@qaecy/cue-cli 0.0.44 → 0.0.45

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 (2) hide show
  1. package/main.js +21 -12
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -9260,6 +9260,27 @@ async function syncHandler(options) {
9260
9260
  if (!space) {
9261
9261
  process.exit(1);
9262
9262
  }
9263
+ if (verbose)
9264
+ console.info("Authenticating \u23F3");
9265
+ let user;
9266
+ try {
9267
+ user = await cue.auth.signInWithApiKey(key, space);
9268
+ } catch (err) {
9269
+ const cause = err instanceof Error ? err.message : String(err);
9270
+ console.error(`Couldn't authenticate. ${cause}`);
9271
+ process.exit(1);
9272
+ }
9273
+ if (verbose)
9274
+ console.info("Authenticated \u2705\n");
9275
+ const projectDoc = await cue.projects.getProject(space);
9276
+ if (projectDoc) {
9277
+ const isSuperAdmin = await cue.auth.checkSuperAdmin();
9278
+ const canSync = isSuperAdmin || projectDoc.syncers?.includes(user.uid) || projectDoc.admins?.includes(user.uid);
9279
+ if (!canSync) {
9280
+ console.error(`You don't have sync rights on project ${space}.`);
9281
+ process.exit(1);
9282
+ }
9283
+ }
9263
9284
  if (verbose)
9264
9285
  console.info("Building sync base \u23F3");
9265
9286
  const resolvedPath = (0, import_path3.resolve)(path);
@@ -9297,18 +9318,6 @@ async function syncHandler(options) {
9297
9318
  }
9298
9319
  if (verbose)
9299
9320
  console.info("Built sync base \u2705\n");
9300
- if (verbose)
9301
- console.info("Authenticating \u23F3");
9302
- let user;
9303
- try {
9304
- user = await cue.auth.signInWithApiKey(key, space);
9305
- } catch (err) {
9306
- const cause = err instanceof Error ? err.message : String(err);
9307
- console.error(`Couldn't authenticate. ${cause}`);
9308
- process.exit(1);
9309
- }
9310
- if (verbose)
9311
- console.info("Authenticated \u2705\n");
9312
9321
  if (metadataOnly) {
9313
9322
  console.info(`Pushing metadata for ${localFiles.length} file(s) \u23F3`);
9314
9323
  await cue.api.sync.pushAllMetadata(localFiles, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaecy/cue-cli",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "Cue CLI for QAECY platform",
5
5
  "main": "main.js",
6
6
  "bin": {