@itwin/core-backend 3.3.0-dev.40 → 3.3.0-dev.41
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/lib/cjs/BackendHubAccess.d.ts +2 -7
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +10 -11
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +10 -11
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +14 -4
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +91 -19
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/Element.d.ts +1 -1
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +1 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +14 -0
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -0
- package/lib/cjs/GeoCoordConfig.js +74 -0
- package/lib/cjs/GeoCoordConfig.js.map +1 -0
- package/lib/cjs/HubMock.d.ts.map +1 -1
- package/lib/cjs/HubMock.js +0 -2
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +25 -15
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +43 -34
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +9 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +26 -12
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +5 -3
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +4 -3
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +5 -4
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +4 -0
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +4 -0
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +68 -0
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +22 -0
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +53 -0
- package/lib/cjs/assets/Settings/backend.setting.json5 +139 -0
- package/lib/cjs/core-backend.d.ts +1 -1
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -1
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +8 -12
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +8 -3
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +9 -0
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +76 -0
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -0
- package/lib/cjs/workspace/SettingsSchemas.js +192 -0
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -0
- package/lib/cjs/workspace/Workspace.d.ts +241 -146
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +260 -96
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +20 -13
- package/lib/cjs/assets/Settings.schema.json +0 -25
- package/lib/cjs/workspace/SettingsSpecRegistry.d.ts +0 -68
- package/lib/cjs/workspace/SettingsSpecRegistry.d.ts.map +0 -1
- package/lib/cjs/workspace/SettingsSpecRegistry.js +0 -122
- package/lib/cjs/workspace/SettingsSpecRegistry.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "http://itwinjs.org/json-schema/cloud",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
4
|
+
"title": "Cloud settings",
|
|
5
|
+
"description": "Settings for accessing cloud containers",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"groupName": "cloud",
|
|
8
|
+
"properties": {
|
|
9
|
+
"cloud/accounts": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"description": "array of cloud accounts",
|
|
12
|
+
"cumulative": true,
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": [
|
|
16
|
+
"name",
|
|
17
|
+
"accessName",
|
|
18
|
+
"storageType"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"name": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "the alias name of the cloud account used in `cloud/container.containerId` values"
|
|
24
|
+
},
|
|
25
|
+
"accessName": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "the accessName for the cloud account"
|
|
28
|
+
},
|
|
29
|
+
"storageType": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "the storageType of the cloud account"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"cloud/containers": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"description": "array of cloud containers",
|
|
39
|
+
"cumulative": true,
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": [
|
|
43
|
+
"name",
|
|
44
|
+
"containerId"
|
|
45
|
+
],
|
|
46
|
+
"properties": {
|
|
47
|
+
"name": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "the alias name of this cloud container"
|
|
50
|
+
},
|
|
51
|
+
"containerId": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"description": "the containerId of this cloud container"
|
|
54
|
+
},
|
|
55
|
+
"accountName": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "the account name for this cloud container. Must be an entry in \"cloud/accounts\" or empty string for local (non-cloud) containers."
|
|
58
|
+
},
|
|
59
|
+
"isPublic": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"description": "whether the cloud container is public (doesn't require authentication)",
|
|
62
|
+
"default": false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "http://itwinjs.org/json-schema/gcs",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
4
|
+
"title": "GeoCoordinate settings",
|
|
5
|
+
"description": "settings for geocoordinate services",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"groupName": "gcs",
|
|
8
|
+
"properties": {
|
|
9
|
+
"gcs/default/databases": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"cumulative": false,
|
|
12
|
+
"description": "List of GCS workspace database aliases loaded by default. Must be entries in \"workspace/databases\".",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"default": [
|
|
17
|
+
"gcs/base",
|
|
18
|
+
"gcs/entire-earth"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "http://itwinjs.org/json-schema/workspace",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
4
|
+
"title": "Workspace settings",
|
|
5
|
+
"description": "settings for accessing data from workspaces",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"groupName": "workspace",
|
|
8
|
+
"properties": {
|
|
9
|
+
"workspace/databases": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"cumulative": true,
|
|
12
|
+
"description": "array of workspace databases",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": [
|
|
16
|
+
"name",
|
|
17
|
+
"dbName",
|
|
18
|
+
"containerName"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"name": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "the alias name of the workspace database"
|
|
24
|
+
},
|
|
25
|
+
"dbName": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "the name of the database within its cloud container"
|
|
28
|
+
},
|
|
29
|
+
"containerName": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "the container name"
|
|
32
|
+
},
|
|
33
|
+
"version": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "the (semver) range of acceptable versions"
|
|
36
|
+
},
|
|
37
|
+
"includePrerelease": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "include prerelease version as acceptable versions"
|
|
40
|
+
},
|
|
41
|
+
"priority": {
|
|
42
|
+
"type": "number",
|
|
43
|
+
"description": "for sorted databases, higher values are searched first"
|
|
44
|
+
},
|
|
45
|
+
"prefetch": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"description": "if true, pre-fetch all of the data from the cloud in the background"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cloud/accounts": [
|
|
3
|
+
{
|
|
4
|
+
"name": "gcs/account",
|
|
5
|
+
"accessName": "https://gcs-data.itwin.org/",
|
|
6
|
+
"storageType": "azure?customuri=1&sas=1"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"cloud/containers": [
|
|
10
|
+
{
|
|
11
|
+
"name": "gcs/container",
|
|
12
|
+
"accountName": "gcs/account",
|
|
13
|
+
"containerId": "gcs",
|
|
14
|
+
"isPublic": true
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"workspace/databases": [
|
|
18
|
+
{
|
|
19
|
+
"name": "gcs/base",
|
|
20
|
+
"dbName": "base",
|
|
21
|
+
"containerName": "gcs/container",
|
|
22
|
+
"version": "^1",
|
|
23
|
+
"priority": 10000,
|
|
24
|
+
"prefetch": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "gcs/entire-earth",
|
|
28
|
+
"dbName": "allEarth",
|
|
29
|
+
"containerName": "gcs/container",
|
|
30
|
+
"version": "^1",
|
|
31
|
+
"priority": 100
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "gcs/Australia",
|
|
35
|
+
"dbName": "Australia",
|
|
36
|
+
"containerName": "gcs/container",
|
|
37
|
+
"version": "^1",
|
|
38
|
+
"priority": 500
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "gcs/Brazil",
|
|
42
|
+
"dbName": "Brazil",
|
|
43
|
+
"containerName": "gcs/container",
|
|
44
|
+
"version": "^1",
|
|
45
|
+
"priority": 500
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "gcs/Canada",
|
|
49
|
+
"dbName": "Canada",
|
|
50
|
+
"containerName": "gcs/container",
|
|
51
|
+
"version": "^1",
|
|
52
|
+
"priority": 500
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "gcs/France",
|
|
56
|
+
"dbName": "France",
|
|
57
|
+
"containerName": "gcs/container",
|
|
58
|
+
"version": "^1",
|
|
59
|
+
"priority": 500
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "gcs/Germany",
|
|
63
|
+
"dbName": "Germany",
|
|
64
|
+
"containerName": "gcs/container",
|
|
65
|
+
"version": "^1",
|
|
66
|
+
"priority": 500
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "gcs/Japan",
|
|
70
|
+
"dbName": "Japan",
|
|
71
|
+
"containerName": "gcs/container",
|
|
72
|
+
"version": "^1",
|
|
73
|
+
"priority": 500
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "gcs/NewZealand",
|
|
77
|
+
"dbName": "NewZealand",
|
|
78
|
+
"containerName": "gcs/container",
|
|
79
|
+
"version": "^1",
|
|
80
|
+
"priority": 500
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "gcs/Portugal",
|
|
84
|
+
"dbName": "Portugal",
|
|
85
|
+
"containerName": "gcs/container",
|
|
86
|
+
"version": "^1",
|
|
87
|
+
"priority": 500
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "gcs/Slovakia",
|
|
91
|
+
"dbName": "Slovakia",
|
|
92
|
+
"containerName": "gcs/container",
|
|
93
|
+
"version": "^1",
|
|
94
|
+
"priority": 500
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "gcs/SouthAfrica",
|
|
98
|
+
"dbName": "SouthAfrica",
|
|
99
|
+
"containerName": "gcs/container",
|
|
100
|
+
"version": "^1",
|
|
101
|
+
"priority": 500
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "gcs/Spain",
|
|
105
|
+
"dbName": "Spain",
|
|
106
|
+
"containerName": "gcs/container",
|
|
107
|
+
"version": "^1",
|
|
108
|
+
"priority": 500
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "gcs/Switzerland",
|
|
112
|
+
"dbName": "Switzerland",
|
|
113
|
+
"containerName": "gcs/container",
|
|
114
|
+
"version": "^1",
|
|
115
|
+
"priority": 500
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "gcs/UK",
|
|
119
|
+
"dbName": "UK",
|
|
120
|
+
"containerName": "gcs/container",
|
|
121
|
+
"version": "^1",
|
|
122
|
+
"priority": 500
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "gcs/Usa",
|
|
126
|
+
"dbName": "Usa",
|
|
127
|
+
"containerName": "gcs/container",
|
|
128
|
+
"version": "^1",
|
|
129
|
+
"priority": 500
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "gcs/Venezuela",
|
|
133
|
+
"dbName": "Venezuela",
|
|
134
|
+
"containerName": "gcs/container",
|
|
135
|
+
"version": "^1",
|
|
136
|
+
"priority": 500
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
@@ -49,7 +49,7 @@ export * from "./DevTools";
|
|
|
49
49
|
export * from "./LocalhostIpcHost";
|
|
50
50
|
export * from "./ElementGraphics";
|
|
51
51
|
export * from "./workspace/Settings";
|
|
52
|
-
export * from "./workspace/
|
|
52
|
+
export * from "./workspace/SettingsSchemas";
|
|
53
53
|
export * from "./workspace/Workspace";
|
|
54
54
|
export * from "./IModelDb";
|
|
55
55
|
/** @docs-package-description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,C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AIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
package/lib/cjs/core-backend.js
CHANGED
|
@@ -69,7 +69,7 @@ __exportStar(require("./DevTools"), exports);
|
|
|
69
69
|
__exportStar(require("./LocalhostIpcHost"), exports);
|
|
70
70
|
__exportStar(require("./ElementGraphics"), exports);
|
|
71
71
|
__exportStar(require("./workspace/Settings"), exports);
|
|
72
|
-
__exportStar(require("./workspace/
|
|
72
|
+
__exportStar(require("./workspace/SettingsSchemas"), exports);
|
|
73
73
|
__exportStar(require("./workspace/Workspace"), exports);
|
|
74
74
|
__exportStar(require("./IModelDb"), exports); // must be last
|
|
75
75
|
/** @docs-package-description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,qDAAmC;AACnC,6CAA2B;AAC3B,yDAAuC;AACvC,sDAAoC;AACpC,kDAAgC;AAChC,8CAA4B;AAC5B,iDAA+B;AAC/B,yCAAuB;AACvB,uDAAqC;AACrC,mDAAiC;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,2CAAyB;AACzB,mDAAiC;AACjC,mDAAiC;AACjC,6CAA2B;AAC3B,4CAA0B;AAC1B,+CAA6B;AAC7B,qDAAmC;AACnC,iDAA+B;AAC/B,4CAA0B;AAC1B,+CAA6B;AAC7B,8CAA4B;AAC5B,0DAAwC;AACxC,6CAA2B;AAC3B,0CAAwB;AACxB,2DAAyC;AACzC,+CAA6B;AAC7B,2CAAyB;AACzB,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CAA0B;AAC1B,qDAAmC;AACnC,+CAA6B;AAC7B,wDAAsC;AACtC,2DAAyC;AACzC,6CAA2B;AAC3B,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC;AACrC,8DAA4C;AAC5C,wDAAsC;AACtC,6CAA2B,CAAC,eAAe;AAE3C;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./Entity\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./LocalHub\";\r\nexport * from \"./HubMock\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./RpcBackend\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport { CloudSqlite, IModelJsNative, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelSchemaLoader\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./CloudStorageBackend\";\r\nexport * from \"./AliCloudStorageService\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSchemas\";\r\nexport * from \"./workspace/Workspace\";\r\nexport * from \"./IModelDb\"; // must be last\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/intro/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/intro/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/intro/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/intro/relationship-fundamentals.md) between elements.\r\n */\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/intro/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Categories\r\n * Classes for [Categories]($docs/bis/intro/categories.md).\r\n */\r\n/**\r\n * @docs-group-description Symbology\r\n * Classes for defining the appearance of element geometry\r\n */\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n/**\r\n * @docs-group-description Portability\r\n * Classes to help write [portable apps]($docs/learning/Portability.md) and libraries that will run on any platform, including web apps, node services, Electron desktops apps, and mobile apps.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n/**\r\n * @docs-group-description CloudStorageBackend\r\n * Classes for working with cloud storage.\r\n */\r\n/**\r\n * @docs-group-description AliCloudStorageService\r\n * Classes for working with cloud storage using AliCloud.\r\n */\r\n/**\r\n * @docs-group-description Authentication\r\n * Classes for working with Authentication.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * APIs for working with tile graphics.\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n/**\r\n * @docs-group-description ViewStateHydrater\r\n * Class responsible for loading ViewStates.\r\n */\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcBriefcaseUtility.d.ts","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"RpcBriefcaseUtility.d.ts","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAA0D,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EACL,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,cAAc,EAAiB,WAAW,EAAsB,QAAQ,EACpI,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAe,QAAQ,EAAc,MAAM,aAAa,CAAC;AAMhE,gBAAgB;AAChB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC,EAAE,CAAC;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AACD;;;GAGG;AACH,qBAAa,mBAAmB;mBAET,eAAe;IA2DpC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAmC;mBAC9C,aAAa;IAYlC;;;;OAIG;WACiB,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc;IAQnF;;;OAGG;WACiB,IAAI,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;WA+DlD,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAE,MAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAIvK"}
|
|
@@ -18,7 +18,7 @@ const IModelHost_1 = require("../IModelHost");
|
|
|
18
18
|
const IModelJsFs_1 = require("../IModelJsFs");
|
|
19
19
|
const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelDb;
|
|
20
20
|
/**
|
|
21
|
-
* Utility to open the iModel for
|
|
21
|
+
* Utility to open the iModel for RPC interfaces
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
24
|
class RpcBriefcaseUtility {
|
|
@@ -26,8 +26,7 @@ class RpcBriefcaseUtility {
|
|
|
26
26
|
var _a, _b, _c, _d;
|
|
27
27
|
const { activity, tokenProps } = args;
|
|
28
28
|
const accessToken = activity.accessToken;
|
|
29
|
-
|
|
30
|
-
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "iModelId is undefined.");
|
|
29
|
+
(0, core_bentley_1.assert)(undefined !== tokenProps.iModelId);
|
|
31
30
|
const iModelId = tokenProps.iModelId;
|
|
32
31
|
let myBriefcaseIds;
|
|
33
32
|
if (args.syncMode === core_common_1.SyncMode.PullOnly) {
|
|
@@ -76,7 +75,7 @@ class RpcBriefcaseUtility {
|
|
|
76
75
|
briefcaseId: args.syncMode === core_common_1.SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.
|
|
77
76
|
};
|
|
78
77
|
const props = await BriefcaseManager_1.BriefcaseManager.downloadBriefcase(request);
|
|
79
|
-
return IModelDb_1.BriefcaseDb.open(
|
|
78
|
+
return IModelDb_1.BriefcaseDb.open(props);
|
|
80
79
|
}
|
|
81
80
|
static async openBriefcase(args) {
|
|
82
81
|
if (this._briefcasePromise)
|
|
@@ -96,8 +95,8 @@ class RpcBriefcaseUtility {
|
|
|
96
95
|
*/
|
|
97
96
|
static async findOpenIModel(accessToken, iModel) {
|
|
98
97
|
const iModelDb = IModelDb_1.IModelDb.findByKey(iModel.key);
|
|
99
|
-
// call
|
|
100
|
-
await iModelDb.
|
|
98
|
+
// call refreshContainerSas, just in case this is a V2 checkpoint whose sasToken is about to expire.
|
|
99
|
+
await iModelDb.refreshContainerSas(accessToken);
|
|
101
100
|
return iModelDb;
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
@@ -118,12 +117,9 @@ class RpcBriefcaseUtility {
|
|
|
118
117
|
// note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen
|
|
119
118
|
return briefcaseDb;
|
|
120
119
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "iTwinId is undefined.");
|
|
125
|
-
if (undefined === tokenProps.changeset)
|
|
126
|
-
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Changeset is undefined.");
|
|
120
|
+
(0, core_bentley_1.assert)(undefined !== tokenProps.iModelId);
|
|
121
|
+
(0, core_bentley_1.assert)(undefined !== tokenProps.iTwinId);
|
|
122
|
+
(0, core_bentley_1.assert)(undefined !== tokenProps.changeset);
|
|
127
123
|
const checkpoint = {
|
|
128
124
|
iModelId: tokenProps.iModelId,
|
|
129
125
|
iTwinId: tokenProps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AAG,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;gBAC3F,MAAM,IAAI,gCAAkB,EAAE,CAAC;aAChC;YACD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;SACpF;QAED,mCAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;CAEF;AAlKD,kDAkKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { AccessToken, assert, BeDuration, BentleyError, BentleyStatus, IModelStatus, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\r\nimport { CheckpointManager, CheckpointProps, V1CheckpointManager } from \"../CheckpointManager\";\r\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { IModelJsFs } from \"../IModelJsFs\";\r\n\r\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\r\n\r\n/** @internal */\r\nexport interface DownloadAndOpenArgs {\r\n activity: RpcActivity;\r\n tokenProps: IModelRpcOpenProps;\r\n syncMode: SyncMode;\r\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\r\n timeout?: number;\r\n forceDownload?: boolean;\r\n}\r\n/**\r\n * Utility to open the iModel for Read/Write RPC interfaces\r\n * @internal\r\n */\r\nexport class RpcBriefcaseUtility {\r\n\r\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\r\n const { activity, tokenProps } = args;\r\n const accessToken = activity.accessToken;\r\n if (undefined === tokenProps.iModelId)\r\n throw new IModelError(BentleyStatus.ERROR, \"iModelId is undefined.\");\r\n\r\n const iModelId = tokenProps.iModelId;\r\n let myBriefcaseIds: number[];\r\n if (args.syncMode === SyncMode.PullOnly) {\r\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\r\n } else {\r\n // check with iModelHub and see if we already have acquired any briefcaseIds\r\n myBriefcaseIds = await IModelHost.hubAccess.getMyBriefcaseIds({ accessToken, iModelId });\r\n }\r\n\r\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\r\n\r\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\r\n if (resolvers) {\r\n for (const resolver of resolvers) {\r\n for (const briefcaseId of myBriefcaseIds) {\r\n const fileName = resolver({ briefcaseId, iModelId });\r\n if (IModelJsFs.existsSync(fileName)) {\r\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\r\n if (briefcaseDb !== undefined)\r\n return briefcaseDb as BriefcaseDb;\r\n try {\r\n if (args.forceDownload)\r\n throw new Error(); // causes delete below\r\n const db = await BriefcaseDb.open({ fileName });\r\n if (db.changeset.id !== tokenProps.changeset?.id) {\r\n assert(undefined !== tokenProps.changeset);\r\n const toIndex = tokenProps.changeset?.index ??\r\n (await IModelHost.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\r\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\r\n }\r\n return db;\r\n } catch (error: any) {\r\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\r\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\r\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // no local briefcase available. Download one and open it.\r\n assert(undefined !== tokenProps.iTwinId);\r\n const request: RequestNewBriefcaseArg = {\r\n accessToken,\r\n iTwinId: tokenProps.iTwinId,\r\n iModelId,\r\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\r\n };\r\n\r\n const props = await BriefcaseManager.downloadBriefcase(request);\r\n return BriefcaseDb.open({ rpcActivity: activity, fileName: props.fileName });\r\n }\r\n\r\n private static _briefcasePromise: Promise<BriefcaseDb> | undefined;\r\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\r\n if (this._briefcasePromise)\r\n return this._briefcasePromise;\r\n\r\n try {\r\n this._briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\r\n return await this._briefcasePromise;\r\n } finally {\r\n this._briefcasePromise = undefined; // the download and open is now done\r\n }\r\n }\r\n\r\n /** find a previously opened iModel for RPC.\r\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\r\n * to refresh the daemon, even though it will be used for all authorized users.\r\n * @param the IModelRpcProps to locate the opened iModel.\r\n */\r\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\r\n const iModelDb = IModelDb.findByKey(iModel.key);\r\n\r\n // call reattach, just in case this is a V2 checkpoint whose accessToken is about to expire.\r\n await iModelDb.reattachDaemon(accessToken);\r\n return iModelDb;\r\n }\r\n\r\n /**\r\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\r\n * a RpcPendingResponse exception is thrown\r\n */\r\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\r\n const { activity, tokenProps, syncMode } = args;\r\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", () => ({ ...tokenProps }));\r\n\r\n const timeout = args.timeout ?? 1000;\r\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\r\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\r\n\r\n if (briefcaseDb === undefined) {\r\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", () => ({ ...tokenProps }));\r\n throw new RpcPendingResponse();\r\n }\r\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\r\n return briefcaseDb;\r\n }\r\n\r\n if (undefined === tokenProps.iModelId)\r\n throw new IModelError(BentleyStatus.ERROR, \"iModelId is undefined.\");\r\n if (undefined === tokenProps.iTwinId)\r\n throw new IModelError(BentleyStatus.ERROR, \"iTwinId is undefined.\");\r\n if (undefined === tokenProps.changeset)\r\n throw new IModelError(BentleyStatus.ERROR, \"Changeset is undefined.\");\r\n\r\n const checkpoint: CheckpointProps = {\r\n iModelId: tokenProps.iModelId,\r\n iTwinId: tokenProps.iTwinId,\r\n changeset: tokenProps.changeset,\r\n accessToken: activity.accessToken,\r\n };\r\n\r\n // opening a checkpoint, readonly.\r\n let db: SnapshotDb | void;\r\n // first check if it's already open\r\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\r\n if (db) {\r\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", () => ({ ...tokenProps }));\r\n BriefcaseManager.logUsage(db);\r\n return db;\r\n }\r\n\r\n try {\r\n // now try V2 checkpoint\r\n db = await SnapshotDb.openCheckpointV2(checkpoint);\r\n Logger.logTrace(loggerCategory, \"using V2 checkpoint briefcase\", () => ({ ...tokenProps }));\r\n } catch (e) {\r\n Logger.logTrace(loggerCategory, \"unable to open V2 checkpoint - falling back to V1 checkpoint\", () => ({ error: BentleyError.getErrorProps(e), ...tokenProps }));\r\n\r\n // this isn't a v2 checkpoint. Set up a race between the specified timeout period and the open. Throw an RpcPendingResponse exception if the timeout happens first.\r\n const request = {\r\n checkpoint,\r\n localFile: V1CheckpointManager.getFileName(checkpoint),\r\n aliasFiles: [],\r\n };\r\n db = await BeDuration.race(timeout, V1CheckpointManager.getCheckpointDb(request));\r\n\r\n if (db === undefined) {\r\n Logger.logTrace(loggerCategory, \"Open V1 checkpoint - pending\", () => ({ ...tokenProps }));\r\n throw new RpcPendingResponse();\r\n }\r\n Logger.logTrace(loggerCategory, \"Opened V1 checkpoint\", () => ({ ...tokenProps }));\r\n }\r\n\r\n BriefcaseManager.logUsage(db, activity);\r\n return db;\r\n }\r\n\r\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\r\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0G;AAC1G,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAA+F;AAC/F,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAE3C,MAAM,cAAc,GAAW,6CAAqB,CAAC,QAAQ,CAAC;AAW9D;;;GAGG;AACH,MAAa,mBAAmB;IAEtB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAyB;;QAC5D,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACzC,IAAA,qBAAM,EA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AC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;YAEjK,mKAAmK;YACnK,MAAM,OAAO,GAAG;gBACd,UAAU;gBACV,SAAS,EAAE,uCAAmB,CAAC,WAAW,CAAC,UAAU,CAAC;gBACtD,UAAU,EAAE,EAAE;aACf,CAAC;YACF,EAAE,GAAG,MAAM,yBAAU,CAAC,IAAI,CAAC,OAAO,EAAE,uCAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;YAElF,IAAI,EAAE,KAAK,SAAS,EAAE;gBACpB,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,8BAA8B,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;gBAC3F,MAAM,IAAI,gCAAkB,EAAE,CAAC;aAChC;YACD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;SACpF;QAED,mCAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;CAEF;AA9JD,kDA8JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { AccessToken, assert, BeDuration, BentleyError, IModelStatus, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseProps, IModelConnectionProps, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\r\nimport { CheckpointManager, CheckpointProps, V1CheckpointManager } from \"../CheckpointManager\";\r\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { IModelJsFs } from \"../IModelJsFs\";\r\n\r\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\r\n\r\n/** @internal */\r\nexport interface DownloadAndOpenArgs {\r\n activity: RpcActivity;\r\n tokenProps: IModelRpcOpenProps;\r\n syncMode: SyncMode;\r\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\r\n timeout?: number;\r\n forceDownload?: boolean;\r\n}\r\n/**\r\n * Utility to open the iModel for RPC interfaces\r\n * @internal\r\n */\r\nexport class RpcBriefcaseUtility {\r\n\r\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\r\n const { activity, tokenProps } = args;\r\n const accessToken = activity.accessToken;\r\n assert(undefined !== tokenProps.iModelId);\r\n\r\n const iModelId = tokenProps.iModelId;\r\n let myBriefcaseIds: number[];\r\n if (args.syncMode === SyncMode.PullOnly) {\r\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\r\n } else {\r\n // check with iModelHub and see if we already have acquired any briefcaseIds\r\n myBriefcaseIds = await IModelHost.hubAccess.getMyBriefcaseIds({ accessToken, iModelId });\r\n }\r\n\r\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\r\n\r\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\r\n if (resolvers) {\r\n for (const resolver of resolvers) {\r\n for (const briefcaseId of myBriefcaseIds) {\r\n const fileName = resolver({ briefcaseId, iModelId });\r\n if (IModelJsFs.existsSync(fileName)) {\r\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\r\n if (briefcaseDb !== undefined)\r\n return briefcaseDb as BriefcaseDb;\r\n try {\r\n if (args.forceDownload)\r\n throw new Error(); // causes delete below\r\n const db = await BriefcaseDb.open({ fileName });\r\n if (db.changeset.id !== tokenProps.changeset?.id) {\r\n assert(undefined !== tokenProps.changeset);\r\n const toIndex = tokenProps.changeset?.index ??\r\n (await IModelHost.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\r\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\r\n }\r\n return db;\r\n } catch (error: any) {\r\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\r\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\r\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // no local briefcase available. Download one and open it.\r\n assert(undefined !== tokenProps.iTwinId);\r\n const request: RequestNewBriefcaseArg = {\r\n accessToken,\r\n iTwinId: tokenProps.iTwinId,\r\n iModelId,\r\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\r\n };\r\n\r\n const props = await BriefcaseManager.downloadBriefcase(request);\r\n return BriefcaseDb.open(props);\r\n }\r\n\r\n private static _briefcasePromise: Promise<BriefcaseDb> | undefined;\r\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\r\n if (this._briefcasePromise)\r\n return this._briefcasePromise;\r\n\r\n try {\r\n this._briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\r\n return await this._briefcasePromise;\r\n } finally {\r\n this._briefcasePromise = undefined; // the download and open is now done\r\n }\r\n }\r\n\r\n /** find a previously opened iModel for RPC.\r\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\r\n * to refresh the daemon, even though it will be used for all authorized users.\r\n * @param the IModelRpcProps to locate the opened iModel.\r\n */\r\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\r\n const iModelDb = IModelDb.findByKey(iModel.key);\r\n\r\n // call refreshContainerSas, just in case this is a V2 checkpoint whose sasToken is about to expire.\r\n await iModelDb.refreshContainerSas(accessToken);\r\n return iModelDb;\r\n }\r\n\r\n /**\r\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\r\n * a RpcPendingResponse exception is thrown\r\n */\r\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\r\n const { activity, tokenProps, syncMode } = args;\r\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", () => ({ ...tokenProps }));\r\n\r\n const timeout = args.timeout ?? 1000;\r\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\r\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\r\n\r\n if (briefcaseDb === undefined) {\r\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", () => ({ ...tokenProps }));\r\n throw new RpcPendingResponse();\r\n }\r\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\r\n return briefcaseDb;\r\n }\r\n\r\n assert(undefined !== tokenProps.iModelId);\r\n assert(undefined !== tokenProps.iTwinId);\r\n assert(undefined !== tokenProps.changeset);\r\n\r\n const checkpoint: CheckpointProps = {\r\n iModelId: tokenProps.iModelId,\r\n iTwinId: tokenProps.iTwinId,\r\n changeset: tokenProps.changeset,\r\n accessToken: activity.accessToken,\r\n };\r\n\r\n // opening a checkpoint, readonly.\r\n let db: SnapshotDb | void;\r\n // first check if it's already open\r\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\r\n if (db) {\r\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", () => ({ ...tokenProps }));\r\n BriefcaseManager.logUsage(db);\r\n return db;\r\n }\r\n\r\n try {\r\n // now try V2 checkpoint\r\n db = await SnapshotDb.openCheckpointV2(checkpoint);\r\n Logger.logTrace(loggerCategory, \"using V2 checkpoint briefcase\", () => ({ ...tokenProps }));\r\n } catch (e) {\r\n Logger.logTrace(loggerCategory, \"unable to open V2 checkpoint - falling back to V1 checkpoint\", () => ({ error: BentleyError.getErrorProps(e), ...tokenProps }));\r\n\r\n // this isn't a v2 checkpoint. Set up a race between the specified timeout period and the open. Throw an RpcPendingResponse exception if the timeout happens first.\r\n const request = {\r\n checkpoint,\r\n localFile: V1CheckpointManager.getFileName(checkpoint),\r\n aliasFiles: [],\r\n };\r\n db = await BeDuration.race(timeout, V1CheckpointManager.getCheckpointDb(request));\r\n\r\n if (db === undefined) {\r\n Logger.logTrace(loggerCategory, \"Open V1 checkpoint - pending\", () => ({ ...tokenProps }));\r\n throw new RpcPendingResponse();\r\n }\r\n Logger.logTrace(loggerCategory, \"Opened V1 checkpoint\", () => ({ ...tokenProps }));\r\n }\r\n\r\n BriefcaseManager.logUsage(db, activity);\r\n return db;\r\n }\r\n\r\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\r\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @module Workspace
|
|
3
3
|
*/
|
|
4
4
|
import { BeEvent, JSONSchemaType } from "@itwin/core-bentley";
|
|
5
|
-
import { LocalFileName } from "@itwin/core-common";
|
|
5
|
+
import { LocalDirName, LocalFileName } from "@itwin/core-common";
|
|
6
6
|
/** The type of a Setting, according to its schema
|
|
7
7
|
* @beta
|
|
8
8
|
*/
|
|
9
9
|
export declare type SettingType = JSONSchemaType;
|
|
10
10
|
/**
|
|
11
|
-
* The name of a Setting. SettingNames must be valid JavaScript property names, defined in a [[
|
|
11
|
+
* The name of a Setting. SettingNames must be valid JavaScript property names, defined in a [[SettingSchema]].
|
|
12
12
|
* @see [SettingName]($docs/learning/backend/Workspace#settingnames)
|
|
13
13
|
* @beta
|
|
14
14
|
*/
|
|
@@ -80,6 +80,10 @@ export interface Settings {
|
|
|
80
80
|
* @note If the SettingDictionary was previously added, the new content overrides the old content.
|
|
81
81
|
*/
|
|
82
82
|
addFile(fileName: LocalFileName, priority: SettingsPriority): void;
|
|
83
|
+
/** Add all files in the supplied directory with the extension ".json" or ".json5"
|
|
84
|
+
* @param dirName the name of a local settings directory
|
|
85
|
+
*/
|
|
86
|
+
addDirectory(dirName: LocalDirName, priority: SettingsPriority): void;
|
|
83
87
|
/** Add a SettingDictionary from a JSON5 stringified string. The string is parsed and the resultant object is added as a SettingDictionary.
|
|
84
88
|
* @param dictionaryName the name of the SettingDictionary
|
|
85
89
|
* @param priority the SettingsPriority for the SettingDictionary
|
|
@@ -103,8 +107,8 @@ export interface Settings {
|
|
|
103
107
|
* @param defaultValue value returned if settingName is not present in any SettingDictionary or resolver never returned a value.
|
|
104
108
|
* @returns the resolved setting value.
|
|
105
109
|
*/
|
|
106
|
-
resolveSetting<T extends SettingType>(settingName: SettingName, resolver: SettingResolver<T>, defaultValue?: T): T | undefined;
|
|
107
110
|
resolveSetting<T extends SettingType>(settingName: SettingName, resolver: SettingResolver<T>, defaultValue: T): T;
|
|
111
|
+
resolveSetting<T extends SettingType>(settingName: SettingName, resolver: SettingResolver<T>, defaultValue?: T): T | undefined;
|
|
108
112
|
/** Get the highest priority setting for a SettingName.
|
|
109
113
|
* @param settingName The name of the setting
|
|
110
114
|
* @param defaultValue value returned if settingName is not present in any SettingDictionary.
|
|
@@ -159,6 +163,7 @@ export declare class BaseSettings implements Settings {
|
|
|
159
163
|
close(): void;
|
|
160
164
|
readonly onSettingsChanged: BeEvent<() => void>;
|
|
161
165
|
addFile(fileName: LocalFileName, priority: SettingsPriority): void;
|
|
166
|
+
addDirectory(dirName: LocalDirName, priority: SettingsPriority): void;
|
|
162
167
|
addJson(dictionaryName: string, priority: SettingsPriority, settingsJson: string): void;
|
|
163
168
|
addDictionary(dictionaryName: string, priority: SettingsPriority, settings: SettingDictionary): void;
|
|
164
169
|
dropDictionary(dictionaryName: DictionaryName, raiseEvent?: boolean): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../src/workspace/Settings.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../src/workspace/Settings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,oBAAY,WAAW,GAAG,cAAc,CAAC;AAEzC;;;;GAIG;AACH,oBAAY,WAAW,GAAG,MAAM,CAAC;AAEjC;;;GAGG;AACH,oBAAY,cAAc,GAAG,MAAM,CAAC;AAEpC;;;;;;;;GAQG;AACH,oBAAY,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,KAAK,CAAC,GAAG,SAAS,CAAC;AAE7G;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAAI,KAAK,EAAE,CAAC,CAAC;IAAC,UAAU,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAE/F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,oBAAY,iBAAiB,GAAG,aAAa,CAAC;AAE9C;;;EAGE;AACF,oBAAY,gBAAgB;IAC1B,6CAA6C;IAC7C,Q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AAG,MAAM;IAC1D,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS;IAKhD,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC;IAClE,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,CAAC,GAAG,SAAS;IAK7D,QAAQ,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IACpF,QAAQ,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS;CAKhF"}
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.BaseSettings = exports.SettingsPriority = void 0;
|
|
11
11
|
const fs = require("fs-extra");
|
|
12
12
|
const json5_1 = require("json5");
|
|
13
|
+
const path_1 = require("path");
|
|
13
14
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
15
|
+
const IModelJsFs_1 = require("../IModelJsFs");
|
|
14
16
|
/**
|
|
15
17
|
* Values for SettingsPriority determine the sort order for Settings. Higher values take precedence over lower values.
|
|
16
18
|
* @beta
|
|
@@ -68,6 +70,13 @@ class BaseSettings {
|
|
|
68
70
|
addFile(fileName, priority) {
|
|
69
71
|
this.addJson(fileName, priority, fs.readFileSync(fileName, "utf-8"));
|
|
70
72
|
}
|
|
73
|
+
addDirectory(dirName, priority) {
|
|
74
|
+
for (const fileName of IModelJsFs_1.IModelJsFs.readdirSync(dirName)) {
|
|
75
|
+
const ext = (0, path_1.extname)(fileName);
|
|
76
|
+
if (ext === ".json5" || ext === ".json")
|
|
77
|
+
this.addFile((0, path_1.join)(dirName, fileName), priority);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
71
80
|
addJson(dictionaryName, priority, settingsJson) {
|
|
72
81
|
this.addDictionary(dictionaryName, priority, (0, json5_1.parse)(settingsJson));
|
|
73
82
|
}
|