@itwin/core-backend 3.4.0-dev.46 → 3.4.0-dev.48

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 (219) hide show
  1. package/lib/cjs/AliCloudStorageService.d.ts +17 -17
  2. package/lib/cjs/AliCloudStorageService.js +68 -68
  3. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  4. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  5. package/lib/cjs/BackendHubAccess.js +41 -41
  6. package/lib/cjs/BackendHubAccess.js.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.d.ts +82 -82
  8. package/lib/cjs/BackendLoggerCategory.js +90 -90
  9. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  11. package/lib/cjs/BisCoreSchema.js +60 -60
  12. package/lib/cjs/BisCoreSchema.js.map +1 -1
  13. package/lib/cjs/BriefcaseManager.d.ts +165 -165
  14. package/lib/cjs/BriefcaseManager.js +405 -405
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.d.ts +153 -153
  17. package/lib/cjs/Category.js +243 -243
  18. package/lib/cjs/Category.js.map +1 -1
  19. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  20. package/lib/cjs/ChangeSummaryManager.js +445 -445
  21. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  22. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  23. package/lib/cjs/ChangedElementsDb.js +165 -165
  24. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  25. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  26. package/lib/cjs/ChangedElementsManager.js +88 -88
  27. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  28. package/lib/cjs/CheckpointManager.d.ts +122 -122
  29. package/lib/cjs/CheckpointManager.js +354 -354
  30. package/lib/cjs/CheckpointManager.js.map +1 -1
  31. package/lib/cjs/ClassRegistry.d.ts +71 -71
  32. package/lib/cjs/ClassRegistry.js +213 -213
  33. package/lib/cjs/ClassRegistry.js.map +1 -1
  34. package/lib/cjs/CloudSqlite.d.ts +328 -328
  35. package/lib/cjs/CloudSqlite.js +135 -135
  36. package/lib/cjs/CloudSqlite.js.map +1 -1
  37. package/lib/cjs/CloudStorageBackend.d.ts +46 -46
  38. package/lib/cjs/CloudStorageBackend.js +164 -164
  39. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  40. package/lib/cjs/CodeService.d.ts +391 -391
  41. package/lib/cjs/CodeService.js +61 -61
  42. package/lib/cjs/CodeService.js.map +1 -1
  43. package/lib/cjs/CodeSpecs.d.ts +50 -50
  44. package/lib/cjs/CodeSpecs.js +112 -112
  45. package/lib/cjs/CodeSpecs.js.map +1 -1
  46. package/lib/cjs/ConcurrentQuery.d.ts +11 -11
  47. package/lib/cjs/ConcurrentQuery.js +30 -30
  48. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  49. package/lib/cjs/CustomViewState3dCreator.d.ts +32 -32
  50. package/lib/cjs/CustomViewState3dCreator.js +99 -99
  51. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  52. package/lib/cjs/DevTools.d.ts +71 -71
  53. package/lib/cjs/DevTools.js +154 -154
  54. package/lib/cjs/DevTools.js.map +1 -1
  55. package/lib/cjs/DisplayStyle.d.ts +106 -106
  56. package/lib/cjs/DisplayStyle.js +256 -256
  57. package/lib/cjs/DisplayStyle.js.map +1 -1
  58. package/lib/cjs/ECDb.d.ts +191 -191
  59. package/lib/cjs/ECDb.js +350 -350
  60. package/lib/cjs/ECDb.js.map +1 -1
  61. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  62. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  63. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  64. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  65. package/lib/cjs/ECSqlStatement.js +791 -791
  66. package/lib/cjs/ECSqlStatement.js.map +1 -1
  67. package/lib/cjs/Element.d.ts +1109 -1109
  68. package/lib/cjs/Element.js +1421 -1421
  69. package/lib/cjs/Element.js.map +1 -1
  70. package/lib/cjs/ElementAspect.d.ts +156 -156
  71. package/lib/cjs/ElementAspect.js +178 -178
  72. package/lib/cjs/ElementAspect.js.map +1 -1
  73. package/lib/cjs/ElementGraphics.d.ts +9 -9
  74. package/lib/cjs/ElementGraphics.js +41 -41
  75. package/lib/cjs/ElementGraphics.js.map +1 -1
  76. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  77. package/lib/cjs/ElementTreeWalker.js +409 -409
  78. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  79. package/lib/cjs/Entity.d.ts +76 -76
  80. package/lib/cjs/Entity.js +82 -82
  81. package/lib/cjs/Entity.js.map +1 -1
  82. package/lib/cjs/ExportGraphics.d.ts +317 -317
  83. package/lib/cjs/ExportGraphics.js +208 -208
  84. package/lib/cjs/ExportGraphics.js.map +1 -1
  85. package/lib/cjs/ExternalSource.d.ts +94 -94
  86. package/lib/cjs/ExternalSource.js +125 -125
  87. package/lib/cjs/ExternalSource.js.map +1 -1
  88. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  89. package/lib/cjs/GeoCoordConfig.js +82 -82
  90. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  91. package/lib/cjs/GeometrySummary.d.ts +4 -4
  92. package/lib/cjs/GeometrySummary.js +380 -380
  93. package/lib/cjs/GeometrySummary.js.map +1 -1
  94. package/lib/cjs/HubMock.d.ts +93 -93
  95. package/lib/cjs/HubMock.js +190 -190
  96. package/lib/cjs/HubMock.js.map +1 -1
  97. package/lib/cjs/IModelCloneContext.d.ts +85 -85
  98. package/lib/cjs/IModelCloneContext.js +150 -150
  99. package/lib/cjs/IModelCloneContext.js.map +1 -1
  100. package/lib/cjs/IModelDb.d.ts +1164 -1164
  101. package/lib/cjs/IModelDb.js +2321 -2321
  102. package/lib/cjs/IModelDb.js.map +1 -1
  103. package/lib/cjs/IModelHost.d.ts +347 -347
  104. package/lib/cjs/IModelHost.js +457 -457
  105. package/lib/cjs/IModelHost.js.map +1 -1
  106. package/lib/cjs/IModelJsFs.d.ts +62 -62
  107. package/lib/cjs/IModelJsFs.js +140 -140
  108. package/lib/cjs/IModelJsFs.js.map +1 -1
  109. package/lib/cjs/IpcHost.d.ts +98 -98
  110. package/lib/cjs/IpcHost.js +234 -234
  111. package/lib/cjs/IpcHost.js.map +1 -1
  112. package/lib/cjs/LineStyle.d.ts +311 -311
  113. package/lib/cjs/LineStyle.js +295 -295
  114. package/lib/cjs/LineStyle.js.map +1 -1
  115. package/lib/cjs/LocalHub.d.ts +162 -162
  116. package/lib/cjs/LocalHub.js +587 -587
  117. package/lib/cjs/LocalHub.js.map +1 -1
  118. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  119. package/lib/cjs/LocalhostIpcHost.js +81 -81
  120. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  121. package/lib/cjs/Material.d.ts +103 -103
  122. package/lib/cjs/Material.js +147 -147
  123. package/lib/cjs/Material.js.map +1 -1
  124. package/lib/cjs/Model.d.ts +386 -386
  125. package/lib/cjs/Model.js +468 -468
  126. package/lib/cjs/Model.js.map +1 -1
  127. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  128. package/lib/cjs/NativeAppStorage.js +202 -202
  129. package/lib/cjs/NativeAppStorage.js.map +1 -1
  130. package/lib/cjs/NativeHost.d.ts +52 -52
  131. package/lib/cjs/NativeHost.js +168 -168
  132. package/lib/cjs/NativeHost.js.map +1 -1
  133. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  134. package/lib/cjs/NavigationRelationship.js +225 -225
  135. package/lib/cjs/NavigationRelationship.js.map +1 -1
  136. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  137. package/lib/cjs/PromiseMemoizer.js +95 -95
  138. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  139. package/lib/cjs/PropertyStore.d.ts +132 -132
  140. package/lib/cjs/PropertyStore.js +11 -11
  141. package/lib/cjs/PropertyStore.js.map +1 -1
  142. package/lib/cjs/Relationship.d.ts +400 -400
  143. package/lib/cjs/Relationship.js +465 -465
  144. package/lib/cjs/Relationship.js.map +1 -1
  145. package/lib/cjs/RpcBackend.d.ts +28 -28
  146. package/lib/cjs/RpcBackend.js +126 -126
  147. package/lib/cjs/RpcBackend.js.map +1 -1
  148. package/lib/cjs/SQLiteDb.d.ts +219 -219
  149. package/lib/cjs/SQLiteDb.js +214 -214
  150. package/lib/cjs/SQLiteDb.js.map +1 -1
  151. package/lib/cjs/Schema.d.ts +55 -55
  152. package/lib/cjs/Schema.js +83 -83
  153. package/lib/cjs/Schema.js.map +1 -1
  154. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  155. package/lib/cjs/ServerBasedLocks.js +168 -168
  156. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  157. package/lib/cjs/SqliteStatement.d.ts +283 -283
  158. package/lib/cjs/SqliteStatement.js +448 -448
  159. package/lib/cjs/SqliteStatement.js.map +1 -1
  160. package/lib/cjs/Texture.d.ts +58 -58
  161. package/lib/cjs/Texture.js +82 -82
  162. package/lib/cjs/Texture.js.map +1 -1
  163. package/lib/cjs/TxnManager.d.ts +202 -202
  164. package/lib/cjs/TxnManager.js +353 -353
  165. package/lib/cjs/TxnManager.js.map +1 -1
  166. package/lib/cjs/ViewDefinition.d.ts +435 -435
  167. package/lib/cjs/ViewDefinition.js +629 -629
  168. package/lib/cjs/ViewDefinition.js.map +1 -1
  169. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  170. package/lib/cjs/ViewStateHydrator.js +103 -103
  171. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  172. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  173. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  174. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  175. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  176. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  177. package/lib/cjs/core-backend.d.ts +178 -178
  178. package/lib/cjs/core-backend.js +198 -198
  179. package/lib/cjs/core-backend.js.map +1 -1
  180. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  181. package/lib/cjs/domains/FunctionalElements.js +145 -145
  182. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  183. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  184. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  185. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  186. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  187. package/lib/cjs/domains/GenericElements.js +263 -263
  188. package/lib/cjs/domains/GenericElements.js.map +1 -1
  189. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  190. package/lib/cjs/domains/GenericSchema.js +28 -28
  191. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  192. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  193. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  194. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  195. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +45 -45
  196. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +262 -262
  197. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  198. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +20 -20
  199. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +195 -195
  200. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  201. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  202. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +165 -165
  203. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  204. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  205. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  206. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  207. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  208. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  209. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  210. package/lib/cjs/workspace/Settings.d.ts +186 -186
  211. package/lib/cjs/workspace/Settings.js +152 -152
  212. package/lib/cjs/workspace/Settings.js.map +1 -1
  213. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  214. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  215. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  216. package/lib/cjs/workspace/Workspace.d.ts +405 -405
  217. package/lib/cjs/workspace/Workspace.js +539 -539
  218. package/lib/cjs/workspace/Workspace.js.map +1 -1
  219. package/package.json +11 -11
@@ -1,406 +1,406 @@
1
- /** @packageDocumentation
2
- * @module Workspace
3
- */
4
- import { BeEvent, Optional } from "@itwin/core-bentley";
5
- import { LocalDirName, LocalFileName } from "@itwin/core-common";
6
- import { CloudSqlite } from "../CloudSqlite";
7
- import { SQLiteDb } from "../SQLiteDb";
8
- import { Settings, SettingsPriority } from "./Settings";
9
- /** The Settings used by Workspace api
10
- * @beta
11
- */
12
- export declare const WorkspaceSetting: {
13
- Accounts: string;
14
- Containers: string;
15
- Databases: string;
16
- };
17
- /** Types used to identify cloud accounts for Workspaces.
18
- * @beta
19
- */
20
- export declare namespace WorkspaceAccount {
21
- /** The name of a WorkspaceAccount in a "cloud/accounts" setting. */
22
- type Name = string;
23
- /** A member named `accountName` that specifies by an entry in a "cloud/accounts" setting */
24
- interface Alias {
25
- accountName: string;
26
- }
27
- /** The properties of a cloud account required to open containers with CloudSqlite. Usually supplied via a "cloud/accounts" setting. */
28
- type Props = CloudSqlite.AccountAccessProps;
29
- }
30
- /** @beta */
31
- export declare namespace WorkspaceContainer {
32
- /** The name of a WorkspaceContainer in a "cloud/containers" setting. */
33
- type Name = string;
34
- /** The unique identifier of a WorkspaceContainer. This becomes the base name for the local directory holding the WorkspaceDbs from a WorkspaceContainer.
35
- * Usually supplied via the `containerId` member of a "cloud/containers" setting.
36
- * `WorkspaceContainer.Id`s may:
37
- * - only contain lower case letters, numbers or dashes
38
- * - not start or end with a dash
39
- * - not be shorter than 3 or longer than 63 characters
40
- */
41
- type Id = string;
42
- /** A member named `containerName` that specifies by an entry in a "cloud/containers" setting */
43
- interface Alias {
44
- containerName: string;
45
- }
46
- /** Properties that specify a WorkspaceContainer. */
47
- interface Props extends Optional<CloudSqlite.ContainerProps, "accessToken"> {
48
- /** true if the container is public (doesn't require authentication) */
49
- isPublic?: boolean;
50
- /** attempt to synchronize (i.e. call `checkForChanges`) this cloud container whenever it is connected to a cloud cache. */
51
- syncOnConnect?: boolean;
52
- }
53
- }
54
- /** @beta */
55
- export declare namespace WorkspaceDb {
56
- /** The name of a WorkspaceDb in a "workspace/databases" setting. */
57
- type Name = string;
58
- /** The base name of a WorkspaceDb within a WorkspaceContainer (without any version identifier) */
59
- type DbName = string;
60
- /** The name of a WorkspaceDb within a WorkspaceContainer, including the version identifier */
61
- type DbFullName = string;
62
- /** The semver-format version identifier for a WorkspaceDb. */
63
- type Version = string;
64
- /** The [semver range format](https://github.com/npm/node-semver) identifier for a range of acceptable versions. */
65
- type VersionRange = string;
66
- /** Properties that specify how to load a WorkspaceDb within a [[WorkspaceContainer]]. */
67
- interface Props extends CloudSqlite.DbNameProp {
68
- /** a semver version range specifier that determines the acceptable range of versions to load. If not present, use the newest version. */
69
- version?: VersionRange;
70
- /** if true, allow semver *prerelease* versions. By default only released version are allowed. */
71
- includePrerelease?: boolean;
72
- }
73
- /** Scope to increment for a version number.
74
- * @see semver.ReleaseType
75
- */
76
- type VersionIncrement = "major" | "minor" | "patch";
77
- }
78
- /** Types used to identify Workspace resources
79
- * @beta
80
- */
81
- export declare namespace WorkspaceResource {
82
- /**
83
- * The name for identifying WorkspaceResources in a [[WorkspaceDb]].
84
- * * `WorkspaceResource.Name`s may not:
85
- * - be blank or start or end with a space
86
- * - be longer than 1024 characters
87
- * @note a single WorkspaceDb may hold WorkspaceResources of type 'blob', 'string' and 'file', all with the same WorkspaceResource.Name.
88
- */
89
- type Name = string;
90
- /** Properties that specify an individual WorkspaceResource within a [[WorkspaceDb]]. */
91
- interface Props {
92
- /** the name of the resource within the WorkspaceDb */
93
- rscName: Name;
94
- }
95
- }
96
- /**
97
- * A WorkspaceDb holds workspace resources. `WorkspaceDb`s may just be local files, or they may be stored
98
- * in cloud WorkspaceContainers. Each `WorkspaceResource` in a WorkspaceDb is identified by a [[WorkspaceResource.Name]].
99
- * Resources of type `string` and `blob` may be loaded directly from the `WorkspaceDb`. Resources of type `file` are
100
- * copied from the WorkspaceDb into a temporary local file so they can be accessed by programs directly from disk.
101
- * @beta
102
- */
103
- export interface WorkspaceDb {
104
- /** The WorkspaceContainer holding this WorkspaceDb. */
105
- readonly container: WorkspaceContainer;
106
- /** The base name of this WorkspaceDb, without version */
107
- readonly dbName: WorkspaceDb.DbName;
108
- /** event raised before this WorkspaceDb is closed. */
109
- readonly onClose: BeEvent<() => void>;
110
- /** Name by which a WorkspaceDb may be opened. This will be either a local file name or the name of a database in a cloud container */
111
- readonly dbFileName: string;
112
- /** Get a string resource from this WorkspaceDb, if present. */
113
- getString(rscName: WorkspaceResource.Name): string | undefined;
114
- /** Get a blob resource from this WorkspaceDb, if present. */
115
- getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
116
- /** @internal */
117
- getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
118
- /**
119
- * Extract a local copy of a file resource from this WorkspaceDb, if present.
120
- * @param rscName The name of the file resource in the WorkspaceDb
121
- * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If
122
- * 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
123
- * keep the extracted files in the filesDir.
124
- * @returns the full path to a file on the local filesystem.
125
- * @note The file is copied from the file into the local filesystem so it may be accessed directly. This happens only
126
- * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.
127
- * For this reason, you should not save the local file name, and instead call this method every time you access it, so its
128
- * content is always holds the correct version.
129
- * @note The filename will be a hash value, not the resource name.
130
- * @note Workspace resource files are set readonly as they are copied from the file.
131
- * To edit them, you must first copy them to another location.
132
- */
133
- getFile(rscName: WorkspaceResource.Name, targetFileName?: LocalFileName): LocalFileName | undefined;
134
- /**
135
- * Ensure that the contents of a `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.
136
- * Until the promise is resolved, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.
137
- * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.
138
- */
139
- prefetch(): void;
140
- }
141
- /** The properties of the CloudCache used for Workspaces.
142
- * @beta
143
- */
144
- export interface WorkspaceCloudCacheProps extends Optional<CloudSqlite.CacheProps, "name" | "rootDir"> {
145
- /** if true, empty the cache before using it. */
146
- clearContents?: boolean;
147
- }
148
- /**
149
- * Options for constructing a [[Workspace]].
150
- * @beta
151
- */
152
- export interface WorkspaceOpts {
153
- /** The local directory for non-cloud-based WorkspaceDb files. The workspace api will look in this directory
154
- * for files named `${containerId}/${dbId}.itwin-workspace`.
155
- * @note if not supplied, defaults to `iTwin/Workspace` in the user-local folder.
156
- */
157
- containerDir?: LocalDirName;
158
- /** the local fileName(s) of one or more settings files to load after the Workspace is first created. */
159
- settingsFiles?: LocalFileName | [LocalFileName];
160
- /**
161
- * only for tests
162
- * @internal */
163
- testCloudCache?: CloudSqlite.CloudCache;
164
- }
165
- /**
166
- * Settings and resources that customize an application for the current session.
167
- * See [Workspaces]($docs/learning/backend/Workspace)
168
- * @beta
169
- */
170
- export interface Workspace {
171
- /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`. */
172
- readonly containerDir: LocalDirName;
173
- /** The [[Settings]] for this Workspace */
174
- readonly settings: Settings;
175
- /** The CloudCache for cloud-based WorkspaceContainers */
176
- readonly cloudCache?: CloudSqlite.CloudCache;
177
- /** search for a previously opened container.
178
- * @param containerId the id of the container
179
- * @returns the [[WorkspaceContainer]] for `containerId` if it was not previously opened with [[getContainer]]
180
- */
181
- findContainer(containerId: WorkspaceContainer.Id): WorkspaceContainer | undefined;
182
- /** get a [[WorkspaceContainer]] by [[WorkspaceContainer.Props]]
183
- * @param props the properties of the `WorkspaceContainer`. If `props.containerId` was already opened, its WorkspaceContainer is returned.
184
- * Otherwise it is created.
185
- * @param account If present, the properties for this container if it is to be opened from the cloud. If not present, the container is just a local directory.
186
- */
187
- getContainer(props: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceContainer;
188
- /** get the properties for the supplied account name by searching for an entry with that name in a `cloud/accounts` setting. */
189
- resolveAccount(accountName: WorkspaceAccount.Name): WorkspaceAccount.Props;
190
- /** get the properties for the supplied container name by searching for an entry with that name in a `cloud/containers` setting. */
191
- resolveContainer(containerName: WorkspaceContainer.Name): WorkspaceContainer.Props & WorkspaceAccount.Alias;
192
- /** get the properties for the supplied workspace database name by searching for an entry with that name in a `workspace/databases` setting. */
193
- resolveDatabase(databaseAlias: WorkspaceDb.Name): WorkspaceDb.Props & WorkspaceContainer.Alias;
194
- /**
195
- * Get an opened [[WorkspaceDb]]. If the WorkspaceDb is present but not open, it is opened first.
196
- * If `cloudProps` are supplied, a CloudContainer will be used to open the WorkspaceDb.
197
- */
198
- getWorkspaceDbFromProps(dbProps: WorkspaceDb.Props, containerProps: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceDb;
199
- /** Get an opened [[WorkspaceDb]] from a WorkspaceDb name.
200
- * @param databaseName the database name, resolved via [[resolveDatabase]].
201
- * @see [[getWorkspaceDbFromProps]]
202
- */
203
- getWorkspaceDb(databaseName: WorkspaceDb.Name): WorkspaceDb;
204
- /** Load a WorkspaceResource of type string, parse it, and add it to the current Settings for this Workspace.
205
- * @note settingsRsc must specify a resource holding a stringified JSON representation of a [[SettingDictionary]]
206
- */
207
- loadSettingsDictionary(settingRsc: WorkspaceResource.Name, db: WorkspaceDb, priority: SettingsPriority): void;
208
- /** Close this Workspace. All WorkspaceContainers are dropped. */
209
- close(): void;
210
- }
211
- /**
212
- * A WorkspaceContainer holds WorkspaceDbs.
213
- * Access rights are administered per WorkspaceContainer. That is, if a user has rights to access a WorkspaceContainer, that right
214
- * applies to all WorkspaceDbs in the WorkspaceContainer.
215
- * @beta
216
- */
217
- export interface WorkspaceContainer {
218
- /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources. */
219
- readonly filesDir: LocalDirName;
220
- /** The unique identifier for a WorkspaceContainer a cloud storage account. */
221
- readonly id: WorkspaceContainer.Id;
222
- /** Workspace holding this WorkspaceContainer. */
223
- readonly workspace: Workspace;
224
- /** CloudContainer for this WorkspaceContainer (`undefined` if this is a local WorkspaceContainer.)
225
- * @internal
226
- */
227
- readonly cloudContainer?: CloudSqlite.CloudContainer;
228
- /** @internal */
229
- addWorkspaceDb(toAdd: ITwinWorkspaceDb): void;
230
- /** @internal */
231
- resolveDbFileName(props: WorkspaceDb.Props): string;
232
- /** find or open a WorkspaceDb from this WorkspaceContainer. */
233
- getWorkspaceDb(props: WorkspaceDb.Props): WorkspaceDb;
234
- /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace. */
235
- dropWorkspaceDb(container: WorkspaceDb): void;
236
- /** Close this WorkspaceContainer. All currently opened WorkspaceDbs are dropped. */
237
- close(): void;
238
- }
239
- /** @internal */
240
- export declare class ITwinWorkspace implements Workspace {
241
- private _containers;
242
- readonly containerDir: LocalDirName;
243
- readonly settings: Settings;
244
- private static _sharedCloudCache?;
245
- private _cloudCache?;
246
- get cloudCache(): CloudSqlite.CloudCache;
247
- private static getSharedCloudCache;
248
- static finalize(): void;
249
- constructor(settings: Settings, opts?: WorkspaceOpts);
250
- addContainer(toAdd: ITwinWorkspaceContainer): void;
251
- findContainer(containerId: WorkspaceContainer.Id): ITwinWorkspaceContainer | undefined;
252
- getContainer(props: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceContainer;
253
- getWorkspaceDbFromProps(dbProps: WorkspaceDb.Props, containerProps: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceDb;
254
- getWorkspaceDb(dbAlias: string): WorkspaceDb;
255
- loadSettingsDictionary(settingRsc: WorkspaceResource.Name, db: WorkspaceDb, priority: SettingsPriority): void;
256
- close(): void;
257
- resolveAccount(accountName: string): WorkspaceAccount.Props;
258
- resolveContainer(containerName: string): WorkspaceContainer.Props & WorkspaceAccount.Alias;
259
- resolveDatabase(databaseName: string): WorkspaceDb.Props & WorkspaceContainer.Alias;
260
- }
261
- /** @internal */
262
- export declare class ITwinWorkspaceContainer implements WorkspaceContainer {
263
- readonly workspace: ITwinWorkspace;
264
- readonly filesDir: LocalDirName;
265
- readonly id: WorkspaceContainer.Id;
266
- readonly cloudContainer?: CloudSqlite.CloudContainer | undefined;
267
- private _wsDbs;
268
- get dirName(): string;
269
- static noLeadingOrTrailingSpaces(name: string, msg: string): void;
270
- /** rules for ContainerIds (from Azure, see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata)
271
- * - may only contain lower case letters, numbers or dashes
272
- * - may not start or end with with a dash nor have more than one dash in a row
273
- * - may not be shorter than 3 or longer than 63 characters
274
- */
275
- private static validateContainerId;
276
- static validateDbName(dbName: WorkspaceDb.DbName): void;
277
- constructor(workspace: ITwinWorkspace, props: WorkspaceContainer.Props, account?: WorkspaceAccount.Props);
278
- static validateVersion(version?: WorkspaceDb.Version): string;
279
- static parseDbFileName(dbFileName: WorkspaceDb.DbFullName): {
280
- dbName: WorkspaceDb.DbName;
281
- version: WorkspaceDb.Version;
282
- };
283
- static makeDbFileName(dbName: WorkspaceDb.DbName, version?: WorkspaceDb.Version): WorkspaceDb.DbName;
284
- static resolveCloudFileName(cloudContainer: CloudSqlite.CloudContainer, props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
285
- /**
286
- * Create a copy of an existing [[WorkspaceDb]] in a cloud container with a new version number.
287
- * @param cloudContainer The attached cloud container holding the existing WorkspaceDb
288
- * @param fromProps Properties that describe the source WorkspaceDb for the new version
289
- * @param versionType The type of version increment to apply to the existing version.
290
- * @note This requires that the cloudContainer is attached and the write lock on the container be held. The copy should be modified with
291
- * new content before the write lock is released, and thereafter should never be modified again.
292
- */
293
- static makeNewVersion(cloudContainer: CloudSqlite.CloudContainer, fromProps: WorkspaceDb.Props, versionType: WorkspaceDb.VersionIncrement): Promise<{
294
- oldName: string;
295
- newName: string;
296
- }>;
297
- /**
298
- * Convert a WorkspaceDb.Props specification into a DbFileName. For cloud-based containers, this resolves to the dbName, incorporating the appropriate
299
- * version. For file-based containers, this returns a local filename of a WorkspaceDb file with the extension ".itwin-workspace"
300
- */
301
- resolveDbFileName(props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
302
- addWorkspaceDb(toAdd: ITwinWorkspaceDb): void;
303
- getWorkspaceDb(props: WorkspaceDb.Props): WorkspaceDb;
304
- dropWorkspaceDb(toDrop: WorkspaceDb): void;
305
- close(): void;
306
- /** Delete all local files extracted by [[WorkspaceDb.getFile]] for this container. */
307
- purgeContainerFiles(): void;
308
- }
309
- /**
310
- * Implementation of WorkspaceDb
311
- * @internal
312
- */
313
- export declare class ITwinWorkspaceDb implements WorkspaceDb {
314
- /** file extension for local WorkspaceDbs */
315
- static readonly fileExt = "itwin-workspace";
316
- /** the SQLiteDb for this WorkspaceDb*/
317
- readonly sqliteDb: SQLiteDb;
318
- /** the base WorkspaceDb name, without directory, extension, or version information. */
319
- readonly dbName: WorkspaceDb.DbName;
320
- /** The WorkspaceContainer holding this WorkspaceDb */
321
- readonly container: WorkspaceContainer;
322
- /** called before db is closed */
323
- readonly onClose: BeEvent<() => void>;
324
- /** either a local file name or the name of the file in a cloud container, including version identifier */
325
- dbFileName: string;
326
- /** true if this WorkspaceDb is currently open */
327
- get isOpen(): boolean;
328
- queryFileResource(rscName: WorkspaceResource.Name): {
329
- localFileName: string;
330
- info: import("@bentley/imodeljs-native").IModelJsNative.EmbedFileQuery;
331
- } | undefined;
332
- constructor(props: WorkspaceDb.Props, container: WorkspaceContainer);
333
- open(): void;
334
- close(): void;
335
- getString(rscName: WorkspaceResource.Name): string | undefined;
336
- /** Get a BlobIO reader for a blob WorkspaceResource.
337
- * @note when finished, caller *must* call `close` on the BlobIO.
338
- */
339
- getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
340
- getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
341
- getFile(rscName: WorkspaceResource.Name, targetFileName?: LocalFileName): LocalFileName | undefined;
342
- prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch | undefined;
343
- }
344
- /**
345
- * An editable [[WorkspaceDb]]. This is used by administrators for creating and modifying `WorkspaceDb`s.
346
- * For cloud-backed containers, the write token must be obtained before this class may be used. Only one user at at time
347
- * may be editing.
348
- * @internal
349
- */
350
- export declare class EditableWorkspaceDb extends ITwinWorkspaceDb {
351
- private static validateResourceName;
352
- private validateResourceSize;
353
- open(): void;
354
- private getFileModifiedTime;
355
- private performWriteSql;
356
- createDb(version?: string): Promise<void>;
357
- /** Create a new, empty, EditableWorkspaceDb for importing Workspace resources. */
358
- static createEmpty(fileName: LocalFileName): void;
359
- /** Add a new string resource to this WorkspaceDb.
360
- * @param rscName The name of the string resource.
361
- * @param val The string to save.
362
- */
363
- addString(rscName: WorkspaceResource.Name, val: string): void;
364
- /** Update an existing string resource with a new value.
365
- * @param rscName The name of the string resource.
366
- * @param val The new value.
367
- * @throws if rscName does not exist
368
- */
369
- updateString(rscName: WorkspaceResource.Name, val: string): void;
370
- /** Remove a string resource. */
371
- removeString(rscName: WorkspaceResource.Name): void;
372
- /** Add a new blob resource to this WorkspaceDb.
373
- * @param rscName The name of the blob resource.
374
- * @param val The blob to save.
375
- */
376
- addBlob(rscName: WorkspaceResource.Name, val: Uint8Array): void;
377
- /** Update an existing blob resource with a new value.
378
- * @param rscName The name of the blob resource.
379
- * @param val The new value.
380
- * @throws if rscName does not exist
381
- */
382
- updateBlob(rscName: WorkspaceResource.Name, val: Uint8Array): void;
383
- /** Get a BlobIO writer for a previously-added blob WorkspaceResource.
384
- * @note after writing is complete, caller must call `close` on the BlobIO and must call `saveChanges` on the `db`.
385
- */
386
- getBlobWriter(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
387
- /** Remove a blob resource. */
388
- removeBlob(rscName: WorkspaceResource.Name): void;
389
- /** Copy the contents of an existing local file into this WorkspaceDb as a file resource.
390
- * @param rscName The name of the file resource.
391
- * @param localFileName The name of a local file to be read.
392
- * @param fileExt The extension (do not include the leading ".") to be appended to the generated fileName
393
- * when this WorkspaceDb is extracted from the WorkspaceDb. By default the characters after the last "." in `localFileName`
394
- * are used. Pass this argument to override that.
395
- */
396
- addFile(rscName: WorkspaceResource.Name, localFileName: LocalFileName, fileExt?: string): void;
397
- /** Replace an existing file resource with the contents of another local file.
398
- * @param rscName The name of the file resource.
399
- * @param localFileName The name of a local file to be read.
400
- * @throws if rscName does not exist
401
- */
402
- updateFile(rscName: WorkspaceResource.Name, localFileName: LocalFileName): void;
403
- /** Remove a file resource. */
404
- removeFile(rscName: WorkspaceResource.Name): void;
405
- }
1
+ /** @packageDocumentation
2
+ * @module Workspace
3
+ */
4
+ import { BeEvent, Optional } from "@itwin/core-bentley";
5
+ import { LocalDirName, LocalFileName } from "@itwin/core-common";
6
+ import { CloudSqlite } from "../CloudSqlite";
7
+ import { SQLiteDb } from "../SQLiteDb";
8
+ import { Settings, SettingsPriority } from "./Settings";
9
+ /** The Settings used by Workspace api
10
+ * @beta
11
+ */
12
+ export declare const WorkspaceSetting: {
13
+ Accounts: string;
14
+ Containers: string;
15
+ Databases: string;
16
+ };
17
+ /** Types used to identify cloud accounts for Workspaces.
18
+ * @beta
19
+ */
20
+ export declare namespace WorkspaceAccount {
21
+ /** The name of a WorkspaceAccount in a "cloud/accounts" setting. */
22
+ type Name = string;
23
+ /** A member named `accountName` that specifies by an entry in a "cloud/accounts" setting */
24
+ interface Alias {
25
+ accountName: string;
26
+ }
27
+ /** The properties of a cloud account required to open containers with CloudSqlite. Usually supplied via a "cloud/accounts" setting. */
28
+ type Props = CloudSqlite.AccountAccessProps;
29
+ }
30
+ /** @beta */
31
+ export declare namespace WorkspaceContainer {
32
+ /** The name of a WorkspaceContainer in a "cloud/containers" setting. */
33
+ type Name = string;
34
+ /** The unique identifier of a WorkspaceContainer. This becomes the base name for the local directory holding the WorkspaceDbs from a WorkspaceContainer.
35
+ * Usually supplied via the `containerId` member of a "cloud/containers" setting.
36
+ * `WorkspaceContainer.Id`s may:
37
+ * - only contain lower case letters, numbers or dashes
38
+ * - not start or end with a dash
39
+ * - not be shorter than 3 or longer than 63 characters
40
+ */
41
+ type Id = string;
42
+ /** A member named `containerName` that specifies by an entry in a "cloud/containers" setting */
43
+ interface Alias {
44
+ containerName: string;
45
+ }
46
+ /** Properties that specify a WorkspaceContainer. */
47
+ interface Props extends Optional<CloudSqlite.ContainerProps, "accessToken"> {
48
+ /** true if the container is public (doesn't require authentication) */
49
+ isPublic?: boolean;
50
+ /** attempt to synchronize (i.e. call `checkForChanges`) this cloud container whenever it is connected to a cloud cache. */
51
+ syncOnConnect?: boolean;
52
+ }
53
+ }
54
+ /** @beta */
55
+ export declare namespace WorkspaceDb {
56
+ /** The name of a WorkspaceDb in a "workspace/databases" setting. */
57
+ type Name = string;
58
+ /** The base name of a WorkspaceDb within a WorkspaceContainer (without any version identifier) */
59
+ type DbName = string;
60
+ /** The name of a WorkspaceDb within a WorkspaceContainer, including the version identifier */
61
+ type DbFullName = string;
62
+ /** The semver-format version identifier for a WorkspaceDb. */
63
+ type Version = string;
64
+ /** The [semver range format](https://github.com/npm/node-semver) identifier for a range of acceptable versions. */
65
+ type VersionRange = string;
66
+ /** Properties that specify how to load a WorkspaceDb within a [[WorkspaceContainer]]. */
67
+ interface Props extends CloudSqlite.DbNameProp {
68
+ /** a semver version range specifier that determines the acceptable range of versions to load. If not present, use the newest version. */
69
+ version?: VersionRange;
70
+ /** if true, allow semver *prerelease* versions. By default only released version are allowed. */
71
+ includePrerelease?: boolean;
72
+ }
73
+ /** Scope to increment for a version number.
74
+ * @see semver.ReleaseType
75
+ */
76
+ type VersionIncrement = "major" | "minor" | "patch";
77
+ }
78
+ /** Types used to identify Workspace resources
79
+ * @beta
80
+ */
81
+ export declare namespace WorkspaceResource {
82
+ /**
83
+ * The name for identifying WorkspaceResources in a [[WorkspaceDb]].
84
+ * * `WorkspaceResource.Name`s may not:
85
+ * - be blank or start or end with a space
86
+ * - be longer than 1024 characters
87
+ * @note a single WorkspaceDb may hold WorkspaceResources of type 'blob', 'string' and 'file', all with the same WorkspaceResource.Name.
88
+ */
89
+ type Name = string;
90
+ /** Properties that specify an individual WorkspaceResource within a [[WorkspaceDb]]. */
91
+ interface Props {
92
+ /** the name of the resource within the WorkspaceDb */
93
+ rscName: Name;
94
+ }
95
+ }
96
+ /**
97
+ * A WorkspaceDb holds workspace resources. `WorkspaceDb`s may just be local files, or they may be stored
98
+ * in cloud WorkspaceContainers. Each `WorkspaceResource` in a WorkspaceDb is identified by a [[WorkspaceResource.Name]].
99
+ * Resources of type `string` and `blob` may be loaded directly from the `WorkspaceDb`. Resources of type `file` are
100
+ * copied from the WorkspaceDb into a temporary local file so they can be accessed by programs directly from disk.
101
+ * @beta
102
+ */
103
+ export interface WorkspaceDb {
104
+ /** The WorkspaceContainer holding this WorkspaceDb. */
105
+ readonly container: WorkspaceContainer;
106
+ /** The base name of this WorkspaceDb, without version */
107
+ readonly dbName: WorkspaceDb.DbName;
108
+ /** event raised before this WorkspaceDb is closed. */
109
+ readonly onClose: BeEvent<() => void>;
110
+ /** Name by which a WorkspaceDb may be opened. This will be either a local file name or the name of a database in a cloud container */
111
+ readonly dbFileName: string;
112
+ /** Get a string resource from this WorkspaceDb, if present. */
113
+ getString(rscName: WorkspaceResource.Name): string | undefined;
114
+ /** Get a blob resource from this WorkspaceDb, if present. */
115
+ getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
116
+ /** @internal */
117
+ getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
118
+ /**
119
+ * Extract a local copy of a file resource from this WorkspaceDb, if present.
120
+ * @param rscName The name of the file resource in the WorkspaceDb
121
+ * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If
122
+ * 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
123
+ * keep the extracted files in the filesDir.
124
+ * @returns the full path to a file on the local filesystem.
125
+ * @note The file is copied from the file into the local filesystem so it may be accessed directly. This happens only
126
+ * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.
127
+ * For this reason, you should not save the local file name, and instead call this method every time you access it, so its
128
+ * content is always holds the correct version.
129
+ * @note The filename will be a hash value, not the resource name.
130
+ * @note Workspace resource files are set readonly as they are copied from the file.
131
+ * To edit them, you must first copy them to another location.
132
+ */
133
+ getFile(rscName: WorkspaceResource.Name, targetFileName?: LocalFileName): LocalFileName | undefined;
134
+ /**
135
+ * Ensure that the contents of a `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.
136
+ * Until the promise is resolved, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.
137
+ * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.
138
+ */
139
+ prefetch(): void;
140
+ }
141
+ /** The properties of the CloudCache used for Workspaces.
142
+ * @beta
143
+ */
144
+ export interface WorkspaceCloudCacheProps extends Optional<CloudSqlite.CacheProps, "name" | "rootDir"> {
145
+ /** if true, empty the cache before using it. */
146
+ clearContents?: boolean;
147
+ }
148
+ /**
149
+ * Options for constructing a [[Workspace]].
150
+ * @beta
151
+ */
152
+ export interface WorkspaceOpts {
153
+ /** The local directory for non-cloud-based WorkspaceDb files. The workspace api will look in this directory
154
+ * for files named `${containerId}/${dbId}.itwin-workspace`.
155
+ * @note if not supplied, defaults to `iTwin/Workspace` in the user-local folder.
156
+ */
157
+ containerDir?: LocalDirName;
158
+ /** the local fileName(s) of one or more settings files to load after the Workspace is first created. */
159
+ settingsFiles?: LocalFileName | [LocalFileName];
160
+ /**
161
+ * only for tests
162
+ * @internal */
163
+ testCloudCache?: CloudSqlite.CloudCache;
164
+ }
165
+ /**
166
+ * Settings and resources that customize an application for the current session.
167
+ * See [Workspaces]($docs/learning/backend/Workspace)
168
+ * @beta
169
+ */
170
+ export interface Workspace {
171
+ /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`. */
172
+ readonly containerDir: LocalDirName;
173
+ /** The [[Settings]] for this Workspace */
174
+ readonly settings: Settings;
175
+ /** The CloudCache for cloud-based WorkspaceContainers */
176
+ readonly cloudCache?: CloudSqlite.CloudCache;
177
+ /** search for a previously opened container.
178
+ * @param containerId the id of the container
179
+ * @returns the [[WorkspaceContainer]] for `containerId` if it was not previously opened with [[getContainer]]
180
+ */
181
+ findContainer(containerId: WorkspaceContainer.Id): WorkspaceContainer | undefined;
182
+ /** get a [[WorkspaceContainer]] by [[WorkspaceContainer.Props]]
183
+ * @param props the properties of the `WorkspaceContainer`. If `props.containerId` was already opened, its WorkspaceContainer is returned.
184
+ * Otherwise it is created.
185
+ * @param account If present, the properties for this container if it is to be opened from the cloud. If not present, the container is just a local directory.
186
+ */
187
+ getContainer(props: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceContainer;
188
+ /** get the properties for the supplied account name by searching for an entry with that name in a `cloud/accounts` setting. */
189
+ resolveAccount(accountName: WorkspaceAccount.Name): WorkspaceAccount.Props;
190
+ /** get the properties for the supplied container name by searching for an entry with that name in a `cloud/containers` setting. */
191
+ resolveContainer(containerName: WorkspaceContainer.Name): WorkspaceContainer.Props & WorkspaceAccount.Alias;
192
+ /** get the properties for the supplied workspace database name by searching for an entry with that name in a `workspace/databases` setting. */
193
+ resolveDatabase(databaseAlias: WorkspaceDb.Name): WorkspaceDb.Props & WorkspaceContainer.Alias;
194
+ /**
195
+ * Get an opened [[WorkspaceDb]]. If the WorkspaceDb is present but not open, it is opened first.
196
+ * If `cloudProps` are supplied, a CloudContainer will be used to open the WorkspaceDb.
197
+ */
198
+ getWorkspaceDbFromProps(dbProps: WorkspaceDb.Props, containerProps: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceDb;
199
+ /** Get an opened [[WorkspaceDb]] from a WorkspaceDb name.
200
+ * @param databaseName the database name, resolved via [[resolveDatabase]].
201
+ * @see [[getWorkspaceDbFromProps]]
202
+ */
203
+ getWorkspaceDb(databaseName: WorkspaceDb.Name): WorkspaceDb;
204
+ /** Load a WorkspaceResource of type string, parse it, and add it to the current Settings for this Workspace.
205
+ * @note settingsRsc must specify a resource holding a stringified JSON representation of a [[SettingDictionary]]
206
+ */
207
+ loadSettingsDictionary(settingRsc: WorkspaceResource.Name, db: WorkspaceDb, priority: SettingsPriority): void;
208
+ /** Close this Workspace. All WorkspaceContainers are dropped. */
209
+ close(): void;
210
+ }
211
+ /**
212
+ * A WorkspaceContainer holds WorkspaceDbs.
213
+ * Access rights are administered per WorkspaceContainer. That is, if a user has rights to access a WorkspaceContainer, that right
214
+ * applies to all WorkspaceDbs in the WorkspaceContainer.
215
+ * @beta
216
+ */
217
+ export interface WorkspaceContainer {
218
+ /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources. */
219
+ readonly filesDir: LocalDirName;
220
+ /** The unique identifier for a WorkspaceContainer a cloud storage account. */
221
+ readonly id: WorkspaceContainer.Id;
222
+ /** Workspace holding this WorkspaceContainer. */
223
+ readonly workspace: Workspace;
224
+ /** CloudContainer for this WorkspaceContainer (`undefined` if this is a local WorkspaceContainer.)
225
+ * @internal
226
+ */
227
+ readonly cloudContainer?: CloudSqlite.CloudContainer;
228
+ /** @internal */
229
+ addWorkspaceDb(toAdd: ITwinWorkspaceDb): void;
230
+ /** @internal */
231
+ resolveDbFileName(props: WorkspaceDb.Props): string;
232
+ /** find or open a WorkspaceDb from this WorkspaceContainer. */
233
+ getWorkspaceDb(props: WorkspaceDb.Props): WorkspaceDb;
234
+ /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace. */
235
+ dropWorkspaceDb(container: WorkspaceDb): void;
236
+ /** Close this WorkspaceContainer. All currently opened WorkspaceDbs are dropped. */
237
+ close(): void;
238
+ }
239
+ /** @internal */
240
+ export declare class ITwinWorkspace implements Workspace {
241
+ private _containers;
242
+ readonly containerDir: LocalDirName;
243
+ readonly settings: Settings;
244
+ private static _sharedCloudCache?;
245
+ private _cloudCache?;
246
+ get cloudCache(): CloudSqlite.CloudCache;
247
+ private static getSharedCloudCache;
248
+ static finalize(): void;
249
+ constructor(settings: Settings, opts?: WorkspaceOpts);
250
+ addContainer(toAdd: ITwinWorkspaceContainer): void;
251
+ findContainer(containerId: WorkspaceContainer.Id): ITwinWorkspaceContainer | undefined;
252
+ getContainer(props: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceContainer;
253
+ getWorkspaceDbFromProps(dbProps: WorkspaceDb.Props, containerProps: WorkspaceContainer.Props, account?: WorkspaceAccount.Props): WorkspaceDb;
254
+ getWorkspaceDb(dbAlias: string): WorkspaceDb;
255
+ loadSettingsDictionary(settingRsc: WorkspaceResource.Name, db: WorkspaceDb, priority: SettingsPriority): void;
256
+ close(): void;
257
+ resolveAccount(accountName: string): WorkspaceAccount.Props;
258
+ resolveContainer(containerName: string): WorkspaceContainer.Props & WorkspaceAccount.Alias;
259
+ resolveDatabase(databaseName: string): WorkspaceDb.Props & WorkspaceContainer.Alias;
260
+ }
261
+ /** @internal */
262
+ export declare class ITwinWorkspaceContainer implements WorkspaceContainer {
263
+ readonly workspace: ITwinWorkspace;
264
+ readonly filesDir: LocalDirName;
265
+ readonly id: WorkspaceContainer.Id;
266
+ readonly cloudContainer?: CloudSqlite.CloudContainer | undefined;
267
+ private _wsDbs;
268
+ get dirName(): string;
269
+ static noLeadingOrTrailingSpaces(name: string, msg: string): void;
270
+ /** rules for ContainerIds (from Azure, see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata)
271
+ * - may only contain lower case letters, numbers or dashes
272
+ * - may not start or end with with a dash nor have more than one dash in a row
273
+ * - may not be shorter than 3 or longer than 63 characters
274
+ */
275
+ private static validateContainerId;
276
+ static validateDbName(dbName: WorkspaceDb.DbName): void;
277
+ constructor(workspace: ITwinWorkspace, props: WorkspaceContainer.Props, account?: WorkspaceAccount.Props);
278
+ static validateVersion(version?: WorkspaceDb.Version): string;
279
+ static parseDbFileName(dbFileName: WorkspaceDb.DbFullName): {
280
+ dbName: WorkspaceDb.DbName;
281
+ version: WorkspaceDb.Version;
282
+ };
283
+ static makeDbFileName(dbName: WorkspaceDb.DbName, version?: WorkspaceDb.Version): WorkspaceDb.DbName;
284
+ static resolveCloudFileName(cloudContainer: CloudSqlite.CloudContainer, props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
285
+ /**
286
+ * Create a copy of an existing [[WorkspaceDb]] in a cloud container with a new version number.
287
+ * @param cloudContainer The attached cloud container holding the existing WorkspaceDb
288
+ * @param fromProps Properties that describe the source WorkspaceDb for the new version
289
+ * @param versionType The type of version increment to apply to the existing version.
290
+ * @note This requires that the cloudContainer is attached and the write lock on the container be held. The copy should be modified with
291
+ * new content before the write lock is released, and thereafter should never be modified again.
292
+ */
293
+ static makeNewVersion(cloudContainer: CloudSqlite.CloudContainer, fromProps: WorkspaceDb.Props, versionType: WorkspaceDb.VersionIncrement): Promise<{
294
+ oldName: string;
295
+ newName: string;
296
+ }>;
297
+ /**
298
+ * Convert a WorkspaceDb.Props specification into a DbFileName. For cloud-based containers, this resolves to the dbName, incorporating the appropriate
299
+ * version. For file-based containers, this returns a local filename of a WorkspaceDb file with the extension ".itwin-workspace"
300
+ */
301
+ resolveDbFileName(props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
302
+ addWorkspaceDb(toAdd: ITwinWorkspaceDb): void;
303
+ getWorkspaceDb(props: WorkspaceDb.Props): WorkspaceDb;
304
+ dropWorkspaceDb(toDrop: WorkspaceDb): void;
305
+ close(): void;
306
+ /** Delete all local files extracted by [[WorkspaceDb.getFile]] for this container. */
307
+ purgeContainerFiles(): void;
308
+ }
309
+ /**
310
+ * Implementation of WorkspaceDb
311
+ * @internal
312
+ */
313
+ export declare class ITwinWorkspaceDb implements WorkspaceDb {
314
+ /** file extension for local WorkspaceDbs */
315
+ static readonly fileExt = "itwin-workspace";
316
+ /** the SQLiteDb for this WorkspaceDb*/
317
+ readonly sqliteDb: SQLiteDb;
318
+ /** the base WorkspaceDb name, without directory, extension, or version information. */
319
+ readonly dbName: WorkspaceDb.DbName;
320
+ /** The WorkspaceContainer holding this WorkspaceDb */
321
+ readonly container: WorkspaceContainer;
322
+ /** called before db is closed */
323
+ readonly onClose: BeEvent<() => void>;
324
+ /** either a local file name or the name of the file in a cloud container, including version identifier */
325
+ dbFileName: string;
326
+ /** true if this WorkspaceDb is currently open */
327
+ get isOpen(): boolean;
328
+ queryFileResource(rscName: WorkspaceResource.Name): {
329
+ localFileName: string;
330
+ info: import("@bentley/imodeljs-native").IModelJsNative.EmbedFileQuery;
331
+ } | undefined;
332
+ constructor(props: WorkspaceDb.Props, container: WorkspaceContainer);
333
+ open(): void;
334
+ close(): void;
335
+ getString(rscName: WorkspaceResource.Name): string | undefined;
336
+ /** Get a BlobIO reader for a blob WorkspaceResource.
337
+ * @note when finished, caller *must* call `close` on the BlobIO.
338
+ */
339
+ getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
340
+ getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
341
+ getFile(rscName: WorkspaceResource.Name, targetFileName?: LocalFileName): LocalFileName | undefined;
342
+ prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch | undefined;
343
+ }
344
+ /**
345
+ * An editable [[WorkspaceDb]]. This is used by administrators for creating and modifying `WorkspaceDb`s.
346
+ * For cloud-backed containers, the write token must be obtained before this class may be used. Only one user at at time
347
+ * may be editing.
348
+ * @internal
349
+ */
350
+ export declare class EditableWorkspaceDb extends ITwinWorkspaceDb {
351
+ private static validateResourceName;
352
+ private validateResourceSize;
353
+ open(): void;
354
+ private getFileModifiedTime;
355
+ private performWriteSql;
356
+ createDb(version?: string): Promise<void>;
357
+ /** Create a new, empty, EditableWorkspaceDb for importing Workspace resources. */
358
+ static createEmpty(fileName: LocalFileName): void;
359
+ /** Add a new string resource to this WorkspaceDb.
360
+ * @param rscName The name of the string resource.
361
+ * @param val The string to save.
362
+ */
363
+ addString(rscName: WorkspaceResource.Name, val: string): void;
364
+ /** Update an existing string resource with a new value.
365
+ * @param rscName The name of the string resource.
366
+ * @param val The new value.
367
+ * @throws if rscName does not exist
368
+ */
369
+ updateString(rscName: WorkspaceResource.Name, val: string): void;
370
+ /** Remove a string resource. */
371
+ removeString(rscName: WorkspaceResource.Name): void;
372
+ /** Add a new blob resource to this WorkspaceDb.
373
+ * @param rscName The name of the blob resource.
374
+ * @param val The blob to save.
375
+ */
376
+ addBlob(rscName: WorkspaceResource.Name, val: Uint8Array): void;
377
+ /** Update an existing blob resource with a new value.
378
+ * @param rscName The name of the blob resource.
379
+ * @param val The new value.
380
+ * @throws if rscName does not exist
381
+ */
382
+ updateBlob(rscName: WorkspaceResource.Name, val: Uint8Array): void;
383
+ /** Get a BlobIO writer for a previously-added blob WorkspaceResource.
384
+ * @note after writing is complete, caller must call `close` on the BlobIO and must call `saveChanges` on the `db`.
385
+ */
386
+ getBlobWriter(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
387
+ /** Remove a blob resource. */
388
+ removeBlob(rscName: WorkspaceResource.Name): void;
389
+ /** Copy the contents of an existing local file into this WorkspaceDb as a file resource.
390
+ * @param rscName The name of the file resource.
391
+ * @param localFileName The name of a local file to be read.
392
+ * @param fileExt The extension (do not include the leading ".") to be appended to the generated fileName
393
+ * when this WorkspaceDb is extracted from the WorkspaceDb. By default the characters after the last "." in `localFileName`
394
+ * are used. Pass this argument to override that.
395
+ */
396
+ addFile(rscName: WorkspaceResource.Name, localFileName: LocalFileName, fileExt?: string): void;
397
+ /** Replace an existing file resource with the contents of another local file.
398
+ * @param rscName The name of the file resource.
399
+ * @param localFileName The name of a local file to be read.
400
+ * @throws if rscName does not exist
401
+ */
402
+ updateFile(rscName: WorkspaceResource.Name, localFileName: LocalFileName): void;
403
+ /** Remove a file resource. */
404
+ removeFile(rscName: WorkspaceResource.Name): void;
405
+ }
406
406
  //# sourceMappingURL=Workspace.d.ts.map