@qaecy/cue-cli 0.0.36 → 0.0.38
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/main.js +36 -10
- package/package.json +1 -1
- 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
|
|
@@ -8143,8 +8164,6 @@ WHERE {
|
|
|
8143
8164
|
}
|
|
8144
8165
|
}
|
|
8145
8166
|
async _postFssBatch(items, spaceId) {
|
|
8146
|
-
const controller = new AbortController();
|
|
8147
|
-
const timeout = setTimeout(() => controller.abort(), 15e3);
|
|
8148
8167
|
const url = this._legacy ? `${this._gatewayUrl}${ENDPOINT_FSS_BATCH}?blob=true` : `${this._gatewayUrl}${ENDPOINT_FSS_BATCH}`;
|
|
8149
8168
|
let response;
|
|
8150
8169
|
try {
|
|
@@ -8154,14 +8173,10 @@ WHERE {
|
|
|
8154
8173
|
"Content-Type": "application/json",
|
|
8155
8174
|
"x-project-id": spaceId
|
|
8156
8175
|
},
|
|
8157
|
-
body: JSON.stringify({ items })
|
|
8158
|
-
signal: controller.signal
|
|
8176
|
+
body: JSON.stringify({ items })
|
|
8159
8177
|
});
|
|
8160
8178
|
} catch (err) {
|
|
8161
|
-
|
|
8162
|
-
throw new Error(`File structure batch POST failed: ${isTimeout ? "request timed out" : err instanceof Error ? err.message : String(err)}`);
|
|
8163
|
-
} finally {
|
|
8164
|
-
clearTimeout(timeout);
|
|
8179
|
+
throw new Error(`File structure batch POST failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
8165
8180
|
}
|
|
8166
8181
|
if (!response.ok) {
|
|
8167
8182
|
const body = await response.text().catch(() => "");
|
|
@@ -9156,7 +9171,7 @@ function askConfirm(question) {
|
|
|
9156
9171
|
});
|
|
9157
9172
|
}
|
|
9158
9173
|
async function syncHandler(options) {
|
|
9159
|
-
const { space, path, verbose, provider, emulators, zip, legacy } = options;
|
|
9174
|
+
const { space, path, verbose, provider, emulators, zip, legacy, metadataOnly } = options;
|
|
9160
9175
|
try {
|
|
9161
9176
|
const cue = new CueNode({
|
|
9162
9177
|
apiKey: FIREBASE_CONFIG().apiKey,
|
|
@@ -9221,6 +9236,17 @@ async function syncHandler(options) {
|
|
|
9221
9236
|
}
|
|
9222
9237
|
if (verbose)
|
|
9223
9238
|
console.info("Authenticated \u2705\n");
|
|
9239
|
+
if (metadataOnly) {
|
|
9240
|
+
console.info(`Pushing metadata for ${localFiles.length} file(s) \u23F3`);
|
|
9241
|
+
await cue.api.sync.pushAllMetadata(localFiles, {
|
|
9242
|
+
spaceId: space,
|
|
9243
|
+
providerId: provider,
|
|
9244
|
+
verbose,
|
|
9245
|
+
legacy
|
|
9246
|
+
});
|
|
9247
|
+
console.info(`Pushed metadata for ${localFiles.length} file(s) \u2705`);
|
|
9248
|
+
process.exit(0);
|
|
9249
|
+
}
|
|
9224
9250
|
if (verbose)
|
|
9225
9251
|
console.info("Checking sync preview \u23F3");
|
|
9226
9252
|
const preview = await cue.api.sync.previewSync(localFiles, {
|
|
@@ -9499,7 +9525,7 @@ try {
|
|
|
9499
9525
|
}
|
|
9500
9526
|
var program = new import_commander.Command();
|
|
9501
9527
|
program.name("cue-cli").description("Cue Command Line Interface").version(packageJson.version);
|
|
9502
|
-
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);
|
|
9528
|
+
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);
|
|
9503
9529
|
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);
|
|
9504
9530
|
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);
|
|
9505
9531
|
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
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
|
|