How to use the @bentley/imodeljs-common.IModelVersion.latest function in @bentley/imodeljs-common

To help you get started, we’ve selected a few @bentley/imodeljs-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / testbed / frontend / performance / IModelApi.ts View on Github external
public static async openIModel(accessToken: AccessToken, projectId: string, iModelId: string, changeSetId: string | undefined, openMode: OpenMode): Promise {
    return IModelConnection.open(accessToken!, projectId, iModelId, openMode, changeSetId ? IModelVersion.asOfChangeSet(changeSetId) : IModelVersion.latest());
  }
}
github imodeljs / imodeljs / test-apps / agent-test-app / src / changeSetUtility / HubUtility.ts View on Github external
public async createNamedVersion(accessToken: AccessToken, iModelId: string, name: string, description: string): Promise {
        const changeSetId: string = await IModelVersion.latest().evaluateChangeSet(actx, accessToken, iModelId, this._hubClient);
        Logger.logTrace(ChangeSetUtilityConfig.loggingCategory, `Creating named version "${name}" on the Hub`);
        return this._hubClient.versions.create(actx, accessToken, iModelId, changeSetId, name, description);
    }
    /** Push an iModel to the Hub */
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / frontend / IModelApi.ts View on Github external
public static async openIModel(accessToken: AccessToken, projectId: string, iModelId: string, changeSetId: string | undefined, openMode: OpenMode): Promise {
    return IModelConnection.open(accessToken!, projectId, iModelId, openMode, changeSetId ? IModelVersion.asOfChangeSet(changeSetId) : IModelVersion.latest());
  }
}
github imodeljs / imodeljs / test-apps / display-test-app / src / frontend / IModelApi.ts View on Github external
public static async openIModel(projectId: string, iModelId: string, changeSetId: string | undefined, openMode: OpenMode): Promise {
    return IModelConnection.open(projectId, iModelId, openMode, changeSetId ? IModelVersion.asOfChangeSet(changeSetId) : IModelVersion.latest());
  }
}
github imodeljs / imodeljs / core / backend / src / IModelDb.ts View on Github external
  public async pullAndMergeChanges(requestContext: AuthorizedClientRequestContext, version: IModelVersion = IModelVersion.latest()): Promise {
    requestContext.enter();
    this.concurrencyControl.onMergeChanges();
    await BriefcaseManager.pullAndMergeChanges(requestContext, this.briefcase, version);
    requestContext.enter();
    this.concurrencyControl.onMergedChanges();
    this.iModelToken.changeSetId = this.briefcase.currentChangeSetId;
    this.initializeIModelDb();
  }
github imodeljs / imodeljs / core / backend / src / IModelDb.ts View on Github external
  public static async open(requestContext: AuthorizedClientRequestContext, contextId: string, iModelId: string, openParams: OpenParams = OpenParams.pullAndPush(), version: IModelVersion = IModelVersion.latest()): Promise {
    requestContext.enter();
    const perfLogger = new PerfLogger("Opening iModel", () => ({ contextId, iModelId, ...openParams }));

    IModelDb.onOpen.raiseEvent(requestContext, contextId, iModelId, openParams, version);

    let briefcaseEntry: BriefcaseEntry;
    let timedOut = false;
    try {
      briefcaseEntry = await BriefcaseManager.open(requestContext, contextId, iModelId, openParams, version);
      requestContext.enter();

      if (briefcaseEntry.isPending) {
        if (typeof openParams.timeout === "undefined")
          await briefcaseEntry.isPending;
        else {
          timedOut = true;
github imodeljs / imodeljs / core / backend / src / BriefcaseManager.ts View on Github external
  public static async pullAndMergeChanges(requestContext: AuthorizedClientRequestContext, briefcase: BriefcaseEntry, mergeToVersion: IModelVersion = IModelVersion.latest()): Promise {
    requestContext.enter();

    const { changeSetId: targetChangeSetId, changeSetIndex: targetChangeSetIndex } = await BriefcaseManager.evaluateVersion(requestContext, mergeToVersion, briefcase.iModelId);
    requestContext.enter();
    if (targetChangeSetIndex < briefcase.currentChangeSetIndex)
      return Promise.reject(new IModelError(ChangeSetStatus.NothingToMerge, "Nothing to merge", Logger.logError, loggerCategory, () => ({ ...briefcase.getDebugInfo(), targetChangeSetId, targetChangeSetIndex })));

    await BriefcaseManager.updatePendingChangeSets(requestContext, briefcase);
    requestContext.enter();

    return BriefcaseManager.processChangeSets(requestContext, briefcase, targetChangeSetId, targetChangeSetIndex);
  }
github imodeljs / imodeljs / core / backend / src / IModelDb.ts View on Github external
  public async reinstateChanges(requestContext: AuthorizedClientRequestContext, version: IModelVersion = IModelVersion.latest()): Promise {
    requestContext.enter();
    await BriefcaseManager.reinstateChanges(requestContext, this.briefcase, version);
    requestContext.enter();
    this.initializeIModelDb();
  }
github imodeljs / imodeljs / core / frontend / src / IModelConnection.ts View on Github external
  public static async open(contextId: string, iModelId: string, openMode: OpenMode = OpenMode.Readonly, version: IModelVersion = IModelVersion.latest()): Promise {
    if (!IModelApp.initialized)
      throw new IModelError(BentleyStatus.ERROR, "Call IModelApp.startup() before calling open");

    const requestContext = await AuthorizedFrontendRequestContext.create();
    requestContext.enter();

    const changeSetId: string = await version.evaluateChangeSet(requestContext, iModelId, IModelApp.iModelClient);
    requestContext.enter();

    const iModelToken = new IModelToken(undefined, contextId, iModelId, changeSetId, openMode);

    const openResponse: IModelProps = await IModelConnection.callOpen(requestContext, iModelToken, openMode);
    requestContext.enter();

    const connection = new IModelConnection(openResponse, openMode);
    RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);
github imodeljs / imodeljs / core / backend / src / IModelDb.ts View on Github external
  public async reverseChanges(requestContext: AuthorizedClientRequestContext, version: IModelVersion = IModelVersion.latest()): Promise {
    requestContext.enter();
    await BriefcaseManager.reverseChanges(requestContext, this.briefcase, version);
    requestContext.enter();
    this.initializeIModelDb();
  }