@fragment-dev/cli 2026.9.8-1 → 2026.9.8-13

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.
@@ -1239,7 +1239,7 @@ mutation CreatePayment(
1239
1239
  $ik: SafeString!
1240
1240
  $ledgerIk: SafeString!
1241
1241
  $type: SafeString!
1242
- $typeVersion: Int
1242
+ $typeVersion: Int!
1243
1243
  $parameters: JSON
1244
1244
  ) {
1245
1245
  createPayment(
@@ -1253,8 +1253,8 @@ mutation CreatePayment(
1253
1253
  ) {
1254
1254
  __typename
1255
1255
  ... on CreatePaymentResult {
1256
- clientSecret
1257
1256
  payment {
1257
+ clientSecret
1258
1258
  ik
1259
1259
  ledgerId
1260
1260
  status
@@ -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,
@@ -7511,6 +7512,17 @@ var validateGroup = (group, validatedCoA, validatedEntries, index) => {
7511
7512
 
7512
7513
  // ../../libs/schema-validation/utils/transformers/payments.ts
7513
7514
  init_cjs_shims();
7515
+
7516
+ // ../../libs/types/paymentEntryType.ts
7517
+ init_cjs_shims();
7518
+ var PAYMENT_ENTRY_TYPE_PREFIX = "payment";
7519
+ var makePaymentEntryTypePrefix = (paymentType) => (
7520
+ // Both halves are SafeStrings and `_` is not a delimiter character, so the
7521
+ // concatenation is a SafeString without a runtime re-parse.
7522
+ `${PAYMENT_ENTRY_TYPE_PREFIX}_${paymentType}_`
7523
+ );
7524
+
7525
+ // ../../libs/schema-validation/utils/transformers/payments.ts
7514
7526
  var amountMatchesSystemLine = (amount, system) => amount === SYSTEM_LINE_AMOUNT[system];
7515
7527
  var getAccountCategoryOrUndefined = (account) => {
7516
7528
  try {
@@ -7784,6 +7796,26 @@ var validateUniquePaymentTypes = ({
7784
7796
  path: [...pathPrefix, idx, "type"]
7785
7797
  }))
7786
7798
  );
7799
+ var validateReservedPaymentEntryTypes = ({
7800
+ ledgerEntryTypes,
7801
+ paymentTypes
7802
+ }) => {
7803
+ const reservedNamespaces = paymentTypes.map(({ type }) => ({
7804
+ paymentType: type,
7805
+ prefix: makePaymentEntryTypePrefix(type)
7806
+ }));
7807
+ return ledgerEntryTypes.flatMap((entry, idx) => {
7808
+ const reservedBy = reservedNamespaces.find(
7809
+ ({ prefix }) => entry.type.startsWith(prefix)
7810
+ );
7811
+ return reservedBy === void 0 ? [] : [
7812
+ {
7813
+ path: ["types", idx, "type"],
7814
+ message: `Entry (${entry.type}) is in the '${reservedBy.prefix}' namespace reserved for the entries Payment Type (${reservedBy.paymentType}) posts. Rename one of them.`
7815
+ }
7816
+ ];
7817
+ });
7818
+ };
7787
7819
  var transformAndValidatePayments = ({
7788
7820
  payments,
7789
7821
  validatedCoA
@@ -7941,6 +7973,42 @@ var parameterizeSchemaLedgerLineInput = ({
7941
7973
  });
7942
7974
  return fullLine;
7943
7975
  };
7976
+ var enrichSchemaLines = ({
7977
+ lines,
7978
+ entryParameters,
7979
+ accountPathToAccount
7980
+ }) => lines.map((line) => {
7981
+ const parameterizedLine = parameterizeSchemaLedgerLineInput({
7982
+ line,
7983
+ entryParameters
7984
+ });
7985
+ const accountPath = parameterizedLine.account.path;
7986
+ const structuralPath = getStructuralPath(accountPath);
7987
+ const fullParameterizedAccount = accountPathToAccount.get(structuralPath);
7988
+ const account = (
7989
+ // TODO: this makes Steven and Jerry very sad, lets fix it later.
7990
+ fullParameterizedAccount && reparameterizeSchemaLedgerAccountInput({
7991
+ account: fullParameterizedAccount,
7992
+ entryParameters
7993
+ })
7994
+ );
7995
+ const currency = parameterizedLine.currency || account?.currency || { code: "USD" };
7996
+ return {
7997
+ ...parameterizedLine,
7998
+ parameters: parameterizedLine.parameters.concat(
7999
+ account ? account.parameters : []
8000
+ ),
8001
+ // INC-62: We need to use the user-provided path for the account.
8002
+ // Do not assign it to account.path as it's a shared object
8003
+ // across entries.
8004
+ account: {
8005
+ ...account,
8006
+ path: accountPath
8007
+ },
8008
+ accountPath,
8009
+ currency
8010
+ };
8011
+ });
7944
8012
  var SchemaInt96ConditionInput = z.object({
7945
8013
  eq: ParameterizedString.optional(),
7946
8014
  lte: ParameterizedString.optional(),
@@ -8053,6 +8121,23 @@ var SchemaLedgerEntryInput = z.object({
8053
8121
  var SchemaLedgerEntriesInput = z.object({
8054
8122
  types: z.array(SchemaLedgerEntryInput)
8055
8123
  });
8124
+ var enrichJournalEntry = ({
8125
+ entry,
8126
+ accountPathToAccount
8127
+ }) => ({
8128
+ ...entry,
8129
+ conditions: entry.conditions?.map(
8130
+ (condition) => parameterizeSchemaLedgerEntryConditionInput({
8131
+ condition,
8132
+ entryParameters: entry.parameters
8133
+ })
8134
+ ),
8135
+ lines: entry.lines && enrichSchemaLines({
8136
+ lines: entry.lines,
8137
+ entryParameters: entry.parameters,
8138
+ accountPathToAccount
8139
+ })
8140
+ });
8056
8141
  var SchemaPaymentLineInput = SchemaLedgerLineInput.pick({
8057
8142
  key: true,
8058
8143
  account: true,
@@ -8081,6 +8166,33 @@ var SchemaPaymentTypeInput = z.object({
8081
8166
  processing_to_settled: SchemaPaymentEntryInput
8082
8167
  })
8083
8168
  });
8169
+ var enrichPaymentEntry = ({
8170
+ entry,
8171
+ accountPathToAccount
8172
+ }) => ({
8173
+ ...entry,
8174
+ lines: enrichSchemaLines({
8175
+ lines: entry.lines,
8176
+ // Payment entries hold no static parameters — every parameter is supplied
8177
+ // per payment when the entry posts.
8178
+ entryParameters: void 0,
8179
+ accountPathToAccount
8180
+ })
8181
+ });
8182
+ var enrichPaymentType = ({
8183
+ paymentType,
8184
+ accountPathToAccount
8185
+ }) => {
8186
+ const enrichEntry = (entry) => enrichPaymentEntry({ entry, accountPathToAccount });
8187
+ const { processing_to_settled: settled, ...optionalEvents } = paymentType.accounting;
8188
+ return {
8189
+ ...paymentType,
8190
+ accounting: {
8191
+ ...mapValues_default(optionalEvents, (entry) => entry && enrichEntry(entry)),
8192
+ processing_to_settled: enrichEntry(settled)
8193
+ }
8194
+ };
8195
+ };
8084
8196
  var SchemaPaymentsInput = z.object({
8085
8197
  types: z.array(SchemaPaymentTypeInput).min(1, {
8086
8198
  message: "At least one Payment Type is required. Omit `payments` to store a schema without Payment Types."
@@ -8148,6 +8260,16 @@ var Schema = z.object({
8148
8260
  path
8149
8261
  })
8150
8262
  );
8263
+ validateReservedPaymentEntryTypes({
8264
+ ledgerEntryTypes: ledgerEntries?.types ?? [],
8265
+ paymentTypes: payments?.types ?? []
8266
+ }).map((e2) => ({ ...e2, path: ["ledgerEntries", ...e2.path] })).forEach(
8267
+ ({ message, path }) => ctx.addIssue({
8268
+ code: z.ZodIssueCode.custom,
8269
+ message,
8270
+ path
8271
+ })
8272
+ );
8151
8273
  if (groups && groups.length > 0) {
8152
8274
  groups.forEach((group, index) => {
8153
8275
  const groupErrors = validateGroup(
@@ -8165,56 +8287,20 @@ var Schema = z.object({
8165
8287
  );
8166
8288
  });
8167
8289
  }
8290
+ const { accountPathToAccount } = chartOfAccounts;
8291
+ const ledgerEntryTypes = (ledgerEntries?.types ?? []).map(
8292
+ (entry) => enrichJournalEntry({ entry, accountPathToAccount })
8293
+ );
8294
+ const enrichedPayments = payments && {
8295
+ ...payments,
8296
+ types: payments.types.map(
8297
+ (paymentType) => enrichPaymentType({ paymentType, accountPathToAccount })
8298
+ )
8299
+ };
8168
8300
  return {
8169
8301
  ...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
- },
8302
+ ledgerEntries: { types: ledgerEntryTypes },
8303
+ payments: enrichedPayments,
8218
8304
  consistencyConfig: consistencyConfig ?? {
8219
8305
  entries: "eventual"
8220
8306
  }
@@ -3,18 +3,18 @@ import {
3
3
  generateQueryFiles,
4
4
  schemaToEntryDefinitions,
5
5
  validateOutputName
6
- } from "./chunk-FLHLIRQW.js";
6
+ } from "./chunk-JZ773SXY.js";
7
7
  import {
8
8
  Schema,
9
9
  parseWithError
10
- } from "./chunk-62V42D7I.js";
10
+ } from "./chunk-DSF3KRDQ.js";
11
11
  import {
12
12
  formatValidationErrors,
13
13
  logValidationErrors
14
- } from "./chunk-ZZOL34Q7.js";
14
+ } from "./chunk-VYSP73KB.js";
15
15
  import {
16
16
  BadRequestError
17
- } from "./chunk-AT22ZHOC.js";
17
+ } from "./chunk-3AACKVGA.js";
18
18
  import {
19
19
  FragmentCommand,
20
20
  require_lib
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Schema,
3
3
  parseWithError
4
- } from "./chunk-62V42D7I.js";
4
+ } from "./chunk-DSF3KRDQ.js";
5
5
  import {
6
6
  formatValidationErrors
7
- } from "./chunk-ZZOL34Q7.js";
7
+ } from "./chunk-VYSP73KB.js";
8
8
  import {
9
9
  BadRequestError
10
- } from "./chunk-AT22ZHOC.js";
10
+ } from "./chunk-3AACKVGA.js";
11
11
  import {
12
12
  init_cjs_shims
13
13
  } from "./chunk-7GH3YGSC.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  standardQueries
3
- } from "./chunk-RLIHSP7N.js";
3
+ } from "./chunk-4VYFUMLV.js";
4
4
  import {
5
5
  InvalidGraphQlError
6
6
  } from "./chunk-ZMFGVGZP.js";
7
7
  import {
8
8
  getSchemaObjectParameters,
9
9
  getStructuralSubpaths
10
- } from "./chunk-XCOAZ3QX.js";
10
+ } from "./chunk-PUON7HP5.js";
11
11
  import {
12
12
  require_source
13
13
  } from "./chunk-XK2D2Z44.js";
@@ -2,13 +2,13 @@ import {
2
2
  extractSchemaMetadata,
3
3
  isJsonParseError,
4
4
  validateSchemaStructure
5
- } from "./chunk-CJQCWCVJ.js";
5
+ } from "./chunk-ICTREY3N.js";
6
6
  import {
7
7
  DEFAULT_SCHEMA_PATH
8
8
  } from "./chunk-A4BSWX5D.js";
9
9
  import {
10
10
  logValidationErrors
11
- } from "./chunk-ZZOL34Q7.js";
11
+ } from "./chunk-VYSP73KB.js";
12
12
  import {
13
13
  FragmentCommand,
14
14
  require_lib
@@ -3,7 +3,7 @@ import {
3
3
  assert_default,
4
4
  codes,
5
5
  getStringParametersInternal
6
- } from "./chunk-AT22ZHOC.js";
6
+ } from "./chunk-3AACKVGA.js";
7
7
  import {
8
8
  init_cjs_shims
9
9
  } from "./chunk-7GH3YGSC.js";
@@ -27,10 +27,10 @@ import {
27
27
  } from "./chunk-PISSWWTD.js";
28
28
  import {
29
29
  VerifySchema
30
- } from "./chunk-HUY4HCN7.js";
30
+ } from "./chunk-MWVEFIZA.js";
31
31
  import {
32
32
  GenGraphQL
33
- } from "./chunk-2KYSBZOZ.js";
33
+ } from "./chunk-EK7ODN45.js";
34
34
  import {
35
35
  GetSchema
36
36
  } from "./chunk-QHM6HMNG.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BadRequestError
3
- } from "./chunk-AT22ZHOC.js";
3
+ } from "./chunk-3AACKVGA.js";
4
4
  import {
5
5
  require_source
6
6
  } from "./chunk-XK2D2Z44.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  GenGraphQL
3
- } from "../chunk-2KYSBZOZ.js";
4
- import "../chunk-FLHLIRQW.js";
5
- import "../chunk-RLIHSP7N.js";
3
+ } from "../chunk-EK7ODN45.js";
4
+ import "../chunk-JZ773SXY.js";
5
+ import "../chunk-4VYFUMLV.js";
6
6
  import "../chunk-ZMFGVGZP.js";
7
- import "../chunk-62V42D7I.js";
8
- import "../chunk-ZZOL34Q7.js";
9
- import "../chunk-XCOAZ3QX.js";
10
- import "../chunk-AT22ZHOC.js";
7
+ import "../chunk-DSF3KRDQ.js";
8
+ import "../chunk-VYSP73KB.js";
9
+ import "../chunk-PUON7HP5.js";
10
+ import "../chunk-3AACKVGA.js";
11
11
  import "../chunk-W33MLXYW.js";
12
12
  import "../chunk-34NLRFFT.js";
13
13
  import "../chunk-LFCNPXLH.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  VerifySchema
3
- } from "../chunk-HUY4HCN7.js";
4
- import "../chunk-CJQCWCVJ.js";
3
+ } from "../chunk-MWVEFIZA.js";
4
+ import "../chunk-ICTREY3N.js";
5
5
  import "../chunk-A4BSWX5D.js";
6
- import "../chunk-62V42D7I.js";
7
- import "../chunk-ZZOL34Q7.js";
8
- import "../chunk-XCOAZ3QX.js";
9
- import "../chunk-AT22ZHOC.js";
6
+ import "../chunk-DSF3KRDQ.js";
7
+ import "../chunk-VYSP73KB.js";
8
+ import "../chunk-PUON7HP5.js";
9
+ import "../chunk-3AACKVGA.js";
10
10
  import "../chunk-W33MLXYW.js";
11
11
  import "../chunk-34NLRFFT.js";
12
12
  import "../chunk-LFCNPXLH.js";
package/dist/commands.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  COMMANDS
3
- } from "./chunk-XDGWDO25.js";
3
+ } from "./chunk-VQNMUMPN.js";
4
4
  import "./chunk-EXE547EZ.js";
5
5
  import "./chunk-MINQOVLY.js";
6
6
  import "./chunk-3NFTHWMS.js";
@@ -10,17 +10,17 @@ import "./chunk-AZBIIMD6.js";
10
10
  import "./chunk-YVGWCI6H.js";
11
11
  import "./chunk-YO6AXWBO.js";
12
12
  import "./chunk-PISSWWTD.js";
13
- import "./chunk-HUY4HCN7.js";
14
- import "./chunk-CJQCWCVJ.js";
13
+ import "./chunk-MWVEFIZA.js";
14
+ import "./chunk-ICTREY3N.js";
15
15
  import "./chunk-A4BSWX5D.js";
16
- import "./chunk-2KYSBZOZ.js";
17
- import "./chunk-FLHLIRQW.js";
18
- import "./chunk-RLIHSP7N.js";
16
+ import "./chunk-EK7ODN45.js";
17
+ import "./chunk-JZ773SXY.js";
18
+ import "./chunk-4VYFUMLV.js";
19
19
  import "./chunk-ZMFGVGZP.js";
20
- import "./chunk-62V42D7I.js";
21
- import "./chunk-ZZOL34Q7.js";
22
- import "./chunk-XCOAZ3QX.js";
23
- import "./chunk-AT22ZHOC.js";
20
+ import "./chunk-DSF3KRDQ.js";
21
+ import "./chunk-VYSP73KB.js";
22
+ import "./chunk-PUON7HP5.js";
23
+ import "./chunk-3AACKVGA.js";
24
24
  import "./chunk-QHM6HMNG.js";
25
25
  import "./chunk-BYZNYEGH.js";
26
26
  import "./chunk-52KK5CBJ.js";
package/dist/graphql.js CHANGED
@@ -8,11 +8,11 @@ import {
8
8
  isValidGraphQlName,
9
9
  schemaToEntryDefinitions,
10
10
  validateOutputName
11
- } from "./chunk-FLHLIRQW.js";
12
- import "./chunk-RLIHSP7N.js";
11
+ } from "./chunk-JZ773SXY.js";
12
+ import "./chunk-4VYFUMLV.js";
13
13
  import "./chunk-ZMFGVGZP.js";
14
- import "./chunk-XCOAZ3QX.js";
15
- import "./chunk-AT22ZHOC.js";
14
+ import "./chunk-PUON7HP5.js";
15
+ import "./chunk-3AACKVGA.js";
16
16
  import "./chunk-XK2D2Z44.js";
17
17
  import "./chunk-7K4RMTU4.js";
18
18
  import "./chunk-7GH3YGSC.js";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  COMMANDS
3
- } from "./chunk-XDGWDO25.js";
3
+ } from "./chunk-VQNMUMPN.js";
4
4
  import "./chunk-EXE547EZ.js";
5
5
  import "./chunk-MINQOVLY.js";
6
6
  import "./chunk-3NFTHWMS.js";
@@ -10,17 +10,17 @@ import "./chunk-AZBIIMD6.js";
10
10
  import "./chunk-YVGWCI6H.js";
11
11
  import "./chunk-YO6AXWBO.js";
12
12
  import "./chunk-PISSWWTD.js";
13
- import "./chunk-HUY4HCN7.js";
14
- import "./chunk-CJQCWCVJ.js";
13
+ import "./chunk-MWVEFIZA.js";
14
+ import "./chunk-ICTREY3N.js";
15
15
  import "./chunk-A4BSWX5D.js";
16
- import "./chunk-2KYSBZOZ.js";
17
- import "./chunk-FLHLIRQW.js";
18
- import "./chunk-RLIHSP7N.js";
16
+ import "./chunk-EK7ODN45.js";
17
+ import "./chunk-JZ773SXY.js";
18
+ import "./chunk-4VYFUMLV.js";
19
19
  import "./chunk-ZMFGVGZP.js";
20
- import "./chunk-62V42D7I.js";
21
- import "./chunk-ZZOL34Q7.js";
22
- import "./chunk-XCOAZ3QX.js";
23
- import "./chunk-AT22ZHOC.js";
20
+ import "./chunk-DSF3KRDQ.js";
21
+ import "./chunk-VYSP73KB.js";
22
+ import "./chunk-PUON7HP5.js";
23
+ import "./chunk-3AACKVGA.js";
24
24
  import "./chunk-QHM6HMNG.js";
25
25
  import "./chunk-BYZNYEGH.js";
26
26
  import "./chunk-52KK5CBJ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  standardQueries
3
- } from "../chunk-RLIHSP7N.js";
3
+ } from "../chunk-4VYFUMLV.js";
4
4
  import "../chunk-7GH3YGSC.js";
5
5
  export {
6
6
  standardQueries
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  formatValidationErrors,
3
3
  logValidationErrors
4
- } from "../chunk-ZZOL34Q7.js";
5
- import "../chunk-AT22ZHOC.js";
4
+ } from "../chunk-VYSP73KB.js";
5
+ import "../chunk-3AACKVGA.js";
6
6
  import "../chunk-XK2D2Z44.js";
7
7
  import "../chunk-L7ZGDLYU.js";
8
8
  import "../chunk-7GH3YGSC.js";
@@ -3,11 +3,11 @@ import {
3
3
  extractSchemaMetadata,
4
4
  isJsonParseError,
5
5
  validateSchemaStructure
6
- } from "../chunk-CJQCWCVJ.js";
7
- import "../chunk-62V42D7I.js";
8
- import "../chunk-ZZOL34Q7.js";
9
- import "../chunk-XCOAZ3QX.js";
10
- import "../chunk-AT22ZHOC.js";
6
+ } from "../chunk-ICTREY3N.js";
7
+ import "../chunk-DSF3KRDQ.js";
8
+ import "../chunk-VYSP73KB.js";
9
+ import "../chunk-PUON7HP5.js";
10
+ import "../chunk-3AACKVGA.js";
11
11
  import "../chunk-XK2D2Z44.js";
12
12
  import "../chunk-L7ZGDLYU.js";
13
13
  import "../chunk-7GH3YGSC.js";
@@ -1096,5 +1096,5 @@
1096
1096
  "help": "Generate GraphQL queries from your Schema for your SDK."
1097
1097
  }
1098
1098
  },
1099
- "version": "2026.9.8-1"
1099
+ "version": "2026.9.8-13"
1100
1100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fragment-dev/cli",
3
- "version": "2026.9.8-1",
3
+ "version": "2026.9.8-13",
4
4
  "description": "FRAGMENT CLI",
5
5
  "author": "hello@fragment.dev",
6
6
  "bin": {