@uniformdev/cli 19.173.0 → 19.173.2-alpha.210

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.
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // ../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.43.2_postcss@8.4.38_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
8
+ // ../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.2_tsx@4.17.0_typescript@5.5.4/node_modules/tsup/assets/esm_shims.js
9
9
  import { fileURLToPath } from "url";
10
10
  import path from "path";
11
11
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -1,4 +1,4 @@
1
- import "./chunk-DDTNSIMF.mjs";
1
+ import "./chunk-VMUNHMVI.mjs";
2
2
 
3
3
  // src/sync/allSerializableEntitiesConfig.ts
4
4
  var allSerializableEntitiesConfig = {
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  withFormatOptions,
16
16
  withProjectOptions,
17
17
  withTeamOptions
18
- } from "./chunk-DDTNSIMF.mjs";
18
+ } from "./chunk-VMUNHMVI.mjs";
19
19
 
20
20
  // src/index.ts
21
21
  import * as dotenv from "dotenv";
@@ -236,7 +236,8 @@ async function syncEngine({
236
236
  log = () => {
237
237
  },
238
238
  onBeforeCompareObjects,
239
- onBeforeWriteObject
239
+ onBeforeWriteObject,
240
+ onError
240
241
  }) {
241
242
  const targetItems = /* @__PURE__ */ new Map();
242
243
  const deleteTracker = /* @__PURE__ */ new Set();
@@ -246,18 +247,22 @@ async function syncEngine({
246
247
  if (!whatIf) {
247
248
  try {
248
249
  await target.deleteObject(object.providerId, object);
250
+ log({
251
+ action: "delete",
252
+ id: object.id[0],
253
+ providerId: object.providerId,
254
+ displayName: object.displayName ?? object.providerId,
255
+ whatIf,
256
+ diff: diffLines(JSON.stringify(object.object, null, 2), "")
257
+ });
249
258
  } catch (e) {
250
- throw new SyncEngineError(e, object);
259
+ if (onError) {
260
+ onError(e, object);
261
+ } else {
262
+ throw new SyncEngineError(e, object);
263
+ }
251
264
  }
252
265
  }
253
- log({
254
- action: "delete",
255
- id: object.id[0],
256
- providerId: object.providerId,
257
- displayName: object.displayName ?? object.providerId,
258
- whatIf,
259
- diff: diffLines(JSON.stringify(object.object, null, 2), "")
260
- });
261
266
  };
262
267
  for await (const obj of target.objects) {
263
268
  if (Array.isArray(obj.id)) {
@@ -282,18 +287,22 @@ async function syncEngine({
282
287
  try {
283
288
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
284
289
  await target.writeObject(finalSourceObject, targetObject2);
290
+ log({
291
+ action: "update",
292
+ id: ids[0],
293
+ providerId: sourceObject2.providerId,
294
+ displayName: sourceObject2.displayName ?? sourceObject2.providerId,
295
+ whatIf,
296
+ diff: diffJson(targetObject2.object, sourceObject2.object)
297
+ });
285
298
  } catch (e) {
286
- throw new SyncEngineError(e, sourceObject2);
299
+ if (onError) {
300
+ onError(e, sourceObject2);
301
+ } else {
302
+ throw new SyncEngineError(e, sourceObject2);
303
+ }
287
304
  }
288
305
  }
289
- log({
290
- action: "update",
291
- id: ids[0],
292
- providerId: sourceObject2.providerId,
293
- displayName: sourceObject2.displayName ?? sourceObject2.providerId,
294
- whatIf,
295
- diff: diffJson(targetObject2.object, sourceObject2.object)
296
- });
297
306
  };
298
307
  actions.push(process2(sourceObject, targetObject));
299
308
  }
@@ -305,18 +314,22 @@ async function syncEngine({
305
314
  try {
306
315
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
307
316
  await target.writeObject(finalSourceObject);
317
+ log({
318
+ action: "create",
319
+ id,
320
+ providerId: id,
321
+ displayName: sourceObject2.displayName ?? sourceObject2.providerId,
322
+ whatIf,
323
+ diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
324
+ });
308
325
  } catch (e) {
309
- throw new SyncEngineError(e, sourceObject2);
326
+ if (onError) {
327
+ onError(e, sourceObject2);
328
+ } else {
329
+ throw new SyncEngineError(e, sourceObject2);
330
+ }
310
331
  }
311
332
  }
312
- log({
313
- action: "create",
314
- id,
315
- providerId: id,
316
- displayName: sourceObject2.displayName ?? sourceObject2.providerId,
317
- whatIf,
318
- diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
319
- });
320
333
  };
321
334
  if (invalidTargetObjects.length > 0) {
322
335
  [...invalidTargetObjects, targetObject].forEach((o) => {
@@ -1883,7 +1896,7 @@ var CompositionListModule = {
1883
1896
  const res = await client.getCompositionList({
1884
1897
  limit,
1885
1898
  offset,
1886
- search: search.length > 0 ? search : void 0,
1899
+ search: search && search.length > 0 ? search : void 0,
1887
1900
  pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
1888
1901
  patternType,
1889
1902
  state: convertStateOption(state),
@@ -3588,7 +3601,6 @@ var EntryGetModule = {
3588
3601
  withApiOptions(
3589
3602
  withProjectOptions(
3590
3603
  withStateOptions(
3591
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3592
3604
  yargs36.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
3593
3605
  resolveData: {
3594
3606
  type: "boolean",
@@ -4151,7 +4163,6 @@ var EntryPatternGetModule = {
4151
4163
  withApiOptions(
4152
4164
  withProjectOptions(
4153
4165
  withStateOptions(
4154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4155
4166
  yargs36.positional("id", {
4156
4167
  demandOption: true,
4157
4168
  describe: "Entry pattern public ID to fetch"
@@ -7463,7 +7474,7 @@ import { PostHog } from "posthog-node";
7463
7474
  // package.json
7464
7475
  var package_default = {
7465
7476
  name: "@uniformdev/cli",
7466
- version: "19.173.0",
7477
+ version: "19.186.3",
7467
7478
  description: "Uniform command line interface tool",
7468
7479
  license: "SEE LICENSE IN LICENSE.txt",
7469
7480
  main: "./cli.js",
@@ -9109,7 +9120,10 @@ var ProjectMapNodePullModule = {
9109
9120
  };
9110
9121
 
9111
9122
  // src/commands/project-map/commands/ProjectMapNode/push.ts
9112
- import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniformdev/project-map";
9123
+ import {
9124
+ __INTERNAL_MISSING_PARENT_NODE_ERROR,
9125
+ UncachedProjectMapClient as UncachedProjectMapClient10
9126
+ } from "@uniformdev/project-map";
9113
9127
  var ProjectMapNodePushModule = {
9114
9128
  command: "push <directory>",
9115
9129
  describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
@@ -9163,7 +9177,9 @@ var ProjectMapNodePushModule = {
9163
9177
  const packageContents = readContextPackage2(directory, true);
9164
9178
  source = await createArraySyncEngineDataSource({
9165
9179
  name: `Package file ${directory}`,
9166
- objects: packageContents.projectMapNodes ?? [],
9180
+ objects: packageContents.projectMapNodes.sort((a, b) => {
9181
+ return a.path.length - b.path.length;
9182
+ }) ?? [],
9167
9183
  selectIdentifier: expandedSelectIdentifier,
9168
9184
  selectDisplayName: selectDisplayName12
9169
9185
  });
@@ -9176,14 +9192,41 @@ var ProjectMapNodePushModule = {
9176
9192
  });
9177
9193
  }
9178
9194
  const target = createProjectMapNodeEngineDataSource({ client, projectId });
9179
- await syncEngine({
9180
- source,
9181
- target,
9182
- mode,
9183
- whatIf,
9184
- allowEmptySource,
9185
- log: createSyncEngineConsoleLogger({ diffMode })
9186
- });
9195
+ const nodesFailedDueToMissingParent = /* @__PURE__ */ new Set();
9196
+ const attemptSync = async () => {
9197
+ const lastFailedNodesCount = nodesFailedDueToMissingParent.size;
9198
+ nodesFailedDueToMissingParent.clear();
9199
+ await syncEngine({
9200
+ source,
9201
+ target,
9202
+ mode,
9203
+ whatIf,
9204
+ allowEmptySource,
9205
+ log: createSyncEngineConsoleLogger({ diffMode }),
9206
+ onError: (error, object) => {
9207
+ if (error.message.includes(__INTERNAL_MISSING_PARENT_NODE_ERROR)) {
9208
+ nodesFailedDueToMissingParent.add(object.object);
9209
+ } else {
9210
+ throw error;
9211
+ }
9212
+ }
9213
+ });
9214
+ if (nodesFailedDueToMissingParent.size !== 0) {
9215
+ const newFailedNodesCount = nodesFailedDueToMissingParent.size;
9216
+ if (newFailedNodesCount !== lastFailedNodesCount) {
9217
+ source = await createArraySyncEngineDataSource({
9218
+ name: `Nodes re-push from ${directory}`,
9219
+ objects: Array.from(nodesFailedDueToMissingParent),
9220
+ selectIdentifier: expandedSelectIdentifier,
9221
+ selectDisplayName: selectDisplayName12
9222
+ });
9223
+ await attemptSync();
9224
+ } else {
9225
+ throw new Error("Failed to push nodes due to missing parent nodes");
9226
+ }
9227
+ }
9228
+ };
9229
+ await attemptSync();
9187
9230
  }
9188
9231
  };
9189
9232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.173.0",
3
+ "version": "19.173.2-alpha.210+4f0f6ff104",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@thi.ng/mime": "^2.2.23",
30
- "@uniformdev/assets": "19.173.0",
31
- "@uniformdev/canvas": "19.173.0",
32
- "@uniformdev/context": "19.173.0",
33
- "@uniformdev/files": "19.173.0",
34
- "@uniformdev/project-map": "19.173.0",
35
- "@uniformdev/redirect": "19.173.0",
30
+ "@uniformdev/assets": "19.173.2-alpha.210+4f0f6ff104",
31
+ "@uniformdev/canvas": "19.173.2-alpha.210+4f0f6ff104",
32
+ "@uniformdev/context": "19.173.2-alpha.210+4f0f6ff104",
33
+ "@uniformdev/files": "19.173.2-alpha.210+4f0f6ff104",
34
+ "@uniformdev/project-map": "19.173.2-alpha.210+4f0f6ff104",
35
+ "@uniformdev/redirect": "19.173.2-alpha.210+4f0f6ff104",
36
36
  "call-bind": "^1.0.2",
37
37
  "colorette": "2.0.20",
38
38
  "cosmiconfig": "9.0.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "d71596f8829efb4f28ef7213dd9c06421b5cc388"
81
+ "gitHead": "4f0f6ff104f46349c338fde461f063f22f04ce0e"
82
82
  }