@qaecy/cue-cli 0.0.37 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/main.js +41 -5
  2. package/package.json +1 -1
  3. package/readme.md +2 -0
package/main.js CHANGED
@@ -7820,6 +7820,27 @@ var CueSyncApi = class {
7820
7820
  async initBrowserSync(spaceId) {
7821
7821
  await this._initPendingBatch(spaceId);
7822
7822
  }
7823
+ /**
7824
+ * Pushes filesystem-structure metadata for all provided files directly to the
7825
+ * commands API, without checking what is already on the remote or accounting for
7826
+ * credits. Use this when you want to force-write metadata for every file in a
7827
+ * local path (e.g. to repair missing graph data after a migration).
7828
+ */
7829
+ async pushAllMetadata(localFiles, options) {
7830
+ this._legacy = options.legacy ?? false;
7831
+ const items = localFiles.map((f) => ({
7832
+ relativePath: f.relativePath,
7833
+ md5: f.md5,
7834
+ size: f.size,
7835
+ providerId: options.providerId,
7836
+ fileContentExists: false
7837
+ }));
7838
+ for (let i = 0; i < items.length; i += FSS_BATCH_CHUNK_SIZE) {
7839
+ await this._postFssBatch(items.slice(i, i + FSS_BATCH_CHUNK_SIZE), options.spaceId);
7840
+ }
7841
+ if (options.verbose)
7842
+ console.info(`Pushed metadata for ${items.length} file(s) \u2705`);
7843
+ }
7823
7844
  /**
7824
7845
  * Flushes any pending file-location metadata from a previously interrupted sync.
7825
7846
  * Safe to call even when there are no new files to upload (e.g. when the process
@@ -8094,9 +8115,13 @@ WHERE {
8094
8115
  }
8095
8116
  }
8096
8117
  const timer = setInterval(() => {
8097
- this._drainPending(verbose).catch(
8098
- (err) => console.error("[CueSyncApi] Periodic flush failed:", err)
8099
- );
8118
+ this._drainPending(verbose).catch((err) => {
8119
+ const msg = err instanceof Error ? err.message : String(err);
8120
+ console.warn(
8121
+ `\u26A0\uFE0F Metadata flush failed (will retry on next tick): ${msg}
8122
+ Pending items are saved locally and will be re-sent automatically.`
8123
+ );
8124
+ });
8100
8125
  }, 6e4);
8101
8126
  if (typeof timer === "object" && typeof timer.unref === "function") {
8102
8127
  timer.unref();
@@ -9150,7 +9175,7 @@ function askConfirm(question) {
9150
9175
  });
9151
9176
  }
9152
9177
  async function syncHandler(options) {
9153
- const { space, path, verbose, provider, emulators, zip, legacy } = options;
9178
+ const { space, path, verbose, provider, emulators, zip, legacy, metadataOnly } = options;
9154
9179
  try {
9155
9180
  const cue = new CueNode({
9156
9181
  apiKey: FIREBASE_CONFIG().apiKey,
@@ -9215,6 +9240,17 @@ async function syncHandler(options) {
9215
9240
  }
9216
9241
  if (verbose)
9217
9242
  console.info("Authenticated \u2705\n");
9243
+ if (metadataOnly) {
9244
+ console.info(`Pushing metadata for ${localFiles.length} file(s) \u23F3`);
9245
+ await cue.api.sync.pushAllMetadata(localFiles, {
9246
+ spaceId: space,
9247
+ providerId: provider,
9248
+ verbose,
9249
+ legacy
9250
+ });
9251
+ console.info(`Pushed metadata for ${localFiles.length} file(s) \u2705`);
9252
+ process.exit(0);
9253
+ }
9218
9254
  if (verbose)
9219
9255
  console.info("Checking sync preview \u23F3");
9220
9256
  const preview = await cue.api.sync.previewSync(localFiles, {
@@ -9493,7 +9529,7 @@ try {
9493
9529
  }
9494
9530
  var program = new import_commander.Command();
9495
9531
  program.name("cue-cli").description("Cue Command Line Interface").version(packageJson.version);
9496
- program.command("sync").description("Sync files to Cue").requiredOption("-s, --space <id>", "Specify the space ID (required)").requiredOption("-p, --path <id>", "Specify the folder path (required)").option("-k, --key <api-key>", "Specify the API key (or set CUE_API_KEY env variable)").option("--provider <provider ID>", "Specify the provider ID (eg. sharepoint, drive, dropbox) or leave empty for default provider", "").option("-v, --verbose", "Enable verbose output", false).option("-e, --emulators", "Uses emulators for sync", false).option("-z, --zip", 'Include zipped content (will be unzipped to path "<zip_path>_unzipped". Max uncompressed size: 500 MB, max recursion depth: 3)', false).option("--legacy", "Write RDF as BLOBs to the processed bucket instead of patching the graph directly", false).action(syncHandler);
9532
+ program.command("sync").description("Sync files to Cue").requiredOption("-s, --space <id>", "Specify the space ID (required)").requiredOption("-p, --path <id>", "Specify the folder path (required)").option("-k, --key <api-key>", "Specify the API key (or set CUE_API_KEY env variable)").option("--provider <provider ID>", "Specify the provider ID (eg. sharepoint, drive, dropbox) or leave empty for default provider", "").option("-v, --verbose", "Enable verbose output", false).option("-e, --emulators", "Uses emulators for sync", false).option("-z, --zip", 'Include zipped content (will be unzipped to path "<zip_path>_unzipped". Max uncompressed size: 500 MB, max recursion depth: 3)', false).option("--legacy", "Write RDF as BLOBs to the processed bucket instead of patching the graph directly", false).option("--metadata-only", "Push filesystem-structure metadata for all local files without checking credits or remote state", false).action(syncHandler);
9497
9533
  program.command("dump").description("Dump Cue Knowledge Graph data to file\n Examples:\n $ cue-cli dump -s <space_id> -l -v\n $ cue-cli dump -s <space_id> -j -v").requiredOption("-s, --space <id>", "Specify the space ID (required)").option("-k, --key <api-key>", "Specify the API key (or set CUE_API_KEY env variable)").option("-v, --verbose", "Enable verbose output", false).option("-e, --emulators", "Uses emulators for sync", false).option("-q, --query", "Uses a construct query to get the dump rather than using the /data endpoint", false).option("-j, --jelly", "Downloads a Jelly file rather than the standard Gzipped NQuads format", false).option("-l, --load", "Loads the dumped file into a local triplestore (requires emulators)", false).action(dumpHandler);
9498
9534
  program.command("compare").description("Compares folder content to files already updated to Cue").requiredOption("-s, --space <id>", "Specify the space ID (required)").requiredOption("-p, --path <id>", "Specify the folder path (required)").option("-k, --key <api-key>", "Specify the API key (or set CUE_API_KEY env variable)").option("--provider <provider ID>", "Specify the provider ID (eg. sharepoint, drive, dropbox) or leave empty for default provider", "").option("-v, --verbose", "Enable verbose output", false).option("-e, --emulators", "Uses emulators for sync", false).option("-z, --zip", "Include zipped content (will temporarily unzip files with same logic as when syncing and delete them again after the comparison)", false).action(compareHandler);
9499
9535
  program.command("dump-processed").description("Dump processed files to local folder").requiredOption("-s, --space <id>", "Specify the space ID (required)").requiredOption("-p, --processor <id>", "Id of the processor to dump processed files from (required) [eg. writers-blob, processors-cad-files]").option("-k, --key <api-key>", "Specify the API key (or set CUE_API_KEY env variable)").option("-v, --verbose", "Enable verbose output", false).option("-e, --emulators", "Uses emulators for sync", false).action(dumpProcessedHandler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaecy/cue-cli",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "description": "Cue CLI for QAECY platform",
5
5
  "main": "main.js",
6
6
  "bin": {
package/readme.md CHANGED
@@ -32,6 +32,8 @@ To sync the current dir to the space with id `<space-id>` under the provider id
32
32
  | `-v, --verbose` | Enable verbose output | `false` |
33
33
  | `-e, --emulators` | Use emulators for sync | `false` |
34
34
  | `-z, --zip` | Include zipped content. Will be unzipped to `<zip_path>_unzipped`. Max uncompressed size: 500 MB, max recursion depth: 3. Cleans up unzipped files after sync. | `false` |
35
+ | `--legacy` | Write RDF metadata as serialised Turtle BLOBs to the processed storage bucket instead of patching the knowledge graph directly. Use this when the ledger and graph services are not yet available for the target environment. | `false` |
36
+ | `--metadata-only` | Push filesystem-structure metadata for every local file directly to the commands API, without checking what is already on the remote, running a credit estimate, or uploading any file content. Useful for repairing missing graph metadata after a migration or interrupted sync. Can be combined with `--legacy` to write the metadata as BLOBs. | `false` |
35
37
 
36
38
  ### util-remove-rdf-star
37
39