@qaecy/cue-cli 0.0.13 → 0.0.14

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 +29 -3
  2. package/package.json +1 -1
  3. package/readme.md +14 -1
package/main.js CHANGED
@@ -211,6 +211,7 @@ var BUCKET_CHAT_SESSIONS = "spaces_chats_eu_west6";
211
211
  var BUCKET_RAW = "spaces_raw_eu_west6";
212
212
  var BUCKET_PROCESSED = "spaces_processed_eu_west6";
213
213
  var BUCKET_LOGS = "spaces_logs_eu_west6";
214
+ var BUCKET_PUBLIC = "cue_public_eu_west6";
214
215
  var COLLECTION_CHAT_SESSIONS = "chatSessions";
215
216
  var COLLECTION_ORGANIZATIONS = "organizations";
216
217
  var COLLECTION_PROJECTS = "projects";
@@ -272,6 +273,9 @@ var CueFirebase = class _CueFirebase {
272
273
  get storageChatSessions() {
273
274
  return this._storageChatSessions;
274
275
  }
276
+ get storagePublic() {
277
+ return this._storagePublic;
278
+ }
275
279
  get collectionChatSessions() {
276
280
  return this._collectionChatSessions;
277
281
  }
@@ -342,6 +346,7 @@ var CueFirebase = class _CueFirebase {
342
346
  this._storageRaw = (0, import_storage.getStorage)(app, BUCKET_RAW);
343
347
  this._storageChatSessions = (0, import_storage.getStorage)(app, BUCKET_CHAT_SESSIONS);
344
348
  this._storageLogs = (0, import_storage.getStorage)(app, BUCKET_LOGS);
349
+ this._storagePublic = (0, import_storage.getStorage)(app, BUCKET_PUBLIC);
345
350
  this._collectionChatSessions = (0, import_firestore.collection)(
346
351
  (0, import_firestore.getFirestore)(app),
347
352
  COLLECTION_CHAT_SESSIONS
@@ -377,6 +382,8 @@ var CueFirebase = class _CueFirebase {
377
382
  throw new Error("Storage chat sessions is not initialized");
378
383
  if (this._storageLogs === void 0)
379
384
  throw new Error("Storage logs is not initialized");
385
+ if (this._storagePublic === void 0)
386
+ throw new Error("Storage public is not initialized");
380
387
  if (this._app === void 0)
381
388
  throw new Error("App is not initialized");
382
389
  const functions = (0, import_functions.getFunctions)(this._app, GCP_REGION);
@@ -387,6 +394,7 @@ var CueFirebase = class _CueFirebase {
387
394
  (0, import_storage.connectStorageEmulator)(this._storageRaw, "localhost", 9199);
388
395
  (0, import_storage.connectStorageEmulator)(this._storageChatSessions, "localhost", 9199);
389
396
  (0, import_storage.connectStorageEmulator)(this._storageLogs, "localhost", 9199);
397
+ (0, import_storage.connectStorageEmulator)(this._storagePublic, "localhost", 9199);
390
398
  if (!this._muted)
391
399
  console.info("Firebase emulators attached");
392
400
  }
@@ -402,6 +410,7 @@ var import_storage2 = require("firebase/storage");
402
410
  var qaecyPrefixes = {
403
411
  qcy: "https://dev.qaecy.com/ont#",
404
412
  "qcy-e": "https://dev.qaecy.com/enum#",
413
+ "qcy-f": "https://dev.qaecy.com/functions#",
405
414
  obc: "https://w3id.org/obc#",
406
415
  // OpenBIM Components
407
416
  dicc: "https://w3id.org/digitalconstruction/0.5/Contexts#",
@@ -5724,7 +5733,7 @@ function turtleFileMetadata(sourceFile, processorId, locationUUID, stored = fals
5724
5733
 
5725
5734
  // apps/desktop/cue-cli/src/helpers/upload-file.ts
5726
5735
  var import_promises6 = require("fs/promises");
5727
- async function uploadFile(file, spaceId, userId, providerId) {
5736
+ async function uploadFile(file, spaceId, userId, providerId, verbose) {
5728
5737
  const firebase = CueFirebase.getInstance();
5729
5738
  const rawFileMetadata = uploadedFileMetadata(
5730
5739
  file.relativePath,
@@ -5743,10 +5752,27 @@ async function uploadFile(file, spaceId, userId, providerId) {
5743
5752
  uploadTask.on(
5744
5753
  "state_changed",
5745
5754
  null,
5746
- (error) => reject(error),
5755
+ (error) => {
5756
+ console.error("[uploadFile] Error uploading file:", {
5757
+ filePath: file.fullPath,
5758
+ relativePath: file.relativePath,
5759
+ md5: file.md5,
5760
+ blobName: rawFileMetadata.blob_name,
5761
+ errorCode: error?.code,
5762
+ errorMessage: error?.message,
5763
+ errorPayload: error
5764
+ });
5765
+ reject(error);
5766
+ },
5747
5767
  () => resolve()
5748
5768
  );
5749
5769
  if (!uploadTask) {
5770
+ console.error("[uploadFile] Upload task could not be created:", {
5771
+ filePath: file.fullPath,
5772
+ relativePath: file.relativePath,
5773
+ md5: file.md5,
5774
+ blobName: rawFileMetadata.blob_name
5775
+ });
5750
5776
  reject(new Error("Upload task could not be created"));
5751
5777
  }
5752
5778
  });
@@ -5870,7 +5896,7 @@ async function syncHandler(options) {
5870
5896
  console.info("Syncing missing files \u23F3");
5871
5897
  let rdfWritten = false;
5872
5898
  for (const file of report.localNotOnRemote) {
5873
- const rawFileMetadata = await uploadFile(file, space, userId, provider);
5899
+ const rawFileMetadata = await uploadFile(file, space, userId, provider, verbose);
5874
5900
  await uploadFileRDF(file, rawFileMetadata, verbose);
5875
5901
  syncCount += 1;
5876
5902
  syncSize += file.size || 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaecy/cue-cli",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Cue CLI for QAECY platform",
5
5
  "main": "main.js",
6
6
  "bin": {
package/readme.md CHANGED
@@ -18,4 +18,17 @@ You need an API key in order to authenticate with the CLI tool.
18
18
  ### Sync a folder
19
19
  To sync the current dir to the space with id `<space-id>` under the provider id `d_drive` (provider id is used to distinguish different document sources and if none is provided the default provider is used). The `v`-flag is for verbose logging so we can follow the progress.
20
20
 
21
- `npx @qaecy/cue-cli sync -s <space-id> -p . --provider d_drive -v`
21
+ `npx @qaecy/cue-cli sync -s <space-id> -p . --provider d_drive -v`
22
+
23
+
24
+ ### Sync command options
25
+
26
+ | Option | Description | Default |
27
+ |-----------------------|------------------------------------------------------------------------------------------------------|--------------|
28
+ | `-s, --space <id>` | Specify the space ID (required) | N/A |
29
+ | `-p, --path <id>` | Specify the folder path to sync (required) | N/A |
30
+ | `-k, --key <api-key>` | Specify the API key (or set `CUE_API_KEY` env variable) | N/A |
31
+ | `--provider <id>` | Specify the provider ID (e.g., sharepoint, drive, dropbox). Leave empty for default provider | `""` |
32
+ | `-v, --verbose` | Enable verbose output | `false` |
33
+ | `-e, --emulators` | Use emulators for sync | `false` |
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` |