@itwin/core-backend 3.4.0-dev.3 → 3.4.0-dev.30

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  3. package/lib/cjs/BackendHubAccess.js.map +1 -1
  4. package/lib/cjs/ChangedElementsDb.d.ts +1 -0
  5. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  6. package/lib/cjs/ChangedElementsDb.js +2 -2
  7. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  8. package/lib/cjs/CodeService.d.ts +392 -0
  9. package/lib/cjs/CodeService.d.ts.map +1 -0
  10. package/lib/cjs/CodeService.js +62 -0
  11. package/lib/cjs/CodeService.js.map +1 -0
  12. package/lib/cjs/CodeSpecs.js.map +1 -1
  13. package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
  14. package/lib/cjs/CustomViewState3dCreator.js +1 -0
  15. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  16. package/lib/cjs/Element.d.ts.map +1 -1
  17. package/lib/cjs/Element.js +4 -0
  18. package/lib/cjs/Element.js.map +1 -1
  19. package/lib/cjs/ElementTreeWalker.d.ts +41 -18
  20. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  21. package/lib/cjs/ElementTreeWalker.js +91 -57
  22. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  23. package/lib/cjs/ExportGraphics.d.ts +9 -9
  24. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  25. package/lib/cjs/ExportGraphics.js.map +1 -1
  26. package/lib/cjs/GeoCoordConfig.d.ts +7 -1
  27. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
  28. package/lib/cjs/GeoCoordConfig.js +15 -6
  29. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  30. package/lib/cjs/HubMock.d.ts.map +1 -1
  31. package/lib/cjs/HubMock.js +7 -7
  32. package/lib/cjs/HubMock.js.map +1 -1
  33. package/lib/cjs/IModelDb.d.ts +17 -4
  34. package/lib/cjs/IModelDb.d.ts.map +1 -1
  35. package/lib/cjs/IModelDb.js +53 -11
  36. package/lib/cjs/IModelDb.js.map +1 -1
  37. package/lib/cjs/IModelHost.d.ts.map +1 -1
  38. package/lib/cjs/IModelHost.js +3 -1
  39. package/lib/cjs/IModelHost.js.map +1 -1
  40. package/lib/cjs/IModelSchemaLoader.d.ts.map +1 -1
  41. package/lib/cjs/IModelSchemaLoader.js +10 -18
  42. package/lib/cjs/IModelSchemaLoader.js.map +1 -1
  43. package/lib/cjs/LocalHub.js +1 -1
  44. package/lib/cjs/LocalHub.js.map +1 -1
  45. package/lib/cjs/Material.d.ts +3 -1
  46. package/lib/cjs/Material.d.ts.map +1 -1
  47. package/lib/cjs/Material.js +3 -1
  48. package/lib/cjs/Material.js.map +1 -1
  49. package/lib/cjs/PropertyStore.d.ts +134 -0
  50. package/lib/cjs/PropertyStore.d.ts.map +1 -0
  51. package/lib/cjs/PropertyStore.js +12 -0
  52. package/lib/cjs/PropertyStore.js.map +1 -0
  53. package/lib/cjs/SQLiteDb.d.ts +79 -40
  54. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  55. package/lib/cjs/SQLiteDb.js +57 -40
  56. package/lib/cjs/SQLiteDb.js.map +1 -1
  57. package/lib/cjs/SqliteStatement.d.ts +14 -2
  58. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  59. package/lib/cjs/SqliteStatement.js +50 -28
  60. package/lib/cjs/SqliteStatement.js.map +1 -1
  61. package/lib/cjs/TxnManager.js +1 -1
  62. package/lib/cjs/TxnManager.js.map +1 -1
  63. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +10 -0
  64. package/lib/cjs/assets/Settings/backend.setting.json5 +1 -1
  65. package/lib/cjs/core-backend.d.ts +3 -0
  66. package/lib/cjs/core-backend.d.ts.map +1 -1
  67. package/lib/cjs/core-backend.js +3 -0
  68. package/lib/cjs/core-backend.js.map +1 -1
  69. package/lib/cjs/workspace/Workspace.d.ts +7 -3
  70. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  71. package/lib/cjs/workspace/Workspace.js +25 -20
  72. package/lib/cjs/workspace/Workspace.js.map +1 -1
  73. package/package.json +15 -15
package/CHANGELOG.md CHANGED
@@ -1,6 +1,44 @@
1
1
  # Change Log - @itwin/core-backend
2
2
 
3
- This log was last generated on Mon, 01 Aug 2022 13:36:56 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 26 Aug 2022 15:40:02 GMT and should not be manually modified.
4
+
5
+ ## 3.3.1
6
+ Fri, 26 Aug 2022 15:40:02 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.3.0
11
+ Thu, 18 Aug 2022 19:08:02 GMT
12
+
13
+ ### Updates
14
+
15
+ - upgrade mocha to version 10.0.0
16
+ - Update links to BIS documentation.
17
+ - vacuum is now an instance method
18
+ - enable loading gcs data from workspace at https://geocoord-workspace.itwinjs.org/
19
+ - Progress API for downloading changesets.
20
+ - IModelHost.startup now accepts IModelHostOptions interface rather than IModelHostConfiguration instance
21
+ - added computeSchemaChecksum function to IModelHost
22
+ - Transport RPC requests over IPC when available.
23
+ - make prefetch opt-in instead of opt-out
24
+ - move HubMock to core-backend
25
+ - retry v2checkpoint downloads when they fail with "Failure when receiving data from the peer"
26
+ - set cloud cache size to 50G
27
+ - move LocalHub to @internal in core-backend
28
+ - deprecate collectPredecessorIds and getPredecessorIds in favor of collectReferenceIds and getReferenceIds
29
+ - added SQLiteDb.withOpenDb
30
+
31
+ ## 3.2.9
32
+ Fri, 26 Aug 2022 14:21:40 GMT
33
+
34
+ ### Updates
35
+
36
+ - Update to @bentley/imodeljs-native@3.2.15
37
+
38
+ ## 3.2.8
39
+ Tue, 09 Aug 2022 15:52:41 GMT
40
+
41
+ _Version update only_
4
42
 
5
43
  ## 3.2.7
6
44
  Mon, 01 Aug 2022 13:36:56 GMT
@@ -1 +1 @@
1
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AExD,4FAA4F;IAC5F,iBAAiB,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAE3E,wEAAwE;IACxE,eAAe,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAEpE,uBAAuB;IACvB,YAAY,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE"}
@@ -1 +1 @@
1
- {"version":3,"file":"BackendHubAccess.js","sourceRoot":"","sources":["../../src/BackendHubAccess.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2F;AAC3F,oDAG4B;AAI5B;;GAEG;AACH,IAAY,SASX;AATD,WAAY,SAAS;IACnB,gCAAgC;IAChC,yCAAQ,CAAA;IACR,mJAAmJ;IACnJ,6CAAU,CAAA;IACV;;OAEG;IACH,mDAAa,CAAA;AACf,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB;AAED;;EAEE;AACF,MAAa,YAAa,SAAQ,yBAAW;IAC3C;IACE,mCAAmC;IACnB,WAAwB;IACxC,sCAAsC;IACtB,cAAsB,EACtC,GAA6D;QAE7D,KAAK,CAAC,8BAAe,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QALxC,gBAAW,GAAX,WAAW,CAAa;QAExB,mBAAc,GAAd,cAAc,CAAQ;IAIxC,CAAC;CACF;AAVD,oCAUC","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 HubAccess\r\n */\r\n\r\nimport { AccessToken, GuidString, Id64String, IModelHubStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseId, ChangesetFileProps, ChangesetIdWithIndex, ChangesetIndex, ChangesetIndexAndId, ChangesetIndexOrId, ChangesetProps, ChangesetRange, IModelError,\r\n IModelVersion, LocalDirName, LocalFileName,\r\n} from \"@itwin/core-common\";\r\nimport { CheckpointProps, DownloadRequest, ProgressFunction } from \"./CheckpointManager\";\r\nimport { TokenArg } from \"./IModelDb\";\r\n\r\n/** The state of a lock.\r\n * @public\r\n */\r\nexport enum LockState {\r\n /** The element is not locked */\r\n None = 0,\r\n /** Holding a shared lock on an element blocks other users from acquiring the Exclusive lock it. More than one user may acquire the shared lock. */\r\n Shared = 1,\r\n /** A Lock that permits modifications to an element and blocks other users from making modifications to it.\r\n * Holding an exclusive lock on an \"owner\" (a model or a parent element), implicitly exclusively locks all its members.\r\n */\r\n Exclusive = 2,\r\n}\r\n\r\n/** Exception thrown if lock cannot be acquired.\r\n * @beta\r\n*/\r\nexport class LockConflict extends IModelError {\r\n public constructor(\r\n /** Id of Briefcase holding lock */\r\n public readonly briefcaseId: BriefcaseId,\r\n /** Alias of Briefcase holding lock */\r\n public readonly briefcaseAlias: string,\r\n msg: \"shared lock is held\" | \"exclusive lock is already held\"\r\n ) {\r\n super(IModelHubStatus.LockOwnedByAnotherBriefcase, msg);\r\n }\r\n}\r\n\r\n/**\r\n * The properties to access a V2 checkpoint through a daemon.\r\n * @internal\r\n */\r\nexport interface V2CheckpointAccessProps {\r\n /** blob store account name. */\r\n readonly accountName: string;\r\n /** AccessToken that grants access to the container. */\r\n readonly sasToken: AccessToken;\r\n /** The name of the iModel's blob store container holding all checkpoints. */\r\n readonly containerId: string;\r\n /** The name of the virtual file within the container, used for the checkpoint */\r\n readonly dbName: string;\r\n /** blob storage module: e.g. \"azure\", \"google\", \"aws\". May also include URI style parameters. */\r\n readonly storageType: string;\r\n}\r\n\r\n/** @internal */\r\nexport type LockMap = Map<Id64String, LockState>;\r\n\r\n/**\r\n * The properties of a lock that may be obtained from a lock server.\r\n * @beta\r\n */\r\nexport interface LockProps {\r\n /** The elementId for the lock */\r\n readonly id: Id64String;\r\n /** the lock state */\r\n readonly state: LockState;\r\n}\r\n\r\n/**\r\n * Argument for cancelling and tracking download progress.\r\n * @beta\r\n */\r\nexport interface DownloadProgressArg {\r\n /** Called to show progress during a download. If this function returns non-zero, the download is aborted. */\r\n progressCallback?: ProgressFunction;\r\n}\r\n\r\n/**\r\n * Argument for methods that must supply an iTwinId\r\n * @public\r\n */\r\nexport interface ITwinIdArg {\r\n readonly iTwinId: GuidString;\r\n}\r\n\r\n/**\r\n * Argument for methods that must supply an IModelId\r\n * @public\r\n */\r\nexport interface IModelIdArg extends TokenArg {\r\n readonly iModelId: GuidString;\r\n}\r\n\r\n/**\r\n * Argument for acquiring a new BriefcaseId\r\n * @public\r\n */\r\nexport interface AcquireNewBriefcaseIdArg extends IModelIdArg {\r\n /** A string to be reported to other users to identify this briefcase, for example in the case of conflicts or lock collisions. */\r\n readonly briefcaseAlias?: string;\r\n}\r\n\r\n/** Argument for methods that must supply an IModel name and iTwinId\r\n * @public\r\n */\r\nexport interface IModelNameArg extends TokenArg, ITwinIdArg {\r\n readonly iModelName: string;\r\n}\r\n\r\n/** Argument for methods that must supply an IModelId and a BriefcaseId\r\n * @public\r\n */\r\nexport interface BriefcaseIdArg extends IModelIdArg {\r\n readonly briefcaseId: BriefcaseId;\r\n}\r\n\r\n/** Argument for methods that must supply a briefcaseId and a changeset\r\n * @public\r\n */\r\nexport interface BriefcaseDbArg extends BriefcaseIdArg {\r\n readonly changeset: ChangesetIdWithIndex;\r\n}\r\n\r\n/** Argument for methods that must supply an IModelId and a changeset\r\n * @public\r\n */\r\nexport interface ChangesetArg extends IModelIdArg {\r\n readonly changeset: ChangesetIndexOrId;\r\n}\r\n\r\n/** Argument for downloading a changeset.\r\n * @beta\r\n */\r\nexport interface DownloadChangesetArg extends ChangesetArg, DownloadProgressArg {\r\n /** Directory where the changeset should be downloaded. */\r\n targetDir: LocalDirName;\r\n}\r\n\r\n/** @internal */\r\nexport interface ChangesetIndexArg extends IModelIdArg {\r\n readonly changeset: ChangesetIdWithIndex;\r\n}\r\n\r\n/** Argument for methods that must supply an IModelId and a range of Changesets.\r\n * @public\r\n */\r\nexport interface ChangesetRangeArg extends IModelIdArg {\r\n /** the range of changesets desired. If is undefined, *all* changesets are returned. */\r\n readonly range?: ChangesetRange;\r\n}\r\n\r\n/** Argument for downloading a changeset range.\r\n * @beta\r\n */\r\nexport interface DownloadChangesetRangeArg extends ChangesetRangeArg, DownloadProgressArg {\r\n /** Directory where the changesets should be downloaded. */\r\n targetDir: LocalDirName;\r\n}\r\n\r\n/**\r\n * @deprecated\r\n * @internal\r\n */\r\nexport type CheckpointArg = DownloadRequest;\r\n\r\n/**\r\n * Arguments to create a new iModel in iModelHub\r\n * @public\r\n */\r\nexport interface CreateNewIModelProps extends IModelNameArg {\r\n readonly description?: string;\r\n readonly version0?: LocalFileName;\r\n readonly noLocks?: true;\r\n}\r\n\r\n/**\r\n * Methods for accessing services of IModelHub from an iTwin.js backend.\r\n * Generally direct access to these methods should not be required, since higher-level apis are provided.\r\n * @beta\r\n */\r\nexport interface BackendHubAccess {\r\n /** Download all the changesets in the specified range. */\r\n downloadChangesets: (arg: DownloadChangesetRangeArg) => Promise<ChangesetFileProps[]>;\r\n /** Download a single changeset. */\r\n downloadChangeset: (arg: DownloadChangesetArg) => Promise<ChangesetFileProps>;\r\n /** Query the changeset properties given a ChangesetIndex */\r\n queryChangeset: (arg: ChangesetArg) => Promise<ChangesetProps>;\r\n /** Query an array of changeset properties given a range of ChangesetIndexes */\r\n queryChangesets: (arg: ChangesetRangeArg) => Promise<ChangesetProps[]>;\r\n /** Push a changeset to iModelHub. Returns the newly pushed changeset's index */\r\n pushChangeset: (arg: IModelIdArg & { changesetProps: ChangesetFileProps }) => Promise<ChangesetIndex>;\r\n /** Get the ChangesetProps of the most recent changeset */\r\n getLatestChangeset: (arg: IModelIdArg) => Promise<ChangesetProps>;\r\n /** Get the ChangesetProps for an IModelVersion */\r\n getChangesetFromVersion: (arg: IModelIdArg & { version: IModelVersion }) => Promise<ChangesetProps>;\r\n /** Get the ChangesetProps for a named version */\r\n getChangesetFromNamedVersion: (arg: IModelIdArg & { versionName: string }) => Promise<ChangesetProps>;\r\n\r\n /** Acquire a new briefcaseId for the supplied iModelId\r\n * @note usually there should only be one briefcase per iModel per user.\r\n */\r\n acquireNewBriefcaseId: (arg: AcquireNewBriefcaseIdArg) => Promise<BriefcaseId>;\r\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\r\n releaseBriefcase: (arg: BriefcaseIdArg) => Promise<void>;\r\n\r\n /** get an array of the briefcases assigned to a user. */\r\n getMyBriefcaseIds: (arg: IModelIdArg) => Promise<BriefcaseId[]>;\r\n\r\n /**\r\n * download a v1 checkpoint\r\n * @deprecated\r\n * @internal\r\n */\r\n downloadV1Checkpoint: (arg: CheckpointArg) => Promise<ChangesetIndexAndId>; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * Get the access props for a V2 checkpoint. Returns undefined if no V2 checkpoint exists.\r\n * @internal\r\n */\r\n queryV2Checkpoint: (arg: CheckpointProps) => Promise<V2CheckpointAccessProps | undefined>;\r\n\r\n /**\r\n * acquire one or more locks. Throws if unsuccessful. If *any* lock cannot be obtained, no locks are acquired\r\n * @internal\r\n */\r\n acquireLocks: (arg: BriefcaseDbArg, locks: LockMap) => Promise<void>;\r\n\r\n /**\r\n * Get the list of all held locks for a briefcase. This can be very expensive and is currently used only for tests.\r\n * @internal\r\n */\r\n queryAllLocks: (arg: BriefcaseDbArg) => Promise<LockProps[]>;\r\n\r\n /**\r\n * Release all currently held locks\r\n * @internal\r\n */\r\n releaseAllLocks: (arg: BriefcaseDbArg) => Promise<void>;\r\n\r\n /** Get the iModelId of an iModel by name. Undefined if no iModel with that name exists. */\r\n queryIModelByName: (arg: IModelNameArg) => Promise<GuidString | undefined>;\r\n\r\n /** create a new iModel. Returns the Guid of the newly created iModel */\r\n createNewIModel: (arg: CreateNewIModelProps) => Promise<GuidString>;\r\n\r\n /** delete an iModel */\r\n deleteIModel: (arg: IModelIdArg & ITwinIdArg) => Promise<void>;\r\n}\r\n"]}
1
+ {"version":3,"file":"BackendHubAccess.js","sourceRoot":"","sources":["../../src/BackendHubAccess.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2F;AAC3F,oDAG4B;AAI5B;;GAEG;AACH,IAAY,SASX;AATD,WAAY,SAAS;IACnB,gCAAgC;IAChC,yCAAQ,CAAA;IACR,mJAAmJ;IACnJ,6CAAU,CAAA;IACV;;OAEG;IACH,mDAAa,CAAA;AACf,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB;AAED;;EAEE;AACF,MAAa,YAAa,SAAQ,yBAAW;IAC3C;IACE,mCAAmC;IACnB,WAAwB;IACxC,sCAAsC;IACtB,cAAsB,EACtC,GAA6D;QAE7D,KAAK,CAAC,8BAAe,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QALxC,gBAAW,GAAX,WAAW,CAAa;QAExB,mBAAc,GAAd,cAAc,CAAQ;IAIxC,CAAC;CACF;AAVD,oCAUC","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 HubAccess\r\n */\r\n\r\nimport { AccessToken, GuidString, Id64String, IModelHubStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseId, ChangesetFileProps, ChangesetIdWithIndex, ChangesetIndex, ChangesetIndexAndId, ChangesetIndexOrId, ChangesetProps, ChangesetRange,\r\n IModelError, IModelVersion, LocalDirName, LocalFileName,\r\n} from \"@itwin/core-common\";\r\nimport { CheckpointProps, DownloadRequest, ProgressFunction } from \"./CheckpointManager\";\r\nimport { TokenArg } from \"./IModelDb\";\r\n\r\n/** The state of a lock.\r\n * @public\r\n */\r\nexport enum LockState {\r\n /** The element is not locked */\r\n None = 0,\r\n /** Holding a shared lock on an element blocks other users from acquiring the Exclusive lock it. More than one user may acquire the shared lock. */\r\n Shared = 1,\r\n /** A Lock that permits modifications to an element and blocks other users from making modifications to it.\r\n * Holding an exclusive lock on an \"owner\" (a model or a parent element), implicitly exclusively locks all its members.\r\n */\r\n Exclusive = 2,\r\n}\r\n\r\n/** Exception thrown if lock cannot be acquired.\r\n * @beta\r\n*/\r\nexport class LockConflict extends IModelError {\r\n public constructor(\r\n /** Id of Briefcase holding lock */\r\n public readonly briefcaseId: BriefcaseId,\r\n /** Alias of Briefcase holding lock */\r\n public readonly briefcaseAlias: string,\r\n msg: \"shared lock is held\" | \"exclusive lock is already held\"\r\n ) {\r\n super(IModelHubStatus.LockOwnedByAnotherBriefcase, msg);\r\n }\r\n}\r\n\r\n/**\r\n * The properties to access a V2 checkpoint through a daemon.\r\n * @internal\r\n */\r\nexport interface V2CheckpointAccessProps {\r\n /** blob store account name. */\r\n readonly accountName: string;\r\n /** AccessToken that grants access to the container. */\r\n readonly sasToken: AccessToken;\r\n /** The name of the iModel's blob store container holding all checkpoints. */\r\n readonly containerId: string;\r\n /** The name of the virtual file within the container, used for the checkpoint */\r\n readonly dbName: string;\r\n /** blob storage module: e.g. \"azure\", \"google\", \"aws\". May also include URI style parameters. */\r\n readonly storageType: string;\r\n}\r\n\r\n/** @internal */\r\nexport type LockMap = Map<Id64String, LockState>;\r\n\r\n/**\r\n * The properties of a lock that may be obtained from a lock server.\r\n * @beta\r\n */\r\nexport interface LockProps {\r\n /** The elementId for the lock */\r\n readonly id: Id64String;\r\n /** the lock state */\r\n readonly state: LockState;\r\n}\r\n\r\n/**\r\n * Argument for cancelling and tracking download progress.\r\n * @beta\r\n */\r\nexport interface DownloadProgressArg {\r\n /** Called to show progress during a download. If this function returns non-zero, the download is aborted. */\r\n progressCallback?: ProgressFunction;\r\n}\r\n\r\n/**\r\n * Argument for methods that must supply an iTwinId\r\n * @public\r\n */\r\nexport interface ITwinIdArg {\r\n readonly iTwinId: GuidString;\r\n}\r\n\r\n/**\r\n * Argument for methods that must supply an IModelId\r\n * @public\r\n */\r\nexport interface IModelIdArg extends TokenArg {\r\n readonly iModelId: GuidString;\r\n}\r\n\r\n/**\r\n * Argument for acquiring a new BriefcaseId\r\n * @public\r\n */\r\nexport interface AcquireNewBriefcaseIdArg extends IModelIdArg {\r\n /** A string to be reported to other users to identify this briefcase, for example in the case of conflicts or lock collisions. */\r\n readonly briefcaseAlias?: string;\r\n}\r\n\r\n/** Argument for methods that must supply an IModel name and iTwinId\r\n * @public\r\n */\r\nexport interface IModelNameArg extends TokenArg, ITwinIdArg {\r\n readonly iModelName: string;\r\n}\r\n\r\n/** Argument for methods that must supply an IModelId and a BriefcaseId\r\n * @public\r\n */\r\nexport interface BriefcaseIdArg extends IModelIdArg {\r\n readonly briefcaseId: BriefcaseId;\r\n}\r\n\r\n/** Argument for methods that must supply a briefcaseId and a changeset\r\n * @public\r\n */\r\nexport interface BriefcaseDbArg extends BriefcaseIdArg {\r\n readonly changeset: ChangesetIdWithIndex;\r\n}\r\n\r\n/** Argument for methods that must supply an IModelId and a changeset\r\n * @public\r\n */\r\nexport interface ChangesetArg extends IModelIdArg {\r\n readonly changeset: ChangesetIndexOrId;\r\n}\r\n\r\n/** Argument for downloading a changeset.\r\n * @beta\r\n */\r\nexport interface DownloadChangesetArg extends ChangesetArg, DownloadProgressArg {\r\n /** Directory where the changeset should be downloaded. */\r\n targetDir: LocalDirName;\r\n}\r\n\r\n/** @internal */\r\nexport interface ChangesetIndexArg extends IModelIdArg {\r\n readonly changeset: ChangesetIdWithIndex;\r\n}\r\n\r\n/** Argument for methods that must supply an IModelId and a range of Changesets.\r\n * @public\r\n */\r\nexport interface ChangesetRangeArg extends IModelIdArg {\r\n /** the range of changesets desired. If is undefined, *all* changesets are returned. */\r\n readonly range?: ChangesetRange;\r\n}\r\n\r\n/** Argument for downloading a changeset range.\r\n * @beta\r\n */\r\nexport interface DownloadChangesetRangeArg extends ChangesetRangeArg, DownloadProgressArg {\r\n /** Directory where the changesets should be downloaded. */\r\n targetDir: LocalDirName;\r\n}\r\n\r\n/**\r\n * @deprecated\r\n * @internal\r\n */\r\nexport type CheckpointArg = DownloadRequest;\r\n\r\n/**\r\n * Arguments to create a new iModel in iModelHub\r\n * @public\r\n */\r\nexport interface CreateNewIModelProps extends IModelNameArg {\r\n readonly description?: string;\r\n readonly version0?: LocalFileName;\r\n readonly noLocks?: true;\r\n}\r\n\r\n/**\r\n * Methods for accessing services of IModelHub from an iTwin.js backend.\r\n * Generally direct access to these methods should not be required, since higher-level apis are provided.\r\n * @beta\r\n */\r\nexport interface BackendHubAccess {\r\n /** Download all the changesets in the specified range. */\r\n downloadChangesets: (arg: DownloadChangesetRangeArg) => Promise<ChangesetFileProps[]>;\r\n /** Download a single changeset. */\r\n downloadChangeset: (arg: DownloadChangesetArg) => Promise<ChangesetFileProps>;\r\n /** Query the changeset properties given a ChangesetIndex */\r\n queryChangeset: (arg: ChangesetArg) => Promise<ChangesetProps>;\r\n /** Query an array of changeset properties given a range of ChangesetIndexes */\r\n queryChangesets: (arg: ChangesetRangeArg) => Promise<ChangesetProps[]>;\r\n /** Push a changeset to iModelHub. Returns the newly pushed changeset's index */\r\n pushChangeset: (arg: IModelIdArg & { changesetProps: ChangesetFileProps }) => Promise<ChangesetIndex>;\r\n /** Get the ChangesetProps of the most recent changeset */\r\n getLatestChangeset: (arg: IModelIdArg) => Promise<ChangesetProps>;\r\n /** Get the ChangesetProps for an IModelVersion */\r\n getChangesetFromVersion: (arg: IModelIdArg & { version: IModelVersion }) => Promise<ChangesetProps>;\r\n /** Get the ChangesetProps for a named version */\r\n getChangesetFromNamedVersion: (arg: IModelIdArg & { versionName: string }) => Promise<ChangesetProps>;\r\n\r\n /** Acquire a new briefcaseId for the supplied iModelId\r\n * @note usually there should only be one briefcase per iModel per user.\r\n */\r\n acquireNewBriefcaseId: (arg: AcquireNewBriefcaseIdArg) => Promise<BriefcaseId>;\r\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\r\n releaseBriefcase: (arg: BriefcaseIdArg) => Promise<void>;\r\n\r\n /** get an array of the briefcases assigned to a user. */\r\n getMyBriefcaseIds: (arg: IModelIdArg) => Promise<BriefcaseId[]>;\r\n\r\n /**\r\n * download a v1 checkpoint\r\n * @deprecated\r\n * @internal\r\n */\r\n downloadV1Checkpoint: (arg: CheckpointArg) => Promise<ChangesetIndexAndId>; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * Get the access props for a V2 checkpoint. Returns undefined if no V2 checkpoint exists.\r\n * @internal\r\n */\r\n queryV2Checkpoint: (arg: CheckpointProps) => Promise<V2CheckpointAccessProps | undefined>;\r\n\r\n /**\r\n * acquire one or more locks. Throws if unsuccessful. If *any* lock cannot be obtained, no locks are acquired\r\n * @internal\r\n */\r\n acquireLocks: (arg: BriefcaseDbArg, locks: LockMap) => Promise<void>;\r\n\r\n /**\r\n * Get the list of all held locks for a briefcase. This can be very expensive and is currently used only for tests.\r\n * @internal\r\n */\r\n queryAllLocks: (arg: BriefcaseDbArg) => Promise<LockProps[]>;\r\n\r\n /**\r\n * Release all currently held locks\r\n * @internal\r\n */\r\n releaseAllLocks: (arg: BriefcaseDbArg) => Promise<void>;\r\n\r\n /** Get the iModelId of an iModel by name. Undefined if no iModel with that name exists. */\r\n queryIModelByName: (arg: IModelNameArg) => Promise<GuidString | undefined>;\r\n\r\n /** create a new iModel. Returns the Guid of the newly created iModel */\r\n createNewIModel: (arg: CreateNewIModelProps) => Promise<GuidString>;\r\n\r\n /** delete an iModel */\r\n deleteIModel: (arg: IModelIdArg & ITwinIdArg) => Promise<void>;\r\n}\r\n"]}
@@ -21,6 +21,7 @@ export interface ProcessChangesetOptions {
21
21
  tempDir?: string;
22
22
  wantRelationshipCaching?: boolean;
23
23
  relationshipCacheSize?: number;
24
+ wantChunkTraversal?: boolean;
24
25
  }
25
26
  /** An ChangedElementsDb file
26
27
  * @internal
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,GAAG,aAAa,GAAG,SAAS;IAOpG;;;;;OAKG;IACI,aAAa,CAAC,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAO9F,sDAAsD;IACtD,IAAW,MAAM,IAAI,OAAO,CAAmC;IAE/D,mEAAmE;IAC5D,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAEhD;;OAEG;IACI,OAAO,IAAI,IAAI;IAIf,WAAW,IAAI,IAAI;IAI1B,gBAAgB;IAChB,IAAW,QAAQ,IAAI,cAAc,CAAC,mBAAmB,CAKxD;CACF"}
@@ -79,7 +79,7 @@ class ChangedElementsDb {
79
79
  const changesets = await IModelHost_1.IModelHost.hubAccess.downloadChangesets({ accessToken, iModelId, range: { first, end }, targetDir: BriefcaseManager_1.BriefcaseManager.getChangeSetsPath(iModelId) });
80
80
  // ChangeSets need to be processed from newest to oldest
81
81
  changesets.reverse();
82
- const status = this.nativeDb.processChangesets(briefcase.nativeDb, changesets, options.rulesetId, options.filterSpatial, options.wantParents, options.wantPropertyChecksums, options.rulesetDir, options.tempDir);
82
+ const status = this.nativeDb.processChangesets(briefcase.nativeDb, changesets, options.rulesetId, options.filterSpatial, options.wantParents, options.wantPropertyChecksums, options.rulesetDir, options.tempDir, options.wantChunkTraversal);
83
83
  if (status !== core_bentley_1.DbResult.BE_SQLITE_OK)
84
84
  throw new core_common_1.IModelError(status, "Failed to process changesets");
85
85
  return status;
@@ -101,7 +101,7 @@ class ChangedElementsDb {
101
101
  const dbGuid = briefcase.iModelId;
102
102
  briefcase.close();
103
103
  // Process changesets
104
- const status = this.nativeDb.processChangesetsAndRoll(dbFilename, dbGuid, changesets, options.rulesetId, options.filterSpatial, options.wantParents, options.wantPropertyChecksums, options.rulesetDir, options.tempDir, options.wantRelationshipCaching, options.relationshipCacheSize);
104
+ const status = this.nativeDb.processChangesetsAndRoll(dbFilename, dbGuid, changesets, options.rulesetId, options.filterSpatial, options.wantParents, options.wantPropertyChecksums, options.rulesetDir, options.tempDir, options.wantRelationshipCaching, options.relationshipCacheSize, options.wantChunkTraversal);
105
105
  if (status !== core_bentley_1.DbResult.BE_SQLITE_OK)
106
106
  throw new core_common_1.IModelError(status, "Failed to process changesets");
107
107
  return status;
@@ -1 +1 @@
1
- {"version":3,"file":"ChangedElementsDb.js","sourceRoot":"","sources":["../../src/ChangedElementsDb.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAiG;AACjG,oDAA6F;AAE7F,yDAAsD;AACtD,iCAAsC;AAEtC,6CAA0C;AAmB1C;;GAEG;AACH,MAAa,iBAAiB;IAG5B;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;IACjE,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,OAAO;QAET,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACK,SAAS,CAAC,SAAmB,EAAE,QAAgB;QACrD,MAAM,MAAM,GAAa,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC9E,IAAI,MAAM,KAAK,uBAAQ,CAAC,YAAY;YAClC,MAAM,IAAI,yBAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACK,OAAO,CAAC,QAAgB,EAAE,WAAyB,mBAAY,CAAC,QAAQ;QAC9E,MAAM,cAAc,GAAG,QAAQ,KAAK,mBAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAQ,CAAC,SAAS,CAAC;QACnG,MAAM,UAAU,GAAG,QAAQ,KA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ACI,OAAO;QACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC;IAED,gBAAgB;IAChB,IAAW,QAAQ;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,qDAAqD,CAAC,CAAC;QAExG,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AA3LD,8CA2LC","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 ChangedElementsDb\r\n */\r\n\r\nimport { AccessToken, DbResult, IDisposable, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\r\nimport { ChangeData, ChangedElements, ChangedModels, IModelError } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { ECDbOpenMode } from \"./ECDb\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/**\r\n * Options for processChangesets function\r\n * @internal\r\n * */\r\nexport interface ProcessChangesetOptions {\r\n startChangesetId: string;\r\n endChangesetId: string;\r\n rulesetId: string;\r\n filterSpatial?: boolean;\r\n wantParents?: boolean;\r\n wantPropertyChecksums?: boolean;\r\n rulesetDir?: string;\r\n tempDir?: string;\r\n wantRelationshipCaching?: boolean;\r\n relationshipCacheSize?: number;\r\n}\r\n\r\n/** An ChangedElementsDb file\r\n * @internal\r\n */\r\nexport class ChangedElementsDb implements IDisposable {\r\n private _nativeDb: IModelJsNative.ChangedElementsECDb | undefined;\r\n\r\n constructor() {\r\n this._nativeDb = new IModelHost.platform.ChangedElementsECDb();\r\n }\r\n\r\n public dispose(): void {\r\n if (!this._nativeDb)\r\n return;\r\n\r\n this.closeDb();\r\n this._nativeDb.dispose();\r\n this._nativeDb = undefined;\r\n }\r\n\r\n /** Create a ChangedElementsDb\r\n * @param pathName The path to the ECDb file to create.\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n private _createDb(briefcase: IModelDb, pathName: string): void {\r\n const status: DbResult = this.nativeDb.createDb(briefcase.nativeDb, pathName);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to created ECDb\");\r\n }\r\n\r\n /** Open the Changed Elements Db.\r\n * @param pathName The path to the ECDb file to open\r\n * @param openMode Open mode\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n private _openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\r\n const nativeOpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\r\n const tryUpgrade = openMode === ECDbOpenMode.FileUpgrade;\r\n const status = this.nativeDb.openDb(pathName, nativeOpenMode, tryUpgrade);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to open ECDb\");\r\n }\r\n\r\n /** Open the Changed Elements Db.\r\n * @param pathName The path to the ECDb file to open\r\n * @param openMode Open mode\r\n * @returns ChangedElementsDb\r\n */\r\n public static openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): ChangedElementsDb {\r\n const cacheDb = new ChangedElementsDb();\r\n cacheDb._openDb(pathName, openMode);\r\n return cacheDb;\r\n }\r\n\r\n /** Create the changed elements cache db\r\n * @param briefcase IModelDb to use\r\n * @param pathName The path to the ECDb file to create.\r\n * @returns The new cache db\r\n */\r\n public static createDb(briefcase: IModelDb, pathName: string): ChangedElementsDb {\r\n const cacheDb = new ChangedElementsDb();\r\n cacheDb._createDb(briefcase, pathName);\r\n return cacheDb;\r\n }\r\n\r\n /** Processes a range of changesets and adds it to the changed elements cache\r\n * @param briefcase iModel briefcase to use\r\n * @param options Options for processing\r\n */\r\n public async processChangesets(accessToken: AccessToken, briefcase: IModelDb, options: ProcessChangesetOptions): Promise<DbResult> {\r\n const iModelId = briefcase.iModelId;\r\n const first = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.startChangesetId }, accessToken })).index;\r\n const end = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.endChangesetId }, accessToken })).index;\r\n const changesets = await IModelHost.hubAccess.downloadChangesets({ accessToken, iModelId, range: { first, end }, targetDir: BriefcaseManager.getChangeSetsPath(iModelId) });\r\n\r\n // ChangeSets need to be processed from newest to oldest\r\n changesets.reverse();\r\n const status = this.nativeDb.processChangesets(\r\n briefcase.nativeDb,\r\n changesets,\r\n options.rulesetId,\r\n options.filterSpatial,\r\n options.wantParents,\r\n options.wantPropertyChecksums,\r\n options.rulesetDir,\r\n options.tempDir,\r\n );\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to process changesets\");\r\n return status;\r\n }\r\n\r\n /** Processes a range of changesets and adds it to the changed elements cache\r\n * This call will close the IModelDb object as it is required for processing and applying changesets\r\n * @param briefcase iModel briefcase to use\r\n * @param options options for processing\r\n */\r\n public async processChangesetsAndRoll(accessToken: AccessToken, briefcase: IModelDb, options: ProcessChangesetOptions): Promise<DbResult> {\r\n const iModelId = briefcase.iModelId;\r\n const first = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.startChangesetId }, accessToken })).index;\r\n const end = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.endChangesetId }, accessToken })).index;\r\n const changesets = await IModelHost.hubAccess.downloadChangesets({ accessToken, iModelId, range: { first, end }, targetDir: BriefcaseManager.getChangeSetsPath(iModelId) });\r\n\r\n // ChangeSets need to be processed from newest to oldest\r\n changesets.reverse();\r\n // Close briefcase before doing processing and rolling briefcase\r\n const dbFilename = briefcase.pathName;\r\n const dbGuid = briefcase.iModelId;\r\n briefcase.close();\r\n // Process changesets\r\n const status = this.nativeDb.processChangesetsAndRoll(\r\n dbFilename,\r\n dbGuid,\r\n changesets,\r\n options.rulesetId,\r\n options.filterSpatial,\r\n options.wantParents,\r\n options.wantPropertyChecksums,\r\n options.rulesetDir,\r\n options.tempDir,\r\n options.wantRelationshipCaching,\r\n options.relationshipCacheSize\r\n );\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to process changesets\");\r\n return status;\r\n }\r\n\r\n /** Get changed elements between two changesets\r\n * @param startChangesetId Start Changeset Id\r\n * @param endChangesetId End Changeset Id\r\n * @returns Returns the changed elements between the changesets provided\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public getChangedElements(startChangesetId: string, endChangesetId: string): ChangedElements | undefined {\r\n const result = this.nativeDb.getChangedElements(startChangesetId, endChangesetId);\r\n if (result.error || !result.result)\r\n throw new IModelError(result.error ? result.error.status : -1, result.error ? result.error.message : \"Problem getting changed elements\");\r\n return (result.result.changedElements) as ChangedElements;\r\n }\r\n\r\n /** Get changed models between two changesets\r\n * @param startChangesetId Start Changeset Id\r\n * @param endChangesetId End Changeset Id\r\n * @returns Returns the changed models between the changesets provided\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public getChangedModels(startChangesetId: string, endChangesetId: string): ChangedModels | undefined {\r\n const result = this.nativeDb.getChangedElements(startChangesetId, endChangesetId);\r\n if (result.error || !result.result)\r\n throw new IModelError(result.error ? result.error.status : -1, result.error ? result.error.message : \"Problem getting changed models\");\r\n return (result.result.changedModels) as ChangedModels;\r\n }\r\n\r\n /** Get changed models between two changesets\r\n * @param startChangesetId Start Changeset Id\r\n * @param endChangesetId End Changeset Id\r\n * @returns Returns the changed models between the changesets provided\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public getChangeData(startChangesetId: string, endChangesetId: string): ChangeData | undefined {\r\n const result = this.nativeDb.getChangedElements(startChangesetId, endChangesetId);\r\n if (result.error)\r\n throw new IModelError(result.error.status, result.error.message);\r\n return result.result as ChangeData;\r\n }\r\n\r\n /** Returns true if the Changed Elements Db is open */\r\n public get isOpen(): boolean { return this.nativeDb.isOpen(); }\r\n\r\n /** Returns true if the cache already contains this changeset Id */\r\n public isProcessed(changesetId: string): boolean { return this.nativeDb.isProcessed(changesetId); }\r\n\r\n /** Close the Db after saving any uncommitted changes.\r\n * @throws [IModelError]($common) if the database is not open.\r\n */\r\n public closeDb(): void {\r\n this.nativeDb.closeDb();\r\n }\r\n\r\n public cleanCaches(): void {\r\n this.nativeDb.cleanCaches();\r\n }\r\n\r\n /** @internal */\r\n public get nativeDb(): IModelJsNative.ChangedElementsECDb {\r\n if (!this._nativeDb)\r\n throw new IModelError(IModelStatus.BadRequest, \"ChangedElementsDb object has already been disposed.\");\r\n\r\n return this._nativeDb;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ChangedElementsDb.js","sourceRoot":"","sources":["../../src/ChangedElementsDb.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAiG;AACjG,oDAA6F;AAE7F,yDAAsD;AACtD,iCAAsC;AAEtC,6CAA0C;AAoB1C;;GAEG;AACH,MAAa,iBAAiB;IAG5B;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;IACjE,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,OAAO;QAET,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACK,SAAS,CAAC,SAAmB,EAAE,QAAgB;QACrD,MAAM,MAAM,GAAa,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC9E,IAA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AI,MAAM,CAAC,KAAK;YACd,MAAM,IAAI,yBAAW,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC,MAAoB,CAAC;IACrC,CAAC;IAED,sDAAsD;IACtD,IAAW,MAAM,KAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAE/D,mEAAmE;IAC5D,WAAW,CAAC,WAAmB,IAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAEnG;;OAEG;IACI,OAAO;QACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC;IAED,gBAAgB;IAChB,IAAW,QAAQ;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,qDAAqD,CAAC,CAAC;QAExG,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AA7LD,8CA6LC","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 ChangedElementsDb\r\n */\r\n\r\nimport { AccessToken, DbResult, IDisposable, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\r\nimport { ChangeData, ChangedElements, ChangedModels, IModelError } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { ECDbOpenMode } from \"./ECDb\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/**\r\n * Options for processChangesets function\r\n * @internal\r\n * */\r\nexport interface ProcessChangesetOptions {\r\n startChangesetId: string;\r\n endChangesetId: string;\r\n rulesetId: string;\r\n filterSpatial?: boolean;\r\n wantParents?: boolean;\r\n wantPropertyChecksums?: boolean;\r\n rulesetDir?: string;\r\n tempDir?: string;\r\n wantRelationshipCaching?: boolean;\r\n relationshipCacheSize?: number;\r\n wantChunkTraversal?: boolean;\r\n}\r\n\r\n/** An ChangedElementsDb file\r\n * @internal\r\n */\r\nexport class ChangedElementsDb implements IDisposable {\r\n private _nativeDb: IModelJsNative.ChangedElementsECDb | undefined;\r\n\r\n constructor() {\r\n this._nativeDb = new IModelHost.platform.ChangedElementsECDb();\r\n }\r\n\r\n public dispose(): void {\r\n if (!this._nativeDb)\r\n return;\r\n\r\n this.closeDb();\r\n this._nativeDb.dispose();\r\n this._nativeDb = undefined;\r\n }\r\n\r\n /** Create a ChangedElementsDb\r\n * @param pathName The path to the ECDb file to create.\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n private _createDb(briefcase: IModelDb, pathName: string): void {\r\n const status: DbResult = this.nativeDb.createDb(briefcase.nativeDb, pathName);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to created ECDb\");\r\n }\r\n\r\n /** Open the Changed Elements Db.\r\n * @param pathName The path to the ECDb file to open\r\n * @param openMode Open mode\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n private _openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\r\n const nativeOpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\r\n const tryUpgrade = openMode === ECDbOpenMode.FileUpgrade;\r\n const status = this.nativeDb.openDb(pathName, nativeOpenMode, tryUpgrade);\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to open ECDb\");\r\n }\r\n\r\n /** Open the Changed Elements Db.\r\n * @param pathName The path to the ECDb file to open\r\n * @param openMode Open mode\r\n * @returns ChangedElementsDb\r\n */\r\n public static openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): ChangedElementsDb {\r\n const cacheDb = new ChangedElementsDb();\r\n cacheDb._openDb(pathName, openMode);\r\n return cacheDb;\r\n }\r\n\r\n /** Create the changed elements cache db\r\n * @param briefcase IModelDb to use\r\n * @param pathName The path to the ECDb file to create.\r\n * @returns The new cache db\r\n */\r\n public static createDb(briefcase: IModelDb, pathName: string): ChangedElementsDb {\r\n const cacheDb = new ChangedElementsDb();\r\n cacheDb._createDb(briefcase, pathName);\r\n return cacheDb;\r\n }\r\n\r\n /** Processes a range of changesets and adds it to the changed elements cache\r\n * @param briefcase iModel briefcase to use\r\n * @param options Options for processing\r\n */\r\n public async processChangesets(accessToken: AccessToken, briefcase: IModelDb, options: ProcessChangesetOptions): Promise<DbResult> {\r\n const iModelId = briefcase.iModelId;\r\n const first = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.startChangesetId }, accessToken })).index;\r\n const end = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.endChangesetId }, accessToken })).index;\r\n const changesets = await IModelHost.hubAccess.downloadChangesets({ accessToken, iModelId, range: { first, end }, targetDir: BriefcaseManager.getChangeSetsPath(iModelId) });\r\n\r\n // ChangeSets need to be processed from newest to oldest\r\n changesets.reverse();\r\n const status = this.nativeDb.processChangesets(\r\n briefcase.nativeDb,\r\n changesets,\r\n options.rulesetId,\r\n options.filterSpatial,\r\n options.wantParents,\r\n options.wantPropertyChecksums,\r\n options.rulesetDir,\r\n options.tempDir,\r\n options.wantChunkTraversal,\r\n );\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to process changesets\");\r\n return status;\r\n }\r\n\r\n /** Processes a range of changesets and adds it to the changed elements cache\r\n * This call will close the IModelDb object as it is required for processing and applying changesets\r\n * @param briefcase iModel briefcase to use\r\n * @param options options for processing\r\n */\r\n public async processChangesetsAndRoll(accessToken: AccessToken, briefcase: IModelDb, options: ProcessChangesetOptions): Promise<DbResult> {\r\n const iModelId = briefcase.iModelId;\r\n const first = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.startChangesetId }, accessToken })).index;\r\n const end = (await IModelHost.hubAccess.queryChangeset({ iModelId, changeset: { id: options.endChangesetId }, accessToken })).index;\r\n const changesets = await IModelHost.hubAccess.downloadChangesets({ accessToken, iModelId, range: { first, end }, targetDir: BriefcaseManager.getChangeSetsPath(iModelId) });\r\n\r\n // ChangeSets need to be processed from newest to oldest\r\n changesets.reverse();\r\n // Close briefcase before doing processing and rolling briefcase\r\n const dbFilename = briefcase.pathName;\r\n const dbGuid = briefcase.iModelId;\r\n briefcase.close();\r\n // Process changesets\r\n const status = this.nativeDb.processChangesetsAndRoll(\r\n dbFilename,\r\n dbGuid,\r\n changesets,\r\n options.rulesetId,\r\n options.filterSpatial,\r\n options.wantParents,\r\n options.wantPropertyChecksums,\r\n options.rulesetDir,\r\n options.tempDir,\r\n options.wantRelationshipCaching,\r\n options.relationshipCacheSize,\r\n options.wantChunkTraversal,\r\n );\r\n if (status !== DbResult.BE_SQLITE_OK)\r\n throw new IModelError(status, \"Failed to process changesets\");\r\n return status;\r\n }\r\n\r\n /** Get changed elements between two changesets\r\n * @param startChangesetId Start Changeset Id\r\n * @param endChangesetId End Changeset Id\r\n * @returns Returns the changed elements between the changesets provided\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public getChangedElements(startChangesetId: string, endChangesetId: string): ChangedElements | undefined {\r\n const result = this.nativeDb.getChangedElements(startChangesetId, endChangesetId);\r\n if (result.error || !result.result)\r\n throw new IModelError(result.error ? result.error.status : -1, result.error ? result.error.message : \"Problem getting changed elements\");\r\n return (result.result.changedElements) as ChangedElements;\r\n }\r\n\r\n /** Get changed models between two changesets\r\n * @param startChangesetId Start Changeset Id\r\n * @param endChangesetId End Changeset Id\r\n * @returns Returns the changed models between the changesets provided\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public getChangedModels(startChangesetId: string, endChangesetId: string): ChangedModels | undefined {\r\n const result = this.nativeDb.getChangedElements(startChangesetId, endChangesetId);\r\n if (result.error || !result.result)\r\n throw new IModelError(result.error ? result.error.status : -1, result.error ? result.error.message : \"Problem getting changed models\");\r\n return (result.result.changedModels) as ChangedModels;\r\n }\r\n\r\n /** Get changed models between two changesets\r\n * @param startChangesetId Start Changeset Id\r\n * @param endChangesetId End Changeset Id\r\n * @returns Returns the changed models between the changesets provided\r\n * @throws [IModelError]($common) if the operation failed.\r\n */\r\n public getChangeData(startChangesetId: string, endChangesetId: string): ChangeData | undefined {\r\n const result = this.nativeDb.getChangedElements(startChangesetId, endChangesetId);\r\n if (result.error)\r\n throw new IModelError(result.error.status, result.error.message);\r\n return result.result as ChangeData;\r\n }\r\n\r\n /** Returns true if the Changed Elements Db is open */\r\n public get isOpen(): boolean { return this.nativeDb.isOpen(); }\r\n\r\n /** Returns true if the cache already contains this changeset Id */\r\n public isProcessed(changesetId: string): boolean { return this.nativeDb.isProcessed(changesetId); }\r\n\r\n /** Close the Db after saving any uncommitted changes.\r\n * @throws [IModelError]($common) if the database is not open.\r\n */\r\n public closeDb(): void {\r\n this.nativeDb.closeDb();\r\n }\r\n\r\n public cleanCaches(): void {\r\n this.nativeDb.cleanCaches();\r\n }\r\n\r\n /** @internal */\r\n public get nativeDb(): IModelJsNative.ChangedElementsECDb {\r\n if (!this._nativeDb)\r\n throw new IModelError(IModelStatus.BadRequest, \"ChangedElementsDb object has already been disposed.\");\r\n\r\n return this._nativeDb;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,392 @@
1
+ import { AccessToken, BentleyError, GuidString, MarkRequired, Mutable } from "@itwin/core-bentley";
2
+ import { CodeProps } from "@itwin/core-common";
3
+ import { IModelDb } from "./IModelDb";
4
+ import { SQLiteDb } from "./SQLiteDb";
5
+ import { SettingObject } from "./workspace/Settings";
6
+ /**
7
+ * A readonly index of all known Codes for an iTwin. The CodeIndex may be slightly out-of-date
8
+ * with the master copy in the cloud, but it should be periodically synchronized. Whenever codes are reserved/updated/deleted
9
+ * locally, this copy is always up-to-date as of those changes.
10
+ * @alpha
11
+ */
12
+ export interface CodeIndex {
13
+ /**
14
+ * Find the next available value for the supplied `SequenceScope`.
15
+ * If the sequence is full (there are no available values), this will throw an exception with `errorId="SequenceFull"`
16
+ * @param from the sequence and scope to search
17
+ * @returns the next available CodeValue in the sequence.
18
+ */
19
+ findNextAvailable(from: CodeService.SequenceScope): CodeService.CodeValue;
20
+ /**
21
+ * Find the highest currently used value for the supplied `SequenceScope`
22
+ * @param from the sequence and scope to search
23
+ * @returns the highest used value, or undefined if no values have been used.
24
+ */
25
+ findHighestUsed(from: CodeService.SequenceScope): CodeService.CodeValue | undefined;
26
+ /** Determine whether a code is present in this CodeIndex by its Guid. */
27
+ isCodePresent(guid: CodeService.CodeGuid): boolean;
28
+ /** Get the data for a code in this CodeIndex by its Guid.
29
+ * @returns the data for the code or undefined if no code is present for the supplied Guid.
30
+ */
31
+ getCode(guid: CodeService.CodeGuid): CodeService.CodeEntry | undefined;
32
+ /** Look up a code by its Scope, Spec, and Value.
33
+ * @returns the Guid of the code, or undefined if not present.
34
+ */
35
+ findCode(code: CodeService.ScopeSpecAndValue): CodeService.CodeGuid | undefined;
36
+ /** Look up a code spec by its name
37
+ * @throws if the spec is not present.
38
+ */
39
+ getCodeSpec(props: CodeService.CodeSpecName): CodeService.NameAndJson;
40
+ /** Call a `CodeIteration` function for all codes in this index, optionally filtered by a `CodeFilter ` */
41
+ forAllCodes(iter: CodeService.CodeIteration, filter?: CodeService.CodeFilter): void;
42
+ /** Call an iteration function for all code specs in this index, optionally filtered by a `ValueFilter ` */
43
+ forAllCodeSpecs(iter: CodeService.NameAndJsonIteration, filter?: CodeService.ValueFilter): void;
44
+ }
45
+ /**
46
+ * The services for querying, reserving, updating, and deleting codes for a BriefcaseDb (available via `BriefcaseDb.codeService`) whenever it is opened for write access.
47
+ * @alpha
48
+ */
49
+ export interface CodeService {
50
+ /** @internal */
51
+ close: () => void;
52
+ /** @internal */
53
+ addAllCodeSpecs(iModel: IModelDb): Promise<void>;
54
+ /** the code index for this CodeService */
55
+ readonly codeIndex: CodeIndex;
56
+ /**
57
+ * Application-supplied parameters for obtaining the write lock on the container and for reserving new codes.
58
+ * Applications should set these parameters by adding a listener for `BriefcaseDb.onCodeServiceCreated`
59
+ * that is called every time a BriefcaseDb that uses code services is opened for write access.
60
+ */
61
+ readonly appParams: SQLiteDb.ObtainLockParams & CodeService.AuthorAndOrigin;
62
+ /**
63
+ * The token that grants access to the cloud container for this CodeService.
64
+ * It should be established in a listener for `BriefcaseDb.onCodeServiceCreated`, and should be refreshed (via a
65
+ * timer) before it expires.
66
+ */
67
+ sasToken: AccessToken;
68
+ /**
69
+ * Synchronize the local index with any changes by made by others.
70
+ * @note This is called automatically whenever any write operation is performed on the code index. It is only necessary to
71
+ * call this directly if you have not changed the code index recently, but wish to perform a readonly operation and want to
72
+ * ensure it is up-to-date as of now.
73
+ * @note There is no guarantee that a readonly index is up-to-date even immediately after calling this method, since others
74
+ * may be modifying it at any time.
75
+ */
76
+ synchronizeWithCloud(): void;
77
+ /**
78
+ * Verify that the Code of a to-be-inserted or to-be-updated Element:
79
+ * 1. has already been reserved,
80
+ * 2. if the element has a `federationGuid`, it must match the reserved value. If the federationGuid is undefined,
81
+ * the value from the code index is returned.
82
+ *
83
+ * If not, throw an exception. Elements with no CodeValue are ignored.
84
+ * @note this method is automatically called whenever elements are added or updated by a BriefcaseDb with a CodeService.
85
+ */
86
+ verifyCode(props: CodeService.ElementCodeProps): void;
87
+ /** Add a new code spec to this code service.
88
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
89
+ */
90
+ addCodeSpec(val: CodeService.NameAndJson): Promise<void>;
91
+ /**
92
+ * Add all of the codes and code specs from this CodeService's BriefcaseDb into the code index.
93
+ * @returns the number of codes actually added.
94
+ * @note It is not necessary to call this method unless the BriefcaseDb somehow becomes out of sync with its CodeService,
95
+ * for example when migrating iModels to a new code service. It is safe (but relatively expensive) to call this method multiple times, since
96
+ * any codes or code specs that are already in the index are ignored.
97
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
98
+ */
99
+ addAllCodes(iModel: IModelDb): Promise<number>;
100
+ /**
101
+ * Attempt to reserve a single proposed code.
102
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
103
+ * @throws `CodeService.Error` if the proposed code cannot be reserved.
104
+ */
105
+ reserveCode(code: CodeService.ProposedCode): Promise<void>;
106
+ /**
107
+ * Attempt to reserve an array of proposed codes.
108
+ * @returns number of codes actually reserved.
109
+ * @see the `problems` member of the `CodeService.Error` exception
110
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
111
+ * @note If you have a set of codes to reserve, it is considerably more efficient to do them as an array rather than one at a time.
112
+ * @throws `CodeService.Error` if any of the proposed code cannot be reserved. The details for each failed code are in the `problems` member.
113
+ */
114
+ reserveCodes(arg: CodeService.ReserveCodesArgs): Promise<number>;
115
+ /**
116
+ * Attempt to reserve the next available code for a code sequence and scope.
117
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
118
+ */
119
+ reserveNextAvailableCode(arg: CodeService.ReserveNextArgs): Promise<void>;
120
+ /**
121
+ * Attempt to reserve an array of the next available codes for a code sequence and scope.
122
+ * The length of the array determines the number of codes requested. The values for the new codes are returned
123
+ * in the array, so they can be associated with the supplied GUIDs.
124
+ * @returns number of codes actually reserved.
125
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
126
+ */
127
+ reserveNextAvailableCodes(arg: CodeService.ReserveNextArrayArgs): Promise<number>;
128
+ /**
129
+ * Update the properties of a single code.
130
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
131
+ */
132
+ updateCode(props: CodeService.UpdatedCode): Promise<void>;
133
+ /**
134
+ * Update the properties of an array codes.
135
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
136
+ * @note If you have a set of codes to update, it is considerably more efficient to do them as an array rather than one at a time.
137
+ * @returns number of codes actually updated.
138
+ */
139
+ updateCodes(arg: CodeService.UpdateCodesArgs): Promise<number>;
140
+ /** Delete an array of codes by their guids.
141
+ * @note This will automatically attempt to obtain, perform the operation, and then release the write lock.
142
+ */
143
+ deleteCodes(guid: CodeService.CodeGuid[]): Promise<void>;
144
+ }
145
+ /** @alpha */
146
+ export declare namespace CodeService {
147
+ /** @internal */
148
+ let createForIModel: ((db: IModelDb) => CodeService) | undefined;
149
+ /** Register an instance of a`CodeSequence` so it can be looked up by name. */
150
+ function registerSequence(seq: CodeSequence): void;
151
+ /** Get a previously registered `CodeSequence` by its name.
152
+ * @throws if no sequence by that name was registered.
153
+ */
154
+ function getSequence(name: string): CodeSequence;
155
+ /**
156
+ * Turn a `CodePops` for the briefcase of this CodeService into a `ScopeAndSpec` object for use with a CodeService.
157
+ * This is necessary because the `spec` member of `CodeProps` refers to the id of a code spec in the iModel, and
158
+ * the `scope` member refers to the element Id of the scope element in the iModel. This helper function
159
+ * converts the spec Id to the spec name and looks up the `FederationGuid` of the scope element.
160
+ */
161
+ function makeScopeAndSpec(iModel: IModelDb, code: CodeProps): CodeService.ScopeAndSpec;
162
+ /** Turn a `CodeProps` and `ProposedCodeProps` into a `ProposedCode` for use with a CodeService.
163
+ * @see [[makeScopeAndSpec]] for explanation of why this is necessary.
164
+ */
165
+ function makeProposedCode(arg: CodeService.MakeProposedCodeArgs): CodeService.ProposedCode;
166
+ /** The name of a code spec */
167
+ type CodeSpecName = string;
168
+ /** The name that identifies the "originator" of a code. Usually this is the Guid of the iModel from which a code was added,
169
+ * but can also be used to identify a system or type from an external code service. */
170
+ type CodeOriginName = string;
171
+ /** The name that identifies the "author" of a code. Generally, this is intended to be the name of a person or group that helps identify the purpose of the code. */
172
+ type AuthorName = string;
173
+ /** The value for a code. */
174
+ type CodeValue = string;
175
+ /** The guid for a code. This identifies the real-world entity associated with the code. */
176
+ type CodeGuid = GuidString;
177
+ /** The guid of the scope for a code. This identifies the real-world entity that provides the uniqueness scope for code values. */
178
+ type ScopeGuid = GuidString;
179
+ /** An optional number associated with a code that may be used for "status" information. Values must be defined by applications. */
180
+ type CodeState = number;
181
+ /** The return status of an iteration function. The value "stop" causes the iteration to terminate. */
182
+ type IterationReturn = void | "stop";
183
+ /** An iteration function over codes in a code index. It is called with the Guid of a each code. */
184
+ type CodeIteration = (guid: GuidString) => IterationReturn;
185
+ /** An iteration function over code specs in a code index. It is called with the name and json of a each code spec. */
186
+ type NameAndJsonIteration = (nameAndJson: NameAndJson) => IterationReturn;
187
+ /** Argument for reserving an array of new codes. */
188
+ interface ReserveCodesArgs {
189
+ /** an array of proposed codes to reserve.
190
+ * @note the guid of each proposed code must be supplied by the caller.
191
+ */
192
+ readonly codes: CodeService.ProposedCode[];
193
+ /** If true, unless all codes are available, don't reserve any codes. Otherwise reserve all available codes. */
194
+ readonly allOrNothing?: true;
195
+ }
196
+ /** Argument for reserving a code from a code sequence. */
197
+ interface ReserveNextArgs {
198
+ /** the properties of the new code */
199
+ readonly code: CodeService.ProposedCodeProps;
200
+ /** The code sequence and scope for the new code. */
201
+ readonly from: SequenceScope;
202
+ }
203
+ /** Argument for reserving an array of codes from a code sequence. */
204
+ interface ReserveNextArrayArgs {
205
+ /** an array of proposed codes to reserve. */
206
+ readonly codes: CodeService.ProposedCodeProps[];
207
+ /** The code sequence and scope for the new codes. */
208
+ readonly from: CodeService.SequenceScope;
209
+ /** If true, and in the event that the code sequence does not have enough available codes to fulfill all the entries in `codes`,
210
+ * return as many as possible. Otherwise no codes are reserved. The `problems` member of the exception can be used to determine how many codes were available.
211
+ * @note if `asManyAsPossible` is true, no error is thrown if the sequence becomes full. You must check the return value to see how many
212
+ * were actually available. The `value` member will be undefined for any proposed codes that were not reserved.
213
+ */
214
+ readonly asManyAsPossible?: true;
215
+ }
216
+ /** Argument for updating an array of codes. */
217
+ interface UpdateCodesArgs {
218
+ /** Properties of the codes to update */
219
+ readonly props: CodeService.UpdatedCode[];
220
+ /** If true, unless all codes are updated, don't update any codes. Otherwise update all possible codes. */
221
+ readonly allOrNothing?: true;
222
+ }
223
+ /** Arguments for CodeService.makeProposedCode */
224
+ interface MakeProposedCodeArgs {
225
+ readonly iModel: IModelDb;
226
+ readonly code: Required<CodeProps>;
227
+ readonly props: CodeService.CodeGuidStateJson;
228
+ }
229
+ /** The properties of an Element to be checked against the code index.
230
+ * @see CodeService.verifyCode
231
+ */
232
+ interface ElementCodeProps {
233
+ /** iModel from which the code is being inserted/updated. */
234
+ readonly iModel: IModelDb;
235
+ /** Properties of the code */
236
+ readonly props: {
237
+ /** The imodel-specific code properties. */
238
+ readonly code: CodeProps;
239
+ /**
240
+ * The federationGuid of the element being inserted or updated.
241
+ * If federationGuid is defined, it is must match the value in the code index or an error is thrown.
242
+ * If it is undefined, the value from the code index is returned here.
243
+ */
244
+ federationGuid?: GuidString;
245
+ };
246
+ }
247
+ /** a name and a json object. Used for code specs, authors and origins. */
248
+ interface NameAndJson {
249
+ readonly name: string;
250
+ readonly json?: SettingObject;
251
+ }
252
+ /** A code Scope guid, and code spec name. */
253
+ interface ScopeAndSpec {
254
+ readonly spec: CodeSpecName;
255
+ readonly scope: ScopeGuid;
256
+ }
257
+ /** A code Scope guid, code spec, and code value. */
258
+ interface ScopeSpecAndValue extends ScopeAndSpec {
259
+ readonly value: CodeValue;
260
+ }
261
+ /** The data held in a code index for a single code. */
262
+ interface CodeEntry {
263
+ /** The name of the code spec for this code. */
264
+ readonly spec: CodeSpecName;
265
+ /** The guid of the entity that provides the scope for this code. */
266
+ readonly scope: ScopeGuid;
267
+ /** The value of this code. */
268
+ readonly value: CodeValue;
269
+ /** The guid of the entity this code identifies. */
270
+ readonly guid: CodeGuid;
271
+ /** the state of the code. May be undefined. */
272
+ readonly state?: CodeState;
273
+ /** The name of the originating source of this code (usually an iModel Guid). May be undefined. */
274
+ readonly origin: CodeOriginName;
275
+ /** The name of the author of this code. May be undefined. */
276
+ readonly author?: AuthorName;
277
+ /** Option json properties associated with this code. May be undefined. */
278
+ readonly json?: SettingObject;
279
+ }
280
+ /** A filter used to limit and/or sort the values returned by an iteration. */
281
+ interface ValueFilter {
282
+ /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */
283
+ readonly value?: string;
284
+ /** The comparison operator for `value`. Default is `=` */
285
+ readonly valueCompare?: "GLOB" | "LIKE" | "NOT GLOB" | "NOT LIKE" | "=" | "<" | ">";
286
+ /** Order results ascending or descending. If not supplied, the results are unordered (random). */
287
+ readonly orderBy?: "ASC" | "DESC";
288
+ /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */
289
+ readonly sqlExpression?: string;
290
+ }
291
+ /** A filter to limit and/or sort the values for the [[CodeIndex.forAllCodes]] iteration. */
292
+ interface CodeFilter extends ValueFilter {
293
+ /** If supplied, limit results to only those with this spec */
294
+ readonly spec?: CodeSpecName;
295
+ /** If supplied, limit results to only those with this scope Guid */
296
+ readonly scope?: ScopeGuid;
297
+ /** If supplied, limit results to only those with this origin */
298
+ readonly origin?: CodeOriginName;
299
+ }
300
+ /** Author and origin information supplied when codes are reserved. */
301
+ interface AuthorAndOrigin {
302
+ /** The name of the individual or group for whom the code was reserved. */
303
+ readonly author: Mutable<NameAndJson>;
304
+ /** The identity of the "originator" of the code. This is usually a guid of an iModel, but can be any unique string. */
305
+ readonly origin: Mutable<NameAndJson>;
306
+ }
307
+ /** The Guid, state, and json properties of a code. */
308
+ interface CodeGuidStateJson {
309
+ /** The Guid of the new code. This must be always be supplied by the application. */
310
+ readonly guid: CodeGuid;
311
+ /** An optional value for the state of the code. */
312
+ readonly state?: CodeState;
313
+ /** An optional json object to be stored with the code. */
314
+ readonly json?: SettingObject;
315
+ }
316
+ /** Properties of a "proposed" new code to be reserved.
317
+ * @note the Guid of the entity identified by this code *must* be supplied, but `value` is optional, since
318
+ * this may be used to reserve codes from a sequence where the value is generated.
319
+ */
320
+ interface ProposedCodeProps extends CodeGuidStateJson {
321
+ /** The value for the proposed code.
322
+ * @note For code sequence operations, this value is ignored on input and is set with a new value from the sequence on successful return.
323
+ */
324
+ value?: CodeValue;
325
+ }
326
+ /** Properties of a proposed new code that is not from a code sequence (its `value` is required). */
327
+ type ProposedCode = ProposedCodeProps & ScopeSpecAndValue;
328
+ /** Properties that describe a code sequence and a scope and spec for a proposed code or array of codes from a sequence. */
329
+ interface SequenceScope extends ScopeAndSpec {
330
+ /** The code sequence. */
331
+ readonly seq: CodeSequence;
332
+ /** A valid current value. If supplied, the returned value will always be later in the sequence than this. */
333
+ readonly start?: CodeValue;
334
+ }
335
+ /** Properties of a code to be updated.
336
+ * @note The `guid` member identifies the code to be updated and is required.
337
+ * All other properties are optional - if `undefined`, its value is not changed.
338
+ */
339
+ type UpdatedCode = MarkRequired<Partial<ProposedCode>, "guid">;
340
+ /** A proposed code that could not be reserved due to some error. */
341
+ interface ReserveProblem {
342
+ /** the proposed code that failed. */
343
+ readonly code: ProposedCode;
344
+ /** the reason for the failure */
345
+ readonly errorId: ErrorId;
346
+ /** the error message from the exception for this proposed code. */
347
+ readonly message: string;
348
+ }
349
+ /** A update to a code that failed for some error. */
350
+ interface UpdateProblem {
351
+ /** The properties of the code that was to be updated */
352
+ readonly prop: UpdatedCode;
353
+ /** the reason for the failure */
354
+ readonly errorId: ErrorId;
355
+ /** the error message from the exception for the update request. */
356
+ readonly message: string;
357
+ }
358
+ /**
359
+ * A sequence of code values following a increasing pattern. Valid code sequences must have a first value, a last value, and
360
+ * a way to get the next valid value from an existing valid value.
361
+ * Code sequences have a `sequenceName` so they can be registered using `CodeService.registerSequence`.
362
+ */
363
+ interface CodeSequence {
364
+ /** the name of this CodeSequence. */
365
+ get sequenceName(): string;
366
+ /** Get the first valid value for this CodeSequence */
367
+ getFirstValue(): CodeValue;
368
+ /** Get the last valid value for this CodeSequence */
369
+ getLastValue(): CodeValue;
370
+ /** Get the next valid value for this CodeSequence from the supplied value.
371
+ * If the sequence is full (that is, the next value is greater than the last value, this method should throw with errorId="SequenceFull".
372
+ * @return the next valid value according to the rules of this CodeSequence.
373
+ */
374
+ getNextValue(code: CodeValue): CodeValue;
375
+ /** Determine whether this supplied value is valid for this sequence. */
376
+ isValidCode(code: CodeValue): boolean;
377
+ }
378
+ /** Exception class thrown by `CodeService` methods. */
379
+ class Error extends BentleyError {
380
+ /** A string that indicates the type of problem that caused the exception. */
381
+ readonly errorId: ErrorId;
382
+ /** For [[CodeService.reserveCodes]] and [[CodeService.updateCodes]], a list of the problem details. */
383
+ readonly problems?: ReserveProblem[] | UpdateProblem[];
384
+ /** @internal */
385
+ constructor(errorId: ErrorId, errNum: number, message: string, problems?: ReserveProblem[] | UpdateProblem[]);
386
+ }
387
+ /** Identifiers for exceptions thrown by `CodeService` methods.
388
+ * @see [[CodeService.Error.errorId]]
389
+ */
390
+ type ErrorId = "BadIndexProps" | "CorruptIModel" | "CorruptIndex" | "DuplicateValue" | "GuidIsInUse" | "GuidMismatch" | "IllegalValue" | "IndexReadonly" | "InvalidCodeScope" | "InvalidGuid" | "InvalidSequence" | "MissingCode" | "MissingGuid" | "MissingInput" | "MissingSpec" | "NoCodeIndex" | "SequenceFull" | "ReserveErrors" | "SequenceNotFound" | "SqlLogicError" | "UpdateErrors" | "ValueIsInUse" | "WrongVersion";
391
+ }
392
+ //# sourceMappingURL=CodeService.d.ts.map