@uniformdev/cli 20.53.1-alpha.7 → 20.53.2-alpha.0

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/dist/index.mjs +49 -14
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -722,7 +722,7 @@ import mitt from "mitt";
722
722
 
723
723
  // src/sync/serializedDequal.ts
724
724
  var has = Object.prototype.hasOwnProperty;
725
- var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated"]);
725
+ var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated", "createdBy", "modifiedBy", "updatedBy"]);
726
726
  function serializedDequal(foo, bar) {
727
727
  let ctor, len;
728
728
  if (foo === bar) {
@@ -1107,7 +1107,7 @@ import { PostHog } from "posthog-node";
1107
1107
  // package.json
1108
1108
  var package_default = {
1109
1109
  name: "@uniformdev/cli",
1110
- version: "20.53.0",
1110
+ version: "20.53.1",
1111
1111
  description: "Uniform command line interface tool",
1112
1112
  license: "SEE LICENSE IN LICENSE.txt",
1113
1113
  main: "./cli.js",
@@ -2459,7 +2459,7 @@ import {
2459
2459
  walkNodeTree,
2460
2460
  walkPropertyValues
2461
2461
  } from "@uniformdev/canvas";
2462
- var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
2462
+ var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu([1-9]\d*)?\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
2463
2463
  var walkFileUrlsForCompositionOrEntry = ({
2464
2464
  entity,
2465
2465
  callback
@@ -2742,7 +2742,7 @@ var escapeRegExp = (string4) => {
2742
2742
  var findUrlMatchingPartialPathname = (source, pathname) => {
2743
2743
  const escapedPathname = escapeRegExp(pathname);
2744
2744
  const regex = new RegExp(
2745
- `"(https://([^"]*?)?(img|files).uniform.(rocks|global)${escapedPathname}([^"]*?))"`
2745
+ `"(https://([^"]*?)?(img|files).(eu([1-9]\\d*)?\\.)?uniform.(rocks|global)${escapedPathname}([^"]*?))"`
2746
2746
  );
2747
2747
  const match = source.match(regex);
2748
2748
  if (match && match[1]) {
@@ -7090,17 +7090,24 @@ function getLabelClient(options) {
7090
7090
  }
7091
7091
 
7092
7092
  // src/commands/canvas/labelsEngineDataSource.ts
7093
+ function normalizeLabelForSync(label) {
7094
+ const { projectId: _projectId, ...labelWithoutProjectId } = label;
7095
+ return labelWithoutProjectId;
7096
+ }
7093
7097
  function createLabelsEngineDataSource({
7094
7098
  client
7095
7099
  }) {
7096
7100
  async function* getObjects() {
7097
- const labels = (await client.getLabels()).labels;
7101
+ const labels = paginateAsync(
7102
+ async (offset, limit2) => (await client.getLabels({ offset, limit: limit2 })).labels,
7103
+ { pageSize: 100 }
7104
+ );
7098
7105
  for await (const label of labels) {
7099
7106
  const result = {
7100
7107
  id: label.label.publicId,
7101
7108
  displayName: `${label.label.displayName} (pid: ${label.label.publicId})`,
7102
7109
  providerId: label.label.publicId,
7103
- object: label
7110
+ object: normalizeLabelForSync(label)
7104
7111
  };
7105
7112
  yield result;
7106
7113
  }
@@ -7204,6 +7211,7 @@ var LabelPullModule = {
7204
7211
  };
7205
7212
 
7206
7213
  // src/commands/canvas/commands/label/push.ts
7214
+ var __INTERNAL_MISSING_PARENT_LABEL_ERROR = "Parent label with public ID";
7207
7215
  var LabelPushModule = {
7208
7216
  command: "push <directory>",
7209
7217
  describe: "Pushes all labels from files in a directory to Uniform",
@@ -7261,14 +7269,41 @@ var LabelPushModule = {
7261
7269
  });
7262
7270
  }
7263
7271
  const target = createLabelsEngineDataSource({ client });
7264
- await syncEngine({
7265
- source,
7266
- target,
7267
- mode,
7268
- whatIf,
7269
- allowEmptySource,
7270
- log: createSyncEngineConsoleLogger({ diffMode })
7271
- });
7272
+ const labelsFailedDueToMissingParent = /* @__PURE__ */ new Set();
7273
+ const attemptSync = async () => {
7274
+ const lastFailedLabelsCount = labelsFailedDueToMissingParent.size;
7275
+ labelsFailedDueToMissingParent.clear();
7276
+ await syncEngine({
7277
+ source,
7278
+ target,
7279
+ mode,
7280
+ whatIf,
7281
+ allowEmptySource,
7282
+ log: createSyncEngineConsoleLogger({ diffMode }),
7283
+ onError: (error, object4) => {
7284
+ if (error.message.includes(__INTERNAL_MISSING_PARENT_LABEL_ERROR)) {
7285
+ labelsFailedDueToMissingParent.add(object4.object);
7286
+ } else {
7287
+ throw error;
7288
+ }
7289
+ }
7290
+ });
7291
+ if (labelsFailedDueToMissingParent.size !== 0) {
7292
+ const newFailedLabelsCount = labelsFailedDueToMissingParent.size;
7293
+ if (newFailedLabelsCount !== lastFailedLabelsCount) {
7294
+ source = await createArraySyncEngineDataSource({
7295
+ name: `Labels re-push from ${directory}`,
7296
+ objects: Array.from(labelsFailedDueToMissingParent),
7297
+ selectIdentifier: selectLabelIdentifier,
7298
+ selectDisplayName: selectLabelDisplayName
7299
+ });
7300
+ await attemptSync();
7301
+ } else {
7302
+ throw new Error("Failed to push labels due to missing parent labels");
7303
+ }
7304
+ }
7305
+ };
7306
+ await attemptSync();
7272
7307
  }
7273
7308
  };
7274
7309
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.53.1-alpha.7+1c3bd56284",
3
+ "version": "20.53.2-alpha.0+9f6b2ac29f",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -28,13 +28,13 @@
28
28
  "dependencies": {
29
29
  "@inquirer/prompts": "^7.10.1",
30
30
  "@thi.ng/mime": "^2.2.23",
31
- "@uniformdev/assets": "20.53.1-alpha.7+1c3bd56284",
32
- "@uniformdev/canvas": "20.53.1-alpha.7+1c3bd56284",
33
- "@uniformdev/context": "20.53.1-alpha.7+1c3bd56284",
34
- "@uniformdev/files": "20.53.1-alpha.7+1c3bd56284",
35
- "@uniformdev/project-map": "20.53.1-alpha.7+1c3bd56284",
36
- "@uniformdev/redirect": "20.53.1-alpha.7+1c3bd56284",
37
- "@uniformdev/richtext": "20.53.1-alpha.7+1c3bd56284",
31
+ "@uniformdev/assets": "20.53.2-alpha.0+9f6b2ac29f",
32
+ "@uniformdev/canvas": "20.53.2-alpha.0+9f6b2ac29f",
33
+ "@uniformdev/context": "20.53.2-alpha.0+9f6b2ac29f",
34
+ "@uniformdev/files": "20.53.2-alpha.0+9f6b2ac29f",
35
+ "@uniformdev/project-map": "20.53.2-alpha.0+9f6b2ac29f",
36
+ "@uniformdev/redirect": "20.53.2-alpha.0+9f6b2ac29f",
37
+ "@uniformdev/richtext": "20.53.2-alpha.0+9f6b2ac29f",
38
38
  "call-bind": "^1.0.2",
39
39
  "colorette": "2.0.20",
40
40
  "cosmiconfig": "9.0.0",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "1c3bd56284db96f16318a18e62b3b6e83cb09f9b"
84
+ "gitHead": "9f6b2ac29f8ee91c8fe96e927eba23e4ed0dfee9"
85
85
  }