@itwin/core-backend 5.7.0-dev.8 → 5.8.0-dev.1

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 (102) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/lib/cjs/BriefcaseManager.d.ts +138 -1
  3. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseManager.js +336 -1
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/CloudSqlite.js +1 -1
  7. package/lib/cjs/CloudSqlite.js.map +1 -1
  8. package/lib/cjs/IModelDb.d.ts +71 -0
  9. package/lib/cjs/IModelDb.d.ts.map +1 -1
  10. package/lib/cjs/IModelDb.js +122 -6
  11. package/lib/cjs/IModelDb.js.map +1 -1
  12. package/lib/cjs/IModelHost.d.ts +15 -0
  13. package/lib/cjs/IModelHost.d.ts.map +1 -1
  14. package/lib/cjs/IModelHost.js +12 -0
  15. package/lib/cjs/IModelHost.js.map +1 -1
  16. package/lib/cjs/IModelJsFs.d.ts +2 -0
  17. package/lib/cjs/IModelJsFs.d.ts.map +1 -1
  18. package/lib/cjs/IModelJsFs.js +2 -0
  19. package/lib/cjs/IModelJsFs.js.map +1 -1
  20. package/lib/cjs/TileStorage.js +1 -1
  21. package/lib/cjs/TileStorage.js.map +1 -1
  22. package/lib/cjs/TxnManager.d.ts +41 -3
  23. package/lib/cjs/TxnManager.d.ts.map +1 -1
  24. package/lib/cjs/TxnManager.js +151 -3
  25. package/lib/cjs/TxnManager.js.map +1 -1
  26. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  27. package/lib/cjs/ViewDefinition.js +2 -0
  28. package/lib/cjs/ViewDefinition.js.map +1 -1
  29. package/lib/cjs/internal/IModelDbFontsImpl.js +1 -1
  30. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  31. package/lib/cjs/internal/IntegrityCheck.d.ts +240 -0
  32. package/lib/cjs/internal/IntegrityCheck.d.ts.map +1 -0
  33. package/lib/cjs/internal/IntegrityCheck.js +193 -0
  34. package/lib/cjs/internal/IntegrityCheck.js.map +1 -0
  35. package/lib/cjs/internal/annotations/fields.js +2 -2
  36. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  37. package/lib/cjs/rpc/tracing.js +2 -2
  38. package/lib/cjs/rpc/tracing.js.map +1 -1
  39. package/lib/cjs/workspace/Workspace.js +1 -1
  40. package/lib/cjs/workspace/Workspace.js.map +1 -1
  41. package/lib/esm/BriefcaseManager.d.ts +138 -1
  42. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  43. package/lib/esm/BriefcaseManager.js +336 -1
  44. package/lib/esm/BriefcaseManager.js.map +1 -1
  45. package/lib/esm/CloudSqlite.js +1 -1
  46. package/lib/esm/CloudSqlite.js.map +1 -1
  47. package/lib/esm/IModelDb.d.ts +71 -0
  48. package/lib/esm/IModelDb.d.ts.map +1 -1
  49. package/lib/esm/IModelDb.js +122 -6
  50. package/lib/esm/IModelDb.js.map +1 -1
  51. package/lib/esm/IModelHost.d.ts +15 -0
  52. package/lib/esm/IModelHost.d.ts.map +1 -1
  53. package/lib/esm/IModelHost.js +12 -0
  54. package/lib/esm/IModelHost.js.map +1 -1
  55. package/lib/esm/IModelJsFs.d.ts +2 -0
  56. package/lib/esm/IModelJsFs.d.ts.map +1 -1
  57. package/lib/esm/IModelJsFs.js +2 -0
  58. package/lib/esm/IModelJsFs.js.map +1 -1
  59. package/lib/esm/TileStorage.js +1 -1
  60. package/lib/esm/TileStorage.js.map +1 -1
  61. package/lib/esm/TxnManager.d.ts +41 -3
  62. package/lib/esm/TxnManager.d.ts.map +1 -1
  63. package/lib/esm/TxnManager.js +152 -4
  64. package/lib/esm/TxnManager.js.map +1 -1
  65. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  66. package/lib/esm/ViewDefinition.js +2 -0
  67. package/lib/esm/ViewDefinition.js.map +1 -1
  68. package/lib/esm/internal/IModelDbFontsImpl.js +1 -1
  69. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  70. package/lib/esm/internal/IntegrityCheck.d.ts +240 -0
  71. package/lib/esm/internal/IntegrityCheck.d.ts.map +1 -0
  72. package/lib/esm/internal/IntegrityCheck.js +187 -0
  73. package/lib/esm/internal/IntegrityCheck.js.map +1 -0
  74. package/lib/esm/internal/annotations/fields.js +2 -2
  75. package/lib/esm/internal/annotations/fields.js.map +1 -1
  76. package/lib/esm/rpc/tracing.js +2 -2
  77. package/lib/esm/rpc/tracing.js.map +1 -1
  78. package/lib/esm/test/SquashSchemaAndDataChanges.test.d.ts +2 -0
  79. package/lib/esm/test/SquashSchemaAndDataChanges.test.d.ts.map +1 -0
  80. package/lib/esm/test/SquashSchemaAndDataChanges.test.js +241 -0
  81. package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +1 -0
  82. package/lib/esm/test/hubaccess/Rebase.test.js +1575 -1568
  83. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  84. package/lib/esm/test/hubaccess/SemanticRebase.test.d.ts +2 -0
  85. package/lib/esm/test/hubaccess/SemanticRebase.test.d.ts.map +1 -0
  86. package/lib/esm/test/hubaccess/SemanticRebase.test.js +1206 -0
  87. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -0
  88. package/lib/esm/test/imodel/IModel.test.js +1 -1
  89. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  90. package/lib/esm/test/standalone/ChangesetReader.test.js +173 -2
  91. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  92. package/lib/esm/test/standalone/IntegrityCheck.test.d.ts +2 -0
  93. package/lib/esm/test/standalone/IntegrityCheck.test.d.ts.map +1 -0
  94. package/lib/esm/test/standalone/IntegrityCheck.test.js +385 -0
  95. package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -0
  96. package/lib/esm/test/standalone/ViewDefinition.test.js +14 -2
  97. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  98. package/lib/esm/test/standalone/Workspace.test.js +5 -0
  99. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  100. package/lib/esm/workspace/Workspace.js +1 -1
  101. package/lib/esm/workspace/Workspace.js.map +1 -1
  102. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAuDH,8CAkBC;AAvED,0BAA0B;AAE1B,sDAAwE;AACxE,oDAAgE;AAChE,6CAAgD;AAChD,oEAAiE;AACjE,8CAA2C;AAE3C,qDAAqD;AAErD;;;;;;GAMG;AACH,MAAa,QAAQ;IACX,MAAM,CAAC,QAAQ,GAAG,IAAI,+BAAiB,EAAE,CAAC;IAElD;;SAEK;IACE,MAAM,KAAK,eAAe;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAA6B,CAAC;IACjE,CAAC;IAED;;SAEK;IACE,MAAM,KAAK,qBAAqB;QACrC,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IAED,8CAA8C;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAI,QAAqB,EAAE,EAAoB;QACpE,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,QAAqB,EAAE,EAAoB;QAC5E,OAAO,sBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,IAAI,oBAAoB,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YAC1G,UAAU,EAAE;gBACV,GAAG,qBAAM,CAAC,WAAW,EAAE,EAAE,uBAAuB;gBAChD,GAAG,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,wCAAwC;aACpF;YACD,IAAI,EAAE,uBAAQ,CAAC,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;;AAhCH,4BAiCC;AAED,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,sBAA+B,KAAK;IACpE,2BAAa,CAAC,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,mDAAmD;IAEnI,IAAI,mBAAmB,EAAE,CAAC;QACxB,IAAI,CAAC;YACH,iEAAiE;YACjE,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE,uBAAU,CAAC,cAAc,CAAC,CAAC;YACrF,sBAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzC,2BAAa,CAAC,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,mEAAmE;QAC7J,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YACxF,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC","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 RpcInterface\r\n */\r\n\r\n// cspell:ignore calltrace\r\n\r\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\r\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\r\nimport { AsyncLocalStorage } from \"async_hooks\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\n\r\n/**\r\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\r\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\r\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\r\n * from the RpcActivity.\r\n * @public\r\n */\r\nexport class RpcTrace {\r\n private static _storage = new AsyncLocalStorage();\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\r\n * RpcActivity in the current call stack.\r\n * */\r\n public static get currentActivity(): RpcActivity | undefined {\r\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\r\n }\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\r\n * exists in the current call stack.\r\n * */\r\n public static get expectCurrentActivity(): RpcActivity {\r\n assert(undefined !== RpcTrace.currentActivity);\r\n return RpcTrace.currentActivity;\r\n }\r\n\r\n /** Start the processing of an RpcActivity. */\r\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return RpcTrace._storage.run(activity, fn);\r\n }\r\n\r\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\r\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\r\n attributes: {\r\n ...Logger.getMetaData(), // add default metadata\r\n ...RpcInvocation.sanitizeForLog(activity), // override with the correct RpcActivity\r\n },\r\n kind: SpanKind.INTERNAL,\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\r\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.run(activity, fn); // redirect the invocation processing to the tracer\r\n\r\n if (enableOpenTelemetry) {\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-require-imports\r\n const api = require(\"@opentelemetry/api\");\r\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\r\n Tracing.enableOpenTelemetry(tracer, api);\r\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.runWithSpan(activity, fn); // wrap invocation in an OpenTelemetry span in addition to RpcTrace\r\n } catch (e) {\r\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\r\n Logger.logException(BackendLoggerCategory.IModelHost, e);\r\n }\r\n }\r\n\r\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\r\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\r\n}\r\n"]}
1
+ {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAuDH,8CAkBC;AAvED,0BAA0B;AAE1B,sDAAwE;AACxE,oDAAgE;AAChE,6CAAgD;AAChD,oEAAiE;AACjE,8CAA2C;AAE3C,qDAAqD;AAErD;;;;;;GAMG;AACH,MAAa,QAAQ;IACX,MAAM,CAAC,QAAQ,GAAG,IAAI,+BAAiB,EAAE,CAAC;IAElD;;SAEK;IACE,MAAM,KAAK,eAAe;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAA6B,CAAC;IACjE,CAAC;IAED;;SAEK;IACE,MAAM,KAAK,qBAAqB;QACrC,IAAA,q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,CAAC;YACzC,2BAAa,CAAC,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,mEAAmE;QAC7J,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,qBAAM,CAAC,UAAU,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YAC1F,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC","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 RpcInterface\r\n */\r\n\r\n// cspell:ignore calltrace\r\n\r\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\r\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\r\nimport { AsyncLocalStorage } from \"async_hooks\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\n\r\n/**\r\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\r\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\r\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\r\n * from the RpcActivity.\r\n * @public\r\n */\r\nexport class RpcTrace {\r\n private static _storage = new AsyncLocalStorage();\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\r\n * RpcActivity in the current call stack.\r\n * */\r\n public static get currentActivity(): RpcActivity | undefined {\r\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\r\n }\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\r\n * exists in the current call stack.\r\n * */\r\n public static get expectCurrentActivity(): RpcActivity {\r\n assert(undefined !== RpcTrace.currentActivity);\r\n return RpcTrace.currentActivity;\r\n }\r\n\r\n /** Start the processing of an RpcActivity. */\r\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return RpcTrace._storage.run(activity, fn);\r\n }\r\n\r\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\r\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\r\n attributes: {\r\n ...Logger.getMetaData(), // add default metadata\r\n ...RpcInvocation.sanitizeForLog(activity), // override with the correct RpcActivity\r\n },\r\n kind: SpanKind.INTERNAL,\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\r\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.run(activity, fn); // redirect the invocation processing to the tracer\r\n\r\n if (enableOpenTelemetry) {\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-require-imports\r\n const api = require(\"@opentelemetry/api\");\r\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\r\n Tracing.enableOpenTelemetry(tracer, api);\r\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.runWithSpan(activity, fn); // wrap invocation in an OpenTelemetry span in addition to RpcTrace\r\n } catch (e) {\r\n Logger.logWarning(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\r\n Logger.logError(BackendLoggerCategory.IModelHost, e);\r\n }\r\n }\r\n\r\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\r\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\r\n}\r\n"]}
@@ -44,7 +44,7 @@ var Workspace;
44
44
  */
45
45
  Workspace.exceptionDiagnosticFn = (e) => {
46
46
  if (e instanceof Error)
47
- core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.Workspace, e);
47
+ core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.Workspace, e);
48
48
  else
49
49
  core_bentley_1.UnexpectedErrors.handle(e);
50
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2G;AAM3G,oEAAiE;AACjE,iDAAgE;AAuahE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,GAAG,sBAAsB,IAAI,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,IAAiB,qBAAqB,CAOrC;AAPD,WAAiB,qBAAqB;IACpC;;;;OAIG;IACU,wCAAkB,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;AAC1E,CAAC,EAPgB,qBAAqB,qCAArB,qBAAqB,QAOrC;AA+BD,SAAS,oBAAoB,CAAC,GAAkB,EAAE,IAAY,EAAE,IAAuB;IACrF,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpE,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAcD,YAAY;AACZ,IAA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AK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/B,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAhBe,wBAAc,iBAgB7B,CAAA;AACH,CAAC,EAtFgB,SAAS,yBAAT,SAAS,QAsFzB","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 Workspace\r\n */\r\n\r\nimport { AccessToken, BeEvent, ITwinError, Logger, Optional, UnexpectedErrors } from \"@itwin/core-bentley\";\r\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\r\nimport { CloudSqlite } from \"../CloudSqlite\";\r\nimport { SQLiteDb } from \"../SQLiteDb\";\r\nimport { SettingName, Settings, SettingsDictionary, SettingsPriority } from \"./Settings\";\r\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\n\r\n/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.\r\n * A valid `WorkspaceContainerId` must conform to the following constraints:\r\n * - Consist solely of a combination of lower case letters, numbers, and dashes.\r\n * - May not start or end with a dash.\r\n * - Must be at least 3 characters long and no longer than 63 characters.\r\n * @beta\r\n */\r\nexport type WorkspaceContainerId = string;\r\n\r\n/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].\r\n * @beta\r\n */\r\nexport interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, \"accessToken\"> {\r\n /** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].\r\n * @note This property defaults to `true`.\r\n */\r\n readonly syncOnConnect?: boolean;\r\n /** A user-friendly description of the container's contents. */\r\n readonly description?: string;\r\n /** A message to display to the user if problems occur while loading the container. */\r\n readonly loadingHelp?: string;\r\n}\r\n\r\n/** The base name of a [[WorkspaceDb]], without any version information.\r\n * The name must conform to the following constraints:\r\n * - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].\r\n * - Between 1 and 255 characters in length.\r\n * - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.\r\n * - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and \"#\".\r\n * - Begin or end with a whitespace character.\r\n * @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.\r\n * @beta\r\n */\r\nexport type WorkspaceDbName = string;\r\n\r\n/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format \"name:version\".\r\n * @beta\r\n */\r\nexport type WorkspaceDbFullName = string;\r\n\r\n/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., \"4.2.11\".\r\n * @beta\r\n */\r\nexport type WorkspaceDbVersion = CloudSqlite.DbVersion;\r\n\r\n/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,\r\n * e.g., \">=1.2.7 <1.3.0\".\r\n * @beta\r\n */\r\nexport type WorkspaceDbVersionRange = CloudSqlite.DbVersionRange;\r\n\r\n/** Specifies the name and version of a [[WorkspaceDb]].\r\n * @beta\r\n */\r\nexport type WorkspaceDbNameAndVersion = Optional<CloudSqlite.DbNameAndVersion, \"dbName\">;\r\n\r\n/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {\r\n /** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., \"1.4.2-beta.0\".\r\n * By default, only released version are allowed.\r\n */\r\n readonly includePrerelease?: boolean;\r\n /** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */\r\n readonly prefetch?: boolean;\r\n}\r\n\r\n/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.\r\n * @beta\r\n */\r\nexport type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;\r\n\r\n/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.\r\n * @beta\r\n */\r\nexport type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;\r\n\r\n/** Arguments supplied to [[WorkspaceDb.queryResources]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbQueryResourcesArgs {\r\n /** The type of resource to query. */\r\n type?: \"string\" | \"blob\";\r\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\r\n * Only resources whose names match the pattern will be included in the query results.\r\n */\r\n namePattern?: string;\r\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\r\n * Only resources whose names match the pattern will be included in the query results.\r\n * Ignored if [[namePattern]] is undefined.\r\n */\r\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\r\n /** A function invoked to process the resources that match the query criterion. */\r\n callback: WorkspaceDbQueryResourcesCallback;\r\n}\r\n\r\n/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to\r\n * contact with questions about it, and so on.\r\n * @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.\r\n * @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.\r\n * @beta\r\n */\r\nexport interface WorkspaceDbManifest {\r\n /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough\r\n * so that users may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in\r\n * lists of WorkspaceDbs.\r\n * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).\r\n */\r\n readonly workspaceName: string;\r\n /** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */\r\n readonly description?: string;\r\n /** The name of the person to contact with questions about this [[WorkspaceDb]]. */\r\n readonly contactName?: string;\r\n /** The name of the person who last modified this [[WorkspaceDb]]. */\r\n readonly lastEditedBy?: string;\r\n}\r\n\r\n/**\r\n * An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user\r\n * is not authorized to access its [[WorkspaceContainer]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbLoadError extends ITwinError {\r\n /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */\r\n wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;\r\n /** The [[WorkspaceDb]] in which the error occurred, if available. */\r\n wsDb?: WorkspaceDb;\r\n}\r\n\r\n/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].\r\n * This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]\r\n * so that the user can be notified of the problems.\r\n * @beta\r\n */\r\nexport interface WorkspaceDbLoadErrors extends ITwinError {\r\n /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem\r\n * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..\r\n */\r\n wsLoadErrors?: WorkspaceDbLoadError[];\r\n}\r\n\r\n/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].\r\n * Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {\r\n /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */\r\n resourceName: string;\r\n /** The priority to assign to the [[SettingsDictionary]]. */\r\n priority: SettingsPriority;\r\n}\r\n\r\n/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].\r\n * Resource names must conform to the following constraints:\r\n * - At least 1 character and no more than 1024 characters in length.\r\n * - No leading or trailing whitespace characters.\r\n * Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define\r\n * resources with the same name but different types.\r\n * @beta\r\n */\r\nexport type WorkspaceResourceName = string;\r\n\r\n/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.\r\n * Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:\r\n * - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.\r\n * - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].\r\n * - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.\r\n *\r\n * Ultimately, each resource is stored in one of the following formats:\r\n * - A `string`, which is often a stringified `JSON` representation of the resource;\r\n * - A binary `blob`; or\r\n * - An embedded file.\r\n *\r\n * Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software\r\n * that uses them is written to access them from disk.\r\n *\r\n * A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.\r\n * However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.\r\n * `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).\r\n *\r\n * The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain\r\n * a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain\r\n * a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].\r\n *\r\n * You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDb {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n /** The [[WorkspaceContainer]] in which this db resides. */\r\n readonly container: WorkspaceContainer;\r\n /** The base name of this WorkspaceDb, without version */\r\n readonly dbName: WorkspaceDbName;\r\n /** An event raised before this WorkspaceDb is [[close]]d. */\r\n readonly onClose: BeEvent<() => void>;\r\n /** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */\r\n readonly dbFileName: string;\r\n /** The underlying SQLite database that stores this WorkspaceDb's resources. */\r\n readonly sqliteDb: SQLiteDb;\r\n /** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */\r\n readonly isOpen: boolean;\r\n /** The manifest that describes the contents and context of this WorkspaceDb. */\r\n readonly manifest: WorkspaceDbManifest;\r\n /** The version of this WorkspaceDb */\r\n readonly version: WorkspaceDbVersion;\r\n\r\n /** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,\r\n * when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.\r\n * Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.\r\n */\r\n open(): void;\r\n\r\n /** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */\r\n close(): void;\r\n\r\n /** Look up a string resource by name, if one exists. */\r\n getString(rscName: WorkspaceResourceName): string | undefined;\r\n\r\n /** Look up a binary resource by name, if one exists. */\r\n getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;\r\n\r\n /** Get a BlobIO reader for a blob WorkspaceResource.\r\n * @note when finished, caller *must* call `close` on the BlobIO.\r\n * @internal\r\n */\r\n getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;\r\n\r\n /**\r\n * Extract a local copy of a file resource from this WorkspaceDb, if present.\r\n * @param rscName The name of the file resource in the WorkspaceDb\r\n * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If\r\n * you know the full path to use for the extracted file, you can supply it. Generally, it is best to *not* supply the filename and\r\n * keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].\r\n * @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.\r\n * @note The file is copied from the file into the local file system so it may be accessed directly. This happens only\r\n * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.\r\n * For this reason, you should not save the local file name, and instead call this method every time you access it, so its\r\n * content is always holds the correct version.\r\n * @note The filename will be a hash value, not the resource name.\r\n * @note Workspace resource files are set as read-only as they are copied from the file.\r\n * To edit them, you must first copy them to another location.\r\n */\r\n getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;\r\n\r\n /**\r\n * Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.\r\n * Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.\r\n * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.\r\n * @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.\r\n * @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].\r\n */\r\n prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;\r\n\r\n /** Find resources of a particular type with names matching a specified pattern.\r\n * The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].\r\n * @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.\r\n */\r\n queryResources(args: WorkspaceDbQueryResourcesArgs): void;\r\n\r\n /** @internal */\r\n queryFileResource(rscName: WorkspaceResourceName): { localFileName: LocalFileName, info: IModelJsNative.EmbedFileQuery } | undefined;\r\n}\r\n\r\n/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].\r\n * @beta\r\n */\r\nexport interface WorkspaceOpts {\r\n /** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory\r\n * for files named `${containerId}/${dbId}.itwin-workspace`.\r\n * @note if not supplied, defaults to \"iTwin/Workspace\" in the user-local folder.\r\n */\r\n containerDir?: LocalDirName;\r\n\r\n /** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */\r\n settingsFiles?: LocalFileName | LocalFileName[];\r\n}\r\n\r\n/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].\r\n * @beta\r\n */\r\nexport interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {\r\n /** Token required to access the container. */\r\n accessToken: AccessToken;\r\n}\r\n\r\n/**\r\n * Settings and resources that customize an application for the current session.\r\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\r\n * @beta\r\n */\r\nexport interface Workspace {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n\r\n /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.\r\n * @internal\r\n */\r\n readonly containerDir: LocalDirName;\r\n\r\n /** The current [[Settings]] for this Workspace */\r\n readonly settings: Settings;\r\n\r\n /** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */\r\n getCloudCache(): CloudSqlite.CloudCache;\r\n\r\n /** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].\r\n * @param containerId The id of the container\r\n * @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.\r\n * @internal\r\n */\r\n findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;\r\n\r\n /** Obtain the [[WorkspaceContainer]] specified by `props`.\r\n * @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.\r\n * Otherwise it is created.\r\n * @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,\r\n * hence this function is async.\r\n * @see [[getContainer]] to obtain a container synchronously.\r\n */\r\n getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;\r\n\r\n /** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:\r\n * - a valid [AccessToken]($bentley) is already available;\r\n * - the container has already been previously prefetched in another session (this is useful for offline usage); or\r\n * - the container is public and doesn't require an [AccessToken]($bentley).\r\n * @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.\r\n */\r\n getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;\r\n\r\n /** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].\r\n * @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in\r\n * the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be \"chained\" together so that loading one\r\n * causes its \"dependent\" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).\r\n */\r\n loadSettingsDictionary(\r\n /** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */\r\n props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],\r\n /** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */\r\n problems?: WorkspaceDbLoadError[]\r\n ): Promise<void>;\r\n\r\n /** Get a single [[WorkspaceDb]]. */\r\n getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;\r\n\r\n /**\r\n * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]\r\n * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].\r\n * The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].\r\n * @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the\r\n * properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].\r\n * @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes\r\n * be useful for editors, tests, or diagnostics.\r\n */\r\n resolveWorkspaceDbSetting(\r\n /** the name of the setting. */\r\n settingName: SettingName,\r\n /** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */\r\n filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];\r\n\r\n /**\r\n * Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will\r\n * use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].\r\n * @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence\r\n * over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.\r\n * @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.\r\n */\r\n getWorkspaceDbs(\r\n args: Workspace.DbListOrSettingName & {\r\n /** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */\r\n problems?: WorkspaceDbLoadError[];\r\n /** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */\r\n filter?: Workspace.DbListFilter;\r\n }): Promise<WorkspaceDb[]>;\r\n}\r\n\r\n/**\r\n * A WorkspaceContainer is a type of [[CloudSqlite.CloudContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.\r\n * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that\r\n * older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually\r\n * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).\r\n * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.\r\n * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.\r\n * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.\r\n * In this case, [[cloudContainer]] will be `undefined`.\r\n * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.\r\n * @beta\r\n */\r\nexport interface WorkspaceContainer {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.\r\n * @internal\r\n */\r\n readonly filesDir: LocalDirName;\r\n /** The workspace into which this container was loaded. */\r\n readonly workspace: Workspace;\r\n /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */\r\n readonly cloudContainer?: CloudSqlite.CloudContainer;\r\n /** Properties supplied when this container was loaded */\r\n readonly fromProps: WorkspaceContainerProps;\r\n\r\n /** @internal */\r\n addWorkspaceDb(toAdd: WorkspaceDb): void;\r\n\r\n /**\r\n * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.\r\n * @throws Error if no version satisfying the criteria exists.\r\n */\r\n resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;\r\n\r\n /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */\r\n getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;\r\n\r\n /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.\r\n * @internal\r\n */\r\n closeWorkspaceDb(container: WorkspaceDb): void;\r\n}\r\n\r\nfunction makeSettingName(name: string) {\r\n return `${\"itwin/core/workspace\"}/${name}`;\r\n}\r\n\r\n/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.\r\n * @beta\r\n */\r\nexport namespace WorkspaceSettingNames {\r\n /** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically\r\n * be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]\r\n * to others upon which they depend.\r\n * This setting's value is an array of [[WorkspaceDbSettingsProps]]s.\r\n */\r\n export const settingsWorkspaces = makeSettingName(\"settingsWorkspaces\");\r\n}\r\n\r\n/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].\r\n * The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.\r\n * @beta\r\n */\r\nexport type QueryWorkspaceResourcesCallback = (resources: Iterable<{ name: string, db: WorkspaceDb }>) => void;\r\n\r\n/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.\r\n * @beta\r\n */\r\nexport interface QueryWorkspaceResourcesArgs {\r\n /** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.\r\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\r\n */\r\n dbs: WorkspaceDb[];\r\n /** The type of resource to query. */\r\n type?: \"string\" | \"blob\";\r\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\r\n * Only resources whose names match the pattern will be included in the query results.\r\n */\r\n namePattern?: string;\r\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\r\n * Only resources whose names match the pattern will be included in the query results.\r\n * Ignored i [[namePattern]] is undefined.\r\n */\r\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\r\n /** A function invoked to process the resources that match the query criteria. */\r\n callback: QueryWorkspaceResourcesCallback;\r\n}\r\n\r\nfunction getWorkspaceResource(dbs: WorkspaceDb[], name: string, type: \"string\" | \"blob\"): string | Uint8Array | undefined {\r\n for (const db of dbs) {\r\n const val = type === \"blob\" ? db.getBlob(name) : db.getString(name);\r\n if (undefined !== val) {\r\n return val;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\n/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].\r\n * @beta\r\n */\r\nexport interface GetWorkspaceResourceArgs {\r\n /** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.\r\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\r\n */\r\n dbs: WorkspaceDb[];\r\n /** The name of the resource to find. */\r\n name: WorkspaceResourceName;\r\n}\r\n\r\n/** @beta */\r\nexport namespace Workspace {\r\n /** A function invoked to handle exceptions produced while loading workspace data.\r\n * Applications can override this function to notify the user and/or attempt to diagnose the problem.\r\n * The default implementation simply logs each exception.\r\n */\r\n export let exceptionDiagnosticFn = (e: WorkspaceDbLoadErrors) => { // eslint-disable-line prefer-const\r\n if (e instanceof Error)\r\n Logger.logException(BackendLoggerCategory.Workspace, e);\r\n else\r\n UnexpectedErrors.handle(e);\r\n };\r\n\r\n /** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */\r\n export interface SettingsDictionaryLoaded {\r\n /** The dictionary that was loaded */\r\n dict: SettingsDictionary;\r\n /** The WorkspaceDb from which the dictionary was loaded. */\r\n from: WorkspaceDb;\r\n }\r\n\r\n /** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].\r\n * Applications can override this function to notify the user and/or record diagnostics.\r\n * The default implementation simply records an information message in the [Logger]($bentley).\r\n */\r\n export let onSettingsDictionaryLoadedFn = (loaded: SettingsDictionaryLoaded) => { // eslint-disable-line prefer-const\r\n Logger.logInfo(BackendLoggerCategory.Workspace, `loaded setting dictionary ${loaded.dict.props.name} from ${loaded.from.dbFileName}`);\r\n };\r\n\r\n /** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].\r\n * Used by [[Workspace.getWorkspaceDbs]].\r\n */\r\n export type DbListOrSettingName = { readonly dbs: WorkspaceDbCloudProps[], readonly settingName?: never } | { readonly settingName: SettingName, readonly dbs?: never };\r\n\r\n /** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some\r\n * [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.\r\n */\r\n export type DbListFilter = (\r\n /** The properties of the WorkspaceDb to be returned */\r\n dbProp: WorkspaceDbCloudProps,\r\n /** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the\r\n * [[SettingsPriority]] of the dictionary.\r\n */\r\n dict: SettingsDictionary\r\n ) => boolean;\r\n\r\n /** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.\r\n * The list is searched in order, and the first resource with the request name is returned.\r\n * If no such resource exists, the function returns `undefined`.\r\n * @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.\r\n * @beta\r\n */\r\n export function getStringResource(args: GetWorkspaceResourceArgs): string | undefined {\r\n return getWorkspaceResource(args.dbs, args.name, \"string\") as string | undefined;\r\n }\r\n\r\n /** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.\r\n * The list is searched in order, and the first resource with the request name is returned.\r\n * If no such resource exists, the function returns `undefined`.\r\n * @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.\r\n * @beta\r\n */\r\n export function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined {\r\n return getWorkspaceResource(args.dbs, args.name, \"blob\") as Uint8Array | undefined;\r\n }\r\n\r\n /** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.\r\n * @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.\r\n * @beta\r\n */\r\n export function queryResources(args: QueryWorkspaceResourcesArgs): void {\r\n const resources: Array<{ name: string, db: WorkspaceDb }> = [];\r\n for (const db of args.dbs) {\r\n db.queryResources({\r\n type: args.type,\r\n namePattern: args.namePattern,\r\n nameCompare: args.nameCompare,\r\n callback: (names) => {\r\n for (const name of names) {\r\n resources.push({ db, name });\r\n }\r\n },\r\n });\r\n }\r\n\r\n args.callback(resources);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2G;AAM3G,oEAAiE;AACjE,iDAAgE;AAuahE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,GAAG,sBAAsB,IAAI,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,IAAiB,qBAAqB,CAOrC;AAPD,WAAiB,qBAAqB;IACpC;;;;OAIG;IACU,wCAAkB,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;AAC1E,CAAC,EAPgB,qBAAqB,qCAArB,qBAAqB,QAOrC;AA+BD,SAAS,oBAAoB,CAAC,GAAkB,EAAE,IAAY,EAAE,IAAuB;IACrF,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpE,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAcD,YAAY;AACZ,IAAiB,SAAS,CAsFzB;AAtFD,WAAiB,SAAS;IACxB;;;OAGG;IACQ,+BAAqB,GAAG,CAAC,CAAwB,EAAE,EAAE;QAC9D,IAAI,CAAC,YAAY,KAAK;YACpB,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;;YAEpD,+BAAgB,CAAC,MAAM,CAAC,CAAC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BAgB7B,CAAA;AACH,CAAC,EAtFgB,SAAS,yBAAT,SAAS,QAsFzB","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 Workspace\r\n */\r\n\r\nimport { AccessToken, BeEvent, ITwinError, Logger, Optional, UnexpectedErrors } from \"@itwin/core-bentley\";\r\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\r\nimport { CloudSqlite } from \"../CloudSqlite\";\r\nimport { SQLiteDb } from \"../SQLiteDb\";\r\nimport { SettingName, Settings, SettingsDictionary, SettingsPriority } from \"./Settings\";\r\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\n\r\n/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.\r\n * A valid `WorkspaceContainerId` must conform to the following constraints:\r\n * - Consist solely of a combination of lower case letters, numbers, and dashes.\r\n * - May not start or end with a dash.\r\n * - Must be at least 3 characters long and no longer than 63 characters.\r\n * @beta\r\n */\r\nexport type WorkspaceContainerId = string;\r\n\r\n/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].\r\n * @beta\r\n */\r\nexport interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, \"accessToken\"> {\r\n /** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].\r\n * @note This property defaults to `true`.\r\n */\r\n readonly syncOnConnect?: boolean;\r\n /** A user-friendly description of the container's contents. */\r\n readonly description?: string;\r\n /** A message to display to the user if problems occur while loading the container. */\r\n readonly loadingHelp?: string;\r\n}\r\n\r\n/** The base name of a [[WorkspaceDb]], without any version information.\r\n * The name must conform to the following constraints:\r\n * - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].\r\n * - Between 1 and 255 characters in length.\r\n * - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.\r\n * - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and \"#\".\r\n * - Begin or end with a whitespace character.\r\n * @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.\r\n * @beta\r\n */\r\nexport type WorkspaceDbName = string;\r\n\r\n/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format \"name:version\".\r\n * @beta\r\n */\r\nexport type WorkspaceDbFullName = string;\r\n\r\n/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., \"4.2.11\".\r\n * @beta\r\n */\r\nexport type WorkspaceDbVersion = CloudSqlite.DbVersion;\r\n\r\n/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,\r\n * e.g., \">=1.2.7 <1.3.0\".\r\n * @beta\r\n */\r\nexport type WorkspaceDbVersionRange = CloudSqlite.DbVersionRange;\r\n\r\n/** Specifies the name and version of a [[WorkspaceDb]].\r\n * @beta\r\n */\r\nexport type WorkspaceDbNameAndVersion = Optional<CloudSqlite.DbNameAndVersion, \"dbName\">;\r\n\r\n/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {\r\n /** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., \"1.4.2-beta.0\".\r\n * By default, only released version are allowed.\r\n */\r\n readonly includePrerelease?: boolean;\r\n /** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */\r\n readonly prefetch?: boolean;\r\n}\r\n\r\n/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.\r\n * @beta\r\n */\r\nexport type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;\r\n\r\n/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.\r\n * @beta\r\n */\r\nexport type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;\r\n\r\n/** Arguments supplied to [[WorkspaceDb.queryResources]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbQueryResourcesArgs {\r\n /** The type of resource to query. */\r\n type?: \"string\" | \"blob\";\r\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\r\n * Only resources whose names match the pattern will be included in the query results.\r\n */\r\n namePattern?: string;\r\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\r\n * Only resources whose names match the pattern will be included in the query results.\r\n * Ignored if [[namePattern]] is undefined.\r\n */\r\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\r\n /** A function invoked to process the resources that match the query criterion. */\r\n callback: WorkspaceDbQueryResourcesCallback;\r\n}\r\n\r\n/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to\r\n * contact with questions about it, and so on.\r\n * @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.\r\n * @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.\r\n * @beta\r\n */\r\nexport interface WorkspaceDbManifest {\r\n /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough\r\n * so that users may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in\r\n * lists of WorkspaceDbs.\r\n * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).\r\n */\r\n readonly workspaceName: string;\r\n /** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */\r\n readonly description?: string;\r\n /** The name of the person to contact with questions about this [[WorkspaceDb]]. */\r\n readonly contactName?: string;\r\n /** The name of the person who last modified this [[WorkspaceDb]]. */\r\n readonly lastEditedBy?: string;\r\n}\r\n\r\n/**\r\n * An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user\r\n * is not authorized to access its [[WorkspaceContainer]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbLoadError extends ITwinError {\r\n /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */\r\n wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;\r\n /** The [[WorkspaceDb]] in which the error occurred, if available. */\r\n wsDb?: WorkspaceDb;\r\n}\r\n\r\n/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].\r\n * This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]\r\n * so that the user can be notified of the problems.\r\n * @beta\r\n */\r\nexport interface WorkspaceDbLoadErrors extends ITwinError {\r\n /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem\r\n * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..\r\n */\r\n wsLoadErrors?: WorkspaceDbLoadError[];\r\n}\r\n\r\n/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].\r\n * Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {\r\n /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */\r\n resourceName: string;\r\n /** The priority to assign to the [[SettingsDictionary]]. */\r\n priority: SettingsPriority;\r\n}\r\n\r\n/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].\r\n * Resource names must conform to the following constraints:\r\n * - At least 1 character and no more than 1024 characters in length.\r\n * - No leading or trailing whitespace characters.\r\n * Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define\r\n * resources with the same name but different types.\r\n * @beta\r\n */\r\nexport type WorkspaceResourceName = string;\r\n\r\n/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.\r\n * Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:\r\n * - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.\r\n * - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].\r\n * - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.\r\n *\r\n * Ultimately, each resource is stored in one of the following formats:\r\n * - A `string`, which is often a stringified `JSON` representation of the resource;\r\n * - A binary `blob`; or\r\n * - An embedded file.\r\n *\r\n * Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software\r\n * that uses them is written to access them from disk.\r\n *\r\n * A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.\r\n * However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.\r\n * `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).\r\n *\r\n * The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain\r\n * a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain\r\n * a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].\r\n *\r\n * You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].\r\n * @beta\r\n */\r\nexport interface WorkspaceDb {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n /** The [[WorkspaceContainer]] in which this db resides. */\r\n readonly container: WorkspaceContainer;\r\n /** The base name of this WorkspaceDb, without version */\r\n readonly dbName: WorkspaceDbName;\r\n /** An event raised before this WorkspaceDb is [[close]]d. */\r\n readonly onClose: BeEvent<() => void>;\r\n /** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */\r\n readonly dbFileName: string;\r\n /** The underlying SQLite database that stores this WorkspaceDb's resources. */\r\n readonly sqliteDb: SQLiteDb;\r\n /** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */\r\n readonly isOpen: boolean;\r\n /** The manifest that describes the contents and context of this WorkspaceDb. */\r\n readonly manifest: WorkspaceDbManifest;\r\n /** The version of this WorkspaceDb */\r\n readonly version: WorkspaceDbVersion;\r\n\r\n /** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,\r\n * when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.\r\n * Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.\r\n */\r\n open(): void;\r\n\r\n /** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */\r\n close(): void;\r\n\r\n /** Look up a string resource by name, if one exists. */\r\n getString(rscName: WorkspaceResourceName): string | undefined;\r\n\r\n /** Look up a binary resource by name, if one exists. */\r\n getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;\r\n\r\n /** Get a BlobIO reader for a blob WorkspaceResource.\r\n * @note when finished, caller *must* call `close` on the BlobIO.\r\n * @internal\r\n */\r\n getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;\r\n\r\n /**\r\n * Extract a local copy of a file resource from this WorkspaceDb, if present.\r\n * @param rscName The name of the file resource in the WorkspaceDb\r\n * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If\r\n * you know the full path to use for the extracted file, you can supply it. Generally, it is best to *not* supply the filename and\r\n * keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].\r\n * @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.\r\n * @note The file is copied from the file into the local file system so it may be accessed directly. This happens only\r\n * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.\r\n * For this reason, you should not save the local file name, and instead call this method every time you access it, so its\r\n * content is always holds the correct version.\r\n * @note The filename will be a hash value, not the resource name.\r\n * @note Workspace resource files are set as read-only as they are copied from the file.\r\n * To edit them, you must first copy them to another location.\r\n */\r\n getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;\r\n\r\n /**\r\n * Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.\r\n * Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.\r\n * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.\r\n * @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.\r\n * @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].\r\n */\r\n prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;\r\n\r\n /** Find resources of a particular type with names matching a specified pattern.\r\n * The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].\r\n * @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.\r\n */\r\n queryResources(args: WorkspaceDbQueryResourcesArgs): void;\r\n\r\n /** @internal */\r\n queryFileResource(rscName: WorkspaceResourceName): { localFileName: LocalFileName, info: IModelJsNative.EmbedFileQuery } | undefined;\r\n}\r\n\r\n/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].\r\n * @beta\r\n */\r\nexport interface WorkspaceOpts {\r\n /** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory\r\n * for files named `${containerId}/${dbId}.itwin-workspace`.\r\n * @note if not supplied, defaults to \"iTwin/Workspace\" in the user-local folder.\r\n */\r\n containerDir?: LocalDirName;\r\n\r\n /** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */\r\n settingsFiles?: LocalFileName | LocalFileName[];\r\n}\r\n\r\n/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].\r\n * @beta\r\n */\r\nexport interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {\r\n /** Token required to access the container. */\r\n accessToken: AccessToken;\r\n}\r\n\r\n/**\r\n * Settings and resources that customize an application for the current session.\r\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\r\n * @beta\r\n */\r\nexport interface Workspace {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n\r\n /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.\r\n * @internal\r\n */\r\n readonly containerDir: LocalDirName;\r\n\r\n /** The current [[Settings]] for this Workspace */\r\n readonly settings: Settings;\r\n\r\n /** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */\r\n getCloudCache(): CloudSqlite.CloudCache;\r\n\r\n /** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].\r\n * @param containerId The id of the container\r\n * @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.\r\n * @internal\r\n */\r\n findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;\r\n\r\n /** Obtain the [[WorkspaceContainer]] specified by `props`.\r\n * @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.\r\n * Otherwise it is created.\r\n * @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,\r\n * hence this function is async.\r\n * @see [[getContainer]] to obtain a container synchronously.\r\n */\r\n getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;\r\n\r\n /** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:\r\n * - a valid [AccessToken]($bentley) is already available;\r\n * - the container has already been previously prefetched in another session (this is useful for offline usage); or\r\n * - the container is public and doesn't require an [AccessToken]($bentley).\r\n * @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.\r\n */\r\n getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;\r\n\r\n /** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].\r\n * @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in\r\n * the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be \"chained\" together so that loading one\r\n * causes its \"dependent\" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).\r\n */\r\n loadSettingsDictionary(\r\n /** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */\r\n props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],\r\n /** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */\r\n problems?: WorkspaceDbLoadError[]\r\n ): Promise<void>;\r\n\r\n /** Get a single [[WorkspaceDb]]. */\r\n getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;\r\n\r\n /**\r\n * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]\r\n * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].\r\n * The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].\r\n * @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the\r\n * properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].\r\n * @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes\r\n * be useful for editors, tests, or diagnostics.\r\n */\r\n resolveWorkspaceDbSetting(\r\n /** the name of the setting. */\r\n settingName: SettingName,\r\n /** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */\r\n filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];\r\n\r\n /**\r\n * Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will\r\n * use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].\r\n * @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence\r\n * over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.\r\n * @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.\r\n */\r\n getWorkspaceDbs(\r\n args: Workspace.DbListOrSettingName & {\r\n /** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */\r\n problems?: WorkspaceDbLoadError[];\r\n /** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */\r\n filter?: Workspace.DbListFilter;\r\n }): Promise<WorkspaceDb[]>;\r\n}\r\n\r\n/**\r\n * A WorkspaceContainer is a type of [[CloudSqlite.CloudContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.\r\n * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that\r\n * older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually\r\n * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).\r\n * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.\r\n * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.\r\n * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.\r\n * In this case, [[cloudContainer]] will be `undefined`.\r\n * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.\r\n * @beta\r\n */\r\nexport interface WorkspaceContainer {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.\r\n * @internal\r\n */\r\n readonly filesDir: LocalDirName;\r\n /** The workspace into which this container was loaded. */\r\n readonly workspace: Workspace;\r\n /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */\r\n readonly cloudContainer?: CloudSqlite.CloudContainer;\r\n /** Properties supplied when this container was loaded */\r\n readonly fromProps: WorkspaceContainerProps;\r\n\r\n /** @internal */\r\n addWorkspaceDb(toAdd: WorkspaceDb): void;\r\n\r\n /**\r\n * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.\r\n * @throws Error if no version satisfying the criteria exists.\r\n */\r\n resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;\r\n\r\n /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */\r\n getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;\r\n\r\n /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.\r\n * @internal\r\n */\r\n closeWorkspaceDb(container: WorkspaceDb): void;\r\n}\r\n\r\nfunction makeSettingName(name: string) {\r\n return `${\"itwin/core/workspace\"}/${name}`;\r\n}\r\n\r\n/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.\r\n * @beta\r\n */\r\nexport namespace WorkspaceSettingNames {\r\n /** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically\r\n * be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]\r\n * to others upon which they depend.\r\n * This setting's value is an array of [[WorkspaceDbSettingsProps]]s.\r\n */\r\n export const settingsWorkspaces = makeSettingName(\"settingsWorkspaces\");\r\n}\r\n\r\n/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].\r\n * The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.\r\n * @beta\r\n */\r\nexport type QueryWorkspaceResourcesCallback = (resources: Iterable<{ name: string, db: WorkspaceDb }>) => void;\r\n\r\n/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.\r\n * @beta\r\n */\r\nexport interface QueryWorkspaceResourcesArgs {\r\n /** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.\r\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\r\n */\r\n dbs: WorkspaceDb[];\r\n /** The type of resource to query. */\r\n type?: \"string\" | \"blob\";\r\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\r\n * Only resources whose names match the pattern will be included in the query results.\r\n */\r\n namePattern?: string;\r\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\r\n * Only resources whose names match the pattern will be included in the query results.\r\n * Ignored i [[namePattern]] is undefined.\r\n */\r\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\r\n /** A function invoked to process the resources that match the query criteria. */\r\n callback: QueryWorkspaceResourcesCallback;\r\n}\r\n\r\nfunction getWorkspaceResource(dbs: WorkspaceDb[], name: string, type: \"string\" | \"blob\"): string | Uint8Array | undefined {\r\n for (const db of dbs) {\r\n const val = type === \"blob\" ? db.getBlob(name) : db.getString(name);\r\n if (undefined !== val) {\r\n return val;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\n/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].\r\n * @beta\r\n */\r\nexport interface GetWorkspaceResourceArgs {\r\n /** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.\r\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\r\n */\r\n dbs: WorkspaceDb[];\r\n /** The name of the resource to find. */\r\n name: WorkspaceResourceName;\r\n}\r\n\r\n/** @beta */\r\nexport namespace Workspace {\r\n /** A function invoked to handle exceptions produced while loading workspace data.\r\n * Applications can override this function to notify the user and/or attempt to diagnose the problem.\r\n * The default implementation simply logs each exception.\r\n */\r\n export let exceptionDiagnosticFn = (e: WorkspaceDbLoadErrors) => { // eslint-disable-line prefer-const\r\n if (e instanceof Error)\r\n Logger.logError(BackendLoggerCategory.Workspace, e);\r\n else\r\n UnexpectedErrors.handle(e);\r\n };\r\n\r\n /** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */\r\n export interface SettingsDictionaryLoaded {\r\n /** The dictionary that was loaded */\r\n dict: SettingsDictionary;\r\n /** The WorkspaceDb from which the dictionary was loaded. */\r\n from: WorkspaceDb;\r\n }\r\n\r\n /** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].\r\n * Applications can override this function to notify the user and/or record diagnostics.\r\n * The default implementation simply records an information message in the [Logger]($bentley).\r\n */\r\n export let onSettingsDictionaryLoadedFn = (loaded: SettingsDictionaryLoaded) => { // eslint-disable-line prefer-const\r\n Logger.logInfo(BackendLoggerCategory.Workspace, `loaded setting dictionary ${loaded.dict.props.name} from ${loaded.from.dbFileName}`);\r\n };\r\n\r\n /** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].\r\n * Used by [[Workspace.getWorkspaceDbs]].\r\n */\r\n export type DbListOrSettingName = { readonly dbs: WorkspaceDbCloudProps[], readonly settingName?: never } | { readonly settingName: SettingName, readonly dbs?: never };\r\n\r\n /** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some\r\n * [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.\r\n */\r\n export type DbListFilter = (\r\n /** The properties of the WorkspaceDb to be returned */\r\n dbProp: WorkspaceDbCloudProps,\r\n /** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the\r\n * [[SettingsPriority]] of the dictionary.\r\n */\r\n dict: SettingsDictionary\r\n ) => boolean;\r\n\r\n /** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.\r\n * The list is searched in order, and the first resource with the request name is returned.\r\n * If no such resource exists, the function returns `undefined`.\r\n * @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.\r\n * @beta\r\n */\r\n export function getStringResource(args: GetWorkspaceResourceArgs): string | undefined {\r\n return getWorkspaceResource(args.dbs, args.name, \"string\") as string | undefined;\r\n }\r\n\r\n /** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.\r\n * The list is searched in order, and the first resource with the request name is returned.\r\n * If no such resource exists, the function returns `undefined`.\r\n * @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.\r\n * @beta\r\n */\r\n export function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined {\r\n return getWorkspaceResource(args.dbs, args.name, \"blob\") as Uint8Array | undefined;\r\n }\r\n\r\n /** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.\r\n * @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.\r\n * @beta\r\n */\r\n export function queryResources(args: QueryWorkspaceResourcesArgs): void {\r\n const resources: Array<{ name: string, db: WorkspaceDb }> = [];\r\n for (const db of args.dbs) {\r\n db.queryResources({\r\n type: args.type,\r\n namePattern: args.namePattern,\r\n nameCompare: args.nameCompare,\r\n callback: (names) => {\r\n for (const name of names) {\r\n resources.push({ db, name });\r\n }\r\n },\r\n });\r\n }\r\n\r\n args.callback(resources);\r\n }\r\n}\r\n"]}
@@ -1,12 +1,30 @@
1
1
  /** @packageDocumentation
2
2
  * @module iModels
3
3
  */
4
- import { AccessToken, BeDuration, GuidString, Optional } from "@itwin/core-bentley";
4
+ import { AccessToken, BeDuration, GuidString, Id64String, Optional } from "@itwin/core-bentley";
5
5
  import { BriefcaseId, BriefcaseProps, ChangesetFileProps, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange, LocalBriefcaseProps, LocalDirName, LocalFileName, RequestNewBriefcaseProps } from "@itwin/core-common";
6
6
  import { AcquireNewBriefcaseIdArg, DownloadChangesetArg, DownloadChangesetRangeArg, IModelNameArg } from "./BackendHubAccess";
7
7
  import { ProgressFunction } from "./CheckpointManager";
8
8
  import { BriefcaseDb, IModelDb, TokenArg } from "./IModelDb";
9
9
  import { StashProps } from "./StashManager";
10
+ import { ECSqlRow } from "./Entity";
11
+ /**
12
+ * The argument for identifying an Patch Instance Key
13
+ * @internal
14
+ */
15
+ interface PatchInstanceKey {
16
+ id: Id64String;
17
+ classFullName: string;
18
+ }
19
+ /** The argument for patch instances during high level rebase application
20
+ * @internal
21
+ */
22
+ export interface InstancePatch {
23
+ key: PatchInstanceKey;
24
+ op: "Inserted" | "Updated" | "Deleted";
25
+ isIndirect: boolean;
26
+ props?: ECSqlRow;
27
+ }
10
28
  /** The argument for [[BriefcaseManager.downloadBriefcase]]
11
29
  * @public
12
30
  */
@@ -271,5 +289,124 @@ export declare class BriefcaseManager {
271
289
  * @internal
272
290
  */
273
291
  static pullMergePush(db: BriefcaseDb, arg: PushChangesArgs): Promise<void>;
292
+ private static readonly REBASING_FOLDER;
293
+ private static readonly EC_FOLDER;
294
+ private static readonly SCHEMAS_FOLDER;
295
+ private static readonly DATA_FOLDER;
296
+ private static readonly DATA_FILE_NAME;
297
+ /**
298
+ * Captures the changed instances as patch instances from each data txn in the briefcase db for semantic rebase
299
+ * @param db The {@link BriefcaseDb} instance for which to capture the changed instances as patch instances for all data txns
300
+ * @internal
301
+ */
302
+ private static capturePatchInstances;
303
+ /**
304
+ * Captures changed instances from a txn as JSON
305
+ * @param txnId The txn id for which to capture changed instances
306
+ * @param db The {@link BriefcaseDb} instance from which to capture changed instances as json
307
+ * @returns changed instances for semantic rebase
308
+ * @internal
309
+ */
310
+ private static captureChangedInstancesAsJSON;
311
+ /**
312
+ * Constructs patch instances from changed instances
313
+ * @param changedInstances The changed instances from which to construct the patch instances
314
+ * @param db The {@link BriefcaseDb} instance for which to construct the patch instances
315
+ * @returns The {@link InstancePatch} instance patches for semantic rebase
316
+ * @internal
317
+ */
318
+ private static constructPatchInstances;
319
+ /**
320
+ * Constructs a single patch instance from changed instance
321
+ * @param changedInstance The changed instance from which to construct the patch instance
322
+ * @param db The {@link BriefcaseDb} instance for which to construct the single patch instance
323
+ * @returns a single instance patch {@link InstancePatch}
324
+ * @throws IModelError If cannot determine classId or unknown operation encountered
325
+ */
326
+ private static constructPatchInstance;
327
+ /**
328
+ * Stores changed instances for semantic rebase locally in appropriate json file in a folder structure
329
+ * @param db The {@link BriefcaseDb} instance for storing the changed instances against a txn
330
+ * @param txnId The txn id for which we are storing the changed instances
331
+ * @param instancePatches The {@link InstancePatch} instance patches to be stored
332
+ * @internal
333
+ */
334
+ private static storeChangedInstancesForSemanticRebase;
335
+ /**
336
+ * Gets the base path for semantic rebase local files
337
+ * @param db The {@link BriefcaseDb} instance for which to get the base path
338
+ * @returns base path for semantic rebase local files
339
+ * @internal
340
+ */
341
+ static getBasePathForSemanticRebaseLocalFiles(db: BriefcaseDb): string;
342
+ /**
343
+ * Stores schemas for semantic rebase locally in appropriate folder structure
344
+ * @param db The {@link BriefcaseDb} instance for storing the schemas against a txn
345
+ * @param txnId The txn id for which we are storing the schemas
346
+ * @param schemaFileNames The schema file paths or schema xml strings to be stored
347
+ * @internal
348
+ */
349
+ static storeSchemasForSemanticRebase<T extends LocalFileName[] | string[]>(db: BriefcaseDb, txnId: string, schemaFileNames: T): void;
350
+ /**
351
+ * Gets schemas for semantic rebase for a txn
352
+ * @param db The {@link BriefcaseDb} instance for getting the locally stored schemas against a txn
353
+ * @param txnId The txn id for which we are getting the schemas
354
+ * @returns the schema file paths
355
+ * @internal
356
+ */
357
+ static getSchemasForTxn(db: BriefcaseDb, txnId: string): string[];
358
+ /**
359
+ * Get the changed instances data for semantic rebase for a txn
360
+ * @param db - The {@link BriefcaseDb} instance for getting the locally stored changed instances against a txn
361
+ * @param txnId - The txn id for which we are getting the changed instances
362
+ * @returns Instance patches
363
+ * @internal
364
+ */
365
+ static getChangedInstancesDataForTxn(db: BriefcaseDb, txnId: string): InstancePatch[];
366
+ /**
367
+ * Checks if schema folder exists for semantic rebase for a txn
368
+ * @param db - The {@link BriefcaseDb} instance for which TO check the schema folder
369
+ * @param txnId - The txn id for which we are check the schema folder
370
+ * @returns true if exists, false otherwise
371
+ * @internal
372
+ */
373
+ static semanticRebaseSchemaFolderExists(db: BriefcaseDb, txnId: string): boolean;
374
+ /**
375
+ * Checks if data folder exists for semantic rebase for a txn
376
+ * @param db The {@link BriefcaseDb} instance for which to check the data folder.
377
+ * @param txnId The txn id for which to check the data folder
378
+ * @returns true if exists, false otherwise
379
+ * @internal
380
+ */
381
+ static semanticRebaseDataFolderExists(db: BriefcaseDb, txnId: string): boolean;
382
+ /**
383
+ * Deletes the schema folder for semantic rebase for a txn
384
+ * @param db The {@link BriefcaseDb} instance for which to delete the schema folder.
385
+ * @param txnId The txn id for which to delete the schema folder
386
+ * @internal
387
+ */
388
+ static deleteTxnSchemaFolder(db: BriefcaseDb, txnId: string): void;
389
+ /**
390
+ * Deletes the data folder for semantic rebase for a txn
391
+ * @param db The {@link BriefcaseDb} instance for which to delete the data folder.
392
+ * @param txnId The txn id for which to delete the data folder
393
+ * @internal
394
+ */
395
+ static deleteTxnDataFolder(db: BriefcaseDb, txnId: string): void;
396
+ /**
397
+ * Deletes rebase folders for semantic rebase
398
+ * @param db The {@link BriefcaseDb} instance for which to delete the rebase folders.
399
+ * @param checkIfEmpty If true, only deletes the base folder if it is empty, default is false
400
+ * @internal
401
+ */
402
+ static deleteRebaseFolders(db: BriefcaseDb, checkIfEmpty?: boolean): void;
403
+ /**
404
+ * Cleans up rebase folders for semantic rebase given briefcase file path and briefcase id
405
+ * @param briefcaseFilePath The briefcase file path
406
+ * @param briefcaseId The briefcase id
407
+ * @internal
408
+ */
409
+ private static cleanupRebaseFolders;
274
410
  }
411
+ export {};
275
412
  //# sourceMappingURL=BriefcaseManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BriefcaseManager.d.ts","sourceRoot":"","sources":["../../src/BriefcaseManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EACL,WAAW,EAAE,UAAU,EAA6B,UAAU,EAAmD,QAAQ,EAC1H,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EAAoB,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAA6C,mBAAmB,EACrM,YAAY,EAAE,aAAa,EAAE,wBAAwB,EAEtD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9H,OAAO,EAAsC,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM7D,OAAO,EAAgB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI1D;;EAEE;AACF,MAAM,WAAW,sBAAuB,SAAQ,QAAQ,EAAE,wBAAwB;IAChF;;OAEG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAC;IACpB,8IAA8I;IAC9I,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,oGAAoG;IACpG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,8FAA8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