@fragment-dev/cli 2025.10.8 → 2025.10.10

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.
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  Schema,
9
9
  parseWithError
10
- } from "./chunk-ZNN2E7GU.js";
10
+ } from "./chunk-LPY3PXYU.js";
11
11
  import {
12
12
  formatValidationErrors,
13
13
  logValidationErrors
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Schema,
3
3
  parseWithError
4
- } from "./chunk-ZNN2E7GU.js";
4
+ } from "./chunk-LPY3PXYU.js";
5
5
  import {
6
6
  formatValidationErrors
7
7
  } from "./chunk-KVEENL2F.js";
@@ -4626,9 +4626,7 @@ var GroupReconciliationParameters = z.object({
4626
4626
  });
4627
4627
  var SchemaEntryGroup = z.object({
4628
4628
  key: SafeStringSchema,
4629
- value: ParameterizedString,
4630
4629
  description: ParameterizedString.optional(),
4631
- entries: z.array(EntryKey),
4632
4630
  reconciliation: GroupReconciliationParameters.optional()
4633
4631
  });
4634
4632
  var BaseSchema = z.object({
@@ -6327,8 +6325,8 @@ init_cjs_shims();
6327
6325
  var isAccountPathEquivalent = (path1, path2) => {
6328
6326
  return getStructuralPath(path1) === getStructuralPath(path2);
6329
6327
  };
6330
- var validateMinimumSteps = (group) => {
6331
- if (group.entries.length < 2 && group.reconciliation) {
6328
+ var validateMinimumSteps = (group, entries) => {
6329
+ if (entries.length < 2 && group.reconciliation) {
6332
6330
  return [
6333
6331
  {
6334
6332
  message: "Reconciliation Group must contain at least 2 entries",
@@ -6336,7 +6334,7 @@ var validateMinimumSteps = (group) => {
6336
6334
  }
6337
6335
  ];
6338
6336
  }
6339
- if (group.entries.length < 1 && !group.reconciliation) {
6337
+ if (entries.length < 1 && !group.reconciliation) {
6340
6338
  return [
6341
6339
  {
6342
6340
  message: "Group must contain at least 1 entry",
@@ -6346,19 +6344,20 @@ var validateMinimumSteps = (group) => {
6346
6344
  }
6347
6345
  return [];
6348
6346
  };
6349
- var validateUniqueEntries = (group) => {
6350
- const entrySet = new Set(
6351
- group.entries.map((entry) => `${entry.type}:${entry.typeVersion}`)
6352
- );
6353
- if (entrySet.size !== group.entries.length) {
6354
- return [
6355
- {
6356
- message: "Cannot have duplicate entries in the group",
6357
- path: ["entries"]
6347
+ var validateUniqueEntries = (entries) => {
6348
+ const errors = [];
6349
+ entries.forEach((entry, index) => {
6350
+ if (entry.groups) {
6351
+ const groupSet = new Set(entry.groups.map((g) => `${g.key}-${g.value}`));
6352
+ if (groupSet.size !== entry.groups.length) {
6353
+ errors.push({
6354
+ message: "Entry cannot have duplicate groups",
6355
+ path: ["entries", index, "groups"]
6356
+ });
6358
6357
  }
6359
- ];
6360
- }
6361
- return [];
6358
+ }
6359
+ });
6360
+ return errors;
6362
6361
  };
6363
6362
  var validateReconciliationGroupHasClearingAccountPath = (group) => {
6364
6363
  if (group.reconciliation && group.reconciliation.clearingAccountPath.path.trim() === "") {
@@ -6371,26 +6370,12 @@ var validateReconciliationGroupHasClearingAccountPath = (group) => {
6371
6370
  }
6372
6371
  return [];
6373
6372
  };
6374
- var validateEntriesModifyClearingAccount = (group, validatedEntries) => {
6373
+ var validateEntriesModifyClearingAccount = (group, entriesInGroup) => {
6375
6374
  if (!group.reconciliation) {
6376
6375
  return [];
6377
6376
  }
6378
6377
  const clearingAccount = group.reconciliation.clearingAccountPath.path;
6379
- const fullEntries = group.entries.map((entry) => {
6380
- const fullEntry = validatedEntries.types.find(
6381
- (e) => e.type === entry.type && (e.typeVersion ?? 1) === entry.typeVersion
6382
- );
6383
- return fullEntry;
6384
- });
6385
- if (fullEntries.length !== group.entries.length) {
6386
- return [
6387
- {
6388
- message: "All entries in the group must be present in the validated entries",
6389
- path: ["entries"]
6390
- }
6391
- ];
6392
- }
6393
- const entriesMissingClearingAccount = fullEntries.filter(
6378
+ const entriesMissingClearingAccount = entriesInGroup.filter(
6394
6379
  (e) => !e?.lines?.some(
6395
6380
  (l) => isAccountPathEquivalent(l.account.path, clearingAccount)
6396
6381
  )
@@ -6403,28 +6388,6 @@ var validateEntriesModifyClearingAccount = (group, validatedEntries) => {
6403
6388
  }
6404
6389
  return [];
6405
6390
  };
6406
- var validateGroupEntryReferences = (group, validatedEntries) => {
6407
- const errors = [];
6408
- group.entries.forEach((entryRef, index) => {
6409
- const matchingEntry = validatedEntries?.types?.find(
6410
- (entry) => entry.type === entryRef.type && (entry.typeVersion ?? 1) === entryRef.typeVersion
6411
- );
6412
- if (!matchingEntry) {
6413
- errors.push({
6414
- message: `Group entry not found in validated entries: ${entryRef.type}:${entryRef.typeVersion}`,
6415
- path: ["entries", index]
6416
- });
6417
- } else if (!matchingEntry.groups?.some(
6418
- (g) => g.key === group.key && g.value === group.value
6419
- )) {
6420
- errors.push({
6421
- message: `All entries in group ${group.key} must have the group as a parameter`,
6422
- path: ["entries", index]
6423
- });
6424
- }
6425
- });
6426
- return errors;
6427
- };
6428
6391
  var validateClearingAccount = (group, validatedCoA) => {
6429
6392
  if (!group.reconciliation) {
6430
6393
  return [];
@@ -6466,21 +6429,41 @@ var validateClearingAccount = (group, validatedCoA) => {
6466
6429
  );
6467
6430
  return errors;
6468
6431
  };
6469
- var validateGroup = (group, validatedCoA, validatedEntries) => {
6432
+ var setErrorPathPrefix = (errors, index) => {
6433
+ return errors.map((e) => ({
6434
+ ...e,
6435
+ path: ["groups", index, ...e.path]
6436
+ }));
6437
+ };
6438
+ var validateGroup = (group, validatedCoA, validatedEntries, index) => {
6470
6439
  const errors = [];
6471
6440
  const zodErrors = safeGetZodErrors(SchemaEntryGroup, group, []);
6472
- errors.push(...zodErrors);
6441
+ errors.push(...setErrorPathPrefix(zodErrors, index));
6473
6442
  if (errors.length > 0) {
6474
6443
  return errors;
6475
6444
  }
6476
- errors.push(...validateReconciliationGroupHasClearingAccountPath(group));
6477
- errors.push(...validateMinimumSteps(group));
6478
- errors.push(...validateUniqueEntries(group));
6445
+ const entriesInGroup = validatedEntries.types.filter(
6446
+ (e) => e.groups.some((g) => g.key === group.key)
6447
+ );
6448
+ errors.push(
6449
+ ...setErrorPathPrefix(
6450
+ validateReconciliationGroupHasClearingAccountPath(group),
6451
+ index
6452
+ )
6453
+ );
6454
+ errors.push(
6455
+ ...setErrorPathPrefix(validateMinimumSteps(group, entriesInGroup), index)
6456
+ );
6457
+ errors.push(...validateUniqueEntries(validatedEntries.types));
6479
6458
  if (errors.length === 0) {
6480
- errors.push(...validateGroupEntryReferences(group, validatedEntries));
6481
- errors.push(...validateClearingAccount(group, validatedCoA));
6482
6459
  errors.push(
6483
- ...validateEntriesModifyClearingAccount(group, validatedEntries)
6460
+ ...setErrorPathPrefix(validateClearingAccount(group, validatedCoA), index)
6461
+ );
6462
+ errors.push(
6463
+ ...setErrorPathPrefix(
6464
+ validateEntriesModifyClearingAccount(group, entriesInGroup),
6465
+ index
6466
+ )
6484
6467
  );
6485
6468
  }
6486
6469
  return errors;
@@ -6723,7 +6706,6 @@ var Schema = z.object({
6723
6706
  groups: z.array(SchemaEntryGroup).optional()
6724
6707
  }).transform((schema, ctx) => {
6725
6708
  const { chartOfAccounts, ledgerEntries, consistencyConfig, groups } = schema;
6726
- const mergedGroups = groups;
6727
6709
  const { errors, filledIn: validatedLedgerEntries } = transformAndValidateEntries({
6728
6710
  ledgerEntries: ledgerEntries ?? { types: [] },
6729
6711
  validatedCoA: chartOfAccounts
@@ -6735,18 +6717,19 @@ var Schema = z.object({
6735
6717
  path
6736
6718
  })
6737
6719
  );
6738
- if (mergedGroups && mergedGroups.length > 0) {
6739
- mergedGroups.forEach((group, index) => {
6720
+ if (groups && groups.length > 0) {
6721
+ groups.forEach((group, index) => {
6740
6722
  const groupErrors = validateGroup(
6741
6723
  group,
6742
6724
  chartOfAccounts,
6743
- validatedLedgerEntries
6725
+ validatedLedgerEntries,
6726
+ index
6744
6727
  );
6745
6728
  groupErrors.forEach(
6746
6729
  ({ message, path }) => ctx.addIssue({
6747
6730
  code: z.ZodIssueCode.custom,
6748
6731
  message,
6749
- path: ["groups", index, ...path]
6732
+ path
6750
6733
  })
6751
6734
  );
6752
6735
  });
@@ -2,7 +2,7 @@ import {
2
2
  extractSchemaMetadata,
3
3
  isJsonParseError,
4
4
  validateSchemaStructure
5
- } from "./chunk-5UHRJACV.js";
5
+ } from "./chunk-DJ4ZQI4N.js";
6
6
  import {
7
7
  DEFAULT_SCHEMA_PATH
8
8
  } from "./chunk-A4BSWX5D.js";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-HDSQSGJZ.js";
19
19
  import {
20
20
  VerifySchema
21
- } from "./chunk-QYDCICEM.js";
21
+ } from "./chunk-SRF3ITCX.js";
22
22
  import {
23
23
  Workspace
24
24
  } from "./chunk-3LSL4JNW.js";
@@ -66,7 +66,7 @@ import {
66
66
  } from "./chunk-VRHCYGEJ.js";
67
67
  import {
68
68
  GenGraphQL
69
- } from "./chunk-DE4QEPZ2.js";
69
+ } from "./chunk-5IDO4GMW.js";
70
70
  import {
71
71
  init_cjs_shims
72
72
  } from "./chunk-7GH3YGSC.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  GenGraphQL
3
- } from "../chunk-DE4QEPZ2.js";
3
+ } from "../chunk-5IDO4GMW.js";
4
4
  import "../chunk-V6DDQIMM.js";
5
5
  import "../chunk-ODU6I44Y.js";
6
6
  import "../chunk-73ZTML2E.js";
7
- import "../chunk-ZNN2E7GU.js";
7
+ import "../chunk-LPY3PXYU.js";
8
8
  import "../chunk-KVEENL2F.js";
9
9
  import "../chunk-7O3LAZJ4.js";
10
10
  import "../chunk-MR3BCPLV.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  VerifySchema
3
- } from "../chunk-QYDCICEM.js";
4
- import "../chunk-5UHRJACV.js";
3
+ } from "../chunk-SRF3ITCX.js";
4
+ import "../chunk-DJ4ZQI4N.js";
5
5
  import "../chunk-A4BSWX5D.js";
6
- import "../chunk-ZNN2E7GU.js";
6
+ import "../chunk-LPY3PXYU.js";
7
7
  import "../chunk-KVEENL2F.js";
8
8
  import "../chunk-7O3LAZJ4.js";
9
9
  import "../chunk-MR3BCPLV.js";
package/dist/commands.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  COMMANDS
3
- } from "./chunk-LTIFVIJM.js";
3
+ } from "./chunk-XWHF6VO7.js";
4
4
  import "./chunk-ZDE3DZ3I.js";
5
5
  import "./chunk-T3TNAOFS.js";
6
6
  import "./chunk-3BFX3ZQM.js";
7
7
  import "./chunk-LCVLN3SZ.js";
8
8
  import "./chunk-GRMPAF2X.js";
9
9
  import "./chunk-HDSQSGJZ.js";
10
- import "./chunk-QYDCICEM.js";
11
- import "./chunk-5UHRJACV.js";
10
+ import "./chunk-SRF3ITCX.js";
11
+ import "./chunk-DJ4ZQI4N.js";
12
12
  import "./chunk-A4BSWX5D.js";
13
13
  import "./chunk-3LSL4JNW.js";
14
14
  import "./chunk-UOIGY3UB.js";
@@ -28,11 +28,11 @@ import "./chunk-YGEYBIHA.js";
28
28
  import "./chunk-VRHCYGEJ.js";
29
29
  import "./chunk-IVDQ4PQW.js";
30
30
  import "./chunk-UXTOXY2F.js";
31
- import "./chunk-DE4QEPZ2.js";
31
+ import "./chunk-5IDO4GMW.js";
32
32
  import "./chunk-V6DDQIMM.js";
33
33
  import "./chunk-ODU6I44Y.js";
34
34
  import "./chunk-73ZTML2E.js";
35
- import "./chunk-ZNN2E7GU.js";
35
+ import "./chunk-LPY3PXYU.js";
36
36
  import "./chunk-KVEENL2F.js";
37
37
  import "./chunk-7O3LAZJ4.js";
38
38
  import "./chunk-MR3BCPLV.js";
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  COMMANDS
3
- } from "./chunk-LTIFVIJM.js";
3
+ } from "./chunk-XWHF6VO7.js";
4
4
  import "./chunk-ZDE3DZ3I.js";
5
5
  import "./chunk-T3TNAOFS.js";
6
6
  import "./chunk-3BFX3ZQM.js";
7
7
  import "./chunk-LCVLN3SZ.js";
8
8
  import "./chunk-GRMPAF2X.js";
9
9
  import "./chunk-HDSQSGJZ.js";
10
- import "./chunk-QYDCICEM.js";
11
- import "./chunk-5UHRJACV.js";
10
+ import "./chunk-SRF3ITCX.js";
11
+ import "./chunk-DJ4ZQI4N.js";
12
12
  import "./chunk-A4BSWX5D.js";
13
13
  import "./chunk-3LSL4JNW.js";
14
14
  import "./chunk-UOIGY3UB.js";
@@ -28,11 +28,11 @@ import "./chunk-YGEYBIHA.js";
28
28
  import "./chunk-VRHCYGEJ.js";
29
29
  import "./chunk-IVDQ4PQW.js";
30
30
  import "./chunk-UXTOXY2F.js";
31
- import "./chunk-DE4QEPZ2.js";
31
+ import "./chunk-5IDO4GMW.js";
32
32
  import "./chunk-V6DDQIMM.js";
33
33
  import "./chunk-ODU6I44Y.js";
34
34
  import "./chunk-73ZTML2E.js";
35
- import "./chunk-ZNN2E7GU.js";
35
+ import "./chunk-LPY3PXYU.js";
36
36
  import "./chunk-KVEENL2F.js";
37
37
  import "./chunk-7O3LAZJ4.js";
38
38
  import "./chunk-MR3BCPLV.js";
@@ -3,8 +3,8 @@ import {
3
3
  extractSchemaMetadata,
4
4
  isJsonParseError,
5
5
  validateSchemaStructure
6
- } from "../chunk-5UHRJACV.js";
7
- import "../chunk-ZNN2E7GU.js";
6
+ } from "../chunk-DJ4ZQI4N.js";
7
+ import "../chunk-LPY3PXYU.js";
8
8
  import "../chunk-KVEENL2F.js";
9
9
  import "../chunk-7O3LAZJ4.js";
10
10
  import "../chunk-MR3BCPLV.js";
@@ -973,5 +973,5 @@
973
973
  "help": "Generate GraphQL queries from your Schema for your SDK."
974
974
  }
975
975
  },
976
- "version": "2025.10.8"
976
+ "version": "2025.10.10"
977
977
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fragment-dev/cli",
3
- "version": "2025.10.8",
3
+ "version": "2025.10.10",
4
4
  "description": "FRAGMENT CLI",
5
5
  "author": "hello@fragment.dev",
6
6
  "bin": {