@itwin/core-backend 4.1.0-dev.2 → 4.1.0-dev.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,47 @@
1
1
  # Change Log - @itwin/core-backend
2
2
 
3
- This log was last generated on Tue, 25 Apr 2023 17:50:35 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 22 May 2023 15:34:14 GMT and should not be manually modified.
4
+
5
+ ## 4.0.0
6
+ Mon, 22 May 2023 15:34:14 GMT
7
+
8
+ ### Updates
9
+
10
+ - use baseUri rather than accountName for cloud containers
11
+ - added support for index of internal codes
12
+ - added IModelHost.profileDir. No two process may use the same profile directory at the same time.
13
+ - implemented constant lod texture mapping for tiles
14
+ - Deprecate IModelDb's and ECDb's query, queryRowCount, and restartQuery methods.
15
+ - Remove `ChangeSummaryManager.extractChangeSummaries`
16
+ - added ChannelControl
17
+ - Update to eslint@8
18
+ - add flag schemaLockHeld
19
+ - add public methods to BriefcaseManager to query the hub for changesets
20
+ - Drop Node 12 and Node 14.
21
+ - Drop Node 16 support.
22
+ - Prevent IPC requests from blocking the backend.
23
+ - cloudsqlite: add bcvhttplog and pragma bcv_client support
24
+ - change backendhubaccess and related properties to @internal
25
+ - Add SpatialViewState.fromJSON.
26
+ - remove old entity-unaware implementation of getReferenceIds
27
+ - rename members of @alpha CodeService interfaces
28
+ - DrawingViewDefinition.fromJSON
29
+ - Fix for timing issue in core tests
30
+ - allow passing a custom schema read context to IModelDb.importSchemas
31
+ - Added test to verify Id serialization to hex for system properties.
32
+
33
+ ## 3.7.6
34
+ Mon, 15 May 2023 18:23:40 GMT
35
+
36
+ ### Updates
37
+
38
+ - log metadata when uploading tiles
39
+ - disable native sqlite logger category when calling 'updateToRequestedVersion'
40
+
41
+ ## 3.7.5
42
+ Thu, 04 May 2023 19:43:18 GMT
43
+
44
+ _Version update only_
4
45
 
5
46
  ## 3.7.4
6
47
  Tue, 25 Apr 2023 17:50:35 GMT
@@ -31,6 +31,8 @@ export declare namespace BlobContainer {
31
31
  iTwinId: Id64String;
32
32
  /** optionally, an iModelId within the iTwin. If present, container is deleted when the iModel is deleted. */
33
33
  iModelId?: Id64String;
34
+ /** optionally, an owner of the container. Owners always have administrator rights for the container. */
35
+ owner?: string;
34
36
  }
35
37
  /**
36
38
  * Metadata about the use of a container so that:
@@ -1 +1 @@
1
- {"version":3,"file":"BlobContainerService.d.ts","sourceRoot":"","sources":["../../src/BlobContainerService.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAE7B,+FAA+F;IACxF,IAAI,OAAO,EAAE,aAAa,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAE/D,8CAA8C;IAC9C,KAAY,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAElD,mDAAmD;IACnD,KAAY,WAAW,GAAG,MAAM,CAAC;IAEjC,4FAA4F;IAC5F,KAAY,SAAS,GAAG,WAAW,CAAC;IAEpC,+EAA+E;IAC/E,KAAY,cAAc,GAAG,WAAW,CAAC;IAEzC;;;;;;;;OAQG;IACH,UAAiB,KAAK;QACpB,8CAA8C;QAC9C,OAAO,EAAE,UAAU,CAAC;QACpB,6GAA6G;QAC7G,QAAQ,CAAC,EAAE,UAAU,CAAC;KACvB;IAED;;;;;;OAMG;IACH,UAAiB,QAAQ;QACvB,yJAAyJ;QACzJ,WAAW,EAAE,MAAM,CAAC;QACpB,+GAA+G;QAC/G,MAAM,EAAE,MAAM,CAAC;QACf,qEAAqE;QACrE,WAAW,EAAE,MAAM,CAAC;QACpB,oDAAoD;QACpD,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;KAChC;IAED,oDAAoD;IACpD,UAAiB,UAAU;QACzB;;;WAGG;QACH,KAAK,EAAE,cAAc,CAAC;QAC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C;QAClB,SAAS,EAAE,SAAS,CAAC;KACtB;IAED,uEAAuE;IACvE,UAAiB,iBAAkB,SAAQ,oBAAoB;QAC7D;;WAEG;QACH,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAED,sDAAsD;IACtD,UAAiB,uBAAuB;QACtC,qCAAqC;QACrC,KAAK,EAAE,KAAK,CAAC;QACb,iDAAiD;QACjD,QAAQ,EAAE,QAAQ,CAAC;QACnB,4GAA4G;QAC5G,SAAS,EAAE,SAAS,CAAC;QACrB;;;WAGG;QACH,EAAE,CAAC,EAAE,WAAW,CAAC;KAClB;IAED,6DAA6D;IAC7D,UAAiB,gBAAgB;QAC/B;;WAEG;QACH,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE1D;;;WAGG;QACH,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAEnD;;WAEG;QACH,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;KAC7D;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlobContainerService.js","sourceRoot":"","sources":["../../src/BlobContainerService.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,IAAiB,aAAa,CA6H7B;AA7HD,WAAiB,aAAa;AA6H9B,CAAC,EA7HgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA6H7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module BlobContainers\r\n */\r\n\r\n// spell:ignore datacenter\r\n\r\nimport { AccessToken, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/**\r\n * Types and functions for creating, deleting and authorizing access to cloud-based blob containers for an iTwin.\r\n * @beta\r\n */\r\nexport namespace BlobContainer {\r\n\r\n /** Object that implements the methods to create, delete, and request access to a container. */\r\n export let service: BlobContainer.ContainerService | undefined;\r\n\r\n /** name of cloud provider for a container. */\r\n export type Provider = \"azure\" | \"google\" | \"aws\";\r\n\r\n /** the name of the container within its `Scope` */\r\n export type ContainerId = string;\r\n\r\n /** token that authenticates a user. This token is required to obtain a `ContainerToken`. */\r\n export type UserToken = AccessToken;\r\n\r\n /** token that authenticates access to a container for either read or write. */\r\n export type ContainerToken = AccessToken;\r\n\r\n /**\r\n * The scope for a container. This determines:\r\n * - the \"owner\" organization, including the contract that governs its legal and commercial terms and obligations\r\n * - the administrators who may configure RBAC permissions\r\n * - the datacenter for the container. Every container resides in a datacenter as determined by the iTwinId. This\r\n * determines the region for data residency requirements.\r\n * - the lifecycle constraints for the container. No container can outlive its iTwin or its iModel (if defined). That is,\r\n * when the iTwin/iModel is deleted (either explicitly or due to contract expiration), the container is also deleted.\r\n */\r\n export interface Scope {\r\n /** iTwinId of the owner of this container. */\r\n iTwinId: Id64String;\r\n /** optionally, an iModelId within the iTwin. If present, container is deleted when the iModel is deleted. */\r\n iModelId?: Id64String;\r\n }\r\n\r\n /**\r\n * Metadata about the use of a container so that:\r\n * - administrators can understand why a container exists for assigning RBAC permissions appropriately\r\n * - usage reports can aggregate types of containers\r\n * - applications can identify their containers\r\n * - applications can store important (to them) properties \"on\" their containers\r\n */\r\n export interface Metadata {\r\n /** Human readable explanation of the information held in the container. This will be displayed in the administrator RBAC panel, and on usage reports. */\r\n description: string;\r\n /** a machine-readable string that describes the \"format\" of the data in this container (e.g. \"CloudSqlite\") */\r\n format: string;\r\n /** an identifier of the application that uses this this container */\r\n application: string;\r\n /** Additional properties stored on the container */\r\n [propertyName: string]: string;\r\n }\r\n\r\n /** Properties returned by `Service.requestToken` */\r\n export interface TokenProps {\r\n /**\r\n * expiring token that provides the requested access to the container. Should be used in all subsequent requests for blobs within the container,\r\n * and must be refreshed before it expires\r\n */\r\n token: ContainerToken;\r\n /** scope of the container. */\r\n scope: Scope;\r\n /** name of the blob storage provider. */\r\n provider: Provider;\r\n /** Time at which the token will expire. The token should be refreshed (that is, a new token should be requested) before this time. */\r\n expiration: Date;\r\n /** Metadata of the container. */\r\n metadata: Metadata;\r\n }\r\n\r\n /** The URI and Id of the container. */\r\n export interface UriAndId {\r\n baseUri: string;\r\n id: ContainerId;\r\n }\r\n\r\n /** Information required to access an existing container. */\r\n export interface AccessContainerProps {\r\n address: UriAndId;\r\n userToken: UserToken;\r\n }\r\n\r\n /** Information required to request an access token for a container. */\r\n export interface RequestTokenProps extends AccessContainerProps {\r\n /** If true, token should provide write access.\r\n * @note if write access is requested and the user is authorized for read but not write, an exception will be thrown (i.e. a read token is *not* returned).\r\n */\r\n forWriteAccess?: boolean;\r\n /** the number of seconds before the token should expire.\r\n * @note A maximum duration is determined by the service. If no value is supplied, or the value is larger than the maximum, the maximum duration is used.\r\n */\r\n durationSeconds?: number;\r\n }\r\n\r\n /** Information required to create a new container. */\r\n export interface CreateNewContainerProps {\r\n /** the scope of the new container */\r\n scope: Scope;\r\n /** metadata to be stored on the new container */\r\n metadata: Metadata;\r\n /** The user's access token. The user must be authorized with \"create container\" RBAC role for the iTwin. */\r\n userToken: UserToken;\r\n /**\r\n * the id for the container. Useful for tests.\r\n * @internal\r\n */\r\n id?: ContainerId;\r\n }\r\n\r\n /** Methods to create, delete, and access blob containers. */\r\n export interface ContainerService {\r\n /**\r\n * Create a new blob container. Throws on failure (e.g. access denied or container already exists.)\r\n */\r\n create(props: CreateNewContainerProps): Promise<UriAndId>;\r\n\r\n /**\r\n * Delete an existing blob container.\r\n * @note This method requires that the user be authorized with \"delete container\" RBAC role for the iTwin.\r\n */\r\n delete(props: AccessContainerProps): Promise<void>;\r\n\r\n /**\r\n * Request a `ContainerToken` for a container. Throws on failure.\r\n */\r\n requestToken(props: RequestTokenProps): Promise<TokenProps>;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BlobContainerService.js","sourceRoot":"","sources":["../../src/BlobContainerService.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,IAAiB,aAAa,CA+H7B;AA/HD,WAAiB,aAAa;AA+H9B,CAAC,EA/HgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA+H7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module BlobContainers\r\n */\r\n\r\n// spell:ignore datacenter\r\n\r\nimport { AccessToken, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/**\r\n * Types and functions for creating, deleting and authorizing access to cloud-based blob containers for an iTwin.\r\n * @beta\r\n */\r\nexport namespace BlobContainer {\r\n\r\n /** Object that implements the methods to create, delete, and request access to a container. */\r\n export let service: BlobContainer.ContainerService | undefined;\r\n\r\n /** name of cloud provider for a container. */\r\n export type Provider = \"azure\" | \"google\" | \"aws\";\r\n\r\n /** the name of the container within its `Scope` */\r\n export type ContainerId = string;\r\n\r\n /** token that authenticates a user. This token is required to obtain a `ContainerToken`. */\r\n export type UserToken = AccessToken;\r\n\r\n /** token that authenticates access to a container for either read or write. */\r\n export type ContainerToken = AccessToken;\r\n\r\n /**\r\n * The scope for a container. This determines:\r\n * - the \"owner\" organization, including the contract that governs its legal and commercial terms and obligations\r\n * - the administrators who may configure RBAC permissions\r\n * - the datacenter for the container. Every container resides in a datacenter as determined by the iTwinId. This\r\n * determines the region for data residency requirements.\r\n * - the lifecycle constraints for the container. No container can outlive its iTwin or its iModel (if defined). That is,\r\n * when the iTwin/iModel is deleted (either explicitly or due to contract expiration), the container is also deleted.\r\n */\r\n export interface Scope {\r\n /** iTwinId of the owner of this container. */\r\n iTwinId: Id64String;\r\n /** optionally, an iModelId within the iTwin. If present, container is deleted when the iModel is deleted. */\r\n iModelId?: Id64String;\r\n /** optionally, an owner of the container. Owners always have administrator rights for the container. */\r\n owner?: string;\r\n }\r\n\r\n /**\r\n * Metadata about the use of a container so that:\r\n * - administrators can understand why a container exists for assigning RBAC permissions appropriately\r\n * - usage reports can aggregate types of containers\r\n * - applications can identify their containers\r\n * - applications can store important (to them) properties \"on\" their containers\r\n */\r\n export interface Metadata {\r\n /** Human readable explanation of the information held in the container. This will be displayed in the administrator RBAC panel, and on usage reports. */\r\n description: string;\r\n /** a machine-readable string that describes the \"format\" of the data in this container (e.g. \"CloudSqlite\") */\r\n format: string;\r\n /** an identifier of the application that uses this this container */\r\n application: string;\r\n /** Additional properties stored on the container */\r\n [propertyName: string]: string;\r\n }\r\n\r\n /** Properties returned by `Service.requestToken` */\r\n export interface TokenProps {\r\n /**\r\n * expiring token that provides the requested access to the container. Should be used in all subsequent requests for blobs within the container,\r\n * and must be refreshed before it expires\r\n */\r\n token: ContainerToken;\r\n /** scope of the container. */\r\n scope: Scope;\r\n /** name of the blob storage provider. */\r\n provider: Provider;\r\n /** Time at which the token will expire. The token should be refreshed (that is, a new token should be requested) before this time. */\r\n expiration: Date;\r\n /** Metadata of the container. */\r\n metadata: Metadata;\r\n }\r\n\r\n /** The URI and Id of the container. */\r\n export interface UriAndId {\r\n baseUri: string;\r\n id: ContainerId;\r\n }\r\n\r\n /** Information required to access an existing container. */\r\n export interface AccessContainerProps {\r\n address: UriAndId;\r\n userToken: UserToken;\r\n }\r\n\r\n /** Information required to request an access token for a container. */\r\n export interface RequestTokenProps extends AccessContainerProps {\r\n /** If true, token should provide write access.\r\n * @note if write access is requested and the user is authorized for read but not write, an exception will be thrown (i.e. a read token is *not* returned).\r\n */\r\n forWriteAccess?: boolean;\r\n /** the number of seconds before the token should expire.\r\n * @note A maximum duration is determined by the service. If no value is supplied, or the value is larger than the maximum, the maximum duration is used.\r\n */\r\n durationSeconds?: number;\r\n }\r\n\r\n /** Information required to create a new container. */\r\n export interface CreateNewContainerProps {\r\n /** the scope of the new container */\r\n scope: Scope;\r\n /** metadata to be stored on the new container */\r\n metadata: Metadata;\r\n /** The user's access token. The user must be authorized with \"create container\" RBAC role for the iTwin. */\r\n userToken: UserToken;\r\n /**\r\n * the id for the container. Useful for tests.\r\n * @internal\r\n */\r\n id?: ContainerId;\r\n }\r\n\r\n /** Methods to create, delete, and access blob containers. */\r\n export interface ContainerService {\r\n /**\r\n * Create a new blob container. Throws on failure (e.g. access denied or container already exists.)\r\n */\r\n create(props: CreateNewContainerProps): Promise<UriAndId>;\r\n\r\n /**\r\n * Delete an existing blob container.\r\n * @note This method requires that the user be authorized with \"delete container\" RBAC role for the iTwin.\r\n */\r\n delete(props: AccessContainerProps): Promise<void>;\r\n\r\n /**\r\n * Request a `ContainerToken` for a container. Throws on failure.\r\n */\r\n requestToken(props: RequestTokenProps): Promise<TokenProps>;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckpointManager.d.ts","sourceRoot":"","sources":["../../src/CheckpointManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAE,OAAO,EAAyB,UAAU,EAAgE,MAAM,qBAAqB,CAAC;AAC/I,OAAO,EACa,WAAW,EAAE,oBAAoB,EAAmD,YAAY,EAAE,aAAa,EAClI,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAIlD;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAE7B,uBAAuB;IACvB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAE9B,mCAAmC;IACnC,QAAQ,CAAC,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W,CAAC;CAGvF;AAED;;GAEG;AACH,qBAAa,mBAAmB;WAChB,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,YAAY;WAI7C,WAAW,CAAC,UAAU,EAAE,eAAe,GAAG,aAAa;WAKjD,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAKlF,+BAA+B;WACX,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;mBAIjE,eAAe;mBASf,eAAe;CAKrC;AAED,iBAAiB;AACjB,qBAAa,iBAAiB;IAC5B,gBAAuB,YAAY,gBAAqB,WAAW,KAAK,IAAI,EAAI;IAChF,gBAAuB,YAAY,gBAAqB,WAAW,KAAK,IAAI,EAAI;WAClE,MAAM,CAAC,UAAU,EAAE,eAAe;mBAE3B,UAAU;WAmBX,wBAAwB,CAAC,OAAO,EAAE,eAAe;IAkDrE,uGAAuG;WACnF,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB/E,6FAA6F;WAC/E,uBAAuB,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAyBzF,4DAA4D;WAC9C,gBAAgB,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO;IAmB7F,uEAAuE;WACzD,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,UAAU,GAAG,SAAS;CAgBjF"}
@@ -111,7 +111,8 @@ class V2CheckpointManager {
111
111
  static getContainer(v2Props) {
112
112
  let container = this.containers.get(v2Props.containerId);
113
113
  if (!container) {
114
- container = CloudSqlite_1.CloudSqlite.createCloudContainer(this.toCloudContainerProps(v2Props));
114
+ // note checkpoint tokens can't be auto-refreshed because they rely on user credentials supplied through RPC. They're refreshed in SnapshotDb._refreshSas.
115
+ container = CloudSqlite_1.CloudSqlite.createCloudContainer({ ...this.toCloudContainerProps(v2Props), tokenRefreshSeconds: -1 });
115
116
  this.containers.set(v2Props.containerId, container);
116
117
  }
117
118
  return container;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckpointManager.js","sourceRoot":"","sources":["../../src/CheckpointManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,2BAA2B;AAE3B,6BAA6B;AAC7B,8DAAgE;AAChE,sDAA+I;AAC/I,oDAE4B;AAE5B,mEAAgE;AAChE,yDAAsD;AACtD,+CAA4C;AAC5C,6CAA0C;AAC1C,6CAA0C;AAC1C,yCAAkD;AAElD,MAAM,cAAc,GAAG,6CAAqB,CAAC,QAAQ,CAAC;AAyBtD;;GAEG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,yBAAyB;IACzB,2DAAY,CAAA;IACZ,sBAAsB;IACtB,qDAAS,CAAA;AACX,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAmCD,gBAAgB;AAChB,MAAa,SAAS;IAGZ,MAAM,CAAC,KAAK,CAAC,OAAO,CAAI,GAAgB,EAAE,EAAoC;QACpF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,gDAAgD;QACvF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI;YACF,OAAO,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;SACtB;gBAAS;YACR,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAC9B;IACH,CAAC;IAEM,MAAM,CAAC,YAAY,CAAC,QAAuB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAI,OAAwB,EAAE,UAA4C;QACpG,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,GAAG,GAAG,IAAI,CAAC,YAAY,CAA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O,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;QAED,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,KAAK,QAAQ,CAAC,WAAW,EAAE,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,KAAK,QAAQ,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC;QAChI,QAAQ,CAAC,WAAW,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO;YACV,uBAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAElC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,uEAAuE;IAChE,MAAM,CAAC,gBAAgB,CAAC,OAAwB;QACrD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC;YACtD,OAAO,qBAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAEpE,iHAAiH;QACjH,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,UAAU,EAAE;gBACtC,IAAI,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;oBAC5C,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;oBAC1B,OAAO,qBAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;iBACvD;aACF;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAzJsB,8BAAY,GAAG,IAAI,sBAAO,EAA8B,CAAC;AACzD,8BAAY,GAAG,IAAI,sBAAO,EAA8B,CAAC;AAFrE,8CAAiB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\n// cspell:ignore BLOCKCACHE\r\n\r\nimport * as path from \"path\";\r\nimport { NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\nimport { BeEvent, ChangeSetStatus, Guid, GuidString, IModelStatus, Logger, LogLevel, Mutable, OpenMode, StopWatch } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseIdValue, ChangesetId, ChangesetIdWithIndex, ChangesetIndexAndId, IModelError, IModelVersion, LocalDirName, LocalFileName,\r\n} from \"@itwin/core-common\";\r\nimport { V2CheckpointAccessProps } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { SnapshotDb, TokenArg } from \"./IModelDb\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelDb;\r\n\r\n/**\r\n * Properties of a checkpoint\r\n * @public\r\n */\r\nexport interface CheckpointProps extends TokenArg {\r\n readonly expectV2?: boolean;\r\n\r\n /** iTwin that the iModel belongs to */\r\n readonly iTwinId: GuidString;\r\n\r\n /** Id of the iModel */\r\n readonly iModelId: GuidString;\r\n\r\n /** changeset for the checkpoint */\r\n readonly changeset: ChangesetIdWithIndex;\r\n\r\n /** If true, then the latest successful v2 checkpoint at or before the provided changeset will be returned when calling queryV2Checkpoint. */\r\n readonly allowPreceding?: boolean;\r\n\r\n /** The number of seconds before the current token expires to attempt to reacquire a new token. Default is 1 hour. */\r\n readonly reattachSafetySeconds?: number;\r\n}\r\n\r\n/** Return value from [[ProgressFunction]].\r\n * @public\r\n */\r\nexport enum ProgressStatus {\r\n /** Continue download. */\r\n Continue = 0,\r\n /** Abort download. */\r\n Abort = 1,\r\n}\r\n\r\n/** Called to show progress during a download. If this function returns non-zero, the download is aborted.\r\n * @public\r\n */\r\nexport type ProgressFunction = (loaded: number, total: number) => ProgressStatus;\r\n\r\n/** The parameters that specify a request to download a checkpoint file from iModelHub.\r\n * @internal\r\n */\r\nexport interface DownloadRequest {\r\n /** name of local file to hold the downloaded data. */\r\n localFile: LocalFileName;\r\n\r\n /** A list of full fileName paths to test before downloading. If a valid file exists by one of these names,\r\n * no download is performed and `localFile` is updated to reflect the fact that the file exists with that name.\r\n * This can be used, for example, to look for checkpoints from previous versions if the naming strategy changes.\r\n */\r\n readonly aliasFiles?: ReadonlyArray<string>;\r\n\r\n /** Properties of the checkpoint to be downloaded */\r\n readonly checkpoint: CheckpointProps;\r\n\r\n /** If present, this function will be called to indicate progress as the briefcase is downloaded. If this\r\n * function returns a non-zero value, the download is aborted.\r\n */\r\n readonly onProgress?: ProgressFunction;\r\n}\r\n\r\n/** @internal */\r\nexport interface DownloadJob {\r\n request: DownloadRequest;\r\n promise?: Promise<any>;\r\n}\r\n\r\n/** @internal */\r\nexport class Downloads {\r\n private static _active = new Map<string, DownloadJob>();\r\n\r\n private static async process<T>(job: DownloadJob, fn: (job: DownloadJob) => Promise<T>) {\r\n const jobName = job.request.localFile; // save this, it can change inside call to `fn`!\r\n this._active.set(jobName, job);\r\n try {\r\n return await fn(job);\r\n } finally {\r\n this._active.delete(jobName);\r\n }\r\n }\r\n\r\n public static isInProgress(pathName: LocalFileName): DownloadJob | undefined {\r\n return this._active.get(pathName);\r\n }\r\n\r\n public static async download<T>(request: DownloadRequest, downloadFn: (job: DownloadJob) => Promise<T>) {\r\n const pathName = request.localFile;\r\n let job = this.isInProgress(pathName);\r\n if (undefined !== job)\r\n return job.promise;\r\n\r\n IModelJsFs.recursiveMkDirSync(path.dirname(pathName));\r\n job = { request };\r\n return job.promise = this.process(job, downloadFn);\r\n }\r\n}\r\n\r\n/**\r\n * Utility class for opening V2 checkpoints from cloud containers, and also for downloading them.\r\n * @internal\r\n*/\r\nexport class V2CheckpointManager {\r\n public static readonly cloudCacheName = \"v2Checkpoints\";\r\n private static _cloudCache?: CloudSqlite.CloudCache;\r\n private static containers = new Map<string, CloudSqlite.CloudContainer>();\r\n\r\n public static getFolder(): LocalDirName {\r\n const cloudCachePath = path.join(BriefcaseManager.cacheDir, V2CheckpointManager.cloudCacheName);\r\n if (!(IModelJsFs.existsSync(cloudCachePath))) {\r\n IModelJsFs.recursiveMkDirSync(cloudCachePath);\r\n }\r\n return cloudCachePath;\r\n }\r\n\r\n /* only used by tests that reset the state of the v2CheckpointManager. all dbs should be closed before calling this function. */\r\n public static cleanup(): void {\r\n for (const [_, value] of this.containers.entries()) {\r\n if (value.isConnected)\r\n value.disconnect({ detach: true });\r\n }\r\n\r\n CloudSqlite.CloudCaches.dropCache(this.cloudCacheName)?.destroy();\r\n this._cloudCache = undefined;\r\n this.containers.clear();\r\n }\r\n\r\n public static getFileName(checkpoint: CheckpointProps): LocalFileName {\r\n const changesetId = checkpoint.changeset.id || \"first\";\r\n return path.join(this.getFolder(), `${changesetId}.bim`);\r\n }\r\n\r\n private static get cloudCache(): CloudSqlite.CloudCache {\r\n if (!this._cloudCache) {\r\n let cacheDir = process.env.CHECKPOINT_CACHE_DIR;\r\n if (!cacheDir) {\r\n cacheDir = this.getFolder();\r\n Logger.logWarning(loggerCategory, `No CHECKPOINT_CACHE_DIR found in process.env, using ${cacheDir} instead.`);\r\n } else {\r\n // Make sure the checkpoint_cache_dir has an iTwinDaemon specific file in it, otherwise fall back to other directory.\r\n if (!(IModelJsFs.existsSync(path.join(cacheDir, \"portnumber.bcv\")))) {\r\n cacheDir = this.getFolder();\r\n Logger.logWarning(loggerCategory, `No evidence of the iTwinDaemon in provided CHECKPOINT_CACHE_DIR: ${process.env.CHECKPOINT_CACHE_DIR}, using ${cacheDir} instead.`);\r\n }\r\n }\r\n\r\n this._cloudCache = CloudSqlite.CloudCaches.getCache({ cacheName: this.cloudCacheName, cacheDir });\r\n\r\n // Its fine if its not a daemon, but lets log an info message\r\n if (!this._cloudCache.isDaemon)\r\n Logger.logInfo(loggerCategory, \"V2Checkpoint manager running with no iTwinDaemon.\");\r\n }\r\n return this._cloudCache;\r\n }\r\n\r\n /** Member names differ slightly between the V2Checkpoint api and the CloudSqlite api. Add aliases `accessName` for `accountName` and `accessToken` for `sasToken` */\r\n private static toCloudContainerProps(from: V2CheckpointAccessProps): CloudSqlite.ContainerAccessProps {\r\n return { ...from, baseUri: `https://${from.accountName}.blob.core.windows.net`, accessToken: from.sasToken, storageType: \"azure\" };\r\n }\r\n\r\n private static getContainer(v2Props: V2CheckpointAccessProps) {\r\n let container = this.containers.get(v2Props.containerId);\r\n if (!container) {\r\n container = CloudSqlite.createCloudContainer(this.toCloudContainerProps(v2Props));\r\n this.containers.set(v2Props.containerId, container);\r\n }\r\n return container;\r\n }\r\n\r\n public static async attach(checkpoint: CheckpointProps): Promise<{ dbName: string, container: CloudSqlite.CloudContainer }> {\r\n let v2props: V2CheckpointAccessProps | undefined;\r\n try {\r\n v2props = await IModelHost.hubAccess.queryV2Checkpoint(checkpoint);\r\n if (!v2props)\r\n throw new Error(\"no checkpoint\");\r\n } catch (err: any) {\r\n throw new IModelError(IModelStatus.NotFound, `V2 checkpoint not found: err: ${err.message}`);\r\n }\r\n\r\n try {\r\n const container = this.getContainer(v2props);\r\n const dbName = v2props.dbName;\r\n if (!container.isConnected)\r\n container.connect(this.cloudCache);\r\n container.checkForChanges();\r\n if (IModelHost.appWorkspace.settings.getBoolean(\"Checkpoints/prefetch\", false)) {\r\n const logPrefetch = async (prefetch: CloudSqlite.CloudPrefetch) => {\r\n const stopwatch = new StopWatch(`[${container.containerId}/${dbName}]`, true);\r\n Logger.logInfo(loggerCategory, `Starting prefetch of ${stopwatch.description}`);\r\n const done = await prefetch.promise;\r\n Logger.logInfo(loggerCategory, `Prefetch of ${stopwatch.description} complete=${done} (${stopwatch.elapsedSeconds} seconds)`);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n logPrefetch(CloudSqlite.startCloudPrefetch(container, dbName));\r\n }\r\n return { dbName, container };\r\n } catch (e: any) {\r\n const error = `Cloud cache connect failed: ${e.message}`;\r\n if (checkpoint.expectV2)\r\n Logger.logError(loggerCategory, error);\r\n\r\n throw new IModelError(e.errorNumber, error);\r\n }\r\n }\r\n\r\n private static async performDownload(job: DownloadJob): Promise<ChangesetId> {\r\n const request = job.request;\r\n const v2props: V2CheckpointAccessProps | undefined = await IModelHost.hubAccess.queryV2Checkpoint({ ...request.checkpoint, allowPreceding: true });\r\n if (!v2props)\r\n throw new IModelError(IModelStatus.NotFound, \"V2 checkpoint not found\");\r\n\r\n CheckpointManager.onDownloadV2.raiseEvent(job);\r\n const container = CloudSqlite.createCloudContainer(this.toCloudContainerProps(v2props));\r\n await CloudSqlite.transferDb(\"download\", container, { dbName: v2props.dbName, localFileName: request.localFile, onProgress: request.onProgress });\r\n return request.checkpoint.changeset.id;\r\n }\r\n\r\n /** Fully download a V2 checkpoint to a local file that can be used to create a briefcase or to work offline.\r\n * @returns a Promise that is resolved when the download completes with the changesetId of the downloaded checkpoint (which will\r\n * be the same as the requested changesetId or the most recent checkpoint before it.)\r\n */\r\n public static async downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId> {\r\n return Downloads.download(request, async (job: DownloadJob) => this.performDownload(job));\r\n }\r\n}\r\n\r\n/** Utility class to deal with downloading V1 checkpoints from iModelHub.\r\n * @internal\r\n */\r\nexport class V1CheckpointManager {\r\n public static getFolder(iModelId: GuidString): LocalDirName {\r\n return path.join(BriefcaseManager.getIModelPath(iModelId), \"checkpoints\");\r\n }\r\n\r\n public static getFileName(checkpoint: CheckpointProps): LocalFileName {\r\n const changesetId = checkpoint.changeset.id || \"first\";\r\n return path.join(this.getFolder(checkpoint.iModelId), `${changesetId}.bim`);\r\n }\r\n\r\n public static async getCheckpointDb(request: DownloadRequest): Promise<SnapshotDb> {\r\n const db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(request.checkpoint));\r\n return (undefined !== db) ? db : Downloads.download(request, async (job: DownloadJob) => this.downloadAndOpen(job));\r\n }\r\n\r\n /** Download a V1 checkpoint */\r\n public static async downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId> {\r\n return Downloads.download(request, async (job: DownloadJob) => this.performDownload(job));\r\n }\r\n\r\n private static async downloadAndOpen(job: DownloadJob) {\r\n const db = CheckpointManager.tryOpenLocalFile(job.request);\r\n if (db)\r\n return db;\r\n await this.performDownload(job);\r\n await CheckpointManager.updateToRequestedVersion(job.request);\r\n return SnapshotDb.openCheckpointV1(job.request.localFile, job.request.checkpoint);\r\n }\r\n\r\n private static async performDownload(job: DownloadJob): Promise<ChangesetId> {\r\n CheckpointManager.onDownloadV1.raiseEvent(job);\r\n // eslint-disable-next-line deprecation/deprecation\r\n return (await IModelHost.hubAccess.downloadV1Checkpoint(job.request)).id;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class CheckpointManager {\r\n public static readonly onDownloadV1 = new BeEvent<(job: DownloadJob) => void>();\r\n public static readonly onDownloadV2 = new BeEvent<(job: DownloadJob) => void>();\r\n public static getKey(checkpoint: CheckpointProps) { return `${checkpoint.iModelId}:${checkpoint.changeset.id}`; }\r\n\r\n private static async doDownload(request: DownloadRequest): Promise<ChangesetId> {\r\n try {\r\n // first see if there's a V2 checkpoint available.\r\n const changesetId = await V2CheckpointManager.downloadCheckpoint(request);\r\n if (changesetId !== request.checkpoint.changeset.id)\r\n Logger.logInfo(loggerCategory, `Downloaded previous v2 checkpoint because requested checkpoint not found.`, { requestedChangesetId: request.checkpoint.changeset.id, iModelId: request.checkpoint.iModelId, changesetId, iTwinId: request.checkpoint.iTwinId });\r\n else\r\n Logger.logInfo(loggerCategory, `Downloaded v2 checkpoint.`, { iModelId: request.checkpoint.iModelId, changesetId: request.checkpoint.changeset.id, iTwinId: request.checkpoint.iTwinId });\r\n return changesetId;\r\n } catch (error: any) {\r\n if (error.errorNumber === IModelStatus.NotFound) { // No V2 checkpoint available, try a v1 checkpoint\r\n const changeset = await V1CheckpointManager.downloadCheckpoint(request);\r\n Logger.logWarning(loggerCategory, `Got an error downloading v2 checkpoint, but downloaded v1 checkpoint successfully!`, { error, iModelId: request.checkpoint.iModelId, iTwinId: request.checkpoint.iTwinId, requestedChangesetId: request.checkpoint.changeset.id, changesetId: changeset });\r\n return changeset;\r\n }\r\n throw error; // most likely, was aborted\r\n }\r\n }\r\n\r\n public static async updateToRequestedVersion(request: DownloadRequest) {\r\n const checkpoint = request.checkpoint;\r\n const targetFile = request.localFile;\r\n const traceInfo = { iTwinId: checkpoint.iTwinId, iModelId: checkpoint.iModelId, changeset: checkpoint.changeset };\r\n try {\r\n // Open checkpoint for write\r\n Logger.setLevel(NativeLoggerCategory.SQLite, LogLevel.None); // Ignores noisy error messages when applying changesets.\r\n const db = SnapshotDb.openForApplyChangesets(targetFile);\r\n const nativeDb = db.nativeDb;\r\n try {\r\n\r\n if (nativeDb.hasPendingTxns()) {\r\n Logger.logWarning(loggerCategory, \"Checkpoint with Txns found - deleting them\", () => traceInfo);\r\n nativeDb.deleteAllTxns();\r\n }\r\n\r\n if (nativeDb.getBriefcaseId() !== BriefcaseIdValue.Unassigned)\r\n nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned);\r\n\r\n CheckpointManager.validateCheckpointGuids(checkpoint, db);\r\n // Apply change sets if necessary\r\n const currentChangeset: Mutable<ChangesetIndexAndId> = nativeDb.getCurrentChangeset();\r\n if (currentChangeset.id !== checkpoint.changeset.id) {\r\n const accessToken = checkpoint.accessToken;\r\n const toIndex = checkpoint.changeset.index ??\r\n (await IModelHost.hubAccess.getChangesetFromVersion({ accessToken, iModelId: checkpoint.iModelId, version: IModelVersion.asOfChangeSet(checkpoint.changeset.id) })).index;\r\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\r\n } else {\r\n // make sure the parent changeset index is saved in the file - old versions didn't have it.\r\n currentChangeset.index = checkpoint.changeset.index!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n nativeDb.saveLocalValue(\"parentChangeSet\", JSON.stringify(currentChangeset));\r\n }\r\n } finally {\r\n Logger.setLevel(NativeLoggerCategory.SQLite, LogLevel.Error); // Turn logging back on after applying changesets.\r\n db.saveChanges();\r\n db.close();\r\n }\r\n } catch (error: any) {\r\n\r\n Logger.logError(loggerCategory, \"Error downloading checkpoint - deleting it\", () => traceInfo);\r\n IModelJsFs.removeSync(targetFile);\r\n\r\n if (error.errorNumber === ChangeSetStatus.CorruptedChangeStream || error.errorNumber === ChangeSetStatus.InvalidId || error.errorNumber === ChangeSetStatus.InvalidVersion) {\r\n Logger.logError(loggerCategory, \"Detected potential corruption of change sets. Deleting them to enable retries\", () => traceInfo);\r\n BriefcaseManager.deleteChangeSetsFromLocalDisk(checkpoint.iModelId);\r\n }\r\n throw error;\r\n }\r\n }\r\n\r\n /** Download a checkpoint file from iModelHub into a local file specified in the request parameters. */\r\n public static async downloadCheckpoint(request: DownloadRequest): Promise<void> {\r\n if (this.verifyCheckpoint(request.checkpoint, request.localFile))\r\n return;\r\n\r\n if (request.aliasFiles) {\r\n for (const alias of request.aliasFiles) {\r\n if (this.verifyCheckpoint(request.checkpoint, alias)) {\r\n request.localFile = alias;\r\n return;\r\n }\r\n }\r\n }\r\n\r\n await this.doDownload(request);\r\n return this.updateToRequestedVersion(request);\r\n }\r\n\r\n /** checks a file's dbGuid & iTwinId for consistency, and updates the dbGuid when possible */\r\n public static validateCheckpointGuids(checkpoint: CheckpointProps, snapshotDb: SnapshotDb) {\r\n const traceInfo = { iTwinId: checkpoint.iTwinId, iModelId: checkpoint.iModelId };\r\n\r\n const nativeDb = snapshotDb.nativeDb;\r\n const dbChangeset = nativeDb.getCurrentChangeset();\r\n const iModelId = Guid.normalize(nativeDb.getIModelId());\r\n if (iModelId !== Guid.normalize(checkpoint.iModelId)) {\r\n if (nativeDb.isReadonly())\r\n throw new IModelError(IModelStatus.ValidationFailed, \"iModelId is not properly set up in the checkpoint\");\r\n\r\n Logger.logWarning(loggerCategory, \"iModelId is not properly set up in the checkpoint. Updated checkpoint to the correct iModelId.\", () => ({ ...traceInfo, dbGuid: iModelId }));\r\n const iModelIdNormalized = Guid.normalize(checkpoint.iModelId);\r\n nativeDb.setIModelId(iModelIdNormalized);\r\n (snapshotDb as any)._iModelId = iModelIdNormalized;\r\n // Required to reset the ChangeSetId because setDbGuid clears the value.\r\n nativeDb.saveLocalValue(\"ParentChangeSetId\", dbChangeset.id);\r\n if (undefined !== dbChangeset.index)\r\n nativeDb.saveLocalValue(\"parentChangeSet\", JSON.stringify(dbChangeset));\r\n }\r\n\r\n const iTwinId = Guid.normalize(nativeDb.getITwinId());\r\n if (iTwinId !== Guid.normalize(checkpoint.iTwinId))\r\n throw new IModelError(IModelStatus.ValidationFailed, \"iTwinId was not properly set up in the checkpoint\");\r\n }\r\n\r\n /** @returns true if the file is the checkpoint requested */\r\n public static verifyCheckpoint(checkpoint: CheckpointProps, fileName: LocalFileName): boolean {\r\n if (!IModelJsFs.existsSync(fileName))\r\n return false;\r\n\r\n const nativeDb = new IModelHost.platform.DgnDb();\r\n try {\r\n nativeDb.openIModel(fileName, OpenMode.Readonly);\r\n } catch (error) {\r\n return false;\r\n }\r\n\r\n const isValid = checkpoint.iModelId === nativeDb.getIModelId() && checkpoint.changeset.id === nativeDb.getCurrentChangeset().id;\r\n nativeDb.closeIModel();\r\n if (!isValid)\r\n IModelJsFs.removeSync(fileName);\r\n\r\n return isValid;\r\n }\r\n\r\n /** try to open an existing local file to satisfy a download request */\r\n public static tryOpenLocalFile(request: DownloadRequest): SnapshotDb | undefined {\r\n const checkpoint = request.checkpoint;\r\n if (this.verifyCheckpoint(checkpoint, request.localFile))\r\n return SnapshotDb.openCheckpointV1(request.localFile, checkpoint);\r\n\r\n // check a list of aliases for finding checkpoints downloaded to non-default locations (e.g. from older versions)\r\n if (request.aliasFiles) {\r\n for (const alias of request.aliasFiles) {\r\n if (this.verifyCheckpoint(checkpoint, alias)) {\r\n request.localFile = alias;\r\n return SnapshotDb.openCheckpointV1(alias, checkpoint);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n}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SAClD;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;QAED,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,KAAK,QAAQ,CAAC,WAAW,EAAE,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,KAAK,QAAQ,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC;QAChI,QAAQ,CAAC,WAAW,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO;YACV,uBAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAElC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,uEAAuE;IAChE,MAAM,CAAC,gBAAgB,CAAC,OAAwB;QACrD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC;YACtD,OAAO,qBAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAEpE,iHAAiH;QACjH,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,UAAU,EAAE;gBACtC,IAAI,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;oBAC5C,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;oBAC1B,OAAO,qBAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;iBACvD;aACF;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAzJsB,8BAAY,GAAG,IAAI,sBAAO,EAA8B,CAAC;AACzD,8BAAY,GAAG,IAAI,sBAAO,EAA8B,CAAC;AAFrE,8CAAiB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\n// cspell:ignore BLOCKCACHE\r\n\r\nimport * as path from \"path\";\r\nimport { NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\nimport { BeEvent, ChangeSetStatus, Guid, GuidString, IModelStatus, Logger, LogLevel, Mutable, OpenMode, StopWatch } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseIdValue, ChangesetId, ChangesetIdWithIndex, ChangesetIndexAndId, IModelError, IModelVersion, LocalDirName, LocalFileName,\r\n} from \"@itwin/core-common\";\r\nimport { V2CheckpointAccessProps } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { SnapshotDb, TokenArg } from \"./IModelDb\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelDb;\r\n\r\n/**\r\n * Properties of a checkpoint\r\n * @public\r\n */\r\nexport interface CheckpointProps extends TokenArg {\r\n readonly expectV2?: boolean;\r\n\r\n /** iTwin that the iModel belongs to */\r\n readonly iTwinId: GuidString;\r\n\r\n /** Id of the iModel */\r\n readonly iModelId: GuidString;\r\n\r\n /** changeset for the checkpoint */\r\n readonly changeset: ChangesetIdWithIndex;\r\n\r\n /** If true, then the latest successful v2 checkpoint at or before the provided changeset will be returned when calling queryV2Checkpoint. */\r\n readonly allowPreceding?: boolean;\r\n\r\n /** The number of seconds before the current token expires to attempt to reacquire a new token. Default is 1 hour. */\r\n readonly reattachSafetySeconds?: number;\r\n}\r\n\r\n/** Return value from [[ProgressFunction]].\r\n * @public\r\n */\r\nexport enum ProgressStatus {\r\n /** Continue download. */\r\n Continue = 0,\r\n /** Abort download. */\r\n Abort = 1,\r\n}\r\n\r\n/** Called to show progress during a download. If this function returns non-zero, the download is aborted.\r\n * @public\r\n */\r\nexport type ProgressFunction = (loaded: number, total: number) => ProgressStatus;\r\n\r\n/** The parameters that specify a request to download a checkpoint file from iModelHub.\r\n * @internal\r\n */\r\nexport interface DownloadRequest {\r\n /** name of local file to hold the downloaded data. */\r\n localFile: LocalFileName;\r\n\r\n /** A list of full fileName paths to test before downloading. If a valid file exists by one of these names,\r\n * no download is performed and `localFile` is updated to reflect the fact that the file exists with that name.\r\n * This can be used, for example, to look for checkpoints from previous versions if the naming strategy changes.\r\n */\r\n readonly aliasFiles?: ReadonlyArray<string>;\r\n\r\n /** Properties of the checkpoint to be downloaded */\r\n readonly checkpoint: CheckpointProps;\r\n\r\n /** If present, this function will be called to indicate progress as the briefcase is downloaded. If this\r\n * function returns a non-zero value, the download is aborted.\r\n */\r\n readonly onProgress?: ProgressFunction;\r\n}\r\n\r\n/** @internal */\r\nexport interface DownloadJob {\r\n request: DownloadRequest;\r\n promise?: Promise<any>;\r\n}\r\n\r\n/** @internal */\r\nexport class Downloads {\r\n private static _active = new Map<string, DownloadJob>();\r\n\r\n private static async process<T>(job: DownloadJob, fn: (job: DownloadJob) => Promise<T>) {\r\n const jobName = job.request.localFile; // save this, it can change inside call to `fn`!\r\n this._active.set(jobName, job);\r\n try {\r\n return await fn(job);\r\n } finally {\r\n this._active.delete(jobName);\r\n }\r\n }\r\n\r\n public static isInProgress(pathName: LocalFileName): DownloadJob | undefined {\r\n return this._active.get(pathName);\r\n }\r\n\r\n public static async download<T>(request: DownloadRequest, downloadFn: (job: DownloadJob) => Promise<T>) {\r\n const pathName = request.localFile;\r\n let job = this.isInProgress(pathName);\r\n if (undefined !== job)\r\n return job.promise;\r\n\r\n IModelJsFs.recursiveMkDirSync(path.dirname(pathName));\r\n job = { request };\r\n return job.promise = this.process(job, downloadFn);\r\n }\r\n}\r\n\r\n/**\r\n * Utility class for opening V2 checkpoints from cloud containers, and also for downloading them.\r\n * @internal\r\n*/\r\nexport class V2CheckpointManager {\r\n public static readonly cloudCacheName = \"v2Checkpoints\";\r\n private static _cloudCache?: CloudSqlite.CloudCache;\r\n private static containers = new Map<string, CloudSqlite.CloudContainer>();\r\n\r\n public static getFolder(): LocalDirName {\r\n const cloudCachePath = path.join(BriefcaseManager.cacheDir, V2CheckpointManager.cloudCacheName);\r\n if (!(IModelJsFs.existsSync(cloudCachePath))) {\r\n IModelJsFs.recursiveMkDirSync(cloudCachePath);\r\n }\r\n return cloudCachePath;\r\n }\r\n\r\n /* only used by tests that reset the state of the v2CheckpointManager. all dbs should be closed before calling this function. */\r\n public static cleanup(): void {\r\n for (const [_, value] of this.containers.entries()) {\r\n if (value.isConnected)\r\n value.disconnect({ detach: true });\r\n }\r\n\r\n CloudSqlite.CloudCaches.dropCache(this.cloudCacheName)?.destroy();\r\n this._cloudCache = undefined;\r\n this.containers.clear();\r\n }\r\n\r\n public static getFileName(checkpoint: CheckpointProps): LocalFileName {\r\n const changesetId = checkpoint.changeset.id || \"first\";\r\n return path.join(this.getFolder(), `${changesetId}.bim`);\r\n }\r\n\r\n private static get cloudCache(): CloudSqlite.CloudCache {\r\n if (!this._cloudCache) {\r\n let cacheDir = process.env.CHECKPOINT_CACHE_DIR;\r\n if (!cacheDir) {\r\n cacheDir = this.getFolder();\r\n Logger.logWarning(loggerCategory, `No CHECKPOINT_CACHE_DIR found in process.env, using ${cacheDir} instead.`);\r\n } else {\r\n // Make sure the checkpoint_cache_dir has an iTwinDaemon specific file in it, otherwise fall back to other directory.\r\n if (!(IModelJsFs.existsSync(path.join(cacheDir, \"portnumber.bcv\")))) {\r\n cacheDir = this.getFolder();\r\n Logger.logWarning(loggerCategory, `No evidence of the iTwinDaemon in provided CHECKPOINT_CACHE_DIR: ${process.env.CHECKPOINT_CACHE_DIR}, using ${cacheDir} instead.`);\r\n }\r\n }\r\n\r\n this._cloudCache = CloudSqlite.CloudCaches.getCache({ cacheName: this.cloudCacheName, cacheDir });\r\n\r\n // Its fine if its not a daemon, but lets log an info message\r\n if (!this._cloudCache.isDaemon)\r\n Logger.logInfo(loggerCategory, \"V2Checkpoint manager running with no iTwinDaemon.\");\r\n }\r\n return this._cloudCache;\r\n }\r\n\r\n /** Member names differ slightly between the V2Checkpoint api and the CloudSqlite api. Add aliases `accessName` for `accountName` and `accessToken` for `sasToken` */\r\n private static toCloudContainerProps(from: V2CheckpointAccessProps): CloudSqlite.ContainerAccessProps {\r\n return { ...from, baseUri: `https://${from.accountName}.blob.core.windows.net`, accessToken: from.sasToken, storageType: \"azure\" };\r\n }\r\n\r\n private static getContainer(v2Props: V2CheckpointAccessProps) {\r\n let container = this.containers.get(v2Props.containerId);\r\n if (!container) {\r\n // note checkpoint tokens can't be auto-refreshed because they rely on user credentials supplied through RPC. They're refreshed in SnapshotDb._refreshSas.\r\n container = CloudSqlite.createCloudContainer({ ...this.toCloudContainerProps(v2Props), tokenRefreshSeconds: -1 });\r\n this.containers.set(v2Props.containerId, container);\r\n }\r\n return container;\r\n }\r\n\r\n public static async attach(checkpoint: CheckpointProps): Promise<{ dbName: string, container: CloudSqlite.CloudContainer }> {\r\n let v2props: V2CheckpointAccessProps | undefined;\r\n try {\r\n v2props = await IModelHost.hubAccess.queryV2Checkpoint(checkpoint);\r\n if (!v2props)\r\n throw new Error(\"no checkpoint\");\r\n } catch (err: any) {\r\n throw new IModelError(IModelStatus.NotFound, `V2 checkpoint not found: err: ${err.message}`);\r\n }\r\n\r\n try {\r\n const container = this.getContainer(v2props);\r\n const dbName = v2props.dbName;\r\n if (!container.isConnected)\r\n container.connect(this.cloudCache);\r\n container.checkForChanges();\r\n if (IModelHost.appWorkspace.settings.getBoolean(\"Checkpoints/prefetch\", false)) {\r\n const logPrefetch = async (prefetch: CloudSqlite.CloudPrefetch) => {\r\n const stopwatch = new StopWatch(`[${container.containerId}/${dbName}]`, true);\r\n Logger.logInfo(loggerCategory, `Starting prefetch of ${stopwatch.description}`);\r\n const done = await prefetch.promise;\r\n Logger.logInfo(loggerCategory, `Prefetch of ${stopwatch.description} complete=${done} (${stopwatch.elapsedSeconds} seconds)`);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n logPrefetch(CloudSqlite.startCloudPrefetch(container, dbName));\r\n }\r\n return { dbName, container };\r\n } catch (e: any) {\r\n const error = `Cloud cache connect failed: ${e.message}`;\r\n if (checkpoint.expectV2)\r\n Logger.logError(loggerCategory, error);\r\n\r\n throw new IModelError(e.errorNumber, error);\r\n }\r\n }\r\n\r\n private static async performDownload(job: DownloadJob): Promise<ChangesetId> {\r\n const request = job.request;\r\n const v2props: V2CheckpointAccessProps | undefined = await IModelHost.hubAccess.queryV2Checkpoint({ ...request.checkpoint, allowPreceding: true });\r\n if (!v2props)\r\n throw new IModelError(IModelStatus.NotFound, \"V2 checkpoint not found\");\r\n\r\n CheckpointManager.onDownloadV2.raiseEvent(job);\r\n const container = CloudSqlite.createCloudContainer(this.toCloudContainerProps(v2props));\r\n await CloudSqlite.transferDb(\"download\", container, { dbName: v2props.dbName, localFileName: request.localFile, onProgress: request.onProgress });\r\n return request.checkpoint.changeset.id;\r\n }\r\n\r\n /** Fully download a V2 checkpoint to a local file that can be used to create a briefcase or to work offline.\r\n * @returns a Promise that is resolved when the download completes with the changesetId of the downloaded checkpoint (which will\r\n * be the same as the requested changesetId or the most recent checkpoint before it.)\r\n */\r\n public static async downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId> {\r\n return Downloads.download(request, async (job: DownloadJob) => this.performDownload(job));\r\n }\r\n}\r\n\r\n/** Utility class to deal with downloading V1 checkpoints from iModelHub.\r\n * @internal\r\n */\r\nexport class V1CheckpointManager {\r\n public static getFolder(iModelId: GuidString): LocalDirName {\r\n return path.join(BriefcaseManager.getIModelPath(iModelId), \"checkpoints\");\r\n }\r\n\r\n public static getFileName(checkpoint: CheckpointProps): LocalFileName {\r\n const changesetId = checkpoint.changeset.id || \"first\";\r\n return path.join(this.getFolder(checkpoint.iModelId), `${changesetId}.bim`);\r\n }\r\n\r\n public static async getCheckpointDb(request: DownloadRequest): Promise<SnapshotDb> {\r\n const db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(request.checkpoint));\r\n return (undefined !== db) ? db : Downloads.download(request, async (job: DownloadJob) => this.downloadAndOpen(job));\r\n }\r\n\r\n /** Download a V1 checkpoint */\r\n public static async downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId> {\r\n return Downloads.download(request, async (job: DownloadJob) => this.performDownload(job));\r\n }\r\n\r\n private static async downloadAndOpen(job: DownloadJob) {\r\n const db = CheckpointManager.tryOpenLocalFile(job.request);\r\n if (db)\r\n return db;\r\n await this.performDownload(job);\r\n await CheckpointManager.updateToRequestedVersion(job.request);\r\n return SnapshotDb.openCheckpointV1(job.request.localFile, job.request.checkpoint);\r\n }\r\n\r\n private static async performDownload(job: DownloadJob): Promise<ChangesetId> {\r\n CheckpointManager.onDownloadV1.raiseEvent(job);\r\n // eslint-disable-next-line deprecation/deprecation\r\n return (await IModelHost.hubAccess.downloadV1Checkpoint(job.request)).id;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class CheckpointManager {\r\n public static readonly onDownloadV1 = new BeEvent<(job: DownloadJob) => void>();\r\n public static readonly onDownloadV2 = new BeEvent<(job: DownloadJob) => void>();\r\n public static getKey(checkpoint: CheckpointProps) { return `${checkpoint.iModelId}:${checkpoint.changeset.id}`; }\r\n\r\n private static async doDownload(request: DownloadRequest): Promise<ChangesetId> {\r\n try {\r\n // first see if there's a V2 checkpoint available.\r\n const changesetId = await V2CheckpointManager.downloadCheckpoint(request);\r\n if (changesetId !== request.checkpoint.changeset.id)\r\n Logger.logInfo(loggerCategory, `Downloaded previous v2 checkpoint because requested checkpoint not found.`, { requestedChangesetId: request.checkpoint.changeset.id, iModelId: request.checkpoint.iModelId, changesetId, iTwinId: request.checkpoint.iTwinId });\r\n else\r\n Logger.logInfo(loggerCategory, `Downloaded v2 checkpoint.`, { iModelId: request.checkpoint.iModelId, changesetId: request.checkpoint.changeset.id, iTwinId: request.checkpoint.iTwinId });\r\n return changesetId;\r\n } catch (error: any) {\r\n if (error.errorNumber === IModelStatus.NotFound) { // No V2 checkpoint available, try a v1 checkpoint\r\n const changeset = await V1CheckpointManager.downloadCheckpoint(request);\r\n Logger.logWarning(loggerCategory, `Got an error downloading v2 checkpoint, but downloaded v1 checkpoint successfully!`, { error, iModelId: request.checkpoint.iModelId, iTwinId: request.checkpoint.iTwinId, requestedChangesetId: request.checkpoint.changeset.id, changesetId: changeset });\r\n return changeset;\r\n }\r\n throw error; // most likely, was aborted\r\n }\r\n }\r\n\r\n public static async updateToRequestedVersion(request: DownloadRequest) {\r\n const checkpoint = request.checkpoint;\r\n const targetFile = request.localFile;\r\n const traceInfo = { iTwinId: checkpoint.iTwinId, iModelId: checkpoint.iModelId, changeset: checkpoint.changeset };\r\n try {\r\n // Open checkpoint for write\r\n Logger.setLevel(NativeLoggerCategory.SQLite, LogLevel.None); // Ignores noisy error messages when applying changesets.\r\n const db = SnapshotDb.openForApplyChangesets(targetFile);\r\n const nativeDb = db.nativeDb;\r\n try {\r\n\r\n if (nativeDb.hasPendingTxns()) {\r\n Logger.logWarning(loggerCategory, \"Checkpoint with Txns found - deleting them\", () => traceInfo);\r\n nativeDb.deleteAllTxns();\r\n }\r\n\r\n if (nativeDb.getBriefcaseId() !== BriefcaseIdValue.Unassigned)\r\n nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned);\r\n\r\n CheckpointManager.validateCheckpointGuids(checkpoint, db);\r\n // Apply change sets if necessary\r\n const currentChangeset: Mutable<ChangesetIndexAndId> = nativeDb.getCurrentChangeset();\r\n if (currentChangeset.id !== checkpoint.changeset.id) {\r\n const accessToken = checkpoint.accessToken;\r\n const toIndex = checkpoint.changeset.index ??\r\n (await IModelHost.hubAccess.getChangesetFromVersion({ accessToken, iModelId: checkpoint.iModelId, version: IModelVersion.asOfChangeSet(checkpoint.changeset.id) })).index;\r\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\r\n } else {\r\n // make sure the parent changeset index is saved in the file - old versions didn't have it.\r\n currentChangeset.index = checkpoint.changeset.index!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n nativeDb.saveLocalValue(\"parentChangeSet\", JSON.stringify(currentChangeset));\r\n }\r\n } finally {\r\n Logger.setLevel(NativeLoggerCategory.SQLite, LogLevel.Error); // Turn logging back on after applying changesets.\r\n db.saveChanges();\r\n db.close();\r\n }\r\n } catch (error: any) {\r\n\r\n Logger.logError(loggerCategory, \"Error downloading checkpoint - deleting it\", () => traceInfo);\r\n IModelJsFs.removeSync(targetFile);\r\n\r\n if (error.errorNumber === ChangeSetStatus.CorruptedChangeStream || error.errorNumber === ChangeSetStatus.InvalidId || error.errorNumber === ChangeSetStatus.InvalidVersion) {\r\n Logger.logError(loggerCategory, \"Detected potential corruption of change sets. Deleting them to enable retries\", () => traceInfo);\r\n BriefcaseManager.deleteChangeSetsFromLocalDisk(checkpoint.iModelId);\r\n }\r\n throw error;\r\n }\r\n }\r\n\r\n /** Download a checkpoint file from iModelHub into a local file specified in the request parameters. */\r\n public static async downloadCheckpoint(request: DownloadRequest): Promise<void> {\r\n if (this.verifyCheckpoint(request.checkpoint, request.localFile))\r\n return;\r\n\r\n if (request.aliasFiles) {\r\n for (const alias of request.aliasFiles) {\r\n if (this.verifyCheckpoint(request.checkpoint, alias)) {\r\n request.localFile = alias;\r\n return;\r\n }\r\n }\r\n }\r\n\r\n await this.doDownload(request);\r\n return this.updateToRequestedVersion(request);\r\n }\r\n\r\n /** checks a file's dbGuid & iTwinId for consistency, and updates the dbGuid when possible */\r\n public static validateCheckpointGuids(checkpoint: CheckpointProps, snapshotDb: SnapshotDb) {\r\n const traceInfo = { iTwinId: checkpoint.iTwinId, iModelId: checkpoint.iModelId };\r\n\r\n const nativeDb = snapshotDb.nativeDb;\r\n const dbChangeset = nativeDb.getCurrentChangeset();\r\n const iModelId = Guid.normalize(nativeDb.getIModelId());\r\n if (iModelId !== Guid.normalize(checkpoint.iModelId)) {\r\n if (nativeDb.isReadonly())\r\n throw new IModelError(IModelStatus.ValidationFailed, \"iModelId is not properly set up in the checkpoint\");\r\n\r\n Logger.logWarning(loggerCategory, \"iModelId is not properly set up in the checkpoint. Updated checkpoint to the correct iModelId.\", () => ({ ...traceInfo, dbGuid: iModelId }));\r\n const iModelIdNormalized = Guid.normalize(checkpoint.iModelId);\r\n nativeDb.setIModelId(iModelIdNormalized);\r\n (snapshotDb as any)._iModelId = iModelIdNormalized;\r\n // Required to reset the ChangeSetId because setDbGuid clears the value.\r\n nativeDb.saveLocalValue(\"ParentChangeSetId\", dbChangeset.id);\r\n if (undefined !== dbChangeset.index)\r\n nativeDb.saveLocalValue(\"parentChangeSet\", JSON.stringify(dbChangeset));\r\n }\r\n\r\n const iTwinId = Guid.normalize(nativeDb.getITwinId());\r\n if (iTwinId !== Guid.normalize(checkpoint.iTwinId))\r\n throw new IModelError(IModelStatus.ValidationFailed, \"iTwinId was not properly set up in the checkpoint\");\r\n }\r\n\r\n /** @returns true if the file is the checkpoint requested */\r\n public static verifyCheckpoint(checkpoint: CheckpointProps, fileName: LocalFileName): boolean {\r\n if (!IModelJsFs.existsSync(fileName))\r\n return false;\r\n\r\n const nativeDb = new IModelHost.platform.DgnDb();\r\n try {\r\n nativeDb.openIModel(fileName, OpenMode.Readonly);\r\n } catch (error) {\r\n return false;\r\n }\r\n\r\n const isValid = checkpoint.iModelId === nativeDb.getIModelId() && checkpoint.changeset.id === nativeDb.getCurrentChangeset().id;\r\n nativeDb.closeIModel();\r\n if (!isValid)\r\n IModelJsFs.removeSync(fileName);\r\n\r\n return isValid;\r\n }\r\n\r\n /** try to open an existing local file to satisfy a download request */\r\n public static tryOpenLocalFile(request: DownloadRequest): SnapshotDb | undefined {\r\n const checkpoint = request.checkpoint;\r\n if (this.verifyCheckpoint(checkpoint, request.localFile))\r\n return SnapshotDb.openCheckpointV1(request.localFile, checkpoint);\r\n\r\n // check a list of aliases for finding checkpoints downloaded to non-default locations (e.g. from older versions)\r\n if (request.aliasFiles) {\r\n for (const alias of request.aliasFiles) {\r\n if (this.verifyCheckpoint(checkpoint, alias)) {\r\n request.localFile = alias;\r\n return SnapshotDb.openCheckpointV1(alias, checkpoint);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
@@ -9,13 +9,24 @@ import type { VersionedSqliteDb } from "./SQLiteDb";
9
9
  * @beta
10
10
  */
11
11
  export declare namespace CloudSqlite {
12
+ /**
13
+ * Request a new AccessToken for a cloud container using the [[BlobContainer]] service.
14
+ * If the service is unavailable or returns an error, an empty token is returned.
15
+ */
16
+ function requestToken(args: ContainerTokenProps): Promise<AccessToken>;
17
+ /**
18
+ * Create a new CloudContainer from a ContainerAccessProps. For non-public containers, a valid accessToken must be provided before the container
19
+ * can be used (e.g. via [[CloudSqlite.requestToken]]).
20
+ * @note After the container is successfully connected to a CloudCache, it will begin auto-refreshing its accessToken every `tokenRefreshSeconds` seconds (default is 1 hour)
21
+ * until it is disconnected. However, if the container is public, or if `tokenRefreshSeconds` is <=0, auto-refresh is not enabled.
22
+ */
12
23
  function createCloudContainer(args: ContainerAccessProps): CloudContainer;
13
24
  /** Begin prefetching all blocks for a database in a CloudContainer in the background. */
14
25
  function startCloudPrefetch(container: CloudContainer, dbName: string, args?: PrefetchProps): CloudPrefetch;
15
26
  /** Properties of a CloudContainer. */
16
27
  interface ContainerProps {
17
- /** blob storage module */
18
- storageType: "azure" | "google" | "aws";
28
+ /** blob storage provider */
29
+ storageType: "azure" | "google";
19
30
  /** base URI for container. */
20
31
  baseUri: string;
21
32
  /** the name of the container. */
@@ -33,6 +44,7 @@ export declare namespace CloudSqlite {
33
44
  /** string attached to log messages from CloudSQLite. This is most useful for identifying usage from daemon mode. */
34
45
  logId?: string;
35
46
  }
47
+ type ContainerTokenProps = Omit<ContainerProps, "accessToken">;
36
48
  /** Returned from `CloudContainer.queryDatabase` describing one database in the container */
37
49
  interface CachedDbProps {
38
50
  /** The total of (4Mb) blocks in the database. */
@@ -48,7 +60,7 @@ export declare namespace CloudSqlite {
48
60
  }
49
61
  /** Filter options passed to CloudContainer.queryHttpLog
50
62
  * @internal
51
- */
63
+ */
52
64
  interface BcvHttpLogFilterOptions {
53
65
  /** only return rows whose ID is >= the provided id */
54
66
  startFromId?: number;
@@ -59,17 +71,17 @@ export declare namespace CloudSqlite {
59
71
  }
60
72
  /** Returned from 'CloudContainer.queryHttpLog' describing a row in the bcv_http_log table.
61
73
  * @internal
62
- */
74
+ */
63
75
  interface BcvHttpLog {
64
76
  /** Unique, monotonically increasing id value */
65
77
  readonly id: number;
66
78
  /** Time request was made, as iso-8601 */
67
79
  readonly startTime: string;
68
- /** Time reply received, as iso-8601 (or NULL) */
80
+ /** Time reply received, as iso-8601 (may be undefined) */
69
81
  readonly endTime: string | undefined;
70
82
  /** "PUT", "GET", etc. */
71
83
  readonly method: string;
72
- /** Name of the client that caused this request. Name will be "prefetch" if it is a request triggered by a prefetch. */
84
+ /** LogId of client that caused this request. Will be "prefetch" for prefetch requests. */
73
85
  readonly logId: string;
74
86
  /** Log message associated with request */
75
87
  readonly logmsg: string;
@@ -82,6 +94,8 @@ export declare namespace CloudSqlite {
82
94
  type ContainerAccessProps = ContainerProps & {
83
95
  /** Duration for holding write lock, in seconds. After this time the write lock expires if not refreshed. Default is one hour. */
84
96
  lockExpireSeconds?: number;
97
+ /** number of seconds between auto-refresh of access token. If <=0 no auto-refresh. Default is 1 hour (60*60) */
98
+ tokenRefreshSeconds?: number;
85
99
  };
86
100
  /** The name of a CloudSqlite database within a CloudContainer. */
87
101
  interface DbNameProp {
@@ -255,7 +269,7 @@ export declare namespace CloudSqlite {
255
269
  */
256
270
  initializeContainer(opts?: {
257
271
  checksumBlockNames?: boolean;
258
- blockSize?: number;
272
+ blockSize: number;
259
273
  }): void;
260
274
  /**
261
275
  * Connect this CloudContainer to a CloudCache for accessing and/or modifying its contents.
@@ -391,24 +405,24 @@ export declare namespace CloudSqlite {
391
405
  /** @internal */
392
406
  function transferDb(direction: TransferDirection, container: CloudContainer, props: TransferDbProps): Promise<void>;
393
407
  /** Upload a local SQLite database file into a CloudContainer.
394
- * @param container the CloudContainer holding the database. Must be connected.
395
- * @param props the properties that describe the database to be downloaded, plus optionally an `onProgress` function.
396
- * @note this function requires that the write lock be held on the container
397
- */
408
+ * @param container the CloudContainer holding the database. Must be connected.
409
+ * @param props the properties that describe the database to be downloaded, plus optionally an `onProgress` function.
410
+ * @note this function requires that the write lock be held on the container
411
+ */
398
412
  function uploadDb(container: CloudContainer, props: TransferDbProps): Promise<void>;
399
413
  /** Download a database from a CloudContainer.
400
- * @param container the CloudContainer holding the database. Must be connected.
401
- * @param props the properties that describe the database to be downloaded, plus optionally an `onProgress` function.
402
- * @returns a Promise that is resolved when the download completes.
403
- * @note the download is "restartable." If the transfer is aborted and then re-requested, it will continue from where
404
- * it left off rather than re-downloading the entire file.
405
- */
414
+ * @param container the CloudContainer holding the database. Must be connected.
415
+ * @param props the properties that describe the database to be downloaded, plus optionally an `onProgress` function.
416
+ * @returns a Promise that is resolved when the download completes.
417
+ * @note the download is "restartable." If the transfer is aborted and then re-requested, it will continue from where
418
+ * it left off rather than re-downloading the entire file.
419
+ */
406
420
  function downloadDb(container: CloudContainer, props: TransferDbProps): Promise<void>;
407
421
  /** Optional method to be called when an attempt to acquire the write lock fails because another user currently holds it.
408
- * @param lockedBy The identifier supplied by the application/user that currently holds the lock.
409
- * @param expires a stringified Date (in local time) indicating when the lock will expire.
410
- * @return "stop" to give up and stop retrying. Generally, it's a good idea to wait for some time before returning.
411
- */
422
+ * @param lockedBy The identifier supplied by the application/user that currently holds the lock.
423
+ * @param expires a stringified Date (in local time) indicating when the lock will expire.
424
+ * @return "stop" to give up and stop retrying. Generally, it's a good idea to wait for some time before returning.
425
+ */
412
426
  type WriteLockBusyHandler = (lockedBy: string, expires: string) => Promise<void | "stop">;
413
427
  /**
414
428
  * Attempt to acquire the write lock for a container, with retries.
@@ -421,19 +435,19 @@ export declare namespace CloudSqlite {
421
435
  */
422
436
  function acquireWriteLock(user: string, container: CloudContainer, busyHandler?: WriteLockBusyHandler): Promise<void>;
423
437
  /**
424
- * Perform an asynchronous write operation on a CloudContainer with the write lock held.
425
- * 1. if write lock is already held, call operation and return.
426
- * 2. attempt to acquire the write lock, with retries. Throw if unable to obtain write lock.
427
- * 3. perform the operation
428
- * 3.a if the operation throws, abandon all changes and re-throw
429
- * 4. release the write lock.
430
- * 5. return value from operation
431
- * @param user the name to be displayed to other users in the event they attempt to obtain the lock while it is held by us
432
- * @param container the CloudContainer for which the lock is to be acquired
433
- * @param operation an asynchronous operation performed with the write lock held.
434
- * @param busyHandler if present, function called when the write lock is currently held by another user.
435
- * @returns a Promise with the result of `operation`
436
- */
438
+ * Perform an asynchronous write operation on a CloudContainer with the write lock held.
439
+ * 1. if write lock is already held, call operation and return.
440
+ * 2. attempt to acquire the write lock, with retries. Throw if unable to obtain write lock.
441
+ * 3. perform the operation
442
+ * 3.a if the operation throws, abandon all changes and re-throw
443
+ * 4. release the write lock.
444
+ * 5. return value from operation
445
+ * @param user the name to be displayed to other users in the event they attempt to obtain the lock while it is held by us
446
+ * @param container the CloudContainer for which the lock is to be acquired
447
+ * @param operation an asynchronous operation performed with the write lock held.
448
+ * @param busyHandler if present, function called when the write lock is currently held by another user.
449
+ * @returns a Promise with the result of `operation`
450
+ */
437
451
  function withWriteLock<T>(user: string, container: CloudContainer, operation: () => Promise<T>, busyHandler?: WriteLockBusyHandler): Promise<T>;
438
452
  /** Arguments to create or find a CloudCache */
439
453
  interface CreateCloudCacheArg {
@@ -1 +1 @@
1
- {"version":3,"file":"CloudSqlite.d.ts","sourceRoot":"","sources":["../../src/CloudSqlite.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAA+B,WAAW,EAAE,UAAU,EAAoB,gBAAgB,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAC;AACpK,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,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