@itwin/core-backend 4.8.0-dev.1 → 4.8.0-dev.10

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 (182) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.d.ts +3 -1
  4. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  5. package/lib/cjs/BackendLoggerCategory.js +2 -0
  6. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  7. package/lib/cjs/BisCoreSchema.js.map +1 -1
  8. package/lib/cjs/BlobContainerService.d.ts +3 -3
  9. package/lib/cjs/BlobContainerService.d.ts.map +1 -1
  10. package/lib/cjs/BlobContainerService.js.map +1 -1
  11. package/lib/cjs/BriefcaseManager.js.map +1 -1
  12. package/lib/cjs/Category.js.map +1 -1
  13. package/lib/cjs/ChangeSummaryManager.js +2 -2
  14. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  15. package/lib/cjs/ChangedElementsDb.d.ts +1 -0
  16. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  17. package/lib/cjs/ChangedElementsDb.js +1 -1
  18. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  19. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  20. package/lib/cjs/ChangesetECAdaptor.js +237 -237
  21. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  22. package/lib/cjs/ChannelControl.js.map +1 -1
  23. package/lib/cjs/CheckpointManager.js.map +1 -1
  24. package/lib/cjs/ClassRegistry.js +5 -5
  25. package/lib/cjs/ClassRegistry.js.map +1 -1
  26. package/lib/cjs/CloudSqlite.d.ts +49 -24
  27. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  28. package/lib/cjs/CloudSqlite.js +66 -7
  29. package/lib/cjs/CloudSqlite.js.map +1 -1
  30. package/lib/cjs/CodeService.d.ts +4 -4
  31. package/lib/cjs/CodeService.d.ts.map +1 -1
  32. package/lib/cjs/CodeService.js.map +1 -1
  33. package/lib/cjs/CodeSpecs.js.map +1 -1
  34. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  35. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  36. package/lib/cjs/DevTools.js.map +1 -1
  37. package/lib/cjs/DisplayStyle.js.map +1 -1
  38. package/lib/cjs/ECDb.js.map +1 -1
  39. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  40. package/lib/cjs/ECSqlStatement.js.map +1 -1
  41. package/lib/cjs/Element.d.ts +1 -1
  42. package/lib/cjs/Element.js +1 -1
  43. package/lib/cjs/Element.js.map +1 -1
  44. package/lib/cjs/ElementAspect.js.map +1 -1
  45. package/lib/cjs/ElementGraphics.js.map +1 -1
  46. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  47. package/lib/cjs/Entity.js.map +1 -1
  48. package/lib/cjs/EntityReferences.js.map +1 -1
  49. package/lib/cjs/ExportGraphics.js.map +1 -1
  50. package/lib/cjs/ExternalSource.js.map +1 -1
  51. package/lib/cjs/GeoCoordConfig.d.ts +10 -0
  52. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
  53. package/lib/cjs/GeoCoordConfig.js +20 -23
  54. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  55. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  56. package/lib/cjs/GeometrySummary.js +47 -47
  57. package/lib/cjs/GeometrySummary.js.map +1 -1
  58. package/lib/cjs/HubMock.js.map +1 -1
  59. package/lib/cjs/IModelCloneContext.js.map +1 -1
  60. package/lib/cjs/IModelDb.d.ts +15 -10
  61. package/lib/cjs/IModelDb.d.ts.map +1 -1
  62. package/lib/cjs/IModelDb.js +84 -28
  63. package/lib/cjs/IModelDb.js.map +1 -1
  64. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  65. package/lib/cjs/IModelHost.d.ts +8 -1
  66. package/lib/cjs/IModelHost.d.ts.map +1 -1
  67. package/lib/cjs/IModelHost.js +24 -15
  68. package/lib/cjs/IModelHost.js.map +1 -1
  69. package/lib/cjs/IModelJsFs.js.map +1 -1
  70. package/lib/cjs/IpcHost.js.map +1 -1
  71. package/lib/cjs/LineStyle.js.map +1 -1
  72. package/lib/cjs/LocalHub.js +1 -1
  73. package/lib/cjs/LocalHub.js.map +1 -1
  74. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  75. package/lib/cjs/Material.d.ts.map +1 -1
  76. package/lib/cjs/Material.js +5 -0
  77. package/lib/cjs/Material.js.map +1 -1
  78. package/lib/cjs/Model.js.map +1 -1
  79. package/lib/cjs/NativeAppStorage.js.map +1 -1
  80. package/lib/cjs/NativeHost.js.map +1 -1
  81. package/lib/cjs/NavigationRelationship.js.map +1 -1
  82. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  83. package/lib/cjs/PropertyStore.d.ts +17 -7
  84. package/lib/cjs/PropertyStore.d.ts.map +1 -1
  85. package/lib/cjs/PropertyStore.js +11 -5
  86. package/lib/cjs/PropertyStore.js.map +1 -1
  87. package/lib/cjs/Relationship.js.map +1 -1
  88. package/lib/cjs/RpcBackend.js.map +1 -1
  89. package/lib/cjs/SQLiteDb.d.ts +2 -3
  90. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  91. package/lib/cjs/SQLiteDb.js +2 -3
  92. package/lib/cjs/SQLiteDb.js.map +1 -1
  93. package/lib/cjs/Schema.js.map +1 -1
  94. package/lib/cjs/SchemaSync.d.ts +1 -1
  95. package/lib/cjs/SchemaSync.d.ts.map +1 -1
  96. package/lib/cjs/SchemaSync.js.map +1 -1
  97. package/lib/cjs/SchemaUtils.js.map +1 -1
  98. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  99. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  100. package/lib/cjs/SqliteStatement.js.map +1 -1
  101. package/lib/cjs/TextAnnotationElement.js.map +1 -1
  102. package/lib/cjs/TextAnnotationGeometry.d.ts +5 -1
  103. package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -1
  104. package/lib/cjs/TextAnnotationGeometry.js +11 -8
  105. package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
  106. package/lib/cjs/TextAnnotationLayout.d.ts +21 -13
  107. package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
  108. package/lib/cjs/TextAnnotationLayout.js +134 -92
  109. package/lib/cjs/TextAnnotationLayout.js.map +1 -1
  110. package/lib/cjs/Texture.js.map +1 -1
  111. package/lib/cjs/TileStorage.js.map +1 -1
  112. package/lib/cjs/TxnManager.js.map +1 -1
  113. package/lib/cjs/ViewDefinition.js.map +1 -1
  114. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  115. package/lib/cjs/ViewStore.d.ts +16 -2
  116. package/lib/cjs/ViewStore.d.ts.map +1 -1
  117. package/lib/cjs/ViewStore.js +14 -1
  118. package/lib/cjs/ViewStore.js.map +1 -1
  119. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  120. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +33 -0
  121. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -31
  122. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -52
  123. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -132
  124. package/lib/cjs/core-backend.d.ts +2 -1
  125. package/lib/cjs/core-backend.d.ts.map +1 -1
  126. package/lib/cjs/core-backend.js +3 -2
  127. package/lib/cjs/core-backend.js.map +1 -1
  128. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  129. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  130. package/lib/cjs/domains/GenericElements.js.map +1 -1
  131. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  132. package/lib/cjs/internal/ImplementationProhibited.d.ts +44 -0
  133. package/lib/cjs/internal/ImplementationProhibited.d.ts.map +1 -0
  134. package/lib/cjs/internal/ImplementationProhibited.js +51 -0
  135. package/lib/cjs/internal/ImplementationProhibited.js.map +1 -0
  136. package/lib/cjs/internal/workspace/SettingsImpl.d.ts +43 -0
  137. package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -0
  138. package/lib/cjs/internal/workspace/SettingsImpl.js +161 -0
  139. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -0
  140. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
  141. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
  142. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +276 -0
  143. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -0
  144. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +41 -0
  145. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
  146. package/lib/cjs/internal/workspace/WorkspaceImpl.js +696 -0
  147. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -0
  148. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
  149. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
  150. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +41 -0
  151. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
  152. package/lib/cjs/rpc/multipart.js.map +1 -1
  153. package/lib/cjs/rpc/tracing.js.map +1 -1
  154. package/lib/cjs/rpc/web/logging.js.map +1 -1
  155. package/lib/cjs/rpc/web/request.js.map +1 -1
  156. package/lib/cjs/rpc/web/response.js.map +1 -1
  157. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  158. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  159. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -2
  160. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  161. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  162. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  163. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  164. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  165. package/lib/cjs/workspace/Settings.d.ts +167 -138
  166. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  167. package/lib/cjs/workspace/Settings.js +68 -138
  168. package/lib/cjs/workspace/Settings.js.map +1 -1
  169. package/lib/cjs/workspace/SettingsSchemas.d.ts +112 -48
  170. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
  171. package/lib/cjs/workspace/SettingsSchemas.js +1 -172
  172. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  173. package/lib/cjs/workspace/Workspace.d.ts +411 -277
  174. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  175. package/lib/cjs/workspace/Workspace.js +76 -457
  176. package/lib/cjs/workspace/Workspace.js.map +1 -1
  177. package/lib/cjs/workspace/WorkspaceEditor.d.ts +245 -0
  178. package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -0
  179. package/lib/cjs/workspace/WorkspaceEditor.js +34 -0
  180. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -0
  181. package/package.json +15 -14
  182. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +0 -45
@@ -1 +1 @@
1
- {"version":3,"file":"ClassRegistry.js","sourceRoot":"","sources":["../../src/ClassRegistry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;AAEH,sDAAuF;AACvF,oDAAqG;AACrG,qCAAkC;AAElC,qCAA2C;AAC3C,yDAAsD;AACtD,iCAAiC;AAEjC,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAa,aAAa;IAExB,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,GAAQ,IAAI,OAAO,CAAC,GAAG,YAAY,yBAAW,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,2BAAY,CAA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CAAC,CAAC,MAAM,KAAK,MAAM;gBAC5B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;;AApPH,sCAqPC;AApPyB,uBAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;AAsPvE;;;;GAIG;AACH,MAAa,gBAAgB;IAA7B;QACU,cAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;QAC9C,mBAAc,GAAG,IAAI,GAAG,EAAsB,CAAC;IAkBzD,CAAC;IAhBC,wCAAwC;IACjC,IAAI,CAAC,aAAqB;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;IACzD,CAAC;IAEM,aAAa,CAAC,OAAmB;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED,gCAAgC;IACzB,GAAG,CAAC,aAAqB,EAAE,QAAwB;QACxD,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AApBD,4CAoBC","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 Schema\r\n */\r\n\r\nimport { DbResult, Id64, Id64String, IModelStatus, Logger } from \"@itwin/core-bentley\";\r\nimport { EntityMetaData, EntityReferenceSet, IModelError, RelatedElement } from \"@itwin/core-common\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { Schema, Schemas } from \"./Schema\";\r\nimport { EntityReferences } from \"./EntityReferences\";\r\nimport * as assert from \"assert\";\r\n\r\nconst isGeneratedClassTag = Symbol(\"isGeneratedClassTag\");\r\n\r\n/** Maintains the mapping between the name of a BIS [ECClass]($ecschema-metadata) (in \"schema:class\" format) and the JavaScript [[Entity]] class that implements it.\r\n * Applications or modules that supply their own Entity subclasses should use [[registerModule]] or [[register]] at startup\r\n * to establish their mappings.\r\n * @public\r\n */\r\nexport class ClassRegistry {\r\n private static readonly _classMap = new Map<string, typeof Entity>();\r\n /** @internal */\r\n public static isNotFoundError(err: any) { return (err instanceof IModelError) && (err.errorNumber === IModelStatus.NotFound); }\r\n /** @internal */\r\n public static makeMetaDataNotFoundError(className: string): IModelError { return new IModelError(IModelStatus.NotFound, `metadata not found for ${className}`); }\r\n /** Register a single `entityClass` defined in the specified `schema`.\r\n * @see [[registerModule]] to register multiple classes.\r\n * @public\r\n */\r\n public static register(entityClass: typeof Entity, schema: typeof Schema) {\r\n entityClass.schema = schema;\r\n const key = (`${schema.schemaName}:${entityClass.className}`).toLowerCase();\r\n if (this._classMap.has(key)) {\r\n const errMsg = `Class ${key} is already registered. Make sure static className member is correct on JavaScript class ${entityClass.name}`;\r\n Logger.logError(\"core-frontend.classRegistry\", errMsg);\r\n throw new Error(errMsg);\r\n }\r\n\r\n this._classMap.set(key, entityClass);\r\n }\r\n\r\n /** Generate a proxy Schema for a domain that has not been registered. */\r\n private static generateProxySchema(domain: string, iModel: IModelDb): typeof Schema {\r\n const hasBehavior = iModel.withPreparedSqliteStatement(`\r\n SELECT NULL FROM [ec_CustomAttribute] [c]\r\n JOIN [ec_schema] [s] ON [s].[Id] = [c].[ContainerId]\r\n JOIN [ec_class] [e] ON [e].[Id] = [c].[ClassId]\r\n JOIN [ec_schema] [b] ON [e].[SchemaId] = [b].[Id]\r\n WHERE [c].[ContainerType] = 1 AND [s].[Name] = ? AND [b].[Name] || '.' || [e].[name] = ?`, (stmt) => {\r\n stmt.bindString(1, domain);\r\n stmt.bindString(2, \"BisCore.SchemaHasBehavior\");\r\n return stmt.step() === DbResult.BE_SQLITE_ROW;\r\n });\r\n\r\n const schemaClass = class extends Schema {\r\n public static override get schemaName() { return domain; }\r\n public static override get missingRequiredBehavior() { return hasBehavior; }\r\n };\r\n\r\n Schemas.registerSchema(schemaClass); // register the class before we return it.\r\n return schemaClass;\r\n }\r\n\r\n /** First, finds the root BisCore entity class for an entity, by traversing base classes and mixin targets (AppliesTo).\r\n * Then, gets its metadata and returns that.\r\n * @param iModel - iModel containing the metadata for this type\r\n * @param ecTypeQualifier - a full name of an ECEntityClass to find the root of\r\n * @returns the qualified full name of an ECEntityClass\r\n * @internal public for testing only\r\n */\r\n public static getRootEntity(iModel: IModelDb, ecTypeQualifier: string): string {\r\n const [classSchema, className] = ecTypeQualifier.split(\".\");\r\n const schemaItemJson = iModel.nativeDb.getSchemaItem(classSchema, className);\r\n if (schemaItemJson.error)\r\n throw new IModelError(schemaItemJson.error.status, `failed to get schema item '${ecTypeQualifier}'`);\r\n\r\n assert(undefined !== schemaItemJson.result);\r\n const schemaItem = JSON.parse(schemaItemJson.result);\r\n if (!(\"appliesTo\" in schemaItem) && schemaItem.baseClass === undefined) {\r\n return ecTypeQualifier;\r\n }\r\n\r\n // typescript doesn't understand that the inverse of the above condition is\r\n // (\"appliesTo\" in rootclassMetaData || rootClassMetaData.baseClass !== undefined)\r\n const parentItemQualifier = schemaItem.appliesTo ?? schemaItem.baseClass as string;\r\n return this.getRootEntity(iModel, parentItemQualifier);\r\n }\r\n\r\n /** Generate a JavaScript class from Entity metadata.\r\n * @param entityMetaData The Entity metadata that defines the class\r\n */\r\n private static generateClassForEntity(entityMetaData: EntityMetaData, iModel: IModelDb): typeof Entity {\r\n const name = entityMetaData.ecclass.split(\":\");\r\n const domainName = name[0];\r\n const className = name[1];\r\n\r\n if (0 === entityMetaData.baseClasses.length) // metadata must contain a superclass\r\n throw new IModelError(IModelStatus.BadArg, `class ${name} has no superclass`);\r\n\r\n // make sure schema exists\r\n let schema = Schemas.getRegisteredSchema(domainName);\r\n if (undefined === schema)\r\n schema = this.generateProxySchema(domainName, iModel); // no schema found, create it too\r\n\r\n const superclass = this._classMap.get(entityMetaData.baseClasses[0].toLowerCase());\r\n if (undefined === superclass)\r\n throw new IModelError(IModelStatus.NotFound, `cannot find superclass for class ${name}`);\r\n\r\n // user defined class hierarchies may skip a class in the hierarchy, and therefore their JS base class cannot\r\n // be used to tell if there are any generated classes in the hierarchy\r\n let generatedClassHasNonGeneratedNonCoreAncestor = false;\r\n let currentSuperclass = superclass;\r\n const MAX_ITERS = 1000;\r\n for (let i = 0; i < MAX_ITERS; ++i) {\r\n if (currentSuperclass.schema.schemaName === \"BisCore\")\r\n break;\r\n\r\n if (!currentSuperclass.isGeneratedClass) {\r\n generatedClassHasNonGeneratedNonCoreAncestor = true;\r\n break;\r\n }\r\n const superclassMetaData = iModel.classMetaDataRegistry.find(currentSuperclass.classFullName);\r\n if (superclassMetaData === undefined)\r\n throw new IModelError(IModelStatus.BadSchema, `could not find the metadata for class '${currentSuperclass.name}', class metadata should be loaded by now`);\r\n const maybeNextSuperclass = this.getClass(superclassMetaData.baseClasses[0], iModel);\r\n if (maybeNextSuperclass === undefined)\r\n throw new IModelError(IModelStatus.BadSchema, `could not find the base class of '${currentSuperclass.name}', all generated classes must have a base class`);\r\n currentSuperclass = maybeNextSuperclass;\r\n }\r\n\r\n const generatedClass = class extends superclass {\r\n public static override get className() { return className; }\r\n private static [isGeneratedClassTag] = true;\r\n public static override get isGeneratedClass() { return this.hasOwnProperty(isGeneratedClassTag); }\r\n };\r\n\r\n // the above creates an anonymous class. For help debugging, set the \"constructor.name\" property to be the same as the bisClassName.\r\n Object.defineProperty(generatedClass, \"name\", { get: () => className }); // this is the (only) way to change that readonly property.\r\n\r\n // a class only gets an automatic `collectReferenceIds` implementation if:\r\n // - it is not in the `BisCore` schema\r\n // - there are no ancestors with manually registered JS implementations, (excluding BisCore base classes)\r\n if (!generatedClassHasNonGeneratedNonCoreAncestor) {\r\n const navigationProps = Object.entries(entityMetaData.properties)\r\n .filter(([_name, prop]) => prop.isNavigation)\r\n // eslint-disable-next-line @typescript-eslint/no-shadow\r\n .map(([name, prop]) => {\r\n assert(prop.relationshipClass);\r\n const maybeMetaData = iModel.nativeDb.getSchemaItem(...prop.relationshipClass.split(\":\") as [string, string]);\r\n assert(maybeMetaData.result !== undefined, \"The nav props relationship metadata was not found\");\r\n const relMetaData = JSON.parse(maybeMetaData.result);\r\n const rootClassMetaData = ClassRegistry.getRootEntity(iModel, relMetaData.target.constraintClasses[0]);\r\n // root class must be in BisCore so should be loaded since biscore classes will never get this\r\n // generated implementation\r\n const normalizeClassName = (clsName: string) => clsName.replace(\".\", \":\");\r\n const rootClass = ClassRegistry.findRegisteredClass(normalizeClassName(rootClassMetaData));\r\n assert(rootClass, `The root class for ${prop.relationshipClass} was not in BisCore.`);\r\n return { name, concreteEntityType: EntityReferences.typeFromClass(rootClass) };\r\n });\r\n\r\n Object.defineProperty(\r\n generatedClass.prototype,\r\n \"collectReferenceIds\",\r\n {\r\n value(this: typeof generatedClass, referenceIds: EntityReferenceSet) {\r\n // eslint-disable-next-line @typescript-eslint/dot-notation\r\n const superImpl = superclass.prototype[\"collectReferenceIds\"];\r\n superImpl.call(this, referenceIds);\r\n for (const navProp of navigationProps) {\r\n const relatedElem: RelatedElement | undefined = (this as any)[navProp.name]; // cast to any since subclass can have any extensions\r\n if (!relatedElem || !Id64.isValid(relatedElem.id))\r\n continue;\r\n const referenceId = EntityReferences.fromEntityType(relatedElem.id, navProp.concreteEntityType);\r\n referenceIds.add(referenceId);\r\n }\r\n },\r\n // defaults for methods on a prototype (required for sinon to stub out methods on tests)\r\n writable: true,\r\n configurable: true,\r\n },\r\n );\r\n }\r\n\r\n // if the schema is a proxy for a domain with behavior, throw exceptions for all protected operations\r\n if (schema.missingRequiredBehavior) {\r\n const throwError = () => {\r\n throw new IModelError(IModelStatus.WrongHandler, `Schema [${domainName}] not registered, but is marked with SchemaHasBehavior`);\r\n };\r\n\r\n superclass.protectedOperations.forEach((operation) => (generatedClass as any)[operation] = throwError);\r\n }\r\n\r\n this.register(generatedClass, schema); // register it before returning\r\n return generatedClass;\r\n }\r\n\r\n /** Register all of the classes found in the given module that derive from [[Entity]].\r\n * [[register]] will be invoked for each subclass of `Entity` exported by `moduleObj`.\r\n * @param moduleObj The module to search for subclasses of Entity\r\n * @param schema The schema that contains all of the [ECClass]($ecschema-metadata)es exported by `moduleObj`.\r\n */\r\n public static registerModule(moduleObj: any, schema: typeof Schema) {\r\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\r\n const thisClass = moduleObj[thisMember];\r\n if (thisClass.prototype instanceof Entity)\r\n this.register(thisClass, schema);\r\n }\r\n }\r\n\r\n /**\r\n * This function fetches the specified Entity from the imodel, generates a JavaScript class for it, and registers the generated\r\n * class. This function also ensures that all of the base classes of the Entity exist and are registered.\r\n */\r\n private static generateClass(classFullName: string, iModel: IModelDb): typeof Entity {\r\n const metadata: EntityMetaData | undefined = iModel.classMetaDataRegistry.find(classFullName);\r\n if (metadata === undefined || metadata.ecclass === undefined)\r\n throw this.makeMetaDataNotFoundError(classFullName);\r\n\r\n // Make sure we have all base classes registered.\r\n if (metadata.baseClasses && (0 !== metadata.baseClasses.length))\r\n this.getClass(metadata.baseClasses[0], iModel);\r\n\r\n // Now we can generate the class from the classDef.\r\n return this.generateClassForEntity(metadata, iModel);\r\n }\r\n\r\n /** Find a registered class by classFullName.\r\n * @param classFullName class to find\r\n * @param iModel The IModel that contains the class definitions\r\n * @returns The Entity class or undefined\r\n */\r\n public static findRegisteredClass(classFullName: string): typeof Entity | undefined {\r\n return this._classMap.get(classFullName.toLowerCase());\r\n }\r\n\r\n /** Get the Entity class for the specified Entity className.\r\n * @param classFullName The full BIS class name of the Entity\r\n * @param iModel The IModel that contains the class definitions\r\n * @returns The Entity class\r\n */\r\n public static getClass(classFullName: string, iModel: IModelDb): typeof Entity {\r\n const key = classFullName.toLowerCase();\r\n const ctor = this._classMap.get(key);\r\n return ctor ? ctor : this.generateClass(key, iModel);\r\n }\r\n\r\n /** Unregister a class, by name, if one is already registered.\r\n * This function is not normally needed, but is useful for cases where a generated *proxy* class needs to be replaced by the *real* class.\r\n * @param classFullName Name of the class to unregister\r\n * @return true if the class was unregistered\r\n * @internal\r\n */\r\n public static unregisterCLass(classFullName: string) { return this._classMap.delete(classFullName.toLowerCase()); }\r\n /** Unregister all classes from a schema.\r\n * This function is not normally needed, but is useful for cases where a generated *proxy* schema needs to be replaced by the *real* schema.\r\n * @param schema Name of the schema to unregister\r\n * @internal\r\n */\r\n public static unregisterClassesFrom(schema: typeof Schema) {\r\n for (const entry of Array.from(this._classMap)) {\r\n if (entry[1].schema === schema)\r\n this.unregisterCLass(entry[0]);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A cache that records the mapping between class names and class metadata.\r\n * @see [[IModelDb.classMetaDataRegistry]] to access the registry for a specific iModel.\r\n * @internal\r\n */\r\nexport class MetaDataRegistry {\r\n private _registry = new Map<string, EntityMetaData>();\r\n private _classIdToName = new Map<Id64String, string>();\r\n\r\n /** Get the specified Entity metadata */\r\n public find(classFullName: string): EntityMetaData | undefined {\r\n return this._registry.get(classFullName.toLowerCase());\r\n }\r\n\r\n public findByClassId(classId: Id64String): EntityMetaData | undefined {\r\n const name = this._classIdToName.get(classId);\r\n return undefined !== name ? this.find(name) : undefined;\r\n }\r\n\r\n /** Add metadata to the cache */\r\n public add(classFullName: string, metaData: EntityMetaData): void {\r\n const name = classFullName.toLowerCase();\r\n this._registry.set(name, metaData);\r\n this._classIdToName.set(metaData.classId, name);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClassRegistry.js","sourceRoot":"","sources":["../../src/ClassRegistry.ts"],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E,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AApBD,4CAoBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport { DbResult, Id64, Id64String, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport { EntityMetaData, EntityReferenceSet, IModelError, RelatedElement } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { Schema, Schemas } from \"./Schema\";\nimport { EntityReferences } from \"./EntityReferences\";\nimport * as assert from \"assert\";\n\nconst isGeneratedClassTag = Symbol(\"isGeneratedClassTag\");\n\n/** Maintains the mapping between the name of a BIS [ECClass]($ecschema-metadata) (in \"schema:class\" format) and the JavaScript [[Entity]] class that implements it.\n * Applications or modules that supply their own Entity subclasses should use [[registerModule]] or [[register]] at startup\n * to establish their mappings.\n * @public\n */\nexport class ClassRegistry {\n private static readonly _classMap = new Map<string, typeof Entity>();\n /** @internal */\n public static isNotFoundError(err: any) { return (err instanceof IModelError) && (err.errorNumber === IModelStatus.NotFound); }\n /** @internal */\n public static makeMetaDataNotFoundError(className: string): IModelError { return new IModelError(IModelStatus.NotFound, `metadata not found for ${className}`); }\n /** Register a single `entityClass` defined in the specified `schema`.\n * @see [[registerModule]] to register multiple classes.\n * @public\n */\n public static register(entityClass: typeof Entity, schema: typeof Schema) {\n entityClass.schema = schema;\n const key = (`${schema.schemaName}:${entityClass.className}`).toLowerCase();\n if (this._classMap.has(key)) {\n const errMsg = `Class ${key} is already registered. Make sure static className member is correct on JavaScript class ${entityClass.name}`;\n Logger.logError(\"core-frontend.classRegistry\", errMsg);\n throw new Error(errMsg);\n }\n\n this._classMap.set(key, entityClass);\n }\n\n /** Generate a proxy Schema for a domain that has not been registered. */\n private static generateProxySchema(domain: string, iModel: IModelDb): typeof Schema {\n const hasBehavior = iModel.withPreparedSqliteStatement(`\n SELECT NULL FROM [ec_CustomAttribute] [c]\n JOIN [ec_schema] [s] ON [s].[Id] = [c].[ContainerId]\n JOIN [ec_class] [e] ON [e].[Id] = [c].[ClassId]\n JOIN [ec_schema] [b] ON [e].[SchemaId] = [b].[Id]\n WHERE [c].[ContainerType] = 1 AND [s].[Name] = ? AND [b].[Name] || '.' || [e].[name] = ?`, (stmt) => {\n stmt.bindString(1, domain);\n stmt.bindString(2, \"BisCore.SchemaHasBehavior\");\n return stmt.step() === DbResult.BE_SQLITE_ROW;\n });\n\n const schemaClass = class extends Schema {\n public static override get schemaName() { return domain; }\n public static override get missingRequiredBehavior() { return hasBehavior; }\n };\n\n Schemas.registerSchema(schemaClass); // register the class before we return it.\n return schemaClass;\n }\n\n /** First, finds the root BisCore entity class for an entity, by traversing base classes and mixin targets (AppliesTo).\n * Then, gets its metadata and returns that.\n * @param iModel - iModel containing the metadata for this type\n * @param ecTypeQualifier - a full name of an ECEntityClass to find the root of\n * @returns the qualified full name of an ECEntityClass\n * @internal public for testing only\n */\n public static getRootEntity(iModel: IModelDb, ecTypeQualifier: string): string {\n const [classSchema, className] = ecTypeQualifier.split(\".\");\n const schemaItemJson = iModel.nativeDb.getSchemaItem(classSchema, className);\n if (schemaItemJson.error)\n throw new IModelError(schemaItemJson.error.status, `failed to get schema item '${ecTypeQualifier}'`);\n\n assert(undefined !== schemaItemJson.result);\n const schemaItem = JSON.parse(schemaItemJson.result);\n if (!(\"appliesTo\" in schemaItem) && schemaItem.baseClass === undefined) {\n return ecTypeQualifier;\n }\n\n // typescript doesn't understand that the inverse of the above condition is\n // (\"appliesTo\" in rootclassMetaData || rootClassMetaData.baseClass !== undefined)\n const parentItemQualifier = schemaItem.appliesTo ?? schemaItem.baseClass as string;\n return this.getRootEntity(iModel, parentItemQualifier);\n }\n\n /** Generate a JavaScript class from Entity metadata.\n * @param entityMetaData The Entity metadata that defines the class\n */\n private static generateClassForEntity(entityMetaData: EntityMetaData, iModel: IModelDb): typeof Entity {\n const name = entityMetaData.ecclass.split(\":\");\n const domainName = name[0];\n const className = name[1];\n\n if (0 === entityMetaData.baseClasses.length) // metadata must contain a superclass\n throw new IModelError(IModelStatus.BadArg, `class ${name} has no superclass`);\n\n // make sure schema exists\n let schema = Schemas.getRegisteredSchema(domainName);\n if (undefined === schema)\n schema = this.generateProxySchema(domainName, iModel); // no schema found, create it too\n\n const superclass = this._classMap.get(entityMetaData.baseClasses[0].toLowerCase());\n if (undefined === superclass)\n throw new IModelError(IModelStatus.NotFound, `cannot find superclass for class ${name}`);\n\n // user defined class hierarchies may skip a class in the hierarchy, and therefore their JS base class cannot\n // be used to tell if there are any generated classes in the hierarchy\n let generatedClassHasNonGeneratedNonCoreAncestor = false;\n let currentSuperclass = superclass;\n const MAX_ITERS = 1000;\n for (let i = 0; i < MAX_ITERS; ++i) {\n if (currentSuperclass.schema.schemaName === \"BisCore\")\n break;\n\n if (!currentSuperclass.isGeneratedClass) {\n generatedClassHasNonGeneratedNonCoreAncestor = true;\n break;\n }\n const superclassMetaData = iModel.classMetaDataRegistry.find(currentSuperclass.classFullName);\n if (superclassMetaData === undefined)\n throw new IModelError(IModelStatus.BadSchema, `could not find the metadata for class '${currentSuperclass.name}', class metadata should be loaded by now`);\n const maybeNextSuperclass = this.getClass(superclassMetaData.baseClasses[0], iModel);\n if (maybeNextSuperclass === undefined)\n throw new IModelError(IModelStatus.BadSchema, `could not find the base class of '${currentSuperclass.name}', all generated classes must have a base class`);\n currentSuperclass = maybeNextSuperclass;\n }\n\n const generatedClass = class extends superclass {\n public static override get className() { return className; }\n private static [isGeneratedClassTag] = true;\n public static override get isGeneratedClass() { return this.hasOwnProperty(isGeneratedClassTag); }\n };\n\n // the above creates an anonymous class. For help debugging, set the \"constructor.name\" property to be the same as the bisClassName.\n Object.defineProperty(generatedClass, \"name\", { get: () => className }); // this is the (only) way to change that readonly property.\n\n // a class only gets an automatic `collectReferenceIds` implementation if:\n // - it is not in the `BisCore` schema\n // - there are no ancestors with manually registered JS implementations, (excluding BisCore base classes)\n if (!generatedClassHasNonGeneratedNonCoreAncestor) {\n const navigationProps = Object.entries(entityMetaData.properties)\n .filter(([_name, prop]) => prop.isNavigation)\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .map(([name, prop]) => {\n assert(prop.relationshipClass);\n const maybeMetaData = iModel.nativeDb.getSchemaItem(...prop.relationshipClass.split(\":\") as [string, string]);\n assert(maybeMetaData.result !== undefined, \"The nav props relationship metadata was not found\");\n const relMetaData = JSON.parse(maybeMetaData.result);\n const rootClassMetaData = ClassRegistry.getRootEntity(iModel, relMetaData.target.constraintClasses[0]);\n // root class must be in BisCore so should be loaded since biscore classes will never get this\n // generated implementation\n const normalizeClassName = (clsName: string) => clsName.replace(\".\", \":\");\n const rootClass = ClassRegistry.findRegisteredClass(normalizeClassName(rootClassMetaData));\n assert(rootClass, `The root class for ${prop.relationshipClass} was not in BisCore.`);\n return { name, concreteEntityType: EntityReferences.typeFromClass(rootClass) };\n });\n\n Object.defineProperty(\n generatedClass.prototype,\n \"collectReferenceIds\",\n {\n value(this: typeof generatedClass, referenceIds: EntityReferenceSet) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n const superImpl = superclass.prototype[\"collectReferenceIds\"];\n superImpl.call(this, referenceIds);\n for (const navProp of navigationProps) {\n const relatedElem: RelatedElement | undefined = (this as any)[navProp.name]; // cast to any since subclass can have any extensions\n if (!relatedElem || !Id64.isValid(relatedElem.id))\n continue;\n const referenceId = EntityReferences.fromEntityType(relatedElem.id, navProp.concreteEntityType);\n referenceIds.add(referenceId);\n }\n },\n // defaults for methods on a prototype (required for sinon to stub out methods on tests)\n writable: true,\n configurable: true,\n },\n );\n }\n\n // if the schema is a proxy for a domain with behavior, throw exceptions for all protected operations\n if (schema.missingRequiredBehavior) {\n const throwError = () => {\n throw new IModelError(IModelStatus.WrongHandler, `Schema [${domainName}] not registered, but is marked with SchemaHasBehavior`);\n };\n\n superclass.protectedOperations.forEach((operation) => (generatedClass as any)[operation] = throwError);\n }\n\n this.register(generatedClass, schema); // register it before returning\n return generatedClass;\n }\n\n /** Register all of the classes found in the given module that derive from [[Entity]].\n * [[register]] will be invoked for each subclass of `Entity` exported by `moduleObj`.\n * @param moduleObj The module to search for subclasses of Entity\n * @param schema The schema that contains all of the [ECClass]($ecschema-metadata)es exported by `moduleObj`.\n */\n public static registerModule(moduleObj: any, schema: typeof Schema) {\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\n const thisClass = moduleObj[thisMember];\n if (thisClass.prototype instanceof Entity)\n this.register(thisClass, schema);\n }\n }\n\n /**\n * This function fetches the specified Entity from the imodel, generates a JavaScript class for it, and registers the generated\n * class. This function also ensures that all of the base classes of the Entity exist and are registered.\n */\n private static generateClass(classFullName: string, iModel: IModelDb): typeof Entity {\n const metadata: EntityMetaData | undefined = iModel.classMetaDataRegistry.find(classFullName);\n if (metadata === undefined || metadata.ecclass === undefined)\n throw this.makeMetaDataNotFoundError(classFullName);\n\n // Make sure we have all base classes registered.\n if (metadata.baseClasses && (0 !== metadata.baseClasses.length))\n this.getClass(metadata.baseClasses[0], iModel);\n\n // Now we can generate the class from the classDef.\n return this.generateClassForEntity(metadata, iModel);\n }\n\n /** Find a registered class by classFullName.\n * @param classFullName class to find\n * @param iModel The IModel that contains the class definitions\n * @returns The Entity class or undefined\n */\n public static findRegisteredClass(classFullName: string): typeof Entity | undefined {\n return this._classMap.get(classFullName.toLowerCase());\n }\n\n /** Get the Entity class for the specified Entity className.\n * @param classFullName The full BIS class name of the Entity\n * @param iModel The IModel that contains the class definitions\n * @returns The Entity class\n */\n public static getClass(classFullName: string, iModel: IModelDb): typeof Entity {\n const key = classFullName.toLowerCase();\n const ctor = this._classMap.get(key);\n return ctor ? ctor : this.generateClass(key, iModel);\n }\n\n /** Unregister a class, by name, if one is already registered.\n * This function is not normally needed, but is useful for cases where a generated *proxy* class needs to be replaced by the *real* class.\n * @param classFullName Name of the class to unregister\n * @return true if the class was unregistered\n * @internal\n */\n public static unregisterCLass(classFullName: string) { return this._classMap.delete(classFullName.toLowerCase()); }\n /** Unregister all classes from a schema.\n * This function is not normally needed, but is useful for cases where a generated *proxy* schema needs to be replaced by the *real* schema.\n * @param schema Name of the schema to unregister\n * @internal\n */\n public static unregisterClassesFrom(schema: typeof Schema) {\n for (const entry of Array.from(this._classMap)) {\n if (entry[1].schema === schema)\n this.unregisterCLass(entry[0]);\n }\n }\n}\n\n/**\n * A cache that records the mapping between class names and class metadata.\n * @see [[IModelDb.classMetaDataRegistry]] to access the registry for a specific iModel.\n * @internal\n */\nexport class MetaDataRegistry {\n private _registry = new Map<string, EntityMetaData>();\n private _classIdToName = new Map<Id64String, string>();\n\n /** Get the specified Entity metadata */\n public find(classFullName: string): EntityMetaData | undefined {\n return this._registry.get(classFullName.toLowerCase());\n }\n\n public findByClassId(classId: Id64String): EntityMetaData | undefined {\n const name = this._classIdToName.get(classId);\n return undefined !== name ? this.find(name) : undefined;\n }\n\n /** Add metadata to the cache */\n public add(classFullName: string, metaData: EntityMetaData): void {\n const name = classFullName.toLowerCase();\n this._registry.set(name, metaData);\n this._classIdToName.set(metaData.classId, name);\n }\n}\n"]}
@@ -30,30 +30,32 @@ export declare namespace CloudSqlite {
30
30
  export function startCloudPrefetch(container: CloudContainer, dbName: string, args?: PrefetchProps): CloudPrefetch;
31
31
  export interface ContainerProps {
32
32
  /** The type of storage provider. */
33
- storageType: "azure" | "google";
33
+ readonly storageType: "azure" | "google";
34
34
  /** The base URI for the container. */
35
- baseUri: string;
35
+ readonly baseUri: string;
36
36
  /** The name of the container. */
37
- containerId: string;
37
+ readonly containerId: string;
38
38
  /** true if the container is public (doesn't require authorization) */
39
- isPublic?: boolean;
39
+ readonly isPublic?: boolean;
40
+ /** access token for container. If not present uses `CloudSqlite.requestToken` */
41
+ accessToken?: string;
40
42
  }
41
43
  /** Properties to access a CloudContainer. */
42
44
  export interface ContainerAccessProps extends ContainerProps {
43
45
  /** an alias for the container. Defaults to `containerId` */
44
- alias?: string;
46
+ readonly alias?: string;
45
47
  /** SAS token that grants access to the container. */
46
48
  accessToken: string;
47
49
  /** if true, container is allowed to request the write lock. */
48
- writeable?: boolean;
50
+ readonly writeable?: boolean;
49
51
  /** if true, container is attached in "secure" mode (blocks are encrypted). Only supported in daemon mode. */
50
- secure?: boolean;
52
+ readonly secure?: boolean;
51
53
  /** string attached to log messages from CloudSQLite. This is most useful for identifying usage from daemon mode. */
52
- logId?: string;
54
+ readonly logId?: string;
53
55
  /** Duration for holding write lock, in seconds. After this time the write lock expires if not refreshed. Default is one hour. */
54
- lockExpireSeconds?: number;
56
+ readonly lockExpireSeconds?: number;
55
57
  /** number of seconds between auto-refresh of access token. If <=0 no auto-refresh. Default is 1 hour (60*60) */
56
- tokenRefreshSeconds?: number;
58
+ readonly tokenRefreshSeconds?: number;
57
59
  }
58
60
  /** Returned from `CloudContainer.queryDatabase` describing one database in the container */
59
61
  export interface CachedDbProps {
@@ -265,8 +267,23 @@ export declare namespace CloudSqlite {
265
267
  * a 404 error. Default is 1 hour.
266
268
  */
267
269
  nSeconds?: number;
268
- /** if enabled, outputs verbose logs about the cleanup process. These would include outputting blocks which are determined as eligible for deletion. */
270
+ /** if enabled, outputs verbose logs about the cleanup process. Output includes blocks determined eligible for deletion.
271
+ * @default false
272
+ */
269
273
  debugLogging?: boolean;
274
+ /** If true, iterates over all blobs in the cloud container to add blocks that are 'orphaned' to the delete list in the manifest.
275
+ * Orphaned blocks are created when a client abruptly halts, is disconnected, or encounters an error while uploading a change.
276
+ * If false, the search for 'orphaned' blocks is skipped and only any blocks which are already on the delete list are deleted.
277
+ * @default true
278
+ */
279
+ findOrphanedBlocks?: boolean;
280
+ /**
281
+ * a user-supplied progress function called during the cleanup operation. While the search for orphaned blocks occurs, nDeleted will be 0 and nTotalToDelete will be 1.
282
+ * Once the search is complete and orphaned blocks begin being deleted, nDeleted will be the number of blocks deleted and nTotalToDelete will be the total number of blocks to delete.
283
+ * If the return value is 1, the job will be cancelled and progress will be saved. If one or more blocks have already been deleted, then a new manifest file is uploaded saving the progress of the delete job.
284
+ * Return any other non-0 value to cancel the job without saving progress.
285
+ */
286
+ onProgress?: (nDeleted: number, nTotalToDelete: number) => number;
270
287
  }
271
288
  /**
272
289
  * A CloudSqlite container that may be connected to a CloudCache. A CloudContainer maps a container in a cloud blob-storage
@@ -394,14 +411,6 @@ export declare namespace CloudSqlite {
394
411
  * @see hasLocalChanges
395
412
  */
396
413
  uploadChanges(): Promise<void>;
397
- /**
398
- * Clean any unused deleted blocks from cloud storage. When a database is written, a subset of its blocks are replaced
399
- * by new versions, sometimes leaving the originals unused. In this case, they are not deleted immediately.
400
- * Instead, they are scheduled for deletion at some later time. Calling this method deletes all blocks in the cloud container
401
- * for which the scheduled deletion time has passed.
402
- * @param options options which influence the behavior of cleanDeletedBlocks. @see CleanDeletedBlocksOptions
403
- */
404
- cleanDeletedBlocks(options?: CleanDeletedBlocksOptions): Promise<void>;
405
414
  /**
406
415
  * Create a copy of an existing database within this CloudContainer with a new name.
407
416
  * @note CloudSqlite uses copy-on-write semantics for this operation. That is, this method merely makes a
@@ -409,8 +418,8 @@ export declare namespace CloudSqlite {
409
418
  * If either database subsequently changes, the only modified blocks are not shared.
410
419
  */
411
420
  copyDatabase(dbName: string, toAlias: string): Promise<void>;
412
- /** Remove a database from this CloudContainer.
413
- * @see cleanDeletedBlocks
421
+ /** Remove a database from this CloudContainer. Unused blocks are moved to the delete list in the manifest.
422
+ * @see [[CloudSqlite.cleanDeletedBlocks]] to actually delete the blocks from the delete list.
414
423
  */
415
424
  deleteDatabase(dbName: string): Promise<void>;
416
425
  /** Get the list of database names in this CloudContainer.
@@ -461,6 +470,16 @@ export declare namespace CloudSqlite {
461
470
  */
462
471
  promise: Promise<boolean>;
463
472
  }
473
+ /**
474
+ * Clean any unused deleted blocks from cloud storage. Unused deleted blocks can accumulate in cloud storage in a couple of ways:
475
+ * 1) When a database is updated, a subset of its blocks are replaced by new versions, sometimes leaving the originals unused.
476
+ * 2) A database is deleted with [[CloudContainer.deleteDatabase]]
477
+ * In both cases, the blocks are not deleted immediately. Instead, they are scheduled for deletion at some later time.
478
+ * Calling this method deletes all blocks in the cloud container for which the scheduled deletion time has passed.
479
+ * @param container the CloudContainer to be cleaned. Must be connected and hold the write lock.
480
+ * @param options options for the cleanup operation. @see CloudSqlite.CleanDeletedBlocksOptions
481
+ */
482
+ export function cleanDeletedBlocks(container: CloudContainer, options: CleanDeletedBlocksOptions): Promise<void>;
464
483
  /** @internal */
465
484
  export function transferDb(direction: TransferDirection, container: CloudContainer, props: TransferDbProps): Promise<void>;
466
485
  /** Upload a local SQLite database file into a CloudContainer.
@@ -591,16 +610,22 @@ export declare namespace CloudSqlite {
591
610
  /** Close the database for this DbAccess if it is opened, and disconnect this `DbAccess from its CloudContainer. */
592
611
  close(): void;
593
612
  /**
594
- * Initialize a cloud container to hold a Cloud SQliteDb. The container must first be created via its storage supplier api (e.g. Azure, or Google).
595
- * A valid sasToken that grants write access must be supplied. This function creates and uploads an empty database into the container.
613
+ * Initialize a cloud container to hold VersionedSqliteDbs. The container must first be created by [[createBlobContainer]].
614
+ * This function creates and uploads an empty database into the container.
596
615
  * @note this deletes any existing content in the container.
597
616
  */
598
617
  protected static _initializeDb(args: {
599
618
  dbType: typeof VersionedSqliteDb;
600
- props: ContainerAccessProps;
619
+ props: ContainerProps;
601
620
  dbName: string;
602
621
  blockSize?: "64K" | "4M";
603
622
  }): Promise<void>;
623
+ /**
624
+ * Create a new BlobContainer from the BlobContainer service to hold one or more VersionedSqliteDbs.
625
+ * @returns A ContainerProps that describes the newly created container.
626
+ * @note the current user must have administrator rights to create containers.
627
+ */
628
+ protected static createBlobContainer(args: Omit<BlobContainer.CreateNewContainerProps, "userToken">): Promise<CloudSqlite.ContainerProps>;
604
629
  /**
605
630
  * Synchronize the local cache of this database with any changes by made by others.
606
631
  * @note This is called automatically whenever any write operation is performed on this DbAccess. It is only necessary to
@@ -1 +1 @@
1
- {"version":3,"file":"CloudSqlite.d.ts","sourceRoot":"","sources":["../../src/CloudSqlite.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EACL,WAAW,EAA+B,WAAW,EAAE,UAAU,EAAU,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAC7H,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAI9D;;;GAGG;AACH,yBAAiB,WAAW,CAAC;IAK3B,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IACtF;;;OAGG;IACH,gBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAQ/E;IASD;;;;;OAKG;IACH,MAAM,UAAU,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,GAAG;QAAE,WAAW,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;KAAE,GAAG,cAAc,CAoChM;IAED,yFAAyF;IACzF,MAAM,UAAU,kBAAkB,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,aAAa,CAEjH;IACD,MAAM,WAAW,cAAc;QAC7B,oCAAoC;QACpC,WAAW,EAAE,OAAO,GAAG,QAAQ,CAAC;QAChC,sCAAsC;QACtC,OAAO,EAAE,MAAM,CAAC;QAChB,iCA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OD,0DAA0D;QACnD,OAAO;QAKd,mHAAmH;QAC5G,KAAK;QAKZ;;;;WAIG;yBACoB,aAAa,CAAC,IAAI,EAAE;YAAE,MAAM,EAAE,OAAO,iBAAiB,CAAC;YAAC,KAAK,EAAE,cAAc,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,KAAK,GAAG,IAAI,CAAA;SAAE;QAahJ;;;;WAIG;yBACoB,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,uBAAuB,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC;QAa/I;;;;;;;WAOG;QACI,oBAAoB;QAK3B;;;WAGG;QACI,WAAW,IAAI,MAAM;QAM5B;;;;;;;;WAQG;QACU,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE;YAAE,aAAa,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;QAmC1I,wFAAwF;QACxF,OAAO,CAAC,WAAW;QAOnB;;;;;;;;;;;;WAYG;QACH,IAAW,WAAW,mCAOrB;QAED;;;WAGG;QACH,IAAW,MAAM,6BAOhB;KACF;;CACF"}
@@ -30,8 +30,10 @@ var CloudSqlite;
30
30
  * If the service is unavailable or returns an error, an empty token is returned.
31
31
  */
32
32
  async function requestToken(args) {
33
- // allow the userToken to be supplied via Rpc. If not supplied, or blank, use the backend's accessToken.
34
- const userToken = args.userToken ? args.userToken : (await IModelHost_1.IModelHost.getAccessToken());
33
+ // allow the userToken to be supplied via args. If not supplied, or blank, use the backend's accessToken. If that fails, use the value from the current RPC request
34
+ let userToken = args.userToken ? args.userToken : await IModelHost_1.IModelHost.getAccessToken();
35
+ if (userToken === "")
36
+ userToken = tracing_1.RpcTrace.currentActivity?.accessToken ?? "";
35
37
  if (BlobContainerService_1.BlobContainer.service === undefined) {
36
38
  throw new Error(`BlobContainer.service is not defined`);
37
39
  }
@@ -104,13 +106,54 @@ var CloudSqlite;
104
106
  /** Disable logging */
105
107
  LoggingMask[LoggingMask["None"] = 0] = "None";
106
108
  })(LoggingMask = CloudSqlite.LoggingMask || (CloudSqlite.LoggingMask = {}));
109
+ /**
110
+ * Clean any unused deleted blocks from cloud storage. Unused deleted blocks can accumulate in cloud storage in a couple of ways:
111
+ * 1) When a database is updated, a subset of its blocks are replaced by new versions, sometimes leaving the originals unused.
112
+ * 2) A database is deleted with [[CloudContainer.deleteDatabase]]
113
+ * In both cases, the blocks are not deleted immediately. Instead, they are scheduled for deletion at some later time.
114
+ * Calling this method deletes all blocks in the cloud container for which the scheduled deletion time has passed.
115
+ * @param container the CloudContainer to be cleaned. Must be connected and hold the write lock.
116
+ * @param options options for the cleanup operation. @see CloudSqlite.CleanDeletedBlocksOptions
117
+ */
118
+ async function cleanDeletedBlocks(container, options) {
119
+ let timer;
120
+ try {
121
+ const cleanJob = new imodeljs_native_1.NativeLibrary.nativeLib.CancellableCloudSqliteJob("cleanup", container, options);
122
+ let total = 0;
123
+ const onProgress = options?.onProgress;
124
+ if (onProgress) {
125
+ timer = setInterval(async () => {
126
+ const progress = cleanJob.getProgress();
127
+ total = progress.total;
128
+ const result = onProgress(progress.loaded, progress.total);
129
+ if (result === 1)
130
+ cleanJob.stopAndSaveProgress();
131
+ else if (result !== 0)
132
+ cleanJob.cancelTransfer();
133
+ }, 250);
134
+ }
135
+ await cleanJob.promise;
136
+ onProgress?.(total, total); // make sure we call progress func one last time when download completes
137
+ container.checkForChanges(); // re-read the manifest so the number of garbage blocks is updated.
138
+ }
139
+ catch (err) {
140
+ if (err.message === "cancelled")
141
+ err.errorNumber = core_bentley_1.BriefcaseStatus.DownloadCancelled;
142
+ throw err;
143
+ }
144
+ finally {
145
+ if (timer)
146
+ clearInterval(timer);
147
+ }
148
+ }
149
+ CloudSqlite.cleanDeletedBlocks = cleanDeletedBlocks;
107
150
  /** @internal */
108
151
  async function transferDb(direction, container, props) {
109
152
  if (direction === "download")
110
153
  (0, fs_1.mkdirSync)((0, path_1.dirname)(props.localFileName), { recursive: true }); // make sure the directory exists before starting download
111
154
  let timer;
112
155
  try {
113
- const transfer = new imodeljs_native_1.NativeLibrary.nativeLib.CloudDbTransfer(direction, container, props);
156
+ const transfer = new imodeljs_native_1.NativeLibrary.nativeLib.CancellableCloudSqliteJob(direction, container, props);
114
157
  let total = 0;
115
158
  const onProgress = props.onProgress;
116
159
  if (onProgress) {
@@ -320,22 +363,38 @@ var CloudSqlite;
320
363
  this._container.disconnect();
321
364
  }
322
365
  /**
323
- * Initialize a cloud container to hold a Cloud SQliteDb. The container must first be created via its storage supplier api (e.g. Azure, or Google).
324
- * A valid sasToken that grants write access must be supplied. This function creates and uploads an empty database into the container.
366
+ * Initialize a cloud container to hold VersionedSqliteDbs. The container must first be created by [[createBlobContainer]].
367
+ * This function creates and uploads an empty database into the container.
325
368
  * @note this deletes any existing content in the container.
326
369
  */
327
370
  static async _initializeDb(args) {
328
- const container = createCloudContainer({ ...args.props, writeable: true });
371
+ const container = createCloudContainer({ ...args.props, writeable: true, accessToken: args.props.accessToken ?? await CloudSqlite.requestToken(args.props) });
329
372
  container.initializeContainer({ blockSize: args.blockSize === "4M" ? 4 * 1024 * 1024 : 64 * 1024 });
330
373
  container.connect(CloudCaches.getCache({ cacheName: this._cacheName }));
331
374
  await withWriteLock({ user: "initialize", container }, async () => {
332
375
  const localFileName = (0, path_1.join)(IModelHost_1.KnownLocations.tmpdir, "blank.db");
333
- args.dbType.createNewDb(localFileName);
376
+ args.dbType.createNewDb(localFileName, args);
334
377
  await transferDb("upload", container, { dbName: args.dbName, localFileName });
335
378
  (0, fs_1.unlinkSync)(localFileName);
336
379
  });
337
380
  container.disconnect({ detach: true });
338
381
  }
382
+ /**
383
+ * Create a new BlobContainer from the BlobContainer service to hold one or more VersionedSqliteDbs.
384
+ * @returns A ContainerProps that describes the newly created container.
385
+ * @note the current user must have administrator rights to create containers.
386
+ */
387
+ static async createBlobContainer(args) {
388
+ const service = BlobContainerService_1.BlobContainer.service;
389
+ if (undefined === service)
390
+ throw new Error("no BlobContainer service available");
391
+ const auth = IModelHost_1.IModelHost.authorizationClient;
392
+ if (undefined === auth)
393
+ throw new Error("no authorization client available");
394
+ const userToken = await auth.getAccessToken();
395
+ const cloudContainer = await service.create({ scope: args.scope, metadata: { ...args.metadata, containerType: "property-store" }, userToken });
396
+ return { baseUri: cloudContainer.baseUri, containerId: cloudContainer.containerId, storageType: cloudContainer.provider };
397
+ }
339
398
  /**
340
399
  * Synchronize the local cache of this database with any changes by made by others.
341
400
  * @note This is called automatically whenever any write operation is performed on this DbAccess. It is only necessary to