@fragment-dev/cli 2026.9.8-9 → 2026.9.9-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 (58) hide show
  1. package/dist/{chunk-TLKQCSIZ.js → chunk-2SKJI4RI.js} +1 -1
  2. package/dist/{chunk-62V42D7I.js → chunk-2UUZOEA7.js} +204 -59
  3. package/dist/{chunk-AT22ZHOC.js → chunk-3AACKVGA.js} +1188 -42
  4. package/dist/{chunk-BPL6HXNE.js → chunk-44WNS3KY.js} +1 -1
  5. package/dist/{chunk-7GZBRFFZ.js → chunk-4BGR7UYB.js} +1 -1
  6. package/dist/{chunk-KOZXIOXI.js → chunk-4VYFUMLV.js} +1 -1
  7. package/dist/{chunk-OP6Y57XW.js → chunk-6L4WGBKA.js} +1 -1
  8. package/dist/{chunk-MINQOVLY.js → chunk-C6XIABYY.js} +1 -1
  9. package/dist/{chunk-2ISV7MGN.js → chunk-D4GPZGZ4.js} +1 -1
  10. package/dist/{chunk-YO6AXWBO.js → chunk-DF3NICEM.js} +1 -1
  11. package/dist/{chunk-7GDGRCLH.js → chunk-EAD3B7YV.js} +7 -0
  12. package/dist/{chunk-ETQYRERW.js → chunk-EJNEAWYE.js} +19 -19
  13. package/dist/{chunk-QCRQCQ5P.js → chunk-FXOC6ORG.js} +1 -1
  14. package/dist/{chunk-2CNCDMJW.js → chunk-JT3HFAGU.js} +1 -1
  15. package/dist/{chunk-AJHJ77OG.js → chunk-JZ773SXY.js} +2 -2
  16. package/dist/{chunk-AZBIIMD6.js → chunk-K7KCVZP2.js} +1 -1
  17. package/dist/{chunk-HUY4HCN7.js → chunk-KNFHXSE5.js} +2 -2
  18. package/dist/{chunk-YVGWCI6H.js → chunk-MNVCFR3U.js} +1 -1
  19. package/dist/{chunk-4TMMKDO7.js → chunk-NEF7WXIH.js} +1 -1
  20. package/dist/{chunk-HW7EKKCA.js → chunk-OFVJQHSU.js} +1 -1
  21. package/dist/{chunk-XCOAZ3QX.js → chunk-PUON7HP5.js} +1 -1
  22. package/dist/{chunk-3NFTHWMS.js → chunk-QC7XM3CQ.js} +1 -1
  23. package/dist/{chunk-GQ6U2I54.js → chunk-QIAV4NC3.js} +1 -1
  24. package/dist/{chunk-I7JOAHOD.js → chunk-RWZJWPVV.js} +1 -1
  25. package/dist/{chunk-QHM6HMNG.js → chunk-T2BBIXGB.js} +1 -1
  26. package/dist/{chunk-ZZOL34Q7.js → chunk-VYSP73KB.js} +1 -1
  27. package/dist/{chunk-CJQCWCVJ.js → chunk-WL5BF26E.js} +3 -3
  28. package/dist/{chunk-PRYAXP4C.js → chunk-YY2ZOA2F.js} +1 -1
  29. package/dist/{chunk-MBCLPFGS.js → chunk-ZPKRHWC3.js} +4 -4
  30. package/dist/commands/add-ledger-entry.js +3 -3
  31. package/dist/commands/create-custom-link.js +3 -3
  32. package/dist/commands/create-ledger.js +3 -3
  33. package/dist/commands/delete-custom-txs.js +3 -3
  34. package/dist/commands/delete-ledger.js +3 -3
  35. package/dist/commands/delete-schema.js +3 -3
  36. package/dist/commands/gen-graphql.js +7 -7
  37. package/dist/commands/get-schema.js +3 -3
  38. package/dist/commands/migrate-ledger-entry.js +3 -3
  39. package/dist/commands/query/ledgerAccounts.js +3 -3
  40. package/dist/commands/query/ledgers.js +3 -3
  41. package/dist/commands/query/schema.js +3 -3
  42. package/dist/commands/query/schemas.js +3 -3
  43. package/dist/commands/reverse-ledger-entry.js +3 -3
  44. package/dist/commands/store-schema.js +3 -3
  45. package/dist/commands/token.js +3 -3
  46. package/dist/commands/update-ledger-account.js +3 -3
  47. package/dist/commands/verify-schema.js +6 -6
  48. package/dist/commands/workspace.js +3 -3
  49. package/dist/commands.js +29 -29
  50. package/dist/graphql.js +4 -4
  51. package/dist/index.js +29 -29
  52. package/dist/lib/authenticatedCommand.js +2 -2
  53. package/dist/lib/sdk.js +3 -1
  54. package/dist/queries/standard-queries.js +1 -1
  55. package/dist/utils/formatValidationErrors.js +2 -2
  56. package/dist/utils/schemaValidation.js +5 -5
  57. package/oclif.manifest.json +1 -1
  58. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-I7JOAHOD.js";
3
+ } from "./chunk-RWZJWPVV.js";
4
4
  import {
5
5
  require_lib
6
6
  } from "./chunk-W33MLXYW.js";
@@ -5,7 +5,7 @@ import {
5
5
  getStructuralPath,
6
6
  getStructuralSubpaths,
7
7
  getSubpaths
8
- } from "./chunk-XCOAZ3QX.js";
8
+ } from "./chunk-PUON7HP5.js";
9
9
  import {
10
10
  BadRequestError,
11
11
  CurrencyMatchInputSchema,
@@ -20,9 +20,10 @@ import {
20
20
  assert_default,
21
21
  currencyCodes,
22
22
  getStringParameters,
23
+ mapValues_default,
23
24
  safe,
24
25
  z
25
- } from "./chunk-AT22ZHOC.js";
26
+ } from "./chunk-3AACKVGA.js";
26
27
  import {
27
28
  __commonJS,
28
29
  __toESM,
@@ -4700,13 +4701,31 @@ var SceneEntrySchema = z.object({
4700
4701
  typeVersion: z.number().int().positive().optional(),
4701
4702
  parameters: z.record(SafeRecordKey, z.string())
4702
4703
  });
4703
- var SceneEventSchema = z.object({
4704
+ var ScenePaymentSchema = z.object({
4705
+ ik: z.string(),
4706
+ type: z.string(),
4707
+ typeVersion: z.number().int().positive().optional(),
4708
+ parameters: z.record(SafeRecordKey, z.string())
4709
+ });
4710
+ var SceneLedgerEventSchema = z.object({
4704
4711
  eventType: z.literal("entry"),
4705
4712
  entry: SceneEntrySchema
4706
4713
  });
4714
+ var ScenePaymentEventSchema = z.object({
4715
+ eventType: z.literal("payment"),
4716
+ payment: z.object({
4717
+ ik: z.string(),
4718
+ event: PaymentEventKeySchema
4719
+ })
4720
+ });
4721
+ var SceneEventSchema = z.discriminatedUnion("eventType", [
4722
+ SceneLedgerEventSchema,
4723
+ ScenePaymentEventSchema
4724
+ ]);
4707
4725
  var BaseScene = z.object({
4708
4726
  name: z.string(),
4709
- events: z.array(SceneEventSchema)
4727
+ events: z.array(SceneEventSchema),
4728
+ payments: z.array(ScenePaymentSchema).optional()
4710
4729
  });
4711
4730
  var EntryKey = z.object({
4712
4731
  type: SafeStringSchema,
@@ -7511,6 +7530,17 @@ var validateGroup = (group, validatedCoA, validatedEntries, index) => {
7511
7530
 
7512
7531
  // ../../libs/schema-validation/utils/transformers/payments.ts
7513
7532
  init_cjs_shims();
7533
+
7534
+ // ../../libs/types/paymentEntryType.ts
7535
+ init_cjs_shims();
7536
+ var PAYMENT_ENTRY_TYPE_PREFIX = "payment";
7537
+ var makePaymentEntryTypePrefix = (paymentType) => (
7538
+ // Both halves are SafeStrings and `_` is not a delimiter character, so the
7539
+ // concatenation is a SafeString without a runtime re-parse.
7540
+ `${PAYMENT_ENTRY_TYPE_PREFIX}_${paymentType}_`
7541
+ );
7542
+
7543
+ // ../../libs/schema-validation/utils/transformers/payments.ts
7514
7544
  var amountMatchesSystemLine = (amount, system) => amount === SYSTEM_LINE_AMOUNT[system];
7515
7545
  var getAccountCategoryOrUndefined = (account) => {
7516
7546
  try {
@@ -7784,6 +7814,26 @@ var validateUniquePaymentTypes = ({
7784
7814
  path: [...pathPrefix, idx, "type"]
7785
7815
  }))
7786
7816
  );
7817
+ var validateReservedPaymentEntryTypes = ({
7818
+ ledgerEntryTypes,
7819
+ paymentTypes
7820
+ }) => {
7821
+ const reservedNamespaces = paymentTypes.map(({ type }) => ({
7822
+ paymentType: type,
7823
+ prefix: makePaymentEntryTypePrefix(type)
7824
+ }));
7825
+ return ledgerEntryTypes.flatMap((entry, idx) => {
7826
+ const reservedBy = reservedNamespaces.find(
7827
+ ({ prefix }) => entry.type.startsWith(prefix)
7828
+ );
7829
+ return reservedBy === void 0 ? [] : [
7830
+ {
7831
+ path: ["types", idx, "type"],
7832
+ message: `Entry (${entry.type}) is in the '${reservedBy.prefix}' namespace reserved for the entries Payment Type (${reservedBy.paymentType}) posts. Rename one of them.`
7833
+ }
7834
+ ];
7835
+ });
7836
+ };
7787
7837
  var transformAndValidatePayments = ({
7788
7838
  payments,
7789
7839
  validatedCoA
@@ -7941,6 +7991,42 @@ var parameterizeSchemaLedgerLineInput = ({
7941
7991
  });
7942
7992
  return fullLine;
7943
7993
  };
7994
+ var enrichSchemaLines = ({
7995
+ lines,
7996
+ entryParameters,
7997
+ accountPathToAccount
7998
+ }) => lines.map((line) => {
7999
+ const parameterizedLine = parameterizeSchemaLedgerLineInput({
8000
+ line,
8001
+ entryParameters
8002
+ });
8003
+ const accountPath = parameterizedLine.account.path;
8004
+ const structuralPath = getStructuralPath(accountPath);
8005
+ const fullParameterizedAccount = accountPathToAccount.get(structuralPath);
8006
+ const account = (
8007
+ // TODO: this makes Steven and Jerry very sad, lets fix it later.
8008
+ fullParameterizedAccount && reparameterizeSchemaLedgerAccountInput({
8009
+ account: fullParameterizedAccount,
8010
+ entryParameters
8011
+ })
8012
+ );
8013
+ const currency = parameterizedLine.currency || account?.currency || { code: "USD" };
8014
+ return {
8015
+ ...parameterizedLine,
8016
+ parameters: parameterizedLine.parameters.concat(
8017
+ account ? account.parameters : []
8018
+ ),
8019
+ // INC-62: We need to use the user-provided path for the account.
8020
+ // Do not assign it to account.path as it's a shared object
8021
+ // across entries.
8022
+ account: {
8023
+ ...account,
8024
+ path: accountPath
8025
+ },
8026
+ accountPath,
8027
+ currency
8028
+ };
8029
+ });
7944
8030
  var SchemaInt96ConditionInput = z.object({
7945
8031
  eq: ParameterizedString.optional(),
7946
8032
  lte: ParameterizedString.optional(),
@@ -8053,6 +8139,23 @@ var SchemaLedgerEntryInput = z.object({
8053
8139
  var SchemaLedgerEntriesInput = z.object({
8054
8140
  types: z.array(SchemaLedgerEntryInput)
8055
8141
  });
8142
+ var enrichJournalEntry = ({
8143
+ entry,
8144
+ accountPathToAccount
8145
+ }) => ({
8146
+ ...entry,
8147
+ conditions: entry.conditions?.map(
8148
+ (condition) => parameterizeSchemaLedgerEntryConditionInput({
8149
+ condition,
8150
+ entryParameters: entry.parameters
8151
+ })
8152
+ ),
8153
+ lines: entry.lines && enrichSchemaLines({
8154
+ lines: entry.lines,
8155
+ entryParameters: entry.parameters,
8156
+ accountPathToAccount
8157
+ })
8158
+ });
8056
8159
  var SchemaPaymentLineInput = SchemaLedgerLineInput.pick({
8057
8160
  key: true,
8058
8161
  account: true,
@@ -8081,6 +8184,33 @@ var SchemaPaymentTypeInput = z.object({
8081
8184
  processing_to_settled: SchemaPaymentEntryInput
8082
8185
  })
8083
8186
  });
8187
+ var enrichPaymentEntry = ({
8188
+ entry,
8189
+ accountPathToAccount
8190
+ }) => ({
8191
+ ...entry,
8192
+ lines: enrichSchemaLines({
8193
+ lines: entry.lines,
8194
+ // Payment entries hold no static parameters — every parameter is supplied
8195
+ // per payment when the entry posts.
8196
+ entryParameters: void 0,
8197
+ accountPathToAccount
8198
+ })
8199
+ });
8200
+ var enrichPaymentType = ({
8201
+ paymentType,
8202
+ accountPathToAccount
8203
+ }) => {
8204
+ const enrichEntry = (entry) => enrichPaymentEntry({ entry, accountPathToAccount });
8205
+ const { processing_to_settled: settled, ...optionalEvents } = paymentType.accounting;
8206
+ return {
8207
+ ...paymentType,
8208
+ accounting: {
8209
+ ...mapValues_default(optionalEvents, (entry) => entry && enrichEntry(entry)),
8210
+ processing_to_settled: enrichEntry(settled)
8211
+ }
8212
+ };
8213
+ };
8084
8214
  var SchemaPaymentsInput = z.object({
8085
8215
  types: z.array(SchemaPaymentTypeInput).min(1, {
8086
8216
  message: "At least one Payment Type is required. Omit `payments` to store a schema without Payment Types."
@@ -8090,20 +8220,61 @@ var LedgerConsistencyConfigSchema = ConsistencyConfigSchema(
8090
8220
  ["entries"],
8091
8221
  {}
8092
8222
  );
8223
+ var SceneParameters = z.unknown().refine((value) => typeof value === "object", {
8224
+ message: "Parameters must be an object"
8225
+ }).transform((value) => z.record(z.string()).parse(value));
8093
8226
  var SceneLedgerEntry = z.object({
8094
8227
  type: SafeStringSchema,
8095
8228
  typeVersion: z.optional(z.number().int().positive()),
8096
- parameters: z.unknown().refine((value) => typeof value === "object", {
8097
- message: "Parameters must be an object"
8098
- }).transform((value) => z.record(z.string()).parse(value))
8229
+ parameters: SceneParameters
8099
8230
  });
8100
- var SceneEvent = z.object({
8101
- eventType: z.literal("entry"),
8102
- entry: SceneLedgerEntry
8231
+ var ScenePayment = z.object({
8232
+ ik: SafeStringSchema,
8233
+ type: SafeStringSchema,
8234
+ typeVersion: z.optional(z.number().int().positive()),
8235
+ parameters: SceneParameters
8236
+ });
8237
+ var ScenePaymentEvent = z.object({
8238
+ ik: SafeStringSchema,
8239
+ event: PaymentEventKeySchema
8103
8240
  });
8241
+ var SceneEvent = z.object({
8242
+ eventType: z.enum(["entry", "payment"]),
8243
+ entry: z.optional(SceneLedgerEntry),
8244
+ payment: z.optional(ScenePaymentEvent)
8245
+ }).pipe(
8246
+ z.discriminatedUnion("eventType", [
8247
+ z.object({ eventType: z.literal("entry"), entry: SceneLedgerEntry }),
8248
+ z.object({ eventType: z.literal("payment"), payment: ScenePaymentEvent })
8249
+ ])
8250
+ );
8104
8251
  var Scene = z.object({
8105
8252
  name: SafeStringSchema,
8106
- events: z.array(SceneEvent)
8253
+ events: z.array(SceneEvent),
8254
+ payments: z.optional(z.array(ScenePayment))
8255
+ }).superRefine((scene, ctx) => {
8256
+ const declaredIks = /* @__PURE__ */ new Set();
8257
+ (scene.payments ?? []).forEach((payment, index) => {
8258
+ if (declaredIks.has(payment.ik)) {
8259
+ ctx.addIssue({
8260
+ code: z.ZodIssueCode.custom,
8261
+ path: ["payments", index, "ik"],
8262
+ message: `Duplicate simulated payment ik '${payment.ik}' in Scene '${scene.name}'.`
8263
+ });
8264
+ }
8265
+ declaredIks.add(payment.ik);
8266
+ });
8267
+ scene.events.forEach((event, index) => {
8268
+ if (event.eventType !== "payment")
8269
+ return;
8270
+ if (declaredIks.has(event.payment.ik))
8271
+ return;
8272
+ ctx.addIssue({
8273
+ code: z.ZodIssueCode.custom,
8274
+ path: ["events", index, "payment", "ik"],
8275
+ message: `Scene '${scene.name}' has an event for simulated payment '${event.payment.ik}', which it does not declare in \`payments\`.`
8276
+ });
8277
+ });
8107
8278
  });
8108
8279
  var Schema = z.object({
8109
8280
  name: z.string().optional(),
@@ -8148,6 +8319,16 @@ var Schema = z.object({
8148
8319
  path
8149
8320
  })
8150
8321
  );
8322
+ validateReservedPaymentEntryTypes({
8323
+ ledgerEntryTypes: ledgerEntries?.types ?? [],
8324
+ paymentTypes: payments?.types ?? []
8325
+ }).map((e2) => ({ ...e2, path: ["ledgerEntries", ...e2.path] })).forEach(
8326
+ ({ message, path }) => ctx.addIssue({
8327
+ code: z.ZodIssueCode.custom,
8328
+ message,
8329
+ path
8330
+ })
8331
+ );
8151
8332
  if (groups && groups.length > 0) {
8152
8333
  groups.forEach((group, index) => {
8153
8334
  const groupErrors = validateGroup(
@@ -8165,56 +8346,20 @@ var Schema = z.object({
8165
8346
  );
8166
8347
  });
8167
8348
  }
8349
+ const { accountPathToAccount } = chartOfAccounts;
8350
+ const ledgerEntryTypes = (ledgerEntries?.types ?? []).map(
8351
+ (entry) => enrichJournalEntry({ entry, accountPathToAccount })
8352
+ );
8353
+ const enrichedPayments = payments && {
8354
+ ...payments,
8355
+ types: payments.types.map(
8356
+ (paymentType) => enrichPaymentType({ paymentType, accountPathToAccount })
8357
+ )
8358
+ };
8168
8359
  return {
8169
8360
  ...schema,
8170
- ledgerEntries: {
8171
- types: ledgerEntries?.types.map((entry) => {
8172
- const lines = entry.lines?.map(
8173
- (line) => parameterizeSchemaLedgerLineInput({
8174
- line,
8175
- entryParameters: entry.parameters
8176
- })
8177
- ).map((line) => {
8178
- const accountPath = line.account.path;
8179
- const structuralPath = getStructuralPath(accountPath);
8180
- const fullParameterizedAccount = chartOfAccounts.accountPathToAccount.get(structuralPath);
8181
- const account = (
8182
- // TODO: this makes Steven and Jerry very sad, lets fix it later.
8183
- fullParameterizedAccount && reparameterizeSchemaLedgerAccountInput({
8184
- account: fullParameterizedAccount,
8185
- entryParameters: entry.parameters
8186
- })
8187
- );
8188
- const currency = line.currency || account?.currency || { code: "USD" };
8189
- return {
8190
- ...line,
8191
- parameters: line.parameters.concat(
8192
- account ? account.parameters : []
8193
- ),
8194
- // INC-62: We need to use the user-provided path for the account.
8195
- // Do not assign it to account.path as it's a shared object
8196
- // across entries.
8197
- account: {
8198
- ...account,
8199
- path: accountPath
8200
- },
8201
- accountPath,
8202
- currency
8203
- };
8204
- });
8205
- const conditions = entry.conditions?.map(
8206
- (condition) => parameterizeSchemaLedgerEntryConditionInput({
8207
- condition,
8208
- entryParameters: entry.parameters
8209
- })
8210
- );
8211
- return {
8212
- ...entry,
8213
- conditions,
8214
- lines
8215
- };
8216
- }) ?? []
8217
- },
8361
+ ledgerEntries: { types: ledgerEntryTypes },
8362
+ payments: enrichedPayments,
8218
8363
  consistencyConfig: consistencyConfig ?? {
8219
8364
  entries: "eventual"
8220
8365
  }