conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import { TextureUnit, OvrFlags } from "./RenderFlags";
=======
import { TextureUnit } from "./RenderFlags";
import { debugPrint } from "./debugPrint";
>>>>>>>
import { TextureUnit, OvrFlags } from "./RenderFlags";
import { debugPrint } from "./debugPrint"; |
<<<<<<<
import { DisclosedTileTreeSet, LRUTileList, Tile, TileLoadStatus, TileRequest, TileTree, TileTreeOwner, TileUsageMarker } from "./internal";
import { NativeApp } from "../NativeApp";
=======
import { Tile, TileLoadStatus, TileRequest, TileTree, TileTreeOwner, TileTreeSet, TileUsageMarker } from "./internal";
import { IpcApp } from "../IpcApp";
>>>>>>>
import { DisclosedTileTreeSet, LRUTileList, Tile, TileLoadStatus, TileRequest, TileTree, TileTreeOwner, TileUsageMarker } from "./internal";
import { IpcApp } from "../IpcApp";
<<<<<<<
this._isDispatched = true;
=======
this._rpcInitialized = true;
const retryInterval = this._retryInterval;
RpcOperation.lookup(IModelTileRpcInterface, "requestTileTreeProps").policy.retryInterval = () => retryInterval;
const policy = RpcOperation.lookup(IModelTileRpcInterface, "requestTileContent").policy;
policy.retryInterval = () => retryInterval;
policy.allowResponseCaching = () => RpcResponseCacheControl.Immutable;
if (IpcApp.isValid) {
this._canceledElementGraphicsRequests = new Map<IModelConnection, string[]>();
if (this._cancelBackendTileRequests)
this._canceledIModelTileRequests = new Map<IModelConnection, Map<string, Set<string>>>();
} else {
this._cancelBackendTileRequests = false;
}
}
>>>>>>>
this._isDispatched = true; |
<<<<<<<
import { AccessToken, ChangeSet, IModel as HubIModel } from "@bentley/imodeljs-clients";
=======
import { AccessToken, MultiCode, CodeState } from "@bentley/imodeljs-clients";
import { ChangeSet } from "@bentley/imodeljs-clients";
>>>>>>>
import { AccessToken, ChangeSet, IModel as HubIModel } from "@bentley/imodeljs-clients";
<<<<<<<
it.skip("should write to briefcase with optimistic concurrency", async () => {
// Delete any existing iModels with the same name as the read-write test iModel
const iModelName = "ReadWriteTest";
const iModels: HubIModel[] = await IModelTestUtils.hubClient.getIModels(accessToken, testProjectId, {
$select: "*",
$filter: "Name+eq+'" + iModelName + "'",
});
for (const iModelTemp of iModels) {
await IModelTestUtils.hubClient.deleteIModel(accessToken, testProjectId, iModelTemp.wsgId);
}
// Create a new iModel on the Hub (by uploading a seed file)
const pathname = path.join(__dirname, "assets", iModelName + ".bim");
const rwIModelId: string = await BriefcaseManager.uploadIModel(accessToken, testProjectId, pathname);
assert.isNotEmpty(rwIModelId);
=======
it.only("should write to briefcase with optimistic concurrency", async () => {
>>>>>>>
it.skip("should write to briefcase with optimistic concurrency", async () => {
// Delete any existing iModels with the same name as the read-write test iModel
const iModelName = "ReadWriteTest";
const iModels: HubIModel[] = await IModelTestUtils.hubClient.getIModels(accessToken, testProjectId, {
$select: "*",
$filter: "Name+eq+'" + iModelName + "'",
});
for (const iModelTemp of iModels) {
await IModelTestUtils.hubClient.deleteIModel(accessToken, testProjectId, iModelTemp.wsgId);
}
// Create a new iModel on the Hub (by uploading a seed file)
const pathname = path.join(__dirname, "assets", iModelName + ".bim");
const rwIModelId: string = await BriefcaseManager.uploadIModel(accessToken, testProjectId, pathname);
assert.isNotEmpty(rwIModelId);
<<<<<<<
// (Later, when the app downloads and merges changeSets from the Hub into the briefcase, BriefcaseManager will merge changes and handle conflicts.)
rwIModel.setConcurrencyControlPolicy(new BriefcaseManager.OptimisticConcurrencyControlPolicy({
updateVsUpdate: BriefcaseManager.ConflictResolution.Reject,
updateVsDelete: BriefcaseManager.ConflictResolution.Take,
deleteVsUpdate: BriefcaseManager.ConflictResolution.Reject,
}));
=======
// Later, when the app downloads and merges changeSets from the Hub into the briefcase, BriefcaseManager will merge changes and handle conflicts.
// The app still has to reserve codes.
iModel.concurrencyControl.setPolicy(new ConcurrencyControl.OptimisticPolicy());
>>>>>>>
// Later, when the app downloads and merges changeSets from the Hub into the briefcase, BriefcaseManager will merge changes and handle conflicts.
// The app still has to reserve codes.
rwIModel.concurrencyControl.setPolicy(new ConcurrencyControl.OptimisticPolicy());
<<<<<<<
rwIModel.elements.insertElement(IModelTestUtils.createPhysicalObject(rwIModel, newModelId, spatialCategoryId));
rwIModel.elements.insertElement(IModelTestUtils.createPhysicalObject(rwIModel, newModelId, spatialCategoryId));
=======
const elid1 = iModel.elements.insertElement(IModelTestUtils.createPhysicalObject(iModel, newModelId, spatialCategoryId));
iModel.elements.insertElement(IModelTestUtils.createPhysicalObject(iModel, newModelId, spatialCategoryId));
>>>>>>>
const elid1 = rwIModel.elements.insertElement(IModelTestUtils.createPhysicalObject(rwIModel, newModelId, spatialCategoryId));
rwIModel.elements.insertElement(IModelTestUtils.createPhysicalObject(rwIModel, newModelId, spatialCategoryId)); |
<<<<<<<
import { Decorations, RenderTarget, RenderPlan, Pixel, GraphicList } from "./render/System";
import { UpdatePlan } from "./render/UpdatePlan";
=======
import { Decorations, DecorationList, RenderTarget, RenderPlan, Pixel } from "./render/System";
>>>>>>>
import { Decorations, RenderTarget, RenderPlan, Pixel, GraphicList } from "./render/System"; |
<<<<<<<
channelCache: Record<string, ChannelState | undefined> = {};
=======
channelCache: Record<string, ChannelState> = {};
budgetCache?: SiteBudget;
>>>>>>>
channelCache: Record<string, ChannelState | undefined> = {};
budgetCache?: SiteBudget; |
<<<<<<<
public async createPrimitiveProperty(name: string, primitiveType: PrimitiveType, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<PrimitiveProperty>;
public async createPrimitiveProperty(name: string, primitiveType: Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<EnumerationProperty>;
public async createPrimitiveProperty(name: string, primitiveType?: string, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<ECProperty>;
public async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<ECProperty> {
=======
public async createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;
public async createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;
public async createPrimitiveProperty(name: string, primitiveType?: string): Promise<Property>;
public async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {
>>>>>>>
public async createPrimitiveProperty(name: string, primitiveType: PrimitiveType, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<PrimitiveProperty>;
public async createPrimitiveProperty(name: string, primitiveType: Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<EnumerationProperty>;
public async createPrimitiveProperty(name: string, primitiveType?: string, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<Property>;
public async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number): Promise<Property> {
<<<<<<<
public async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<PrimitiveArrayProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<EnumerationArrayProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType?: string, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<ECProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<ECProperty> {
=======
public async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType?: string): Promise<Property>;
public async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {
>>>>>>>
public async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<PrimitiveArrayProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<EnumerationArrayProperty>;
public async createPrimitiveArrayProperty(name: string, primitiveType?: string, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<Property>;
public async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration, label?: string, description?: string, isReadOnly?: boolean, priority?: number, extendedTypeName?: string, minLength?: number, maxLength?: number, minValue?: number, maxValue?: number, minOccurs?: number, maxOccurs?: number): Promise<Property> { |
<<<<<<<
import { IndexedPrimitiveParamsFeatures, PolylineParamVertex, PolylineParam } from "../../frontend/render/webgl/Graphic";
import { Graphic, GraphicList } from "../../frontend/render/Graphic";
import { FeatureIndexType, FeatureIndex } from "../../frontend/render/webgl/FeatureIndex";
import { IModelConnection } from "../../frontend/IModelConnection";
=======
import { IndexedPrimitiveParamsFeatures, PolylineParamVertex, PolylineParam } from "@bentley/imodeljs-frontend/lib/render/webgl/Graphic";
import { Graphic, GraphicList } from "@bentley/imodeljs-frontend/lib/render/Graphic";
import { FeatureIndexType, FeatureIndex } from "@bentley/imodeljs-frontend/lib/render/webgl/FeatureIndex";
import { IModelConnection } from "@bentley/imodeljs-frontend/lib/IModelConnection";
import { ViewContext } from "@bentley/imodeljs-frontend/lib/ViewContext";
>>>>>>>
import { IndexedPrimitiveParamsFeatures, PolylineParamVertex, PolylineParam } from "@bentley/imodeljs-frontend/lib/render/webgl/Graphic";
import { Graphic, GraphicList } from "@bentley/imodeljs-frontend/lib/render/Graphic";
import { FeatureIndexType, FeatureIndex } from "@bentley/imodeljs-frontend/lib/render/webgl/FeatureIndex";
import { IModelConnection } from "@bentley/imodeljs-frontend/lib/IModelConnection"; |
<<<<<<<
protected _precision: number;
protected _presentationUnits: FormatUnitSpec[];
protected _persistenceUnit: FormatUnitSpec;
get precision() { return this._precision; }
get presentationUnits() { return this._presentationUnits; }
get persistenceUnit() { return this._persistenceUnit; }
=======
public precision: number;
public presentationUnits: FormatUnitSet[];
public persistenceUnit: FormatUnitSet;
>>>>>>>
protected _precision: number;
protected _presentationUnits: FormatUnitSet[];
protected _persistenceUnit: FormatUnitSet;
get precision() { return this._precision; }
get presentationUnits() { return this._presentationUnits; }
get persistenceUnit() { return this._persistenceUnit; }
<<<<<<<
this._presentationUnits = jsonObj.presentationUnits as FormatUnitSpec[];
=======
this.presentationUnits = jsonObj.presentationUnits as FormatUnitSet[];
>>>>>>>
this._presentationUnits = jsonObj.presentationUnits as FormatUnitSet[];
<<<<<<<
this._persistenceUnit = jsonObj.persistenceUnit as FormatUnitSpec;
=======
this.persistenceUnit = jsonObj.persistenceUnit as FormatUnitSet;
>>>>>>>
this._persistenceUnit = jsonObj.persistenceUnit as FormatUnitSet; |
<<<<<<<
import { CodeSpec, CodeSpecNames } from "../../common/Code";
import { ViewDefinitionProps } from "../../common/ViewProps";
import { DrawingViewState, OrthographicViewState, ViewState } from "../../frontend/ViewState";
import { IModelConnection, IModelConnectionElements, IModelConnectionModels } from "../../frontend/IModelConnection";
import { XYAndZ } from "@bentley/geometry-core/lib/PointVector";
import { NavigationValue, ECSqlTypedString, ECSqlStringType } from "../../common/ECSqlTypes";
=======
import { CodeSpec, CodeSpecNames } from "@bentley/imodeljs-common/lib/Code";
import { ViewDefinitionProps } from "@bentley/imodeljs-common/lib/ViewProps";
import { DrawingViewState, OrthographicViewState, ViewState } from "@bentley/imodeljs-frontend/lib/ViewState";
import { IModelConnection, IModelConnectionElements, IModelConnectionModels } from "@bentley/imodeljs-frontend/lib/IModelConnection";
import { Point3d } from "@bentley/geometry-core/lib/PointVector";
import { DateTime, Blob, NavigationValue } from "@bentley/imodeljs-common/lib/ECSqlTypes";
>>>>>>>
import { CodeSpec, CodeSpecNames } from "@bentley/imodeljs-common/lib/Code";
import { ViewDefinitionProps } from "@bentley/imodeljs-common/lib/ViewProps";
import { DrawingViewState, OrthographicViewState, ViewState } from "../../frontend/ViewState";
import { IModelConnection, IModelConnectionElements, IModelConnectionModels } from "../../frontend/IModelConnection";
import { XYAndZ } from "@bentley/geometry-core/lib/PointVector";
import { NavigationValue, ECSqlTypedString, ECSqlStringType } from "@bentley/imodeljs-common/lib/ECSqlTypes"; |
<<<<<<<
import { ToolRegistry } from "./tools/Tool";
import { I18N, I18NNamespace, I18NOptions } from "./Localization";
=======
import { ToolRegistry, ToolGroup } from "./tools/Tool";
import { FeatureGates } from "../common/FeatureGates";
import * as selectTool from "./tools/SelectTool";
import * as viewTool from "./tools/ViewTool";
import * as idleTool from "./tools/IdleTool";
>>>>>>>
import { ToolRegistry } from "./tools/Tool";
import { I18N, I18NNamespace, I18NOptions } from "./Localization";
import { FeatureGates } from "../common/FeatureGates";
import * as selectTool from "./tools/SelectTool";
import * as viewTool from "./tools/ViewTool";
import * as idleTool from "./tools/IdleTool";
<<<<<<<
protected _i18N?: I18N;
=======
public readonly features = new FeatureGates();
>>>>>>>
protected _i18N?: I18N;
public readonly features = new FeatureGates();
<<<<<<<
const namespace: I18NNamespace = iModelApp.i18N.registerNamespace("BaseTools");
tools.registerModule(require("./tools/ViewTool"), namespace);
tools.registerModule(require("./tools/IdleTool"), namespace);
=======
const group = new ToolGroup("BaseTool");
tools.registerModule(selectTool, group);
tools.registerModule(idleTool, group);
tools.registerModule(viewTool, group);
>>>>>>>
const namespace: I18NNamespace = iModelApp.i18N.registerNamespace("BaseTools");
tools.registerModule(selectTool, namespace);
tools.registerModule(idleTool, namespace);
tools.registerModule(viewTool, namespace); |
<<<<<<<
const briefcases = await BriefcaseManager.hubClient!.getBriefcases(accessToken, iModelId);
briefcases.forEach((briefcase: HubBriefcase) => {
=======
const briefcases = await BriefcaseManager.hubClient.getBriefcases(accessToken, iModelId);
briefcases.forEach((briefcase: Briefcase) => {
>>>>>>>
const briefcases = await BriefcaseManager.hubClient.getBriefcases(accessToken, iModelId);
briefcases.forEach((briefcase: HubBriefcase) => { |
<<<<<<<
const projectId = url.split("/").find((val: string) => val.includes("--"))!.split("--")[1];
const tilesId = url.split("/").find((val: string) => /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(val));
const json = await realityDataServiceClient.getRootDocumentJsonFromUrl(accessToken, url);
=======
const json = await realityDataServiceClient.getTileJsonFromUrl(accessToken, url);
>>>>>>>
const projectId = url.split("/").find((val: string) => val.includes("--"))!.split("--")[1];
const tilesId = url.split("/").find((val: string) => /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(val));
const json = await realityDataServiceClient.getTileJsonFromUrl(accessToken, url); |
<<<<<<<
=======
import { AxisAlignedBox3d } from "../common/geometry/Primitives";
import { IModelDbLinkTableRelationships, LinkTableRelationship } from "./LinkTableRelationship";
>>>>>>>
import { IModelDbLinkTableRelationships, LinkTableRelationship } from "./LinkTableRelationship"; |
<<<<<<<
if (SCHEMAURL3_2 !== jsonObj.$schema) {
throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, "Schema namespace '$(jsonObj.$schema)' is not supported.");
}
=======
if (Schema.ec32 && SCHEMAURL3_2 !== jsonObj.$schema)
throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl);
else if (!Schema.ec32 && SCHEMAURL3_1 !== jsonObj.$schema)
throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl);
>>>>>>>
if (Schema.ec32 && SCHEMAURL3_2 !== jsonObj.$schema)
throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, "Schema namespace '$(jsonObj.$schema)' is not supported.");
else if (!Schema.ec32 && SCHEMAURL3_1 !== jsonObj.$schema)
throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, "Schema namespace '$(jsonObj.$schema)' is not supported."); |
<<<<<<<
try {
const json = await this._iModel.getDgnDb().getElement(JSON.stringify(opts));
const stream: IElement = JSON.parse(json) as IElement;
stream._iModel = this._iModel;
let el = EcRegistry.create(stream) as Element | undefined;
if (el === undefined) {
await EcRegistry.generateClassFor(stream, this._iModel);
el = EcRegistry.create(stream) as Element | undefined;
}
return el;
} catch (e) {
return undefined;
}
=======
// first see if the element is already in the local cache.
if (opts.id) {
const loaded = this._loaded.get(opts.id.toString());
if (loaded)
return loaded;
}
const json = await this._iModel.getDgnDb().getElement(JSON.stringify(opts));
const stream = JSON.parse(json);
stream._iModel = this._iModel;
const el = EcRegistry.create(stream, "BisCore.Element") as Element | undefined;
if (el) { // found it, register it in the local cache.
this._loaded.set(el.id.toString(), el);
}
return el;
>>>>>>>
// first see if the element is already in the local cache.
if (opts.id) {
const loaded = this._loaded.get(opts.id.toString());
if (loaded)
return loaded;
}
const json = await this._iModel.getDgnDb().getElement(JSON.stringify(opts));
const stream: IElement = JSON.parse(json) as IElement;
stream._iModel = this._iModel;
let el = EcRegistry.create(stream) as Element | undefined;
if (el === undefined) {
await EcRegistry.generateClassFor(stream, this._iModel);
el = EcRegistry.create(stream) as Element | undefined;
}
if (el) { // found it, register it in the local cache.
this._loaded.set(el.id.toString(), el);
}
return el; |
<<<<<<<
import { IModelTestUtils } from "./IModelTestUtils";
import { MockAssetUtil } from "./MockAssetUtil";
=======
import { IModelTestUtils, TestUsers } from "./IModelTestUtils";
>>>>>>>
import { IModelTestUtils, TestUsers } from "./IModelTestUtils";
import { MockAssetUtil } from "./MockAssetUtil";
<<<<<<<
class MockAccessToken extends AccessToken {
public constructor() { super(""); }
public getUserProfile(): UserProfile|undefined {
return new UserProfile ("test", "user", "[email protected]", "12345", "Bentley");
}
public toTokenString() { return ""; }
}
export class IModelTestUser {
public static user = {
email: "[email protected]",
password: "pmadm1",
};
}
=======
async function createNewModelAndCategory(rwIModel: IModelDb, accessToken: AccessToken) {
// Create a new physical model.
let modelId: Id64;
[, modelId] = IModelTestUtils.createAndInsertPhysicalModel(rwIModel, IModelTestUtils.getUniqueModelCode(rwIModel, "newPhysicalModel"), true);
// Find or create a SpatialCategory.
const dictionary: DictionaryModel = rwIModel.models.getModel(IModel.getDictionaryId()) as DictionaryModel;
const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, "ThisTestSpatialCategory");
const spatialCategoryId: Id64 = IModelTestUtils.createAndInsertSpatialCategory(dictionary, newCategoryCode.value!, new Appearance({ color: new ColorDef("rgb(255,0,0)") }));
// Reserve all of the codes that are required by the new model and category.
try {
await rwIModel.concurrencyControl.request(accessToken);
} catch (err) {
if (err instanceof ConcurrencyControl.RequestError) {
assert.fail(JSON.stringify(err.unavailableCodes) + ", " + JSON.stringify(err.unavailableLocks));
}
}
return { modelId, spatialCategoryId };
}
>>>>>>>
class MockAccessToken extends AccessToken {
public constructor() { super(""); }
public getUserProfile(): UserProfile|undefined {
return new UserProfile ("test", "user", "[email protected]", "12345", "Bentley");
}
public toTokenString() { return ""; }
}
async function createNewModelAndCategory(rwIModel: IModelDb, accessToken: AccessToken) {
// Create a new physical model.
let modelId: Id64;
[, modelId] = IModelTestUtils.createAndInsertPhysicalModel(rwIModel, IModelTestUtils.getUniqueModelCode(rwIModel, "newPhysicalModel"), true);
// Find or create a SpatialCategory.
const dictionary: DictionaryModel = rwIModel.models.getModel(IModel.getDictionaryId()) as DictionaryModel;
const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, "ThisTestSpatialCategory");
const spatialCategoryId: Id64 = IModelTestUtils.createAndInsertSpatialCategory(dictionary, newCategoryCode.value!, new Appearance({ color: new ColorDef("rgb(255,0,0)") }));
// Reserve all of the codes that are required by the new model and category.
try {
await rwIModel.concurrencyControl.request(accessToken);
} catch (err) {
if (err instanceof ConcurrencyControl.RequestError) {
assert.fail(JSON.stringify(err.unavailableCodes) + ", " + JSON.stringify(err.unavailableLocks));
}
}
return { modelId, spatialCategoryId };
}
<<<<<<<
// downloadChangeSets (Not needed if we assume cache is in initialized state)
const cacheDir = iModelHost.configuration.briefcaseCacheDir;
// const csetDir = path.join(cacheDir, testIModelId, "csets");
// await iModelHubClientMock.object.downloadChangeSets(testChangeSets, csetDir);
console.log(` ...getting information on Project+IModel+ChangeSets for test case from mock data: ${new Date().getTime() - startTime} ms`); // tslint:disable-line:no-console
=======
const cacheDir = IModelHost.configuration!.briefcaseCacheDir;
>>>>>>>
// downloadChangeSets (Not needed if we assume cache is in initialized state)
const cacheDir = IModelHost.configuration!.briefcaseCacheDir;
// const csetDir = path.join(cacheDir, testIModelId, "csets");
// await iModelHubClientMock.object.downloadChangeSets(testChangeSets, csetDir);
console.log(` ...getting information on Project+IModel+ChangeSets for test case from mock data: ${new Date().getTime() - startTime} ms`); // tslint:disable-line:no-console |
<<<<<<<
public displayLogoImage(context: SceneContext) {
const logoImage: HTMLImageElement | undefined = this._provider!.getCopyrightImage();
=======
private displayLogoImage(context: SceneContext) {
const logoImage: HTMLImageElement | undefined = this.provider!.getCopyrightImage();
>>>>>>>
private displayLogoImage(context: SceneContext) {
const logoImage: HTMLImageElement | undefined = this._provider!.getCopyrightImage(); |
<<<<<<<
import { IModelConnection, IModelApp, Viewport } from "@bentley/imodeljs-frontend";
import { Target, UpdatePlan, PerformanceMetrics/*, System*/ } from "@bentley/imodeljs-frontend/lib/rendering";
import { IModelApi } from "./IModelApi";
import { ProjectApi } from "./ProjectApi";
// import { CONSTANTS } from "../../common/Testbed";
// import * as path from "path";
import { StopWatch } from "@bentley/bentleyjs-core";
// const iModelLocation = path.join(CONSTANTS.IMODELJS_CORE_DIRNAME, "test-apps/testbed/frontend/performance/imodels/");
// const glContext: WebGLRenderingContext | null = null;
const wantConsoleOutput: boolean = true;
function debugPrint(msg: string): void {
if (wantConsoleOutput)
console.log(msg); // tslint:disable-line
}
=======
import { IModelConnection, IModelApp, Viewport } from "@bentley/imodeljs-frontend"; // @ts-ignore
import { Target, PerformanceMetrics } from "@bentley/imodeljs-frontend/lib/rendering";
import { IModelApi } from "./IModelApi"; // @ts-ignore
import { ProjectApi } from "./ProjectApi"; // @ts-ignore
import { CONSTANTS } from "../../common/Testbed";
import * as path from "path";
>>>>>>>
import { IModelConnection, IModelApp, Viewport } from "@bentley/imodeljs-frontend";
import { Target, UpdatePlan, PerformanceMetrics/*, System*/ } from "@bentley/imodeljs-frontend/lib/rendering";
import { IModelApi } from "./IModelApi";
import { ProjectApi } from "./ProjectApi";
// import { CONSTANTS } from "../../common/Testbed";
// import * as path from "path";
import { StopWatch } from "@bentley/bentleyjs-core";
import { IModelConnection, IModelApp, Viewport } from "@bentley/imodeljs-frontend"; // @ts-ignore
import { Target, PerformanceMetrics } from "@bentley/imodeljs-frontend/lib/rendering";
import { IModelApi } from "./IModelApi"; // @ts-ignore
import { ProjectApi } from "./ProjectApi"; // @ts-ignore
import { CONSTANTS } from "../../common/Testbed";
import * as path from "path";
// const iModelLocation = path.join(CONSTANTS.IMODELJS_CORE_DIRNAME, "test-apps/testbed/frontend/performance/imodels/");
// const glContext: WebGLRenderingContext | null = null;
const wantConsoleOutput: boolean = true;
function debugPrint(msg: string): void {
if (wantConsoleOutput)
console.log(msg); // tslint:disable-line
}
<<<<<<<
// initialize the Project and IModel Api
await ProjectApi.init();
await IModelApi.init();
=======
it("Test 1 - Wraith Model - W1", async () => {
await PerformanceWriterClient.startup();
// this is the default configuration
configuration = {
userName: "[email protected]",
password: "pmadm1",
iModelName: path.join(iModelLocation, "Wraith.ibim"), // "D:\\models\\ibim_bim0200dev\\Wraith.ibim", // "D:\\models\\ibim_bim0200dev\\Wraith.ibim", // "atp_10K.bim", // "D:/models/ibim_bim0200dev/Wraith.ibim", // "atp_10K.bim",
viewName: "W1", // "Physical-Tag",
} as SVTConfiguration;
// override anything that's in the configuration
// retrieveConfigurationOverrides(configuration);
// applyConfigurationOverrides(configuration);
console.log("Configuration", JSON.stringify(configuration)); // tslint:disable-line
// Start the backend
// const config = new IModelHostConfiguration();
// config.hubDeploymentEnv = "QA";
// await IModelHost.startup(config);
console.log("Starting create Window"); // tslint:disable-line
await createWindow();
// start the app.
await IModelApp.startup();
console.log("IModelApp Started up"); // tslint:disable-line
// initialize the Project and IModel Api
console.log("Initialize ProjectApi and ImodelApi"); // tslint:disable-line
await ProjectApi.init();
await IModelApi.init();
console.log("Finished Initializing ProjectApi and ImodelApi"); // tslint:disable-line
activeViewState = new SimpleViewState();
// showStatus("Opening", configuration.iModelName);
console.log("Opening standaloneImodel"); // tslint:disable-line
await openStandaloneIModel(activeViewState, configuration.iModelName);
// open the specified view
// showStatus("opening View", configuration.viewName);
console.log("Build the view list"); // tslint:disable-line
await buildViewList(activeViewState, configuration);
// now connect the view to the canvas
console.log("Open the view"); // tslint:disable-line
await openView(activeViewState);
console.log("This is from frontend/main"); // tslint:disable-line
await theViewport!.renderFrame();
const target = (theViewport!.target as Target);
const frameTimes = target.frameTimings;
for (let i = 0; i < 11 && frameTimes.length; ++i)
console.log("frameTimes[" + i + "]: " + frameTimes[i]); // tslint:disable-line
await printResults(frameTimes);
await theViewport!.renderFrame();
for (let i = 0; i < 11 && frameTimes.length; ++i)
console.log("frameTimes[" + i + "]: " + frameTimes[i]); // tslint:disable-line
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
await theViewport!.renderFrame();
await printResults((theViewport!.target as Target).frameTimings);
console.log("///////////////////////////////// -- b4 shutdown"); // tslint:disable-line
if (activeViewState.iModelConnection) await activeViewState.iModelConnection.closeStandalone();
await IModelApp.shutdown();
await PerformanceWriterClient.finishSeries();
// WebGLTestContext.shutdown();
// TestApp.shutdown();
console.log("///////////////////////////////// -- after shutdown"); // tslint:disable-line
>>>>>>>
// initialize the Project and IModel Api
await ProjectApi.init();
await IModelApi.init(); |
<<<<<<<
const testIModelName: string = "assets/datasets/Properties_60InstancesWithUrl2.ibim";
=======
initialize();
const testIModelName: string = "assets/datasets/1K.bim";
>>>>>>>
initialize();
const testIModelName: string = "assets/datasets/Properties_60InstancesWithUrl2.ibim"; |
<<<<<<<
import { AccessToken, Briefcase as HubBriefcase, IModelHubClient, ChangeSet, IModel as HubIModel, ContainsSchemaChanges, SeedFile, SeedFileInitState, IModelHubResponseError, IModelHubResponseErrorId } from "@bentley/imodeljs-clients";
=======
import {
AccessToken, Briefcase as HubBriefcase, IModelHubClient, ChangeSet, IModel as HubIModel,
ContainsSchemaChanges, Briefcase, Code, IModelHubResponseError, IModelHubResponseErrorId,
BriefcaseQuery, ChangeSetQuery, IModelQuery, AzureFileHandler,
} from "@bentley/imodeljs-clients";
>>>>>>>
import {
AccessToken, Briefcase as HubBriefcase, IModelHubClient, ChangeSet, IModel as HubIModel,
ContainsSchemaChanges, Briefcase, Code, IModelHubResponseError, IModelHubResponseErrorId,
BriefcaseQuery, ChangeSetQuery, IModelQuery, AzureFileHandler,
} from "@bentley/imodeljs-clients";
<<<<<<<
if (!BriefcaseManager.hubClient) { BriefcaseManager.hubClient = new IModelHubClient(IModelHost.configuration.iModelHubDeployConfig); }
=======
BriefcaseManager.hubClient = new IModelHubClient(IModelHost.configuration.iModelHubDeployConfig, new AzureFileHandler());
>>>>>>>
if (!BriefcaseManager.hubClient) { BriefcaseManager.hubClient = new IModelHubClient(IModelHost.configuration.iModelHubDeployConfig, new AzureFileHandler()); }
<<<<<<<
const briefcases = await BriefcaseManager.hubClient.getBriefcases(accessToken, iModelId);
briefcases.forEach((briefcase: HubBriefcase) => {
promises.push(BriefcaseManager.hubClient!.deleteBriefcase(accessToken, iModelId, briefcase.briefcaseId!));
=======
const briefcases = await BriefcaseManager.hubClient.Briefcases().get(accessToken, iModelId);
briefcases.forEach((briefcase: Briefcase) => {
promises.push(BriefcaseManager.hubClient!.Briefcases().delete(accessToken, iModelId, briefcase.briefcaseId!));
>>>>>>>
const briefcases = await BriefcaseManager.hubClient.Briefcases().get(accessToken, iModelId);
briefcases.forEach((briefcase: Briefcase) => {
promises.push(BriefcaseManager.hubClient!.Briefcases().delete(accessToken, iModelId, briefcase.briefcaseId!)); |
<<<<<<<
return IModelDb.create(briefcaseEntry, contextId);
=======
return await IModelDb.create(briefcaseInfo, contextId);
>>>>>>>
return IModelDb.create(briefcaseEntry, contextId);
<<<<<<<
/** See Model.buildResourcesRequest */
public buildResourcesRequestForModel(req: BriefcaseManager.ResourcesRequest, model: Model, opcode: DbOpcode): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
const rc: RepositoryStatus = this.briefcaseEntry.nativeDb.buildBriefcaseManagerResourcesRequestForModel(req as AddonBriefcaseManagerResourcesRequest, JSON.stringify(model.id), opcode);
if (rc !== RepositoryStatus.Success)
throw new IModelError(rc);
}
/** See Element.buildResourcesRequest */
public buildResourcesRequestForElement(req: BriefcaseManager.ResourcesRequest, element: Element, opcode: DbOpcode): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
let rc: RepositoryStatus;
if (element.id === undefined || opcode === DbOpcode.Insert)
rc = this.briefcaseEntry.nativeDb.buildBriefcaseManagerResourcesRequestForElement(req as AddonBriefcaseManagerResourcesRequest, JSON.stringify({ modelid: element.model, code: element.code }), opcode);
else
rc = this.briefcaseEntry.nativeDb.buildBriefcaseManagerResourcesRequestForElement(req as AddonBriefcaseManagerResourcesRequest, JSON.stringify(element.id), opcode);
if (rc !== RepositoryStatus.Success)
throw new IModelError(rc);
}
/** See LinkTableRelationship.buildResourcesRequest */
public buildResourcesRequestForLinkTableRelationship(req: BriefcaseManager.ResourcesRequest, instance: LinkTableRelationship, opcode: DbOpcode): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
const rc: RepositoryStatus = this.briefcaseEntry.nativeDb.buildBriefcaseManagerResourcesRequestForLinkTableRelationship(req as AddonBriefcaseManagerResourcesRequest, JSON.stringify(instance), opcode);
if (rc !== RepositoryStatus.Success)
throw new IModelError(rc);
}
/** See CodeSpec.buildResourcesRequest */
public buildResourcesRequestForCodeSpec(req: BriefcaseManager.ResourcesRequest, instance: CodeSpec, opcode: DbOpcode): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
const rc: RepositoryStatus = this.briefcaseEntry.nativeDb.buildBriefcaseManagerResourcesRequestForCodeSpec(req as AddonBriefcaseManagerResourcesRequest, JSON.stringify(instance.id), opcode);
if (rc !== RepositoryStatus.Success)
throw new IModelError(rc);
}
/**
* Try to acquire the requested resources from iModelHub.
* This function may fulfill some requests and fail to fulfill others. This function returns a zero status
* if all requests were fulfilled. It returns a non-zero status if some or all requests could not be fulfilled.
* This function updates req to remove the requests that were successfully fulfilled. Therefore, if a non-zero
* status is returned, the caller can look at req to see which requests failed.
* @param req On input, this is the list of resource requests to be fulfilled. On return, this is the list of
* requests that could not be fulfilled.
* @return BentleyStatus.SUCCESS if all resources were acquired or non-zero if some could not be acquired.
*/
public requestResources(_req: BriefcaseManager.ResourcesRequest) {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
// throw new Error("TBD");
}
/**
* Check to see if *all* of the requested resources could be acquired from iModelHub.
* @param req the list of resource requests to be fulfilled.
* @return true if all resources could be acquired or false if any could not be acquired.
*/
public areResourcesAvailable(_req: BriefcaseManager.ResourcesRequest): boolean {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
// throw new Error("TBD");
return false; // *** TBD
}
/** Set the concurrency control policy.
* Before changing from optimistic to pessimistic, all local changes must be saved and uploaded to iModelHub.
* Before changing the locking policy of the pessimistic concurrency policy, all local changes must be saved to the local briefcase.
* @param policy The policy to used
* @throws IModelError if the policy cannot be set.
*/
public setConcurrencyControlPolicy(policy: BriefcaseManager.PessimisticConcurrencyControlPolicy | BriefcaseManager.OptimisticConcurrencyControlPolicy): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
let rc: RepositoryStatus = RepositoryStatus.Success;
if (policy as BriefcaseManager.OptimisticConcurrencyControlPolicy) {
const oc: BriefcaseManager.OptimisticConcurrencyControlPolicy = policy as BriefcaseManager.OptimisticConcurrencyControlPolicy;
rc = this.briefcaseEntry.nativeDb.setBriefcaseManagerOptimisticConcurrencyControlPolicy(oc.conflictResolution);
} else {
rc = this.briefcaseEntry.nativeDb.setBriefcaseManagerPessimisticConcurrencyControlPolicy();
}
if (RepositoryStatus.Success !== rc) {
throw new IModelError(rc);
}
}
/**
* Start a bulk update operation. This allows apps to write entities and codes to the local briefcase without first acquiring locks.
* The transaction manager then attempts to acquire all needed locks and codes before saving the changes to the local briefcase.
* The transaction manager will roll back all pending changes if any lock or code cannot be acquired at save time. Lock and code acquisition will fail if another user
* has push changes to the same entities or used the same codes as the local transaction.
* This policy does prevent conflicts and is the easiest way to implement the pessimistic locking policy efficiently.
* It however carries the risk that local changes could be rolled back, and so it can only be used safely in special cases, where
* contention for locks and codes is not a risk. Normally, that is only possible when writing to a model that is exclusively locked and where codes
* are scoped to that model.
* See saveChanges and endBulkUpdateMode.
*/
public startBulkUpdateMode(): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
const rc: RepositoryStatus = this.briefcaseEntry.nativeDb.briefcaseManagerStartBulkOperation();
if (RepositoryStatus.Success !== rc)
throw new IModelError(rc);
}
/**
* Call this if you want to acquire locks and codes *before* the end of the transaction.
* Note that saveChanges automatically calls this function to end the bulk operation and acquire locks and codes.
* If successful, this terminates the bulk operation.
* If not successful, the caller should abandon all changes.
*/
public endBulkUpdateMode(): void {
if (!this.briefcaseEntry)
throw new IModelError(IModelStatus.BadRequest);
const rc: RepositoryStatus = this.briefcaseEntry.nativeDb.briefcaseManagerEndBulkOperation();
if (RepositoryStatus.Success !== rc)
throw new IModelError(rc);
}
=======
>>>>>>>
<<<<<<<
const stat = this.briefcaseEntry.nativeDb.saveChanges(description);
=======
this.concurrencyControl.onSaveChanges();
const stat = this.briefcaseInfo.nativeDb.saveChanges(description);
>>>>>>>
this.concurrencyControl.onSaveChanges();
const stat = this.briefcaseEntry.nativeDb.saveChanges(description);
<<<<<<<
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getModel(JSON.stringify({ id: modelId }));
=======
const { error, result: json } = this._iModel.briefcaseInfo.nativeDb.getModel(JSON.stringify({ id: modelId }));
>>>>>>>
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getModel(JSON.stringify({ id: modelId }));
<<<<<<<
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getModel(JSON.stringify({ id: modelIdStr }));
=======
const { error, result: json } = this._iModel.briefcaseInfo.nativeDb.getModel(JSON.stringify({ id: modelIdStr }));
>>>>>>>
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getModel(JSON.stringify({ id: modelIdStr }));
<<<<<<<
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getElement(JSON.stringify(opts));
=======
const { error, result: json } = this._iModel.briefcaseInfo.nativeDb.getElement(JSON.stringify(opts));
>>>>>>>
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getElement(JSON.stringify(opts));
<<<<<<<
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getElement(JSON.stringify({ id: elementIdStr }));
=======
const { error, result: json } = this._iModel.briefcaseInfo.nativeDb.getElement(JSON.stringify({ id: elementIdStr }));
>>>>>>>
const {error, result: json} = this._iModel.briefcaseEntry.nativeDb.getElement(JSON.stringify({ id: elementIdStr })); |
<<<<<<<
=======
@MultiTierExecutionHost("@bentley/imodeljs-core/IModel")
class DgnDbNativeCode {
private static dbs = new Map<string, any>(); // services tier only
/**
* Open the Db.
* @param fileName The name of the db file.
* @param mode The open mode
* @returns Promise that resolves to an object that contains an error property if the operation failed
* or the "token" that identifies the Db on the server if success.
*/
@RunsIn(Tier.Services)
public static async callOpenDb(fileName: string, mode: OpenMode): Promise<DgnDbToken> {
let dgndb = DgnDbNativeCode.dbs.get(fileName);
if (undefined !== dgndb) // If the file is already open, just acknowledge that
return Promise.resolve(new DgnDbToken(fileName)); // for now, we just use the fileName as the "token" that identifies the Db
dgndb = new dgnDbNodeAddon.DgnDb();
const res: BentleyReturn<DbResult, void> = await dgndb.openDgnDb(fileName, mode);
if (res.error)
return Promise.reject(new IModelError(res.error.status));
DgnDbNativeCode.dbs.set(fileName, dgndb);
return new DgnDbToken(fileName); // for now, we just use the fileName as the "token" that identifies the Db
}
@RunsIn(Tier.Services, { synchronous: true })
public static callCloseDb(dbToken: DgnDbToken) {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb) {
return;
}
dgndb.closeDgnDb();
DgnDbNativeCode.dbs.delete(dbToken.id);
}
/**
* Get a JSON representation of an element.
* @param opt A JSON string with options for loading the element
* @returns Promise that resolves to an object with a result property set to the JSON string of the element.
* The resolved object contains an error property if the operation failed.
*/
@RunsIn(Tier.Services)
public static async callGetElement(dbToken: DgnDbToken, opt: string): Promise<string> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(IModelStatus.NotOpen));
const response: BentleyReturn<IModelStatus, string> = await dgndb.getElement(opt);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
return response.result!;
}
@RunsIn(Tier.Services)
public static async callGetElementPropertiesForDisplay(dbToken: DgnDbToken, elementId: string): Promise<string> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(DbResult.BE_SQLITE_CANTOPEN));
const response: BentleyReturn<DbResult, string> = await dgndb.getElementPropertiesForDisplay(elementId);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
return response.result!;
}
@RunsIn(Tier.Services)
public static async callInsertElement(dbToken: DgnDbToken, props: string): Promise<string> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(IModelStatus.NotOpen));
// Note that inserting an element is always done synchronously. That is because of constraints
// on the native code side. Nevertheless, we want the signature of this method to be
// that of an asynchronous method, since it must run in the services tier and will be
// asynchronous from a remote client's point of view in any case.
const response: BentleyReturn<IModelStatus, string> = dgndb.insertElementSync(props);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
return response.result!;
}
@RunsIn(Tier.Services)
public static async callUpdateElement(dbToken: DgnDbToken, props: string): Promise<void> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(IModelStatus.NotOpen));
// Note that updating an element is always done synchronously. That is because of constraints
// on the native code side. Nevertheless, we want the signature of this method to be
// that of an asynchronous method, since it must run in the services tier and will be
// asynchronous from a remote client's point of view in any case.
const response: BentleyReturn<IModelStatus, string> = dgndb.updateElementSync(props);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
}
@RunsIn(Tier.Services)
public static async callDeleteElement(dbToken: DgnDbToken, elemid: string): Promise<void> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(IModelStatus.NotOpen));
// Note that deleting an element is always done synchronously. That is because of constraints
// on the native code side. Nevertheless, we want the signature of this method to be
// that of an asynchronous method, since it must run in the services tier and will be
// asynchronous from a remote client's point of view in any case.
const response: BentleyReturn<IModelStatus, string> = dgndb.deleteElementSync(elemid);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
}
/**
* Get a JSON representation of a Model.
* @param opt A JSON string with options for loading the model
* @returns Promise that resolves to an object with a result property set to the JSON string of the model.
* The resolved object contains an error property if the operation failed.
*/
@RunsIn(Tier.Services)
public static async callGetModel(dbToken: DgnDbToken, opt: string): Promise<string> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(DbResult.BE_SQLITE_CANTOPEN));
const response: BentleyReturn<DbResult, string> = await dgndb.getModel(opt);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
return response.result!;
}
/**
* Execute an ECSql select statement
* @param ecsql The ECSql select statement to prepare
* @returns Promise that resolves to an object with a result property set to a JSON array containing the rows returned from the query
* The resolved object contains an error property if the operation failed.
*/
@RunsIn(Tier.Services)
public static async callExecuteQuery(dbToken: DgnDbToken, ecsql: string): Promise<string> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(DbResult.BE_SQLITE_CANTOPEN));
const response: BentleyReturn<DbResult, string> = await dgndb.executeQuery(ecsql);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
return response.result!;
}
/**
* Get the meta data for the specified ECClass from the schema in this DgnDbNativeCode.
* @param ecschemaname The name of the schema
* @param ecclassname The name of the class
* @returns Promise that resolves to an object with a result property set to a the meta data in JSON format
* The resolved object contains an error property if the operation failed.
*/
@RunsIn(Tier.Services)
public static async callGetECClassMetaData(dbToken: DgnDbToken, ecschemaname: string, ecclassname: string): Promise<string> {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
return Promise.reject(new IModelError(IModelStatus.NotOpen));
const response: BentleyReturn<IModelStatus, string> = await dgndb.getECClassMetaData(ecschemaname, ecclassname);
if (response.error)
return Promise.reject(new IModelError(response.error.status));
return response.result!;
}
/**
* Get the meta data for the specified ECClass from the schema in this iModel, blocking until the result is returned.
* @param ecschemaname The name of the schema
* @param ecclassname The name of the class
* @returns On success, the BentleyReturn result property will be the class meta data in JSON format.
*/
@RunsIn(Tier.Services, { synchronous: true })
public static callGetECClassMetaDataSync(dbToken: DgnDbToken, ecschemaname: string, ecclassname: string): string {
const dgndb = DgnDbNativeCode.dbs.get(dbToken.id);
if (undefined === dgndb)
throw new IModelError(IModelStatus.NotOpen);
const response: BentleyReturn<IModelStatus, string> = dgndb.getECClassMetaDataSync(ecschemaname, ecclassname);
if (response.error)
throw new IModelError(response.error.status);
return response.result!;
}
}
>>>>>>>
<<<<<<<
* @param openMode Open mode for database
=======
* @param mode Open mode for database
* @throws [[IModelError]]
>>>>>>>
* @param openMode Open mode for database
* @throws [[IModelError]]
<<<<<<<
private async doGetElement(opts: ElementLoadParams): Promise<Element> {
if (!this._iModel.briefcaseKey)
return Promise.reject(new IModelError(DgnDbStatus.NotOpen));
=======
private async _doGetElement(opts: ElementLoadParams): Promise<Element> {
>>>>>>>
private async _doGetElement(opts: ElementLoadParams): Promise<Element> {
if (!this._iModel.briefcaseKey)
return Promise.reject(new IModelError(IModelStatus.NotOpen)); |
<<<<<<<
directives: [ CORE_DIRECTIVES, ROUTER_DIRECTIVES, BUTTON_COMPONENTS, Material, SubscribeButton, Comments ]
=======
directives: [ CORE_DIRECTIVES, ROUTER_DIRECTIVES, Material, SubscribeButton, Comments, MindsBanner ]
>>>>>>>
directives: [ CORE_DIRECTIVES, ROUTER_DIRECTIVES, BUTTON_COMPONENTS, Material, SubscribeButton, Comments, MindsBanner ] |
<<<<<<<
RelatedChart,
CategoryWithEntries,
PageType,
EntryNode,
FullPost,
} from "../clientUtils/owidTypes"
let knexInstance: Knex
=======
CountryProfileSpec,
countryProfileSpecs,
} from "site/server/countryProfileProjects"
import { getContentGraph, GraphType } from "site/server/contentGraph"
import { PostReference } from "adminSite/client/ChartEditor"
>>>>>>>
RelatedChart,
CategoryWithEntries,
PageType,
EntryNode,
FullPost,
WP_PostType,
DocumentNode,
PostReference,
} from "../clientUtils/owidTypes"
import { getContentGraph, GraphType } from "./contentGraph"
let knexInstance: Knex
<<<<<<<
const apiQuery = async (
=======
export enum WP_PostType {
Post = "post",
Page = "page",
}
export const ENTRIES_CATEGORY_ID = 44
const graphqlQuery = async (query: string, variables: any = {}) => {
const response = await fetch(WP_GRAPHQL_ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
query,
variables,
}),
})
const json = await response.json()
return json
}
async function apiQuery(
>>>>>>>
export const ENTRIES_CATEGORY_ID = 44
const graphqlQuery = async (query: string, variables: any = {}) => {
const response = await fetch(WP_GRAPHQL_ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
query,
variables,
}),
})
const json = await response.json()
return json
}
const apiQuery = async (
<<<<<<<
=======
export interface EntryNode {
slug: string
title: string
// in some edge cases (entry alone in a subcategory), WPGraphQL returns
// null instead of an empty string)
excerpt: string | null
kpi: string
}
interface DocumentNode {
id: number
title: string
slug: string
content: string | null // if content is empty
}
export const getDocumentsInfo = async (
type: WP_PostType,
cursor: string = "",
where: string = ""
): Promise<DocumentNode[]> => {
const typePlural = `${type}s`
const query = `
query($cursor: String){
${typePlural}(first:50, after: $cursor, where:{${where}}) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id: databaseId
title
slug
content
}
}
}
`
const documents = await graphqlQuery(query, { cursor })
const pageInfo = documents?.data[typePlural].pageInfo
const nodes = documents?.data[typePlural].nodes
if (pageInfo.hasNextPage) {
return nodes.concat(
await getDocumentsInfo(type, pageInfo.endCursor, where)
)
} else {
return nodes
}
}
>>>>>>>
export const getDocumentsInfo = async (
type: WP_PostType,
cursor: string = "",
where: string = ""
): Promise<DocumentNode[]> => {
const typePlural = `${type}s`
const query = `
query($cursor: String){
${typePlural}(first:50, after: $cursor, where:{${where}}) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id: databaseId
title
slug
content
}
}
}
`
const documents = await graphqlQuery(query, { cursor })
const pageInfo = documents?.data[typePlural].pageInfo
const nodes = documents?.data[typePlural].nodes
if (pageInfo.hasNextPage) {
return nodes.concat(
await getDocumentsInfo(type, pageInfo.endCursor, where)
)
} else {
return nodes
}
}
<<<<<<<
export const getPosts = async (
postTypes: string[] = ["post", "page"],
=======
export async function getPosts(
postTypes: string[] = [WP_PostType.Post, WP_PostType.Page],
>>>>>>>
export const getPosts = async (
postTypes: string[] = [WP_PostType.Post, WP_PostType.Page],
<<<<<<<
export const getBlockContent = async (
id: number
): Promise<string | undefined> => {
=======
export const getRelatedArticles = async (chartSlug: string) => {
const graph = await getContentGraph()
const chartRecord = await graph.find(GraphType.Chart, chartSlug)
if (!chartRecord.payload.count) return
const chart = chartRecord.payload.records[0]
const relatedArticles: PostReference[] = await Promise.all(
chart.research.map(async (postId: any) => {
const postRecord = await graph.find(GraphType.Document, postId)
const post = postRecord.payload.records[0]
return {
id: postId,
title: post.title,
slug: post.slug,
}
})
)
return relatedArticles
}
export async function getBlockContent(id: number): Promise<string | undefined> {
>>>>>>>
export const getRelatedArticles = async (chartSlug: string) => {
const graph = await getContentGraph()
const chartRecord = await graph.find(GraphType.Chart, chartSlug)
if (!chartRecord.payload.count) return
const chart = chartRecord.payload.records[0]
const relatedArticles: PostReference[] = await Promise.all(
chart.research.map(async (postId: any) => {
const postRecord = await graph.find(GraphType.Document, postId)
const post = postRecord.payload.records[0]
return {
id: postId,
title: post.title,
slug: post.slug,
}
})
)
return relatedArticles
}
export const getBlockContent = async (
id: number
): Promise<string | undefined> => { |
<<<<<<<
=======
logIndicatorExplorerViewError(error: any, info: any) {
this.logToAmplitude(EventNames.indicatorExplorerViewError, {
error,
info,
})
this.logToGA(
Categories.GrapherError,
EventNames.indicatorExplorerViewError
)
}
>>>>>>>
<<<<<<<
this.logToGA(`${pickerSlug}ExplorerCountrySelectorUsage`, action, note)
this.logToSA(
`${pickerSlug}DataExplorerCountrySelector :: ${action} :: ${note}`
)
=======
this.logToGA(
`${countryPickerName}ExplorerCountrySelectorUsage`,
action,
note
)
>>>>>>>
this.logToGA(`${pickerSlug}ExplorerCountrySelectorUsage`, action, note) |
<<<<<<<
=======
var testResult : ifm.TestRunResult = <ifm.TestRunResult> {
state: "Completed",
computerName: hostName,
resolutionState: null,
testCasePriority: 1,
failureType: null,
automatedTestName: testName,
automatedTestStorage: testStorage,
automatedTestType: "JUnit",
automatedTestTypeId: null,
automatedTestId: null,
area: null,
owner: buildRequestedFor,
runBy: buildRequestedFor,
testCaseTitle: testName,
revision: 0,
dataRowCount: 0,
testCaseRevision: 0,
outcome: outcome,
errorMessage: errorMessage,
durationInMs: Math.round(testCaseDuration * 1000) //convert to milliseconds and round to nearest whole number since server can't handle decimals for test case duration
};
testResults.push(testResult);
>>>>>>> |
<<<<<<<
constructor(projectUrl: string, handler: ifm.IRequestHandler) {
this.projectUrl = projectUrl;
this.httpClient = new httpm.HttpClient('vso-build-api', handler);
this.restClient = new restm.RestClient(projectUrl, '2.0-preview', this.httpClient);
=======
constructor(collectionUrl: string, handlers: ifm.IRequestHandler[]) {
this.collectionUrl = collectionUrl;
this.httpClient = new httpm.HttpClient('vso-build-api', handlers);
this.restClient = new restm.RestClient(collectionUrl, this.httpClient);
>>>>>>>
constructor(projectUrl: string, handlers: ifm.IRequestHandler[]) {
this.projectUrl = projectUrl;
this.httpClient = new httpm.HttpClient('vso-build-api', handlers);
this.restClient = new restm.RestClient(projectUrl, this.httpClient);
<<<<<<<
constructor(projectUrl:string, handler: ifm.IRequestHandler) {
this._buildApi = new BuildApi(projectUrl, handler);
=======
constructor(accountUrl:string, handlers: ifm.IRequestHandler[]) {
this._buildApi = new BuildApi(accountUrl, handlers);
>>>>>>>
constructor(projectUrl:string, handlers: ifm.IRequestHandler[]) {
this._buildApi = new BuildApi(projectUrl, handlers); |
<<<<<<<
import {MemoryChannelStoreEntry} from './memory-channel-storage';
export interface SiteBudget {
site: string;
hubAddress: string;
forAsset: Record<string, AssetBudget>;
}
export interface BudgetItem {
playerAmount: BigNumber;
hubAmount: BigNumber;
}
export interface AssetBudget {
assetHolderAddress: string;
pending: BudgetItem;
free: BudgetItem;
inUse: BudgetItem;
direct: BudgetItem;
}
=======
export interface SiteBudget {
site: string;
hubAddress: string;
forAsset: Record<string, AssetBudget | undefined>;
}
export interface BudgetItem {
playerAmount: BigNumber;
hubAmount: BigNumber;
}
export interface AssetBudget {
assetHolderAddress: string;
pending: BudgetItem; // Approved by user, but not yet funded
free: BudgetItem; // Funded, and ready to be allocated
inUse: BudgetItem; // Funded, but currently allocated
direct: BudgetItem;
}
>>>>>>>
import {MemoryChannelStoreEntry} from './memory-channel-storage';
export interface SiteBudget {
site: string;
hubAddress: string;
forAsset: Record<string, AssetBudget | undefined>;
}
export interface BudgetItem {
playerAmount: BigNumber;
hubAmount: BigNumber;
}
export interface AssetBudget {
assetHolderAddress: string;
pending: BudgetItem; // Approved by user, but not yet funded
free: BudgetItem; // Funded, and ready to be allocated
inUse: BudgetItem; // Funded, but currently allocated
direct: BudgetItem;
} |
<<<<<<<
import cm = require('../common');
=======
import ctxm = require('../context');
import cm = require('../common');
>>>>>>>
import cm = require('../common');
<<<<<<<
export function getProvider(ctx: cm.IExecutionContext, targetPath: string): scmm.IScmProvider {
=======
export function getProvider(ctx: ctxm.JobContext, targetPath: string): cm.IScmProvider {
>>>>>>>
export function getProvider(ctx: cm.IExecutionContext, targetPath: string): cm.IScmProvider { |
<<<<<<<
import { BlendShapePresetName, LookAtTypeName } from '../types';
import { CurveMapper } from './CurveMapper';
=======
import { VRMSchema } from '../types';
import { CurveMapper, DEG2RAD } from './CurveMapper';
>>>>>>>
import { VRMSchema } from '../types';
import { CurveMapper } from './CurveMapper';
<<<<<<<
curveHorizontal: CurveMapper,
curveVerticalDown: CurveMapper,
curveVerticalUp: CurveMapper,
=======
lookAtHorizontalOuter: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalDown: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalUp: VRMSchema.FirstPersonDegreeMap,
>>>>>>>
curveHorizontal: CurveMapper,
curveVerticalDown: CurveMapper,
curveVerticalUp: CurveMapper,
<<<<<<<
=======
}
function deg2rad(map: VRMSchema.FirstPersonDegreeMap): VRMSchema.FirstPersonDegreeMap {
return {
xRange: typeof map.xRange === 'number' ? DEG2RAD * map.xRange : undefined,
yRange: map.yRange, // yRange means weight not radian
curve: map.curve,
};
>>>>>>> |
<<<<<<<
vrmExt.firstPerson && blendShapeMaster && humanoid
? this.loadLookAt(vrmExt.firstPerson, blendShapeMaster, humanoid)
: undefined;
=======
blendShapeProxy && humanoid
? await this._lookAtImporter.import(vrmExt.firstPerson, blendShapeProxy, humanoid)
: undefined;
if ((lookAt as any).setupHelper) {
(lookAt as VRMLookAtHeadDebug).setupHelper(scene, debugOption);
}
>>>>>>>
blendShapeMaster && humanoid
? await this._lookAtImporter.import(vrmExt.firstPerson, blendShapeMaster, humanoid)
: undefined;
if ((lookAt as any).setupHelper) {
(lookAt as VRMLookAtHeadDebug).setupHelper(scene, debugOption);
} |
<<<<<<<
import { RawVrmMeta } from './types';
=======
import { RawVector3, RawVector4, RawVrmMeta, VRMPose } from './types';
>>>>>>>
import { RawVrmMeta } from './types';
<<<<<<<
public readonly humanoid?: VRMHumanoid;
=======
/**
* Contains [[VRMHumanBones]] of the VRM.
* You can move or rotate these bones as a `THREE.Object3D`.
* Each bones defined in VRM spec are either required or optional.
* See also: [[VRM.setPose]]
*
* @TODO Add a link to VRM spec
*/
public readonly humanBones?: VRMHumanBones;
/**
* Contains [[VRMBlendShapeProxy]] of the VRM.
* You might want to control these facial expressions via [[VRMBlendShapeProxy.setValue]].
*/
>>>>>>>
/**
* Contains [[VRMHumanoid]] of the VRM.
* You can control each bones using [[VRMHumanoid.getBoneNode]].
*
* @TODO Add a link to VRM spec
*/
public readonly humanoid?: VRMHumanoid;
/**
* Contains [[VRMBlendShapeProxy]] of the VRM.
* You might want to control these facial expressions via [[VRMBlendShapeProxy.setValue]].
*/
<<<<<<<
=======
/**
* Contains informations about rest pose of the VRM.
* You might want to refer this when you want to reset its pose, along with [[VRM.setPose]]}.
*/
public readonly restPose: VRMPose | null;
/**
* Create a new VRM instance.
*
* @param params [[VRMParameters]] that represents components of the VRM
*/
>>>>>>>
/**
* Create a new VRM instance.
*
* @param params [[VRMParameters]] that represents components of the VRM
*/
<<<<<<<
=======
// Save current initial pose (which is Rest-pose) to restPose field, since pose changing may lose the default transforms. This is useful when resetting the pose or referring default pose.
this.restPose = this.humanBones
? Object.keys(this.humanBones).reduce(
(restPose, vrmBoneName) => {
const bone = this.humanBones![vrmBoneName]!;
restPose[vrmBoneName] = {
position: bone.position.toArray() as RawVector3,
rotation: bone.quaternion.toArray() as RawVector4,
};
return restPose;
},
{} as VRMPose,
)
: null;
}
/**
* Let the VRM do a given pose.
*
* @param poseObject [[VRMPose]] represents a pose
*/
public setPose(poseObject: VRMPose): void {
// VRMに定められたboneが足りない場合、正しくposeが取れない可能性がある
if (!this.humanBones) {
console.warn('This VRM cannot be posed since humanBones are not properly set');
return;
}
Object.keys(poseObject).forEach((boneName) => {
const state = poseObject[boneName]!;
const targetBone = this.humanBones![boneName];
// VRM標準ボーンを満たしていないVRMファイルが世の中には存在する
// (少し古いuniVRMは、必須なのにhipsを出力していなさそう)
// その場合は無視。
if (!targetBone) {
return;
}
const restState = this.restPose![boneName];
if (!restState) {
return;
}
if (state.position) {
// 元の状態に戻してから、移動分を追加
targetBone.position.set(
restState.position![0] + state.position[0],
restState.position![1] + state.position[1],
restState.position![2] + state.position[2],
);
}
if (state.rotation) {
targetBone.quaternion.fromArray(state.rotation);
}
});
>>>>>>> |
<<<<<<<
import { VRMHumanBones } from '../humanoid';
import { GLTFMesh, GLTFNode, VRMSchema } from '../types';
=======
import { VRMHumanoid } from '../humanoid';
import { GLTFMesh, GLTFNode, HumanBone, RawVrmFirstPerson } from '../types';
>>>>>>>
import { VRMHumanoid } from '../humanoid';
import { GLTFMesh, GLTFNode, VRMSchema } from '../types';
<<<<<<<
humanBones: VRMHumanBones,
schemaFirstPerson: VRMSchema.FirstPerson,
=======
humanoid: VRMHumanoid,
schemaFirstPerson: RawVrmFirstPerson,
>>>>>>>
humanoid: VRMHumanoid,
schemaFirstPerson: VRMSchema.FirstPerson,
<<<<<<<
firstPersonBone = humanBones[VRMSchema.HumanoidBoneName.Head];
=======
firstPersonBone = humanoid.getBoneNode(HumanBone.Head);
>>>>>>>
firstPersonBone = humanoid.getBoneNode(VRMSchema.HumanoidBoneName.Head); |
<<<<<<<
import { GLTF, GLTFNode, RawVector3, RawVector4, RawVrmMeta, VRMPose } from './types';
=======
import { RawVrmMeta, VRMPose } from './types';
>>>>>>>
import { RawVector3, RawVector4, RawVrmMeta, VRMPose } from './types';
<<<<<<<
/**
* Create a [[VRM]] from a parsed result of GLTF taken from GLTFLoader.
* It's probably a thing what you want to get started with VRMs.
*
* @param gltf A parsed GLTF object taken from GLTFLoader
*/
public static from(gltf: GLTF): Promise<VRM> {
=======
public static from(gltf: THREE.GLTF): Promise<VRM> {
>>>>>>>
/**
* Create a [[VRM]] from a parsed result of GLTF taken from GLTFLoader.
* It's probably a thing what you want to get started with VRMs.
*
* @param gltf A parsed GLTF object taken from GLTFLoader
*/
public static from(gltf: THREE.GLTF): Promise<VRM> {
<<<<<<<
this.blendShapeProxy = blendShapeProxy;
this.springBoneManager = this._partsBuilder.loadSecondary(gltf, this.nodesMap);
this.lookAt = this._partsBuilder.loadLookAt(vrmExt.firstPerson, this.blendShapeProxy, this.humanBones);
// 破壊的な変更後もrestposeにリセットできるように初期状態ポーズを保存。
Object.keys(this.humanBones).forEach((vrmBoneName) => {
const bone = this.humanBones[vrmBoneName]!;
this.restPose[vrmBoneName] = {
position: bone.position.toArray() as RawVector3,
rotation: bone.quaternion.toArray() as RawVector4,
};
});
=======
this._blendShapeProxy = blendShapeProxy;
this._springBoneManager = await this._partsBuilder.loadSecondary(gltf);
this._lookAt =
this.blendShapeProxy && this.humanBones
? this._partsBuilder.loadLookAt(vrmExt.firstPerson, this.blendShapeProxy, this.humanBones)
: null;
// Save current initial pose (which is Rest-pose) to restPose field, since pose changing may lose the default transforms. This is useful when resetting the pose or referring default pose.
this._restPose = this.humanBones
? Object.keys(this.humanBones).reduce(
(restPose, vrmBoneName) => {
const bone = this.humanBones![vrmBoneName]!;
restPose[vrmBoneName] = {
position: bone.position.toArray(),
rotation: bone.quaternion.toArray(),
};
return restPose;
},
{} as VRMPose,
)
: null;
>>>>>>>
this._blendShapeProxy = blendShapeProxy;
this._springBoneManager = await this._partsBuilder.loadSecondary(gltf);
this._lookAt =
this.blendShapeProxy && this.humanBones
? this._partsBuilder.loadLookAt(vrmExt.firstPerson, this.blendShapeProxy, this.humanBones)
: null;
// Save current initial pose (which is Rest-pose) to restPose field, since pose changing may lose the default transforms. This is useful when resetting the pose or referring default pose.
this._restPose = this.humanBones
? Object.keys(this.humanBones).reduce(
(restPose, vrmBoneName) => {
const bone = this.humanBones![vrmBoneName]!;
restPose[vrmBoneName] = {
position: bone.position.toArray() as RawVector3,
rotation: bone.quaternion.toArray() as RawVector4,
};
return restPose;
},
{} as VRMPose,
)
: null; |
<<<<<<<
import { LookAtTypeName } from '../types';
=======
import { VRMSchema } from '../types';
>>>>>>>
import { VRMSchema } from '../types';
<<<<<<<
public abstract readonly type: LookAtTypeName;
=======
public lookAtHorizontalOuter: VRMSchema.FirstPersonDegreeMap;
public lookAtVerticalDown: VRMSchema.FirstPersonDegreeMap;
public lookAtVerticalUp: VRMSchema.FirstPersonDegreeMap;
protected constructor(
lookAtHorizontalOuter: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalDown: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalUp: VRMSchema.FirstPersonDegreeMap,
) {
this.lookAtHorizontalOuter = lookAtHorizontalOuter;
this.lookAtVerticalDown = lookAtVerticalDown;
this.lookAtVerticalUp = lookAtVerticalUp;
}
public abstract name(): VRMSchema.FirstPersonLookAtTypeName;
>>>>>>>
public abstract readonly type: VRMSchema.FirstPersonLookAtTypeName; |
<<<<<<<
import { GLTFMesh, GLTFPrimitive, RawVrm, RawVrmMaterial } from '../types';
import { MToonMaterial, MToonMaterialOutlineWidthMode, MToonMaterialRenderMode } from './MToonMaterial';
import { VRMUnlitMaterial, VRMUnlitMaterialRenderType } from './VRMUnlitMaterial';
=======
import { GLTFMesh, GLTFPrimitive, VRMSchema } from '../types';
import { MToon, MToonOutlineWidthMode, MToonRenderMode } from './MToon';
import { Unlit, UnlitRenderType } from './Unlit';
>>>>>>>
import { GLTFMesh, GLTFPrimitive, VRMSchema } from '../types';
import { MToonMaterial, MToonMaterialOutlineWidthMode, MToonMaterialRenderMode } from './MToonMaterial';
import { VRMUnlitMaterial, VRMUnlitMaterialRenderType } from './VRMUnlitMaterial'; |
<<<<<<<
lookAtImporter?: VRMLookAtImporter;
=======
firstPersonImporter?: VRMFirstPersonImporter;
>>>>>>>
lookAtImporter?: VRMLookAtImporter;
firstPersonImporter?: VRMFirstPersonImporter;
<<<<<<<
protected readonly _lookAtImporter: VRMLookAtImporter;
=======
protected readonly _firstPersonImporter: VRMFirstPersonImporter;
>>>>>>>
protected readonly _lookAtImporter: VRMLookAtImporter;
protected readonly _firstPersonImporter: VRMFirstPersonImporter;
<<<<<<<
this._lookAtImporter = options.lookAtImporter || new VRMLookAtImporter();
=======
this._firstPersonImporter = options.firstPersonImporter || new VRMFirstPersonImporter();
>>>>>>>
this._lookAtImporter = options.lookAtImporter || new VRMLookAtImporter();
this._firstPersonImporter = options.firstPersonImporter || new VRMFirstPersonImporter();
<<<<<<<
/**
* load first person
* @param firstPerson
* @param humanBones
* @param gltf
* @returns
*/
public async loadFirstPerson(
firstPerson: Raw.RawVrmFirstPerson,
humanBones: VRMHumanBones,
gltf: THREE.GLTF,
): Promise<VRMFirstPerson | null> {
const isFirstPersonBoneNotSet = firstPerson.firstPersonBone === undefined || firstPerson.firstPersonBone === -1;
const firstPersonBone: GLTFNode = isFirstPersonBoneNotSet
? humanBones[Raw.HumanBone.Head] // fallback
: await gltf.parser.getDependency('node', firstPerson.firstPersonBone!);
if (!firstPersonBone) {
console.warn('Could not find firstPersonBone of the VRM');
return null;
}
const firstPersonBoneOffset =
!isFirstPersonBoneNotSet && firstPerson.firstPersonBoneOffset
? new THREE.Vector3(
firstPerson.firstPersonBoneOffset!.x,
firstPerson.firstPersonBoneOffset!.y,
firstPerson.firstPersonBoneOffset!.z,
)
: new THREE.Vector3(0, 0.06, 0); // fallback
const meshAnnotations: RendererFirstPersonFlags[] = [];
const meshes: GLTFMesh[] = await gltf.parser.getDependencies('mesh');
meshes.forEach((mesh, meshIndex) => {
const flag = firstPerson.meshAnnotations
? firstPerson.meshAnnotations.find((annotation) => annotation.mesh === meshIndex)
: undefined;
meshAnnotations.push(new RendererFirstPersonFlags(flag && flag.firstPersonFlag, mesh));
});
return new VRMFirstPerson(firstPersonBone, firstPersonBoneOffset, meshAnnotations);
}
=======
public loadLookAt(
firstPerson: Raw.RawVrmFirstPerson,
blendShapeProxy: VRMBlendShapeProxy,
humanBodyBones: VRMHumanBones,
): VRMLookAtHead {
const lookAtHorizontalInner = firstPerson.lookAtHorizontalInner;
const lookAtHorizontalOuter = firstPerson.lookAtHorizontalOuter;
const lookAtVerticalDown = firstPerson.lookAtVerticalDown;
const lookAtVerticalUp = firstPerson.lookAtVerticalUp;
switch (firstPerson.lookAtTypeName) {
case Raw.LookAtTypeName.Bone: {
if (
lookAtHorizontalInner === undefined ||
lookAtHorizontalOuter === undefined ||
lookAtVerticalDown === undefined ||
lookAtVerticalUp === undefined
) {
return new VRMLookAtHead(humanBodyBones);
} else {
return new VRMLookAtHead(
humanBodyBones,
new VRMLookAtBoneApplyer(
humanBodyBones,
lookAtHorizontalInner,
lookAtHorizontalOuter,
lookAtVerticalDown,
lookAtVerticalUp,
),
);
}
}
case Raw.LookAtTypeName.BlendShape: {
if (lookAtHorizontalOuter === undefined || lookAtVerticalDown === undefined || lookAtVerticalUp === undefined) {
return new VRMLookAtHead(humanBodyBones);
} else {
return new VRMLookAtHead(
humanBodyBones,
new VRMLookAtBlendShapeApplyer(
blendShapeProxy,
lookAtHorizontalOuter,
lookAtVerticalDown,
lookAtVerticalUp,
),
);
}
}
default: {
return new VRMLookAtHead(humanBodyBones);
}
}
}
>>>>>>> |
<<<<<<<
import { VRMFirstPerson } from '../firstperson';
import { VRMHumanBones } from '../humanoid';
=======
import { VRMHumanoid } from '../humanoid';
>>>>>>>
import { VRMFirstPerson } from '../firstperson';
import { VRMHumanoid } from '../humanoid';
<<<<<<<
schemaFirstPerson: Raw.RawVrmFirstPerson,
firstPerson: VRMFirstPerson,
=======
firstPerson: VRMSchema.FirstPerson,
>>>>>>>
schemaFirstPerson: VRMSchema.FirstPerson,
firstPerson: VRMFirstPerson,
<<<<<<<
const applyer = this._importApplyer(schemaFirstPerson, blendShapeProxy, humanBodyBones);
return new VRMLookAtHeadDebug(firstPerson, applyer || undefined);
=======
const applyer = this._importApplyer(firstPerson, blendShapeProxy, humanoid);
return new VRMLookAtHeadDebug(humanoid, applyer || undefined);
>>>>>>>
const applyer = this._importApplyer(schemaFirstPerson, blendShapeProxy, humanoid);
return new VRMLookAtHeadDebug(firstPerson, applyer || undefined); |
<<<<<<<
import { VRMBlendShapeImporter, VRMBlendShapeMaster } from './blendshape';
import { VRMFirstPersonImporter } from './firstperson';
import { VRMHumanBones } from './humanoid';
=======
import { BlendShapeController, BlendShapeMaster, VRMBlendShapeProxy } from './blendshape';
import { VRMFirstPersonImporter } from './firstperson';
import { VRMHumanoid } from './humanoid';
import { VRMHumanoidImporter } from './humanoid/VRMHumanoidImporter';
>>>>>>>
import { VRMBlendShapeImporter, VRMBlendShapeMaster } from './blendshape';
import { VRMFirstPersonImporter } from './firstperson';
import { VRMHumanoid } from './humanoid';
import { VRMHumanoidImporter } from './humanoid/VRMHumanoidImporter';
<<<<<<<
import { RawVrmHumanoidBone } from './types';
import * as Raw from './types/VRM';
=======
import { GLTFMesh, GLTFPrimitive, VRMSchema } from './types';
>>>>>>>
import { VRMSchema } from './types';
<<<<<<<
blendShapeImporter?: VRMBlendShapeImporter;
=======
humanoidImporter?: VRMHumanoidImporter;
>>>>>>>
humanoidImporter?: VRMHumanoidImporter;
blendShapeImporter?: VRMBlendShapeImporter;
<<<<<<<
protected readonly _blendShapeImporter: VRMBlendShapeImporter;
=======
protected readonly _humanoidImporter: VRMHumanoidImporter;
>>>>>>>
protected readonly _blendShapeImporter: VRMBlendShapeImporter;
protected readonly _humanoidImporter: VRMHumanoidImporter;
<<<<<<<
this._blendShapeImporter = options.blendShapeImporter || new VRMBlendShapeImporter();
=======
this._humanoidImporter = options.humanoidImporter || new VRMHumanoidImporter();
>>>>>>>
this._blendShapeImporter = options.blendShapeImporter || new VRMBlendShapeImporter();
this._humanoidImporter = options.humanoidImporter || new VRMHumanoidImporter();
<<<<<<<
blendShapeMaster && humanBones ? this.loadLookAt(vrmExt.firstPerson, blendShapeMaster, humanBones) : undefined;
=======
vrmExt.firstPerson && blendShapeProxy && humanoid
? this.loadLookAt(vrmExt.firstPerson, blendShapeProxy, humanoid)
: undefined;
>>>>>>>
vrmExt.firstPerson && blendShapeMaster && humanoid
? this.loadLookAt(vrmExt.firstPerson, blendShapeMaster, humanoid)
: undefined;
<<<<<<<
firstPerson: Raw.RawVrmFirstPerson,
blendShapeMaster: VRMBlendShapeMaster,
humanBodyBones: VRMHumanBones,
=======
firstPerson: VRMSchema.FirstPerson,
blendShapeProxy: VRMBlendShapeProxy,
humanoid: VRMHumanoid,
>>>>>>>
firstPerson: VRMSchema.FirstPerson,
blendShapeMaster: VRMBlendShapeMaster,
humanoid: VRMHumanoid,
<<<<<<<
=======
/**
*
* @param {AnimationMixer} animationMixer
* @param {GLTF} gltf
* @returns {VRMBlendShapeProxy}
*/
public async loadBlendShapeMaster(
animationMixer: THREE.AnimationMixer,
gltf: THREE.GLTF,
): Promise<VRMBlendShapeProxy | null> {
const blendShapeGroups: VRMSchema.BlendShapeGroup[] | undefined =
gltf.parser.json.extensions &&
gltf.parser.json.extensions.VRM &&
gltf.parser.json.extensions.VRM.blendShapeMaster &&
gltf.parser.json.extensions.VRM.blendShapeMaster.blendShapeGroups;
if (!blendShapeGroups) {
return null;
}
const blendShapeMaster = new BlendShapeMaster();
const blendShapePresetMap: { [presetName in VRMSchema.BlendShapePresetName]?: string } = {};
blendShapeGroups.forEach(async (group) => {
const name = group.name;
if (name === undefined) {
console.warn('createBlendShapeMasterFromVRM: One of blendShapeGroups has no name');
return;
}
if (
group.presetName &&
group.presetName !== VRMSchema.BlendShapePresetName.Unknown &&
!blendShapePresetMap[group.presetName]
) {
blendShapePresetMap[group.presetName] = group.name;
}
const controller = new BlendShapeController(name);
gltf.scene.add(controller);
controller.isBinary = group.isBinary || false;
if (Array.isArray(group.binds)) {
group.binds.forEach(async (bind) => {
if (bind.mesh === undefined || bind.index === undefined) {
return;
}
const morphMeshes: GLTFMesh = await gltf.parser.getDependency('mesh', bind.mesh);
const primitives: GLTFPrimitive[] =
morphMeshes.type === 'Group'
? (morphMeshes.children as Array<GLTFPrimitive>)
: [morphMeshes as GLTFPrimitive];
const morphTargetIndex = bind.index;
if (
!primitives.every(
(primitive) =>
Array.isArray(primitive.morphTargetInfluences) &&
morphTargetIndex < primitive.morphTargetInfluences.length,
)
) {
console.warn(
`createBlendShapeMasterFromVRM: ${
group.name
} attempts to index ${morphTargetIndex}th morph but not found.`,
);
return;
}
controller.addBind({
meshes: primitives,
morphTargetIndex,
weight: bind.weight || 100,
});
});
}
const materialValues = group.materialValues;
if (Array.isArray(materialValues)) {
materialValues.forEach((materialValue) => {
if (
materialValue.materialName === undefined ||
materialValue.propertyName === undefined ||
materialValue.targetValue === undefined
) {
return;
}
const materials: THREE.Material[] = [];
gltf.scene.traverse((object) => {
if ((object as any).material) {
const material: THREE.Material[] | THREE.Material = (object as any).material;
if (Array.isArray(material)) {
materials.push(
...material.filter(
(mtl) => mtl.name === materialValue.materialName! && materials.indexOf(mtl) === -1,
),
);
} else if (material.name === materialValue.materialName && materials.indexOf(material) === -1) {
materials.push(material);
}
}
});
materials.forEach((material) => {
controller.addMaterialValue({
material,
propertyName: this.renameMaterialProperty(materialValue.propertyName!),
targetValue: materialValue.targetValue!,
});
});
});
}
blendShapeMaster.registerBlendShapeGroup(name, controller);
});
return VRMBlendShapeProxy.create(animationMixer, blendShapeMaster, blendShapePresetMap);
}
private renameMaterialProperty(name: string): string {
if (name[0] !== '_') {
console.warn(`VRMMaterials: Given property name "${name}" might be invalid`);
return name;
}
name = name.substring(1);
if (!/[A-Z]/.test(name[0])) {
console.warn(`VRMMaterials: Given property name "${name}" might be invalid`);
return name;
}
return name[0].toLowerCase() + name.substring(1);
}
>>>>>>> |
<<<<<<<
import { VRMHumanBones } from '../humanoid';
import { GLTFNode } from '../types';
import { LookAtTypeName } from '../types';
import { CurveMapper } from './CurveMapper';
=======
import { VRMHumanoid } from '../humanoid';
import { GLTFNode, VRMSchema } from '../types';
import { CurveMapper, DEG2RAD } from './CurveMapper';
>>>>>>>
import { VRMHumanoid } from '../humanoid';
import { GLTFNode, VRMSchema } from '../types';
import { CurveMapper } from './CurveMapper';
<<<<<<<
public readonly type = LookAtTypeName.Bone;
private readonly _curveHorizontalInner: CurveMapper;
private readonly _curveHorizontalOuter: CurveMapper;
private readonly _curveVerticalDown: CurveMapper;
private readonly _curveVerticalUp: CurveMapper;
=======
private readonly lookAtHorizontalInner: VRMSchema.FirstPersonDegreeMap;
>>>>>>>
public readonly type = VRMSchema.FirstPersonLookAtTypeName.Bone;
private readonly _curveHorizontalInner: CurveMapper;
private readonly _curveHorizontalOuter: CurveMapper;
private readonly _curveVerticalDown: CurveMapper;
private readonly _curveVerticalUp: CurveMapper;
<<<<<<<
humanBodyBones: VRMHumanBones,
curveHorizontalInner: CurveMapper,
curveHorizontalOuter: CurveMapper,
curveVerticalDown: CurveMapper,
curveVerticalUp: CurveMapper,
=======
humanoid: VRMHumanoid,
lookAtHorizontalInner: VRMSchema.FirstPersonDegreeMap,
lookAtHorizontalOuter: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalDown: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalUp: VRMSchema.FirstPersonDegreeMap,
>>>>>>>
humanoid: VRMHumanoid,
curveHorizontalInner: CurveMapper,
curveHorizontalOuter: CurveMapper,
curveVerticalDown: CurveMapper,
curveVerticalUp: CurveMapper,
<<<<<<<
super();
this._curveHorizontalInner = curveHorizontalInner;
this._curveHorizontalOuter = curveHorizontalOuter;
this._curveVerticalDown = curveVerticalDown;
this._curveVerticalUp = curveVerticalUp;
this._leftEye = humanBodyBones.leftEye;
this._rightEye = humanBodyBones.rightEye;
=======
super(lookAtHorizontalOuter, lookAtVerticalDown, lookAtVerticalUp);
this._leftEye = humanoid.getBoneNode(VRMSchema.HumanoidBoneName.LeftEye);
this._rightEye = humanoid.getBoneNode(VRMSchema.HumanoidBoneName.RightEye);
this.lookAtHorizontalInner = lookAtHorizontalInner;
}
public name(): VRMSchema.FirstPersonLookAtTypeName {
return VRMSchema.FirstPersonLookAtTypeName.Bone;
>>>>>>>
super();
this._curveHorizontalInner = curveHorizontalInner;
this._curveHorizontalOuter = curveHorizontalOuter;
this._curveVerticalDown = curveVerticalDown;
this._curveVerticalUp = curveVerticalUp;
this._leftEye = humanoid.getBoneNode(VRMSchema.HumanoidBoneName.LeftEye);
this._rightEye = humanoid.getBoneNode(VRMSchema.HumanoidBoneName.RightEye);
<<<<<<<
=======
}
function deg2rad(map: VRMSchema.FirstPersonDegreeMap): VRMSchema.FirstPersonDegreeMap {
return {
xRange: typeof map.xRange === 'number' ? DEG2RAD * map.xRange : undefined,
yRange: typeof map.yRange === 'number' ? DEG2RAD * map.yRange : undefined,
curve: map.curve,
};
>>>>>>> |
<<<<<<<
import { VRMBlendShapeMaster } from './blendshape';
import { VRMBlendShapeImporter } from './blendshape/VRMBlendShapeImporter';
import { RendererFirstPersonFlags, VRMFirstPerson } from './firstperson';
=======
import { BlendShapeController, BlendShapeMaster, VRMBlendShapeProxy } from './blendshape';
import { VRMFirstPersonImporter } from './firstperson/VRMFirstPersonImporter';
>>>>>>>
import { VRMBlendShapeImporter, VRMBlendShapeMaster } from './blendshape';
import { VRMFirstPersonImporter } from './firstperson';
<<<<<<<
import { GLTFMesh, GLTFNode, RawVrmHumanoidBone } from './types';
=======
import { GLTFMesh, GLTFPrimitive, RawVrmHumanoidBone } from './types';
>>>>>>>
import { RawVrmHumanoidBone } from './types';
<<<<<<<
blendShapeImporter?: VRMBlendShapeImporter;
=======
firstPersonImporter?: VRMFirstPersonImporter;
>>>>>>>
blendShapeImporter?: VRMBlendShapeImporter;
firstPersonImporter?: VRMFirstPersonImporter;
<<<<<<<
protected readonly _blendShapeImporter: VRMBlendShapeImporter;
=======
protected readonly _firstPersonImporter: VRMFirstPersonImporter;
>>>>>>>
protected readonly _blendShapeImporter: VRMBlendShapeImporter;
protected readonly _firstPersonImporter: VRMFirstPersonImporter;
<<<<<<<
this._blendShapeImporter = options.blendShapeImporter || new VRMBlendShapeImporter();
=======
this._firstPersonImporter = options.firstPersonImporter || new VRMFirstPersonImporter();
>>>>>>>
this._blendShapeImporter = options.blendShapeImporter || new VRMBlendShapeImporter();
this._firstPersonImporter = options.firstPersonImporter || new VRMFirstPersonImporter(); |
<<<<<<<
firstPerson && blendShapeProxy && humanBones
? await this._lookAtImporter.import(vrmExt.firstPerson, firstPerson, blendShapeProxy, humanBones)
=======
blendShapeProxy && humanoid
? await this._lookAtImporter.import(vrmExt.firstPerson, blendShapeProxy, humanoid)
>>>>>>>
firstPerson && blendShapeProxy && humanoid
? await this._lookAtImporter.import(vrmExt.firstPerson, firstPerson, blendShapeProxy, humanoid) |
<<<<<<<
import * as THREE from 'three'
import * as GLTFJSON from './GLTF'
import * as VRMExtension from './VRM'
/**
* It represents a parsed result of GLTF taken from GLTFLoader.
* Please note that this is not a complete type definition of that. (We are too lazy to do this...)
*
* See: https://threejs.org/docs/#examples/en/loaders/GLTFLoader
*/
export interface GLTF {
scene: THREE.Scene;
scenes: THREE.Scene[];
cameras: THREE.Camera[];
animations: THREE.AnimationClip[];
asset: GLTFJSON.RawAsset;
parser: {
json: GLTFJSON.RawGltf;
[key: string]: any;
};
userData: any;
}
/**
* A single node of GLTF, represented as Three.js object.
*/
export type GLTFNode = THREE.Object3D;
=======
import * as THREE from 'three';
import * as VRMExtension from './VRM';
>>>>>>>
import * as THREE from 'three';
import * as VRMExtension from './VRM';
/**
* A single node of GLTF, represented as Three.js object.
*/
export type GLTFNode = THREE.Object3D;
<<<<<<<
[boneName: string]: VRMPoseTransform | undefined;
=======
[name: string]:
| {
position?: number[];
rotation?: number[];
}
| undefined;
>>>>>>>
[boneName: string]: VRMPoseTransform | undefined; |
<<<<<<<
/**
* Readonly boolean that indicates this is a MToon material.
*/
public isVRMMToon: boolean = true;
=======
public readonly isVRMMToon: boolean = true;
>>>>>>>
/**
* Readonly boolean that indicates this is a MToon material.
*/
public readonly isVRMMToon: boolean = true; |
<<<<<<<
import { VRMHumanBones } from '../humanoid';
import { GLTFNode, VRMSchema } from '../types';
=======
import { VRMHumanoid } from '../humanoid';
import { GLTFNode, HumanBone } from '../types';
import { LookAtTypeName, RawVrmFirstPersonDegreemap } from '../types';
>>>>>>>
import { VRMHumanoid } from '../humanoid';
import { GLTFNode, VRMSchema } from '../types';
<<<<<<<
humanBodyBones: VRMHumanBones,
lookAtHorizontalInner: VRMSchema.FirstPersonDegreeMap,
lookAtHorizontalOuter: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalDown: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalUp: VRMSchema.FirstPersonDegreeMap,
=======
humanoid: VRMHumanoid,
lookAtHorizontalInner: RawVrmFirstPersonDegreemap,
lookAtHorizontalOuter: RawVrmFirstPersonDegreemap,
lookAtVerticalDown: RawVrmFirstPersonDegreemap,
lookAtVerticalUp: RawVrmFirstPersonDegreemap,
>>>>>>>
humanoid: VRMHumanoid,
lookAtHorizontalInner: VRMSchema.FirstPersonDegreeMap,
lookAtHorizontalOuter: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalDown: VRMSchema.FirstPersonDegreeMap,
lookAtVerticalUp: VRMSchema.FirstPersonDegreeMap, |
<<<<<<<
import { VRMFirstPerson } from '../firstperson';
import { VRMHumanBones } from '../humanoid';
import * as Raw from '../types/VRM';
import { CurveMapper } from './CurveMapper';
=======
import { VRMHumanoid } from '../humanoid';
import { VRMSchema } from '../types';
>>>>>>>
import { VRMFirstPerson } from '../firstperson';
import { VRMHumanoid } from '../humanoid';
import { VRMSchema } from '../types';
import { CurveMapper } from './CurveMapper';
<<<<<<<
schemaFirstPerson: Raw.RawVrmFirstPerson,
firstPerson: VRMFirstPerson,
=======
firstPerson: VRMSchema.FirstPerson,
>>>>>>>
schemaFirstPerson: VRMSchema.FirstPerson,
firstPerson: VRMFirstPerson,
<<<<<<<
const applyer = this._importApplyer(schemaFirstPerson, blendShapeProxy, humanBodyBones);
return new VRMLookAtHead(firstPerson, applyer || undefined);
=======
const applyer = this._importApplyer(firstPerson, blendShapeProxy, humanoid);
return new VRMLookAtHead(humanoid, applyer || undefined);
>>>>>>>
const applyer = this._importApplyer(schemaFirstPerson, blendShapeProxy, humanoid);
return new VRMLookAtHead(firstPerson, applyer || undefined);
<<<<<<<
schemaFirstPerson: Raw.RawVrmFirstPerson,
=======
firstPerson: VRMSchema.FirstPerson,
>>>>>>>
schemaFirstPerson: VRMSchema.FirstPerson,
<<<<<<<
switch (schemaFirstPerson.lookAtTypeName) {
case Raw.LookAtTypeName.Bone: {
=======
switch (firstPerson.lookAtTypeName) {
case VRMSchema.FirstPersonLookAtTypeName.Bone: {
>>>>>>>
switch (schemaFirstPerson.lookAtTypeName) {
case VRMSchema.FirstPersonLookAtTypeName.Bone: {
<<<<<<<
humanBodyBones,
this._importCurveMapperBone(lookAtHorizontalInner),
this._importCurveMapperBone(lookAtHorizontalOuter),
this._importCurveMapperBone(lookAtVerticalDown),
this._importCurveMapperBone(lookAtVerticalUp),
=======
humanoid,
lookAtHorizontalInner,
lookAtHorizontalOuter,
lookAtVerticalDown,
lookAtVerticalUp,
>>>>>>>
humanoid,
this._importCurveMapperBone(lookAtHorizontalInner),
this._importCurveMapperBone(lookAtHorizontalOuter),
this._importCurveMapperBone(lookAtVerticalDown),
this._importCurveMapperBone(lookAtVerticalUp), |
<<<<<<<
vrmExt.firstPerson && firstPerson && blendShapeProxy && humanoid
? await this._lookAtImporter.import(vrmExt.firstPerson, firstPerson, blendShapeProxy, humanoid)
=======
blendShapeProxy && humanoid
? (await this._lookAtImporter.import(gltf, blendShapeProxy, humanoid)) || undefined
>>>>>>>
firstPerson && blendShapeProxy && humanoid
? (await this._lookAtImporter.import(gltf, firstPerson, blendShapeProxy, humanoid)) || undefined |
<<<<<<<
import { DataType, findModule, getProcesses, ModuleObject, openProcess, ProcessObject, readBuffer, readMemory as readMemoryRaw, findPattern as findPatternRaw } from 'memoryjs';
=======
import {
DataType,
findModule,
getProcesses,
ModuleObject,
openProcess,
ProcessObject,
readBuffer,
readMemory as readMemoryRaw,
} from 'memoryjs';
>>>>>>>
import {
DataType,
findModule,
getProcesses,
ModuleObject,
openProcess,
ProcessObject,
readBuffer,
readMemory as readMemoryRaw,
findPattern as findPatternRaw,
} from 'memoryjs';
<<<<<<<
import { IOffsets, IOffsetsContainer } from './IOffsets';
=======
import equal from 'deep-equal';
import { createHash } from 'crypto';
import { readFileSync } from 'fs';
import offsetStore, { IOffsets } from './offsetStore';
import Errors from '../common/Errors';
>>>>>>>
import equal from 'deep-equal';
import offsetStore, { IOffsets } from './offsetStore';
import Errors from '../common/Errors';
<<<<<<<
reply: (event: string, ...args: unknown[]) => void;
offsets?: IOffsets;
offsetsContainer: IOffsetsContainer;
PlayerStruct?: Struct;
=======
sendIPC: Electron.WebContents['send'];
offsets: IOffsets | undefined;
PlayerStruct: Struct | undefined;
>>>>>>>
sendIPC: Electron.WebContents['send'];
offsets: IOffsets | undefined;
PlayerStruct: Struct | undefined;
<<<<<<<
this.gameAssembly = findModule('GameAssembly.dll', this.amongUs.th32ProcessID);
this.initializeoffsets();
this.reply('gameOpen', true);
=======
this.gameAssembly = findModule(
'GameAssembly.dll',
this.amongUs.th32ProcessID
);
const dllHash = createHash('sha256');
dllHash.update(readFileSync(this.gameAssembly.szExePath));
this.dllHash = dllHash.digest('base64');
this.sendIPC(IpcRendererMessages.NOTIFY_GAME_OPENED, true);
>>>>>>>
this.gameAssembly = findModule(
'GameAssembly.dll',
this.amongUs.th32ProcessID
);
this.initializeoffsets();
this.sendIPC(IpcRendererMessages.NOTIFY_GAME_OPENED, true);
<<<<<<<
loop(): void {
this.checkProcessOpen();
if (this.PlayerStruct && this.offsets && this.amongUs !== null && this.gameAssembly !== null) {
=======
loop(): string | null {
try {
this.checkProcessOpen();
} catch (e) {
return e;
}
if (!this.offsets && this.dllHash) {
if (!Object.prototype.hasOwnProperty.call(offsetStore, this.dllHash)) {
return Errors.UNSUPPORTED_VERSION;
}
this.offsets = offsetStore[this.dllHash];
this.PlayerStruct = new Struct();
for (const member of this.offsets.offsets.player.struct) {
if (member.type === 'SKIP' && member.skip) {
this.PlayerStruct = this.PlayerStruct.addMember(
Struct.TYPES.SKIP(member.skip),
member.name
);
} else {
this.PlayerStruct = this.PlayerStruct.addMember<unknown>(
Struct.TYPES[member.type] as ValueType<unknown>,
member.name
);
}
}
}
if (
this.amongUs !== null &&
this.gameAssembly !== null &&
this.offsets &&
this.PlayerStruct
) {
const offsets = this.offsets.offsets;
>>>>>>>
loop(): void {
this.checkProcessOpen();
if (
this.PlayerStruct &&
this.offsets &&
this.amongUs !== null &&
this.gameAssembly !== null
) {
<<<<<<<
const meetingHud = this.readMemory<number>('pointer', this.gameAssembly.modBaseAddr, this.offsets.meetingHud);
const meetingHud_cachePtr = meetingHud === 0 ? 0 : this.readMemory<number>('pointer', meetingHud, this.offsets.meetingHudCachePtr);
const meetingHudState = meetingHud_cachePtr === 0 ? 4 : this.readMemory('int', meetingHud, this.offsets.meetingHudState, 4);
const gameState = this.readMemory<number>('int', this.gameAssembly.modBaseAddr, this.offsets.gameState);
=======
const meetingHud = this.readMemory<number>(
'pointer',
this.gameAssembly.modBaseAddr,
offsets.meetingHud
);
const meetingHud_cachePtr =
meetingHud === 0
? 0
: this.readMemory<number>(
'uint32',
meetingHud,
offsets.meetingHudCachePtr
);
const meetingHudState =
meetingHud_cachePtr === 0
? 4
: this.readMemory('int', meetingHud, offsets.meetingHudState, 4);
const gameState = this.readMemory<number>(
'int',
this.gameAssembly.modBaseAddr,
offsets.gameState
);
>>>>>>>
const meetingHud = this.readMemory<number>(
'pointer',
this.gameAssembly.modBaseAddr,
this.offsets.meetingHud
);
const meetingHud_cachePtr =
meetingHud === 0
? 0
: this.readMemory<number>(
'pointer',
meetingHud,
this.offsets.meetingHudCachePtr
);
const meetingHudState =
meetingHud_cachePtr === 0
? 4
: this.readMemory('int', meetingHud, this.offsets.meetingHudState, 4);
const gameState = this.readMemory<number>(
'int',
this.gameAssembly.modBaseAddr,
this.offsets.gameState
);
<<<<<<<
this.gameCode = state === GameState.MENU ? '' : this.IntToGameCode(this.readMemory<number>('int32', this.gameAssembly.modBaseAddr, this.offsets.gameCode));
const allPlayersPtr = this.readMemory<number>('ptr', this.gameAssembly.modBaseAddr, this.offsets.allPlayersPtr);
const allPlayers = this.readMemory<number>('ptr', allPlayersPtr, this.offsets.allPlayers);
const playerCount = this.readMemory<number>('int' as const, allPlayersPtr, this.offsets.playerCount);
let playerAddrPtr = allPlayers + this.offsets.playerAddrPtr;
=======
const allPlayersPtr =
this.readMemory<number>(
'ptr',
this.gameAssembly.modBaseAddr,
offsets.allPlayersPtr
) & 0xffffffff;
const allPlayers = this.readMemory<number>(
'ptr',
allPlayersPtr,
offsets.allPlayers
);
const playerCount = this.readMemory<number>(
'int' as const,
allPlayersPtr,
offsets.playerCount
);
let playerAddrPtr = allPlayers + offsets.playerAddrPtr;
>>>>>>>
this.gameCode =
state === GameState.MENU
? ''
: this.IntToGameCode(
this.readMemory<number>(
'int32',
this.gameAssembly.modBaseAddr,
this.offsets.gameCode
)
);
const allPlayersPtr = this.readMemory<number>(
'ptr',
this.gameAssembly.modBaseAddr,
this.offsets.allPlayersPtr
);
const allPlayers = this.readMemory<number>(
'ptr',
allPlayersPtr,
this.offsets.allPlayers
);
const playerCount = this.readMemory<number>(
'int' as const,
allPlayersPtr,
this.offsets.playerCount
);
let playerAddrPtr = allPlayers + this.offsets.playerAddrPtr;
<<<<<<<
oldGameState: this.oldGameState,
isHost: (hostId && clientId && hostId === clientId) as boolean,
hostId: hostId,
clientId: clientId
=======
oldGameState: this.oldGameState,
isHost: (hostId && clientId && hostId === clientId) as boolean,
hostId: hostId,
clientId: clientId,
>>>>>>>
oldGameState: this.oldGameState,
isHost: (hostId && clientId && hostId === clientId) as boolean,
hostId: hostId,
clientId: clientId,
<<<<<<<
offsetAddress(address: number, offsets: number[]): { address: number, last: number } {
=======
offsetAddress(
address: number,
offsets: number[]
): { address: number; last: number } {
>>>>>>>
offsetAddress(
address: number,
offsets: number[]
): { address: number; last: number } {
<<<<<<<
address = readMemoryRaw<number>(this.amongUs.handle, address + offsets[i], this.is_64bit ? 'uint64' : 'uint32');
=======
address = readMemoryRaw<number>(
this.amongUs.handle,
address + offsets[i],
'uint32'
);
>>>>>>>
address = readMemoryRaw<number>(
this.amongUs.handle,
address + offsets[i],
this.is_64bit ? 'uint64' : 'uint32'
);
<<<<<<<
const x = this.readMemory<number>('float', data.objectPtr, positionOffsets[0]);
const y = this.readMemory<number>('float', data.objectPtr, positionOffsets[1]);
const clientId = this.readMemory<number>('uint32', data.objectPtr, this.offsets.player.clientId);
=======
const x = this.readMemory<number>(
'float',
data.objectPtr,
positionOffsets[0]
);
const y = this.readMemory<number>(
'float',
data.objectPtr,
positionOffsets[1]
);
>>>>>>>
const x = this.readMemory<number>(
'float',
data.objectPtr,
positionOffsets[0]
);
const y = this.readMemory<number>(
'float',
data.objectPtr,
positionOffsets[1]
);
const clientId = this.readMemory<number>(
'uint32',
data.objectPtr,
this.offsets.clientId
); |
<<<<<<<
haunting: boolean;
=======
meetingOverlay: boolean;
overlayPosition: 'left' | 'right' | 'hidden';
localLobbySettings: ILobbySettings;
}
export interface ILobbySettings {
maxDistance: number;
>>>>>>>
meetingOverlay: boolean;
overlayPosition: 'left' | 'right' | 'hidden';
localLobbySettings: ILobbySettings;
}
export interface ILobbySettings {
maxDistance: number;
haunting: boolean; |
<<<<<<<
import axios, { AxiosError } from 'axios';
import { createCheckers } from 'ts-interface-checker';
import TI from './hook-ti';
import { existsSync, readFileSync } from 'fs';
import { IOffsets } from './IOffsets';
import { IpcHandlerMessages, IpcRendererMessages, IpcSyncMessages } from '../common/ipc-messages';
const { IOffsets } = createCheckers(TI);
=======
>>>>>>>
import { IpcHandlerMessages, IpcRendererMessages, IpcSyncMessages } from '../common/ipc-messages';
<<<<<<<
async function loadOffsets(): Promise<{ success: true; offsets: IOffsets } | { success: false; error: string }> {
const valuesFile = resolve((process.env.LOCALAPPDATA || '') + 'Low', 'Innersloth/Among Us/Unity/6b8b0d91-4a20-4a00-a3e4-4da4a883a5f0/Analytics/values');
let version = '';
if (existsSync(valuesFile)) {
try {
const json = JSON.parse(readFileSync(valuesFile, 'utf8'));
version = json.app_ver;
} catch (e) {
console.error(e);
return { success: false, error: `Couldn't determine the Among Us version - ${e}. Try opening Among Us and then restarting CrewLink.` };
}
} else {
return { success: false, error: 'Couldn\'t determine the Among Us version - Unity analytics file doesn\'t exist. Try opening Among Us and then restarting CrewLink.' };
}
let data: string;
const offsetStore = store.get('offsets') || {};
if (version === offsetStore.version) {
data = offsetStore.data;
} else {
try {
const response = await axios({
url: `${store.get('serverURL')}/${version}.yml`
});
data = response.data;
} catch (_e) {
const e = _e as AxiosError;
console.error(e);
if (e?.response?.status === 404) {
return { success: false, error: `You are on an unsupported version of Among Us: ${version}.\n` };
} else {
let errorMessage = e.message;
if (errorMessage.includes('ETIMEDOUT')) {
errorMessage = 'has too many active players';
} else if (errorMessage.includes('refuesed')) {
errorMessage = 'is not input correctly';
} else {
errorMessage = 'gave this error: \n' + errorMessage;
}
return { success: false, error: `Please use another voice server. ${store.get('serverURL')} ${errorMessage}.` };
}
}
}
const offsets: IOffsets = yml.safeLoad(data) as unknown as IOffsets;
try {
IOffsets.check(offsets);
if (!version) {
return { success: false, error: 'Couldn\'t determine the Among Us version. Try opening Among Us and then restarting CrewLink.' };
} else {
store.set('offsets', {
version,
data
});
}
return { success: true, offsets };
} catch (e) {
console.error(e);
return { success: false, error: `Couldn't parse the latest game offsets from the server: ${store.get('serverURL')}/${version}.yml.\n${e}` };
}
}
=======
>>>>>>>
<<<<<<<
ipcMain.on(IpcSyncMessages.GET_INITIAL_STATE, (event) => {
if (!readingGame) {
console.error('Recieved GET_INITIAL_STATE message before the START_HOOK message was received');
event.returnValue = null;
return;
}
event.returnValue = gameReader.lastState;
});
/**
* null indicates success, failures should return an error string
*/
ipcMain.handle(IpcHandlerMessages.START_HOOK, async (event): Promise<{ error: string } | null> => {
const offsetsResults = await loadOffsets();
if (!offsetsResults.success) {
return { error: offsetsResults.error };
}
if (!readingGame) {
=======
ipcMain.on('start', async (event) => {
if (!readingGame) {
>>>>>>>
ipcMain.on(IpcSyncMessages.GET_INITIAL_STATE, (event) => {
if (!readingGame) {
console.error('Recieved GET_INITIAL_STATE message before the START_HOOK message was received');
event.returnValue = null;
return;
}
event.returnValue = gameReader.lastState;
});
ipcMain.handle(IpcHandlerMessages.START_HOOK, async (event) => {
if (!readingGame) {
<<<<<<<
if (keyCodeMatches(shortcutKey as K, ev)) {
event.sender.send(IpcRendererMessages.PUSH_TO_TALK, true);
=======
if (!isMouseButton(shortcutKey) && keyCodeMatches(shortcutKey as K, ev)) {
event.reply('pushToTalk', true);
>>>>>>>
if (!isMouseButton(shortcutKey) && keyCodeMatches(shortcutKey as K, ev)) {
event.sender.send(IpcRendererMessages.PUSH_TO_TALK, true);
<<<<<<<
gameReader = new GameReader(event.sender.send.bind(event.sender), offsetsResults.offsets);
=======
gameReader = new GameReader(
event.reply as (event: string, ...args: unknown[]) => void
);
>>>>>>>
gameReader = new GameReader(event.sender.send.bind(event.sender));
<<<<<<<
}
=======
}
const mouseClickMap = {
MouseButton4: 4,
MouseButton5: 5,
MouseButton6: 6,
MouseButton7: 7,
};
type M = keyof typeof mouseClickMap;
function mouseClickMatches(key: M, ev: IOHookEvent): boolean {
if (mouseClickMap[key]) return mouseClickMap[key] === ev.button;
return false;
}
function isMouseButton(shortcutKey: string): boolean {
return shortcutKey.includes('MouseButton');
}
ipcMain.on('openGame', () => {
// Get steam path from registry
const steamPath = enumerateValues(
HKEY.HKEY_LOCAL_MACHINE,
'SOFTWARE\\WOW6432Node\\Valve\\Steam'
).find((v) => v.name === 'InstallPath');
// Check if Steam is installed
if (!steamPath) {
dialog.showErrorBox('Error', 'Could not find your Steam install path.');
} else {
try {
const process = spawn(path.join(steamPath.data as string, 'steam.exe'), [
'-applaunch',
'945360',
]);
process.on('error', () => {
dialog.showErrorBox('Error', 'Please launch the game manually.');
});
} catch (e) {
dialog.showErrorBox('Error', 'Please launch the game manually.');
}
}
});
ipcMain.on('relaunch', () => {
app.relaunch();
app.quit();
});
>>>>>>>
}
const mouseClickMap = {
MouseButton4: 4,
MouseButton5: 5,
MouseButton6: 6,
MouseButton7: 7,
};
type M = keyof typeof mouseClickMap;
function mouseClickMatches(key: M, ev: IOHookEvent): boolean {
if (mouseClickMap[key]) return mouseClickMap[key] === ev.button;
return false;
}
function isMouseButton(shortcutKey: string): boolean {
return shortcutKey.includes('MouseButton');
} |
<<<<<<<
* @name tabindex
* @desc pass through the specified tabindex to the input
* @type {string}
*/
@Input() public tabindex: string = undefined;
/**
=======
* @name disabled
* @type {boolean}
*/
@Input() public disabled = undefined;
/**
>>>>>>>
* @name tabindex
* @desc pass through the specified tabindex to the input
* @type {string}
*/
@Input() public tabindex: string = undefined;
/**
* @name disabled
* @type {boolean}
*/
@Input() public disabled = undefined;
/** |
<<<<<<<
{destination: convertAddressToBytes32(destinationA), amount: "12"},
{destination: convertAddressToBytes32(destinationB), amount: "12"}
=======
{destination: destinationA, amount: "0x12"},
{destination: destinationB, amount: "0x12"}
>>>>>>>
{destination: convertAddressToBytes32(destinationA), amount: "0x12"},
{destination: convertAddressToBytes32(destinationB), amount: "0x12"} |
<<<<<<<
import { IRange } from "./interfaces/IValidation";
=======
import {
IRange,
IValidationError,
IValidationResponse
} from "./interfaces/IValidation";
import { IValidationAPIAdapter } from "./interfaces/IValidationAPIAdapter";
>>>>>>>
import { IRange } from "./interfaces/IValidation";
<<<<<<<
import { createBoundCommands } from "./commands";
=======
import { createBoundCommands, indicateHoverCommand } from "./commands";
>>>>>>>
import { indicateHoverCommand } from "./commands";
<<<<<<<
init: (_, { doc }) => createInitialState(doc, throttleInMs, maxThrottle),
=======
init(_, { doc }): IPluginState {
// Hook up our validation events.
validationService.on(
ValidationEvents.VALIDATION_SUCCESS,
(validationResponse: IValidationResponse) =>
localView.dispatch(
localView.state.tr.setMeta(
VALIDATION_PLUGIN_ACTION,
validationRequestSuccess(validationResponse)
)
)
);
validationService.on(
ValidationEvents.VALIDATION_ERROR,
(validationError: IValidationError) =>
localView.dispatch(
localView.state.tr.setMeta(
VALIDATION_PLUGIN_ACTION,
validationRequestError(validationError)
)
)
);
return createInitialState(doc, throttleInMs, maxThrottle);
},
>>>>>>>
init: (_, { doc }) => createInitialState(doc, throttleInMs, maxThrottle),
<<<<<<<
);
=======
)(localView.state, localView.dispatch)
>>>>>>>
)(localView.state, localView.dispatch)
<<<<<<<
const commands = createBoundCommands(
localView!,
plugin.getState.bind(plugin)
);
=======
>>>>>>> |
<<<<<<<
=======
const body = new URLSearchParams();
const validation = {
id,
validationInputs: inputs
};
this.addRunningValidation(validation);
>>>>>>>
<<<<<<<
const outputs = await this.adapter(input);
this.handleCompleteValidation(id, outputs);
return outputs;
=======
const response = await fetch(this.apiUrl, {
method: "POST",
headers: new Headers({
"Content-Type": "application/json"
}),
body: JSON.stringify({
text: input.str
})
});
const validationData: LTResponse = await response.json();
const validationOutputs: ValidationOutput[] = validationData.results.map(
match => ({
str: input.str,
from: input.from + match.fromPos,
to: input.from + match.toPos,
annotation: match.message,
type: match.rule.description,
suggestions: match.suggestedReplacements
})
);
this.handleCompleteValidation(id, validationOutputs);
return validationOutputs;
>>>>>>>
const result = await this.adapter(input);
this.handleCompleteValidation(id, result);
return result;
<<<<<<<
this.handleError(input, id, e.message);
return {
validationInput: input,
id,
message: e.message
};
=======
console.log(e.message)
this.handleError(input, id, e.status, e.message);
return [
{
validationInput: input,
id,
message: e.message,
status: e.status
}
];
>>>>>>>
this.handleError(input, id, e.message);
return {
validationInput: input,
message: e.message,
id
}; |
<<<<<<<
import { createValidationInput } from "./helpers/fixtures";
=======
import { validateDirtyRangesCommand } from "../commands";
import { createInitialState } from "../state";
import { Node } from "prosemirror-model";
import { Mapping } from "prosemirror-transform";
import { doesNotReject } from "assert";
>>>>>>>
import { createInitialState } from "../state";
import { Node } from "prosemirror-model";
import { Mapping } from "prosemirror-transform";
<<<<<<<
const createOutput = (str: string, offset: number = 0) => {
const from = offset;
const to = offset + str.length;
return {
=======
const createOutput = (inputString: string, offset: number = 0) =>
({
>>>>>>>
const createOutput = (inputString: string, offset: number = 0) => {
const from = offset;
const to = offset + inputString.length;
return {
<<<<<<<
from,
to,
str,
=======
from: offset,
to: offset + inputString.length,
inputString,
>>>>>>>
from,
to,
inputString,
<<<<<<<
str: "1234567890",
id: "0-from:0-to:10"
=======
inputString: "1234567890"
>>>>>>>
inputString: "1234567890",
id: "0-from:0-to:10"
<<<<<<<
const output = await service.validate(createValidationInput(0, 10));
expect(output).toMatchSnapshot();
=======
service.requestValidation();
store.emit("STORE_EVENT_NEW_VALIDATION", {
mapping: new Mapping(),
validationInput,
id: "id"
});
setTimeout(() => {
expect(commands.applyValidationError.mock.calls[0][0]).toMatchSnapshot();
done();
});
>>>>>>>
service.requestValidation();
store.emit("STORE_EVENT_NEW_VALIDATION", {
mapping: new Mapping(),
validationInput
});
setTimeout(() => {
expect(commands.applyValidationError.mock.calls[0][0]).toMatchSnapshot();
done();
}); |
<<<<<<<
export default async function(ledger: AssetLedger, state: AssetLedgerTransferState) {
const abi = xcertAbi.find((a) => (
a.name === 'setPause' && a.type === 'function'
));
return ledger.provider.send({
method: 'eth_sendTransaction',
params: [
{
from: ledger.provider.accountId,
to: ledger.id,
data: encodeFunctionCall(abi, [state !== AssetLedgerTransferState.ENABLED]),
gas: 6000000,
},
],
}).then((txId) => {
return new Mutation(ledger.provider, txId.result);
=======
/**
* Allows or freezes the option of transfering assets in specifies asset ledger.
*/
export default async function(provider: GenericProvider, ledgerId: string, state: AssetLedgerTransferState) {
return provider.mutateContract({
to: ledgerId,
abi: xcertAbi.find((a) => a.name === 'setPause'),
data: [state !== AssetLedgerTransferState.ENABLED],
>>>>>>>
/**
* Allows or freezes the option of transfering assets in specifies asset ledger.
*/
export default async function(ledger: AssetLedger, state: AssetLedgerTransferState) {
const abi = xcertAbi.find((a) => (
a.name === 'setPause' && a.type === 'function'
));
return ledger.provider.send({
method: 'eth_sendTransaction',
params: [
{
from: ledger.provider.accountId,
to: ledger.id,
data: encodeFunctionCall(abi, [state !== AssetLedgerTransferState.ENABLED]),
gas: 6000000,
},
],
}).then((txId) => {
return new Mutation(ledger.provider, txId.result); |
<<<<<<<
import { failure, pretty, Store, success } from '../..';
import { MachineFactory, getDataAndInvoke } from '../../machine-utils';
=======
import { Store, failure, pretty, success } from '../..';
import { MachineFactory } from '../../machine-utils';
>>>>>>>
import { failure, Store, success } from '../..';
import { MachineFactory, getDataAndInvoke } from '../../machine-utils'; |
<<<<<<<
/**
* Gas price multiplier. Defaults to 1.1.
*/
gasPriceMultiplier?: number;
=======
/**
* Sandbox mode. False by default.
*/
sandbox?: Boolean;
>>>>>>>
/**
* Gas price multiplier. Defaults to 1.1.
*/
gasPriceMultiplier?: number;
/**
* Sandbox mode. False by default.
*/
sandbox?: Boolean; |
<<<<<<<
data: encodeFunctionCall(abi, [receiverId, id, proof]),
=======
data: encodeFunctionCall(abi, [receiverId, id, imprint]),
gas: 6000000,
>>>>>>>
data: encodeFunctionCall(abi, [receiverId, id, imprint]), |
<<<<<<<
export default async function(ledger: AssetLedger, accountId: string, assetId: string, proof: string) {
const abi = xcertAbi.find((a) => (
a.name === 'mint' && a.type === 'function'
));
return ledger.provider.send({
method: 'eth_sendTransaction',
params: [
{
from: ledger.provider.accountId,
to: ledger.id,
data: encodeFunctionCall(abi, [accountId, assetId, proof]),
gas: 6000000,
},
],
}).then((txId) => {
return new Mutation(ledger.provider, txId.result);
=======
/**
* Creates a new asset an gives ownership to the specifies account.
*/
export default async function(provider: GenericProvider, ledgerId: string, accountId: string, assetId: string, proof: string) {
return provider.mutateContract({
to: ledgerId,
abi: xcertAbi.find((a) => a.name === 'mint'),
data: [accountId, assetId, proof],
>>>>>>>
/**
* Creates a new asset an gives ownership to the specifies account.
*/
export default async function(ledger: AssetLedger, accountId: string, assetId: string, proof: string) {
const abi = xcertAbi.find((a) => (
a.name === 'mint' && a.type === 'function'
));
return ledger.provider.send({
method: 'eth_sendTransaction',
params: [
{
from: ledger.provider.accountId,
to: ledger.id,
data: encodeFunctionCall(abi, [accountId, assetId, proof]),
gas: 6000000,
},
],
}).then((txId) => {
return new Mutation(ledger.provider, txId.result); |
<<<<<<<
playerA.channelWallet.workflows[0].machine.onTransition(state => {
if (state.value === 'confirmingWithUser') {
state.children.invokeCreateChannelConfirmation.send({type: 'USER_APPROVES'});
}
});
=======
playerA.channelWallet.workflows[0].service.send({type: 'USER_APPROVES'});
>>>>>>>
playerA.channelWallet.workflows[0].service.onTransition(state => {
if (state.value === 'confirmingWithUser') {
state.children.invokeCreateChannelConfirmation.send({type: 'USER_APPROVES'});
}
});
<<<<<<<
playerB.channelWallet.pushMessage(generateJoinChannelRequest(channelId), 'localhost');
playerB.channelWallet.workflows[0].machine.send({type: 'USER_APPROVES'});
=======
playerB.channelWallet.workflows[0].service.send({type: 'USER_APPROVES'});
>>>>>>>
playerB.channelWallet.pushMessage(generateJoinChannelRequest(channelId), 'localhost');
playerB.channelWallet.workflows[0].service.send({type: 'USER_APPROVES'}); |
<<<<<<<
splittedLink?: boolean;
=======
srcImage?: string;
>>>>>>>
splittedLink?: boolean;
srcImage?: string; |
<<<<<<<
import * as rxjs from 'rxjs';
import { State } from '@statechannels/nitro-protocol';
import { getStateSignerAddress, signState } from '@statechannels/nitro-protocol/lib/src/signatures';
=======
import { State, getStateSignerAddress, signState } from '@statechannels/nitro-protocol';
>>>>>>>
import * as rxjs from 'rxjs';
import { State, getStateSignerAddress, signState } from '@statechannels/nitro-protocol'; |
<<<<<<<
=======
private joinLinesInElements(elements: Element[]): Element[] {
const withLines: Element[] = [];
this.getElementsWithLines(elements, withLines);
withLines.forEach(element => {
const lines = this.getLinesInElement(element);
const interLinesSpaces = this.getInterLinesSpace(lines);
const joinedLines: Line[][] = this.joinLinesWithSpaces(lines, interLinesSpaces);
element.content = this.mergeLinesIntoParagraphs(joinedLines);
});
return elements;
}
private getLinesInElement(element: Element): Line[] {
if (Array.isArray(element.content)) {
const lines = element.content;
return lines.filter(item => item instanceof Line).map(line => line as Line);
}
return [];
}
private getElementsWithLines(elements: Element[], withLines: Element[]) {
elements.forEach(element => {
const lines = this.getLinesInElement(element);
if (lines.length > 0) {
withLines.push(element);
} else if (Array.isArray(element.content)) {
element.content.forEach(child => {
this.getElementsWithLines(child.content as Element[], withLines);
});
}
});
}
private getPageElements(page: Page, excludeLines: Line[]): Element[] {
return page.elements.filter(
element => !(element instanceof Line) || !excludeLines.includes(element),
);
}
>>>>>>>
private joinLinesInElements(elements: Element[]): Element[] {
const withLines: Element[] = [];
this.getElementsWithLines(elements, withLines);
withLines.forEach(element => {
const lines = this.getLinesInElement(element);
const interLinesSpaces = this.getInterLinesSpace(lines);
const joinedLines: Line[][] = this.joinLinesWithSpaces(lines, interLinesSpaces);
element.content = this.mergeLinesIntoParagraphs(joinedLines);
});
return elements;
}
private getLinesInElement(element: Element): Line[] {
if (Array.isArray(element.content)) {
const lines = element.content;
return lines.filter(item => item instanceof Line).map(line => line as Line);
}
return [];
}
private getElementsWithLines(elements: Element[], withLines: Element[]) {
elements.forEach(element => {
const lines = this.getLinesInElement(element);
if (lines.length > 0) {
withLines.push(element);
} else if (Array.isArray(element.content)) {
element.content.forEach(child => {
this.getElementsWithLines(child.content as Element[], withLines);
});
}
});
}
private getPageElements(page: Page, excludeLines: Line[]): Element[] {
return page.elements.filter(
element => !(element instanceof Line) || !excludeLines.includes(element),
);
} |
<<<<<<<
public startSpan(name?: string, type?: string, parentSpanId?: string) {
=======
public startSpan(name: string, type: string) {
if (!this.started) {
debug('calling %s.startSpan() on un-started %s %o',
this._className, this._className,
{ id: this.id, name: this.name, type: this.type })
return
}
if (this.ended) {
debug('calling %s.startSpan() on ended %s %o',
this._className, this._className,
{ id: this.id, name: this.name, type: this.type })
return
}
>>>>>>>
public startSpan(name: string, type: string, parentSpanId?: string) {
if (!this.started) {
debug('calling %s.startSpan() on un-started %s %o',
this._className, this._className,
{ id: this.id, name: this.name, type: this.type })
return
}
if (this.ended) {
debug('calling %s.startSpan() on ended %s %o',
this._className, this._className,
{ id: this.id, name: this.name, type: this.type })
return
} |
<<<<<<<
import { bip32, ECPair, networks as NETWORKS, payments, Psbt } from '..';
=======
import {
bip32,
ECPair,
networks as NETWORKS,
Psbt,
Signer,
SignerAsync,
} from '..';
>>>>>>>
import {
bip32,
ECPair,
networks as NETWORKS,
payments,
Psbt,
Signer,
SignerAsync,
} from '..'; |
<<<<<<<
let web3: IEtheriumProvider = new Web3(new Web3.providers.HttpProvider(config.web3.provider))
=======
console.log('reset web3')
let web3 = new Web3(
new Web3.providers.HttpProvider(
(config.binance)
? config.web3.binance_provider
: config.web3.provider
)
)
>>>>>>>
console.log('reset web3')
let web3: IEtheriumProvider = new Web3(
new Web3.providers.HttpProvider(
(config.binance)
? config.web3.binance_provider
: config.web3.provider
)
)
<<<<<<<
web3 = new Web3(new Web3.providers.HttpProvider(config.web3.provider))
=======
web3 = new Web3(
new Web3.providers.HttpProvider(
(config.binance)
? config.web3.binance_provider
: config.web3.provider
)
)
//@ts-ignore
>>>>>>>
web3 = new Web3(
new Web3.providers.HttpProvider(
(config.binance)
? config.web3.binance_provider
: config.web3.provider
)
)
//@ts-ignore |
<<<<<<<
{
title: 'Scroll Bar',
route: '/interface/scrollBar',
},
=======
{
title: 'Toggle Buttons',
route: '/interface/toggleButtons',
},
>>>>>>>
{
title: 'Scroll Bar',
route: '/interface/scrollBar',
},
{
title: 'Toggle Buttons',
route: '/interface/toggleButtons',
}, |
<<<<<<<
export const FacebookIconColor: string = '#3b5998';
// other colors
export const Orange: string = '#ffa500';
=======
export const FacebookIconColor: string = ' #3b5998';
// Box shadow
export const boxShadowColor: string = 'rgba(0, 0, 0, 0.05)';
>>>>>>>
export const FacebookIconColor: string = '#3b5998';
// other colors
export const Orange: string = '#ffa500';
// Box shadow
export const boxShadowColor: string = 'rgba(0, 0, 0, 0.05)'; |
<<<<<<<
CreateIcon = 'CreateIcon',
ClearIcon = 'ClearIcon',
LocationOnIcon = 'LocationOnIcon',
=======
QuestionAnswerIcon = 'QuestionAnswerIcon',
>>>>>>>
CreateIcon = 'CreateIcon',
ClearIcon = 'ClearIcon',
LocationOnIcon = 'LocationOnIcon',
QuestionAnswerIcon = 'QuestionAnswerIcon', |
<<<<<<<
export const getThumbnails = (url):string => {
if (!url) {
return '';
}
let video = youtubeId(url)
return 'http://img.youtube.com/vi/' + video + '/0.jpg';
};
=======
>>>>>>> |
<<<<<<<
import {AuthGuard} from "../auth-guard";
import {TranslatorService} from "../../providers/translator.service";
import {MixpanelService} from '../../providers/analytics/mixpanel.service';
=======
import {Analytics} from '../../providers/analytics';
>>>>>>>
import {MixpanelService} from '../../providers/analytics/mixpanel.service'; |
<<<<<<<
import {MixpanelService} from "../../providers/analytics/mixpanel.service";
=======
import {Analytics} from "../../providers/analytics";
import { Patient } from "../../dto/patient";
>>>>>>>
import {MixpanelService} from "../../providers/analytics/mixpanel.service";
import {Patient} from "../../dto/patient";
<<<<<<<
this.mixpanel.track('AlbumsComponent::add album success', {
patient_id: this.patientService.getCurrentPatient().patient_id,
=======
this.analytics.track('AlbumsComponent::add album success', {
patient_id: this.currentPatient.patient_id,
>>>>>>>
this.mixpanel.track('AlbumsComponent::add album success', {
patient_id: this.currentPatient.patient_id,
<<<<<<<
this.mixpanel.track('AlbumsComponent::add album error', {
patient_id: this.patientService.getCurrentPatient().patient_id,
=======
this.analytics.track('AlbumsComponent::add album error', {
patient_id: this.currentPatient.patient_id,
>>>>>>>
this.mixpanel.track('AlbumsComponent::add album error', {
patient_id: this.currentPatient.patient_id, |
<<<<<<<
public change: Function
public highlight: any
=======
public i18next: any
>>>>>>>
public i18next: any
public highlight: any |
<<<<<<<
import Undo from './undo/index'
import Redo from './redo/index'
=======
import Table from './table/index'
>>>>>>>
import Undo from './undo/index'
import Redo from './redo/index'
import Table from './table/index'
<<<<<<<
undo: Undo,
redo: Redo,
=======
table: Table,
>>>>>>>
undo: Undo,
redo: Redo,
table: Table, |
<<<<<<<
import Undo from './undo-redo'
=======
import initFullScreen, { setUnFullScreen, setFullScreen } from './init-fns/set-full-screen'
>>>>>>>
import initFullScreen, { setUnFullScreen, setFullScreen } from './init-fns/set-full-screen'
import Undo from './undo-redo' |
<<<<<<<
import pasteConfig from './paste'
=======
import cmdConfig from './cmd'
>>>>>>>
import pasteConfig from './paste'
import cmdConfig from './cmd'
<<<<<<<
pasteFilterStyle: boolean
pasteIgnoreImg: boolean
pasteTextHandle: Function
=======
styleWithCSS: boolean
>>>>>>>
pasteFilterStyle: boolean
pasteIgnoreImg: boolean
pasteTextHandle: Function
styleWithCSS: boolean
<<<<<<<
const defaultConfig = Object.assign({}, menusConfig, eventsConfig, styleConfig, pasteConfig)
=======
const defaultConfig = Object.assign({}, menusConfig, eventsConfig, styleConfig, cmdConfig)
>>>>>>>
const defaultConfig = Object.assign(
{},
menusConfig,
eventsConfig,
styleConfig,
cmdConfig,
pasteConfig
) |
<<<<<<<
import List from './list/index'
=======
import LineHeight from './lineHeight/index'
>>>>>>>
import List from './list/index'
import LineHeight from './lineHeight/index'
<<<<<<<
list: List,
=======
lineHeight: LineHeight,
>>>>>>>
list: List,
lineHeight: LineHeight, |
<<<<<<<
'image',
=======
'video',
>>>>>>>
'image',
'video', |
<<<<<<<
import constConfig from './const'
=======
import langConfig from './lang'
>>>>>>>
import constConfig from './const'
import langConfig from './lang'
<<<<<<<
imageConfig,
constConfig
=======
imageConfig,
langConfig
>>>>>>>
imageConfig,
constConfig,
langConfig |
<<<<<<<
import BackColor from './back-color/index'
import FontColor from './font-color/index'
import Image from './img/index'
=======
import backColor from './back-color/index'
import fontColor from './font-color/index'
import Video from './video/index'
>>>>>>>
import BackColor from './back-color/index'
import FontColor from './font-color/index'
import Video from './video/index'
import Image from './img/index'
<<<<<<<
backColor: BackColor,
fontColor: FontColor,
image: Image,
=======
backColor: backColor,
fontColor: fontColor,
video: Video,
>>>>>>>
backColor: BackColor,
fontColor: FontColor,
video: Video,
image: Image, |
<<<<<<<
import Strikethrough from './strikethrough/index'
=======
import Underline from './underline/index'
>>>>>>>
import Underline from './underline/index'
import Strikethrough from './strikethrough/index'
<<<<<<<
strikethrough: Strikethrough,
=======
underline: Underline,
>>>>>>>
underline: Underline,
strikethrough: Strikethrough, |
<<<<<<<
=======
/*****************************
**********COMMENT************
*****************************/
>>>>>>>
<<<<<<<
})()
function fiberWalk(entry) {
let output = [], globalID = 0;
function recurse(root, level, id) {
=======
})();
function fiberWalk(entry: any) {
let output: any = [];
/*****************************
****FIX TYPESCRIPT ISSUES****
*****************************/
// @ts-ignore
function recurse(root, level, id, parentId) {
>>>>>>>
})()
function fiberWalk(entry) {
let output = [], globalID = 0;
function recurse(root, level, id) {
<<<<<<<
// console.log('both');
output.push({ "name": root.sibling, "level": `${level}`, "id": `${globalID+= 1}`, "parentId": `${id}` },
{ "name": root.child, "level": `${level}`, "id": `${globalID += 1}`, "parentId": `${id}` }
=======
output.push({ "name": root.sibling, "level": level, "id": `${id + 1}`, "parentId": `${parentId - 1}` },
{ "name": root.child, "level": `${level + 1}`, "id": `${id + 1}`, "parentId": `${parentId}` }
>>>>>>>
// console.log('both');
output.push({ "name": root.sibling, "level": `${level}`, "id": `${globalID+= 1}`, "parentId": `${id}` },
{ "name": root.child, "level": `${level}`, "id": `${globalID += 1}`, "parentId": `${id}` }
<<<<<<<
recurse(entry, 0, 0);
// output.sort((a, b) => a[1] - b[1]);
=======
recurse(entry, 0, 0, 0);
/*****************************
****FIX TYPESCRIPT ISSUES****
*****************************/
// @ts-ignore
output.sort((a, b) => a[1] - b[1]);
/*****************************
****FIX TYPESCRIPT ISSUES****
*****************************/
// @ts-ignore
>>>>>>>
recurse(entry, 0, 0);
// output.sort((a, b) => a[1] - b[1]); |
<<<<<<<
private async _update() {
const rawData = await this._runPuppeteer();
this._panel.webview.html = this._getHtmlForWebview(rawData);
=======
private async _update() {
const rawReact = await this._runPuppeteer();
this._panel.webview.html = this._getHtmlForWebview(rawReact);
>>>>>>>
private async _update() {
const rawReact = await this._runPuppeteer();
this._panel.webview.html = this._getHtmlForWebview(rawReact);
<<<<<<<
console.log(__dirname, '=====')
const extPath = path.join(__dirname, '../', 'node_modules/react-devtools')
const result = (async () => {
=======
// console.log(__dirname, '=====')
// const extPath = path.join(__dirname, '../', 'node_modules/react-devtools')
return (async () => {
>>>>>>>
// console.log(__dirname, '=====')
// const extPath = path.join(__dirname, '../', 'node_modules/react-devtools')
return (async () => {
<<<<<<<
const formattedReactData = [];
const d3Schema = {
name: '',
children: [],
};
d3Schema.name = reactData[0][0];
formattedReactData.push(d3Schema);
=======
return reactData;
>>>>>>>
const formattedReactData = [];
const d3Schema = {
name: '',
children: [],
};
d3Schema.name = reactData[0][0];
formattedReactData.push(d3Schema);
return reactData;
<<<<<<<
public _getHtmlForWebview(rawData: any) {
=======
private _getHtmlForWebview(rawTreeData: any) {
>>>>>>>
public _getHtmlForWebview(rawData: any) {
private _getHtmlForWebview(rawTreeData: any) {
<<<<<<<
const demoReactData = [
=======
console.log(rawTreeData, '====pup result=====');
// treeData[0].parent = null;
const reactData = [
>>>>>>>
const demoReactData = [
console.log(rawTreeData, '====pup result=====');
// treeData[0].parent = null;
const reactData = [
<<<<<<<
var treeData = ${rawData};
=======
var treeData = d3.stratify().id(function(d) { return d.id }).parentId(function(d) { return d.level })(${rawTreeData});
// var treeData = ${reactJSON}
>>>>>>>
var treeData = ${rawData};
var treeData = d3.stratify().id(function(d) { return d.id }).parentId(function(d) { return d.level })(${rawTreeData});
// var treeData = ${reactJSON} |
<<<<<<<
import TreeNode from './TreeNode';
=======
>>>>>>>
import TreeNode from './TreeNode'; |
<<<<<<<
import {concat, of, Observable} from 'rxjs';
=======
import _ from 'lodash';
>>>>>>>
import {concat, of, Observable} from 'rxjs';
import _ from 'lodash'; |
<<<<<<<
=======
protected get TextureGroupName() {
return "TextureCube";
}
>>>>>>> |
<<<<<<<
=======
import {
Channel,
ensureExists,
MachineFactory,
Store,
success,
getEthAllocation,
FINAL,
} from '../..';
import { Outcome, Allocation } from '@statechannels/nitro-protocol';
>>>>>>>
import {
Channel,
ensureExists,
MachineFactory,
Store,
success,
getEthAllocation,
FINAL,
} from '../..';
import { Outcome, Allocation } from '@statechannels/nitro-protocol'; |
<<<<<<<
import JThreeContext = require("../NJThreeContext");
import NodeManager = require('./NodeManager');
import ContextComponents = require('../ContextComponents');
=======
import JThreeContextProxy = require("../../Core/JThreeContextProxy");
import JThreeContext = require("../../NJThreeContext");
import NodeManager = require('./../NodeManager');
import ContextComponents = require('../../ContextComponents');
>>>>>>>
import JThreeContext = require("../../NJThreeContext");
import NodeManager = require('./../NodeManager');
import ContextComponents = require('../../ContextComponents'); |
<<<<<<<
import J3Object from "../J3Object";
import J3ObjectBase from "../J3ObjectBase";
import InterfaceSelector from "../Static/InterfaceSelector";
import GomlTreeNodeBase from "../../Goml/GomlTreeNodeBase";
import isString from "lodash.isstring";
=======
import J3Object = require("../J3Object");
import J3ObjectBase = require("../J3ObjectBase");
import GomlTreeNodeBase = require("../../Goml/GomlTreeNodeBase");
import isString = require("lodash.isstring");
>>>>>>>
import J3Object from "../J3Object";
import J3ObjectBase from "../J3ObjectBase";
import GomlTreeNodeBase from "../../Goml/GomlTreeNodeBase";
import isString from "lodash.isstring"; |
<<<<<<<
public sharedObject: NamespacedDictionary<any>;
=======
public sharedObject: { [key: string]: any } = {};
public componentsElement: Element;
>>>>>>>
public sharedObject: NamespacedDictionary<any>;
public componentsElement: Element;
<<<<<<<
constructor(recipe: NodeDeclaration, element: Element, components: NamespacedSet) {
=======
constructor(recipe: NodeDeclaration,
element: Element,
components: Component[],
attributes: Attribute[]) {
>>>>>>>
constructor(recipe: NodeDeclaration, element: Element, components: NamespacedSet) {
<<<<<<<
child.sharedObject = null;
=======
child.sharedObject = {};
child._components.forEach((compo) => { compo.sharedObject = child.sharedObject; });
>>>>>>>
child.sharedObject = null;
<<<<<<<
=======
component.sharedObject = this.sharedObject;
this.componentsElement.appendChild(component.element);
>>>>>>>
this.componentsElement.appendChild(component.element); |
<<<<<<<
this.glExtensionRegistory.checkExtensions(glContext);
let materialManager = JThreeContext.getContextComponent<MaterialManager>(ContextComponents.MaterialManager);
if (materialManager.conditionRegistered) {
let extensionList: string[] = [];
for (let extName in GLExtensionRegistory.requiredExtensions) {
if (typeof this.glExtensionRegistory.extensions[extName] === "undefined") {
throw new Error("glExtension " + extName + " is undefined");
}
if (this.glExtensionRegistory.extensions[extName] !== null) {
extensionList.push(extName);
}
}
materialManager.conditionRegistered = true;
}
=======
this.glExtensionResolver.checkExtensions(glContext);
this.alternativeTexture = this.__initializeAlternativeTexture();
this.alternativeCubeTexture = this.__initializeAlternativeCubeTexture();
>>>>>>>
this.glExtensionRegistory.checkExtensions(glContext);
this.alternativeTexture = this.__initializeAlternativeTexture();
this.alternativeCubeTexture = this.__initializeAlternativeCubeTexture(); |
<<<<<<<
import GeometryBuilder = require("./Base/GeometryBuilder");
import BasicGeometry = require("./Base/BasicGeometry");
import Geometry = require("./Base/Geometry");
=======
import GeometryBuilder = require("./GeometryBuilder");
import BasicGeometry = require("./BasicGeometry");
>>>>>>>
import GeometryBuilder = require("./Base/GeometryBuilder");
import BasicGeometry = require("./Base/BasicGeometry"); |
<<<<<<<
MockAxios.all([]);
=======
MockAxios.all();
MockAxios.head();
MockAxios.options();
>>>>>>>
MockAxios.all([]);
MockAxios.head();
MockAxios.options(); |
<<<<<<<
import { MachineFactory, FINAL, statesEqual, outcomesEqual } from '../..';
import { IStore } from '../../store';
=======
import { MachineFactory, statesEqual } from '../..';
import { IStore, observeChannel } from '../../store';
>>>>>>>
import { MachineFactory, FINAL, statesEqual, outcomesEqual } from '../..';
import { IStore, observeChannel } from '../../store';
<<<<<<<
export type machine = typeof machine;
export const machine: MachineFactory<Init, any> = (store: IStore, context: Init) => {
const services: Services = {
sendState: async ({ state }: Init) => {
const entry = store.getEntry(getChannelId(state.channel));
const { latestStateSupportedByMe, hasSupportedState } = entry;
// TODO: Should these safety checks be performed in the store?
if (
// If we've haven't already signed a state, there's no harm in supporting one.
!latestStateSupportedByMe ||
// If we've already supported this state, we might as well re-send it.
statesEqual(latestStateSupportedByMe, state) ||
// Otherwise, we only send it if we haven't signed any new states.
(hasSupportedState &&
statesEqual(entry.latestSupportedState, latestStateSupportedByMe) &&
entry.latestSupportedState.turnNum < state.turnNum) ||
// We always support a final state if it matches the outcome that we have signed
(state.isFinal && outcomesEqual(state.outcome, latestStateSupportedByMe.outcome))
) {
await store.sendState(state);
} else {
throw 'Not safe to send';
}
},
};
=======
const sendState = (store: IStore) => async ({ state }: Init) => {
const entry = store.getEntry(getChannelId(state.channel));
const { latestStateSupportedByMe, hasSupportedState } = entry;
// TODO: Should these safety checks be performed in the store?
if (
// If we've haven't already signed a state, there's no harm in supporting one.
!latestStateSupportedByMe ||
// If we've already supported this state, we might as well re-send it.
statesEqual(latestStateSupportedByMe, state) ||
// Otherwise, we only send it if we haven't signed any new states.
(hasSupportedState &&
statesEqual(entry.latestSupportedState, latestStateSupportedByMe) &&
entry.latestSupportedState.turnNum < state.turnNum)
) {
await store.sendState(state);
} else {
throw 'Not safe to send';
}
};
>>>>>>>
const sendState = (store: IStore) => async ({ state }: Init) => {
const entry = store.getEntry(getChannelId(state.channel));
const { latestStateSupportedByMe, hasSupportedState } = entry;
// TODO: Should these safety checks be performed in the store?
if (
// If we've haven't already signed a state, there's no harm in supporting one.
!latestStateSupportedByMe ||
// If we've already supported this state, we might as well re-send it.
statesEqual(latestStateSupportedByMe, state) ||
// Otherwise, we only send it if we haven't signed any new states.
(hasSupportedState &&
statesEqual(entry.latestSupportedState, latestStateSupportedByMe) &&
entry.latestSupportedState.turnNum < state.turnNum) ||
// We always support a final state if it matches the outcome that we have signed
(state.isFinal && outcomesEqual(state.outcome, latestStateSupportedByMe.outcome))
) {
await store.sendState(state);
} else {
throw 'Not safe to send';
}
}; |
<<<<<<<
join(Config.APP_CLIENT_SRC, '**/*.ts'),
join(Config.APP_CLIENT_SRC, '**/*.html'),
join(Config.APP_CLIENT_SRC, '**/*.css'),
join(Config.APP_CLIENT_SRC, '**/*.json'),
join(Config.APP_CLIENT_SRC, '*.json'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.spec.ts'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.e2e-spec.ts')
=======
join(Config.APP_SRC, '**/*.ts'),
join(Config.APP_SRC, '**/*.json'),
'!' + join(Config.APP_SRC, '**/*.spec.ts'),
'!' + join(Config.APP_SRC, '**/*.e2e-spec.ts')
>>>>>>>
join(Config.APP_CLIENT_SRC, '**/*.ts'),
join(Config.APP_CLIENT_SRC, '**/*.json'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.spec.ts'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.e2e-spec.ts') |
<<<<<<<
'typings/main.d.ts',
join(APP_SRC, '**/*.ts'),
'!' + join(APP_SRC, '**/*.e2e.ts'),
'!' + join(APP_SRC, 'main.ts')
];
=======
join(APP_SRC, '**/*.ts'),
'!' + join(APP_SRC, `${BOOTSTRAP_MODULE}.ts`)
];
>>>>>>>
'typings/main.d.ts',
join(APP_SRC, '**/*.ts'),
'!' + join(APP_SRC, '**/*.e2e.ts'),
'!' + join(APP_SRC, `${BOOTSTRAP_MODULE}.ts`)
]; |
<<<<<<<
base: Config.TMP_CLIENT_DIR,
=======
base: Config.TMP_DIR,
target: 'es5',
>>>>>>>
base: Config.TMP_CLIENT_DIR,
target: 'es5', |
<<<<<<<
export = () => {
let tsProject: any;
let typings = gulp.src([
Config.TOOLS_DIR + '/manual_typings/**/*.d.ts'
]);
let src = [
join(Config.APP_CLIENT_SRC, '**/*.ts'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.spec.ts'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.e2e-spec.ts'),
'!' + join(Config.APP_CLIENT_SRC, `**/${Config.BOOTSTRAP_FACTORY_PROD_MODULE}.ts`)
];
=======
export =
class BuildJsDev extends TypeScriptTask {
run() {
let tsProject: any;
let typings = gulp.src([
Config.TOOLS_DIR + '/manual_typings/**/*.d.ts'
]);
let src = [
join(Config.APP_SRC, '**/*.ts'),
'!' + join(Config.APP_SRC, '**/*.spec.ts'),
'!' + join(Config.APP_SRC, '**/*.e2e-spec.ts'),
'!' + join(Config.APP_SRC, `**/${Config.NG_FACTORY_FILE}.ts`)
];
>>>>>>>
export =
class BuildJsDev extends TypeScriptTask {
run() {
let tsProject: any;
let typings = gulp.src([
Config.TOOLS_DIR + '/manual_typings/**/*.d.ts'
]);
let src = [
join(Config.APP_CLIENT_SRC, '**/*.ts'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.spec.ts'),
'!' + join(Config.APP_CLIENT_SRC, '**/*.e2e-spec.ts'),
'!' + join(Config.APP_CLIENT_SRC, `**/${Config.NG_FACTORY_FILE}.ts`)
]; |
<<<<<<<
=======
import { enableProdMode } from '@angular/core';
// The browser platform with a compiler
>>>>>>>
import { enableProdMode } from '@angular/core';
// The browser platform with a compiler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.