@itwin/workspace-editor 5.13.0-dev.1 → 5.13.0-dev.10

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 CHANGED
@@ -10,9 +10,10 @@ There are 3 `WorkspaceResourceType`s that may be accessed by `@itwin-backend` ap
10
10
 
11
11
  1. `string` accessed via the `getString` method
12
12
  2. `blob` binary data accessed via the `getBlob` method
13
- 3. `file` extracted to a local file via the `getFile` method
13
+ 3. `file` extracted to a local file via the deprecated `getFile` method (retained for existing resources)
14
14
 
15
15
  Several `WorkspaceEditor` commands require a `--type` argument to specify which `WorkspaceResourceType` to use.
16
+ Use `string` or `blob` for new resources so applications can access their contents directly from the `WorkspaceDb`. The `file` type remains available for existing workflows that require a local file path.
16
17
 
17
18
  ## The WorkspaceContainer Directory
18
19
 
@@ -137,13 +138,15 @@ Add one or more local files as resources into a `WorkspaceDb`.
137
138
  `--type` specifies the type of resource(s) to add. Required
138
139
 
139
140
  > Note: `--rscName` is only applicable when adding a single file.
141
+ >
142
+ > The `file` resource type is deprecated. Use `blob` for binary file contents or `string` for text.
140
143
 
141
144
  Examples:
142
145
 
143
146
  ```sh
144
- > WorkspaceEditor add proj --rscName=equipment-data --type=file r:\data\equip.dat
147
+ > WorkspaceEditor add proj --rscName=equipment-data --type=blob r:\data\equip.dat
145
148
  WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
146
- added "r:/data/equip.dat" as file resource [equipment-data]
149
+ added "r:/data/equip.dat" as blob resource [equipment-data]
147
150
 
148
151
  > WorkspaceEditor add proj --type=string --root=r:\json *
149
152
  WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
@@ -215,6 +218,7 @@ WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
215
218
  name=specs.json, size=8K
216
219
  name=vendor.json, size=46K
217
220
  blobs:
221
+ name=equipment-data, size=134K
218
222
  name=Sparks/KDE05814.dict, size=224K
219
223
  name=Sparks/KDE05815.dict, size=307K
220
224
  name=Sparks/KDE05816.dict, size=32K
@@ -228,8 +232,6 @@ WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
228
232
  name=UniSpace/KRT05800.dict, size=5K
229
233
  name=UniSpace/KRT05814.dict, size=13K
230
234
  name=UniSpace/KRT05820.dict, size=7K
231
- files:
232
- name=equipment-data, size=134K, ext="dat", date=Tue Jul 08 2021 13:55:19 GMT-0400 (Eastern Daylight Time)
233
235
 
234
236
  > WorkspaceEditor list proj --strings
235
237
  WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
@@ -479,7 +481,7 @@ Assume a file called `importAll.txt` contains:
479
481
  # Create a new local WorkspaceDb file and import resources into it
480
482
 
481
483
  createDb proj # create a new blank WorkspaceDb
482
- add proj --rscName=equipment-data --type=file r:\data\equip.dat # add file
484
+ add proj --rscName=equipment-data --type=blob r:\data\equip.dat # add binary data
483
485
  add proj --type=string --root=r:\json * # add strings
484
486
  add proj --type=blob --root=r:\dict **\*.dict # add blob
485
487
  listDb proj # so we can tell it worked
@@ -491,7 +493,7 @@ run `importAll.txt` as an @ script using `local.json` as config:
491
493
  > WorkspaceEditor @importAll.txt --config=r:\local.json
492
494
  created WorkspaceDb r:\workspaces\proj112\proj.itwin-workspace
493
495
  WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
494
- added "r:/data/equip.dat" as file resource [equipment-data]
496
+ added "r:/data/equip.dat" as blob resource [equipment-data]
495
497
  WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
496
498
  added "r:\json\contracts.json" as string resource [contracts.json]
497
499
  added "r:\json\firecode.json" as string resource [firecode.json]
@@ -519,6 +521,7 @@ WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
519
521
  name=specs.json, size=8K
520
522
  name=vendor.json, size=46K
521
523
  blobs:
524
+ name=equipment-data, size=134K
522
525
  name=Sparks/KDE05814.dict, size=224K
523
526
  name=Sparks/KDE05815.dict, size=307K
524
527
  name=Sparks/KDE05816.dict, size=32K
@@ -533,8 +536,6 @@ WorkspaceDb [r:\workspaces\proj112\proj.itwin-workspace]
533
536
  name=UniSpace/KRT05814.dict, size=13K
534
537
  name=UniSpace/KRT05820.dict, size=7K
535
538
  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
  ```
539
540
 
540
541
  Then, a separate file called `createCloud.txt` contains:
@@ -169,6 +169,8 @@ async function addResource(args) {
169
169
  wsFile.addBlob(name, val);
170
170
  }
171
171
  else {
172
+ // Preserve the deprecated file-resource command so existing workspace maintenance scripts continue to work.
173
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
172
174
  wsFile.addFile(name, file);
173
175
  }
174
176
  showMessage(` added "${file}" as ${args.type} resource [${name}]`);
@@ -197,6 +199,7 @@ async function replaceResource(args) {
197
199
  wsFile.updateBlob(name, val);
198
200
  }
199
201
  else {
202
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
200
203
  wsFile.updateFile(name, file);
201
204
  }
202
205
  showMessage(` updated "${file}" as ${args.type} resource [${name}]`);
@@ -222,6 +225,7 @@ async function extractResource(args) {
222
225
  fs.writeFileSync(args.fileName, verify(file.getBlob(args.rscName)));
223
226
  }
224
227
  else {
228
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
225
229
  verify(file.getFile(args.rscName, args.fileName));
226
230
  }
227
231
  showMessage(` ${args.type} resource [${args.rscName}] extracted to "${args.fileName}"`);
@@ -235,6 +239,7 @@ async function removeResource(args) {
235
239
  else if (args.type === "blob")
236
240
  wsFile.removeBlob(args.rscName);
237
241
  else
242
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
238
243
  wsFile.removeFile(args.rscName);
239
244
  showMessage(` removed ${args.type} resource [${args.rscName}]`);
240
245
  });
@@ -434,7 +439,17 @@ function runCommand(cmd, readonly) {
434
439
  }
435
440
  };
436
441
  }
437
- const type = { alias: "t", describe: "Type of resource", choices: ["blob", "string", "file"], demandOption: true };
442
+ const type = {
443
+ alias: "t",
444
+ describe: "Type of resource",
445
+ choices: ["blob", "string", "file"],
446
+ demandOption: true,
447
+ coerce: (value) => {
448
+ if (value === "file")
449
+ console.warn("Warning: --type=file is deprecated but supported for compatibility. Use --type=blob or --type=string for new resources.");
450
+ return value;
451
+ },
452
+ };
438
453
  const addOrReplace = {
439
454
  rscName: { alias: "n", describe: "Resource name for file", string: true },
440
455
  root: { alias: "r", describe: "Root directory. Path parts after this will be saved in resource name", string: true },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@itwin/workspace-editor",
3
3
  "license": "MIT",
4
4
  "main": "lib/WorkspaceEditor.js",
5
- "version": "5.13.0-dev.1",
5
+ "version": "5.13.0-dev.10",
6
6
  "bin": {
7
7
  "WorkspaceEditor": "./lib/WorkspaceEditor.js"
8
8
  },
@@ -15,11 +15,11 @@
15
15
  "directory": "utils/workspace-editor"
16
16
  },
17
17
  "dependencies": {
18
- "glob": "^10.5.0",
18
+ "glob": "^13.0.6",
19
19
  "yargs": "^17.4.0",
20
- "@itwin/core-common": "5.13.0-dev.1",
21
- "@itwin/core-bentley": "5.13.0-dev.1",
22
- "@itwin/core-backend": "5.13.0-dev.1"
20
+ "@itwin/core-common": "5.13.0-dev.10",
21
+ "@itwin/core-bentley": "5.13.0-dev.10",
22
+ "@itwin/core-backend": "5.13.0-dev.10"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@itwin/eslint-plugin": "^6.0.0",
@@ -30,7 +30,7 @@
30
30
  "mocha": "^11.1.0",
31
31
  "rimraf": "^6.0.1",
32
32
  "typescript": "~5.6.2",
33
- "@itwin/build-tools": "5.13.0-dev.1"
33
+ "@itwin/build-tools": "5.13.0-dev.10"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsc 1>&2",