@itwin/workspace-editor 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/README.md +466 -69
- package/lib/WorkspaceEditor.js +483 -142
- package/package.json +14 -13
- package/.rush/temp/package-deps_build +0 -0
- package/.rush/temp/package-deps_cover.json +0 -13
- package/.rush/temp/package-deps_docs.json +0 -13
- package/.rush/temp/package-deps_lint.json +0 -13
- package/.rush/temp/package-deps_webpack +0 -0
- package/.rush/temp/shrinkwrap-deps.json +0 -173
- package/CHANGELOG.json +0 -77
- package/CHANGELOG.md +0 -61
- package/lib/WorkspaceEditor.d.ts +0 -2
- package/lib/WorkspaceEditor.d.ts.map +0 -1
- package/lib/WorkspaceEditor.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/src/WorkspaceEditor.ts +0 -366
- package/tsconfig.json +0 -7
- package/workspace-editor.build.log +0 -0
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# WorkspaceEditor
|
|
2
2
|
|
|
3
|
-
**WorkspaceEditor** is a command line utility for creating and editing `WorkspaceResources` in iTwin `WorkspaceDb`s, and for uploading and
|
|
3
|
+
**WorkspaceEditor** is a command line utility for creating and editing `WorkspaceResources` in iTwin `WorkspaceDb`s, and for uploading, downloading, and editing `WorkspaceDb`s in cloud `WorkspaceContainer`s.
|
|
4
4
|
|
|
5
|
-
An iTwin `WorkspaceDb` may hold many `WorkSpaceResources`, each with a `
|
|
5
|
+
An iTwin `WorkspaceDb` may hold many `WorkSpaceResources`, each with a `WorkspaceResource.Name` and type. `WorkspaceEditor` adds, updates, deletes, and extracts *local files* into/from a `WorkspaceDb`.
|
|
6
6
|
|
|
7
7
|
## Workspace Resource Types
|
|
8
8
|
|
|
9
|
-
There are 3 `WorkspaceResourceType`s that may be accessed by `@itwin-backend` applications at runtime via the `
|
|
9
|
+
There are 3 `WorkspaceResourceType`s that may be accessed by `@itwin-backend` applications at runtime via the `WorkspaceDb` api:
|
|
10
10
|
|
|
11
11
|
1. `string` accessed via the `getString` method
|
|
12
12
|
2. `blob` binary data accessed via the `getBlob` method
|
|
@@ -16,11 +16,15 @@ Several `WorkspaceEditor` commands require a `--type` argument to specify which
|
|
|
16
16
|
|
|
17
17
|
## The WorkspaceContainer Directory
|
|
18
18
|
|
|
19
|
-
`WorkspaceDb`s
|
|
19
|
+
`WorkspaceDb`s may be either local files or from cloud `WorkspaceContainers`. When creating new `WorkspaceDb`s, it is sometimes useful to just work with a local file until all resources have been imported, before uploading the WorkspaceDb to the cloud container.
|
|
20
|
+
|
|
21
|
+
`WorkspaceDb`s are located by iTwin.js inside a `WorkspaceContainer` subdirectory within the `WorkspaceContainerDir` directory. `WorkspaceContainerDir` is specified as a directory name in the `workspace.containerDir` member on the `configuration` argument of `IModelHost.startup`. The default value is `%localappdata%/iTwin/Workspace`.
|
|
22
|
+
|
|
23
|
+
WorkspaceEditor will normally create and edit `WorkspaceDb`s in the default directory, but if you wish to use a different directory, supply the `--directory` option to specify a different `WorkspaceContainerDir` location.
|
|
20
24
|
|
|
21
25
|
## Workspace dbName
|
|
22
26
|
|
|
23
|
-
The WorkspaceEditor commands all take a `dbName` option to specify the `WorkspaceDb` on which to operate. The WorkspaceDb is located inside the `
|
|
27
|
+
The WorkspaceEditor commands all take a `dbName` option to specify the `WorkspaceDb` on which to operate. The WorkspaceDb is located inside the `WorkspaceContainer` specified with the --containerId argument. `WorkspaceDbName`s must be less than 255 characters, may not have leading or trailing whitespace, and may not use any reserved path specification characters (see documentation for `WorkspaceDbName` for details.) The `WorkspaceDb` filename is formed via: `${WorkspaceContainerDir}/${WorkspaceContainerId}/${WorkspaceDbName}.itwin-workspace`.
|
|
24
28
|
|
|
25
29
|
## WorkspaceEditor Config file
|
|
26
30
|
|
|
@@ -29,76 +33,174 @@ The WorkspaceEditor commands all take a `dbName` option to specify the `Workspac
|
|
|
29
33
|
Example:
|
|
30
34
|
|
|
31
35
|
```sh
|
|
32
|
-
>
|
|
36
|
+
> WorkspaceEditor --config myConfig.json listDb db1
|
|
33
37
|
...
|
|
34
38
|
```
|
|
35
39
|
|
|
36
40
|
```json
|
|
37
|
-
|
|
41
|
+
myConfig.json:
|
|
42
|
+
|
|
38
43
|
{
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
44
|
+
"containerId": "5d385232-a2ec-4f31-b74b-8201c027848d",
|
|
45
|
+
"accessName": "smsblob1",
|
|
46
|
+
"storageType": "azure?sas=1",
|
|
47
|
+
"user": "workspace editor example",
|
|
48
|
+
"accessToken": "<valid token here>"
|
|
43
49
|
}
|
|
44
50
|
```
|
|
45
51
|
|
|
46
|
-
>
|
|
52
|
+
> config files *must* have a `.json` extension.
|
|
53
|
+
|
|
54
|
+
## WORKSPACE_EDITOR_xxx Environment Variables
|
|
55
|
+
|
|
56
|
+
Any command line option may also be specified by setting a shell environment variable with the option's name after the prefix `WORKSPACE_EDITOR_`.
|
|
57
|
+
|
|
58
|
+
For example, config files may also be specified by setting the environment variable `WORKSPACE_EDITOR_CONFIG`.
|
|
59
|
+
|
|
60
|
+
```cmd
|
|
61
|
+
set WORKSPACE_EDITOR_CONFIG=d:\projData\config.json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
To specify camelCase options, separate the words with an underbar, e.g.:
|
|
65
|
+
|
|
66
|
+
```cmd
|
|
67
|
+
set WORKSPACE_EDITOR_ACCESS_TOKEN=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> `WORKSPACE_EDITOR_` environment variable names are *case sensitive* and must be ALL CAPS
|
|
47
71
|
|
|
48
72
|
## WorkspaceEditor Commands
|
|
49
73
|
|
|
50
74
|
The following WorkspaceEditor commands are available:
|
|
51
75
|
|
|
52
|
-
|
|
76
|
+
```sh
|
|
77
|
+
> WorkspaceEditor
|
|
78
|
+
|
|
79
|
+
Edits or lists contents of a WorkspaceDb
|
|
80
|
+
|
|
81
|
+
Commands:
|
|
82
|
+
WorkspaceEditor add <dbName> <files> add files into a WorkspaceDb
|
|
83
|
+
WorkspaceEditor replace <dbName> <files> replace files in a WorkspaceDb
|
|
84
|
+
WorkspaceEditor remove <dbName> <rscName> remove a resource from a WorkspaceDb
|
|
85
|
+
WorkspaceEditor extract <dbName> <rscName> <fileName> extract a resource from a WorkspaceDb into a local file
|
|
86
|
+
WorkspaceEditor listDb <dbName> list the contents of a WorkspaceDb
|
|
87
|
+
WorkspaceEditor deleteDb <dbName> delete a WorkspaceDb from a cloud container
|
|
88
|
+
WorkspaceEditor createDb <dbName> create a new WorkspaceDb
|
|
89
|
+
WorkspaceEditor copyDb <dbName> <newDbName> make a copy of a WorkspaceDb in a cloud container with a new name
|
|
90
|
+
WorkspaceEditor versionDb <dbName> make a new version of a WorkspaceDb
|
|
91
|
+
WorkspaceEditor vacuumDb <dbName> vacuum a WorkspaceDb
|
|
92
|
+
WorkspaceEditor importDb <dbName> <localFileName> import a WorkspaceDb into a cloud container
|
|
93
|
+
WorkspaceEditor exportDb <dbName> <localFileName> export a WorkspaceDb from a cloud container to a local file
|
|
94
|
+
WorkspaceEditor queryDbs [like] query the list of WorkspaceDbs in a cloud container
|
|
95
|
+
WorkspaceEditor acquireLock acquire the write lock for a cloud container
|
|
96
|
+
WorkspaceEditor releaseLock release the write lock for a cloud container
|
|
97
|
+
WorkspaceEditor clearWriteLock clear the write lock for a cloud container. Note: this can be dangerous!
|
|
98
|
+
WorkspaceEditor purgeWorkspace purge deleted blocks from a WorkspaceContainer
|
|
99
|
+
WorkspaceEditor initializeWorkspace initialize a WorkspaceContainer (empties if already initialized)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Commands that operate on WorkspaceDbs
|
|
103
|
+
|
|
104
|
+
All of the examples in this section use `local.json` for config:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
set WORKSPACE_EDITOR_CONFIG=r:\local.json
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
r:\local.json:
|
|
112
|
+
{
|
|
113
|
+
"directory": "r:/workspaces",
|
|
114
|
+
"containerId": "proj112"
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The name of the `WorkspaceDb` is supplied with the `dbName` argument. For cloud-based `WorkspaceContainers`, `dbName` may either include the version number (e.g. `pipe-spec:1.3.2`) or, if no version is supplied, the highest version is used.
|
|
119
|
+
|
|
120
|
+
### createDb \<dbName>
|
|
53
121
|
|
|
54
122
|
Create a new empty `WorkspaceDb`.
|
|
55
123
|
|
|
56
124
|
Example:
|
|
57
125
|
|
|
58
126
|
```sh
|
|
59
|
-
>
|
|
60
|
-
created WorkspaceDb
|
|
127
|
+
> WorkspaceEditor createDb proj
|
|
128
|
+
created WorkspaceDb r:\workspaces\proj112\proj.itwin-workspace
|
|
61
129
|
```
|
|
62
130
|
|
|
63
|
-
###
|
|
131
|
+
### add \<dbName> \<files>
|
|
64
132
|
|
|
65
133
|
Add one or more local files as resources into a `WorkspaceDb`.
|
|
66
134
|
|
|
67
|
-
`--
|
|
68
|
-
`--name` specifies the name of the resource. Defaults to the name of the local file.
|
|
135
|
+
`--rscName` specifies the name of the resource. Defaults to the name of the local file.
|
|
69
136
|
`--root` specifies a root directory when adding multiple files. The parts of the path after the root are saved in the resource name (see example below.)
|
|
70
|
-
`--
|
|
137
|
+
`--type` specifies the type of resource(s) to add. Required
|
|
71
138
|
|
|
72
|
-
> Note: `--
|
|
139
|
+
> Note: `--rscName` is only applicable when adding a single file.
|
|
73
140
|
|
|
74
141
|
Examples:
|
|
75
142
|
|
|
76
143
|
```sh
|
|
77
|
-
> WorkspaceEditor add proj
|
|
78
|
-
WorkspaceDb [
|
|
79
|
-
added "
|
|
144
|
+
> WorkspaceEditor add proj --rscName=equipment-data --type=file r:\data\equip.dat
|
|
145
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
146
|
+
added "r:/data/equip.dat" as file resource [equipment-data]
|
|
147
|
+
|
|
148
|
+
> WorkspaceEditor add proj --type=string --root=r:\json *
|
|
149
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
150
|
+
added "r:\json\contracts.json" as string resource [contracts.json]
|
|
151
|
+
added "r:\json\firecode.json" as string resource [firecode.json]
|
|
152
|
+
added "r:\json\specs.json" as string resource [specs.json]
|
|
153
|
+
added "r:\json\vendor.json" as string resource [vendor.json]
|
|
154
|
+
|
|
155
|
+
> WorkspaceEditor add proj --type=blob --root=r:\dict **\*.dict
|
|
156
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
157
|
+
added "r:\dict\Sparks\KDE05814.dict" as blob resource [Sparks/KDE05814.dict]
|
|
158
|
+
added "r:\dict\Sparks\KDE05815.dict" as blob resource [Sparks/KDE05815.dict]
|
|
159
|
+
added "r:\dict\Sparks\KDE05816.dict" as blob resource [Sparks/KDE05816.dict]
|
|
160
|
+
added "r:\dict\Sparks\KDE05922.dict" as blob resource [Sparks/KDE05922.dict]
|
|
161
|
+
added "r:\dict\Sparks\KDE05929.dict" as blob resource [Sparks/KDE05929.dict]
|
|
162
|
+
added "r:\dict\TernKit\TRN02324.dict" as blob resource [TernKit/TRN02324.dict]
|
|
163
|
+
added "r:\dict\TernKit\TRN05314.dict" as blob resource [TernKit/TRN05314.dict]
|
|
164
|
+
added "r:\dict\TernKit\TRN05814.dict" as blob resource [TernKit/TRN05814.dict]
|
|
165
|
+
added "r:\dict\TernKit\TRN09911.dict" as blob resource [TernKit/TRN09911.dict]
|
|
166
|
+
added "r:\dict\UniSpace\KRT05554.dict" as blob resource [UniSpace/KRT05554.dict]
|
|
167
|
+
added "r:\dict\UniSpace\KRT05800.dict" as blob resource [UniSpace/KRT05800.dict]
|
|
168
|
+
added "r:\dict\UniSpace\KRT05814.dict" as blob resource [UniSpace/KRT05814.dict]
|
|
169
|
+
added "r:\dict\UniSpace\KRT05820.dict" as blob resource [UniSpace/KRT05820.dict]
|
|
170
|
+
added "r:\dict\UniSpace\KRT06519.dict" as blob resource [UniSpace/KRT06519.dict]
|
|
80
171
|
```
|
|
81
172
|
|
|
173
|
+
### replace \<dbName> \<files>
|
|
174
|
+
|
|
175
|
+
Replace an existing resource in a `WorkspaceDb` with a new version.
|
|
176
|
+
|
|
177
|
+
Takes the same arguments as `add`.
|
|
178
|
+
|
|
179
|
+
### remove \<dbName> \<rscName>
|
|
180
|
+
|
|
181
|
+
Remove an existing `WorkspaceResource` from a `WorkspaceDb`.
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
|
|
82
185
|
```sh
|
|
83
|
-
> WorkspaceEditor
|
|
84
|
-
WorkspaceDb [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
186
|
+
> WorkspaceEditor remove proj --type blob UniSpace/KRT06519.dict
|
|
187
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
188
|
+
removed blob resource [UniSpace/KRT06519.dict]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### extract \<dbName> \<rscName> \<fileName>
|
|
192
|
+
|
|
193
|
+
Extract a `WorkspaceResource` from a `WorkspaceDb` into a local file, leaving the `WorkspaceResource` unchanged in the `WorkspaceDb`.
|
|
194
|
+
|
|
195
|
+
Example:
|
|
88
196
|
|
|
89
197
|
```sh
|
|
90
|
-
|
|
91
|
-
WorkspaceDb [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
added "d:\projData\112\UniSpace\KDEO5814.dict" as blob resource [UniSpace/KDEO5814.dict]
|
|
95
|
-
added "d:\projData\112\UniSpace\KDEO5815.dict" as blob resource [UniSpace/KDEO5815.dict]
|
|
96
|
-
added "d:\projData\112\Sparks\KDEO5814.dict" as blob resource [Sparks/KDEO5814.dict]
|
|
97
|
-
added "d:\projData\112\Sparks\KDEO5815.dict" as blob resource [Sparks/KDEO5815.dict]
|
|
98
|
-
added "d:\projData\112\Sparks\KDEO5816.dict" as blob resource [Sparks/KDEO5816.dict]
|
|
99
|
-
```
|
|
198
|
+
> WorkspaceEditor extract proj -t blob UniSpace/KRT05820.dict d:\temp\kd.dict
|
|
199
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
200
|
+
blob resource [UniSpace/KRT05820.dict] extracted to "d:\temp\kd.dict"
|
|
201
|
+
```
|
|
100
202
|
|
|
101
|
-
###
|
|
203
|
+
### listDb \<dbName>
|
|
102
204
|
|
|
103
205
|
List the contents of a `WorkspaceDb`. By default it will show all 3 resource types. To limit the output to specific types, supply the `--strings`, `--blobs`, or `--files` options.
|
|
104
206
|
|
|
@@ -106,58 +208,353 @@ Examples:
|
|
|
106
208
|
|
|
107
209
|
```sh
|
|
108
210
|
> WorkspaceEditor list proj
|
|
109
|
-
WorkspaceDb [
|
|
211
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
110
212
|
strings:
|
|
111
|
-
name=
|
|
112
|
-
name=
|
|
213
|
+
name=contracts.json, size=17K
|
|
214
|
+
name=firecode.json, size=3K
|
|
215
|
+
name=specs.json, size=8K
|
|
216
|
+
name=vendor.json, size=46K
|
|
113
217
|
blobs:
|
|
114
|
-
name=
|
|
115
|
-
name=
|
|
116
|
-
name=
|
|
117
|
-
name=
|
|
118
|
-
name=
|
|
119
|
-
name=
|
|
120
|
-
name=
|
|
218
|
+
name=Sparks/KDE05814.dict, size=224K
|
|
219
|
+
name=Sparks/KDE05815.dict, size=307K
|
|
220
|
+
name=Sparks/KDE05816.dict, size=32K
|
|
221
|
+
name=Sparks/KDE05922.dict, size=56K
|
|
222
|
+
name=Sparks/KDE05929.dict, size=15K
|
|
223
|
+
name=TernKit/TRN02324.dict, size=405
|
|
224
|
+
name=TernKit/TRN05314.dict, size=67K
|
|
225
|
+
name=TernKit/TRN05814.dict, size=7K
|
|
226
|
+
name=TernKit/TRN09911.dict, size=3K
|
|
227
|
+
name=UniSpace/KRT05554.dict, size=2K
|
|
228
|
+
name=UniSpace/KRT05800.dict, size=5K
|
|
229
|
+
name=UniSpace/KRT05814.dict, size=13K
|
|
230
|
+
name=UniSpace/KRT05820.dict, size=7K
|
|
121
231
|
files:
|
|
122
|
-
name=
|
|
123
|
-
```
|
|
232
|
+
name=equipment-data, size=134K, ext="dat", date=Tue Jul 08 2021 13:55:19 GMT-0400 (Eastern Daylight Time)
|
|
124
233
|
|
|
125
|
-
```sh
|
|
126
234
|
> WorkspaceEditor list proj --strings
|
|
127
|
-
WorkspaceDb [
|
|
235
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
128
236
|
strings:
|
|
129
|
-
name=
|
|
130
|
-
name=
|
|
237
|
+
name=contracts.json, size=17K
|
|
238
|
+
name=firecode.json, size=3K
|
|
239
|
+
name=specs.json, size=8K
|
|
240
|
+
name=vendor.json, size=46K
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### vacuumDb
|
|
244
|
+
|
|
245
|
+
[Vacuum](https://www.sqlite.org/lang_vacuum.html) a `WorkspaceDb`. This can make a `WorkspaceDb` smaller and more efficient to access.
|
|
246
|
+
|
|
247
|
+
Example:
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
> WorkspaceEditor vacuumDb proj
|
|
251
|
+
Vacuuming r:\workspaces\proj112\proj.itwin-workspace ... done
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Commands that operate on Cloud WorkspaceContainers
|
|
255
|
+
|
|
256
|
+
The following `WorkspaceEditor` commands work only on cloud-based `WorkspaceContainers`.
|
|
257
|
+
|
|
258
|
+
All of the examples in this section use `cloud.json` for config:
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
set WORKSPACE_EDITOR_CONFIG=r:\cloud.json
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
r:\cloud.json:
|
|
266
|
+
{
|
|
267
|
+
"directory": "r:/workspaces",
|
|
268
|
+
"accessName": "<storage account name here>",
|
|
269
|
+
"accessToken": "<storage account key here>",
|
|
270
|
+
"storageType": "azure?sas=0",
|
|
271
|
+
"containerId": "5d385232-a2ec-4f31-b74b-8201c027848d",
|
|
272
|
+
"user": "Example editor admin"
|
|
273
|
+
}
|
|
131
274
|
```
|
|
132
275
|
|
|
133
|
-
|
|
276
|
+
When operating on cloud `WorkspaceContainer`s, WorkspaceEditor must first [obtain the write lock](#acquirelock) on the container. If successful, the lock is held on the container and all changes are only made locally (i.e. not visible to users) until [the write lock is released](#releaselock). Only a single administrator may be editing a cloud WorkspaceContainer at a time. Most WorkspaceEditor commands will fail if the write lock is not held.
|
|
277
|
+
|
|
278
|
+
The normal workflow for changing a `WorkspaceDb` in a cloud `WorkspaceContainer` involves running WorkspaceEditor multiple times to:
|
|
279
|
+
|
|
280
|
+
1. Acquire the write lock on the container using [acquireLock](#acquirelock)
|
|
281
|
+
2. Create a new version (major, minor, or patch) of the `WorkspaceDb` using [versionDb](#versiondb-dbname)
|
|
282
|
+
3. Edit the new version using one or more [add](#add-dbname-files), [replace](#replace-dbname-files), or [remove](#remove-dbname-rscname) resource commands.
|
|
283
|
+
4. Release the write lock using [releaselock](#releaselock)
|
|
134
284
|
|
|
135
|
-
|
|
285
|
+
### initializeWorkspace
|
|
286
|
+
|
|
287
|
+
Initialize or empty the contents of a cloud `WorkspaceContainer`. This command should be used after a cloud storage container is first created, or to empty an existing previously-initialized storage container.
|
|
288
|
+
|
|
289
|
+
Since this command will destroy any existing contents of the container, should be used with care. There is an `Are you sure...` prompt to avoid accidents. The `--noPrompt` option can be used from scripts.
|
|
136
290
|
|
|
137
291
|
Example:
|
|
292
|
+
|
|
138
293
|
```sh
|
|
139
|
-
> WorkspaceEditor
|
|
140
|
-
|
|
141
|
-
|
|
294
|
+
> WorkspaceEditor initializeWorkspace
|
|
295
|
+
Are you sure you want to initialize container [5d385232-a2ec-4f31-b74b-8201c027848d]"? [y/n]: y
|
|
296
|
+
container "5d385232-a2ec-4f31-b74b-8201c027848d initialized
|
|
297
|
+
|
|
298
|
+
-or-
|
|
299
|
+
|
|
300
|
+
> WorkspaceEditor initializeWorkspace --noPrompt
|
|
301
|
+
container "5d385232-a2ec-4f31-b74b-8201c027848d initialized
|
|
142
302
|
```
|
|
143
303
|
|
|
144
|
-
###
|
|
304
|
+
### acquireLock
|
|
145
305
|
|
|
146
|
-
|
|
306
|
+
Attempt to acquire the write lock for the cloud `WorkspaceContainer`. This command places the value of the `--user` argument in the lock state of cloud container, so if another user attempts to acquire the write lock before it is released, they will see an error message indicating that the lock is currently held and by whom.
|
|
147
307
|
|
|
148
308
|
Example:
|
|
309
|
+
|
|
149
310
|
```sh
|
|
150
|
-
> WorkspaceEditor
|
|
151
|
-
|
|
152
|
-
deleted blob resource [UniSpace/KDEO5815.dict]
|
|
311
|
+
> WorkspaceEditor acquireLock
|
|
312
|
+
acquired lock for container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
153
313
|
```
|
|
154
314
|
|
|
155
|
-
|
|
315
|
+
> While the write lock is held, all changes to the `WorkspaceContainer` are stored locally and cannot be seen by users until the lock is released.
|
|
156
316
|
|
|
157
|
-
|
|
317
|
+
> The write lock expires after one hour and may thereafter be acquired by others. If no other editor has acquired the lock, it may be re-acquired. However, if someone else acquires the lock, all local changes are lost and must be abandoned.
|
|
318
|
+
|
|
319
|
+
### releaseLock
|
|
320
|
+
|
|
321
|
+
Attempt to upload any local changes to the cloud `WorkspaceContainer` and, upon success, release the write lock.
|
|
322
|
+
|
|
323
|
+
Example:
|
|
324
|
+
|
|
325
|
+
```sh
|
|
326
|
+
> WorkspaceEditor releaseLock
|
|
327
|
+
released lock for container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### clearWriteLock
|
|
331
|
+
|
|
332
|
+
Clear the write lock currently held by another (failed) editor. This command "steals" the lock away from its current owner. After this command, the original holder of the write lock will fail when/if it attempts to release its lock and will lose all its changes.
|
|
333
|
+
|
|
334
|
+
> This command is not normally ever needed, and should only be used in extreme cases when it is know to be safe.
|
|
158
335
|
|
|
159
336
|
Example:
|
|
337
|
+
|
|
160
338
|
```sh
|
|
161
|
-
> WorkspaceEditor
|
|
162
|
-
|
|
339
|
+
> WorkspaceEditor clearWriteLock
|
|
340
|
+
write lock cleared for container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
163
341
|
```
|
|
342
|
+
|
|
343
|
+
### importDb \<dbName> \<localFileName>
|
|
344
|
+
|
|
345
|
+
Import a locally-created `WorkspaceDb` file into a cloud container. The first argument determines the name of the WorkspaceDb within the cloud container. If you don't supply an initial version number, in the form ":major.minor.patch", it will be "1.0.0". The second argument is the name of the local file (without the ".itwin-workspace" extension), including the local container name (since local container names often differ from cloud container names).
|
|
346
|
+
|
|
347
|
+
Examples:
|
|
348
|
+
|
|
349
|
+
```sh
|
|
350
|
+
> WorkspaceEditor importDb project proj112\proj
|
|
351
|
+
Vacuuming r:\workspaces\proj112\proj.itwin-workspace ... done
|
|
352
|
+
import r:\workspaces\proj112\proj.itwin-workspace, container=5d385232-a2ec-4f31-b74b-8201c027848d, dbName=project:1.0.0 : complete, 0.044 seconds
|
|
353
|
+
|
|
354
|
+
- or -
|
|
355
|
+
|
|
356
|
+
> WorkspaceEditor importDb project:2.0.2 proj112\proj
|
|
357
|
+
Vacuuming r:\workspaces\proj112\proj.itwin-workspace ... done
|
|
358
|
+
import r:\workspaces\proj112\proj.itwin-workspace, container=5d385232-a2ec-4f31-b74b-8201c027848d, dbName=project:2.0.2 : complete, 0.044 seconds
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### versionDb \<dbName>
|
|
362
|
+
|
|
363
|
+
Create a new version of an existing WorkspaceDb so it may be edited. All of the resource editing commands will only work after the `versionDb` command and before the `releaseLock` command.
|
|
364
|
+
|
|
365
|
+
After creating a new version of a WorkspaceDb, you must release the write lock for the new version to be visible to users. After the write lock is released on a version of a `WorkspaceDb` **it becomes immutable** and may never be modified again.
|
|
366
|
+
|
|
367
|
+
`dBName` indicates the source database from which the new version is created. `dbName` may include the source version number (e.g. `pipe-spec:1.3.2`). If no version is supplied the highest version is used.
|
|
368
|
+
|
|
369
|
+
The `--versionType` option determines how the current version number is incremented (default is "patch").
|
|
370
|
+
|
|
371
|
+
For example, suppose the latest version is `pipe-spec:1.3.2`:
|
|
372
|
+
|
|
373
|
+
```sh
|
|
374
|
+
|
|
375
|
+
> WorkspaceEditor versionDb pipe-spec --versionType=major
|
|
376
|
+
created new version: [pipe-spec:2.0.0] from [pipe-spec:1.3.2] in container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
377
|
+
|
|
378
|
+
- or -
|
|
379
|
+
|
|
380
|
+
> WorkspaceEditor versionDb pipe-spec:1.3.2 --versionType=minor
|
|
381
|
+
created new version: [pipe-spec:1.4.0] from [pipe-spec:1.3.2] in container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
382
|
+
|
|
383
|
+
- or -
|
|
384
|
+
|
|
385
|
+
> WorkspaceEditor versionDb pipe-spec --versionType=patch
|
|
386
|
+
created new version: [pipe-spec:1.3.3] from [pipe-spec:1.3.2] in container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
387
|
+
|
|
388
|
+
- or -
|
|
389
|
+
|
|
390
|
+
> WorkspaceEditor versionDb pipe-spec
|
|
391
|
+
created new version: [pipe-spec:1.3.3] from [pipe-spec:1.3.2] in container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
> The examples above are not intended to illustrate sequential commands. Once you make a new version of a WorkspaceDb, you may begin editing it. But you cannot make another version until you release the write lock.
|
|
396
|
+
|
|
397
|
+
### queryDbs [glob]
|
|
398
|
+
|
|
399
|
+
Show a list of all `WorkspaceDb` in a cloud `WorkspaceContainer`.
|
|
400
|
+
|
|
401
|
+
The optional `glob` argument can be used to filter the results using the SQLite [GLOB](https://www.sqlite.org/lang_expr.html#glob) operator.
|
|
402
|
+
|
|
403
|
+
Examples:
|
|
404
|
+
|
|
405
|
+
```sh
|
|
406
|
+
> WorkspaceEditor queryDbs
|
|
407
|
+
WorkspaceDbs in container [5d385232-a2ec-4f31-b74b-8201c027848d], writeLocked, has local changes
|
|
408
|
+
"ame-ria:1.0.0", size=24M, 0M downloaded (0%)
|
|
409
|
+
"base-data:1.0.0", size=144M, 0M downloaded (0%)
|
|
410
|
+
"base-data:1.0.1", size=144M, 12M downloaded (9%)
|
|
411
|
+
"proj:1.0.0", size=4M, 4M downloaded (100%)
|
|
412
|
+
"proj:1.0.1", size=4M, 4M downloaded (100%)
|
|
413
|
+
"proj:1.1.0", size=4M, 4M downloaded (100%), editable
|
|
414
|
+
|
|
415
|
+
> WorkspaceEditor queryDbs b*
|
|
416
|
+
WorkspaceDbs in container [5d385232-a2ec-4f31-b74b-8201c027848d], writeLocked, has local changes
|
|
417
|
+
"base-data:1.0.0", size=144M, 0M downloaded (0%)
|
|
418
|
+
"base-data:1.0.1", size=144M, 12M downloaded (9%)
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
The output also shows:
|
|
422
|
+
|
|
423
|
+
- whether the write lock is held
|
|
424
|
+
- whether there are local changes to be uploaded
|
|
425
|
+
- whether there are garbage blocks that can be purged
|
|
426
|
+
- for each `WorkspaceDb`:
|
|
427
|
+
- its full name with version
|
|
428
|
+
- its total size
|
|
429
|
+
- number of bytes downloaded and percentage
|
|
430
|
+
- whether the database is editable
|
|
431
|
+
|
|
432
|
+
### exportDb \<dbName> \<localFileName>
|
|
433
|
+
|
|
434
|
+
Export a `WorkspaceDb` from a cloud `WorkspaceContainer` into a local file.
|
|
435
|
+
|
|
436
|
+
Example:
|
|
437
|
+
|
|
438
|
+
```sh
|
|
439
|
+
> WorkspaceEditor exportDb proj:1.0.1 d:\temp\proj
|
|
440
|
+
export d:\temp\proj.itwin-workspace, container=5d385232-a2ec-4f31-b74b-8201c027848d, dbName=proj:1.0.1 : complete, 0.013 seconds
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
> `dbName` must include a version number.
|
|
444
|
+
|
|
445
|
+
### deleteDb \<dbName>
|
|
446
|
+
|
|
447
|
+
Delete a `WorkspaceDb` from a cloud `WorkspaceContainer`.
|
|
448
|
+
|
|
449
|
+
Example:
|
|
450
|
+
|
|
451
|
+
```sh
|
|
452
|
+
> WorkspaceEditor deleteDb proj3dt:2.0.0
|
|
453
|
+
deleted WorkspaceDb [proj3dt:2.0.0] from container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
This command is not normally used, since older versions of `WorkspaceDb`s may be used by existing or archived projects. It should *only* be used when it can be known that the `WorkspaceDb` is no longer needed for any purpose. Otherwise, leaving old versions in the cloud has very little downside.
|
|
457
|
+
|
|
458
|
+
> `dbName` must include a version number.
|
|
459
|
+
|
|
460
|
+
### purgeWorkspace
|
|
461
|
+
|
|
462
|
+
Delete currently unused blocks from a cloud `WorkspaceContainer`. This is only necessary or useful after vacuuming databases.
|
|
463
|
+
|
|
464
|
+
## @ scripts
|
|
465
|
+
|
|
466
|
+
It is sometimes necessary to run WorkspaceEditor in *batch mode*, for example during pipeline jobs. If the first argument to WorkspaceEditor begins with an "@", the rest of the argument is a file name from which WorkspaceEditor commands are executed in sequence.
|
|
467
|
+
|
|
468
|
+
The second argument can specify the config file for the script.
|
|
469
|
+
|
|
470
|
+
> In @ scripts, anything after an **`#`** is treated as a comment and blank lines are ignored.
|
|
471
|
+
|
|
472
|
+
For example, to run the examples above:
|
|
473
|
+
|
|
474
|
+
Assume a file called `importAll.txt` contains:
|
|
475
|
+
|
|
476
|
+
```sh
|
|
477
|
+
> cat importAll.txt
|
|
478
|
+
|
|
479
|
+
# Create a new local WorkspaceDb file and import resources into it
|
|
480
|
+
|
|
481
|
+
createDb proj # create a new blank WorkspaceDb
|
|
482
|
+
add proj --rscName=equipment-data --type=file r:\data\equip.dat # add file
|
|
483
|
+
add proj --type=string --root=r:\json * # add strings
|
|
484
|
+
add proj --type=blob --root=r:\dict **\*.dict # add blob
|
|
485
|
+
listDb proj # so we can tell it worked
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
run `importAll.txt` as an @ script using `local.json` as config:
|
|
489
|
+
|
|
490
|
+
```sh
|
|
491
|
+
> WorkspaceEditor @importAll.txt --config=r:\local.json
|
|
492
|
+
created WorkspaceDb r:\workspaces\proj112\proj.itwin-workspace
|
|
493
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
494
|
+
added "r:/data/equip.dat" as file resource [equipment-data]
|
|
495
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
496
|
+
added "r:\json\contracts.json" as string resource [contracts.json]
|
|
497
|
+
added "r:\json\firecode.json" as string resource [firecode.json]
|
|
498
|
+
added "r:\json\specs.json" as string resource [specs.json]
|
|
499
|
+
added "r:\json\vendor.json" as string resource [vendor.json]
|
|
500
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
501
|
+
added "r:\dict\Sparks\KDE05814.dict" as blob resource [Sparks/KDE05814.dict]
|
|
502
|
+
added "r:\dict\Sparks\KDE05815.dict" as blob resource [Sparks/KDE05815.dict]
|
|
503
|
+
added "r:\dict\Sparks\KDE05816.dict" as blob resource [Sparks/KDE05816.dict]
|
|
504
|
+
added "r:\dict\Sparks\KDE05922.dict" as blob resource [Sparks/KDE05922.dict]
|
|
505
|
+
added "r:\dict\Sparks\KDE05929.dict" as blob resource [Sparks/KDE05929.dict]
|
|
506
|
+
added "r:\dict\TernKit\TRN02324.dict" as blob resource [TernKit/TRN02324.dict]
|
|
507
|
+
added "r:\dict\TernKit\TRN05314.dict" as blob resource [TernKit/TRN05314.dict]
|
|
508
|
+
added "r:\dict\TernKit\TRN05814.dict" as blob resource [TernKit/TRN05814.dict]
|
|
509
|
+
added "r:\dict\TernKit\TRN09911.dict" as blob resource [TernKit/TRN09911.dict]
|
|
510
|
+
added "r:\dict\UniSpace\KRT05554.dict" as blob resource [UniSpace/KRT05554.dict]
|
|
511
|
+
added "r:\dict\UniSpace\KRT05800.dict" as blob resource [UniSpace/KRT05800.dict]
|
|
512
|
+
added "r:\dict\UniSpace\KRT05814.dict" as blob resource [UniSpace/KRT05814.dict]
|
|
513
|
+
added "r:\dict\UniSpace\KRT05820.dict" as blob resource [UniSpace/KRT05820.dict]
|
|
514
|
+
added "r:\dict\UniSpace\KRT06519.dict" as blob resource [UniSpace/KRT06519.dict]
|
|
515
|
+
WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
|
|
516
|
+
strings:
|
|
517
|
+
name=contracts.json, size=17K
|
|
518
|
+
name=firecode.json, size=3K
|
|
519
|
+
name=specs.json, size=8K
|
|
520
|
+
name=vendor.json, size=46K
|
|
521
|
+
blobs:
|
|
522
|
+
name=Sparks/KDE05814.dict, size=224K
|
|
523
|
+
name=Sparks/KDE05815.dict, size=307K
|
|
524
|
+
name=Sparks/KDE05816.dict, size=32K
|
|
525
|
+
name=Sparks/KDE05922.dict, size=56K
|
|
526
|
+
name=Sparks/KDE05929.dict, size=15K
|
|
527
|
+
name=TernKit/TRN02324.dict, size=405
|
|
528
|
+
name=TernKit/TRN05314.dict, size=67K
|
|
529
|
+
name=TernKit/TRN05814.dict, size=7K
|
|
530
|
+
name=TernKit/TRN09911.dict, size=3K
|
|
531
|
+
name=UniSpace/KRT05554.dict, size=2K
|
|
532
|
+
name=UniSpace/KRT05800.dict, size=5K
|
|
533
|
+
name=UniSpace/KRT05814.dict, size=13K
|
|
534
|
+
name=UniSpace/KRT05820.dict, size=7K
|
|
535
|
+
name=UniSpace/KRT06519.dict, size=687
|
|
536
|
+
files:
|
|
537
|
+
name=equipment-data, size=134K, ext="dat", date=Tue Jul 08 2014 13:55:19 GMT-0400 (Eastern Daylight Time)
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Then, a separate file called `createCloud.txt` contains:
|
|
541
|
+
|
|
542
|
+
```sh
|
|
543
|
+
> cat createCloud.txt
|
|
544
|
+
|
|
545
|
+
# initialize container and import WorkspaceDb from previous step
|
|
546
|
+
|
|
547
|
+
initializeWorkspace --noPrompt # don't prompt for yes/no
|
|
548
|
+
importDb project proj112\proj # import WorkspaceDb from local directory into cloud container.
|
|
549
|
+
queryDbs # so we can tell it worked
|
|
550
|
+
```
|
|
551
|
+
run `createCloud.txt` as an @ script using `cloud.json` for config:
|
|
552
|
+
|
|
553
|
+
```sh
|
|
554
|
+
> WorkspaceEditor @r:\createCloud.txt --config=r:\cloud.json
|
|
555
|
+
container "5d385232-a2ec-4f31-b74b-8201c027848d initialized
|
|
556
|
+
Vacuuming r:\workspaces\proj112\proj.itwin-workspace ... done
|
|
557
|
+
import r:\workspaces\proj112\proj.itwin-workspace, container=5d385232-a2ec-4f31-b74b-8201c027848d, dbName=project:1.0.0 : complete, 0.047 seconds
|
|
558
|
+
WorkspaceDbs in container [5d385232-a2ec-4f31-b74b-8201c027848d]
|
|
559
|
+
"project:1.0.0", size=4M, 0M downloaded (0%)
|
|
560
|
+
```
|