@qaecy/cue-cli 0.0.7 → 0.0.9
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 +25 -4
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -5151,6 +5151,7 @@ var import_app = require("firebase/app");
|
|
|
5151
5151
|
var CueFirebase = class _CueFirebase {
|
|
5152
5152
|
constructor(config, auth, muted = false) {
|
|
5153
5153
|
this._muted = true;
|
|
5154
|
+
this._emulator = false;
|
|
5154
5155
|
this._muted = muted;
|
|
5155
5156
|
this._init(config, auth);
|
|
5156
5157
|
}
|
|
@@ -5224,6 +5225,9 @@ var CueFirebase = class _CueFirebase {
|
|
|
5224
5225
|
get auth() {
|
|
5225
5226
|
return this._auth;
|
|
5226
5227
|
}
|
|
5228
|
+
get emulatorMode() {
|
|
5229
|
+
return this._emulator;
|
|
5230
|
+
}
|
|
5227
5231
|
_init(config, auth) {
|
|
5228
5232
|
const firebaseConfig = Object.assign(config, {
|
|
5229
5233
|
authDomain: `${APP_ID}.firebaseapp.com`,
|
|
@@ -5280,6 +5284,7 @@ var CueFirebase = class _CueFirebase {
|
|
|
5280
5284
|
this._collectionTiers = (0, import_firestore.collection)((0, import_firestore.getFirestore)(app), COLLECTION_TIERS);
|
|
5281
5285
|
this._auth = auth === void 0 ? (0, import_auth.getAuth)(app) : auth;
|
|
5282
5286
|
this._app = app;
|
|
5287
|
+
this._emulator = config.useEmulator || false;
|
|
5283
5288
|
if (config.useEmulator) {
|
|
5284
5289
|
this.attachEmulators();
|
|
5285
5290
|
}
|
|
@@ -8322,13 +8327,27 @@ async function publishMessage(topicName, data, useEmulator) {
|
|
|
8322
8327
|
if (useEmulator) {
|
|
8323
8328
|
process.env.PUBSUB_EMULATOR_HOST = process.env.PUBSUB_EMULATOR_HOST || "localhost:8085";
|
|
8324
8329
|
}
|
|
8325
|
-
const
|
|
8330
|
+
const projectId = useEmulator ? "demo-project" : PROJECT_ID;
|
|
8331
|
+
const pubSubClient = new import_pubsub.PubSub({ projectId });
|
|
8326
8332
|
const topic = pubSubClient.topic(topicName);
|
|
8327
8333
|
const dataBuffer = Buffer.from(JSON.stringify(data));
|
|
8328
8334
|
try {
|
|
8329
|
-
|
|
8335
|
+
if (useEmulator) {
|
|
8336
|
+
const publishPromise = topic.publishMessage({ data: dataBuffer });
|
|
8337
|
+
const timeoutPromise = new Promise(
|
|
8338
|
+
(_, reject) => setTimeout(() => reject(new Error("PubSub publish timeout")), 5e3)
|
|
8339
|
+
);
|
|
8340
|
+
await Promise.race([publishPromise, timeoutPromise]);
|
|
8341
|
+
} else {
|
|
8342
|
+
await topic.publishMessage({ data: dataBuffer });
|
|
8343
|
+
}
|
|
8330
8344
|
} catch (error) {
|
|
8331
8345
|
console.error(`Error publishing message: ${error.message}`);
|
|
8346
|
+
if (useEmulator) {
|
|
8347
|
+
console.warn("Continuing despite PubSub error in emulator mode...");
|
|
8348
|
+
} else {
|
|
8349
|
+
throw error;
|
|
8350
|
+
}
|
|
8332
8351
|
}
|
|
8333
8352
|
}
|
|
8334
8353
|
|
|
@@ -8433,7 +8452,9 @@ async function syncHandler(options) {
|
|
|
8433
8452
|
console.info(`Threw RDF_WRITING_IDLE topic \u2705`);
|
|
8434
8453
|
} catch (error) {
|
|
8435
8454
|
if (verbose)
|
|
8436
|
-
console.error(`Error throwing RDF_WRITING_IDLE topic: ${error}`);
|
|
8455
|
+
console.error(`Error throwing RDF_WRITING_IDLE topic: ${error.message}`);
|
|
8456
|
+
if (verbose)
|
|
8457
|
+
console.warn("Continuing despite PubSub error in emulator mode...");
|
|
8437
8458
|
}
|
|
8438
8459
|
}
|
|
8439
8460
|
await zipDeletePromise;
|
|
@@ -8451,7 +8472,7 @@ async function syncHandler(options) {
|
|
|
8451
8472
|
|
|
8452
8473
|
// apps/desktop/cue-cli/src/main.ts
|
|
8453
8474
|
var program = new import_commander.Command();
|
|
8454
|
-
program.name("cue-cli").description("Cue Command Line Interface").version("0.0.
|
|
8475
|
+
program.name("cue-cli").description("Cue Command Line Interface").version("0.0.7");
|
|
8455
8476
|
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).action(syncHandler);
|
|
8456
8477
|
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);
|
|
8457
8478
|
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);
|