conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import {GENESIS_EPOCH, MAX_CROSSLINK_EPOCHS, ZERO_HASH} from "../../../constants";
=======
import {
ZERO_HASH,
GENESIS_EPOCH, GENESIS_START_SHARD
} from "../../../constants";
>>>>>>>
import {
ZERO_HASH,
GENESIS_EPOCH, GENESIS_START_SHARD
} from "../../../constants";
<<<<<<<
const shardAttestations = getMatchingSourceAttestations(state, epoch)
.filter((a) => a.data.shard === shard);
const shardCrosslinks = shardAttestations
.map((a) => getCrosslinkFromAttestationData(state, a.data));
const currentCrosslinkRoot = hashTreeRoot(state.currentCrosslinks[shard], Crosslink);
const candidateCrosslinks = shardCrosslinks.filter((c) => (
currentCrosslinkRoot.equals(c.previousCrosslinkRoot) ||
currentCrosslinkRoot.equals(hashTreeRoot(c, Crosslink))
));
=======
>>>>>>>
<<<<<<<
const getAttestationsFor = (crosslink: Crosslink) =>
shardAttestations.filter((a) =>
equals(getCrosslinkFromAttestationData(state, a.data), crosslink, Crosslink)
);
=======
>>>>>>> |
<<<<<<<
public url: string;
public beacon: IBeaconApi;
=======
public beacon!: IBeaconApi;
>>>>>>>
public url: string;
public beacon!: IBeaconApi;
<<<<<<<
public constructor(opts: RpcClientOverWsOpts, {config}: {config: IBeaconConfig}) {
=======
private rpcUrl: string;
public constructor(opts: IRpcClientOverWsOpts, {config}: {config: IBeaconConfig}) {
>>>>>>>
public constructor(opts: IRpcClientOverWsOpts, {config}: {config: IBeaconConfig}) { |
<<<<<<<
import varint from "varint";
import StrictEventEmitter from "strict-event-emitter-types";
import {
RequestBody, ResponseBody,
Hello, Goodbye,
BeaconBlocksByRangeRequest, BeaconBlocksByRangeResponse,
BeaconBlocksByRootRequest, BeaconBlocksByRootResponse,
} from "@chainsafe/eth2.0-types";
import {serialize, deserialize} from "@chainsafe/ssz";
=======
import * as varint from "varint";
import {
BeaconBlocksRequest,
BeaconBlocksResponse,
Goodbye,
Hello,
RecentBeaconBlocksRequest,
RecentBeaconBlocksResponse,
RequestBody,
ResponseBody
} from "@chainsafe/eth2.0-types";
import {deserialize, serialize} from "@chainsafe/ssz";
>>>>>>>
import * as varint from "varint";
import {
RequestBody, ResponseBody,
Hello, Goodbye,
BeaconBlocksByRangeRequest, BeaconBlocksByRangeResponse,
BeaconBlocksByRootRequest, BeaconBlocksByRootResponse,
} from "@chainsafe/eth2.0-types";
import {serialize, deserialize} from "@chainsafe/ssz";
<<<<<<<
responseListener = (err, output): void => {
=======
responseListener = (err: Error|null, output: ResponseBody): void => {
this.logger.debug("response", {
method,
requestId,
});
>>>>>>>
responseListener = (err: Error|null, output: ResponseBody): void => {
<<<<<<<
public sendResponse(id: RequestId, err: Error, body: ResponseBody): void {
// @ts-ignore
this.emit(createResponseEvent(id), err, body);
}
public async hello(peerInfo: PeerInfo, request: Hello): Promise<Hello> {
return await this.sendRequest<Hello>(peerInfo, Method.Hello, request);
}
public async goodbye(peerInfo: PeerInfo, request: Goodbye): Promise<void> {
await this.sendRequest<Goodbye>(peerInfo, Method.Goodbye, request, true);
}
public async beaconBlocksByRange(peerInfo: PeerInfo, request: BeaconBlocksByRangeRequest): Promise<BeaconBlocksByRangeResponse> {
return await this.sendRequest<BeaconBlocksByRangeResponse>(peerInfo, Method.BeaconBlocksByRange, request);
}
public async beaconBlocksByRoot(peerInfo: PeerInfo, request: BeaconBlocksByRootRequest): Promise<BeaconBlocksByRootResponse> {
return await this.sendRequest<BeaconBlocksByRootResponse>(peerInfo, Method.BeaconBlocksByRoot, request);
}
=======
>>>>>>>
public sendResponse(id: RequestId, err: Error, body: ResponseBody): void {
// @ts-ignore
this.emit(createResponseEvent(id), err, body);
}
public async hello(peerInfo: PeerInfo, request: Hello): Promise<Hello> {
return await this.sendRequest<Hello>(peerInfo, Method.Hello, request);
}
public async goodbye(peerInfo: PeerInfo, request: Goodbye): Promise<void> {
await this.sendRequest<Goodbye>(peerInfo, Method.Goodbye, request, true);
}
public async beaconBlocksByRange(peerInfo: PeerInfo, request: BeaconBlocksByRangeRequest): Promise<BeaconBlocksByRangeResponse> {
return await this.sendRequest<BeaconBlocksByRangeResponse>(peerInfo, Method.BeaconBlocksByRange, request);
}
public async beaconBlocksByRoot(peerInfo: PeerInfo, request: BeaconBlocksByRootRequest): Promise<BeaconBlocksByRootResponse> {
return await this.sendRequest<BeaconBlocksByRootResponse>(peerInfo, Method.BeaconBlocksByRoot, request);
} |
<<<<<<<
limit: params.MAX_DEPOSITS,
})],
["voluntaryExits", new ListType({
elementType: ssz.VoluntaryExit,
limit: params.MAX_VOLUNTARY_EXITS,
})],
=======
maxLength: params.MAX_DEPOSITS,
}],
["voluntaryExits", {
elementType: ssz.SignedVoluntaryExit,
maxLength: params.MAX_VOLUNTARY_EXITS,
}],
>>>>>>>
limit: params.MAX_DEPOSITS,
})],
["voluntaryExits", new ListType({
elementType: ssz.SignedVoluntaryExit,
limit: params.MAX_VOLUNTARY_EXITS,
})], |
<<<<<<<
try {
const data = await assembleAttestationData(config, db, state, headBlock, slot, index);
return {
aggregationBits,
data,
signature: undefined
};
} catch (e) {
throw e;
}
=======
const custodyBits = getEmptyBitList(committee.length);
const data = await assembleAttestationData(config, db, state, headBlock, shard);
return {
aggregationBits,
custodyBits,
data,
signature: undefined
};
>>>>>>>
const data = await assembleAttestationData(config, db, state, headBlock, slot, index);
return {
aggregationBits,
data,
signature: undefined
}; |
<<<<<<<
import {Bucket, DB_PREFIX_LENGTH, encodeKey, IDatabaseApiOptions, uintLen} from "@chainsafe/lodestar-db";
import {BLSPubkey, SlashingProtectionBlock, Slot} from "@chainsafe/lodestar-types";
import {bytesToInt, intToBytes} from "@chainsafe/lodestar-utils";
=======
import {BLSPubkey, phase0, Slot} from "@chainsafe/lodestar-types";
import {intToBytes, bytesToInt} from "@chainsafe/lodestar-utils";
import {Bucket, encodeKey, IDatabaseApiOptions, bucketLen, uintLen} from "@chainsafe/lodestar-db";
>>>>>>>
import {BLSPubkey, phase0, Slot} from "@chainsafe/lodestar-types";
import {intToBytes, bytesToInt} from "@chainsafe/lodestar-utils";
import {Bucket, DB_PREFIX_LENGTH, encodeKey, IDatabaseApiOptions, uintLen} from "@chainsafe/lodestar-db"; |
<<<<<<<
=======
import {equals, signingRoot} from "@chainsafe/ssz";
import {verify} from "@chainsafe/bls";
>>>>>>>
<<<<<<<
assert(isValidProposerSlashing(config, state, proposerSlashing));
=======
const proposer = state.validators[proposerSlashing.proposerIndex];
const header1Epoch = computeEpochOfSlot(config, proposerSlashing.header1.slot);
const header2Epoch = computeEpochOfSlot(config, proposerSlashing.header2.slot);
// Verify that the epoch is the same
assert(header1Epoch === header2Epoch);
// But the headers are different
assert(!equals(config.types.BeaconBlockHeader, proposerSlashing.header1, proposerSlashing.header2));
// Check proposer is slashable
assert(isSlashableValidator(proposer, getCurrentEpoch(config, state)));
// Signatures are valid
const proposalData1Verified = !verifySignatures || verify(
proposer.pubkey,
signingRoot(config.types.BeaconBlockHeader, proposerSlashing.header1),
proposerSlashing.header1.signature,
getDomain(config, state, DomainType.BEACON_PROPOSER, header1Epoch),
);
assert(proposalData1Verified);
const proposalData2Verified = !verifySignatures || verify(
proposer.pubkey,
signingRoot(config.types.BeaconBlockHeader, proposerSlashing.header2),
proposerSlashing.header2.signature,
getDomain(config, state, DomainType.BEACON_PROPOSER, header2Epoch),
);
assert(proposalData2Verified);
>>>>>>>
assert(isValidProposerSlashing(config, state, proposerSlashing, verifySignatures)); |
<<<<<<<
this.chain.on("finalizedCheckpoint", this.handleFinalizedCheckpointChores);
this.network.gossip.on("gossip:start", this.handleGossipStart);
this.network.gossip.on("gossip:stop", this.handleGossipStop);
=======
this.chain.forkChoice.on("prune", this.handleFinalizedCheckpointChores);
await this.interopSubnetsTask.start();
>>>>>>>
this.chain.forkChoice.on("prune", this.handleFinalizedCheckpointChores);
this.network.gossip.on("gossip:start", this.handleGossipStart);
this.network.gossip.on("gossip:stop", this.handleGossipStop);
<<<<<<<
this.chain.removeListener("finalizedCheckpoint", this.handleFinalizedCheckpointChores);
this.network.gossip.removeListener("gossip:start", this.handleGossipStart);
this.network.gossip.removeListener("gossip:stop", this.handleGossipStop);
=======
this.chain.forkChoice.removeListener("prune", this.handleFinalizedCheckpointChores);
>>>>>>>
this.chain.forkChoice.removeListener("prune", this.handleFinalizedCheckpointChores);
this.network.gossip.removeListener("gossip:start", this.handleGossipStart);
this.network.gossip.removeListener("gossip:stop", this.handleGossipStop);
<<<<<<<
private handleGossipStart = async (): Promise<void> => {
await this.interopSubnetsTask.start();
};
private handleGossipStop = async (): Promise<void> => {
await this.interopSubnetsTask.stop();
};
private handleFinalizedCheckpointChores = async (finalizedCheckpoint: Checkpoint): Promise<void> => {
new ArchiveBlocksTask(this.config, {db: this.db, logger: this.logger}, finalizedCheckpoint).run();
new ArchiveStatesTask(this.config, {db: this.db, logger: this.logger}, finalizedCheckpoint).run();
=======
private handleFinalizedCheckpointChores = async (finalized: BlockSummary, pruned: BlockSummary[]): Promise<void> => {
new ArchiveBlocksTask(this.config, {db: this.db, logger: this.logger}, finalized, pruned).run();
new ArchiveStatesTask(this.config, {db: this.db, logger: this.logger}, finalized, pruned).run();
>>>>>>>
private handleGossipStart = async (): Promise<void> => {
await this.interopSubnetsTask.start();
};
private handleGossipStop = async (): Promise<void> => {
await this.interopSubnetsTask.stop();
};
private handleFinalizedCheckpointChores = async (finalized: BlockSummary, pruned: BlockSummary[]): Promise<void> => {
new ArchiveBlocksTask(this.config, {db: this.db, logger: this.logger}, finalized, pruned).run();
new ArchiveStatesTask(this.config, {db: this.db, logger: this.logger}, finalized, pruned).run(); |
<<<<<<<
import {
BeaconState,
BLSPubkey,
CommitteeIndex,
Epoch,
FinalityCheckpoints,
Root,
Slot,
ValidatorBalance,
ValidatorIndex,
BeaconCommitteeResponse,
} from "@chainsafe/lodestar-types";
import {ValidatorResponse} from "../../../types/validator";
import {EpochContext} from "@chainsafe/lodestar-beacon-state-transition";
=======
import {BeaconState, Fork} from "@chainsafe/lodestar-types";
>>>>>>>
import {
BeaconState,
BLSPubkey,
CommitteeIndex,
Epoch,
FinalityCheckpoints,
Root,
Slot,
ValidatorBalance,
ValidatorIndex,
BeaconCommitteeResponse,
Fork,
} from "@chainsafe/lodestar-types";
import {ValidatorResponse} from "../../../types/validator";
import {EpochContext} from "@chainsafe/lodestar-beacon-state-transition";
<<<<<<<
getStateFinalityCheckpoints(stateId: StateId): Promise<FinalityCheckpoints | null>;
getStateValidators(stateId: StateId, filters?: IValidatorFilters): Promise<ValidatorResponse[]>;
getStateValidator(stateId: StateId, validatorId: BLSPubkey | ValidatorIndex): Promise<ValidatorResponse | null>;
getStateValidatorBalances(stateId: StateId, indices?: (BLSPubkey | ValidatorIndex)[]): Promise<ValidatorBalance[]>;
getStateCommittes(stateId: StateId, epoch: Epoch, filters?: ICommittesFilters): Promise<BeaconCommitteeResponse[]>;
=======
getFork(stateId: StateId): Promise<Fork | null>;
>>>>>>>
getStateFinalityCheckpoints(stateId: StateId): Promise<FinalityCheckpoints | null>;
getStateValidators(stateId: StateId, filters?: IValidatorFilters): Promise<ValidatorResponse[]>;
getStateValidator(stateId: StateId, validatorId: BLSPubkey | ValidatorIndex): Promise<ValidatorResponse | null>;
getStateValidatorBalances(stateId: StateId, indices?: (BLSPubkey | ValidatorIndex)[]): Promise<ValidatorBalance[]>;
getStateCommittes(stateId: StateId, epoch: Epoch, filters?: ICommittesFilters): Promise<BeaconCommitteeResponse[]>;
getFork(stateId: StateId): Promise<Fork | null>; |
<<<<<<<
LIGHTCLIENT_PATCH_FORK_SLOT: "99999999999",
HF1_INACTIVITY_PENALTY_QUOTIENT: 50331648,
HF1_MIN_SLASHING_PENALTY_QUOTIENT: 64,
HF1_PROPORTIONAL_SLASHING_MULTIPLIER: 2,
=======
LIGHTCLIENT_PATCH_FORK_SLOT: "0xffffffffffffffff",
>>>>>>>
HF1_INACTIVITY_PENALTY_QUOTIENT: 50331648,
HF1_MIN_SLASHING_PENALTY_QUOTIENT: 64,
HF1_PROPORTIONAL_SLASHING_MULTIPLIER: 2,
LIGHTCLIENT_PATCH_FORK_SLOT: "0xffffffffffffffff", |
<<<<<<<
import {isDirectory} from "./util";
import {basename, join} from "path";
=======
import {isDirectory, objectToCamelCase} from "./util";
import {basename, parse, join} from "path";
import {describe, it} from "mocha";
>>>>>>>
import {isDirectory, objectToCamelCase} from "./util";
import {basename, parse, join} from "path";
import {describe, it} from "mocha";
import {isDirectory} from "./util";
import {basename, join} from "path";
<<<<<<<
import {describe, it} from "mocha";
import {loadYamlFile} from "@chainsafe/eth2.0-utils";
=======
import {transformType} from "./transform";
>>>>>>>
import {transformType} from "./transform";
import {describe, it} from "mocha";
import {loadYamlFile} from "@chainsafe/eth2.0-utils"; |
<<<<<<<
import * as mediaTypeParser from 'media-type';
import { HandleFunction } from 'connect';
=======
>>>>>>>
import * as mediaTypeParser from 'media-type'; |
<<<<<<<
export * from "./subscriptions";
export * from "./security";
=======
export * from "./subscriptions";
export * from "./sites";
export * from "./insights";
>>>>>>>
export * from "./subscriptions";
export * from "./security";
export * from "./sites";
export * from "./insights"; |
<<<<<<<
import { ISecurityMethods, Security } from "./security";
=======
import { ISitesMethods, Sites } from "./sites";
>>>>>>>
import { ISecurityMethods, Security } from "./security";
import { ISitesMethods, Sites } from "./sites";
<<<<<<<
public get security(): ISecurityMethods {
return new Security(this);
}
=======
public get sites(): ISitesMethods {
return new Sites(this);
}
>>>>>>>
public get security(): ISecurityMethods {
return new Security(this);
}
public get sites(): ISitesMethods {
return new Sites(this);
} |
<<<<<<<
import { stringIsNullOrEmpty } from "@pnp/common";
=======
import getValidUser from "./utilities/getValidUser";
>>>>>>>
import { stringIsNullOrEmpty } from "@pnp/common";
import getValidUser from "./utilities/getValidUser"; |
<<<<<<<
import {
User as IUser,
Message as IMessage,
} from "@microsoft/microsoft-graph-types";
import { Messages, MailboxSettings, MailFolders } from "./messages";
=======
import { DirectoryObjects } from "./directoryobjects";
import { User as IUser } from "@microsoft/microsoft-graph-types";
>>>>>>>
import {
User as IUser,
Message as IMessage,
} from "@microsoft/microsoft-graph-types";
import { Messages, MailboxSettings, MailFolders } from "./messages";
import { DirectoryObjects } from "./directoryobjects"; |
<<<<<<<
public async handleIntent(requestedIntent: intent, ...args: any[]) {
const [currentState, contextStates] = await Promise.all([this.getCurrentState(), this.getContextStates()]);
const intentMethod = this.deriveIntentMethod(requestedIntent);
=======
public async handleIntent(requestedIntent: intent, ...args: any[]) {
const currentState = await this.getCurrentState();
const intentMethod = this.deriveIntentMethod(requestedIntent);
>>>>>>>
public async handleIntent(requestedIntent: intent, ...args: any[]) {
const [currentState, contextStates] = await Promise.all([this.getCurrentState(), this.getContextStates()]);
const intentMethod = this.deriveIntentMethod(requestedIntent);
<<<<<<<
/* Check if there is a "beforeIntent_" method available */
if ("beforeIntent_" in currentState.instance) {
const callbackResult = await Promise.resolve(((currentState.instance as any) as State.BeforeIntent).beforeIntent_(intentMethod, this, ...args));
=======
// Check if there is a "beforeIntent_" method available
if (this.isStateWithBeforeIntent(currentState.instance)) {
const callbackResult = await Promise.resolve(currentState.instance.beforeIntent_(intentMethod, this, ...args));
>>>>>>>
// Check if there is a "beforeIntent_" method available
if (this.isStateWithBeforeIntent(currentState.instance)) {
const callbackResult = await Promise.resolve(currentState.instance.beforeIntent_(intentMethod, this, ...args));
<<<<<<<
/* Call afterIntent_ method if present */
if ("afterIntent_" in currentState.instance) {
((currentState.instance as any) as State.AfterIntent).afterIntent_(intentMethod, this, ...args);
=======
// Call afterIntent_ method if present
if (this.isStateWithAfterIntent(currentState.instance)) {
currentState.instance.afterIntent_(intentMethod, this, ...args);
>>>>>>>
// Call afterIntent_ method if present
if (this.isStateWithAfterIntent(currentState.instance)) {
currentState.instance.afterIntent_(intentMethod, this, ...args);
<<<<<<<
private retrieveStayInContextCallbackFromMetadata(currentStateClass: State.Constructor): ((...args: any[]) => boolean) | undefined {
const metadata = Reflect.getMetadata(stayInContextMetadataKey, currentStateClass);
return metadata ? metadata.stayInContext : undefined;
}
private retrieveClearContextCallbackFromMetadata(currentStateClass: State.Constructor): ((...args: any[]) => boolean) | undefined {
const metadata = Reflect.getMetadata(clearContextMetadataKey, currentStateClass);
return metadata ? metadata.clearContext : undefined;
}
=======
/** Type Guards */
private isStateWithBeforeIntent(state: State.Required | State.Required & State.BeforeIntent): state is State.Required & State.BeforeIntent {
return "beforeIntent_" in state;
}
private isStateWithAfterIntent(state: State.Required | State.Required & State.AfterIntent): state is State.Required & State.AfterIntent {
return "afterIntent_" in state;
}
private isStateWithErrorFallback(state: State.Required | State.Required & State.ErrorHandler): state is State.Required & State.ErrorHandler {
return "errorFallback" in state;
}
>>>>>>>
private retrieveStayInContextCallbackFromMetadata(currentStateClass: State.Constructor): ((...args: any[]) => boolean) | undefined {
const metadata = Reflect.getMetadata(stayInContextMetadataKey, currentStateClass);
return metadata ? metadata.stayInContext : undefined;
}
private retrieveClearContextCallbackFromMetadata(currentStateClass: State.Constructor): ((...args: any[]) => boolean) | undefined {
const metadata = Reflect.getMetadata(clearContextMetadataKey, currentStateClass);
return metadata ? metadata.clearContext : undefined;
/** Type Guards */
private isStateWithBeforeIntent(state: State.Required | State.Required & State.BeforeIntent): state is State.Required & State.BeforeIntent {
return "beforeIntent_" in state;
}
private isStateWithAfterIntent(state: State.Required | State.Required & State.AfterIntent): state is State.Required & State.AfterIntent {
return "afterIntent_" in state;
}
private isStateWithErrorFallback(state: State.Required | State.Required & State.ErrorHandler): state is State.Required & State.ErrorHandler {
return "errorFallback" in state;
} |
<<<<<<<
import { OptionalExtractions, MinimalRequestExtraction } from "../unifier/public-interfaces";
=======
>>>>>>>
import { OptionalExtractions, MinimalRequestExtraction } from "../unifier/public-interfaces";
<<<<<<<
@inject("core:root:current-logger") public logger: Logger,
@inject("core:i18n:interpolation-resolver") public interpolationResolver: InterpolationResolver
) {}
async t(key?: string, locals?: {});
async t(key: {});
async t(key?: string | {}, locals = {}) {
=======
@inject("core:root:current-logger") public logger: Logger
) {}
public t(key?: string, locals?: {});
public t(key: {});
public t(key?: string | {}, locals = {}) {
>>>>>>>
@inject("core:root:current-logger") public logger: Logger,
@inject("core:i18n:interpolation-resolver") public interpolationResolver: InterpolationResolver
) {}
async t(key?: string, locals?: {});
async t(key: {});
async t(key?: string | {}, locals = {}) {
<<<<<<<
const options = Object.assign({ lng: this.extraction.language, returnObjectTrees: false }, locals);
=======
const options = { lng: this.extraction.language, returnObjectTrees: false, ...locals};
>>>>>>>
const options = { ...{ lng: this.extraction.language, returnObjectTrees: false }, ...locals };
<<<<<<<
for (let lookup of lookups) {
if (this.i18n.exists(lookup, options)) {
let translation = this.i18n.t(lookup, options);
=======
lookups.some(lookup => {
if (typeof foundTranslation === "undefined" && this.i18n.exists(lookup, options)) {
const translation = this.i18n.t(lookup, options);
>>>>>>>
for (let lookup of lookups) {
if (this.i18n.exists(lookup, options)) {
let translation = this.i18n.t(lookup, options); |
<<<<<<<
import { MissingInterpolationExtension } from "../../../src/assistant-source";
import { injectable } from "inversify";
import { Container } from "inversify-components";
import { I18nextWrapper } from "../../../src/components/i18n/wrapper";
import { componentInterfaces } from "../../../src/components/i18n/component-interfaces";
import { TranslateHelper } from "../../../src/components/i18n/translate-helper";
interface CurrentThisContext {
container: Container;
missingInterpolationExtension: MissingInterpolationExtension;
translateHelper: TranslateHelper;
}
=======
import { configureI18nLocale } from "../../support/util/i18n-configuration";
import { createRequestScope } from "../../support/util/setup";
>>>>>>>
import { MissingInterpolationExtension } from "../../../src/assistant-source";
import { injectable } from "inversify";
import { Container } from "inversify-components";
import { I18nextWrapper } from "../../../src/components/i18n/wrapper";
import { componentInterfaces } from "../../../src/components/i18n/component-interfaces";
import { TranslateHelper } from "../../../src/components/i18n/translate-helper";
import { configureI18nLocale } from "../../support/util/i18n-configuration";
import { createRequestScope } from "../../support/util/setup";
interface CurrentThisContext {
container: Container;
missingInterpolationExtension: MissingInterpolationExtension;
translateHelper: TranslateHelper;
}
<<<<<<<
it("supports template syntax", async function() {
expect(["Can I help you, Sir?", "May I help you, Sir?", "Would you like me to help you?"]).toContain(
await this.translateHelper.t("templateSyntax", { var: "Sir" })
);
=======
it("supports template syntax", function() {
expect(["Can I help you, Sir?", "May I help you, Sir?", "Would you like me to help you?"]).toContain(
this.translateHelper.t("templateSyntax", { var: "Sir" })
);
>>>>>>>
it("supports template syntax", async function() {
expect(["Can I help you, Sir?", "May I help you, Sir?", "Would you like me to help you?"]).toContain(
await this.translateHelper.t("templateSyntax", { var: "Sir" })
);
<<<<<<<
it("returns platform-specific translation for intent", async function() {
this.context.intent = "platformSpecificIntent";
expect(await this.translateHelper.t()).toEqual("platform-specific-intent");
=======
it("returns platform-specific translation for intent", function() {
this.context.intent = "platformSpecificIntent";
expect(this.translateHelper.t()).toEqual("platform-specific-intent");
>>>>>>>
it("returns platform-specific translation for intent", async function() {
this.context.intent = "platformSpecificIntent";
expect(await this.translateHelper.t()).toEqual("platform-specific-intent");
<<<<<<<
it("returns platform-specific translation for intent", async function() {
this.context.intent = "secondPlatformSpecificIntent";
expect(await this.translateHelper.t()).toEqual("root-platform-specific-intent");
=======
it("returns platform-specific translation for intent", function() {
this.context.intent = "secondPlatformSpecificIntent";
expect(this.translateHelper.t()).toEqual("root-platform-specific-intent");
>>>>>>>
it("returns platform-specific translation for intent", async function() {
this.context.intent = "secondPlatformSpecificIntent";
expect(await this.translateHelper.t()).toEqual("root-platform-specific-intent"); |
<<<<<<<
import { OptionalExtractions, MinimalRequestExtraction } from "../unifier/public-interfaces";
=======
>>>>>>>
<<<<<<<
import { featureIsAvailable } from "../unifier/feature-checker";
=======
import { featureIsAvailable } from "../unifier/feature-checker";
import { MinimalRequestExtraction, OptionalExtractions } from "../unifier/public-interfaces";
>>>>>>>
import { featureIsAvailable } from "../unifier/feature-checker";
import { MinimalRequestExtraction, OptionalExtractions } from "../unifier/public-interfaces";
<<<<<<<
const options = Object.assign({ lng: this.extraction.language, returnObjectTrees: false }, locals);
=======
const options = { lng: this.extraction.language, returnObjectTrees: false, ...locals};
>>>>>>>
const options = { lng: this.extraction.language, returnObjectTrees: false, ...locals };
<<<<<<<
const device = featureIsAvailable<OptionalExtractions.Device & MinimalRequestExtraction>(
this.extraction,
OptionalExtractions.FeatureChecker.DeviceExtraction
)
? this.extraction.device
: undefined;
=======
const device = featureIsAvailable<OptionalExtractions.DeviceExtraction>(this.extraction, OptionalExtractions.FeatureChecker.DeviceExtraction)
? this.extraction.device
: undefined;
>>>>>>>
const device = featureIsAvailable<OptionalExtractions.Device & MinimalRequestExtraction>(
this.extraction,
OptionalExtractions.FeatureChecker.DeviceExtraction
)
? this.extraction.device
: undefined; |
<<<<<<<
booleanLiteral,
FlowType,
FunctionDeclaration,
FunctionTypeAnnotation,
FunctionTypeParam,
GenericTypeAnnotation,
Identifier,
identifier,
IntersectionTypeAnnotation,
isEmptyTypeAnnotation,
isExistsTypeAnnotation,
isFlowType,
isFunctionDeclaration,
isIdentifier,
isNumberLiteralTypeAnnotation,
isObjectTypeProperty,
isObjectTypeSpreadProperty,
isTypeAnnotation,
NumberLiteralTypeAnnotation,
numericLiteral,
ObjectTypeAnnotation,
ObjectTypeProperty,
stringLiteral,
StringLiteralTypeAnnotation,
tsAnyKeyword,
tsArrayType,
tsBooleanKeyword,
tsFunctionType,
tsParenthesizedType,
tsIndexedAccessType,
tsIndexSignature,
tsIntersectionType,
tsLiteralType,
tsNeverKeyword,
tsNullKeyword,
tsNumberKeyword,
tsObjectKeyword,
tsPropertySignature,
tsStringKeyword,
tsThisType,
tsTupleType,
TSType,
tsTypeAnnotation,
TSTypeElement,
tsTypeLiteral,
tsTypeOperator,
TSTypeParameterInstantiation,
tsTypeParameterInstantiation,
tsTypeReference,
tsUndefinedKeyword,
tsUnionType,
tsUnknownKeyword,
tsVoidKeyword,
TypeofTypeAnnotation,
TupleTypeAnnotation,
UnionTypeAnnotation,
=======
booleanLiteral,
FlowType,
FunctionDeclaration,
FunctionTypeAnnotation,
FunctionTypeParam,
GenericTypeAnnotation,
Identifier,
identifier,
IntersectionTypeAnnotation,
isAnyTypeAnnotation,
isArrayTypeAnnotation,
isBooleanLiteralTypeAnnotation,
isBooleanTypeAnnotation,
isEmptyTypeAnnotation,
isExistsTypeAnnotation,
isFlowType,
isFunctionDeclaration,
isFunctionTypeAnnotation,
isGenericTypeAnnotation,
isIdentifier,
isIntersectionTypeAnnotation,
isMixedTypeAnnotation,
isNullableTypeAnnotation,
isNullLiteralTypeAnnotation,
isNumberLiteralTypeAnnotation,
isNumberTypeAnnotation,
isObjectTypeAnnotation,
isObjectTypeProperty,
isObjectTypeSpreadProperty,
isStringLiteralTypeAnnotation,
isStringTypeAnnotation,
isThisTypeAnnotation,
isTupleTypeAnnotation,
isTypeAnnotation,
isTypeofTypeAnnotation,
isUnionTypeAnnotation,
isVoidTypeAnnotation,
NumberLiteralTypeAnnotation,
numericLiteral,
ObjectTypeAnnotation,
ObjectTypeProperty,
stringLiteral,
StringLiteralTypeAnnotation,
tsAnyKeyword,
tsArrayType,
tsBooleanKeyword,
tsFunctionType,
tsIndexedAccessType,
tsIndexSignature,
tsIntersectionType,
tsLiteralType,
tsNeverKeyword,
tsNullKeyword,
tsNumberKeyword,
tsObjectKeyword,
tsPropertySignature,
tsStringKeyword,
tsThisType,
tsTupleType,
TSType,
tsTypeAnnotation,
TSTypeElement,
tsTypeLiteral,
tsTypeOperator,
TSTypeParameterInstantiation,
tsTypeParameterInstantiation,
tsTypeReference,
tsUndefinedKeyword,
tsUnionType,
tsUnknownKeyword,
tsVoidKeyword,
TupleTypeAnnotation,
TypeofTypeAnnotation,
>>>>>>>
booleanLiteral,
FlowType,
FunctionDeclaration,
FunctionTypeAnnotation,
FunctionTypeParam,
GenericTypeAnnotation,
Identifier,
identifier,
IntersectionTypeAnnotation,
isEmptyTypeAnnotation,
isExistsTypeAnnotation,
isFlowType,
isFunctionDeclaration,
isIdentifier,
isNumberLiteralTypeAnnotation,
isObjectTypeProperty,
isObjectTypeSpreadProperty,
isTypeAnnotation,
NumberLiteralTypeAnnotation,
numericLiteral,
ObjectTypeAnnotation,
ObjectTypeProperty,
stringLiteral,
StringLiteralTypeAnnotation,
tsAnyKeyword,
tsArrayType,
tsBooleanKeyword,
tsFunctionType,
tsParenthesizedType,
tsIndexedAccessType,
tsIndexSignature,
tsIntersectionType,
tsLiteralType,
tsNeverKeyword,
tsNullKeyword,
tsNumberKeyword,
tsObjectKeyword,
tsPropertySignature,
tsStringKeyword,
tsThisType,
tsTupleType,
TSType,
tsTypeAnnotation,
TSTypeElement,
tsTypeLiteral,
tsTypeOperator,
TSTypeParameterInstantiation,
tsTypeParameterInstantiation,
tsTypeReference,
tsUndefinedKeyword,
tsUnionType,
tsUnknownKeyword,
tsVoidKeyword,
TypeofTypeAnnotation,
<<<<<<<
import { UnsupportedError, warnOnlyOnce } from '../util';
import { convertFlowIdentifier } from './convert_flow_identifier';
=======
import { isNodePath, UnsupportedError, warnOnlyOnce } from '../util';
import { convertFlowIdentifier } from './convert_flow_identifier';
>>>>>>>
import { UnsupportedError, warnOnlyOnce } from '../util';
import { convertFlowIdentifier } from './convert_flow_identifier';
<<<<<<<
// var x: X<?T> -> var x: X<T | null | undefined>
// var x:?T -> var x:T | null | undefined
return tsUnionType([tsT, tsUndefinedKeyword(), tsNullKeyword()]);
}
if (path.isNullLiteralTypeAnnotation()) {
return tsNullKeyword();
}
if (isNumberLiteralTypeAnnotation(path)) {
return tsLiteralType(
numericLiteral((path as NodePath<NumberLiteralTypeAnnotation>).node.value!),
);
}
if (path.isNumberTypeAnnotation()) {
return tsNumberKeyword();
}
if (path.isObjectTypeAnnotation()) {
const members: TSTypeElement[] = [];
const spreads: TSType[] = [];
const objectTypeNode = path.node as ObjectTypeAnnotation;
if (objectTypeNode.exact) {
warnOnlyOnce(
"Exact object type annotation in Flow is ignored. In TypeScript, it's always regarded as exact type",
);
objectTypeNode.exact = false;
=======
// var x: X<?T> -> var x: X<T | null | undefined>
// var x:?T -> var x:T | null | undefined
return tsUnionType([tsT, tsUndefinedKeyword(), tsNullKeyword()]);
}
if (isNodePath(isNullLiteralTypeAnnotation, path)) {
return tsNullKeyword();
}
if (isNodePath(isNumberLiteralTypeAnnotation, path)) {
return tsLiteralType(
numericLiteral((path as NodePath<NumberLiteralTypeAnnotation>).node.value!),
);
}
if (isNodePath(isNumberTypeAnnotation, path)) {
return tsNumberKeyword();
}
if (isNodePath(isObjectTypeAnnotation, path)) {
const members: TSTypeElement[] = [];
const spreads: TSType[] = [];
const objectTypeNode = path.node as ObjectTypeAnnotation;
if (objectTypeNode.exact) {
warnOnlyOnce(
"Exact object type annotation in Flow is ignored. In TypeScript, it's always regarded as exact type",
);
objectTypeNode.exact = false;
>>>>>>>
// var x: X<?T> -> var x: X<T | null | undefined>
// var x:?T -> var x:T | null | undefined
return tsUnionType([tsT, tsUndefinedKeyword(), tsNullKeyword()]);
}
if (path.isNullLiteralTypeAnnotation()) {
return tsNullKeyword();
}
if (isNumberLiteralTypeAnnotation(path)) {
return tsLiteralType(
numericLiteral((path as NodePath<NumberLiteralTypeAnnotation>).node.value!),
);
}
if (path.isNumberTypeAnnotation()) {
return tsNumberKeyword();
}
if (path.isObjectTypeAnnotation()) {
const members: TSTypeElement[] = [];
const spreads: TSType[] = [];
const objectTypeNode = path.node as ObjectTypeAnnotation;
if (objectTypeNode.exact) {
warnOnlyOnce(
"Exact object type annotation in Flow is ignored. In TypeScript, it's always regarded as exact type",
);
objectTypeNode.exact = false;
<<<<<<<
return ret;
}
if (path.isStringLiteralTypeAnnotation()) {
return tsLiteralType(
stringLiteral((path as NodePath<StringLiteralTypeAnnotation>).node.value!),
);
}
if (path.isStringTypeAnnotation()) {
return tsStringKeyword();
}
if (path.isThisTypeAnnotation()) {
return tsThisType();
}
if (path.isTypeofTypeAnnotation()) {
const typeOp = tsTypeOperator(
convertFlowType((path as NodePath<TypeofTypeAnnotation>).get('argument')),
);
typeOp.operator = 'typeof';
return typeOp;
}
if (path.isUnionTypeAnnotation()) {
const flowTypes = (path as NodePath<UnionTypeAnnotation>).node.types;
return tsUnionType(
flowTypes.map((_, i) => convertFlowType(path.get(`types.${i}`) as NodePath<FlowType>)),
);
}
if (path.isVoidTypeAnnotation()) {
return tsVoidKeyword();
}
if (path.isFunctionTypeAnnotation()) {
const nodePath = path as NodePath<FunctionTypeAnnotation>;
const identifiers = path.node.params.map((p, i) => {
const name = (p.name && p.name.name) || `x${i}`;
const ftParam = nodePath.get(`params.${i}`) as NodePath<FunctionTypeParam>;
const typeAnn = ftParam.get('typeAnnotation') as NodePath<FlowType>;
const iden = identifier(name);
iden.optional = p.optional;
iden.typeAnnotation = tsTypeAnnotation(convertFlowType(typeAnn));
return iden;
});
const returnType = tsTypeAnnotation(convertFlowType(nodePath.get('returnType')));
const tsFT = tsFunctionType(null, [], returnType);
tsFT.parameters = identifiers;
return tsParenthesizedType(tsFT);
}
if (path.isTupleTypeAnnotation()) {
const flowTypes = (path as NodePath<TupleTypeAnnotation>).node.types;
return tsTupleType(
flowTypes.map((_, i) => convertFlowType(path.get(`types.${i}`) as NodePath<FlowType>)),
);
}
throw new UnsupportedError(`FlowType(type=${path.node.type})`);
=======
return ret;
}
if (isNodePath(isStringLiteralTypeAnnotation, path)) {
return tsLiteralType(
stringLiteral((path as NodePath<StringLiteralTypeAnnotation>).node.value!),
);
}
if (isNodePath(isStringTypeAnnotation, path)) {
return tsStringKeyword();
}
if (isNodePath(isThisTypeAnnotation, path)) {
return tsThisType();
}
if (isNodePath(isTypeofTypeAnnotation, path)) {
const typeOp = tsTypeOperator(
convertFlowType((path as NodePath<TypeofTypeAnnotation>).get('argument')),
);
typeOp.operator = 'typeof';
return typeOp;
}
if (isNodePath(isUnionTypeAnnotation, path)) {
const flowTypes = path.node.types;
return tsUnionType(
flowTypes.map((_, i) => convertFlowType(path.get(`types.${i}`) as NodePath<FlowType>)),
);
}
if (isNodePath(isVoidTypeAnnotation, path)) {
return tsVoidKeyword();
}
if (isNodePath(isFunctionTypeAnnotation, path)) {
const nodePath = path as NodePath<FunctionTypeAnnotation>;
const identifiers = path.node.params.map((p, i) => {
const name = (p.name && p.name.name) || `x${i}`;
const ftParam = nodePath.get(`params.${i}`) as NodePath<FunctionTypeParam>;
const typeAnn = ftParam.get('typeAnnotation') as NodePath<FlowType>;
const iden = identifier(name);
iden.typeAnnotation = tsTypeAnnotation(convertFlowType(typeAnn));
return iden;
});
const returnType = tsTypeAnnotation(convertFlowType(nodePath.get('returnType')));
const tsFT = tsFunctionType(null, identifiers, returnType);
return tsFT;
}
if (isNodePath(isTupleTypeAnnotation, path)) {
const flowTypes = (path as NodePath<TupleTypeAnnotation>).node.types;
return tsTupleType(
flowTypes.map((_, i) =>
convertFlowType((path as NodePath<TupleTypeAnnotation>).get(`types.${i}`) as NodePath<
FlowType
>),
),
);
}
throw new UnsupportedError(`FlowType(type=${path.node.type})`);
>>>>>>>
return ret;
}
if (path.isStringLiteralTypeAnnotation()) {
return tsLiteralType(
stringLiteral((path as NodePath<StringLiteralTypeAnnotation>).node.value!),
);
}
if (path.isStringTypeAnnotation()) {
return tsStringKeyword();
}
if (path.isThisTypeAnnotation()) {
return tsThisType();
}
if (path.isTypeofTypeAnnotation()) {
const typeOp = tsTypeOperator(
convertFlowType((path as NodePath<TypeofTypeAnnotation>).get('argument')),
);
typeOp.operator = 'typeof';
return typeOp;
}
if (path.isUnionTypeAnnotation()) {
const flowTypes = path.node.types;
return tsUnionType(
flowTypes.map((_, i) => convertFlowType(path.get(`types.${i}`) as NodePath<FlowType>)),
);
}
if (path.isVoidTypeAnnotation()) {
return tsVoidKeyword();
}
if (path.isFunctionTypeAnnotation()) {
const nodePath = path as NodePath<FunctionTypeAnnotation>;
const identifiers = path.node.params.map((p, i) => {
const name = (p.name && p.name.name) || `x${i}`;
const ftParam = nodePath.get(`params.${i}`) as NodePath<FunctionTypeParam>;
const typeAnn = ftParam.get('typeAnnotation') as NodePath<FlowType>;
const iden = identifier(name);
iden.optional = p.optional;
iden.typeAnnotation = tsTypeAnnotation(convertFlowType(typeAnn));
return iden;
});
const returnType = tsTypeAnnotation(convertFlowType(nodePath.get('returnType')));
const tsFT = tsFunctionType(null, [], returnType);
tsFT.parameters = identifiers;
return tsParenthesizedType(tsFT);
}
if (path.isTupleTypeAnnotation()) {
const flowTypes = path.node.types;
return tsTupleType(
flowTypes.map((_, i) => convertFlowType(path.get(`types.${i}`) as NodePath<FlowType>)),
);
}
throw new UnsupportedError(`FlowType(type=${path.node.type})`); |
<<<<<<<
UnionTypeAnnotation,
isQualifiedTypeIdentifier,
tsQualifiedName,
TSEntityName,
TSQualifiedName
=======
UnionTypeAnnotation,
TupleTypeAnnotation,
FunctionTypeAnnotation,
restElement
>>>>>>>
UnionTypeAnnotation,
isQualifiedTypeIdentifier,
tsQualifiedName,
TSEntityName,
TupleTypeAnnotation,
FunctionTypeAnnotation,
restElement |
<<<<<<<
// tslint:disable:no-any
import { ClassMethod, ClassDeclaration } from '@babel/types';
import { NodePath } from '@babel/traverse';
import { convertClassConstructor } from '../converters/convert_class_constructor';
import { convertFlowType } from '../converters/convert_flow_type';
=======
// tslint:disable:no-any
import {
Identifier,
DeclareClass,
ClassMethod,
ClassDeclaration,
ObjectTypeProperty,
classDeclaration,
classBody,
classProperty,
tsDeclareMethod,
tsTypeAnnotation,
} from '@babel/types';
import { NodePath } from '@babel/traverse';
import { warnOnlyOnce } from '../util';
import { convertFlowType } from '../converters/convert_flow_type';
import { convertTypeParameter } from '../converters/convert_type_parameter';
import { convertClassConstructor } from '../converters/convert_class_constructor';
import { convertInterfaceExtends } from '../converters/convert_interface_declaration';
const SYM_MADE_INTERNALLY = Symbol('Class Made Interanally by flow-to-ts');
>>>>>>>
// tslint:disable:no-any
import { NodePath } from '@babel/traverse';
import { convertClassConstructor } from '../converters/convert_class_constructor';
import { convertFlowType } from '../converters/convert_flow_type';
import {
Identifier,
DeclareClass,
ClassMethod,
ClassDeclaration,
ObjectTypeProperty,
classDeclaration,
classBody,
classProperty,
tsDeclareMethod,
tsTypeAnnotation,
} from '@babel/types';
import { warnOnlyOnce } from '../util';
import { convertTypeParameter } from '../converters/convert_type_parameter';
import { convertInterfaceExtends } from '../converters/convert_interface_declaration';
const SYM_MADE_INTERNALLY = Symbol('Class Made Interanally by flow-to-ts');
<<<<<<<
typeParameterPath.node.params = typeParameterPath.node.params.map((_: any, i: number) =>
convertFlowType(typeParameterPath.get(`params.${i}`)),
);
=======
typeParameterPath.node.params = typeParameterPath.node.params.map((_: any, i: number) => {
const paramPath = typeParameterPath.get(`params.${i}`);
if (paramPath.isTypeParameter()) {
return convertTypeParameter(paramPath);
} else {
return convertFlowType(paramPath);
}
});
>>>>>>>
typeParameterPath.node.params = typeParameterPath.node.params.map((_: any, i: number) => {
const paramPath = typeParameterPath.get(`params.${i}`);
if (paramPath.isTypeParameter()) {
return convertTypeParameter(paramPath);
} else {
return convertFlowType(paramPath);
}
});
<<<<<<<
const superTypeParametersPath = path.get('superTypeParameters');
=======
// @ts-ignore
if (path.node[SYM_MADE_INTERNALLY]) {
return;
}
const superTypeParametersPath = path.get('superTypeParameters');
>>>>>>>
// @ts-ignore
if (path.node[SYM_MADE_INTERNALLY]) {
return;
}
const superTypeParametersPath = path.get('superTypeParameters');
<<<<<<<
});
=======
});
}
}
export function DeclareClass(path: NodePath<DeclareClass>) {
const typeParameterPath = path.get('typeParameters');
const extendsPath = path.get('extends');
const propertiesPaths = path.get('body.properties') as NodePath<ObjectTypeProperty>[];
const classProperties: any = [];
propertiesPaths.forEach(propertyPath => {
const property = propertyPath.node;
const convertedProperty = convertFlowType(propertyPath.get('value')) as any;
if ((property as any).method) {
const converted = tsDeclareMethod(
null,
property.key,
null,
(convertedProperty as any).typeAnnotation.parameters,
(convertedProperty as any).typeAnnotation.typeAnnotation,
);
converted.static = property.static;
// @ts-ignore
converted.kind = property.kind;
classProperties.push(converted);
} else if ((property as any).kind === 'init') {
const converted = classProperty(property.key, null, tsTypeAnnotation(convertedProperty));
converted.static = property.static;
classProperties.push(converted);
}
});
const decl = classDeclaration(path.node.id, null, classBody(classProperties), []);
// @ts-ignore
decl[SYM_MADE_INTERNALLY] = true;
decl.declare = true;
if (typeParameterPath.node) {
processTypeParameters(typeParameterPath);
decl.typeParameters = typeParameterPath.node;
}
if (extendsPath.length) {
if (extendsPath.length > 1) {
warnOnlyOnce(
'declare-class-many-parents',
'Declare Class definitions in TS can only have one super class. Dropping extras.',
);
}
const firstExtend = convertInterfaceExtends(extendsPath[0]);
decl.superClass = firstExtend.expression as Identifier;
decl.superTypeParameters = firstExtend.typeParameters;
>>>>>>>
});
}
}
export function DeclareClass(path: NodePath<DeclareClass>) {
const typeParameterPath = path.get('typeParameters');
const extendsPath = path.get('extends');
const propertiesPaths = path.get('body.properties') as NodePath<ObjectTypeProperty>[];
const classProperties: any = [];
propertiesPaths.forEach(propertyPath => {
const property = propertyPath.node;
const convertedProperty = convertFlowType(propertyPath.get('value')) as any;
if ((property as any).method) {
const converted = tsDeclareMethod(
null,
property.key,
null,
(convertedProperty as any).typeAnnotation.parameters,
(convertedProperty as any).typeAnnotation.typeAnnotation,
);
converted.static = property.static;
// @ts-ignore
converted.kind = property.kind;
classProperties.push(converted);
} else if ((property as any).kind === 'init') {
const converted = classProperty(property.key, null, tsTypeAnnotation(convertedProperty));
converted.static = property.static;
classProperties.push(converted);
}
});
const decl = classDeclaration(path.node.id, null, classBody(classProperties), []);
// @ts-ignore
decl[SYM_MADE_INTERNALLY] = true;
decl.declare = true;
if (typeParameterPath.node) {
processTypeParameters(typeParameterPath);
decl.typeParameters = typeParameterPath.node;
}
if (extendsPath.length) {
if (extendsPath.length > 1) {
warnOnlyOnce(
'declare-class-many-parents',
'Declare Class definitions in TS can only have one super class. Dropping extras.',
);
}
const firstExtend = convertInterfaceExtends(extendsPath[0]);
decl.superClass = firstExtend.expression as Identifier;
decl.superTypeParameters = firstExtend.typeParameters; |
<<<<<<<
expect(() => tokenize('Hi {{')).toThrow(
new SyntaxError('Missing }} in the template expression Hi {{')
=======
expect(() => tokenize('Hi {{')).to.throw(
SyntaxError,
'Missing "}}" in the template expression Hi {{'
>>>>>>>
expect(() => tokenize('Hi {{')).toThrow(
new SyntaxError('Missing "}}" in the template expression Hi {{')
<<<<<<<
expect(() => tokenize('Hi {{}}')).toThrow(
new SyntaxError('Unexpected token }}')
=======
expect(() => tokenize('Hi {{}}')).to.throw(
SyntaxError,
'Unexpected "}}" tag found at position 3'
>>>>>>>
expect(() => tokenize('Hi {{}}')).toThrow(
new SyntaxError('Unexpected "}}" tag found at position 3')
<<<<<<<
expect(() => tokenize('Hi {{ }}')).toThrow(
new SyntaxError('Unexpected token }}')
=======
expect(() => tokenize('Hi {{ }}')).to.throw(
SyntaxError,
'Unexpected "}}" tag found at position 3'
>>>>>>>
expect(() => tokenize('Hi {{ }}')).toThrow(
new SyntaxError('Unexpected "}}" tag found at position 3') |
<<<<<<<
<title>WeTTy - The Web Terminal Emulator</title>
<link rel="stylesheet" href="${resourcePath}public/index.css" />
=======
<title>${title}</title>
<link rel="stylesheet" href="${basePath}/public/index.css" />
>>>>>>>
<title>${title}</title>
<link rel="stylesheet" href="${resourcePath}public/index.css" /> |
<<<<<<<
constructor(private $http, private $routeParams, private $location, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'styleguide');
=======
constructor(private $http, private $routeParams, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getAdminNav();
>>>>>>>
constructor(private $http, private $routeParams, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'styleguide'); |
<<<<<<<
import {queryPartEditorDirective} from './components/query_part/query_part_editor';
=======
import {WizardFlow} from './components/wizard/wizard';
>>>>>>>
import {queryPartEditorDirective} from './components/query_part/query_part_editor';
import {WizardFlow} from './components/wizard/wizard';
<<<<<<<
queryPartEditorDirective,
=======
WizardFlow,
>>>>>>>
queryPartEditorDirective,
WizardFlow, |
<<<<<<<
it('should caclculate the correct period', function () {
var hourSec = 60 * 60;
var daySec = hourSec * 24;
var start = 1483196400;
var testData: any[] = [
[{ period: 60 }, { namespace: 'AWS/EC2' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'AWS/EC2' }, {}, start, start + 3600, (hourSec * 3), 300],
[{ period: 60 }, { namespace: 'AWS/ELB' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'AWS/ELB' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: 1 }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 1440 - 1, (hourSec * 3 - 1), 1],
[{ period: 1 }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3 - 1), 60],
[{ period: 60 }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3 - 1), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (daySec * 15), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (daySec * 63), 300],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (daySec * 455), 3600]
];
for (let t of testData) {
let target = t[0];
let query = t[1];
let options = t[2];
let start = t[3];
let end = t[4];
let now = start + t[5];
let expected = t[6];
let actual = ctx.ds.getPeriod(target, query, options, start, end, now);
expect(actual).to.be(expected);
}
});
=======
describeMetricFindQuery('ec2_instance_attribute(us-east-1, Tags.Name, { "tag:team": [ "sysops" ] })', scenario => {
scenario.setup(() => {
scenario.requestResponse = {
Reservations: [
{
Instances: [
{
Tags: [
{ Key: 'InstanceId', Value: 'i-123456' },
{ Key: 'Name', Value: 'Sysops Dev Server' },
{ Key: 'env', Value: 'dev' },
{ Key: 'team', Value: 'sysops' }
]
},
{
Tags: [
{ Key: 'InstanceId', Value: 'i-789012' },
{ Key: 'Name', Value: 'Sysops Staging Server' },
{ Key: 'env', Value: 'staging' },
{ Key: 'team', Value: 'sysops' }
]
}
]
}
]
};
});
it('should return the "Name" tag for each instance', function() {
expect(scenario.result[0].text).to.be('Sysops Dev Server');
expect(scenario.result[1].text).to.be('Sysops Staging Server');
});
});
>>>>>>>
it('should caclculate the correct period', function () {
var hourSec = 60 * 60;
var daySec = hourSec * 24;
var start = 1483196400;
var testData: any[] = [
[{ period: 60 }, { namespace: 'AWS/EC2' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'AWS/EC2' }, {}, start, start + 3600, (hourSec * 3), 300],
[{ period: 60 }, { namespace: 'AWS/ELB' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'AWS/ELB' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: 1 }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 1440 - 1, (hourSec * 3 - 1), 1],
[{ period: 1 }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3 - 1), 60],
[{ period: 60 }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3 - 1), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (hourSec * 3), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (daySec * 15), 60],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (daySec * 63), 300],
[{ period: null }, { namespace: 'CustomMetricsNamespace' }, {}, start, start + 3600, (daySec * 455), 3600]
];
for (let t of testData) {
let target = t[0];
let query = t[1];
let options = t[2];
let start = t[3];
let end = t[4];
let now = start + t[5];
let expected = t[6];
let actual = ctx.ds.getPeriod(target, query, options, start, end, now);
expect(actual).to.be(expected);
}
});
describeMetricFindQuery('ec2_instance_attribute(us-east-1, Tags.Name, { "tag:team": [ "sysops" ] })', scenario => {
scenario.setup(() => {
scenario.requestResponse = {
Reservations: [
{
Instances: [
{
Tags: [
{ Key: 'InstanceId', Value: 'i-123456' },
{ Key: 'Name', Value: 'Sysops Dev Server' },
{ Key: 'env', Value: 'dev' },
{ Key: 'team', Value: 'sysops' }
]
},
{
Tags: [
{ Key: 'InstanceId', Value: 'i-789012' },
{ Key: 'Name', Value: 'Sysops Staging Server' },
{ Key: 'env', Value: 'staging' },
{ Key: 'team', Value: 'sysops' }
]
}
]
}
]
};
});
it('should return the "Name" tag for each instance', function() {
expect(scenario.result[0].text).to.be('Sysops Dev Server');
expect(scenario.result[1].text).to.be('Sysops Staging Server');
});
}); |
<<<<<<<
withCredentials: boolean;
=======
meta?: PluginMeta;
pluginExports?: PluginExports;
init?: () => void;
testDatasource?: () => Promise<any>;
>>>>>>>
withCredentials: boolean;
meta?: PluginMeta;
pluginExports?: PluginExports;
init?: () => void;
testDatasource?: () => Promise<any>; |
<<<<<<<
import NewDataSourcePage from '../features/datasources/NewDataSourcePage';
=======
import UsersListPage from 'app/features/users/UsersListPage';
>>>>>>>
import NewDataSourcePage from '../features/datasources/NewDataSourcePage';
import UsersListPage from 'app/features/users/UsersListPage'; |
<<<<<<<
constructor(private $scope, private backendSrv, private navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'global-users');
=======
constructor(private $scope, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getAdminNav();
>>>>>>>
constructor(private $scope, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'global-users'); |
<<<<<<<
<ng-container *ngIf="error">
<div class="form-alert form-alert-error" [innerHTML]="error?.displayMessage"></div>
=======
<ng-container *ngIf="show">
<div [class.form-bubble]="bubble">
<div class="form-alert form-alert-error" [class.closeable]="closeable">
<a class="form-alert-close" (click)="close()">
<i class="icon-close"></i>
</a>
<div [innerHTML]="error"></div>
</div>
</div>
>>>>>>>
<ng-container *ngIf="show">
<div [class.form-bubble]="bubble">
<div class="form-alert form-alert-error" [class.closeable]="closeable">
<a class="form-alert-close" (click)="close()">
<i class="icon-close"></i>
</a>
<div [innerHTML]="error?.displayMessage"></div>
</div>
</div>
<<<<<<<
public error?: ErrorDto | null;
=======
public error: string | null | undefined;
@Input()
public bubble = false;
@Input()
public closeable = false;
public show: boolean;
public ngOnChanges(changes: SimpleChanges) {
if (changes['error']) {
this.show = !!this.error;
}
}
public close() {
this.show = false;
}
>>>>>>>
public error?: ErrorDto | null;
@Input()
public bubble = false;
@Input()
public closeable = false;
public show: boolean;
public ngOnChanges(changes: SimpleChanges) {
if (changes['error']) {
this.show = !!this.error;
}
}
public close() {
this.show = false;
} |
<<<<<<<
function typeaheadMatcher(item) {
let str = this.query;
=======
function typeaheadMatcher(this: any, item) {
var str = this.query;
>>>>>>>
function typeaheadMatcher(this: any, item) {
let str = this.query; |
<<<<<<<
import { AngularLoader, setAngularLoader } from 'app/core/services/angular_loader';
=======
import { configureStore } from 'app/stores/configureStore';
>>>>>>>
import { AngularLoader, setAngularLoader } from 'app/core/services/angular_loader';
import { configureStore } from 'app/stores/configureStore';
<<<<<<<
// make angular loader service available to react components
setAngularLoader(angularLoader);
=======
// sets singleston instances for angular services so react components can access them
configureStore();
>>>>>>>
// make angular loader service available to react components
setAngularLoader(angularLoader);
// sets singleston instances for angular services so react components can access them
configureStore(); |
<<<<<<<
newItem: types.maybe(NewPermissionsItem),
isAddPermissionsVisible: types.optional(types.boolean, false),
=======
isInRoot: types.maybe(types.boolean),
>>>>>>>
newItem: types.maybe(NewPermissionsItem),
isAddPermissionsVisible: types.optional(types.boolean, false),
isInRoot: types.maybe(types.boolean),
<<<<<<<
.actions(self => {
const resetNewType = () => {
=======
.actions(self => ({
load: flow(function* load(dashboardId: number, isFolder: boolean, isInRoot: boolean) {
const backendSrv = getEnv(self).backendSrv;
self.fetching = true;
self.isFolder = isFolder;
self.isInRoot = isInRoot;
self.dashboardId = dashboardId;
const res = yield backendSrv.get(`/api/dashboards/id/${dashboardId}/acl`);
const items = prepareServerResponse(res, dashboardId, isFolder, isInRoot);
self.items = items;
self.originalItems = items;
self.fetching = false;
self.error = null;
}),
addStoreItem: flow(function* addStoreItem(item) {
>>>>>>>
.actions(self => {
const resetNewType = () => {
<<<<<<<
return {
load: flow(function* load(dashboardId: number, isFolder: boolean) {
const backendSrv = getEnv(self).backendSrv;
self.fetching = true;
self.isFolder = isFolder;
self.dashboardId = dashboardId;
const res = yield backendSrv.get(`/api/dashboards/id/${dashboardId}/acl`);
const items = prepareServerResponse(res, dashboardId, isFolder);
self.items = items;
self.originalItems = items;
self.fetching = false;
}),
addStoreItem: flow(function* addStoreItem() {
self.error = null;
let item = {
type: self.newItem.type,
permission: self.newItem.permission,
team: undefined,
teamId: undefined,
userLogin: undefined,
userId: undefined,
role: undefined,
};
switch (self.newItem.type) {
case aclTypeValues.GROUP.value:
item.team = self.newItem.team;
item.teamId = self.newItem.teamId;
break;
case aclTypeValues.USER.value:
item.userLogin = self.newItem.userLogin;
item.userId = self.newItem.userId;
break;
case aclTypeValues.VIEWER.value:
case aclTypeValues.EDITOR.value:
item.role = self.newItem.type;
break;
default:
throw Error('Unknown type: ' + self.newItem.type);
}
if (!self.isValid(item)) {
throw Error('New item not valid');
}
self.items.push(prepareItem(item, self.dashboardId, self.isFolder));
resetNewType();
return updateItems(self);
}),
removeStoreItem: flow(function* removeStoreItem(idx: number) {
self.error = null;
self.items.splice(idx, 1);
return updateItems(self);
}),
updatePermissionOnIndex: flow(function* updatePermissionOnIndex(
idx: number,
permission: number,
permissionName: string
) {
self.error = null;
self.items[idx].updatePermission(permission, permissionName);
return updateItems(self);
}),
setNewType(newType: string) {
self.newItem = NewPermissionsItem.create({ type: newType });
},
resetNewType() {
resetNewType();
},
toggleAddPermissions() {
self.isAddPermissionsVisible = !self.isAddPermissionsVisible;
},
showAddPermissions() {
self.isAddPermissionsVisible = true;
},
hideAddPermissions() {
self.isAddPermissionsVisible = false;
},
};
});
=======
self.items.push(prepareItem(item, self.dashboardId, self.isFolder, self.isInRoot));
return updateItems(self);
}),
removeStoreItem: flow(function* removeStoreItem(idx: number) {
self.error = null;
self.items.splice(idx, 1);
return updateItems(self);
}),
updatePermissionOnIndex: flow(function* updatePermissionOnIndex(
idx: number,
permission: number,
permissionName: string
) {
self.error = null;
self.items[idx].updatePermission(permission, permissionName);
return updateItems(self);
}),
setNewType(newType: string) {
self.newType = newType;
},
resetNewType() {
self.newType = defaultNewType;
},
}));
>>>>>>>
return {
load: flow(function* load(dashboardId: number, isFolder: boolean, isInRoot: boolean) {
const backendSrv = getEnv(self).backendSrv;
self.fetching = true;
self.isFolder = isFolder;
self.isInRoot = isInRoot;
self.dashboardId = dashboardId;
const res = yield backendSrv.get(`/api/dashboards/id/${dashboardId}/acl`);
const items = prepareServerResponse(res, dashboardId, isFolder, isInRoot);
self.items = items;
self.originalItems = items;
self.fetching = false;
self.error = null;
}),
addStoreItem: flow(function* addStoreItem() {
self.error = null;
let item = {
type: self.newItem.type,
permission: self.newItem.permission,
dashboardId: self.dashboardId,
team: undefined,
teamId: undefined,
userLogin: undefined,
userId: undefined,
role: undefined,
};
switch (self.newItem.type) {
case aclTypeValues.GROUP.value:
item.team = self.newItem.team;
item.teamId = self.newItem.teamId;
break;
case aclTypeValues.USER.value:
item.userLogin = self.newItem.userLogin;
item.userId = self.newItem.userId;
break;
case aclTypeValues.VIEWER.value:
case aclTypeValues.EDITOR.value:
item.role = self.newItem.type;
break;
default:
throw Error('Unknown type: ' + self.newItem.type);
}
if (!self.isValid(item)) {
return undefined;
}
self.items.push(prepareItem(item, self.dashboardId, self.isFolder, self.isInRoot));
resetNewType();
return updateItems(self);
}),
removeStoreItem: flow(function* removeStoreItem(idx: number) {
self.error = null;
self.items.splice(idx, 1);
return updateItems(self);
}),
updatePermissionOnIndex: flow(function* updatePermissionOnIndex(
idx: number,
permission: number,
permissionName: string
) {
self.error = null;
self.items[idx].updatePermission(permission, permissionName);
return updateItems(self);
}),
setNewType(newType: string) {
self.newItem = NewPermissionsItem.create({ type: newType });
},
resetNewType() {
resetNewType();
},
toggleAddPermissions() {
self.isAddPermissionsVisible = !self.isAddPermissionsVisible;
},
showAddPermissions() {
self.isAddPermissionsVisible = true;
},
hideAddPermissions() {
self.isAddPermissionsVisible = false;
},
};
}); |
<<<<<<<
import { RawTimeRange, TimeRange, DataQuery, DataSourceSelectItem, DataSourceApi } from '@grafana/ui/src/types';
=======
import { RawTimeRange, TimeRange, DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types';
>>>>>>>
import { RawTimeRange, TimeRange, DataQuery, DataSourceSelectItem, DataSourceApi } from '@grafana/ui/src/types';
<<<<<<<
UpdateDatasourceInstance = 'explore/UPDATE_DATASOURCE_INSTANCE',
=======
ResetExplore = 'explore/RESET_EXPLORE',
>>>>>>>
UpdateDatasourceInstance = 'explore/UPDATE_DATASOURCE_INSTANCE',
ResetExplore = 'explore/RESET_EXPLORE',
<<<<<<<
export interface UpdateDatasourceInstanceAction {
type: ActionTypes.UpdateDatasourceInstance;
payload: {
exploreId: ExploreId;
datasourceInstance: DataSourceApi;
};
}
=======
export interface ResetExploreAction {
type: ActionTypes.ResetExplore;
payload: {};
}
>>>>>>>
export interface UpdateDatasourceInstanceAction {
type: ActionTypes.UpdateDatasourceInstance;
payload: {
exploreId: ExploreId;
datasourceInstance: DataSourceApi;
};
}
export interface ResetExploreAction {
type: ActionTypes.ResetExplore;
payload: {};
}
<<<<<<<
| ToggleTableAction
| UpdateDatasourceInstanceAction;
=======
| ToggleTableAction
| ResetExploreAction;
>>>>>>>
| ToggleTableAction
| UpdateDatasourceInstanceAction
| ResetExploreAction; |
<<<<<<<
}
declare module 'gridstack' {
var gridstack: any;
export default gridstack;
=======
}
declare module 'gemini-scrollbar' {
var d3: any;
export default d3;
>>>>>>>
}
declare module 'gridstack' {
var gridstack: any;
export default gridstack;
}
declare module 'gemini-scrollbar' {
var d3: any;
export default d3; |
<<<<<<<
configureStore();
=======
// sets singleston instances for angular services so react components can access them
setBackendSrv(backendSrv);
>>>>>>>
// sets singleston instances for angular services so react components can access them
configureStore();
setBackendSrv(backendSrv); |
<<<<<<<
const raw = {
from: moment.utc('2018-04-25 10:00'),
to: moment.utc('2018-04-25 11:00'),
};
const ctx = <any>{
=======
const ctx = {
>>>>>>>
const raw = {
from: moment.utc('2018-04-25 10:00'),
to: moment.utc('2018-04-25 11:00'),
};
const ctx = {
<<<<<<<
timeSrvMock: {
timeRange: () => ({
from: raw.from,
to: raw.to,
raw: raw,
}),
},
};
=======
} as any;
>>>>>>>
timeSrvMock: {
timeRange: () => ({
from: raw.from,
to: raw.to,
raw: raw,
}),
},
} as any; |
<<<<<<<
import {userPicker} from './components/user_picker';
import {userGroupPicker} from './components/user_group_picker';
import {geminiScrollbar} from './components/scroll/scroll';
import {gfPageDirective} from './components/gf_page';
import {orgSwitcher} from './components/org_switcher';
=======
>>>>>>>
import {userPicker} from './components/user_picker';
import {userGroupPicker} from './components/user_group_picker';
import {geminiScrollbar} from './components/scroll/scroll';
import {gfPageDirective} from './components/gf_page';
import {orgSwitcher} from './components/org_switcher';
<<<<<<<
userPicker,
userGroupPicker,
geminiScrollbar,
gfPageDirective,
orgSwitcher,
=======
PasswordStrength,
>>>>>>>
userPicker,
userGroupPicker,
geminiScrollbar,
gfPageDirective,
orgSwitcher,
PasswordStrength, |
<<<<<<<
const parameters = _.map(
this.params,
function(value, index) {
let paramType;
if (index < this.def.params.length) {
paramType = this.def.params[index].type;
} else if (_.get(_.last(this.def.params), 'multiple')) {
paramType = _.get(_.last(this.def.params), 'type');
}
// param types that should never be quoted
if (_.includes(['value_or_series', 'boolean', 'int', 'float', 'node'], paramType)) {
return value;
}
// param types that might be quoted
if (_.includes(['int_or_interval', 'node_or_tag'], paramType) && _.isFinite(+value)) {
return _.toString(+value);
}
return "'" + value + "'";
}.bind(this)
);
=======
const parameters = _.map(this.params, (value, index) => {
var paramType;
if (index < this.def.params.length) {
paramType = this.def.params[index].type;
} else if (_.get(_.last(this.def.params), 'multiple')) {
paramType = _.get(_.last(this.def.params), 'type');
}
// param types that should never be quoted
if (_.includes(['value_or_series', 'boolean', 'int', 'float', 'node'], paramType)) {
return value;
}
// param types that might be quoted
if (_.includes(['int_or_interval', 'node_or_tag'], paramType) && _.isFinite(+value)) {
return _.toString(+value);
}
return "'" + value + "'";
});
>>>>>>>
const parameters = _.map(this.params, (value, index) => {
let paramType;
if (index < this.def.params.length) {
paramType = this.def.params[index].type;
} else if (_.get(_.last(this.def.params), 'multiple')) {
paramType = _.get(_.last(this.def.params), 'type');
}
// param types that should never be quoted
if (_.includes(['value_or_series', 'boolean', 'int', 'float', 'node'], paramType)) {
return value;
}
// param types that might be quoted
if (_.includes(['int_or_interval', 'node_or_tag'], paramType) && _.isFinite(+value)) {
return _.toString(+value);
}
return "'" + value + "'";
}); |
<<<<<<<
import FolderSettingsPage from 'app/features/manage-dashboards/FolderSettingsPage';
import TeamPages from 'app/features/teams/TeamPages';
import TeamList from 'app/features/teams/TeamList';
=======
import TeamPages from 'app/features/teams/TeamPages';
import TeamList from 'app/features/teams/TeamList';
import FolderSettings from 'app/containers/ManageDashboards/FolderSettings';
>>>>>>>
import TeamPages from 'app/features/teams/TeamPages';
import TeamList from 'app/features/teams/TeamList';
import FolderSettingsPage from 'app/features/manage-dashboards/FolderSettingsPage'; |
<<<<<<<
constructor($scope, private $location, private $timeout) {
var self = this;
=======
constructor($scope, private $location, private $timeout, private $rootScope) {
const self = this;
>>>>>>>
constructor($scope, private $location, private $timeout) {
const self = this;
<<<<<<<
=======
$scope.onAppEvent('panel-initialized', (evt, payload) => {
self.registerPanel(payload.scope);
});
>>>>>>>
<<<<<<<
var panel = this.dashboard.getPanelById(this.state.panelId);
if (!panel) {
=======
const panelScope = this.getPanelScope(this.state.panelId);
if (!panelScope) {
>>>>>>>
const panel = this.dashboard.getPanelById(this.state.panelId);
if (!panel) {
<<<<<<<
leaveFullscreen() {
const panel = this.fullscreenPanel;
=======
getPanelScope(id) {
return _.find(this.panelScopes, panelScope => {
return panelScope.ctrl.panel.id === id;
});
}
leaveFullscreen(render) {
const self = this;
const ctrl = self.fullscreenPanel.ctrl;
>>>>>>>
leaveFullscreen() {
const panel = this.fullscreenPanel;
<<<<<<<
if (this.oldTimeRange !== this.dashboard.time) {
this.dashboard.startRefresh();
=======
this.$timeout(() => {
if (self.oldTimeRange !== ctrl.range) {
self.$rootScope.$broadcast('refresh');
>>>>>>>
if (this.oldTimeRange !== this.dashboard.time) {
this.dashboard.startRefresh();
<<<<<<<
enterFullscreen(panel) {
const isEditing = this.state.edit && this.dashboard.meta.canEdit;
=======
enterFullscreen(panelScope) {
const ctrl = panelScope.ctrl;
>>>>>>>
enterFullscreen(panel) {
const isEditing = this.state.edit && this.dashboard.meta.canEdit;
<<<<<<<
this.dashboard.setViewMode(panel, true, isEditing);
=======
this.dashboard.setViewMode(ctrl.panel, true, ctrl.editMode);
this.$scope.appEvent('panel-fullscreen-enter', { panelId: ctrl.panel.id });
}
registerPanel(panelScope) {
const self = this;
self.panelScopes.push(panelScope);
if (!self.dashboard.meta.soloMode) {
if (self.state.panelId === panelScope.ctrl.panel.id) {
if (self.state.edit) {
panelScope.ctrl.editPanel();
} else {
panelScope.ctrl.viewPanel();
}
}
}
const unbind = panelScope.$on('$destroy', () => {
self.panelScopes = _.without(self.panelScopes, panelScope);
unbind();
});
>>>>>>>
this.dashboard.setViewMode(panel, true, isEditing);
<<<<<<<
create: function($scope) {
return new DashboardViewState($scope, $location, $timeout);
=======
create: $scope => {
return new DashboardViewState($scope, $location, $timeout, $rootScope);
>>>>>>>
create: $scope => {
return new DashboardViewState($scope, $location, $timeout); |
<<<<<<<
addEditorTab(title, directiveFn, index?, icon?) {
var editorTab = { title, directiveFn, icon };
=======
addEditorTab(title, directiveFn, index?) {
const editorTab = { title, directiveFn };
>>>>>>>
addEditorTab(title, directiveFn, index?, icon?) {
const editorTab = { title, directiveFn, icon };
<<<<<<<
let menu = [];
if (!this.panel.fullscreen && this.dashboard.meta.canEdit) {
=======
const menu = [];
if (!this.fullscreen && this.dashboard.meta.canEdit) {
>>>>>>>
const menu = [];
if (!this.panel.fullscreen && this.dashboard.meta.canEdit) {
<<<<<<<
if (this.panel.fullscreen) {
var docHeight = $(window).height();
var editHeight = Math.floor(docHeight * 0.4);
var fullscreenHeight = Math.floor(docHeight * 0.8);
this.containerHeight = this.panel.isEditing ? editHeight : fullscreenHeight;
=======
if (this.fullscreen) {
const docHeight = $(window).height();
const editHeight = Math.floor(docHeight * 0.4);
const fullscreenHeight = Math.floor(docHeight * 0.8);
this.containerHeight = this.editMode ? editHeight : fullscreenHeight;
>>>>>>>
if (this.panel.fullscreen) {
const docHeight = $(window).height();
const editHeight = Math.floor(docHeight * 0.4);
const fullscreenHeight = Math.floor(docHeight * 0.8);
this.containerHeight = this.panel.isEditing ? editHeight : fullscreenHeight; |
<<<<<<<
this.clone.panels.forEach(panel => {
delete panel.thresholds;
delete panel.alert;
=======
this.clone.rows.forEach(row => {
row.panels.forEach(panel => {
if (panel.type === "graph" && panel.alert) {
delete panel.thresholds;
}
delete panel.alert;
});
>>>>>>>
this.clone.panels.forEach(panel => {
if (panel.type === "graph" && panel.alert) {
delete panel.thresholds;
}
delete panel.alert; |
<<<<<<<
export { CustomScrollbar } from './CustomScrollbar/CustomScrollbar';
// Select
export { Select, AsyncSelect, SelectOptionItem } from './Select/Select';
export { IndicatorsContainer } from './Select/IndicatorsContainer';
export { NoOptionsMessage } from './Select/NoOptionsMessage';
export { default as resetSelectStyles } from './Select/resetSelectStyles';
=======
export { CustomScrollbar } from './CustomScrollbar/CustomScrollbar';
export { LoadingPlaceholder } from './LoadingPlaceholder/LoadingPlaceholder';
export { ColorPicker } from './ColorPicker/ColorPicker';
export { SeriesColorPickerPopover } from './ColorPicker/SeriesColorPickerPopover';
export { SeriesColorPicker } from './ColorPicker/SeriesColorPicker';
>>>>>>>
export { CustomScrollbar } from './CustomScrollbar/CustomScrollbar';
// Select
export { Select, AsyncSelect, SelectOptionItem } from './Select/Select';
export { IndicatorsContainer } from './Select/IndicatorsContainer';
export { NoOptionsMessage } from './Select/NoOptionsMessage';
export { default as resetSelectStyles } from './Select/resetSelectStyles';
export { LoadingPlaceholder } from './LoadingPlaceholder/LoadingPlaceholder';
export { ColorPicker } from './ColorPicker/ColorPicker';
export { SeriesColorPickerPopover } from './ColorPicker/SeriesColorPickerPopover';
export { SeriesColorPicker } from './ColorPicker/SeriesColorPicker'; |
<<<<<<<
import * as pieChartPanel from 'app/plugins/panel/piechart/module';
=======
import * as barGaugePanel from 'app/plugins/panel/bargauge/module';
>>>>>>>
import * as pieChartPanel from 'app/plugins/panel/piechart/module';
import * as barGaugePanel from 'app/plugins/panel/bargauge/module';
<<<<<<<
'app/plugins/panel/piechart/module': pieChartPanel,
=======
'app/plugins/panel/bargauge/module': barGaugePanel,
>>>>>>>
'app/plugins/panel/piechart/module': pieChartPanel,
'app/plugins/panel/bargauge/module': barGaugePanel, |
<<<<<<<
/** @ngInject **/
constructor($scope, $injector, private templateSrv, private $q, private uiSegmentSrv) {
=======
/** @ngInject */
constructor($scope, $injector) {
>>>>>>>
/** @ngInject */
constructor($scope, $injector, private templateSrv, private $q, private uiSegmentSrv) { |
<<<<<<<
=======
coreModule.directive('panelDropZone', function($timeout) {
return function(scope, element) {
var row = scope.ctrl.row;
var indrag = false;
var textEl = element.find('.panel-drop-zone-text');
function showPanel(span, text) {
element.find('.panel-container').css('height', row.height);
element[0].style.width = ((span / 1.2) * 10) + '%';
textEl.text(text);
element.show();
}
function hidePanel() {
element.hide();
}
function updateState() {
if (row.panels.length === 0 && indrag === false) {
return showPanel(12, 'Empty Space');
}
var dropZoneSpan = 12 - row.span;
if (dropZoneSpan > 0) {
if (indrag) {
return showPanel(dropZoneSpan, 'Drop Here');
} else {
return showPanel(dropZoneSpan, 'Empty Space');
}
}
if (indrag === true) {
if (dropZoneSpan > 1) {
return showPanel(dropZoneSpan, 'Drop Here');
}
}
hidePanel();
}
row.events.on('span-changed', updateState, scope);
scope.$on("ANGULAR_DRAG_START", function() {
indrag = true;
updateState();
});
scope.$on("ANGULAR_DRAG_END", function() {
indrag = false;
updateState();
});
updateState();
};
});
>>>>>>> |
<<<<<<<
let quotedValues = _.map(value, v => {
return this.queryModel.quoteLiteral(v);
=======
const quotedValues = _.map(value, function(val) {
return "'" + val.replace(/'/g, `''`) + "'";
>>>>>>>
const quotedValues = _.map(value, v => {
return this.queryModel.quoteLiteral(v);
<<<<<<<
let queries = _.filter(options.targets, target => {
return target.hide !== true;
}).map(target => {
let queryModel = new PostgresQuery(target, this.templateSrv, options.scopedVars);
=======
const queries = _.filter(options.targets, item => {
return item.hide !== true;
}).map(item => {
>>>>>>>
const queries = _.filter(options.targets, target => {
return target.hide !== true;
}).map(target => {
let queryModel = new PostgresQuery(target, this.templateSrv, options.scopedVars);
<<<<<<<
let range = this.timeSrv.timeRange();
let data = {
=======
const data = {
>>>>>>>
let range = this.timeSrv.timeRange();
const data = { |
<<<<<<<
// make angular loader service available to react components
setAngularLoader(angularLoader);
// create store with env services
=======
// sets singleston instances for angular services so react components can access them
setBackendSrv(backendSrv);
>>>>>>>
// make angular loader service available to react components
setAngularLoader(angularLoader);
setBackendSrv(backendSrv);
// create store with env services |
<<<<<<<
this.isNew = true;
this.current = angular.copy(defaults);
=======
this.current = _.cloneDeep(defaults);
>>>>>>>
this.isNew = true;
this.current = _.cloneDeep(defaults); |
<<<<<<<
export var classCounter = new Metrics.Counter(true);
=======
declare var JARStore;
>>>>>>>
export var classCounter = new Metrics.Counter(true);
declare var JARStore;
<<<<<<<
/**
* Used to test loading of all class files.
*/
loadAllClassFiles() {
var jarFiles = this.jarFiles;
var self = this;
Object.keys(jarFiles).every(function (path) {
if (path.substr(-4) !== ".jar") {
return true;
}
self.loadAllClassFilesInJARFile(path);
});
}
loadAllClassFilesInJARFile(path: string) {
var jarFiles = this.jarFiles;
var zipFile = jarFiles[path];
var self = this;
Object.keys(zipFile.directory).every(function (fileName) {
if (fileName.substr(-6) !== '.class') {
return true;
}
var className = fileName.substring(0, fileName.length - 6);
var bytes = self.loadFile(className + ".class");
var classInfo2 = new ClassInfo(new Uint8Array(bytes));
return true;
});
}
=======
>>>>>>> |
<<<<<<<
for (var i = 0; i < this.methodInfo.codeAttribute.max_stack; i++) {
stack.push(this.getStack(i));
=======
for (var i = 0; i < this.methodInfo.max_stack; i++) {
stack.push(this.getStackName(i));
>>>>>>>
for (var i = 0; i < this.methodInfo.codeAttribute.max_stack; i++) {
stack.push(this.getStackName(i));
<<<<<<<
this.emitPush(Kind.Int, cp.resolve(cpi, tag));
=======
this.emitPush(Kind.Int, entry.integer, Precedence.Primary);
>>>>>>>
this.emitPush(Kind.Int, cp.resolve(cpi, tag), Precedence.Primary);
<<<<<<<
this.emitPush(Kind.Float, doubleConstant(cp.resolve(cpi, tag)));
=======
this.emitPush(Kind.Float, doubleConstant(entry.float), Precedence.Primary);
>>>>>>>
this.emitPush(Kind.Float, doubleConstant(cp.resolve(cpi, tag)), Precedence.Primary);
<<<<<<<
this.emitPush(Kind.Double, doubleConstant(cp.resolve(cpi, tag)));
=======
this.emitPush(Kind.Double, doubleConstant(entry.double), Precedence.Primary);
>>>>>>>
this.emitPush(Kind.Double, doubleConstant(cp.resolve(cpi, tag)), Precedence.Primary);
<<<<<<<
var long = cp.resolve(cpi, tag);
this.emitPush(Kind.Long, "Long.fromBits(" + long.getLowBits() + ", " + long.getHighBits() + ")");
=======
this.emitPush(Kind.Long, "Long.fromBits(" + entry.lowBits + ", " + entry.highBits + ")", Precedence.Primary);
>>>>>>>
var long = cp.resolve(cpi, tag);
this.emitPush(Kind.Long, "Long.fromBits(" + long.getLowBits() + ", " + long.getHighBits() + ")", Precedence.Primary);
<<<<<<<
debugger;
this.emitPush(Kind.Reference, "SC(" + StringUtilities.escapeStringLiteral(cp.resolveString(cpi)) + ")");
=======
entry = cp[entry.string_index];
this.emitPush(Kind.Reference, "SC(" + StringUtilities.escapeStringLiteral(entry.bytes) + ")", Precedence.Primary);
>>>>>>>
this.emitPush(Kind.Reference, "SC(" + StringUtilities.escapeStringLiteral(cp.resolveString(cpi)) + ")", Precedence.Primary); |
<<<<<<<
"java/lang/Class": {
fields: {
instanceSymbols: {
"status.I": "status"
}
},
methods: {
instanceSymbols: {
"initialize.()V": "initialize"
}
}
},
"java/lang/String": {
=======
"java/lang/Thread": {
>>>>>>>
"java/lang/Class": {
fields: {
instanceSymbols: {
"status.I": "status"
}
},
methods: {
instanceSymbols: {
"initialize.()V": "initialize"
}
}
},
"java/lang/Thread": { |
<<<<<<<
if (pc >= 0) {
this.pc = pc;
this.sp = this.fp + FrameLayout.CallerSaveSize;
release || assert(e instanceof Object && "_address" in e, "exception is object with address");
ref[this.sp++] = e._address;
return;
}
if (mi.isSynchronized) {
this.ctx.monitorExit(getMonitor(ref[this.fp + FrameLayout.MonitorOffset]));
}
this.popFrame(mi);
release || traceWriter && traceWriter.outdent();
release || traceWriter && traceWriter.writeLn("<< I Unwind");
break;
case FrameType.ExitInterpreter:
this.popMarkerFrame(FrameType.ExitInterpreter);
throw e;
break;
case FrameType.PushPendingFrames:
this.frame.thread.pushPendingNativeFrames();
break;
case FrameType.Interrupt:
this.popMarkerFrame(FrameType.Interrupt);
break;
case FrameType.Native:
this.popMarkerFrame(FrameType.Native);
break;
default:
Debug.assertUnreachable("Unhandled frame type: " + frameType);
break;
=======
}
}
if (pc >= 0) {
this.pc = pc;
this.sp = this.fp + FrameLayout.CallerSaveSize;
release || assert(e instanceof Object && "_address" in e, "exception is object with address");
i32[this.sp++] = e._address;
return;
}
if (mi.isSynchronized) {
this.ctx.monitorExit(getMonitor(ref[this.fp + FrameLayout.MonitorOffset]));
>>>>>>>
if (pc >= 0) {
this.pc = pc;
this.sp = this.fp + FrameLayout.CallerSaveSize;
release || assert(e instanceof Object && "_address" in e, "exception is object with address");
i32[this.sp++] = e._address;
return;
}
if (mi.isSynchronized) {
this.ctx.monitorExit(getMonitor(ref[this.fp + FrameLayout.MonitorOffset]));
}
this.popFrame(mi);
release || traceWriter && traceWriter.outdent();
release || traceWriter && traceWriter.writeLn("<< I Unwind");
break;
case FrameType.ExitInterpreter:
this.popMarkerFrame(FrameType.ExitInterpreter);
throw e;
break;
case FrameType.PushPendingFrames:
this.frame.thread.pushPendingNativeFrames();
break;
case FrameType.Interrupt:
this.popMarkerFrame(FrameType.Interrupt);
break;
case FrameType.Native:
this.popMarkerFrame(FrameType.Native);
break;
default:
Debug.assertUnreachable("Unhandled frame type: " + frameType);
break;
<<<<<<<
var value, index, arrayAddr: number, object, klass, offset, buffer, tag: TAGS, targetPC, jumpOffset;
=======
var value, index, arrayAddr: number, klass, offset, buffer, tag: TAGS, targetPC;
>>>>>>>
var value, index, arrayAddr: number, klass, offset, buffer, tag: TAGS, targetPC, jumpOffset;
<<<<<<<
i32[sp] = 0xDEADBEEF;
ref[sp++] = ci.constantPool.resolve(index, tag, false);
=======
i32[sp++] = ci.constantPool.resolve(index, tag, false);
>>>>>>>
i32[sp++] = ci.constantPool.resolve(index, tag, false);
<<<<<<<
i32[sp] = 0xDEADBEEF;
ref[sp++] = ref[lp + code[pc++]];
=======
i32[sp++] = i32[lp + code[pc++]];
>>>>>>>
i32[sp++] = i32[lp + code[pc++]];
<<<<<<<
i32[sp] = 0xDEADBEEF;
ref[sp++] = ref[lp];
=======
i32[sp++] = i32[lp];
>>>>>>>
i32[sp++] = i32[lp];
<<<<<<<
i32[sp] = 0xDEADBEEF;
ref[sp++] = ref[lp + op - Bytecodes.ALOAD_0];
=======
i32[sp++] = i32[lp + op - Bytecodes.ALOAD_0];
>>>>>>>
i32[sp++] = i32[lp + op - Bytecodes.ALOAD_0];
<<<<<<<
i32[lp + code[pc]] = 0xDEADBEEF;
ref[lp + code[pc++]] = ref[--sp];
=======
i32[lp + code[pc++]] = i32[--sp];
>>>>>>>
i32[lp + code[pc++]] = i32[--sp];
<<<<<<<
i32[lp + op - Bytecodes.ASTORE_0] = 0xDEADBEEF;
ref[lp + op - Bytecodes.ASTORE_0] = ref[--sp];
=======
i32[lp + op - Bytecodes.ASTORE_0] = i32[--sp];
>>>>>>>
i32[lp + op - Bytecodes.ASTORE_0] = i32[--sp];
<<<<<<<
if (ref[--sp] === ref[--sp]) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
=======
targetPC = opPC + ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (i32[--sp] === i32[--sp]) {
pc = targetPC;
>>>>>>>
if (i32[--sp] === i32[--sp]) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
<<<<<<<
if (ref[--sp] !== ref[--sp]) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
=======
targetPC = opPC + ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (i32[--sp] !== i32[--sp]) {
pc = targetPC;
>>>>>>>
if (i32[--sp] !== i32[--sp]) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
<<<<<<<
if (!ref[--sp]) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
=======
targetPC = opPC + ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (i32[--sp] === Constants.NULL) {
pc = targetPC;
>>>>>>>
if (i32[--sp] === Constants.NULL) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
<<<<<<<
if (ref[--sp]) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
=======
targetPC = opPC + ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (i32[--sp] !== Constants.NULL) {
pc = targetPC;
>>>>>>>
if (i32[--sp] !== Constants.NULL) {
jumpOffset = ((code[pc++] << 8 | code[pc++]) << 16 >> 16);
if (jumpOffset < 0) {
mi.stats.backwardsBranchCount++;
runtimeCounter.count(Bytecodes[code[opPC]]);
}
pc = opPC + jumpOffset;
continue;
<<<<<<<
i32[lp + (code[pc] << 8 | code[pc + 1])] = 0xDEADBEEF;
ref[lp + (code[pc++] << 8 | code[pc++])] = ref[--sp];
=======
i32[lp + (code[pc++] << 8 | code[pc++])] = i32[--sp];
>>>>>>>
i32[lp + (code[pc++] << 8 | code[pc++])] = i32[--sp];
<<<<<<<
if (interrupt) {
continue;
}
release || assert(isInvoke(code[opPC]), "Return must come from invoke op: " + mi.implKey + " PC: " + pc + Bytecodes[op]);
// Calculate the PC based on the size of the caller's invoke bytecode.
pc = opPC + (code[opPC] === Bytecodes.INVOKEINTERFACE ? 5 : 3);
// Push return value.
switch (lastOP) {
case Bytecodes.LRETURN:
case Bytecodes.DRETURN:
i32[sp++] = i32[lastSP - 2]; // Low Bits
// Fallthrough
case Bytecodes.IRETURN:
case Bytecodes.FRETURN:
i32[sp++] = i32[lastSP - 1];
continue;
case Bytecodes.ARETURN:
ref[sp++] = ref[lastSP - 1];
continue;
=======
var op = code[opPC];
if (op >= Bytecodes.FIRST_INVOKE && op <= Bytecodes.LAST_INVOKE) {
// Calculate the PC based on the size of the caller's invoke bytecode.
pc = opPC + (code[opPC] === Bytecodes.INVOKEINTERFACE ? 5 : 3);
// Push return value.
switch (lastOP) {
case Bytecodes.LRETURN:
case Bytecodes.DRETURN:
i32[sp++] = i32[lastSP - 2]; // Low Bits
// Fallthrough
case Bytecodes.IRETURN:
case Bytecodes.FRETURN:
i32[sp++] = i32[lastSP - 1];
continue;
case Bytecodes.ARETURN:
i32[sp++] = i32[lastSP - 1];
continue;
}
} else {
// We are returning to a bytecode that trapped.
// REDUX: I need to think through this some more, why do we need to subtract the CallerSaveSize? Is it
// because of the the null frame? This frame should have been spliced out, ... is this a coincidence?
sp -= FrameLayout.CallerSaveSize;
pc = opPC;
>>>>>>>
if (interrupt) {
continue;
}
release || assert(isInvoke(code[opPC]), "Return must come from invoke op: " + mi.implKey + " PC: " + pc + Bytecodes[op]);
// Calculate the PC based on the size of the caller's invoke bytecode.
pc = opPC + (code[opPC] === Bytecodes.INVOKEINTERFACE ? 5 : 3);
// Push return value.
switch (lastOP) {
case Bytecodes.LRETURN:
case Bytecodes.DRETURN:
i32[sp++] = i32[lastSP - 2]; // Low Bits
// Fallthrough
case Bytecodes.IRETURN:
case Bytecodes.FRETURN:
i32[sp++] = i32[lastSP - 1];
continue;
case Bytecodes.ARETURN:
i32[sp++] = i32[lastSP - 1];
continue; |
<<<<<<<
addr = gcMallocAtomic(Constants.ARRAY_HDR_SIZE + size * (<PrimitiveArrayClassInfo>arrayClassInfo).bytesPerElement);
// Zero-out memory because GC_MALLOC_ATOMIC doesn't do it automatically.
var off = Constants.ARRAY_HDR_SIZE + addr;
var end = off + size * (<PrimitiveArrayClassInfo>arrayClassInfo).bytesPerElement;
for (var i = off; i < end; i++) {
i8[i] = 0;
}
=======
addr = ASM._gcMallocAtomic(Constants.ARRAY_HDR_SIZE + size * (<PrimitiveArrayClassInfo>arrayClassInfo).bytesPerElement);
>>>>>>>
addr = gcMallocAtomic(Constants.ARRAY_HDR_SIZE + size * (<PrimitiveArrayClassInfo>arrayClassInfo).bytesPerElement); |
<<<<<<<
import {
ApiUrlConfig,
MathHelper,
UserDto,
UsersProviderService
} from '@app/shared/internal';
=======
import { ApiUrlConfig, MathHelper } from 'framework';
import { PublicUserDto, UsersProviderService } from './../declarations-base';
>>>>>>>
import {
ApiUrlConfig,
MathHelper,
PublicUserDto,
UsersProviderService
} from '@app/shared/internal'; |
<<<<<<<
B(pc: number, nextPC: number, local: any [], stack: any [], lockObject: java.lang.Object) {
var methodInfo = jitMethodInfos[(<any>arguments.callee.caller).name];
release || assert(methodInfo !== undefined, "methodInfo undefined in B");
$.ctx.bailout(methodInfo, pc, nextPC, local, stack, lockObject);
=======
B(methodInfoId: number, pc: number, local: any [], stack: any [], lockObject: java.lang.Object) {
var methodInfo = methodIdToMethodInfoMap[methodInfoId];
release || assert(methodInfo !== undefined);
this.ctx.bailout(methodInfo, pc, local, stack, lockObject);
>>>>>>>
B(methodInfoId: number, pc: number, local: any [], stack: any [], lockObject: java.lang.Object) {
var methodInfo = methodIdToMethodInfoMap[methodInfoId];
release || assert(methodInfo !== undefined, "methodInfo undefined in B");
this.ctx.bailout(methodInfo, pc, local, stack, lockObject);
<<<<<<<
T(location: UnwindThrowLocation, local: any [], stack: any [], lockObject: java.lang.Object) {
var methodInfo = jitMethodInfos[(<any>arguments.callee.caller).name];
release || assert(methodInfo !== undefined, "methodInfo undefined in T");
$.ctx.bailout(methodInfo, location.getPC(), location.getNextPC(), local, stack.slice(0, location.getSP()), lockObject);
=======
T(methodInfoId: number, location: UnwindThrowLocation, local: any [], stack: any [], lockObject: java.lang.Object) {
var methodInfo = methodIdToMethodInfoMap[methodInfoId];
release || assert(methodInfo !== undefined);
this.ctx.bailout(methodInfo, location.getPC(), local, stack.slice(0, location.getSP()), lockObject);
}
SA(classId: number) {
return this.getStaticObjectAddress(classIdToClassInfoMap[classId]);
}
CO(classId: number) {
return this.getClassObjectAddress(classIdToClassInfoMap[classId]);
>>>>>>>
T(methodInfoId: number, location: UnwindThrowLocation, local: any [], stack: any [], lockObject: java.lang.Object) {
var methodInfo = methodIdToMethodInfoMap[methodInfoId];
release || assert(methodInfo !== undefined, "methodInfo undefined in T");
this.ctx.bailout(methodInfo, location.getPC(), local, stack.slice(0, location.getSP()), lockObject);
}
SA(classId: number) {
return this.getStaticObjectAddress(classIdToClassInfoMap[classId]);
}
CO(classId: number) {
return this.getClassObjectAddress(classIdToClassInfoMap[classId]);
<<<<<<<
linkClassMethod(methodInfo);
release || assert(methodInfo.fn, "bad fn in getLinkedMethod");
=======
linkMethod(methodInfo);
release || assert (methodInfo.fn);
>>>>>>>
linkMethod(methodInfo);
release || assert (methodInfo.fn, "bad fn in getLinkedMethod");
<<<<<<<
export function instanceOfInterface(object: java.lang.Object, classInfo: ClassInfo): boolean {
release || assert(classInfo.isInterface, "instanceOfInterface called on non interface");
return object !== null && isAssignableTo(object.classInfo, classInfo);
=======
export function instanceOfInterface(objectAddr: number, classId: number): boolean {
release || assert(typeof classId === "number", "Class id must be a number.");
release || assert(classIdToClassInfoMap[classId].isInterface);
return objectAddr !== Constants.NULL && isAssignableTo(classIdToClassInfoMap[i32[objectAddr + Constants.OBJ_CLASS_ID_OFFSET >> 2]], classIdToClassInfoMap[classId]);
>>>>>>>
export function instanceOfInterface(objectAddr: number, classId: number): boolean {
release || assert(typeof classId === "number", "Class id must be a number.");
release || assert(classIdToClassInfoMap[classId].isInterface, "instanceOfInterface called on non interface");
return objectAddr !== Constants.NULL && isAssignableTo(classIdToClassInfoMap[i32[objectAddr + Constants.OBJ_CLASS_ID_OFFSET >> 2]], classIdToClassInfoMap[classId]); |
<<<<<<<
var thread = <java.lang.Thread>getHandle($.mainThread);
getLinkedMethod(methodInfo).call(thread, J2ME.newString("main"));
if (U) {
$.nativeBailout(J2ME.Kind.Void, J2ME.Bytecode.Bytecodes.INVOKESPECIAL);
}
=======
getLinkedMethod(methodInfo)($.mainThread, J2ME.newString("main"));
>>>>>>>
getLinkedMethod(methodInfo)($.mainThread, J2ME.newString("main"));
if (U) {
$.nativeBailout(J2ME.Kind.Void, J2ME.Bytecode.Bytecodes.INVOKESPECIAL);
}
<<<<<<<
getLinkedMethod(entryPoint).call(null, isolate._mainArgs);
if (U) {
$.nativeBailout(J2ME.Kind.Void, J2ME.Bytecode.Bytecodes.INVOKESTATIC);
}
=======
getLinkedMethod(entryPoint)(Constants.NULL, isolate._mainArgs);
>>>>>>>
getLinkedMethod(entryPoint)(Constants.NULL, isolate._mainArgs);
if (U) {
$.nativeBailout(J2ME.Kind.Void, J2ME.Bytecode.Bytecodes.INVOKESTATIC);
} |
<<<<<<<
Native["org/mozilla/internal/Sys.getIsolateMain.()Ljava/lang/String;"] = function(addr: number): java.lang.String {
=======
Native["org/mozilla/internal/Sys.getIsolateMain.()Ljava/lang/String;"] = function(): number {
>>>>>>>
Native["org/mozilla/internal/Sys.getIsolateMain.()Ljava/lang/String;"] = function(addr: number): number { |
<<<<<<<
=======
writer.writeLn(" " + prefix.padRight(' ', 5) + " " + toNumber(i - this.fp).padLeft(' ', 3) + " " + String(i).padLeft(' ', 4) + " " + toHEX(i << 2) + ": " +
String(i32[i]).padLeft(' ', 12) + " " +
toHEX(i32[i]) + " " +
((i32[i] >= 32 && i32[i] < 1024) ? String.fromCharCode(i32[i]) : "?") + " " +
clampString(String(f32[i]), 12).padLeft(' ', 12) + " " +
clampString(String(wordsToDouble(i32[i], i32[i + 1])), 12).padLeft(' ', 12) + " " +
// XXX ref[i] could be an address, so update toName to handle that.
toName(ref[i]));
>>>>>>>
<<<<<<<
if (pc >= 0) {
this.pc = pc;
this.sp = this.fp + FrameLayout.CallerSaveSize;
ref[this.sp++] = e;
return;
}
if (mi.isSynchronized) {
this.ctx.monitorExit(ref[this.fp + FrameLayout.MonitorOffset]);
}
this.popFrame(mi);
release || traceWriter && traceWriter.outdent();
release || traceWriter && traceWriter.writeLn("<< I Unwind");
break;
case FrameType.ExitInterpreter:
this.popMarkerFrame(FrameType.ExitInterpreter);
throw e;
break;
case FrameType.PushPendingFrames:
this.frame.thread.pushPendingNativeFrames();
break;
case FrameType.Interrupt:
this.popMarkerFrame(FrameType.Interrupt);
break;
case FrameType.Native:
this.popMarkerFrame(FrameType.Native);
break;
default:
Debug.assertUnreachable("Unhandled frame type: " + frameType);
break;
=======
}
}
if (pc >= 0) {
this.pc = pc;
this.sp = this.fp + FrameLayout.CallerSaveSize;
release || assert(e instanceof Object && "_address" in e, "exception is object with address");
ref[this.sp++] = e._address;
return;
}
if (mi.isSynchronized) {
this.ctx.monitorExit(getMonitor(ref[this.fp + FrameLayout.MonitorOffset]));
>>>>>>>
if (pc >= 0) {
this.pc = pc;
this.sp = this.fp + FrameLayout.CallerSaveSize;
release || assert(e instanceof Object && "_address" in e, "exception is object with address");
ref[this.sp++] = e._address;
return;
}
if (mi.isSynchronized) {
this.ctx.monitorExit(getMonitor(ref[this.fp + FrameLayout.MonitorOffset]));
}
this.popFrame(mi);
release || traceWriter && traceWriter.outdent();
release || traceWriter && traceWriter.writeLn("<< I Unwind");
break;
case FrameType.ExitInterpreter:
this.popMarkerFrame(FrameType.ExitInterpreter);
throw e;
break;
case FrameType.PushPendingFrames:
this.frame.thread.pushPendingNativeFrames();
break;
case FrameType.Interrupt:
this.popMarkerFrame(FrameType.Interrupt);
break;
case FrameType.Native:
this.popMarkerFrame(FrameType.Native);
break;
default:
Debug.assertUnreachable("Unhandled frame type: " + frameType);
break;
<<<<<<<
var value, index, array, object, offset, buffer, tag: TAGS, jumpOffset;
=======
var value, index, arrayAddr: number, object, klass, offset, buffer, tag: TAGS, targetPC;
>>>>>>>
var value, index, arrayAddr: number, object, klass, offset, buffer, tag: TAGS, targetPC, jumpOffset;
<<<<<<<
i32[sp] = 0xDEADBEEF;
ref[sp++] = array[index];
=======
ref[sp++] = i32[(arrayAddr + Constants.ARRAY_HDR_SIZE >> 2) + index];
>>>>>>>
ref[sp++] = i32[(arrayAddr + Constants.ARRAY_HDR_SIZE >> 2) + index]; |
<<<<<<<
this.emitNullPointerCheck(objectAddr);
var addr = objectAddr + "+" + fieldInfo.byteOffset;
this.emitPush(kind, "i32[" + addr + ">>2]", Precedence.Member);
=======
if (!isStatic) {
this.emitNullPointerCheck(objectAddr);
}
var address = objectAddr + "+" + fieldInfo.byteOffset;
// XXX the push kind is wrong here.
this.emitPush(Kind.Int, "i32[" + address + ">>2]", Precedence.Member);
>>>>>>>
if (!isStatic) {
this.emitNullPointerCheck(objectAddr);
}
var addr = objectAddr + "+" + fieldInfo.byteOffset;
this.emitPush(kind, "i32[" + addr + ">>2]", Precedence.Member);
<<<<<<<
this.emitNullPointerCheck(objectAddr);
var addr = objectAddr + "+" + fieldInfo.byteOffset;
this.blockEmitter.writeLn("i32[" + addr + ">>2]=" + l + ";");
if (isTwoSlot(kind)) {
this.blockEmitter.writeLn("i32[" + addr + "+4>>2]=" + h + ";");
=======
if (!isStatic) {
this.emitNullPointerCheck(objectAddr);
}
var address = objectAddr + "+" + fieldInfo.byteOffset;
this.blockEmitter.writeLn("i32[" + address + ">>2]=" + l + ";");
if (isTwoSlot(fieldInfo.kind)) {
throwCompilerError("XXX");
this.blockEmitter.writeLn("i32[" + address + "+4>>2]=" + h + ";");
>>>>>>>
if (!isStatic) {
this.emitNullPointerCheck(objectAddr);
}
var addr = objectAddr + "+" + fieldInfo.byteOffset;
this.blockEmitter.writeLn("i32[" + addr + ">>2]=" + l + ";");
if (isTwoSlot(kind)) {
this.blockEmitter.writeLn("i32[" + addr + "+4>>2]=" + h + ";"); |
<<<<<<<
/**
* Returns true if the language is supported.
*/
export const isSupportedLanguage = (language: string, supportedLanguages: RefractorSyntax[]) => {
return getLanguageNamesAndAliases(supportedLanguages).includes(language);
};
interface GetLanguageParameter {
=======
interface GetLanguageParams {
>>>>>>>
interface GetLanguageParameter {
<<<<<<<
export const getLanguage = ({ language, supportedLanguages, fallback }: GetLanguageParameter) =>
!isSupportedLanguage(language, supportedLanguages) ? fallback : language;
=======
export const getLanguage = ({ language, supportedLanguages, fallback }: GetLanguageParams): string => {
if (!language) {
return fallback;
}
for (const name of getLanguageNamesAndAliases(supportedLanguages)) {
if (name.toLowerCase() === language.toLowerCase()) {
return name;
}
}
return fallback;
};
>>>>>>>
export const getLanguage = (parameter: GetLanguageParameter): string => {
const { language, supportedLanguages, fallback } = parameter;
if (!language) {
return fallback;
}
for (const name of getLanguageNamesAndAliases(supportedLanguages)) {
if (name.toLowerCase() === language.toLowerCase()) {
return name;
}
}
return fallback;
};
<<<<<<<
};
/**
* Retrieve the supported language names based on configuration.
*/
export const getSupportedLanguagesMap = (supportedLanguages: RefractorSyntax[]) => {
const object_: Record<string, string> = object();
for (const { name, aliases } of [...PRELOADED_LANGUAGES, ...supportedLanguages]) {
object_[name] = name;
aliases.forEach((alias) => {
object_[alias] = name;
});
}
return object_;
=======
>>>>>>> |
<<<<<<<
steps.map((item) => Step.fromJSON(schema(), item.step)),
steps.map((item) => item.clientID),
=======
steps.map(item => Step.fromJSON(schema, item)),
steps.map(item => item.clientID),
>>>>>>>
steps.map((item) => Step.fromJSON(schema(), item)),
steps.map((item) => item.clientID), |
<<<<<<<
import {SingleFocusDispatcher} from "../services/formly.single.focus.dispatcher";
=======
import {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from "@angular/forms";
>>>>>>>
import {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from "@angular/forms";
import {SingleFocusDispatcher} from "../services/formly.single.focus.dispatcher";
<<<<<<<
<select [id]="key" [ngControl]="key" (change)="inputChange($event, 'value')" class="c-select" [(ngModel)]="model"
(focus)="onInputFocus()"
#selectElement>
=======
<select [id]="key" [formControlName]="key" (change)="inputChange($event, 'value')" class="c-select" [(ngModel)]="model">
>>>>>>>
<select [id]="key" [formControlName]="key" (change)="inputChange($event, 'value')" class="c-select" [(ngModel)]="model"
(focus)="onInputFocus()"
#selectElement>
<<<<<<<
inputs: [ "form", "update", "templateOptions", "key", "field", "formModel", "model"],
queries: {inputComponent: new ViewChildren("selectElement")}
=======
inputs: [ "form", "update", "templateOptions", "key", "field", "formModel", "model"],
directives: [FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES]
>>>>>>>
inputs: [ "form", "update", "templateOptions", "key", "field", "formModel", "model"],
directives: [FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES],
queries: {inputComponent: new ViewChildren("selectElement")} |
<<<<<<<
import {SingleFocusDispatcher} from "../services/formly.single.focus.dispatcher";
=======
import {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from "@angular/forms";
>>>>>>>
import {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from "@angular/forms";
import {SingleFocusDispatcher} from "../services/formly.single.focus.dispatcher"; |
<<<<<<<
},
"tsconfig with extends and nostrictnull works as expected": function (test) {
test.expect(4);
var cfg = getConfig("minimalist");
cfg.tsconfig = {
tsconfig: './test/tsconfig_artifact/extends/tsconfig.nostrictnull.json',
};
var result = or.resolveAsync(null, cfg).then(function (result) {
test.strictEqual(result.strictNullChecks, false, "expected to get strict null checks disabled.");
test.strictEqual(result.noImplicitAny, true, "expected to get noImplicitAny from configs/base.json.");
test.ok(result.CompilationTasks[0].src.indexOf('test/abtest/a.ts') > -1, "expected to see a.ts included.");
test.ok(result.CompilationTasks[0].src.indexOf('test/abtest/b.ts') > -1, "expected to see b.ts included.");
test.done();
}).catch(function (err) { test.ifError(err); test.done(); });
}
=======
},
"four spaces indent is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/four_spaces_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/four_spaces_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"tab indent is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/tab_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/tab_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"three spaces indent is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/three_spaces_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/three_spaces_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"crlf newline is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/crlf_newline_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/crlf_newline_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"lf newline is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/lf_newline_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/lf_newline_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"mixed indent uses most frequently detected indent when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/mixed_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/mixed_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"mixed newline uses most frequently detected newline when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/mixed_newline_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/mixed_newline_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
}
>>>>>>>
},
"four spaces indent is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/four_spaces_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/four_spaces_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"tab indent is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/tab_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/tab_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"three spaces indent is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/three_spaces_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/three_spaces_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"crlf newline is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/crlf_newline_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/crlf_newline_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"lf newline is preserved when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/lf_newline_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/lf_newline_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"mixed indent uses most frequently detected indent when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/mixed_indent_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/mixed_indent_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"mixed newline uses most frequently detected newline when updating tsconfig": (test: nodeunit.Test) => {
test.expect(1);
const taskTargetConfig = getConfig("minimalist");
taskTargetConfig.tsconfig = './test/tsconfig/mixed_newline_tsconfig.json';
const result = or.resolveAsync(null, taskTargetConfig, "", null, null, grunt.file.expand).then((result: IGruntTSOptions) => {
testExpectedFile(test, './test/tsconfig/mixed_newline_tsconfig.expected.json', false);
test.done();
}).catch((err) => {test.ifError(err); test.done();});
},
"tsconfig with extends and nostrictnull works as expected": function (test) {
test.expect(4);
var cfg = getConfig("minimalist");
cfg.tsconfig = {
tsconfig: './test/tsconfig_artifact/extends/tsconfig.nostrictnull.json',
};
var result = or.resolveAsync(null, cfg).then(function (result) {
test.strictEqual(result.strictNullChecks, false, "expected to get strict null checks disabled.");
test.strictEqual(result.noImplicitAny, true, "expected to get noImplicitAny from configs/base.json.");
test.ok(result.CompilationTasks[0].src.indexOf('test/abtest/a.ts') > -1, "expected to see a.ts included.");
test.ok(result.CompilationTasks[0].src.indexOf('test/abtest/b.ts') > -1, "expected to see b.ts included.");
test.done();
}).catch(function (err) { test.ifError(err); test.done(); });
} |
<<<<<<<
{ name: 'buildkite', fileNames: ['buildkite.yml', 'buildkite.yaml'] },
{
name: 'uml',
// https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml#user-content-supported-formats
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true
}
=======
{ name: 'buildkite', fileNames: ['buildkite.yml', 'buildkite.yaml'] },
{ name: 'svg', fileExtensions: ['svg'] },
>>>>>>>
{ name: 'buildkite', fileNames: ['buildkite.yml', 'buildkite.yaml'] },
{ name: 'svg', fileExtensions: ['svg'] },
{
name: 'uml',
// https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml#user-content-supported-formats
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true
}, |
<<<<<<<
export interface DependentQuery<DQ> {
(accessor: FieldAccessor<any, any>): DQ;
}
export interface ReferenceOptions<SQ, DQ> {
source: Source<SQ & DQ>;
dependentQuery?: DependentQuery<DQ>;
autoLoad?: boolean;
}
export interface FieldOptions<R, V, SQ, DQ> {
=======
export type ConversionErrors = {
default: string | ErrorFunc;
[key: string]: string | ErrorFunc;
};
export type ConversionErrorType = string | ErrorFunc | ConversionErrors;
export interface FieldOptions<R, V> {
>>>>>>>
export interface DependentQuery<DQ> {
(accessor: FieldAccessor<any, any>): DQ;
}
export interface ReferenceOptions<SQ, DQ> {
source: Source<SQ & DQ>;
dependentQuery?: DependentQuery<DQ>;
autoLoad?: boolean;
}
export type ConversionErrors = {
default: string | ErrorFunc;
[key: string]: string | ErrorFunc;
};
export type ConversionErrorType = string | ErrorFunc | ConversionErrors;
export interface FieldOptions<R, V, SQ, DQ> {
<<<<<<<
references?: ReferenceOptions<SQ, DQ>;
=======
postprocess?: boolean;
>>>>>>>
references?: ReferenceOptions<SQ, DQ>;
postprocess?: boolean; |
<<<<<<<
uin: '',
=======
uin: this.emitter.getUIN(),
data: JSON.stringify({loginer: '1'}),
>>>>>>>
uin: this.emitter.getUIN(), |
<<<<<<<
log.silly(PRE, `messageid and messagetype : ${util.inspect(messageId)};${messageType}`)
=======
>>>>>>> |
<<<<<<<
{ name: 'tiltfile', fileNames: ['Tiltfile'] },
=======
{ name: 'capacitor', fileNames: ['capacitor.config.json'] },
{ name: 'sketch', fileExtensions: ['sketch'] },
{ name: 'adonis', fileNames: ['.adonisrc.json'] },
{
name: 'uml',
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true,
},
{ name: 'meson', fileNames: ['meson.build'] },
{ name: 'commitlint', fileNames: ['.commitlintrc', '.commitlintrc.js', 'commitlint.config.js', '.commitlintrc.json', '.commitlint.yaml', '.commitlint.yml'] },
{ name: 'buck', fileNames: ['.buckconfig'] },
{ name: 'dhall', fileExtensions: ['dhall', 'dhallb'] },
{ name: 'nrwl', fileNames: ['nx.json'] },
>>>>>>>
{ name: 'tiltfile', fileNames: ['Tiltfile'] },
{ name: 'capacitor', fileNames: ['capacitor.config.json'] },
{ name: 'sketch', fileExtensions: ['sketch'] },
{ name: 'adonis', fileNames: ['.adonisrc.json'] },
{
name: 'uml',
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true,
},
{ name: 'meson', fileNames: ['meson.build'] },
{ name: 'commitlint', fileNames: ['.commitlintrc', '.commitlintrc.js', 'commitlint.config.js', '.commitlintrc.json', '.commitlint.yaml', '.commitlint.yml'] },
{ name: 'buck', fileNames: ['.buckconfig'] },
{ name: 'dhall', fileExtensions: ['dhall', 'dhallb'] },
{ name: 'nrwl', fileNames: ['nx.json'] }, |
<<<<<<<
import { GrpcGateway } from '../server-manager/grpc-gateway'
import { StreamResponse, ResponseType } from '../server-manager/proto-ts/PadPlusServer_pb'
import { ScanStatus, UrlLinkPayload } from 'wechaty-puppet'
import { RequestClient } from './api-request/request'
import PadplusUser from './api-request/user'
import PadplusMessage from './api-request/message'
import { GrpcEventEmitter } from '../server-manager/grpc-event-emitter'
import { PadplusMessagePayload, PadplusMessageType, GrpcMessagePayload, PadplusUrlLink, PadplusErrorType } from '../schemas'
import { convertMessageFromGrpcToPadplus } from '../convert-manager/message-convertor'
=======
import { GrpcGateway } from '../server-manager/grpc-gateway'
import { StreamResponse, ResponseType } from '../server-manager/proto-ts/PadPlusServer_pb'
import { ScanStatus } from 'wechaty-puppet'
import { RequestClient } from './api-request/request'
import { PadplusUser } from './api-request/user'
import { PadplusContact } from './api-request/contact'
import { GrpcEventEmitter } from '../server-manager/grpc-event-emitter'
import { PadplusMessagePayload, PadplusContactPayload } from '../schemas'
import { convertMessageFromGrpcToPadplus } from '../convert-manager/message-convertor'
import { convertToPuppetContact } from '../convert-manager/contact-convertor';
>>>>>>>
import { GrpcGateway } from '../server-manager/grpc-gateway'
import { StreamResponse, ResponseType } from '../server-manager/proto-ts/PadPlusServer_pb'
import { ScanStatus, UrlLinkPayload } from 'wechaty-puppet'
import { RequestClient } from './api-request/request'
import { PadplusUser } from './api-request/user'
import { PadplusContact } from './api-request/contact'
import { PadplusMessage } from './api-request/message'
import { GrpcEventEmitter } from '../server-manager/grpc-event-emitter'
import { PadplusMessagePayload, PadplusContactPayload, PadplusMessageType, PadplusUrlLink } from '../schemas'
import { convertMessageFromGrpcToPadplus } from '../convert-manager/message-convertor'
import { convertToPuppetContact } from '../convert-manager/contact-convertor';
import { GrpcMessagePayload } from '../schemas/grpc-schemas';
<<<<<<<
private padplusMesasge : PadplusMessage
=======
private padplusContact : PadplusContact
>>>>>>>
private padplusMesasge : PadplusMessage
private padplusContact : PadplusContact
<<<<<<<
this.requestClient = new RequestClient(this.grpcGateway)
this.padplusUser = new PadplusUser(options.token, this.requestClient)
this.padplusMesasge = new PadplusMessage(this.requestClient)
=======
this.request = new RequestClient(this.grpcGateway)
this.padplusUser = new PadplusUser(this.request)
this.padplusContact = new PadplusContact(this.request)
>>>>>>>
this.requestClient = new RequestClient(this.grpcGateway)
this.padplusUser = new PadplusUser(options.token, this.requestClient)
this.requestClient = new RequestClient(this.grpcGateway)
this.padplusMesasge = new PadplusMessage(this.requestClient)
this.padplusContact = new PadplusContact(this.requestClient) |
<<<<<<<
=======
import { PluginListenerHandle } from '@capacitor/core';
>>>>>>>
import { PluginListenerHandle } from '@capacitor/core';
<<<<<<<
=======
// AdMob listeners
addListener(eventName: 'onAdLoaded', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdFailedToLoad', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdOpened', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdClosed', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdLoaded', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdOpened', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdLeftApplication', listenerFunc: (info: any) => void): PluginListenerHandle;
// Admob RewardVideo listeners
addListener(eventName: 'onRewardedVideoStarted', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdClosed', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewarded', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdLeftApplication', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdFailedToLoad', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoCompleted', listenerFunc: (info: any) => void): PluginListenerHandle;
>>>>>>>
// AdMob listeners
addListener(eventName: 'onAdLoaded', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdFailedToLoad', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdOpened', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdClosed', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdLoaded', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdOpened', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onAdLeftApplication', listenerFunc: (info: any) => void): PluginListenerHandle;
// Admob RewardVideo listeners
addListener(eventName: 'onRewardedVideoStarted', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdClosed', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewarded', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdLeftApplication', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoAdFailedToLoad', listenerFunc: (info: any) => void): PluginListenerHandle;
addListener(eventName: 'onRewardedVideoCompleted', listenerFunc: (info: any) => void): PluginListenerHandle; |
<<<<<<<
babelParserPlugins?: BabelParserPlugins,
jsFile?: boolean
): object {
=======
babelParserPlugins?: BabelParserPlugins
): AstResult {
>>>>>>>
babelParserPlugins?: BabelParserPlugins,
jsFile?: boolean
): AstResult {
<<<<<<<
})
test('data in a mixin', () => {
const sfc: AstResult = getAST('common.js', { jsx: false }, true)
const mockOnData = jest.fn(() => {})
const options: ParserOptions = {
onData: mockOnData
}
parseJavascript(sfc.jsAst as bt.File, options)
expect(mockOnData.mock.calls.length).toBe(3)
const arg1 = mockOnData.mock.calls[0][0]
const arg2 = mockOnData.mock.calls[1][0]
const arg3 = mockOnData.mock.calls[2][0]
expect((arg1 as DataResult).name).toBe('value')
expect((arg1 as DataResult).type).toBe('Number')
expect(((arg1 as DataResult).describe as string[]).length).toBe(1)
expect((arg1 as DataResult).default).toBe('5')
expect((arg1 as DataResult).type).toMatchSnapshot()
expect((arg1 as DataResult).describe).toMatchSnapshot()
expect((arg1 as DataResult).default).toMatchSnapshot()
expect((arg2 as DataResult).name).toBe('stringVariable')
expect((arg2 as DataResult).type).toBe('String')
expect(((arg2 as DataResult).describe as string[]).length).toBe(1)
expect((arg2 as DataResult).default).toBe('A String')
expect((arg2 as DataResult).type).toMatchSnapshot()
expect((arg2 as DataResult).describe).toMatchSnapshot()
expect((arg2 as DataResult).default).toMatchSnapshot()
expect((arg3 as DataResult).name).toBe('arrayVariable')
expect((arg3 as DataResult).type).toBe('Array')
expect(((arg3 as DataResult).describe as string[]).length).toBe(1)
expect((arg3 as DataResult).default).toBe('[An,Array]')
expect((arg3 as DataResult).type).toMatchSnapshot()
expect((arg3 as DataResult).describe).toMatchSnapshot()
expect((arg3 as DataResult).default).toMatchSnapshot()
=======
})
test('the Typescript const assertion should parsing correctly', () => {
const sfc: AstResult = getAST('tsConstAssertion.vue')
const mockOnProp = jest.fn(() => {})
const options: ParserOptions = {
onProp: mockOnProp
}
const seen = new Seen()
parseJavascript(sfc.jsAst as bt.File, seen, options)
>>>>>>>
})
test('the Typescript const assertion should parsing correctly', () => {
const sfc: AstResult = getAST('tsConstAssertion.vue')
const mockOnProp = jest.fn(() => {})
const options: ParserOptions = {
onProp: mockOnProp
}
const seen = new Seen()
parseJavascript(sfc.jsAst as bt.File, seen, options)
})
test('data in a mixin', () => {
const sfc: AstResult = getAST('common.js', { jsx: false }, true)
const mockOnData = jest.fn(() => {})
const options: ParserOptions = {
onData: mockOnData
}
parseJavascript(sfc.jsAst as bt.File, options)
expect(mockOnData.mock.calls.length).toBe(3)
const arg1 = mockOnData.mock.calls[0][0]
const arg2 = mockOnData.mock.calls[1][0]
const arg3 = mockOnData.mock.calls[2][0]
expect((arg1 as DataResult).name).toBe('value')
expect((arg1 as DataResult).type).toBe('Number')
expect(((arg1 as DataResult).describe as string[]).length).toBe(1)
expect((arg1 as DataResult).default).toBe('5')
expect((arg1 as DataResult).type).toMatchSnapshot()
expect((arg1 as DataResult).describe).toMatchSnapshot()
expect((arg1 as DataResult).default).toMatchSnapshot()
expect((arg2 as DataResult).name).toBe('stringVariable')
expect((arg2 as DataResult).type).toBe('String')
expect(((arg2 as DataResult).describe as string[]).length).toBe(1)
expect((arg2 as DataResult).default).toBe('A String')
expect((arg2 as DataResult).type).toMatchSnapshot()
expect((arg2 as DataResult).describe).toMatchSnapshot()
expect((arg2 as DataResult).default).toMatchSnapshot()
expect((arg3 as DataResult).name).toBe('arrayVariable')
expect((arg3 as DataResult).type).toBe('Array')
expect(((arg3 as DataResult).describe as string[]).length).toBe(1)
expect((arg3 as DataResult).default).toBe('[An,Array]')
expect((arg3 as DataResult).type).toMatchSnapshot()
expect((arg3 as DataResult).describe).toMatchSnapshot()
expect((arg3 as DataResult).default).toMatchSnapshot() |
<<<<<<<
jsFile?: any
=======
includeSyncEvent?: boolean
>>>>>>>
jsFile?: any
includeSyncEvent?: boolean |
<<<<<<<
{ name: 'scheme', fileExtensions: ['ss', 'scm'] }
=======
{ name: 'tailwindcss', fileNames: ['tailwind.js', 'tailwind.config.js'] },
>>>>>>>
{ name: 'scheme', fileExtensions: ['ss', 'scm'] },
{ name: 'tailwindcss', fileNames: ['tailwind.js', 'tailwind.config.js'] }, |
<<<<<<<
{
name: 'uml',
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true,
},
=======
{ name: 'codeowners', fileNames: ['codeowners'] },
{ name: 'gcp', fileNames: ['.gcloudignore'] },
>>>>>>>
{ name: 'codeowners', fileNames: ['codeowners'] },
{ name: 'gcp', fileNames: ['.gcloudignore'] },
{
name: 'uml',
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true,
}, |
<<<<<<<
{
name: 'uml',
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true,
},
=======
{ name: 'gitpod', fileNames: ['.gitpod.yml'] },
>>>>>>>
{ name: 'gitpod', fileNames: ['.gitpod.yml'] },
{
name: 'uml',
fileExtensions: ['iuml', 'pu', 'puml', 'plantuml', 'wsd'],
light: true,
}, |
<<<<<<<
import {copyingSlice, deprecationMessage, bufferValidator} from '../core/util';
=======
import {copyingSlice} from '../core/util';
>>>>>>>
import {copyingSlice, bufferValidator} from '../core/util';
<<<<<<<
deprecationMessage(deprecateMsg, IsoFS.Name, {data: "ISO data as a Buffer", name: name});
=======
>>>>>>> |
<<<<<<<
import * as BrowserFS from '../../src/core/browserfs';
import {FileSystem} from '../../src/core/file_system';
import * as buffer from 'buffer';
import BackendFactory from './BackendFactory';
import {eachSeries as asyncEachSeries} from 'async';
=======
import BrowserFS = require('../../src/core/browserfs');
import file_system = require('../../src/core/file_system');
import BFSEmscriptenFS from '../../src/generic/emscripten_fs';
// !!TYPING ONLY!!
import __buffer = require('bfs-buffer');
import buffer = require('buffer');
import BackendFactory = require('./BackendFactory');
import async = require('async');
>>>>>>>
import * as BrowserFS from '../../src/core/browserfs';
import {FileSystem} from '../../src/core/file_system';
import * as buffer from 'buffer';
import BackendFactory from './BackendFactory';
import {eachSeries as asyncEachSeries} from 'async';
import BFSEmscriptenFS from '../../src/generic/emscripten_fs';
<<<<<<<
function generateBackendTests(name: string, backend: FileSystem) {
=======
function generateEmscriptenTest(testName: string, test: (module: any) => void) {
// Only applicable to typed array-compatible browsers.
if (typeof(Uint8Array) !== 'undefined') {
it(`[Emscripten] Initialize FileSystem`, () => {
BrowserFS.initialize(new BrowserFS.FileSystem.InMemory());
});
generateTest(`[Emscripten] Load fixtures (${testName})`, loadFixtures);
it(`[Emscripten] ${testName}`, function(done: (e?: any) => void) {
let stdout = "";
let stderr = "";
let fs = BrowserFS.BFSRequire('fs');
let path = BrowserFS.BFSRequire('path');
let expectedStdout: string = null;
let expectedStderr: string = null;
let testNameNoExt = testName.slice(0, testName.length - path.extname(testName).length);
try {
expectedStdout = fs.readFileSync(`/test/fixtures/files/emscripten/${testNameNoExt}.out`).toString().replace(/\r/g, '');
expectedStderr = fs.readFileSync(`/test/fixtures/files/emscripten/${testNameNoExt}.err`).toString().replace(/\r/g, '');
} catch (e) {
// No stdout/stderr test.
}
const Module = {
print: function(text: string) { stdout += text + '\n'; },
printErr: function(text: string) { stderr += text + '\n'; },
onExit: function(code) {
if (code !== 0) {
done(new Error(`Program exited with code ${code}.\nstdout:\n${stdout}\nstderr:\n${stderr}`));
} else {
if (expectedStdout !== null) {
assert.equal(stdout.trim(), expectedStdout.trim());
assert.equal(stderr.trim(), expectedStderr.trim());
}
done();
}
},
// Block standard input. Otherwise, the unit tests inexplicably read from stdin???
stdin: function() {
return null;
},
locateFile: function(fname: string): string {
return `/test/tests/emscripten/${fname}`;
},
preRun: function() {
const FS = Module.FS;
const BFS = new BFSEmscriptenFS(FS, Module.PATH, Module.ERRNO_CODES);
FS.mkdir('/files');
console.log(BrowserFS.BFSRequire('fs').readdirSync('/test/fixtures/files/emscripten'));
FS.mount(BFS, {root: '/test/fixtures/files/emscripten'}, '/files');
FS.chdir('/files');
},
ENVIRONMENT: "WEB",
FS: <any> undefined,
PATH: <any> undefined,
ERRNO_CODES: <any> undefined
};
test(Module);
});
}
}
function generateBackendTests(name: string, backend: file_system.FileSystem) {
>>>>>>>
function generateEmscriptenTest(testName: string, test: (module: any) => void) {
// Only applicable to typed array-compatible browsers.
if (typeof(Uint8Array) !== 'undefined') {
it(`[Emscripten] Initialize FileSystem`, () => {
BrowserFS.initialize(new BrowserFS.FileSystem.InMemory());
});
generateTest(`[Emscripten] Load fixtures (${testName})`, loadFixtures);
it(`[Emscripten] ${testName}`, function(done: (e?: any) => void) {
let stdout = "";
let stderr = "";
let fs = BrowserFS.BFSRequire('fs');
let path = BrowserFS.BFSRequire('path');
let expectedStdout: string = null;
let expectedStderr: string = null;
let testNameNoExt = testName.slice(0, testName.length - path.extname(testName).length);
try {
expectedStdout = fs.readFileSync(`/test/fixtures/files/emscripten/${testNameNoExt}.out`).toString().replace(/\r/g, '');
expectedStderr = fs.readFileSync(`/test/fixtures/files/emscripten/${testNameNoExt}.err`).toString().replace(/\r/g, '');
} catch (e) {
// No stdout/stderr test.
}
const Module = {
print: function(text: string) { stdout += text + '\n'; },
printErr: function(text: string) { stderr += text + '\n'; },
onExit: function(code) {
if (code !== 0) {
done(new Error(`Program exited with code ${code}.\nstdout:\n${stdout}\nstderr:\n${stderr}`));
} else {
if (expectedStdout !== null) {
assert.equal(stdout.trim(), expectedStdout.trim());
assert.equal(stderr.trim(), expectedStderr.trim());
}
done();
}
},
// Block standard input. Otherwise, the unit tests inexplicably read from stdin???
stdin: function() {
return null;
},
locateFile: function(fname: string): string {
return `/test/tests/emscripten/${fname}`;
},
preRun: function() {
const FS = Module.FS;
const BFS = new BFSEmscriptenFS(FS, Module.PATH, Module.ERRNO_CODES);
FS.mkdir('/files');
console.log(BrowserFS.BFSRequire('fs').readdirSync('/test/fixtures/files/emscripten'));
FS.mount(BFS, {root: '/test/fixtures/files/emscripten'}, '/files');
FS.chdir('/files');
},
ENVIRONMENT: "WEB",
FS: <any> undefined,
PATH: <any> undefined,
ERRNO_CODES: <any> undefined
};
test(Module);
});
}
}
function generateBackendTests(name: string, backend: FileSystem) {
<<<<<<<
asyncEachSeries(backendFactories, (factory: BackendFactory, cb: (e?: any) => void) => {
factory((name: string, backends: FileSystem[]) => {
=======
async.eachSeries(backendFactories, (factory: BackendFactory, cb: (e?: any) => void) => {
let timeout = setTimeout(() => {
throw new Error(`Backend ${factory['name']} failed to initialize promptly.`);
}, 10000);
factory((name: string, backends: file_system.FileSystem[]) => {
clearTimeout(timeout);
>>>>>>>
asyncEachSeries(backendFactories, (factory: BackendFactory, cb: (e?: any) => void) => {
let timeout = setTimeout(() => {
throw new Error(`Backend ${factory['name']} failed to initialize promptly.`);
}, 10000);
factory((name: string, backends: FileSystem[]) => {
clearTimeout(timeout); |
<<<<<<<
import { Model, Token2Vec } from '../../typings'
import { enrichToken2Vec, getSentenceFeatures } from '../language/ft_featurizer'
=======
import { getProgressPayload, identityProgress } from '../../tools/progress'
import { Model } from '../../typings'
import { getSentenceFeatures } from '../language/ft_featurizer'
>>>>>>>
import { getProgressPayload, identityProgress } from '../../tools/progress'
import { Model, Token2Vec } from '../../typings'
import { enrichToken2Vec, getSentenceFeatures } from '../language/ft_featurizer' |
<<<<<<<
import { CMS } from './cms/cms'
import { ContentElementSender } from './cms/content-sender'
import { ConverseService } from './converse'
=======
import { CMSService } from './cms/cms-service'
>>>>>>>
import { CMS } from './cms/cms'
import { ConverseService } from './converse' |
<<<<<<<
for (let i = 0; i < utterance.tokens.length; i++) {
const results = _.orderBy(
candidates.filter(x => !x.eliminated && x.start <= i && x.end >= i),
// we want to favor longer matches (but is obviously less important than score)
// so we take its length into account (up to the longest candidate)
x => x.score * Math.pow(Math.min(x.source.length, longestCandidate), 1 / 5),
'desc'
)
if (results.length > 1) {
const [, ...losers] = results
losers.forEach(x => (x.eliminated = true))
}
}
}
return candidates
.filter(x => !x.eliminated && x.score >= ENTITY_SCORE_THRESHOLD)
.map(match => ({
confidence: match.score,
start: utterance.tokens[match.start].offset,
end: utterance.tokens[match.end].offset + utterance.tokens[match.end].value.length,
value: match.canonical,
metadata: {
source: match.source,
occurrence: match.occurrence,
entityId: listModel.id
},
type: listModel.entityName
})) as EntityExtractionResult[]
}
export const extractListEntities = (
utterance: Utterance,
list_entities: ListEntityModel[]
): EntityExtractionResult[] => {
const cacheKey = utterance.toString()
const [listModelsWithCachedRes, listModelsToExtract] = splitModels(list_entities, cacheKey)
let matches = _.flatMap(listModelsWithCachedRes, listModel => listModel.cache.get(cacheKey))
for (const list of listModelsToExtract) {
const extracted = extractForListModel(utterance, list)
if (extracted.length > 0) {
matches = [...matches, ...extracted]
list.cache?.set(cacheKey, extracted)
}
=======
candidates
.filter(x => !x.eliminated && x.score >= ENTITY_SCORE_THRESHOLD)
.forEach(match => {
matches.push({
confidence: match.score,
start: utterance.tokens[match.start].offset,
end: utterance.tokens[match.end].offset + utterance.tokens[match.end].value.length,
value: match.canonical,
metadata: {
extractor: 'list',
source: match.source,
occurrence: match.occurrence,
entityId: list.id
},
type: list.entityName
})
})
>>>>>>>
for (let i = 0; i < utterance.tokens.length; i++) {
const results = _.orderBy(
candidates.filter(x => !x.eliminated && x.start <= i && x.end >= i),
// we want to favor longer matches (but is obviously less important than score)
// so we take its length into account (up to the longest candidate)
x => x.score * Math.pow(Math.min(x.source.length, longestCandidate), 1 / 5),
'desc'
)
if (results.length > 1) {
const [, ...losers] = results
losers.forEach(x => (x.eliminated = true))
}
}
}
return candidates
.filter(x => !x.eliminated && x.score >= ENTITY_SCORE_THRESHOLD)
.map(match => ({
confidence: match.score,
start: utterance.tokens[match.start].offset,
end: utterance.tokens[match.end].offset + utterance.tokens[match.end].value.length,
value: match.canonical,
metadata: {
extractor: 'list',
source: match.source,
occurrence: match.occurrence,
entityId: listModel.id
},
type: listModel.entityName
})) as EntityExtractionResult[]
}
// TODO useCache param
export const extractListEntities = (
utterance: Utterance,
list_entities: ListEntityModel[]
): EntityExtractionResult[] => {
const cacheKey = utterance.toString()
const [listModelsWithCachedRes, listModelsToExtract] = splitModels(list_entities, cacheKey)
let matches = _.flatMap(listModelsWithCachedRes, listModel => listModel.cache?.get(cacheKey))
for (const list of listModelsToExtract) {
const extracted = extractForListModel(utterance, list)
if (extracted.length > 0) {
matches = [...matches, ...extracted]
list.cache?.set(cacheKey, extracted)
}
<<<<<<<
=======
}
// TODO clean this later with entities and intent srvices
// This will be removed in another commit
export function mapE1toE2Entity(ent: NLU.Entity): EntityExtractionResult {
return {
confidence: ent.meta.confidence,
start: ent.meta.start,
end: ent.meta.end,
value: ent.data.value,
metadata: {
extractor: 'system',
source: ent.meta.source,
entityId: `system.${ent.name}`,
unit: ent.data.unit
},
type: ent.name
}
>>>>>>> |
<<<<<<<
BotService.setBotStatus(botId, 'error')
this.logger
.attachError(err)
.error(`Cannot mount bot "${botId}". Make sure it exists on the filesystem or the database.`)
return false
} finally {
await this._updateBotHealthDebounce()
=======
this.logger.attachError(err).error(`Cannot mount bot "${botId}"`)
>>>>>>>
BotService.setBotStatus(botId, 'error')
this.logger.attachError(err).error(`Cannot mount bot "${botId}"`)
return false
} finally {
await this._updateBotHealthDebounce() |
<<<<<<<
defaultLanguage: string
languages: string[]
=======
locked: boolean
pipeline_status: BotPipelineStatus
}
export type Pipeline = Stage[]
export type StageAction = 'promote_copy' | 'promote_move'
export interface Stage {
id: string
label: string
action: StageAction
}
export interface BotPipelineStatus {
current_stage: {
promoted_by: string
promoted_on: Date
id: string
}
stage_request?: {
requested_on: Date
expires_on?: Date
message?: string
status: string
requested_by: string
id: string
}
>>>>>>>
defaultLanguage: string
languages: string[]
locked: boolean
pipeline_status: BotPipelineStatus
}
export type Pipeline = Stage[]
export type StageAction = 'promote_copy' | 'promote_move'
export interface Stage {
id: string
label: string
action: StageAction
}
export interface BotPipelineStatus {
current_stage: {
promoted_by: string
promoted_on: Date
id: string
}
stage_request?: {
requested_on: Date
expires_on?: Date
message?: string
status: string
requested_by: string
id: string
} |
<<<<<<<
updateIntent: (intent: NLU.IntentDefinition) => bp.axios.put(`/mod/nlu/intents/${intent.name}`, intent),
deleteIntent: (name: string) => bp.axios.delete(`/mod/nlu/intents/${name}`),
=======
updateIntent: () => {}, // TODO use /intent/:id/utterances and use it in intent editor
deleteIntent: (name: string) => bp.axios.post(`/mod/nlu/intents/${name}/delete`),
>>>>>>>
updateIntent: (intent: NLU.IntentDefinition) => bp.axios.put(`/mod/nlu/intents/${intent.name}`, intent),
deleteIntent: (name: string) => bp.axios.post(`/mod/nlu/intents/${name}/delete`), |
<<<<<<<
const isProduction = !yn(process.env.DEBUG) && (isPackaged || process.env.NODE_ENV == 'production')
const botpressEdition = process.env.EDITION || 'community'
const projectLocation = isPackaged
? path.join(path.dirname(process.execPath)) // We point at the binary path
: path.join(__dirname, '..') // e.g. /dist/..
=======
const isProduction = process.IS_PRODUCTION
>>>>>>>
const isProduction = process.IS_PRODUCTION
const botpressEdition = process.env.EDITION || 'community'
<<<<<<<
container.bind<string>(TYPES.ProjectLocation).toConstantValue(projectLocation)
container.bind<string>(TYPES.BotpressEdition).toConstantValue(botpressEdition)
=======
>>>>>>>
container.bind<string>(TYPES.BotpressEdition).toConstantValue(botpressEdition) |
<<<<<<<
{ name: 'folder-mobile', folderNames: ['mobile', 'mobiles', 'portable', 'portability'] },
=======
{ name: 'folder-mobile', folderNames: ['mobile', 'mobiles', 'portable'] },
{ name: 'folder-stencil', folderNames: ['.stencil'] },
{ name: 'folder-firebase', folderNames: ['.firebase'] },
>>>>>>>
{ name: 'folder-mobile', folderNames: ['mobile', 'mobiles', 'portable'] },
{ name: 'folder-stencil', folderNames: ['.stencil'] },
{ name: 'folder-firebase', folderNames: ['.firebase'] },
{ name: 'folder-mobile', folderNames: ['mobile', 'mobiles', 'portable', 'portability'] }, |
<<<<<<<
import { Predictor, Trainer as SVMTrainer } from './svm'
=======
import { processor } from './sentencepiece'
>>>>>>>
import { processor } from './sentencepiece'
import { Predictor, Trainer as SVMTrainer } from './svm' |
<<<<<<<
import { WellKnownFlags } from 'core/sdk/enums'
=======
>>>>>>> |
<<<<<<<
import fse from 'fs-extra'
import _, { debounce, sumBy } from 'lodash'
=======
import * as sdk from 'botpress/sdk'
>>>>>>>
import * as sdk from 'botpress/sdk'
import fse from 'fs-extra'
import _, { debounce, sumBy } from 'lodash'
<<<<<<<
import { setSimilarity, vocabNGram } from './tools/strings'
import { LangsGateway, LanguageProvider, LanguageSource } from './typings'
=======
import { LangsGateway, LanguageProvider, LanguageSource, NLUHealth } from './typings'
>>>>>>>
import { setSimilarity, vocabNGram } from './tools/strings'
import { LangsGateway, LanguageProvider, LanguageSource, NLUHealth } from './typings'
<<<<<<<
private _vectorsCache: lru<string, Float32Array>
private _vectorsCachePath = path.join(process.APP_DATA_PATH, 'cache', 'lang_vectors.json')
private _junkwordsCachePath = path.join(process.APP_DATA_PATH, 'cache', 'junk_words.json')
private _tokensCache: lru<string, string[]>
private _junkwordsCache: lru<string[], string[]>
private _cacheDumpDisabled: boolean = false
=======
private _vectorsCache
private _tokensCache
private _validProvidersCount: number
>>>>>>>
private _vectorsCache: lru<string, Float32Array>
private _vectorsCachePath = path.join(process.APP_DATA_PATH, 'cache', 'lang_vectors.json')
private _junkwordsCachePath = path.join(process.APP_DATA_PATH, 'cache', 'junk_words.json')
private _tokensCache: lru<string, string[]>
private _junkwordsCache: lru<string[], string[]>
private _cacheDumpDisabled: boolean = false
private _validProvidersCount: number
<<<<<<<
async initialize(sources: LanguageSource[]): Promise<LanguageProvider> {
this._vectorsCache = new lru<string, Float32Array>({
length: (arr: Float32Array) => {
if (arr && arr.BYTES_PER_ELEMENT) {
return arr.length * arr.BYTES_PER_ELEMENT
} else {
return 300 /* dim */ * Float32Array.BYTES_PER_ELEMENT
}
},
max: 300 /* dim */ * Float32Array.BYTES_PER_ELEMENT /* bytes */ * 500000 /* tokens */
})
this._tokensCache = new lru<string, string[]>({
maxAge: maxAgeCacheInMS
})
=======
async initialize(sources: LanguageSource[], logger: typeof sdk.logger): Promise<LanguageProvider> {
this._tokensCache = new lru({ maxAge: maxAgeCacheInMS })
this._vectorsCache = new lru({ maxAge: maxAgeCacheInMS })
this._validProvidersCount = 0
>>>>>>>
async initialize(sources: LanguageSource[], logger: typeof sdk.logger): Promise<LanguageProvider> {
this._vectorsCache = new lru<string, Float32Array>({
length: (arr: Float32Array) => {
if (arr && arr.BYTES_PER_ELEMENT) {
return arr.length * arr.BYTES_PER_ELEMENT
} else {
return 300 /* dim */ * Float32Array.BYTES_PER_ELEMENT
}
},
max: 300 /* dim */ * Float32Array.BYTES_PER_ELEMENT /* bytes */ * 500000 /* tokens */
})
this._tokensCache = new lru<string, string[]>({
maxAge: maxAgeCacheInMS
})
this._validProvidersCount = 0
<<<<<<<
private onVectorsCacheChanged = debounce(() => {
if (!this._cacheDumpDisabled) {
this.dumpVectorsCache()
}
}, ms('5s'))
private onJunkWordsCacheChanged = debounce(() => {
if (!this._cacheDumpDisabled) {
this.dumpJunkWordsCache()
}
}, ms('5s'))
private dumpVectorsCache() {
try {
fse.ensureFileSync(this._vectorsCachePath)
fse.writeJSONSync(this._vectorsCachePath, this._vectorsCache.dump())
debug('vectors cache updated at: %s', this._vectorsCachePath)
} catch (err) {
debug('could not persist vectors cache, error: %s', err.message)
this._cacheDumpDisabled = true
}
}
private restoreVectorsCache() {
try {
if (fse.existsSync(this._vectorsCachePath)) {
const dump = fse.readJSONSync(this._vectorsCachePath)
if (dump) {
const kve = dump.map(x => ({ e: x.e, k: x.k, v: Float32Array.from(Object.values(x.v)) }))
this._vectorsCache.load(kve)
}
}
} catch (err) {
debug('could not restore vectors cache, error: %s', err.message)
}
}
private dumpJunkWordsCache() {
try {
fse.ensureFileSync(this._junkwordsCachePath)
fse.writeJSONSync(this._junkwordsCachePath, this._junkwordsCache.dump())
debug('junk words cache updated at: %s', this._junkwordsCache)
} catch (err) {
debug('could not persist junk cache, error: %s', err.message)
this._cacheDumpDisabled = true
}
}
private restoreJunkWordsCache() {
try {
if (fse.existsSync(this._junkwordsCachePath)) {
const dump = fse.readJSONSync(this._junkwordsCachePath)
this._vectorsCache.load(dump)
}
} catch (err) {
debug('could not restore junk cache, error: %s', err.message)
}
}
=======
getHealth(): Partial<NLUHealth> {
return { validProvidersCount: this._validProvidersCount, validLanguages: Object.keys(this.langs) }
}
>>>>>>>
private onVectorsCacheChanged = debounce(() => {
if (!this._cacheDumpDisabled) {
this.dumpVectorsCache()
}
}, ms('5s'))
private onJunkWordsCacheChanged = debounce(() => {
if (!this._cacheDumpDisabled) {
this.dumpJunkWordsCache()
}
}, ms('5s'))
private dumpVectorsCache() {
try {
fse.ensureFileSync(this._vectorsCachePath)
fse.writeJSONSync(this._vectorsCachePath, this._vectorsCache.dump())
debug('vectors cache updated at: %s', this._vectorsCachePath)
} catch (err) {
debug('could not persist vectors cache, error: %s', err.message)
this._cacheDumpDisabled = true
}
}
private restoreVectorsCache() {
try {
if (fse.existsSync(this._vectorsCachePath)) {
const dump = fse.readJSONSync(this._vectorsCachePath)
if (dump) {
const kve = dump.map(x => ({ e: x.e, k: x.k, v: Float32Array.from(Object.values(x.v)) }))
this._vectorsCache.load(kve)
}
}
} catch (err) {
debug('could not restore vectors cache, error: %s', err.message)
}
}
private dumpJunkWordsCache() {
try {
fse.ensureFileSync(this._junkwordsCachePath)
fse.writeJSONSync(this._junkwordsCachePath, this._junkwordsCache.dump())
debug('junk words cache updated at: %s', this._junkwordsCache)
} catch (err) {
debug('could not persist junk cache, error: %s', err.message)
this._cacheDumpDisabled = true
}
}
private restoreJunkWordsCache() {
try {
if (fse.existsSync(this._junkwordsCachePath)) {
const dump = fse.readJSONSync(this._junkwordsCachePath)
this._vectorsCache.load(dump)
}
} catch (err) {
debug('could not restore junk cache, error: %s', err.message)
}
}
getHealth(): Partial<NLUHealth> {
return { validProvidersCount: this._validProvidersCount, validLanguages: Object.keys(this.langs) }
} |
<<<<<<<
if (slotDef && !entity) {
return
}
const value = _.get(entity, 'data.value', token.value) // entity can be null if slot type = any
const confidence = _.get(entity, 'meta.confidence', -1)
=======
const value = _.get(entity, 'data.value', token.value)
const source = _.get(entity, 'meta.source', token.value)
>>>>>>>
if (slotDef && !entity) {
return
}
const value = _.get(entity, 'data.value', token.value)
const source = _.get(entity, 'meta.source', token.value)
const confidence = _.get(entity, 'meta.confidence', -1)
<<<<<<<
value,
entity,
confidence
=======
value,
source
>>>>>>>
value,
entity,
confidence,
source |
<<<<<<<
import { KeyValueStore } from './services/kvs/kvs'
=======
import { ScopedGhostService } from './services/ghost/service'
>>>>>>>
import { ScopedGhostService } from './services/ghost/service'
import { KeyValueStore } from './services/kvs/kvs'
<<<<<<<
@inject(TYPES.KeyValueStore) keyValueStore: KeyValueStore,
@inject(TYPES.NotificationsService) notificationService: NotificationsService
=======
@inject(TYPES.NotificationsService) notificationService: NotificationsService,
@inject(TYPES.BotLoader) botLoader: BotLoader,
@inject(TYPES.GhostService) ghostService: GhostService
>>>>>>>
@inject(TYPES.KeyValueStore) keyValueStore: KeyValueStore,
@inject(TYPES.NotificationsService) notificationService: NotificationsService,
@inject(TYPES.BotLoader) botLoader: BotLoader,
@inject(TYPES.GhostService) ghostService: GhostService
<<<<<<<
kvs: this.kvs,
notifications: this.notifications
=======
notifications: this.notifications,
ghost: this.ghost,
bots: this.bots
>>>>>>>
kvs: this.kvs,
notifications: this.notifications,
ghost: this.ghost,
bots: this.bots |
<<<<<<<
import cluster from 'cluster'
import { Botpress, Config, Logger } from 'core/app'
=======
import { Botpress, Config, Db, Ghost, Logger } from 'core/app'
>>>>>>>
import cluster from 'cluster'
import { Botpress, Config, Db, Ghost, Logger } from 'core/app'
<<<<<<<
if (cluster.isMaster) {
// The master process only needs getos and rewire
return setupMasterNode(await Logger('Cluster'))
}
=======
await setupEnv()
>>>>>>>
if (cluster.isMaster) {
// The master process only needs getos and rewire
return setupMasterNode(await Logger('Cluster'))
}
await setupEnv() |
<<<<<<<
isAllowed = botId ? writePermissions.botActions : writePermissions.globalActions
} else if (type === 'bot_config') {
isAllowed = writePermissions.botConfigs
} else if (type === 'global_config' || type === 'module_config') {
isAllowed = writePermissions.globalConfigs
=======
return ghost.upsertFile('/actions', location, content, true, true)
>>>>>>>
isAllowed = botId ? writePermissions.botActions : writePermissions.globalActions
} else if (type === 'bot_config') {
isAllowed = writePermissions.botConfigs
} else if (type === 'global_config' || type === 'module_config') {
isAllowed = writePermissions.globalConfigs
<<<<<<<
isAllowed = writePermissions.hooks
}
if (!isAllowed) {
throw new WritePermissionError(`Insufficient permissions to apply modifications on file ${name}`)
}
}
async saveFile(file: EditableFile, permissions: FilePermissions): Promise<void> {
await this._validateMetadata(file)
this._assertWritePermissions(file, permissions)
const { location, content, hookType, type } = file
if (type === 'action') {
return this._getGhost(file).upsertFile('/actions', location, content)
}
const ghost = this.bp.ghost.forGlobal()
if (type === 'hook') {
return ghost.upsertFile(`/hooks/${hookType}`, location.replace(hookType, ''), content)
}
if (type === 'bot_config' || type === 'global_config' || type === 'module_config') {
return ghost.upsertFile('/', location, content)
=======
return ghost.upsertFile(`/hooks/${hookType}`, location.replace(hookType, ''), content, true, true)
} else if (type === 'bot_config') {
return ghost.upsertFile('/', 'bot.config.json', content)
>>>>>>>
isAllowed = writePermissions.hooks
}
if (!isAllowed) {
throw new WritePermissionError(`Insufficient permissions to apply modifications on file ${name}`)
}
}
async saveFile(file: EditableFile, permissions: FilePermissions): Promise<void> {
await this._validateMetadata(file)
this._assertWritePermissions(file, permissions)
const { location, content, hookType, type } = file
if (type === 'action') {
return this._getGhost(file).upsertFile('/actions', location, content, true, true)
}
const ghost = this.bp.ghost.forGlobal()
if (type === 'hook') {
return ghost.upsertFile(`/hooks/${hookType}`, location.replace(hookType, ''), content, true, true)
}
if (type === 'bot_config' || type === 'global_config' || type === 'module_config') {
return ghost.upsertFile('/', location, content) |
<<<<<<<
import ms from 'ms'
=======
import moment from 'moment'
>>>>>>>
import moment from 'moment'
import ms from 'ms'
<<<<<<<
this.router.get(
'/notifications',
this.checkTokenHeader,
this.needPermissions('read', 'bot.notifications'),
async (req, res) => {
const botId = req.params.botId
const notifications = await this.notificationService.getInbox(botId)
res.send(notifications)
}
)
=======
this.router.get(
'/logs/archive',
this.checkTokenHeader,
this.needPermissions('read', 'bot.logs'),
async (req, res) => {
const botId = req.params.botId
const logs = await this.logsService.getLogsForBot(botId)
res.setHeader('Content-type', 'text/plain')
res.setHeader('Content-disposition', 'attachment; filename=logs.txt')
res.send(
logs
.map(({ timestamp, level, message }) => {
const time = moment(new Date(timestamp)).format('MMM DD HH:mm:ss')
return `${time} ${level}: ${message}`
})
.join('\n')
)
}
)
this.router.get('/notifications', async (req, res) => {
const botId = req.params.botId
const notifications = await this.notificationService.getInbox(botId)
res.send(notifications)
})
>>>>>>>
this.router.get(
'/logs/archive',
this.checkTokenHeader,
this.needPermissions('read', 'bot.logs'),
async (req, res) => {
const botId = req.params.botId
const logs = await this.logsService.getLogsForBot(botId)
res.setHeader('Content-type', 'text/plain')
res.setHeader('Content-disposition', 'attachment; filename=logs.txt')
res.send(
logs
.map(({ timestamp, level, message }) => {
const time = moment(new Date(timestamp)).format('MMM DD HH:mm:ss')
return `${time} ${level}: ${message}`
})
.join('\n')
)
}
)
this.router.get(
'/notifications',
this.checkTokenHeader,
this.needPermissions('read', 'bot.notifications'),
async (req, res) => {
const botId = req.params.botId
const notifications = await this.notificationService.getInbox(botId)
res.send(notifications)
}
) |
<<<<<<<
private _extractEntities = async (ds: NLUStructure): Promise<NLUStructure> => {
=======
public get modelHash() {
return this._currentModelHash
}
public computeModelHash(intents: sdk.NLU.IntentDefinition[]) {
return crypto
.createHash('md5')
.update(JSON.stringify(intents))
.digest('hex')
}
private async _extractEntities(text: string, lang: string): Promise<sdk.NLU.Entity[]> {
>>>>>>>
public get modelHash() {
return this._currentModelHash
}
public computeModelHash(intents: sdk.NLU.IntentDefinition[]) {
return crypto
.createHash('md5')
.update(JSON.stringify(intents))
.digest('hex')
}
private _extractEntities = async (ds: NLUStructure): Promise<NLUStructure> => { |
<<<<<<<
/**
* Overrides the auto-computed `process.APP_DATA_PATH` path
* @see Process.APP_DATA_PATH
*/
readonly APP_DATA_PATH?: string
=======
/**
* Truthy if running the official Botpress docker image
*/
readonly BP_IS_DOCKER?: boolean
>>>>>>>
/**
* Overrides the auto-computed `process.APP_DATA_PATH` path
* @see Process.APP_DATA_PATH
*/
readonly APP_DATA_PATH?: string
/**
* Truthy if running the official Botpress docker image
*/
readonly BP_IS_DOCKER?: boolean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.