@itwin/core-backend 4.8.0-dev.3 → 4.8.0-dev.32
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.
- package/CHANGELOG.md +57 -1
- package/lib/cjs/BackendHubAccess.d.ts +18 -16
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js +16 -15
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +3 -1
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +2 -0
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BlobContainerService.d.ts +3 -3
- package/lib/cjs/BlobContainerService.d.ts.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +19 -11
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +0 -6
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +0 -6
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +11 -9
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +1 -0
- package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
- package/lib/cjs/ChangedElementsDb.js +6 -4
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +26 -21
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.d.ts +4 -26
- package/lib/cjs/ChannelControl.d.ts.map +1 -1
- package/lib/cjs/ChannelControl.js +2 -101
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +5 -3
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +3 -2
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +49 -24
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +66 -7
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +4 -4
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/DevTools.d.ts.map +1 -1
- package/lib/cjs/DevTools.js +2 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +0 -3
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +0 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +6 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +19 -14
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +2 -2
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +6 -3
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +3 -3
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +3 -60
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +8 -64
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +0 -5
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +4 -8
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts.map +1 -1
- package/lib/cjs/ElementGraphics.js +2 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +10 -0
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +22 -24
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +2 -2
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/GeometrySummary.d.ts.map +1 -1
- package/lib/cjs/GeometrySummary.js +2 -1
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +33 -98
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +242 -156
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +5 -4
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +13 -4
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +39 -32
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +15 -13
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +2 -2
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +17 -17
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LockControl.d.ts +73 -0
- package/lib/cjs/LockControl.d.ts.map +1 -0
- package/lib/cjs/LockControl.js +11 -0
- package/lib/cjs/LockControl.js.map +1 -0
- package/lib/cjs/Material.d.ts +2 -5
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +6 -4
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +0 -22
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +5 -26
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +17 -7
- package/lib/cjs/PropertyStore.d.ts.map +1 -1
- package/lib/cjs/PropertyStore.js +11 -5
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +0 -12
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +5 -16
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +8 -4
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +25 -19
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts +4 -1
- package/lib/cjs/SchemaSync.d.ts.map +1 -1
- package/lib/cjs/SchemaSync.js +24 -11
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js +3 -3
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +2 -2
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js +2 -2
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts +5 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js +11 -8
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.d.ts +21 -13
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js +134 -92
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +2 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +4 -2
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +1 -18
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +1 -18
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts +16 -2
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +20 -6
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +33 -0
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +17 -21
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +80 -38
- package/lib/cjs/assets/Settings/backend.setting.json5 +8 -119
- package/lib/cjs/core-backend.d.ts +4 -2
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +5 -6
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +0 -10
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +0 -10
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js +2 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +0 -18
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js +0 -18
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts +24 -0
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js +7 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts +34 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.js +117 -0
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -0
- package/lib/cjs/internal/NativePlatform.d.ts +15 -0
- package/lib/cjs/internal/NativePlatform.d.ts.map +1 -0
- package/lib/cjs/internal/NativePlatform.js +49 -0
- package/lib/cjs/internal/NativePlatform.js.map +1 -0
- package/lib/cjs/internal/NoLocks.d.ts +6 -0
- package/lib/cjs/internal/NoLocks.d.ts.map +1 -0
- package/lib/cjs/internal/NoLocks.js +31 -0
- package/lib/cjs/internal/NoLocks.js.map +1 -0
- package/lib/cjs/{ServerBasedLocks.d.ts → internal/ServerBasedLocks.d.ts} +10 -16
- package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -0
- package/lib/cjs/{ServerBasedLocks.js → internal/ServerBasedLocks.js} +29 -18
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +11 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -0
- package/lib/cjs/internal/Symbols.js +21 -0
- package/lib/cjs/internal/Symbols.js.map +1 -0
- package/lib/cjs/internal/cross-package.d.ts +4 -0
- package/lib/cjs/internal/cross-package.d.ts.map +1 -0
- package/lib/cjs/internal/cross-package.js +16 -0
- package/lib/cjs/internal/cross-package.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts +43 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.js +161 -0
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +276 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +41 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +696 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +42 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
- package/lib/cjs/rpc/tracing.d.ts.map +1 -1
- package/lib/cjs/rpc/tracing.js +5 -2
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +10 -6
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +5 -3
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +167 -138
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +68 -138
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +112 -48
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js +1 -172
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +411 -277
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +76 -457
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.d.ts +245 -0
- package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -0
- package/lib/cjs/workspace/WorkspaceEditor.js +34 -0
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -0
- package/package.json +15 -14
- package/lib/cjs/ServerBasedLocks.d.ts.map +0 -1
- package/lib/cjs/ServerBasedLocks.js.map +0 -1
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +0 -45
|
@@ -5,369 +5,503 @@ import { AccessToken, BeEvent, Optional } from "@itwin/core-bentley";
|
|
|
5
5
|
import { LocalDirName, LocalFileName } from "@itwin/core-common";
|
|
6
6
|
import { CloudSqlite } from "../CloudSqlite";
|
|
7
7
|
import { SQLiteDb } from "../SQLiteDb";
|
|
8
|
-
import { Settings, SettingsPriority } from "./Settings";
|
|
8
|
+
import { SettingName, Settings, SettingsDictionary, SettingsPriority } from "./Settings";
|
|
9
9
|
import type { IModelJsNative } from "@bentley/imodeljs-native";
|
|
10
|
-
|
|
10
|
+
import { _implementationProhibited } from "../internal/Symbols";
|
|
11
|
+
/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.
|
|
12
|
+
* A valid `WorkspaceContainerId` must conform to the following constraints:
|
|
13
|
+
* - Consist solely of a combination of lower case letters, numbers, and dashes.
|
|
14
|
+
* - May not start or end with a dash.
|
|
15
|
+
* - Must be at least 3 characters long and no longer than 63 characters.
|
|
11
16
|
* @beta
|
|
12
17
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type Name = string;
|
|
21
|
-
/** The unique identifier of a WorkspaceContainer. This becomes the base name for the local directory holding the WorkspaceDbs from a WorkspaceContainer.
|
|
22
|
-
* Usually supplied via the `containerId` member of a "cloud/containers" setting.
|
|
23
|
-
* `WorkspaceContainer.Id`s may:
|
|
24
|
-
* - only contain lower case letters, numbers or dashes
|
|
25
|
-
* - not start or end with a dash
|
|
26
|
-
* - not be shorter than 3 or longer than 63 characters
|
|
27
|
-
*/
|
|
28
|
-
type Id = string;
|
|
29
|
-
/** A member named `containerName` that specifies by an entry in a "cloud/containers" setting */
|
|
30
|
-
interface Alias {
|
|
31
|
-
containerName: string;
|
|
32
|
-
}
|
|
33
|
-
/** Properties that specify a WorkspaceContainer. */
|
|
34
|
-
interface Props extends Optional<CloudSqlite.ContainerAccessProps, "accessToken"> {
|
|
35
|
-
/** attempt to synchronize (i.e. call `checkForChanges`) this cloud container whenever it is connected to a cloud cache. Default=true */
|
|
36
|
-
syncOnConnect?: boolean;
|
|
37
|
-
}
|
|
38
|
-
/** A function to supply an [AccessToken]($bentley) for a `WorkspaceContainer`.
|
|
39
|
-
* @param props The properties of the WorkspaceContainer necessary to obtain the access token
|
|
40
|
-
* @returns a Promise that resolves to the AccessToken for the container.
|
|
18
|
+
export type WorkspaceContainerId = string;
|
|
19
|
+
/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
export interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, "accessToken"> {
|
|
23
|
+
/** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].
|
|
24
|
+
* @note This property defaults to `true`.
|
|
41
25
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
26
|
+
readonly syncOnConnect?: boolean;
|
|
27
|
+
/** A user-friendly description of the container's contents. */
|
|
28
|
+
readonly description?: string;
|
|
29
|
+
/** A message to display to the user if problems occur while loading the container. */
|
|
30
|
+
readonly loadingHelp?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The base name of a [[WorkspaceDb]], without any version information.
|
|
33
|
+
* The name must conform to the following constraints:
|
|
34
|
+
* - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].
|
|
35
|
+
* - Between 1 and 255 characters in length.
|
|
36
|
+
* - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.
|
|
37
|
+
* - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and "#".
|
|
38
|
+
* - Begin or end with a whitespace character.
|
|
39
|
+
* @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.
|
|
40
|
+
* @beta
|
|
41
|
+
*/
|
|
42
|
+
export type WorkspaceDbName = string;
|
|
43
|
+
/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format "name:version".
|
|
44
|
+
* @beta
|
|
45
|
+
*/
|
|
46
|
+
export type WorkspaceDbFullName = string;
|
|
47
|
+
/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., "4.2.11".
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export type WorkspaceDbVersion = string;
|
|
51
|
+
/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,
|
|
52
|
+
* e.g., ">=1.2.7 <1.3.0".
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
export type WorkspaceDbVersionRange = string;
|
|
56
|
+
/** Specifies the name and version of a [[WorkspaceDb]].
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
export interface WorkspaceDbNameAndVersion {
|
|
60
|
+
/** The name of the [[WorkspaceDb]]. If omitted, it defaults to "workspace-db". */
|
|
61
|
+
readonly dbName?: WorkspaceDbName;
|
|
62
|
+
/** The range of acceptable versions of the [[WorkspaceDb]] of the specified [[dbName]].
|
|
63
|
+
* If omitted, it defaults to the newest available version.
|
|
50
64
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
readonly version?: WorkspaceDbVersionRange;
|
|
66
|
+
}
|
|
67
|
+
/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].
|
|
68
|
+
* @beta
|
|
69
|
+
*/
|
|
70
|
+
export interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {
|
|
71
|
+
/** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., "1.4.2-beta.0".
|
|
72
|
+
* By default, only released version are allowed.
|
|
58
73
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
/** Create a dbName for a WorkspaceDb from its base name and version. This will be in the format "name:version" */
|
|
64
|
-
function makeDbFileName(dbName: WorkspaceDb.DbName, version?: WorkspaceDb.Version): WorkspaceDb.DbName;
|
|
74
|
+
readonly includePrerelease?: boolean;
|
|
75
|
+
/** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */
|
|
76
|
+
readonly prefetch?: boolean;
|
|
65
77
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/** if true, allow semver *prerelease* versions. By default only released version are allowed. */
|
|
83
|
-
includePrerelease?: boolean;
|
|
84
|
-
}
|
|
85
|
-
/** Scope to increment for a version number.
|
|
86
|
-
* @see semver.ReleaseType
|
|
78
|
+
/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.
|
|
79
|
+
* @beta
|
|
80
|
+
*/
|
|
81
|
+
export type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;
|
|
82
|
+
/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
85
|
+
export type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;
|
|
86
|
+
/** Arguments supplied to [[WorkspaceDb.queryResources]].
|
|
87
|
+
* @beta
|
|
88
|
+
*/
|
|
89
|
+
export interface WorkspaceDbQueryResourcesArgs {
|
|
90
|
+
/** The type of resource to query. */
|
|
91
|
+
type?: "string" | "blob";
|
|
92
|
+
/** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.
|
|
93
|
+
* Only resources whose names match the pattern will be included in the query results.
|
|
87
94
|
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
95
|
+
namePattern?: string;
|
|
96
|
+
/** The comparison operator by which to compare the name of each resource to [[namePattern]].
|
|
97
|
+
* Only resources whose names match the pattern will be included in the query results.
|
|
98
|
+
* Ignored if [[namePattern]] is undefined.
|
|
91
99
|
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
|
|
100
|
+
nameCompare?: "GLOB" | "LIKE" | "NOT GLOB" | "NOT LIKE" | "=" | "<" | ">";
|
|
101
|
+
/** A function invoked to process the resources that match the query criterion. */
|
|
102
|
+
callback: WorkspaceDbQueryResourcesCallback;
|
|
95
103
|
}
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to
|
|
105
|
+
* contact with questions about it, and so on.
|
|
106
|
+
* @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.
|
|
107
|
+
* @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.
|
|
108
|
+
* @beta
|
|
109
|
+
*/
|
|
110
|
+
export interface WorkspaceDbManifest {
|
|
111
|
+
/** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough
|
|
112
|
+
* so that uses may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in
|
|
113
|
+
* lists of WorkspaceDbs.
|
|
114
|
+
* @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).
|
|
115
|
+
*/
|
|
116
|
+
readonly workspaceName: string;
|
|
117
|
+
/** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */
|
|
118
|
+
readonly description?: string;
|
|
119
|
+
/** The name of the person to contact with questions about this [[WorkspaceDb]]. */
|
|
120
|
+
readonly contactName?: string;
|
|
121
|
+
/** The name of the person who last modified this [[WorkspaceDb]]. */
|
|
122
|
+
readonly lastEditedBy?: string;
|
|
113
123
|
}
|
|
114
124
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
|
|
125
|
+
* An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user
|
|
126
|
+
* is not authorized to access its [[WorkspaceContainer]].
|
|
127
|
+
* @beta
|
|
128
|
+
*/
|
|
129
|
+
export interface WorkspaceDbLoadError extends Error {
|
|
130
|
+
/** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */
|
|
131
|
+
wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;
|
|
132
|
+
/** The [[WorkspaceDb]] in which the error occurred, if available. */
|
|
133
|
+
wsDb?: WorkspaceDb;
|
|
134
|
+
}
|
|
135
|
+
/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].
|
|
136
|
+
* This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]
|
|
137
|
+
* so that the user can be notified of the problems.
|
|
138
|
+
* @beta
|
|
139
|
+
*/
|
|
140
|
+
export interface WorkspaceDbLoadErrors extends Error {
|
|
141
|
+
/** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem
|
|
142
|
+
* is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..
|
|
143
|
+
*/
|
|
144
|
+
wsLoadErrors?: WorkspaceDbLoadError[];
|
|
145
|
+
}
|
|
146
|
+
/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].
|
|
147
|
+
* Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].
|
|
148
|
+
* @beta
|
|
149
|
+
*/
|
|
150
|
+
export interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {
|
|
151
|
+
/** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */
|
|
152
|
+
resourceName: string;
|
|
153
|
+
/** The priority to assign to the [[SettingsDictionary]]. */
|
|
154
|
+
priority: SettingsPriority;
|
|
155
|
+
}
|
|
156
|
+
/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].
|
|
157
|
+
* Resource names must conform to the following constraints:
|
|
158
|
+
* - At least 1 character and no more than 1024 characters in length.
|
|
159
|
+
* - No leading or trailing whitespace characters.
|
|
160
|
+
* Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define
|
|
161
|
+
* resources with the same name but different types.
|
|
162
|
+
* @beta
|
|
163
|
+
*/
|
|
164
|
+
export type WorkspaceResourceName = string;
|
|
165
|
+
/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.
|
|
166
|
+
* Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:
|
|
167
|
+
* - Fonts and [TextStyle]($common)s used when placing [TextAnnotation]($common)s.
|
|
168
|
+
* - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.
|
|
169
|
+
* - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].
|
|
170
|
+
* - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.
|
|
171
|
+
*
|
|
172
|
+
* Ultimately, each resource is stored in one of the following formats:
|
|
173
|
+
* - A `string`, which is often a stringified `JSON` representation of the resource;
|
|
174
|
+
* - A binary `blob`; or
|
|
175
|
+
* - An embedded file.
|
|
176
|
+
*
|
|
177
|
+
* Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software
|
|
178
|
+
* that uses them is written to access them from disk.
|
|
179
|
+
*
|
|
180
|
+
* A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.
|
|
181
|
+
* However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.
|
|
182
|
+
* `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).
|
|
183
|
+
*
|
|
184
|
+
* The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain
|
|
185
|
+
* a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain
|
|
186
|
+
* a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].
|
|
187
|
+
*
|
|
188
|
+
* You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].
|
|
119
189
|
* @beta
|
|
120
190
|
*/
|
|
121
191
|
export interface WorkspaceDb {
|
|
122
|
-
/**
|
|
192
|
+
/** @internal */
|
|
193
|
+
[_implementationProhibited]: unknown;
|
|
194
|
+
/** The [[WorkspaceContainer]] in which this db resides. */
|
|
123
195
|
readonly container: WorkspaceContainer;
|
|
124
196
|
/** The base name of this WorkspaceDb, without version */
|
|
125
|
-
readonly dbName:
|
|
126
|
-
/** event raised before this WorkspaceDb is
|
|
197
|
+
readonly dbName: WorkspaceDbName;
|
|
198
|
+
/** An event raised before this WorkspaceDb is [[close]]d. */
|
|
127
199
|
readonly onClose: BeEvent<() => void>;
|
|
128
|
-
/**
|
|
200
|
+
/** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */
|
|
129
201
|
readonly dbFileName: string;
|
|
130
|
-
/**
|
|
202
|
+
/** The underlying SQLite database that stores this WorkspaceDb's resources. */
|
|
131
203
|
readonly sqliteDb: SQLiteDb;
|
|
204
|
+
/** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */
|
|
205
|
+
readonly isOpen: boolean;
|
|
206
|
+
/** The manifest that describes the contents and context of this WorkspaceDb. */
|
|
207
|
+
readonly manifest: WorkspaceDbManifest;
|
|
208
|
+
/** The version of this WorkspaceDb */
|
|
209
|
+
readonly version: WorkspaceDbVersion;
|
|
210
|
+
/** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,
|
|
211
|
+
* when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.
|
|
212
|
+
* Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.
|
|
213
|
+
*/
|
|
132
214
|
open(): void;
|
|
215
|
+
/** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */
|
|
133
216
|
close(): void;
|
|
134
|
-
/**
|
|
135
|
-
getString(rscName:
|
|
136
|
-
/**
|
|
137
|
-
getBlob(rscName:
|
|
217
|
+
/** Look up a string resource by name, if one exists. */
|
|
218
|
+
getString(rscName: WorkspaceResourceName): string | undefined;
|
|
219
|
+
/** Look up a binary resource by name, if one exists. */
|
|
220
|
+
getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;
|
|
138
221
|
/** Get a BlobIO reader for a blob WorkspaceResource.
|
|
139
222
|
* @note when finished, caller *must* call `close` on the BlobIO.
|
|
140
223
|
* @internal
|
|
141
224
|
*/
|
|
142
|
-
getBlobReader(rscName:
|
|
225
|
+
getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;
|
|
143
226
|
/**
|
|
144
227
|
* Extract a local copy of a file resource from this WorkspaceDb, if present.
|
|
145
228
|
* @param rscName The name of the file resource in the WorkspaceDb
|
|
146
229
|
* @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If
|
|
147
230
|
* 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
|
|
148
|
-
* keep the extracted files in the
|
|
149
|
-
* @returns the full path to a file on the local
|
|
150
|
-
* @note The file is copied from the file into the local
|
|
231
|
+
* keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].
|
|
232
|
+
* @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.
|
|
233
|
+
* @note The file is copied from the file into the local file system so it may be accessed directly. This happens only
|
|
151
234
|
* as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.
|
|
152
235
|
* For this reason, you should not save the local file name, and instead call this method every time you access it, so its
|
|
153
236
|
* content is always holds the correct version.
|
|
154
237
|
* @note The filename will be a hash value, not the resource name.
|
|
155
|
-
* @note Workspace resource files are set
|
|
238
|
+
* @note Workspace resource files are set as read-only as they are copied from the file.
|
|
156
239
|
* To edit them, you must first copy them to another location.
|
|
157
240
|
*/
|
|
158
|
-
getFile(rscName:
|
|
241
|
+
getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;
|
|
159
242
|
/**
|
|
160
|
-
* Ensure that the contents of
|
|
161
|
-
* Until the promise
|
|
243
|
+
* Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.
|
|
244
|
+
* Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.
|
|
162
245
|
* To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.
|
|
163
|
-
* @returns a
|
|
164
|
-
* @throws if this WorkspaceDb is not from a
|
|
246
|
+
* @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.
|
|
247
|
+
* @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].
|
|
165
248
|
*/
|
|
166
249
|
prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;
|
|
250
|
+
/** Find resources of a particular type with names matching a specified pattern.
|
|
251
|
+
* The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].
|
|
252
|
+
* @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.
|
|
253
|
+
*/
|
|
254
|
+
queryResources(args: WorkspaceDbQueryResourcesArgs): void;
|
|
167
255
|
/** @internal */
|
|
168
|
-
queryFileResource(rscName:
|
|
256
|
+
queryFileResource(rscName: WorkspaceResourceName): {
|
|
169
257
|
localFileName: LocalFileName;
|
|
170
258
|
info: IModelJsNative.EmbedFileQuery;
|
|
171
259
|
} | undefined;
|
|
172
260
|
}
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
export interface WorkspaceCloudCacheProps extends Optional<CloudSqlite.CacheProps, "name" | "rootDir"> {
|
|
177
|
-
/** if true, empty the cache before using it. */
|
|
178
|
-
clearContents?: boolean;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Options for constructing a [[Workspace]].
|
|
182
|
-
* @beta
|
|
183
|
-
*/
|
|
261
|
+
/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].
|
|
262
|
+
* @beta
|
|
263
|
+
*/
|
|
184
264
|
export interface WorkspaceOpts {
|
|
185
|
-
/** The local directory for non-cloud-based WorkspaceDb files. The
|
|
265
|
+
/** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory
|
|
186
266
|
* for files named `${containerId}/${dbId}.itwin-workspace`.
|
|
187
|
-
* @note if not supplied, defaults to
|
|
267
|
+
* @note if not supplied, defaults to "iTwin/Workspace" in the user-local folder.
|
|
188
268
|
*/
|
|
189
269
|
containerDir?: LocalDirName;
|
|
190
|
-
/**
|
|
191
|
-
settingsFiles?: LocalFileName | [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
270
|
+
/** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */
|
|
271
|
+
settingsFiles?: LocalFileName | LocalFileName[];
|
|
272
|
+
}
|
|
273
|
+
/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].
|
|
274
|
+
* @beta
|
|
275
|
+
*/
|
|
276
|
+
export interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {
|
|
277
|
+
/** Token required to access the container. */
|
|
278
|
+
accessToken: AccessToken;
|
|
196
279
|
}
|
|
197
280
|
/**
|
|
198
281
|
* Settings and resources that customize an application for the current session.
|
|
199
|
-
* See [
|
|
282
|
+
* See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.
|
|
200
283
|
* @beta
|
|
201
284
|
*/
|
|
202
285
|
export interface Workspace {
|
|
203
|
-
/**
|
|
286
|
+
/** @internal */
|
|
287
|
+
[_implementationProhibited]: unknown;
|
|
288
|
+
/** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.
|
|
289
|
+
* @internal
|
|
290
|
+
*/
|
|
204
291
|
readonly containerDir: LocalDirName;
|
|
205
|
-
/** The [[Settings]] for this Workspace */
|
|
292
|
+
/** The current [[Settings]] for this Workspace */
|
|
206
293
|
readonly settings: Settings;
|
|
207
|
-
/** Get
|
|
294
|
+
/** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */
|
|
208
295
|
getCloudCache(): CloudSqlite.CloudCache;
|
|
209
|
-
/**
|
|
210
|
-
* @param containerId
|
|
211
|
-
* @returns the [[WorkspaceContainer]] for `containerId` if
|
|
296
|
+
/** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].
|
|
297
|
+
* @param containerId The id of the container
|
|
298
|
+
* @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.
|
|
299
|
+
* @internal
|
|
212
300
|
*/
|
|
213
|
-
findContainer(containerId:
|
|
214
|
-
/**
|
|
215
|
-
* @param props
|
|
301
|
+
findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;
|
|
302
|
+
/** Obtain the [[WorkspaceContainer]] specified by `props`.
|
|
303
|
+
* @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.
|
|
216
304
|
* Otherwise it is created.
|
|
217
|
-
* @
|
|
305
|
+
* @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,
|
|
306
|
+
* hence this function is async.
|
|
307
|
+
* @see [[getContainer]] to obtain a container synchronously.
|
|
218
308
|
*/
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* Get an opened [[WorkspaceDb]]. If the WorkspaceDb is present but not open, it is opened first.
|
|
226
|
-
* If `cloudProps` are supplied, a CloudContainer will be used to open the WorkspaceDb.
|
|
309
|
+
getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;
|
|
310
|
+
/** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:
|
|
311
|
+
* - a valid [AccessToken]($bentley) is already available;
|
|
312
|
+
* - the container has already been previously prefetched in another session (this is useful for offline usage); or
|
|
313
|
+
* - the container is public and doesn't require an [AccessToken]($bentley).
|
|
314
|
+
* @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.
|
|
227
315
|
*/
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* @
|
|
316
|
+
getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;
|
|
317
|
+
/** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].
|
|
318
|
+
* @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in
|
|
319
|
+
* the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be "chained" together so that loading one
|
|
320
|
+
* causes its "dependent" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).
|
|
231
321
|
*/
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
|
|
322
|
+
loadSettingsDictionary(
|
|
323
|
+
/** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */
|
|
324
|
+
props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],
|
|
325
|
+
/** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */
|
|
326
|
+
problems?: WorkspaceDbLoadError[]): Promise<void>;
|
|
327
|
+
/** Get a single [[WorkspaceDb]]. */
|
|
328
|
+
getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;
|
|
329
|
+
/**
|
|
330
|
+
* Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]
|
|
331
|
+
* that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].
|
|
332
|
+
* The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].
|
|
333
|
+
* @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the
|
|
334
|
+
* properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].
|
|
335
|
+
* @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes
|
|
336
|
+
* be useful for editors, tests, or diagnostics.
|
|
235
337
|
*/
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
338
|
+
resolveWorkspaceDbSetting(
|
|
339
|
+
/** the name of the setting. */
|
|
340
|
+
settingName: SettingName,
|
|
341
|
+
/** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */
|
|
342
|
+
filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];
|
|
343
|
+
/**
|
|
344
|
+
* Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will
|
|
345
|
+
* use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].
|
|
346
|
+
* @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence
|
|
347
|
+
* over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.
|
|
348
|
+
* @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.
|
|
349
|
+
*/
|
|
350
|
+
getWorkspaceDbs(args: Workspace.DbListOrSettingName & {
|
|
351
|
+
/** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */
|
|
352
|
+
problems?: WorkspaceDbLoadError[];
|
|
353
|
+
/** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */
|
|
354
|
+
filter?: Workspace.DbListFilter;
|
|
355
|
+
}): Promise<WorkspaceDb[]>;
|
|
244
356
|
}
|
|
245
357
|
/**
|
|
246
|
-
* A WorkspaceContainer is a type of
|
|
358
|
+
* 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.
|
|
247
359
|
* Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that
|
|
248
360
|
* 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
|
|
249
361
|
* similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).
|
|
250
362
|
* @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.
|
|
251
363
|
* That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.
|
|
364
|
+
* @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.
|
|
365
|
+
* In this case, [[cloudContainer]] will be `undefined`.
|
|
366
|
+
* @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.
|
|
252
367
|
* @beta
|
|
253
368
|
*/
|
|
254
369
|
export interface WorkspaceContainer {
|
|
255
|
-
/**
|
|
370
|
+
/** @internal */
|
|
371
|
+
[_implementationProhibited]: unknown;
|
|
372
|
+
/** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.
|
|
373
|
+
* @internal
|
|
374
|
+
*/
|
|
256
375
|
readonly filesDir: LocalDirName;
|
|
257
|
-
/** The
|
|
258
|
-
readonly id: WorkspaceContainer.Id;
|
|
259
|
-
/** Workspace holding this WorkspaceContainer. */
|
|
376
|
+
/** The workspace into which this container was loaded. */
|
|
260
377
|
readonly workspace: Workspace;
|
|
261
|
-
/**
|
|
378
|
+
/** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */
|
|
262
379
|
readonly cloudContainer?: CloudSqlite.CloudContainer;
|
|
380
|
+
/** Properties supplied when this container was loaded */
|
|
381
|
+
readonly fromProps: WorkspaceContainerProps;
|
|
263
382
|
/** @internal */
|
|
264
|
-
addWorkspaceDb(toAdd:
|
|
383
|
+
addWorkspaceDb(toAdd: WorkspaceDb): void;
|
|
265
384
|
/**
|
|
266
|
-
* Find the
|
|
267
|
-
*
|
|
268
|
-
|
|
385
|
+
* Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.
|
|
386
|
+
* @throws Error if no version satisfying the criteria exists.
|
|
387
|
+
*/
|
|
388
|
+
resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;
|
|
389
|
+
/** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */
|
|
390
|
+
getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;
|
|
391
|
+
/** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.
|
|
392
|
+
* @internal
|
|
269
393
|
*/
|
|
270
|
-
resolveDbFileName(props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
|
|
271
|
-
/**
|
|
272
|
-
* Create a copy of an existing [[WorkspaceDb]] in this WorkspaceContainer with a new version number. This function is used
|
|
273
|
-
* by administrator tools that modify Workspaces. This requires that the write lock on the container be held. The copy should be modified with
|
|
274
|
-
* new content before the write lock is released, and thereafter should never be modified again.
|
|
275
|
-
* @param fromProps Properties that describe the source WorkspaceDb for the new version
|
|
276
|
-
* @param versionType The type of version increment to apply to the existing version.
|
|
277
|
-
* @note The copy actually shares all of the data with the original, but with copy-on-write if/when data in the new WorkspaceDb is modified.
|
|
278
|
-
*/
|
|
279
|
-
makeNewVersion(fromProps: WorkspaceDb.Props, versionType: WorkspaceDb.VersionIncrement): Promise<{
|
|
280
|
-
oldName: WorkspaceDb.DbName;
|
|
281
|
-
newName: WorkspaceDb.DbName;
|
|
282
|
-
}>;
|
|
283
|
-
/** find or open a WorkspaceDb from this WorkspaceContainer. */
|
|
284
|
-
getWorkspaceDb(props: WorkspaceDb.Props): WorkspaceDb;
|
|
285
|
-
/** Close and remove a currently opened [[WorkspaceDb]] from this Workspace. */
|
|
286
394
|
closeWorkspaceDb(container: WorkspaceDb): void;
|
|
287
|
-
/** Close this WorkspaceContainer. All currently opened WorkspaceDbs are dropped. */
|
|
288
|
-
close(): void;
|
|
289
395
|
}
|
|
290
|
-
/**
|
|
291
|
-
* An editable [[WorkspaceDb]]. This is used only by tools to allow administrators to create and modify `WorkspaceDb`s.
|
|
292
|
-
* For CloudSqlite Workspaces, the write token must be obtained before the methods in this interface may be used. Normally
|
|
293
|
-
* only admins will have write access to Workspaces. Only one admin at at time may be editing a Workspace.
|
|
396
|
+
/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.
|
|
294
397
|
* @beta
|
|
295
398
|
*/
|
|
296
|
-
export
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
|
-
/** Update an existing string resource with a new value, or add it if it does not exist.
|
|
304
|
-
* @param rscName The name of the string resource.
|
|
305
|
-
* @param val The new value.
|
|
306
|
-
*/
|
|
307
|
-
updateString(rscName: WorkspaceResource.Name, val: string): void;
|
|
308
|
-
/** Remove a string resource. */
|
|
309
|
-
removeString(rscName: WorkspaceResource.Name): void;
|
|
310
|
-
/** Add a new blob resource to this WorkspaceDb.
|
|
311
|
-
* @param rscName The name of the blob resource.
|
|
312
|
-
* @param val The blob to save.
|
|
313
|
-
*/
|
|
314
|
-
addBlob(rscName: WorkspaceResource.Name, val: Uint8Array): void;
|
|
315
|
-
/** Update an existing blob resource with a new value, or add it if it does not exist.
|
|
316
|
-
* @param rscName The name of the blob resource.
|
|
317
|
-
* @param val The new value.
|
|
318
|
-
*/
|
|
319
|
-
updateBlob(rscName: WorkspaceResource.Name, val: Uint8Array): void;
|
|
320
|
-
/** Get a BlobIO writer for a previously-added blob WorkspaceResource.
|
|
321
|
-
* @note after writing is complete, caller must call `close` on the BlobIO and must call `saveChanges` on the `db`.
|
|
322
|
-
*/
|
|
323
|
-
getBlobWriter(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
|
|
324
|
-
/** Remove a blob resource. */
|
|
325
|
-
removeBlob(rscName: WorkspaceResource.Name): void;
|
|
326
|
-
/** Copy the contents of an existing local file into this WorkspaceDb as a file resource.
|
|
327
|
-
* @param rscName The name of the file resource.
|
|
328
|
-
* @param localFileName The name of a local file to be read.
|
|
329
|
-
* @param fileExt The extension (do not include the leading ".") to be appended to the generated fileName
|
|
330
|
-
* when this WorkspaceDb is extracted from the WorkspaceDb. By default the characters after the last "." in `localFileName`
|
|
331
|
-
* are used. Pass this argument to override that.
|
|
332
|
-
*/
|
|
333
|
-
addFile(rscName: WorkspaceResource.Name, localFileName: LocalFileName, fileExt?: string): void;
|
|
334
|
-
/** Replace an existing file resource with the contents of another local file.
|
|
335
|
-
* @param rscName The name of the file resource.
|
|
336
|
-
* @param localFileName The name of a local file to be read.
|
|
337
|
-
* @throws if rscName does not exist
|
|
338
|
-
*/
|
|
339
|
-
updateFile(rscName: WorkspaceResource.Name, localFileName: LocalFileName): void;
|
|
340
|
-
/** Remove a file resource. */
|
|
341
|
-
removeFile(rscName: WorkspaceResource.Name): void;
|
|
399
|
+
export declare namespace WorkspaceSettingNames {
|
|
400
|
+
/** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically
|
|
401
|
+
* be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]
|
|
402
|
+
* to others upon which they depend.
|
|
403
|
+
* This setting's value is an array of [[WorkspaceDbSettingsProps]]s.
|
|
404
|
+
*/
|
|
405
|
+
const settingsWorkspaces: string;
|
|
342
406
|
}
|
|
343
|
-
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
407
|
+
/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].
|
|
408
|
+
* The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.
|
|
409
|
+
* @beta
|
|
410
|
+
*/
|
|
411
|
+
export type QueryWorkspaceResourcesCallback = (resources: Iterable<{
|
|
412
|
+
name: string;
|
|
413
|
+
db: WorkspaceDb;
|
|
414
|
+
}>) => void;
|
|
415
|
+
/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.
|
|
416
|
+
* @beta
|
|
417
|
+
*/
|
|
418
|
+
export interface QueryWorkspaceResourcesArgs {
|
|
419
|
+
/** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.
|
|
420
|
+
* @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.
|
|
421
|
+
*/
|
|
422
|
+
dbs: WorkspaceDb[];
|
|
423
|
+
/** The type of resource to query. */
|
|
424
|
+
type?: "string" | "blob";
|
|
425
|
+
/** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.
|
|
426
|
+
* Only resources whose names match the pattern will be included in the query results.
|
|
427
|
+
*/
|
|
428
|
+
namePattern?: string;
|
|
429
|
+
/** The comparison operator by which to compare the name of each resource to [[namePattern]].
|
|
430
|
+
* Only resources whose names match the pattern will be included in the query results.
|
|
431
|
+
* Ignored i [[namePattern]] is undefined.
|
|
432
|
+
*/
|
|
433
|
+
nameCompare?: "GLOB" | "LIKE" | "NOT GLOB" | "NOT LIKE" | "=" | "<" | ">";
|
|
434
|
+
/** A function invoked to process the resources that match the query criteria. */
|
|
435
|
+
callback: QueryWorkspaceResourcesCallback;
|
|
349
436
|
}
|
|
350
|
-
/**
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
437
|
+
/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].
|
|
438
|
+
* @beta
|
|
439
|
+
*/
|
|
440
|
+
export interface GetWorkspaceResourceArgs {
|
|
441
|
+
/** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.
|
|
442
|
+
* @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.
|
|
443
|
+
*/
|
|
444
|
+
dbs: WorkspaceDb[];
|
|
445
|
+
/** The name of the resource to find. */
|
|
446
|
+
name: WorkspaceResourceName;
|
|
447
|
+
}
|
|
448
|
+
/** @beta */
|
|
449
|
+
export declare namespace Workspace {
|
|
450
|
+
/** A function invoked to handle exceptions produced while loading workspace data.
|
|
451
|
+
* Applications can override this function to notify the user and/or attempt to diagnose the problem.
|
|
452
|
+
* The default implementation simply logs each exception.
|
|
453
|
+
*/
|
|
454
|
+
let exceptionDiagnosticFn: (e: WorkspaceDbLoadErrors) => void;
|
|
455
|
+
/** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */
|
|
456
|
+
interface SettingsDictionaryLoaded {
|
|
457
|
+
/** The dictionary that was loaded */
|
|
458
|
+
dict: SettingsDictionary;
|
|
459
|
+
/** The WorkspaceDb from which the dictionary was loaded. */
|
|
460
|
+
from: WorkspaceDb;
|
|
461
|
+
}
|
|
462
|
+
/** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].
|
|
463
|
+
* Applications can override this function to notify the user and/or record diagnostics.
|
|
464
|
+
* The default implementation simply records an information message in the [Logger]($bentley).
|
|
465
|
+
*/
|
|
466
|
+
let onSettingsDictionaryLoadedFn: (loaded: SettingsDictionaryLoaded) => void;
|
|
467
|
+
/** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].
|
|
468
|
+
* Used by [[Workspace.getWorkspaceDbs]].
|
|
469
|
+
*/
|
|
470
|
+
type DbListOrSettingName = {
|
|
471
|
+
readonly dbs: WorkspaceDbCloudProps[];
|
|
472
|
+
readonly settingName?: never;
|
|
473
|
+
} | {
|
|
474
|
+
readonly settingName: SettingName;
|
|
475
|
+
readonly dbs?: never;
|
|
476
|
+
};
|
|
477
|
+
/** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some
|
|
478
|
+
* [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.
|
|
479
|
+
*/
|
|
480
|
+
type DbListFilter = (
|
|
481
|
+
/** The properties of the WorkspaceDb to be returned */
|
|
482
|
+
dbProp: WorkspaceDbCloudProps,
|
|
483
|
+
/** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the
|
|
484
|
+
* [[SettingsPriority]] of the dictionary.
|
|
485
|
+
*/
|
|
486
|
+
dict: SettingsDictionary) => boolean;
|
|
487
|
+
/** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.
|
|
488
|
+
* The list is searched in order, and the first resource with the request name is returned.
|
|
489
|
+
* If no such resource exists, the function returns `undefined`.
|
|
490
|
+
* @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.
|
|
491
|
+
* @beta
|
|
492
|
+
*/
|
|
493
|
+
function getStringResource(args: GetWorkspaceResourceArgs): string | undefined;
|
|
494
|
+
/** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.
|
|
495
|
+
* The list is searched in order, and the first resource with the request name is returned.
|
|
496
|
+
* If no such resource exists, the function returns `undefined`.
|
|
497
|
+
* @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.
|
|
498
|
+
* @beta
|
|
499
|
+
*/
|
|
500
|
+
function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined;
|
|
501
|
+
/** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.
|
|
502
|
+
* @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.
|
|
503
|
+
* @beta
|
|
504
|
+
*/
|
|
505
|
+
function queryResources(args: QueryWorkspaceResourcesArgs): void;
|
|
371
506
|
}
|
|
372
|
-
export {};
|
|
373
507
|
//# sourceMappingURL=Workspace.d.ts.map
|