@itwin/core-backend 5.8.0-dev.1 → 5.8.0-dev.11

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 (164) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/ECDb.d.ts +26 -0
  3. package/lib/cjs/ECDb.d.ts.map +1 -1
  4. package/lib/cjs/ECDb.js +53 -2
  5. package/lib/cjs/ECDb.js.map +1 -1
  6. package/lib/cjs/ECSqlRowExecutor.d.ts +66 -0
  7. package/lib/cjs/ECSqlRowExecutor.d.ts.map +1 -0
  8. package/lib/cjs/ECSqlRowExecutor.js +135 -0
  9. package/lib/cjs/ECSqlRowExecutor.js.map +1 -0
  10. package/lib/cjs/ECSqlStatement.d.ts +13 -1
  11. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  12. package/lib/cjs/ECSqlStatement.js +30 -0
  13. package/lib/cjs/ECSqlStatement.js.map +1 -1
  14. package/lib/cjs/ECSqlSyncReader.d.ts +104 -0
  15. package/lib/cjs/ECSqlSyncReader.d.ts.map +1 -0
  16. package/lib/cjs/ECSqlSyncReader.js +191 -0
  17. package/lib/cjs/ECSqlSyncReader.js.map +1 -0
  18. package/lib/cjs/IModelDb.d.ts +26 -1
  19. package/lib/cjs/IModelDb.d.ts.map +1 -1
  20. package/lib/cjs/IModelDb.js +55 -0
  21. package/lib/cjs/IModelDb.js.map +1 -1
  22. package/lib/cjs/IpcHost.d.ts.map +1 -1
  23. package/lib/cjs/IpcHost.js.map +1 -1
  24. package/lib/cjs/LineStyle.d.ts +6 -0
  25. package/lib/cjs/LineStyle.d.ts.map +1 -1
  26. package/lib/cjs/LineStyle.js +41 -32
  27. package/lib/cjs/LineStyle.js.map +1 -1
  28. package/lib/cjs/core-backend.d.ts +3 -0
  29. package/lib/cjs/core-backend.d.ts.map +1 -1
  30. package/lib/cjs/core-backend.js +3 -0
  31. package/lib/cjs/core-backend.js.map +1 -1
  32. package/lib/cjs/internal/workspace/SettingsDbImpl.d.ts +38 -0
  33. package/lib/cjs/internal/workspace/SettingsDbImpl.d.ts.map +1 -0
  34. package/lib/cjs/internal/workspace/SettingsDbImpl.js +106 -0
  35. package/lib/cjs/internal/workspace/SettingsDbImpl.js.map +1 -0
  36. package/lib/cjs/internal/workspace/SettingsImpl.d.ts +3 -0
  37. package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -1
  38. package/lib/cjs/internal/workspace/SettingsImpl.js +251 -1
  39. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  40. package/lib/cjs/internal/workspace/SettingsSqliteDb.d.ts +14 -0
  41. package/lib/cjs/internal/workspace/SettingsSqliteDb.d.ts.map +1 -0
  42. package/lib/cjs/internal/workspace/SettingsSqliteDb.js +40 -0
  43. package/lib/cjs/internal/workspace/SettingsSqliteDb.js.map +1 -0
  44. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +1 -0
  45. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  46. package/lib/cjs/internal/workspace/WorkspaceImpl.js +54 -5
  47. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  48. package/lib/cjs/workspace/Settings.d.ts +8 -0
  49. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  50. package/lib/cjs/workspace/Settings.js.map +1 -1
  51. package/lib/cjs/workspace/SettingsDb.d.ts +109 -0
  52. package/lib/cjs/workspace/SettingsDb.d.ts.map +1 -0
  53. package/lib/cjs/workspace/SettingsDb.js +19 -0
  54. package/lib/cjs/workspace/SettingsDb.js.map +1 -0
  55. package/lib/cjs/workspace/SettingsEditor.d.ts +246 -0
  56. package/lib/cjs/workspace/SettingsEditor.d.ts.map +1 -0
  57. package/lib/cjs/workspace/SettingsEditor.js +51 -0
  58. package/lib/cjs/workspace/SettingsEditor.js.map +1 -0
  59. package/lib/cjs/workspace/Workspace.d.ts +39 -18
  60. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  61. package/lib/cjs/workspace/Workspace.js.map +1 -1
  62. package/lib/cjs/workspace/WorkspaceEditor.d.ts +28 -0
  63. package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -1
  64. package/lib/cjs/workspace/WorkspaceEditor.js +17 -0
  65. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  66. package/lib/esm/ECDb.d.ts +26 -0
  67. package/lib/esm/ECDb.d.ts.map +1 -1
  68. package/lib/esm/ECDb.js +54 -3
  69. package/lib/esm/ECDb.js.map +1 -1
  70. package/lib/esm/ECSqlRowExecutor.d.ts +66 -0
  71. package/lib/esm/ECSqlRowExecutor.d.ts.map +1 -0
  72. package/lib/esm/ECSqlRowExecutor.js +131 -0
  73. package/lib/esm/ECSqlRowExecutor.js.map +1 -0
  74. package/lib/esm/ECSqlStatement.d.ts +13 -1
  75. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  76. package/lib/esm/ECSqlStatement.js +30 -0
  77. package/lib/esm/ECSqlStatement.js.map +1 -1
  78. package/lib/esm/ECSqlSyncReader.d.ts +104 -0
  79. package/lib/esm/ECSqlSyncReader.d.ts.map +1 -0
  80. package/lib/esm/ECSqlSyncReader.js +187 -0
  81. package/lib/esm/ECSqlSyncReader.js.map +1 -0
  82. package/lib/esm/IModelDb.d.ts +26 -1
  83. package/lib/esm/IModelDb.d.ts.map +1 -1
  84. package/lib/esm/IModelDb.js +55 -0
  85. package/lib/esm/IModelDb.js.map +1 -1
  86. package/lib/esm/IpcHost.d.ts.map +1 -1
  87. package/lib/esm/IpcHost.js.map +1 -1
  88. package/lib/esm/LineStyle.d.ts +6 -0
  89. package/lib/esm/LineStyle.d.ts.map +1 -1
  90. package/lib/esm/LineStyle.js +41 -32
  91. package/lib/esm/LineStyle.js.map +1 -1
  92. package/lib/esm/core-backend.d.ts +3 -0
  93. package/lib/esm/core-backend.d.ts.map +1 -1
  94. package/lib/esm/core-backend.js +3 -0
  95. package/lib/esm/core-backend.js.map +1 -1
  96. package/lib/esm/internal/workspace/SettingsDbImpl.d.ts +38 -0
  97. package/lib/esm/internal/workspace/SettingsDbImpl.d.ts.map +1 -0
  98. package/lib/esm/internal/workspace/SettingsDbImpl.js +102 -0
  99. package/lib/esm/internal/workspace/SettingsDbImpl.js.map +1 -0
  100. package/lib/esm/internal/workspace/SettingsImpl.d.ts +3 -0
  101. package/lib/esm/internal/workspace/SettingsImpl.d.ts.map +1 -1
  102. package/lib/esm/internal/workspace/SettingsImpl.js +253 -4
  103. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  104. package/lib/esm/internal/workspace/SettingsSqliteDb.d.ts +14 -0
  105. package/lib/esm/internal/workspace/SettingsSqliteDb.d.ts.map +1 -0
  106. package/lib/esm/internal/workspace/SettingsSqliteDb.js +36 -0
  107. package/lib/esm/internal/workspace/SettingsSqliteDb.js.map +1 -0
  108. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts +1 -0
  109. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  110. package/lib/esm/internal/workspace/WorkspaceImpl.js +54 -6
  111. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  112. package/lib/esm/test/ecdb/ECSqlQuery.test.js +113 -14
  113. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  114. package/lib/esm/test/ecdb/ECSqlSyncReader.test.d.ts +2 -0
  115. package/lib/esm/test/ecdb/ECSqlSyncReader.test.d.ts.map +1 -0
  116. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js +122 -0
  117. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -0
  118. package/lib/esm/test/ecdb/QueryReaders.test.d.ts +2 -0
  119. package/lib/esm/test/ecdb/QueryReaders.test.d.ts.map +1 -0
  120. package/lib/esm/test/ecdb/QueryReaders.test.js +1427 -0
  121. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -0
  122. package/lib/esm/test/ecsql/src/ECSqlTestParser.d.ts +1 -1
  123. package/lib/esm/test/ecsql/src/ECSqlTestParser.d.ts.map +1 -1
  124. package/lib/esm/test/ecsql/src/ECSqlTestParser.js +11 -5
  125. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  126. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +178 -100
  127. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  128. package/lib/esm/test/standalone/Settings.test.js +18 -0
  129. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  130. package/lib/esm/test/standalone/StandaloneDb.test.js +51 -1
  131. package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -1
  132. package/lib/esm/test/standalone/Workspace.test.js +113 -0
  133. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  134. package/lib/esm/test/standalone/iModelDb.test.d.ts +2 -0
  135. package/lib/esm/test/standalone/iModelDb.test.d.ts.map +1 -0
  136. package/lib/esm/test/standalone/iModelDb.test.js +35 -0
  137. package/lib/esm/test/standalone/iModelDb.test.js.map +1 -0
  138. package/lib/esm/test/workspace/SettingsDb.test.d.ts +2 -0
  139. package/lib/esm/test/workspace/SettingsDb.test.d.ts.map +1 -0
  140. package/lib/esm/test/workspace/SettingsDb.test.js +372 -0
  141. package/lib/esm/test/workspace/SettingsDb.test.js.map +1 -0
  142. package/lib/esm/workspace/Settings.d.ts +8 -0
  143. package/lib/esm/workspace/Settings.d.ts.map +1 -1
  144. package/lib/esm/workspace/Settings.js.map +1 -1
  145. package/lib/esm/workspace/SettingsDb.d.ts +109 -0
  146. package/lib/esm/workspace/SettingsDb.d.ts.map +1 -0
  147. package/lib/esm/workspace/SettingsDb.js +16 -0
  148. package/lib/esm/workspace/SettingsDb.js.map +1 -0
  149. package/lib/esm/workspace/SettingsEditor.d.ts +246 -0
  150. package/lib/esm/workspace/SettingsEditor.d.ts.map +1 -0
  151. package/lib/esm/workspace/SettingsEditor.js +48 -0
  152. package/lib/esm/workspace/SettingsEditor.js.map +1 -0
  153. package/lib/esm/workspace/Workspace.d.ts +39 -18
  154. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  155. package/lib/esm/workspace/Workspace.js.map +1 -1
  156. package/lib/esm/workspace/WorkspaceEditor.d.ts +28 -0
  157. package/lib/esm/workspace/WorkspaceEditor.d.ts.map +1 -1
  158. package/lib/esm/workspace/WorkspaceEditor.js +17 -0
  159. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  160. package/package.json +13 -13
  161. package/lib/esm/test/ecdb/ECSqlReader.test.d.ts +0 -2
  162. package/lib/esm/test/ecdb/ECSqlReader.test.d.ts.map +0 -1
  163. package/lib/esm/test/ecdb/ECSqlReader.test.js +0 -669
  164. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +0 -1
@@ -0,0 +1,109 @@
1
+ /** @packageDocumentation
2
+ * @module Workspace
3
+ */
4
+ import { Setting, SettingName, SettingsContainer, SettingsPriority } from "./Settings";
5
+ import { CloudSqliteContainer, WorkspaceContainerId, WorkspaceDbName } from "./Workspace";
6
+ import { _implementationProhibited } from "../internal/Symbols";
7
+ /** Metadata stored inside a [[SettingsDb]] describing the database's contents, to help users understand
8
+ * the purpose of the [[SettingsDb]] and who to contact with questions about it.
9
+ * @note Only the `settingsName` field is required, and users may add additional fields for their own purposes.
10
+ * @note Since the information is stored inside the [[SettingsDb]], it is versioned along with the rest of the contents.
11
+ * @beta
12
+ */
13
+ export interface SettingsDbManifest {
14
+ /** The name of the [[SettingsDb]] to be shown in user interfaces. Organizations should attempt to make this name
15
+ * informative enough so that users may refer to it in conversations.
16
+ */
17
+ readonly settingsName: string;
18
+ /** A description of the contents of this [[SettingsDb]] to help users understand its purpose and appropriate usage. */
19
+ readonly description?: string;
20
+ /** The name of the person to contact with questions about this [[SettingsDb]]. */
21
+ readonly contactName?: string;
22
+ /** The name of the person who last modified this [[SettingsDb]]. */
23
+ readonly lastEditedBy?: string;
24
+ }
25
+ /** Properties that specify how to load a [[SettingsDb]] within a [[CloudSqliteContainer]].
26
+ * @beta
27
+ */
28
+ export interface SettingsDbProps {
29
+ /** The base name of the [[SettingsDb]], without any version information. Default: `"settings-db"`. */
30
+ readonly dbName?: WorkspaceDbName;
31
+ /** The [semver](https://github.com/npm/node-semver) version string or range for the desired [[SettingsDb]].
32
+ * If not specified, the latest available version is used.
33
+ */
34
+ readonly version?: string;
35
+ }
36
+ /** Arguments for obtaining a [[SettingsDb]] from a previously-loaded container.
37
+ * @beta
38
+ */
39
+ export interface GetSettingsDbArgs {
40
+ /** The [[WorkspaceContainerId]] of the cloud container that holds the [[SettingsDb]].
41
+ * This is an opaque GUID assigned by the BlobContainer service when the container is created — it is
42
+ * **not** the same as an iTwinId or iModelId.
43
+ */
44
+ readonly containerId: WorkspaceContainerId;
45
+ /** The priority to assign to dictionaries loaded from this [[SettingsDb]]. */
46
+ readonly priority: SettingsPriority;
47
+ /** The name of the [[SettingsDb]] to retrieve. Default: `"settings-db"`. */
48
+ readonly dbName?: WorkspaceDbName;
49
+ /** The semantic version string or range for the desired [[SettingsDb]].
50
+ * If not specified, the latest available version is used.
51
+ */
52
+ readonly version?: string;
53
+ }
54
+ /** A CloudSQLite database dedicated to storing settings as key-value pairs. Unlike a general-purpose [[WorkspaceDb]],
55
+ * a `SettingsDb` restricts its API surface to settings-only operations, providing a focused interface
56
+ * for reading settings by name.
57
+ *
58
+ * Internally, all settings are stored in a single JSON blob. Each setting is a named entry in a [[SettingsContainer]].
59
+ *
60
+ * A `SettingsDb` resides in a [[CloudSqliteContainer]] and can be published to the cloud. Once published,
61
+ * the `SettingsDb` becomes immutable; however, multiple versions may be created to allow settings to evolve over time.
62
+ * @beta
63
+ */
64
+ export interface SettingsDb {
65
+ /** @internal */
66
+ [_implementationProhibited]: unknown;
67
+ /** The [[CloudSqliteContainer]] in which this database resides. */
68
+ readonly container: CloudSqliteContainer;
69
+ /** The base name of this SettingsDb, without version. */
70
+ readonly dbName: string;
71
+ /** The resolved [semver](https://github.com/npm/node-semver) version of this SettingsDb.
72
+ * @note For local (non-cloud) containers, this property returns `"0.0.0"`.
73
+ */
74
+ readonly version: string;
75
+ /** The priority assigned to dictionaries loaded from this SettingsDb. */
76
+ readonly priority: SettingsPriority;
77
+ /** Whether the underlying database is currently open. */
78
+ readonly isOpen: boolean;
79
+ /** The manifest describing the contents of this SettingsDb. */
80
+ readonly manifest: SettingsDbManifest;
81
+ /** Open the underlying database for querying. When performing significant activity against a SettingsDb,
82
+ * open it before the operations and [[close]] it afterwards.
83
+ * @note Explicit open/close is a performance optimization for batches of operations. Individual methods like
84
+ * [[getSetting]] and [[getSettings]] will auto-open and auto-close the database if it is not already open.
85
+ */
86
+ open(): void;
87
+ /** Close the underlying database. You should call this after [[open]]ing the database and completing your queries.
88
+ * @note For [[EditableSettingsDb]] instances, if the container's write lock is currently held, closing persists
89
+ * any pending changes and updates the manifest's `lastEditedBy` field with the current write lock holder.
90
+ */
91
+ close(): void;
92
+ /** Return a copy of the value of the setting named `settingName`, or `undefined` if not found.
93
+ * The returned value is always cloned using [[Setting.clone]].
94
+ * @param settingName The name of the setting to retrieve.
95
+ */
96
+ getSetting<T extends Setting>(settingName: SettingName): T | undefined;
97
+ /** Return a deep copy of all settings stored in this SettingsDb as a [[SettingsContainer]].
98
+ * @note The returned object is a fresh copy — mutating it will not affect the stored settings.
99
+ */
100
+ getSettings(): SettingsContainer;
101
+ }
102
+ /** The default resource name used to store settings in a [[SettingsDb]].
103
+ * This is the key under which all settings are stored in the SQLite `strings` table.
104
+ * When loading settings at runtime via [[Workspace.loadSettingsDictionary]], the `resourceName` defaults
105
+ * to this value, ensuring the read and write paths always agree on which key to use.
106
+ * @internal
107
+ */
108
+ export declare const settingsResourceName = "settings";
109
+ //# sourceMappingURL=SettingsDb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsDb.d.ts","sourceRoot":"","sources":["../../../src/workspace/SettingsDb.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,E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AAE,gBAAgB,CAAC;IACpC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IAEtC;;;;OAIG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;OAGG;IACH,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,GAAG,SAAS,CAAC;IAEvE;;OAEG;IACH,WAAW,IAAI,iBAAiB,CAAC;CAClC;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Workspace
7
+ */
8
+ import { _implementationProhibited } from "../internal/Symbols";
9
+ /** The default resource name used to store settings in a [[SettingsDb]].
10
+ * This is the key under which all settings are stored in the SQLite `strings` table.
11
+ * When loading settings at runtime via [[Workspace.loadSettingsDictionary]], the `resourceName` defaults
12
+ * to this value, ensuring the read and write paths always agree on which key to use.
13
+ * @internal
14
+ */
15
+ export const settingsResourceName = "settings";
16
+ //# sourceMappingURL=SettingsDb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsDb.js","sourceRoot":"","sources":["../../../src/workspace/SettingsDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAyGhE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,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 Workspace\r\n */\r\n\r\nimport { Setting, SettingName, SettingsContainer, SettingsPriority } from \"./Settings\";\r\nimport { CloudSqliteContainer, WorkspaceContainerId, WorkspaceDbName } from \"./Workspace\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\n\r\n/** Metadata stored inside a [[SettingsDb]] describing the database's contents, to help users understand\r\n * the purpose of the [[SettingsDb]] and who to contact with questions about it.\r\n * @note Only the `settingsName` field is required, and users may add additional fields for their own purposes.\r\n * @note Since the information is stored inside the [[SettingsDb]], it is versioned along with the rest of the contents.\r\n * @beta\r\n */\r\nexport interface SettingsDbManifest {\r\n /** The name of the [[SettingsDb]] to be shown in user interfaces. Organizations should attempt to make this name\r\n * informative enough so that users may refer to it in conversations.\r\n */\r\n readonly settingsName: string;\r\n /** A description of the contents of this [[SettingsDb]] 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 [[SettingsDb]]. */\r\n readonly contactName?: string;\r\n /** The name of the person who last modified this [[SettingsDb]]. */\r\n readonly lastEditedBy?: string;\r\n}\r\n\r\n/** Properties that specify how to load a [[SettingsDb]] within a [[CloudSqliteContainer]].\r\n * @beta\r\n */\r\nexport interface SettingsDbProps {\r\n /** The base name of the [[SettingsDb]], without any version information. Default: `\"settings-db\"`. */\r\n readonly dbName?: WorkspaceDbName;\r\n /** The [semver](https://github.com/npm/node-semver) version string or range for the desired [[SettingsDb]].\r\n * If not specified, the latest available version is used.\r\n */\r\n readonly version?: string;\r\n}\r\n\r\n/** Arguments for obtaining a [[SettingsDb]] from a previously-loaded container.\r\n * @beta\r\n */\r\nexport interface GetSettingsDbArgs {\r\n /** The [[WorkspaceContainerId]] of the cloud container that holds the [[SettingsDb]].\r\n * This is an opaque GUID assigned by the BlobContainer service when the container is created — it is\r\n * **not** the same as an iTwinId or iModelId.\r\n */\r\n readonly containerId: WorkspaceContainerId;\r\n /** The priority to assign to dictionaries loaded from this [[SettingsDb]]. */\r\n readonly priority: SettingsPriority;\r\n /** The name of the [[SettingsDb]] to retrieve. Default: `\"settings-db\"`. */\r\n readonly dbName?: WorkspaceDbName;\r\n /** The semantic version string or range for the desired [[SettingsDb]].\r\n * If not specified, the latest available version is used.\r\n */\r\n readonly version?: string;\r\n}\r\n\r\n/** A CloudSQLite database dedicated to storing settings as key-value pairs. Unlike a general-purpose [[WorkspaceDb]],\r\n * a `SettingsDb` restricts its API surface to settings-only operations, providing a focused interface\r\n * for reading settings by name.\r\n *\r\n * Internally, all settings are stored in a single JSON blob. Each setting is a named entry in a [[SettingsContainer]].\r\n *\r\n * A `SettingsDb` resides in a [[CloudSqliteContainer]] and can be published to the cloud. Once published,\r\n * the `SettingsDb` becomes immutable; however, multiple versions may be created to allow settings to evolve over time.\r\n * @beta\r\n */\r\nexport interface SettingsDb {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n /** The [[CloudSqliteContainer]] in which this database resides. */\r\n readonly container: CloudSqliteContainer;\r\n /** The base name of this SettingsDb, without version. */\r\n readonly dbName: string;\r\n /** The resolved [semver](https://github.com/npm/node-semver) version of this SettingsDb.\r\n * @note For local (non-cloud) containers, this property returns `\"0.0.0\"`.\r\n */\r\n readonly version: string;\r\n /** The priority assigned to dictionaries loaded from this SettingsDb. */\r\n readonly priority: SettingsPriority;\r\n /** Whether the underlying database is currently open. */\r\n readonly isOpen: boolean;\r\n /** The manifest describing the contents of this SettingsDb. */\r\n readonly manifest: SettingsDbManifest;\r\n\r\n /** Open the underlying database for querying. When performing significant activity against a SettingsDb,\r\n * open it before the operations and [[close]] it afterwards.\r\n * @note Explicit open/close is a performance optimization for batches of operations. Individual methods like\r\n * [[getSetting]] and [[getSettings]] will auto-open and auto-close the database if it is not already open.\r\n */\r\n open(): void;\r\n\r\n /** Close the underlying database. You should call this after [[open]]ing the database and completing your queries.\r\n * @note For [[EditableSettingsDb]] instances, if the container's write lock is currently held, closing persists\r\n * any pending changes and updates the manifest's `lastEditedBy` field with the current write lock holder.\r\n */\r\n close(): void;\r\n\r\n /** Return a copy of the value of the setting named `settingName`, or `undefined` if not found.\r\n * The returned value is always cloned using [[Setting.clone]].\r\n * @param settingName The name of the setting to retrieve.\r\n */\r\n getSetting<T extends Setting>(settingName: SettingName): T | undefined;\r\n\r\n /** Return a deep copy of all settings stored in this SettingsDb as a [[SettingsContainer]].\r\n * @note The returned object is a fresh copy — mutating it will not affect the stored settings.\r\n */\r\n getSettings(): SettingsContainer;\r\n}\r\n\r\n/** The default resource name used to store settings in a [[SettingsDb]].\r\n * This is the key under which all settings are stored in the SQLite `strings` table.\r\n * When loading settings at runtime via [[Workspace.loadSettingsDictionary]], the `resourceName` defaults\r\n * to this value, ensuring the read and write paths always agree on which key to use.\r\n * @internal\r\n */\r\nexport const settingsResourceName = \"settings\";\r\n"]}
@@ -0,0 +1,246 @@
1
+ /** @packageDocumentation
2
+ * @module Workspace
3
+ */
4
+ import { LocalFileName } from "@itwin/core-common";
5
+ import { GuidString } from "@itwin/core-bentley";
6
+ import { Setting, SettingName, SettingsContainer } from "./Settings";
7
+ import { BlobContainer } from "../BlobContainerService";
8
+ import { CloudSqliteContainer, GetWorkspaceContainerArgs, Workspace, WorkspaceContainerProps, WorkspaceDbName, WorkspaceDbNameAndVersion, WorkspaceDbVersion } from "./Workspace";
9
+ import { SettingsDb, SettingsDbManifest, SettingsDbProps } from "./SettingsDb";
10
+ import { _implementationProhibited } from "../internal/Symbols";
11
+ import { CloudSqlite } from "../CloudSqlite";
12
+ /** @beta */
13
+ export declare namespace SettingsEditor {
14
+ /**
15
+ * Create a new [[SettingsEditor]] for creating new versions of [[SettingsDb]]s.
16
+ * @note The caller becomes the owner of the SettingsEditor and is responsible for calling [[SettingsEditor.close]] on it when finished.
17
+ * @note It is illegal to have more than one SettingsEditor active in a single session.
18
+ */
19
+ function construct(): SettingsEditor;
20
+ /**
21
+ * Create a new, empty, [[SettingsDb]] file on the local filesystem for importing settings dictionaries.
22
+ */
23
+ function createEmptyDb(args: {
24
+ localFileName: LocalFileName;
25
+ manifest: SettingsDbManifest;
26
+ }): void;
27
+ /** Arguments for [[SettingsEditor.queryContainers]] and [[SettingsEditor.findContainers]]. */
28
+ interface QuerySettingsContainersArgs {
29
+ /** The iTwinId whose settings containers should be queried. */
30
+ iTwinId: GuidString;
31
+ /** Optional iModelId to further scope the query to containers associated with a specific iModel. */
32
+ iModelId?: GuidString;
33
+ /** Optional label filter. */
34
+ label?: string;
35
+ }
36
+ /**
37
+ * Query the [[BlobContainer]] service for all settings containers associated with a given iTwin.
38
+ * This is a convenience wrapper around `BlobContainer.service.queryContainersMetadata` that
39
+ * automatically filters by `containerType: "settings"`.
40
+ * @param args - The query arguments including the iTwinId.
41
+ * @returns A promise that resolves to the matching container metadata entries.
42
+ * @note Requires [[IModelHost.authorizationClient]] to be configured.
43
+ */
44
+ function queryContainers(args: QuerySettingsContainersArgs): Promise<BlobContainer.MetadataResponse[]>;
45
+ }
46
+ /** Arguments supplied to [[SettingsEditor.createNewCloudContainer]] to create a new [[EditableSettingsCloudContainer]].
47
+ * The created container will automatically have `containerType: "settings"` in its metadata, enabling discovery
48
+ * via `BlobContainer.service.queryContainersMetadata({ containerType: "settings" })`.
49
+ * @beta
50
+ */
51
+ export interface CreateNewSettingsContainerArgs {
52
+ /**
53
+ * The scope of the container. This determines the ownership of the container, how RBAC rights are assigned,
54
+ * and the location of the datacenter.
55
+ */
56
+ scope: BlobContainer.Scope;
57
+ /** The manifest to be stored in the default SettingsDb in the new container. */
58
+ manifest: SettingsDbManifest;
59
+ /** Metadata stored by the BlobContainer service. The `containerType` field is omitted here because it is
60
+ * automatically set to `"settings"` when the container is created (mirroring the `"workspace"` convention for WorkspaceDb containers).
61
+ */
62
+ metadata: Omit<BlobContainer.Metadata, "containerType">;
63
+ /** The name of the default [[SettingsDb]] created inside the new container.
64
+ * Default: "settings-db";
65
+ */
66
+ dbName?: WorkspaceDbName;
67
+ }
68
+ /** Arguments supplied to [[EditableSettingsCloudContainer.createNewSettingsDbVersion]].
69
+ * @beta
70
+ */
71
+ export interface CreateNewSettingsDbVersionArgs {
72
+ /**
73
+ * The properties that determine the source [[SettingsDb]] to serve as the basis for the new version.
74
+ * This is usually the latest version, but it is possible to create patches to older versions.
75
+ */
76
+ fromProps?: SettingsDbProps;
77
+ /** The type of version increment to apply to the source version. */
78
+ versionType: CloudSqlite.SemverIncrement;
79
+ /** For prerelease versions, a string that becomes part of the version name. */
80
+ identifier?: string;
81
+ }
82
+ /** The result of creating a new version of a [[SettingsDb]].
83
+ * @beta
84
+ */
85
+ export interface SettingsDbVersionResult {
86
+ /** The name and version of the source SettingsDb. */
87
+ oldDb: WorkspaceDbNameAndVersion;
88
+ /** The name and version of the newly-created SettingsDb. */
89
+ newDb: WorkspaceDbNameAndVersion;
90
+ }
91
+ /** Arguments supplied to [[EditableSettingsCloudContainer.createDb]] to create a new [[SettingsDb]] in a container.
92
+ * @beta
93
+ */
94
+ export interface CreateSettingsDbArgs {
95
+ /** The name of the new SettingsDb. Default: `"settings-db"`. */
96
+ dbName?: WorkspaceDbName;
97
+ /** The initial version of the new SettingsDb. Default: `"0.0.0"`. */
98
+ version?: WorkspaceDbVersion;
99
+ /** The manifest for the new SettingsDb. */
100
+ manifest: SettingsDbManifest;
101
+ }
102
+ /** Arguments supplied to [[EditableSettingsDb.updateSetting]] to add or update a single [[Setting]].
103
+ * @beta
104
+ */
105
+ export interface UpdateSettingArgs {
106
+ /** The [[SettingName]] of the setting to add or update. */
107
+ readonly settingName: SettingName;
108
+ /** The new value for the setting. */
109
+ readonly value: Setting;
110
+ }
111
+ /**
112
+ * A [[CloudSqliteContainer]] opened for editing settings by a [[SettingsEditor]].
113
+ * You can create new [[SettingsDb]]s or new versions of existing [[SettingsDb]]s inside it.
114
+ * Before actually making any changes to the container's contents, you must first obtain an exclusive write lock on it via
115
+ * [[acquireWriteLock]]. Only one user can hold the write lock at any given time. When you have finished making changes,
116
+ * you can use [[releaseWriteLock]] to publish your changes, or [[abandonChanges]] to discard them.
117
+ * @note Settings containers are separate from workspace containers, providing independent write locks.
118
+ * Editing settings does not block workspace resource editing, and vice versa.
119
+ * @beta
120
+ */
121
+ export interface EditableSettingsCloudContainer extends CloudSqliteContainer {
122
+ /**
123
+ * Create a copy of an existing [[SettingsDb]] in this container with a new [[WorkspaceDbVersion]].
124
+ * The copy should be modified with new content before the write lock is released,
125
+ * and thereafter may never be modified again.
126
+ * @param args - The properties that determine the source SettingsDb and the version increment to apply.
127
+ * @returns A promise that resolves to an object containing the old and new SettingsDb names and versions.
128
+ */
129
+ createNewSettingsDbVersion(args: CreateNewSettingsDbVersionArgs): Promise<SettingsDbVersionResult>;
130
+ /**
131
+ * Create a new, empty [[SettingsDb]].
132
+ * @param args - The arguments for creating the new SettingsDb.
133
+ * @returns A promise that resolves to an EditableSettingsDb.
134
+ */
135
+ createDb(args: CreateSettingsDbArgs): Promise<EditableSettingsDb>;
136
+ /**
137
+ * Get the cloud properties of this container.
138
+ */
139
+ readonly cloudProps: WorkspaceContainerProps | undefined;
140
+ /**
141
+ * Get an editable [[SettingsDb]] to add, delete, or update settings *within a newly created version* of a SettingsDb.
142
+ * @param props - The properties of the SettingsDb.
143
+ * @returns An EditableSettingsDb for modifying settings.
144
+ * @throws if the targeted SettingsDb has already been published and is immutable. Use [[createNewSettingsDbVersion]] first to create an editable version.
145
+ */
146
+ getEditableDb(props?: SettingsDbProps): EditableSettingsDb;
147
+ /**
148
+ * Acquire the write lock on the container. Use [[releaseWriteLock]] to release the lock after publishing your changes, or
149
+ * [[abandonChanges]] to release the lock and discard your changes.
150
+ * Only one user can hold the write lock at any given time. However, readers can continue to read the published contents of the container while
151
+ * a writer holds the write lock. Readers will only see the writer's changes after they are published by [[releaseWriteLock]].
152
+ * @param user - The name of the user acquiring the write lock.
153
+ * @throws if the write lock is already held by another user.
154
+ */
155
+ acquireWriteLock(user: string): void;
156
+ /**
157
+ * Release the write lock on the container. This should be called after all changes to the container's contents are complete. It
158
+ * publishes and uploads the changes made to any [[SettingsDb]]s while the lock was held, after which those dbs become immutable.
159
+ */
160
+ releaseWriteLock(): void;
161
+ /**
162
+ * Abandon any changes made to the container and release the write lock. Any newly created versions of SettingsDbs are discarded.
163
+ */
164
+ abandonChanges(): void;
165
+ }
166
+ /**
167
+ * An editable [[SettingsDb]]. This is used only by tools to allow administrators to create and modify SettingsDbs.
168
+ * For cloud-based SettingsDbs, the container's write token must be obtained via [[EditableSettingsCloudContainer.acquireWriteLock]] before the methods in this interface may be used.
169
+ * Normally, only admins will have write access.
170
+ * Only one admin at a time may be editing a settings container.
171
+ * @note Unlike [[EditableWorkspaceDb]], this interface only supports settings operations — no blob, file, or string resource methods.
172
+ * @beta
173
+ */
174
+ export interface EditableSettingsDb extends SettingsDb {
175
+ readonly container: EditableSettingsCloudContainer;
176
+ /**
177
+ * Update the contents of the manifest in this SettingsDb.
178
+ * @note This replaces the stored manifest entirely; omitted fields are lost.
179
+ * @param manifest - The updated manifest.
180
+ */
181
+ updateManifest(manifest: SettingsDbManifest): void;
182
+ /**
183
+ * Replace all settings in this SettingsDb with the given container.
184
+ * @param settings - The settings object to store.
185
+ */
186
+ updateSettings(settings: SettingsContainer): void;
187
+ /**
188
+ * Add or update a single [[Setting]] by name.
189
+ * If a setting with the given name already exists, its value is replaced.
190
+ * If it does not exist, it is added. Other settings are preserved.
191
+ * @param args - The arguments specifying the setting name and value.
192
+ */
193
+ updateSetting(args: UpdateSettingArgs): void;
194
+ /**
195
+ * Remove a single [[Setting]] by name. Other settings are preserved.
196
+ * @param settingName - The name of the setting to remove.
197
+ */
198
+ removeSetting(settingName: SettingName): void;
199
+ }
200
+ /** An object that permits administrators to modify the contents of settings containers.
201
+ * Use [[SettingsEditor.construct]] to obtain a SettingsEditor, and [[close]] when finished using it.
202
+ * Only one SettingsEditor may be in use at any given time.
203
+ * Use [[getContainer]] to edit an existing container, or [[createNewCloudContainer]] to create a new container.
204
+ * @beta
205
+ */
206
+ export interface SettingsEditor {
207
+ /** @internal */
208
+ [_implementationProhibited]: unknown;
209
+ /**
210
+ * The workspace dedicated to this editor.
211
+ * @note This workspace is independent from [[IModelHost.appWorkspace]] and all [[IModelDb.workspace]]s.
212
+ */
213
+ readonly workspace: Workspace;
214
+ /**
215
+ * Retrieves a container for the editor with the specified properties and access token.
216
+ */
217
+ getContainer(args: GetWorkspaceContainerArgs): EditableSettingsCloudContainer;
218
+ /**
219
+ * Asynchronously retrieves a container for the editor with the specified properties.
220
+ */
221
+ getContainerAsync(props: WorkspaceContainerProps): Promise<EditableSettingsCloudContainer>;
222
+ /**
223
+ * Creates a new cloud container for holding SettingsDbs, from the [[BlobContainer]] service.
224
+ * The container is automatically assigned `containerType: "settings"` in its metadata and
225
+ * initialized with a default [[SettingsDb]].
226
+ * @param args - The arguments for creating the container, including scope, metadata, and manifest.
227
+ * @returns A promise that resolves to the new EditableSettingsCloudContainer.
228
+ * @note The current user must have administrator rights for the iTwin for the container.
229
+ * @note Requires [[IModelHost.authorizationClient]] to be configured.
230
+ */
231
+ createNewCloudContainer(args: CreateNewSettingsContainerArgs): Promise<EditableSettingsCloudContainer>;
232
+ /**
233
+ * Find and open existing settings containers by querying the [[BlobContainer]] service.
234
+ * This is a convenience method that queries for all settings containers matching the given iTwinId
235
+ * (and optionally iModelId), requests write access tokens, and opens each matching container.
236
+ * @param args - The query arguments including iTwinId and optionally iModelId and label.
237
+ * @returns A promise that resolves to an array of opened [[EditableSettingsCloudContainer]]s.
238
+ * @note Requires [[IModelHost.authorizationClient]] and [[BlobContainer.service]] to be configured.
239
+ */
240
+ findContainers(args: SettingsEditor.QuerySettingsContainersArgs): Promise<EditableSettingsCloudContainer[]>;
241
+ /**
242
+ * Closes this editor. All settings containers are dropped.
243
+ */
244
+ close(): void;
245
+ }
246
+ //# sourceMappingURL=SettingsEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsEditor.d.ts","sourceRoot":"","sources":["../../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
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Workspace
7
+ */
8
+ import { BlobContainer } from "../BlobContainerService";
9
+ import { SettingsSqliteDb } from "../internal/workspace/SettingsSqliteDb";
10
+ import { constructSettingsEditor } from "../internal/workspace/SettingsImpl";
11
+ import { _implementationProhibited } from "../internal/Symbols";
12
+ import { IModelHost } from "../IModelHost";
13
+ /** @beta */
14
+ export var SettingsEditor;
15
+ (function (SettingsEditor) {
16
+ /**
17
+ * Create a new [[SettingsEditor]] for creating new versions of [[SettingsDb]]s.
18
+ * @note The caller becomes the owner of the SettingsEditor and is responsible for calling [[SettingsEditor.close]] on it when finished.
19
+ * @note It is illegal to have more than one SettingsEditor active in a single session.
20
+ */
21
+ function construct() {
22
+ return constructSettingsEditor();
23
+ }
24
+ SettingsEditor.construct = construct;
25
+ /**
26
+ * Create a new, empty, [[SettingsDb]] file on the local filesystem for importing settings dictionaries.
27
+ */
28
+ function createEmptyDb(args) {
29
+ SettingsSqliteDb.createNewDb(args.localFileName, args);
30
+ }
31
+ SettingsEditor.createEmptyDb = createEmptyDb;
32
+ /**
33
+ * Query the [[BlobContainer]] service for all settings containers associated with a given iTwin.
34
+ * This is a convenience wrapper around `BlobContainer.service.queryContainersMetadata` that
35
+ * automatically filters by `containerType: "settings"`.
36
+ * @param args - The query arguments including the iTwinId.
37
+ * @returns A promise that resolves to the matching container metadata entries.
38
+ * @note Requires [[IModelHost.authorizationClient]] to be configured.
39
+ */
40
+ async function queryContainers(args) {
41
+ if (undefined === BlobContainer.service)
42
+ throw new Error("BlobContainer.service is not available. Ensure IModelHost is initialized with a valid configuration.");
43
+ const userToken = await IModelHost.getAccessToken();
44
+ return BlobContainer.service.queryContainersMetadata(userToken, { ...args, containerType: "settings" });
45
+ }
46
+ SettingsEditor.queryContainers = queryContainers;
47
+ })(SettingsEditor || (SettingsEditor = {}));
48
+ //# sourceMappingURL=SettingsEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsEditor.js","sourceRoot":"","sources":["../../../src/workspace/SettingsEditor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,YAAY;AACZ,MAAM,KAAW,cAAc,CAyC9B;AAzCD,WAAiB,cAAc;IAC7B;;;;OAIG;IACH,SAAgB,SAAS;QACvB,OAAO,uBAAuB,EAAE,CAAC;IACnC,CAAC;IAFe,wBAAS,YAExB,CAAA;IAED;;OAEG;IACH,SAAgB,aAAa,CAAC,IAAoE;QAChG,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAFe,4BAAa,gBAE5B,CAAA;IAYD;;;;;;;OAOG;IACI,KAAK,UAAU,eAAe,CAAC,IAAiC;QACrE,IAAI,SAAS,KAAK,aAAa,CAAC,OAAO;YACrC,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAC;QAC1H,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,OAAO,CAAC,uBAAuB,CAAC,SAAS,EAAE,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1G,CAAC;IALqB,8BAAe,kBAKpC,CAAA;AACH,CAAC,EAzCgB,cAAc,KAAd,cAAc,QAyC9B","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 { LocalFileName } from \"@itwin/core-common\";\r\nimport { GuidString } from \"@itwin/core-bentley\";\r\nimport { Setting, SettingName, SettingsContainer } from \"./Settings\";\r\nimport { BlobContainer } from \"../BlobContainerService\";\r\nimport { CloudSqliteContainer, GetWorkspaceContainerArgs, Workspace, WorkspaceContainerProps, WorkspaceDbName, WorkspaceDbNameAndVersion, WorkspaceDbVersion } from \"./Workspace\";\r\nimport { SettingsDb, SettingsDbManifest, SettingsDbProps } from \"./SettingsDb\";\r\nimport { SettingsSqliteDb } from \"../internal/workspace/SettingsSqliteDb\";\r\nimport { constructSettingsEditor } from \"../internal/workspace/SettingsImpl\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\nimport { CloudSqlite } from \"../CloudSqlite\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/** @beta */\r\nexport namespace SettingsEditor {\r\n /**\r\n * Create a new [[SettingsEditor]] for creating new versions of [[SettingsDb]]s.\r\n * @note The caller becomes the owner of the SettingsEditor and is responsible for calling [[SettingsEditor.close]] on it when finished.\r\n * @note It is illegal to have more than one SettingsEditor active in a single session.\r\n */\r\n export function construct(): SettingsEditor {\r\n return constructSettingsEditor();\r\n }\r\n\r\n /**\r\n * Create a new, empty, [[SettingsDb]] file on the local filesystem for importing settings dictionaries.\r\n */\r\n export function createEmptyDb(args: { localFileName: LocalFileName; manifest: SettingsDbManifest }): void {\r\n SettingsSqliteDb.createNewDb(args.localFileName, args);\r\n }\r\n\r\n /** Arguments for [[SettingsEditor.queryContainers]] and [[SettingsEditor.findContainers]]. */\r\n export interface QuerySettingsContainersArgs {\r\n /** The iTwinId whose settings containers should be queried. */\r\n iTwinId: GuidString;\r\n /** Optional iModelId to further scope the query to containers associated with a specific iModel. */\r\n iModelId?: GuidString;\r\n /** Optional label filter. */\r\n label?: string;\r\n }\r\n\r\n /**\r\n * Query the [[BlobContainer]] service for all settings containers associated with a given iTwin.\r\n * This is a convenience wrapper around `BlobContainer.service.queryContainersMetadata` that\r\n * automatically filters by `containerType: \"settings\"`.\r\n * @param args - The query arguments including the iTwinId.\r\n * @returns A promise that resolves to the matching container metadata entries.\r\n * @note Requires [[IModelHost.authorizationClient]] to be configured.\r\n */\r\n export async function queryContainers(args: QuerySettingsContainersArgs): Promise<BlobContainer.MetadataResponse[]> {\r\n if (undefined === BlobContainer.service)\r\n throw new Error(\"BlobContainer.service is not available. Ensure IModelHost is initialized with a valid configuration.\");\r\n const userToken = await IModelHost.getAccessToken();\r\n return BlobContainer.service.queryContainersMetadata(userToken, { ...args, containerType: \"settings\" });\r\n }\r\n}\r\n\r\n/** Arguments supplied to [[SettingsEditor.createNewCloudContainer]] to create a new [[EditableSettingsCloudContainer]].\r\n * The created container will automatically have `containerType: \"settings\"` in its metadata, enabling discovery\r\n * via `BlobContainer.service.queryContainersMetadata({ containerType: \"settings\" })`.\r\n * @beta\r\n */\r\nexport interface CreateNewSettingsContainerArgs {\r\n /**\r\n * The scope of the container. This determines the ownership of the container, how RBAC rights are assigned,\r\n * and the location of the datacenter.\r\n */\r\n scope: BlobContainer.Scope;\r\n /** The manifest to be stored in the default SettingsDb in the new container. */\r\n manifest: SettingsDbManifest;\r\n /** Metadata stored by the BlobContainer service. The `containerType` field is omitted here because it is\r\n * automatically set to `\"settings\"` when the container is created (mirroring the `\"workspace\"` convention for WorkspaceDb containers).\r\n */\r\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\r\n /** The name of the default [[SettingsDb]] created inside the new container.\r\n * Default: \"settings-db\";\r\n */\r\n dbName?: WorkspaceDbName;\r\n}\r\n\r\n/** Arguments supplied to [[EditableSettingsCloudContainer.createNewSettingsDbVersion]].\r\n * @beta\r\n */\r\nexport interface CreateNewSettingsDbVersionArgs {\r\n /**\r\n * The properties that determine the source [[SettingsDb]] to serve as the basis for the new version.\r\n * This is usually the latest version, but it is possible to create patches to older versions.\r\n */\r\n fromProps?: SettingsDbProps;\r\n /** The type of version increment to apply to the source version. */\r\n versionType: CloudSqlite.SemverIncrement;\r\n /** For prerelease versions, a string that becomes part of the version name. */\r\n identifier?: string;\r\n}\r\n\r\n/** The result of creating a new version of a [[SettingsDb]].\r\n * @beta\r\n */\r\nexport interface SettingsDbVersionResult {\r\n /** The name and version of the source SettingsDb. */\r\n oldDb: WorkspaceDbNameAndVersion;\r\n /** The name and version of the newly-created SettingsDb. */\r\n newDb: WorkspaceDbNameAndVersion;\r\n}\r\n\r\n/** Arguments supplied to [[EditableSettingsCloudContainer.createDb]] to create a new [[SettingsDb]] in a container.\r\n * @beta\r\n */\r\nexport interface CreateSettingsDbArgs {\r\n /** The name of the new SettingsDb. Default: `\"settings-db\"`. */\r\n dbName?: WorkspaceDbName;\r\n /** The initial version of the new SettingsDb. Default: `\"0.0.0\"`. */\r\n version?: WorkspaceDbVersion;\r\n /** The manifest for the new SettingsDb. */\r\n manifest: SettingsDbManifest;\r\n}\r\n\r\n/** Arguments supplied to [[EditableSettingsDb.updateSetting]] to add or update a single [[Setting]].\r\n * @beta\r\n */\r\nexport interface UpdateSettingArgs {\r\n /** The [[SettingName]] of the setting to add or update. */\r\n readonly settingName: SettingName;\r\n /** The new value for the setting. */\r\n readonly value: Setting;\r\n}\r\n\r\n/**\r\n * A [[CloudSqliteContainer]] opened for editing settings by a [[SettingsEditor]].\r\n * You can create new [[SettingsDb]]s or new versions of existing [[SettingsDb]]s inside it.\r\n * Before actually making any changes to the container's contents, you must first obtain an exclusive write lock on it via\r\n * [[acquireWriteLock]]. Only one user can hold the write lock at any given time. When you have finished making changes,\r\n * you can use [[releaseWriteLock]] to publish your changes, or [[abandonChanges]] to discard them.\r\n * @note Settings containers are separate from workspace containers, providing independent write locks.\r\n * Editing settings does not block workspace resource editing, and vice versa.\r\n * @beta\r\n */\r\nexport interface EditableSettingsCloudContainer extends CloudSqliteContainer {\r\n /**\r\n * Create a copy of an existing [[SettingsDb]] in this container with a new [[WorkspaceDbVersion]].\r\n * The copy should be modified with new content before the write lock is released,\r\n * and thereafter may never be modified again.\r\n * @param args - The properties that determine the source SettingsDb and the version increment to apply.\r\n * @returns A promise that resolves to an object containing the old and new SettingsDb names and versions.\r\n */\r\n createNewSettingsDbVersion(args: CreateNewSettingsDbVersionArgs): Promise<SettingsDbVersionResult>;\r\n\r\n /**\r\n * Create a new, empty [[SettingsDb]].\r\n * @param args - The arguments for creating the new SettingsDb.\r\n * @returns A promise that resolves to an EditableSettingsDb.\r\n */\r\n createDb(args: CreateSettingsDbArgs): Promise<EditableSettingsDb>;\r\n\r\n /**\r\n * Get the cloud properties of this container.\r\n */\r\n readonly cloudProps: WorkspaceContainerProps | undefined;\r\n\r\n /**\r\n * Get an editable [[SettingsDb]] to add, delete, or update settings *within a newly created version* of a SettingsDb.\r\n * @param props - The properties of the SettingsDb.\r\n * @returns An EditableSettingsDb for modifying settings.\r\n * @throws if the targeted SettingsDb has already been published and is immutable. Use [[createNewSettingsDbVersion]] first to create an editable version.\r\n */\r\n getEditableDb(props?: SettingsDbProps): EditableSettingsDb;\r\n\r\n /**\r\n * Acquire the write lock on the container. Use [[releaseWriteLock]] to release the lock after publishing your changes, or\r\n * [[abandonChanges]] to release the lock and discard your changes.\r\n * Only one user can hold the write lock at any given time. However, readers can continue to read the published contents of the container while\r\n * a writer holds the write lock. Readers will only see the writer's changes after they are published by [[releaseWriteLock]].\r\n * @param user - The name of the user acquiring the write lock.\r\n * @throws if the write lock is already held by another user.\r\n */\r\n acquireWriteLock(user: string): void;\r\n\r\n /**\r\n * Release the write lock on the container. This should be called after all changes to the container's contents are complete. It\r\n * publishes and uploads the changes made to any [[SettingsDb]]s while the lock was held, after which those dbs become immutable.\r\n */\r\n releaseWriteLock(): void;\r\n\r\n /**\r\n * Abandon any changes made to the container and release the write lock. Any newly created versions of SettingsDbs are discarded.\r\n */\r\n abandonChanges(): void;\r\n}\r\n\r\n/**\r\n * An editable [[SettingsDb]]. This is used only by tools to allow administrators to create and modify SettingsDbs.\r\n * For cloud-based SettingsDbs, the container's write token must be obtained via [[EditableSettingsCloudContainer.acquireWriteLock]] before the methods in this interface may be used.\r\n * Normally, only admins will have write access.\r\n * Only one admin at a time may be editing a settings container.\r\n * @note Unlike [[EditableWorkspaceDb]], this interface only supports settings operations — no blob, file, or string resource methods.\r\n * @beta\r\n */\r\nexport interface EditableSettingsDb extends SettingsDb {\r\n readonly container: EditableSettingsCloudContainer;\r\n\r\n /**\r\n * Update the contents of the manifest in this SettingsDb.\r\n * @note This replaces the stored manifest entirely; omitted fields are lost.\r\n * @param manifest - The updated manifest.\r\n */\r\n updateManifest(manifest: SettingsDbManifest): void;\r\n\r\n /**\r\n * Replace all settings in this SettingsDb with the given container.\r\n * @param settings - The settings object to store.\r\n */\r\n updateSettings(settings: SettingsContainer): void;\r\n\r\n /**\r\n * Add or update a single [[Setting]] by name.\r\n * If a setting with the given name already exists, its value is replaced.\r\n * If it does not exist, it is added. Other settings are preserved.\r\n * @param args - The arguments specifying the setting name and value.\r\n */\r\n updateSetting(args: UpdateSettingArgs): void;\r\n\r\n /**\r\n * Remove a single [[Setting]] by name. Other settings are preserved.\r\n * @param settingName - The name of the setting to remove.\r\n */\r\n removeSetting(settingName: SettingName): void;\r\n}\r\n\r\n/** An object that permits administrators to modify the contents of settings containers.\r\n * Use [[SettingsEditor.construct]] to obtain a SettingsEditor, and [[close]] when finished using it.\r\n * Only one SettingsEditor may be in use at any given time.\r\n * Use [[getContainer]] to edit an existing container, or [[createNewCloudContainer]] to create a new container.\r\n * @beta\r\n */\r\nexport interface SettingsEditor {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n\r\n /**\r\n * The workspace dedicated to this editor.\r\n * @note This workspace is independent from [[IModelHost.appWorkspace]] and all [[IModelDb.workspace]]s.\r\n */\r\n readonly workspace: Workspace;\r\n\r\n /**\r\n * Retrieves a container for the editor with the specified properties and access token.\r\n */\r\n getContainer(args: GetWorkspaceContainerArgs): EditableSettingsCloudContainer;\r\n\r\n /**\r\n * Asynchronously retrieves a container for the editor with the specified properties.\r\n */\r\n getContainerAsync(props: WorkspaceContainerProps): Promise<EditableSettingsCloudContainer>;\r\n\r\n /**\r\n * Creates a new cloud container for holding SettingsDbs, from the [[BlobContainer]] service.\r\n * The container is automatically assigned `containerType: \"settings\"` in its metadata and\r\n * initialized with a default [[SettingsDb]].\r\n * @param args - The arguments for creating the container, including scope, metadata, and manifest.\r\n * @returns A promise that resolves to the new EditableSettingsCloudContainer.\r\n * @note The current user must have administrator rights for the iTwin for the container.\r\n * @note Requires [[IModelHost.authorizationClient]] to be configured.\r\n */\r\n createNewCloudContainer(args: CreateNewSettingsContainerArgs): Promise<EditableSettingsCloudContainer>;\r\n\r\n /**\r\n * Find and open existing settings containers by querying the [[BlobContainer]] service.\r\n * This is a convenience method that queries for all settings containers matching the given iTwinId\r\n * (and optionally iModelId), requests write access tokens, and opens each matching container.\r\n * @param args - The query arguments including iTwinId and optionally iModelId and label.\r\n * @returns A promise that resolves to an array of opened [[EditableSettingsCloudContainer]]s.\r\n * @note Requires [[IModelHost.authorizationClient]] and [[BlobContainer.service]] to be configured.\r\n */\r\n findContainers(args: SettingsEditor.QuerySettingsContainersArgs): Promise<EditableSettingsCloudContainer[]>;\r\n\r\n /**\r\n * Closes this editor. All settings containers are dropped.\r\n */\r\n close(): void;\r\n}\r\n"]}
@@ -2,10 +2,11 @@
2
2
  * @module Workspace
3
3
  */
4
4
  import { AccessToken, BeEvent, ITwinError, Optional } from "@itwin/core-bentley";
5
- import { LocalDirName, LocalFileName } from "@itwin/core-common";
5
+ import { DbCloudContainerInfo, LocalDirName, LocalFileName } from "@itwin/core-common";
6
6
  import { CloudSqlite } from "../CloudSqlite";
7
7
  import { SQLiteDb } from "../SQLiteDb";
8
8
  import { SettingName, Settings, SettingsDictionary, SettingsPriority } from "./Settings";
9
+ import { GetSettingsDbArgs, SettingsDb } from "./SettingsDb";
9
10
  import type { IModelJsNative } from "@bentley/imodeljs-native";
10
11
  import { _implementationProhibited } from "../internal/Symbols";
11
12
  /** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.
@@ -71,7 +72,8 @@ export interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {
71
72
  /** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.
72
73
  * @beta
73
74
  */
74
- export type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;
75
+ export interface WorkspaceDbCloudProps extends WorkspaceDbProps, WorkspaceContainerProps, DbCloudContainerInfo {
76
+ }
75
77
  /** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.
76
78
  * @beta
77
79
  */
@@ -141,8 +143,12 @@ export interface WorkspaceDbLoadErrors extends ITwinError {
141
143
  * @beta
142
144
  */
143
145
  export interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {
144
- /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */
145
- resourceName: string;
146
+ /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]].
147
+ * Defaults to `"settings"`, which matches the key used by
148
+ * [[EditableSettingsDb.updateSettings]] to write settings. You should generally omit this
149
+ * field unless you need to load settings stored under a non-standard key.
150
+ */
151
+ resourceName?: string;
146
152
  /** The priority to assign to the [[SettingsDictionary]]. */
147
153
  priority: SettingsPriority;
148
154
  }
@@ -318,6 +324,13 @@ export interface Workspace {
318
324
  problems?: WorkspaceDbLoadError[]): Promise<void>;
319
325
  /** Get a single [[WorkspaceDb]]. */
320
326
  getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;
327
+ /** Get a [[SettingsDb]] from a previously-loaded settings container in this workspace.
328
+ * @param args The arguments identifying which SettingsDb to retrieve.
329
+ * @returns The SettingsDb from the matching container.
330
+ * @throws if no container matching [[GetSettingsDbArgs.containerId]] has been loaded into this workspace, or if the container does not hold a SettingsDb.
331
+ * @note The container must already be loaded via [[getContainer]] or [[getContainerAsync]] before calling this method.
332
+ */
333
+ getSettingsDb(args: GetSettingsDbArgs): SettingsDb;
321
334
  /**
322
335
  * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]
323
336
  * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].
@@ -347,37 +360,45 @@ export interface Workspace {
347
360
  }): Promise<WorkspaceDb[]>;
348
361
  }
349
362
  /**
350
- * 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.
351
- * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that
352
- * 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
353
- * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).
354
- * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.
355
- * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.
356
- * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.
363
+ * Base interface for containers backed by [[CloudSqlite]] that hold versioned databases (e.g. [[WorkspaceDb]]s or [[SettingsDb]]s).
364
+ * Provides the shared infrastructure for cloud access, local file caching, and semver-based database resolution.
365
+ * @note Not every container is associated with a [[CloudSqlite.CloudContainer]] containers may also be loaded from the local file system.
357
366
  * In this case, [[cloudContainer]] will be `undefined`.
358
- * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.
367
+ * @see [[WorkspaceContainer]] for workspace-specific containers.
359
368
  * @beta
360
369
  */
361
- export interface WorkspaceContainer {
370
+ export interface CloudSqliteContainer {
362
371
  /** @internal */
363
372
  [_implementationProhibited]: unknown;
364
- /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.
373
+ /** the local directory where this container will store temporary files extracted for file-resources.
365
374
  * @internal
366
375
  */
367
376
  readonly filesDir: LocalDirName;
368
377
  /** The workspace into which this container was loaded. */
369
378
  readonly workspace: Workspace;
370
- /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */
379
+ /** Cloud container for this container, or `undefined` if this is a local container. */
371
380
  readonly cloudContainer?: CloudSqlite.CloudContainer;
372
381
  /** Properties supplied when this container was loaded */
373
382
  readonly fromProps: WorkspaceContainerProps;
374
- /** @internal */
375
- addWorkspaceDb(toAdd: WorkspaceDb): void;
376
383
  /**
377
- * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.
384
+ * Find the fully-qualified name of a database satisfying the name and version criteria specified by `props`.
378
385
  * @throws Error if no version satisfying the criteria exists.
379
386
  */
380
387
  resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;
388
+ }
389
+ /**
390
+ * A [[CloudSqliteContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.
391
+ * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that
392
+ * 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
393
+ * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).
394
+ * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.
395
+ * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.
396
+ * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.
397
+ * @beta
398
+ */
399
+ export interface WorkspaceContainer extends CloudSqliteContainer {
400
+ /** @internal */
401
+ addWorkspaceDb(toAdd: WorkspaceDb): void;
381
402
  /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */
382
403
  getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;
383
404
  /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.