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

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.
@@ -3,18 +3,18 @@ import {
3
3
  generateQueryFiles,
4
4
  schemaToEntryDefinitions,
5
5
  validateOutputName
6
- } from "./chunk-JZ773SXY.js";
6
+ } from "./chunk-FLHLIRQW.js";
7
7
  import {
8
8
  Schema,
9
9
  parseWithError
10
- } from "./chunk-DSF3KRDQ.js";
10
+ } from "./chunk-62V42D7I.js";
11
11
  import {
12
12
  formatValidationErrors,
13
13
  logValidationErrors
14
- } from "./chunk-VYSP73KB.js";
14
+ } from "./chunk-ZZOL34Q7.js";
15
15
  import {
16
16
  BadRequestError
17
- } from "./chunk-3AACKVGA.js";
17
+ } from "./chunk-AT22ZHOC.js";
18
18
  import {
19
19
  FragmentCommand,
20
20
  require_lib
@@ -5,7 +5,7 @@ import {
5
5
  getStructuralPath,
6
6
  getStructuralSubpaths,
7
7
  getSubpaths
8
- } from "./chunk-PUON7HP5.js";
8
+ } from "./chunk-XCOAZ3QX.js";
9
9
  import {
10
10
  BadRequestError,
11
11
  CurrencyMatchInputSchema,
@@ -20,10 +20,9 @@ import {
20
20
  assert_default,
21
21
  currencyCodes,
22
22
  getStringParameters,
23
- mapValues_default,
24
23
  safe,
25
24
  z
26
- } from "./chunk-3AACKVGA.js";
25
+ } from "./chunk-AT22ZHOC.js";
27
26
  import {
28
27
  __commonJS,
29
28
  __toESM,
@@ -7512,17 +7511,6 @@ var validateGroup = (group, validatedCoA, validatedEntries, index) => {
7512
7511
 
7513
7512
  // ../../libs/schema-validation/utils/transformers/payments.ts
7514
7513
  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
7526
7514
  var amountMatchesSystemLine = (amount, system) => amount === SYSTEM_LINE_AMOUNT[system];
7527
7515
  var getAccountCategoryOrUndefined = (account) => {
7528
7516
  try {
@@ -7796,26 +7784,6 @@ var validateUniquePaymentTypes = ({
7796
7784
  path: [...pathPrefix, idx, "type"]
7797
7785
  }))
7798
7786
  );
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
- };
7819
7787
  var transformAndValidatePayments = ({
7820
7788
  payments,
7821
7789
  validatedCoA
@@ -7973,42 +7941,6 @@ var parameterizeSchemaLedgerLineInput = ({
7973
7941
  });
7974
7942
  return fullLine;
7975
7943
  };
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
- });
8012
7944
  var SchemaInt96ConditionInput = z.object({
8013
7945
  eq: ParameterizedString.optional(),
8014
7946
  lte: ParameterizedString.optional(),
@@ -8121,23 +8053,6 @@ var SchemaLedgerEntryInput = z.object({
8121
8053
  var SchemaLedgerEntriesInput = z.object({
8122
8054
  types: z.array(SchemaLedgerEntryInput)
8123
8055
  });
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
- });
8141
8056
  var SchemaPaymentLineInput = SchemaLedgerLineInput.pick({
8142
8057
  key: true,
8143
8058
  account: true,
@@ -8166,33 +8081,6 @@ var SchemaPaymentTypeInput = z.object({
8166
8081
  processing_to_settled: SchemaPaymentEntryInput
8167
8082
  })
8168
8083
  });
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
- };
8196
8084
  var SchemaPaymentsInput = z.object({
8197
8085
  types: z.array(SchemaPaymentTypeInput).min(1, {
8198
8086
  message: "At least one Payment Type is required. Omit `payments` to store a schema without Payment Types."
@@ -8260,16 +8148,6 @@ var Schema = z.object({
8260
8148
  path
8261
8149
  })
8262
8150
  );
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
- );
8273
8151
  if (groups && groups.length > 0) {
8274
8152
  groups.forEach((group, index) => {
8275
8153
  const groupErrors = validateGroup(
@@ -8287,20 +8165,56 @@ var Schema = z.object({
8287
8165
  );
8288
8166
  });
8289
8167
  }
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
- };
8300
8168
  return {
8301
8169
  ...schema,
8302
- ledgerEntries: { types: ledgerEntryTypes },
8303
- payments: enrichedPayments,
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
+ },
8304
8218
  consistencyConfig: consistencyConfig ?? {
8305
8219
  entries: "eventual"
8306
8220
  }