@slicemachine/manager 0.24.15-beta.9 → 0.24.16-alpha.coderabbitai-chat-dniAA6r9GseKm4ouqNyJ8dl.1

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 (45) hide show
  1. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.cjs +1 -1
  2. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js +1 -1
  3. package/dist/_node_modules/cross-spawn/index.cjs +1 -1
  4. package/dist/_node_modules/cross-spawn/index.js +1 -1
  5. package/dist/_node_modules/execa/index.cjs +2 -2
  6. package/dist/_node_modules/execa/index.js +2 -2
  7. package/dist/_node_modules/npm-run-path/_node_modules/path-key/index.cjs.map +1 -0
  8. package/dist/_node_modules/npm-run-path/_node_modules/path-key/index.js.map +1 -0
  9. package/dist/_node_modules/{execa/_node_modules/npm-run-path → npm-run-path}/index.cjs +1 -1
  10. package/dist/_node_modules/npm-run-path/index.cjs.map +1 -0
  11. package/dist/_node_modules/{execa/_node_modules/npm-run-path → npm-run-path}/index.js +1 -1
  12. package/dist/_node_modules/npm-run-path/index.js.map +1 -0
  13. package/dist/_node_modules/{execa/_node_modules/onetime → onetime}/index.cjs +1 -1
  14. package/dist/_node_modules/onetime/index.cjs.map +1 -0
  15. package/dist/_node_modules/{execa/_node_modules/onetime → onetime}/index.js +1 -1
  16. package/dist/_node_modules/onetime/index.js.map +1 -0
  17. package/dist/_virtual/index2.cjs +4 -3
  18. package/dist/_virtual/index2.cjs.map +1 -1
  19. package/dist/_virtual/index2.js +4 -2
  20. package/dist/_virtual/index2.js.map +1 -1
  21. package/dist/_virtual/index3.cjs +3 -4
  22. package/dist/_virtual/index3.cjs.map +1 -1
  23. package/dist/_virtual/index3.js +2 -4
  24. package/dist/_virtual/index3.js.map +1 -1
  25. package/dist/managers/customTypes/CustomTypesManager.cjs +113 -38
  26. package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
  27. package/dist/managers/customTypes/CustomTypesManager.d.ts +197 -75
  28. package/dist/managers/customTypes/CustomTypesManager.js +113 -38
  29. package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
  30. package/dist/managers/telemetry/types.cjs +4 -6
  31. package/dist/managers/telemetry/types.cjs.map +1 -1
  32. package/dist/managers/telemetry/types.d.ts +6 -7
  33. package/dist/managers/telemetry/types.js +4 -6
  34. package/dist/managers/telemetry/types.js.map +1 -1
  35. package/package.json +4 -4
  36. package/src/managers/customTypes/CustomTypesManager.ts +261 -74
  37. package/src/managers/telemetry/types.ts +12 -17
  38. package/dist/_node_modules/execa/_node_modules/npm-run-path/index.cjs.map +0 -1
  39. package/dist/_node_modules/execa/_node_modules/npm-run-path/index.js.map +0 -1
  40. package/dist/_node_modules/execa/_node_modules/onetime/index.cjs.map +0 -1
  41. package/dist/_node_modules/execa/_node_modules/onetime/index.js.map +0 -1
  42. package/dist/_node_modules/execa/_node_modules/path-key/index.cjs.map +0 -1
  43. package/dist/_node_modules/execa/_node_modules/path-key/index.js.map +0 -1
  44. /package/dist/_node_modules/{execa → npm-run-path}/_node_modules/path-key/index.cjs +0 -0
  45. /package/dist/_node_modules/{execa → npm-run-path}/_node_modules/path-key/index.js +0 -0
@@ -37,6 +37,24 @@ type SliceMachineManagerUpdateCustomTypeMocksConfigArgs = {
37
37
  customTypeID: string;
38
38
  mocksConfig: Record<string, unknown>;
39
39
  };
40
+ /** `[field]` or `[group, field]` – path INSIDE the Custom Type */
41
+ type PathWithinCustomType = [string] | [string, string];
42
+ /** `[ct, field]` or `[ct, group, field]` – path WITH Custom Type ID */
43
+ type PathWithCustomType = [string, string] | [string, string, string];
44
+ export type SliceMachineManagerUpdateCustomTypeArgs = CustomTypeUpdateHookData & {
45
+ updateMeta?: {
46
+ fieldIdChanged?: {
47
+ /**
48
+ * Previous path of the changed field. `[field]` or `[group, field]`
49
+ */
50
+ previousPath: PathWithinCustomType;
51
+ /**
52
+ * New path of the changed field. `[field]` or `[group, field]`
53
+ */
54
+ newPath: PathWithinCustomType;
55
+ };
56
+ };
57
+ };
40
58
  type SliceMachineManagerUpdateCustomTypeMocksConfigArgsReturnType = {
41
59
  errors: HookError[];
42
60
  };
@@ -50,8 +68,8 @@ type CustomTypesMachineManagerUpdateCustomTypeReturnType = {
50
68
  errors: (DecodeError | HookError)[];
51
69
  };
52
70
  type CustomTypeFieldIdChangedMeta = {
53
- previousPath: string[];
54
- newPath: string[];
71
+ previousPath: PathWithCustomType;
72
+ newPath: PathWithCustomType;
55
73
  };
56
74
  export declare class CustomTypesManager extends BaseManager {
57
75
  readCustomTypeLibrary(): Promise<SliceMachineManagerReadCustomTypeLibraryReturnType>;
@@ -64,7 +82,7 @@ export declare class CustomTypesManager extends BaseManager {
64
82
  * property.
65
83
  */
66
84
  private updateContentRelationships;
67
- updateCustomType(args: CustomTypeUpdateHookData): Promise<CustomTypesMachineManagerUpdateCustomTypeReturnType>;
85
+ updateCustomType(args: SliceMachineManagerUpdateCustomTypeArgs): Promise<CustomTypesMachineManagerUpdateCustomTypeReturnType>;
68
86
  renameCustomType(args: CustomTypeRenameHookData): Promise<OnlyHookErrors<CallHookReturnType<CustomTypeRenameHook>>>;
69
87
  deleteCustomType(args: CustomTypesMachineManagerDeleteCustomTypeArgs): Promise<CustomTypesMachineManagerDeleteCustomTypeReturnType>;
70
88
  pushCustomType(args: SliceMachineManagerPushCustomTypeArgs): Promise<void>;
@@ -221,18 +239,31 @@ declare const InferSliceResponse: z.ZodObject<{
221
239
  useAsTitle?: boolean | undefined;
222
240
  placeholder?: string | undefined;
223
241
  select?: "media" | "document" | "web" | null | undefined;
224
- customtypes?: readonly (string | ({
242
+ customtypes?: readonly (string | {
225
243
  id: string;
226
- } & {
227
- fields?: readonly (string | {
244
+ fields: readonly (string | {
228
245
  id: string;
229
- customtypes: readonly (string | ({
246
+ customtypes: readonly (string | {
230
247
  id: string;
231
- } & {
232
- fields?: readonly string[] | undefined;
233
- }))[];
234
- })[] | undefined;
235
- }))[] | undefined;
248
+ fields: readonly (string | {
249
+ id: string;
250
+ fields: readonly string[];
251
+ })[];
252
+ })[];
253
+ } | {
254
+ id: string;
255
+ fields: readonly (string | {
256
+ id: string;
257
+ customtypes: readonly (string | {
258
+ id: string;
259
+ fields: readonly (string | {
260
+ id: string;
261
+ fields: readonly string[];
262
+ })[];
263
+ })[];
264
+ })[];
265
+ })[];
266
+ })[] | undefined;
236
267
  masks?: readonly string[] | undefined;
237
268
  tags?: readonly string[] | undefined;
238
269
  allowTargetBlank?: boolean | undefined;
@@ -407,18 +438,31 @@ declare const InferSliceResponse: z.ZodObject<{
407
438
  useAsTitle?: boolean | undefined;
408
439
  placeholder?: string | undefined;
409
440
  select?: "media" | "document" | "web" | null | undefined;
410
- customtypes?: readonly (string | ({
441
+ customtypes?: readonly (string | {
411
442
  id: string;
412
- } & {
413
- fields?: readonly (string | {
443
+ fields: readonly (string | {
444
+ id: string;
445
+ customtypes: readonly (string | {
446
+ id: string;
447
+ fields: readonly (string | {
448
+ id: string;
449
+ fields: readonly string[];
450
+ })[];
451
+ })[];
452
+ } | {
414
453
  id: string;
415
- customtypes: readonly (string | ({
454
+ fields: readonly (string | {
416
455
  id: string;
417
- } & {
418
- fields?: readonly string[] | undefined;
419
- }))[];
420
- })[] | undefined;
421
- }))[] | undefined;
456
+ customtypes: readonly (string | {
457
+ id: string;
458
+ fields: readonly (string | {
459
+ id: string;
460
+ fields: readonly string[];
461
+ })[];
462
+ })[];
463
+ })[];
464
+ })[];
465
+ })[] | undefined;
422
466
  masks?: readonly string[] | undefined;
423
467
  tags?: readonly string[] | undefined;
424
468
  allowTargetBlank?: boolean | undefined;
@@ -593,18 +637,31 @@ declare const InferSliceResponse: z.ZodObject<{
593
637
  useAsTitle?: boolean | undefined;
594
638
  placeholder?: string | undefined;
595
639
  select?: "media" | "document" | "web" | null | undefined;
596
- customtypes?: readonly (string | ({
640
+ customtypes?: readonly (string | {
597
641
  id: string;
598
- } & {
599
- fields?: readonly (string | {
642
+ fields: readonly (string | {
600
643
  id: string;
601
- customtypes: readonly (string | ({
644
+ customtypes: readonly (string | {
602
645
  id: string;
603
- } & {
604
- fields?: readonly string[] | undefined;
605
- }))[];
606
- })[] | undefined;
607
- }))[] | undefined;
646
+ fields: readonly (string | {
647
+ id: string;
648
+ fields: readonly string[];
649
+ })[];
650
+ })[];
651
+ } | {
652
+ id: string;
653
+ fields: readonly (string | {
654
+ id: string;
655
+ customtypes: readonly (string | {
656
+ id: string;
657
+ fields: readonly (string | {
658
+ id: string;
659
+ fields: readonly string[];
660
+ })[];
661
+ })[];
662
+ })[];
663
+ })[];
664
+ })[] | undefined;
608
665
  masks?: readonly string[] | undefined;
609
666
  tags?: readonly string[] | undefined;
610
667
  allowTargetBlank?: boolean | undefined;
@@ -778,18 +835,31 @@ declare const InferSliceResponse: z.ZodObject<{
778
835
  useAsTitle?: boolean | undefined;
779
836
  placeholder?: string | undefined;
780
837
  select?: "media" | "document" | "web" | null | undefined;
781
- customtypes?: readonly (string | ({
838
+ customtypes?: readonly (string | {
782
839
  id: string;
783
- } & {
784
- fields?: readonly (string | {
840
+ fields: readonly (string | {
841
+ id: string;
842
+ customtypes: readonly (string | {
843
+ id: string;
844
+ fields: readonly (string | {
845
+ id: string;
846
+ fields: readonly string[];
847
+ })[];
848
+ })[];
849
+ } | {
785
850
  id: string;
786
- customtypes: readonly (string | ({
851
+ fields: readonly (string | {
787
852
  id: string;
788
- } & {
789
- fields?: readonly string[] | undefined;
790
- }))[];
791
- })[] | undefined;
792
- }))[] | undefined;
853
+ customtypes: readonly (string | {
854
+ id: string;
855
+ fields: readonly (string | {
856
+ id: string;
857
+ fields: readonly string[];
858
+ })[];
859
+ })[];
860
+ })[];
861
+ })[];
862
+ })[] | undefined;
793
863
  masks?: readonly string[] | undefined;
794
864
  tags?: readonly string[] | undefined;
795
865
  allowTargetBlank?: boolean | undefined;
@@ -979,18 +1049,31 @@ declare const InferSliceResponse: z.ZodObject<{
979
1049
  useAsTitle?: boolean | undefined;
980
1050
  placeholder?: string | undefined;
981
1051
  select?: "media" | "document" | "web" | null | undefined;
982
- customtypes?: readonly (string | ({
1052
+ customtypes?: readonly (string | {
983
1053
  id: string;
984
- } & {
985
- fields?: readonly (string | {
1054
+ fields: readonly (string | {
986
1055
  id: string;
987
- customtypes: readonly (string | ({
1056
+ customtypes: readonly (string | {
988
1057
  id: string;
989
- } & {
990
- fields?: readonly string[] | undefined;
991
- }))[];
992
- })[] | undefined;
993
- }))[] | undefined;
1058
+ fields: readonly (string | {
1059
+ id: string;
1060
+ fields: readonly string[];
1061
+ })[];
1062
+ })[];
1063
+ } | {
1064
+ id: string;
1065
+ fields: readonly (string | {
1066
+ id: string;
1067
+ customtypes: readonly (string | {
1068
+ id: string;
1069
+ fields: readonly (string | {
1070
+ id: string;
1071
+ fields: readonly string[];
1072
+ })[];
1073
+ })[];
1074
+ })[];
1075
+ })[];
1076
+ })[] | undefined;
994
1077
  masks?: readonly string[] | undefined;
995
1078
  tags?: readonly string[] | undefined;
996
1079
  allowTargetBlank?: boolean | undefined;
@@ -1165,18 +1248,31 @@ declare const InferSliceResponse: z.ZodObject<{
1165
1248
  useAsTitle?: boolean | undefined;
1166
1249
  placeholder?: string | undefined;
1167
1250
  select?: "media" | "document" | "web" | null | undefined;
1168
- customtypes?: readonly (string | ({
1251
+ customtypes?: readonly (string | {
1169
1252
  id: string;
1170
- } & {
1171
- fields?: readonly (string | {
1253
+ fields: readonly (string | {
1254
+ id: string;
1255
+ customtypes: readonly (string | {
1256
+ id: string;
1257
+ fields: readonly (string | {
1258
+ id: string;
1259
+ fields: readonly string[];
1260
+ })[];
1261
+ })[];
1262
+ } | {
1172
1263
  id: string;
1173
- customtypes: readonly (string | ({
1264
+ fields: readonly (string | {
1174
1265
  id: string;
1175
- } & {
1176
- fields?: readonly string[] | undefined;
1177
- }))[];
1178
- })[] | undefined;
1179
- }))[] | undefined;
1266
+ customtypes: readonly (string | {
1267
+ id: string;
1268
+ fields: readonly (string | {
1269
+ id: string;
1270
+ fields: readonly string[];
1271
+ })[];
1272
+ })[];
1273
+ })[];
1274
+ })[];
1275
+ })[] | undefined;
1180
1276
  masks?: readonly string[] | undefined;
1181
1277
  tags?: readonly string[] | undefined;
1182
1278
  allowTargetBlank?: boolean | undefined;
@@ -1351,18 +1447,31 @@ declare const InferSliceResponse: z.ZodObject<{
1351
1447
  useAsTitle?: boolean | undefined;
1352
1448
  placeholder?: string | undefined;
1353
1449
  select?: "media" | "document" | "web" | null | undefined;
1354
- customtypes?: readonly (string | ({
1450
+ customtypes?: readonly (string | {
1355
1451
  id: string;
1356
- } & {
1357
- fields?: readonly (string | {
1452
+ fields: readonly (string | {
1358
1453
  id: string;
1359
- customtypes: readonly (string | ({
1454
+ customtypes: readonly (string | {
1360
1455
  id: string;
1361
- } & {
1362
- fields?: readonly string[] | undefined;
1363
- }))[];
1364
- })[] | undefined;
1365
- }))[] | undefined;
1456
+ fields: readonly (string | {
1457
+ id: string;
1458
+ fields: readonly string[];
1459
+ })[];
1460
+ })[];
1461
+ } | {
1462
+ id: string;
1463
+ fields: readonly (string | {
1464
+ id: string;
1465
+ customtypes: readonly (string | {
1466
+ id: string;
1467
+ fields: readonly (string | {
1468
+ id: string;
1469
+ fields: readonly string[];
1470
+ })[];
1471
+ })[];
1472
+ })[];
1473
+ })[];
1474
+ })[] | undefined;
1366
1475
  masks?: readonly string[] | undefined;
1367
1476
  tags?: readonly string[] | undefined;
1368
1477
  allowTargetBlank?: boolean | undefined;
@@ -1536,18 +1645,31 @@ declare const InferSliceResponse: z.ZodObject<{
1536
1645
  useAsTitle?: boolean | undefined;
1537
1646
  placeholder?: string | undefined;
1538
1647
  select?: "media" | "document" | "web" | null | undefined;
1539
- customtypes?: readonly (string | ({
1648
+ customtypes?: readonly (string | {
1540
1649
  id: string;
1541
- } & {
1542
- fields?: readonly (string | {
1650
+ fields: readonly (string | {
1543
1651
  id: string;
1544
- customtypes: readonly (string | ({
1652
+ customtypes: readonly (string | {
1545
1653
  id: string;
1546
- } & {
1547
- fields?: readonly string[] | undefined;
1548
- }))[];
1549
- })[] | undefined;
1550
- }))[] | undefined;
1654
+ fields: readonly (string | {
1655
+ id: string;
1656
+ fields: readonly string[];
1657
+ })[];
1658
+ })[];
1659
+ } | {
1660
+ id: string;
1661
+ fields: readonly (string | {
1662
+ id: string;
1663
+ customtypes: readonly (string | {
1664
+ id: string;
1665
+ fields: readonly (string | {
1666
+ id: string;
1667
+ fields: readonly string[];
1668
+ })[];
1669
+ })[];
1670
+ })[];
1671
+ })[];
1672
+ })[] | undefined;
1551
1673
  masks?: readonly string[] | undefined;
1552
1674
  tags?: readonly string[] | undefined;
1553
1675
  allowTargetBlank?: boolean | undefined;
@@ -67,11 +67,11 @@ class CustomTypesManager extends BaseManager {
67
67
  */
68
68
  async updateContentRelationships(args) {
69
69
  assertPluginsInitialized(this.sliceMachinePluginRunner);
70
- const { model } = args;
71
- let { newPath, previousPath } = args;
72
- if (previousPath.join(".") !== newPath.join(".")) {
73
- previousPath = [model.id, ...previousPath];
74
- newPath = [model.id, ...newPath];
70
+ const { model, previousPath: previousFieldPath, newPath: newFieldPath } = args;
71
+ if (previousFieldPath.join(".") !== newFieldPath.join(".")) {
72
+ const { id: ctId } = model;
73
+ const previousPath = [ctId, ...previousFieldPath];
74
+ const newPath = [ctId, ...newFieldPath];
75
75
  const crUpdates = [];
76
76
  const customTypes = await this.readAllCustomTypes();
77
77
  updateCustomTypeContentRelationships({
@@ -309,54 +309,113 @@ const InferSliceResponse = z.object({
309
309
  langSmithUrl: z.string().url().optional()
310
310
  });
311
311
  function updateCRCustomType(args) {
312
- const [previousCustomTypeId, previousFieldId] = args.previousPath;
313
- const [newCustomTypeId, newFieldId] = args.newPath;
314
- if (!previousCustomTypeId || !newCustomTypeId) {
315
- throw new Error("Could not find a customtype id in previousPath and/or newPath, which should not be possible.");
312
+ const previousPath = getPathIds(args.previousPath);
313
+ const newPath = getPathIds(args.newPath);
314
+ if (!previousPath.customTypeId || !newPath.customTypeId) {
315
+ throw new Error(`Could not find a customtype id in previousPath (${args.previousPath.join(".")}) and/or newPath (${args.newPath.join(".")}), which should not be possible.`);
316
316
  }
317
- if (!previousFieldId || !newFieldId) {
318
- throw new Error("Could not find a field id in previousPath and/or newPath, which should not be possible.");
317
+ if (!previousPath.fieldId || !newPath.fieldId) {
318
+ throw new Error(`Could not find a field id in previousPath (${args.previousPath.join(".")}) and/or newPath (${args.newPath.join(".")}), which should not be possible.`);
319
319
  }
320
320
  const customType = shallowCloneIfObject(args.customType);
321
- if (typeof customType === "string" || !customType.fields) {
321
+ if (typeof customType === "string") {
322
322
  return customType;
323
323
  }
324
- const matchedCustomTypeId = customType.id === previousCustomTypeId;
325
- const newFields = customType.fields.map((fieldArg) => {
326
- const customTypeField = shallowCloneIfObject(fieldArg);
327
- if (typeof customTypeField === "string") {
328
- if (matchedCustomTypeId && customTypeField === previousFieldId && customTypeField !== newFieldId) {
329
- return newFieldId;
324
+ const matchedCustomTypeId = customType.id === previousPath.customTypeId;
325
+ return {
326
+ ...customType,
327
+ fields: customType.fields.map((fieldArg) => {
328
+ const customTypeField = shallowCloneIfObject(fieldArg);
329
+ if (typeof customTypeField === "string") {
330
+ if (matchedCustomTypeId && customTypeField === previousPath.fieldId && customTypeField !== newPath.fieldId) {
331
+ return newPath.fieldId;
332
+ }
333
+ return customTypeField;
330
334
  }
331
- return customTypeField;
332
- }
333
- if (matchedCustomTypeId && customTypeField.id === previousFieldId && customTypeField.id !== newFieldId) {
334
- customTypeField.id = newFieldId;
335
+ if (matchedCustomTypeId && customTypeField.id === previousPath.fieldId && customTypeField.id !== newPath.fieldId) {
336
+ customTypeField.id = newPath.fieldId;
337
+ }
338
+ if ("fields" in customTypeField) {
339
+ if (!previousPath.groupId && !newPath.groupId && customTypeField.id === previousPath.fieldId && customTypeField.id !== newPath.fieldId) {
340
+ return newPath.fieldId;
341
+ }
342
+ const matchedGroupId = customTypeField.id === previousPath.groupId;
343
+ if (previousPath.groupId && newPath.groupId && matchedGroupId && customTypeField.id !== newPath.groupId) {
344
+ customTypeField.id = newPath.groupId;
345
+ }
346
+ return {
347
+ ...customTypeField,
348
+ fields: customTypeField.fields.map((groupFieldArg) => {
349
+ const groupField = shallowCloneIfObject(groupFieldArg);
350
+ if (typeof groupField === "string") {
351
+ if (matchedGroupId && groupField === previousPath.fieldId && groupField !== newPath.fieldId) {
352
+ return newPath.fieldId;
353
+ }
354
+ return groupField;
355
+ }
356
+ return {
357
+ ...groupField,
358
+ fields: updateContentRelationshipFields({
359
+ customtypes: groupField.customtypes,
360
+ previousPath,
361
+ newPath
362
+ })
363
+ };
364
+ })
365
+ };
366
+ }
367
+ return {
368
+ ...customTypeField,
369
+ customtypes: updateContentRelationshipFields({
370
+ customtypes: customTypeField.customtypes,
371
+ previousPath,
372
+ newPath
373
+ })
374
+ };
375
+ })
376
+ };
377
+ }
378
+ function updateContentRelationshipFields(args) {
379
+ const { customtypes, previousPath, newPath } = args;
380
+ return customtypes.map((nestedCtArg) => {
381
+ const nestedCt = shallowCloneIfObject(nestedCtArg);
382
+ if (typeof nestedCt === "string" || // Since we are entering a new custom type, if the previous id
383
+ // doesn't match, we can return early, because it's not the
384
+ // custom type we are looking for.
385
+ nestedCt.id !== previousPath.customTypeId) {
386
+ return nestedCt;
335
387
  }
336
388
  return {
337
- ...customTypeField,
338
- customtypes: customTypeField.customtypes.map((customTypeArg) => {
339
- const nestedCustomType = shallowCloneIfObject(customTypeArg);
340
- if (typeof nestedCustomType === "string" || !nestedCustomType.fields || // Since we are on the last level, if we don't start matching right
341
- // at the custom type id, we can return exit early because it's not
342
- // a match.
343
- nestedCustomType.id !== previousCustomTypeId) {
344
- return nestedCustomType;
389
+ ...nestedCt,
390
+ fields: nestedCt.fields.map((nestedCtFieldArg) => {
391
+ const nestedCtField = shallowCloneIfObject(nestedCtFieldArg);
392
+ if (typeof nestedCtField === "string") {
393
+ if (nestedCtField === previousPath.fieldId && nestedCtField !== newPath.fieldId) {
394
+ return newPath.fieldId;
395
+ }
396
+ return nestedCtField;
397
+ }
398
+ if (nestedCtField.id === previousPath.fieldId && nestedCtField.id !== newPath.fieldId) {
399
+ nestedCtField.id = newPath.fieldId;
400
+ }
401
+ if (!previousPath.groupId || !newPath.groupId || nestedCtField.id !== previousPath.groupId) {
402
+ return nestedCtField;
403
+ }
404
+ if (nestedCtField.id !== newPath.groupId) {
405
+ nestedCtField.id = newPath.groupId;
345
406
  }
346
407
  return {
347
- ...nestedCustomType,
348
- fields: nestedCustomType.fields.map((fieldArg2) => {
349
- const nestedCustomTypeField = shallowCloneIfObject(fieldArg2);
350
- if (nestedCustomTypeField === previousFieldId && nestedCustomTypeField !== newFieldId) {
351
- return newFieldId;
408
+ ...nestedCtField,
409
+ fields: nestedCtField.fields.map((nestedCtGroupFieldId) => {
410
+ if (nestedCtGroupFieldId === previousPath.fieldId && nestedCtGroupFieldId !== newPath.fieldId) {
411
+ return newPath.fieldId;
352
412
  }
353
- return nestedCustomTypeField;
413
+ return nestedCtGroupFieldId;
354
414
  })
355
415
  };
356
416
  })
357
417
  };
358
418
  });
359
- return { ...customType, fields: newFields };
360
419
  }
361
420
  function updateFieldContentRelationships(args) {
362
421
  var _a, _b;
@@ -394,7 +453,7 @@ function updateSharedSliceContentRelationships(args) {
394
453
  const { models, previousPath, newPath, onUpdate } = args;
395
454
  for (const { model: slice } of models) {
396
455
  const updateSlice = traverseSharedSlice({
397
- path: ["."],
456
+ path: [],
398
457
  slice,
399
458
  onField: ({ field }) => {
400
459
  return updateFieldContentRelationships({
@@ -409,6 +468,22 @@ function updateSharedSliceContentRelationships(args) {
409
468
  }
410
469
  }
411
470
  }
471
+ function getPathIds(path) {
472
+ if (path.length < 2) {
473
+ throw new Error(`Unexpected path length ${path.length}. Expected at least 2 segments (got: ${path.join(".")}).`);
474
+ }
475
+ const [customTypeId, groupOrFieldId, fieldId] = path;
476
+ return {
477
+ customTypeId,
478
+ /**
479
+ * Id of a changed group. If it's defined, it means that a group or a field
480
+ * inside a group had its API ID renamed. It's defined when the path has a
481
+ * third element (e.g. `["customtypeA", "groupA", "fieldA"]`).
482
+ */
483
+ groupId: fieldId ? groupOrFieldId : void 0,
484
+ fieldId: fieldId || groupOrFieldId
485
+ };
486
+ }
412
487
  function isEqualModel(modelA, modelB) {
413
488
  return JSON.stringify(modelA) === JSON.stringify(modelB);
414
489
  }