@fragment-dev/cli 2026.9.9 → 2026.9.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.
- package/README.md +1 -1
- package/dist/{chunk-WL5BF26E.js → chunk-2LCTKBU3.js} +3 -3
- package/dist/{chunk-3AACKVGA.js → chunk-65EVYD2Y.js} +2 -1
- package/dist/{chunk-4VYFUMLV.js → chunk-7GWSUHUD.js} +3 -1
- package/dist/{chunk-EJNEAWYE.js → chunk-B2LX5DMN.js} +2 -2
- package/dist/{chunk-KNFHXSE5.js → chunk-BTKJKLCB.js} +2 -2
- package/dist/chunk-FUUGVGYY.js +424 -0
- package/dist/{chunk-VYSP73KB.js → chunk-J6HLIC77.js} +1 -1
- package/dist/{chunk-ZPKRHWC3.js → chunk-KJFWVDCE.js} +10 -5
- package/dist/{chunk-JZ773SXY.js → chunk-QUNR5ZC3.js} +153 -22
- package/dist/{chunk-2UUZOEA7.js → chunk-RILSVR74.js} +24 -301
- package/dist/commands/gen-graphql.js +7 -7
- package/dist/commands/verify-schema.js +6 -6
- package/dist/commands.js +10 -10
- package/dist/graphql.js +10 -4
- package/dist/index.js +10 -10
- package/dist/queries/standard-queries.js +1 -1
- package/dist/utils/formatValidationErrors.js +2 -2
- package/dist/utils/schemaValidation.js +5 -5
- package/oclif.manifest.json +2 -2
- package/package.json +3 -3
- package/dist/chunk-PUON7HP5.js +0 -113
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
standardQueries
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7GWSUHUD.js";
|
|
4
4
|
import {
|
|
5
5
|
InvalidGraphQlError
|
|
6
6
|
} from "./chunk-ZMFGVGZP.js";
|
|
7
7
|
import {
|
|
8
|
+
SYSTEM_PARAMETER_NAMES,
|
|
8
9
|
getSchemaObjectParameters,
|
|
9
10
|
getStructuralSubpaths
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FUUGVGYY.js";
|
|
11
12
|
import {
|
|
12
13
|
require_source
|
|
13
14
|
} from "./chunk-XK2D2Z44.js";
|
|
@@ -26,6 +27,16 @@ var import_chalk = __toESM(require_source(), 1);
|
|
|
26
27
|
var import_parser = __toESM(require_parser(), 1);
|
|
27
28
|
var import_printer = __toESM(require_printer(), 1);
|
|
28
29
|
import { statSync, existsSync } from "node:fs";
|
|
30
|
+
|
|
31
|
+
// ../../libs/schema-validation/utils/paymentTypes.ts
|
|
32
|
+
init_cjs_shims();
|
|
33
|
+
var getRequiredPaymentParameters = (paymentType) => new Set(
|
|
34
|
+
getSchemaObjectParameters(paymentType, true).filter(
|
|
35
|
+
(name) => !SYSTEM_PARAMETER_NAMES.has(name)
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// src/graphql.ts
|
|
29
40
|
var getAccountParams = (accountPath, schema) => {
|
|
30
41
|
const subpaths = getStructuralSubpaths(accountPath);
|
|
31
42
|
return subpaths.flatMap(
|
|
@@ -106,6 +117,16 @@ var schemaToEntryDefinitions = ({
|
|
|
106
117
|
];
|
|
107
118
|
});
|
|
108
119
|
};
|
|
120
|
+
var schemaToPaymentDefinitions = ({
|
|
121
|
+
schema
|
|
122
|
+
}) => (schema.payments?.types ?? []).map((paymentType) => ({
|
|
123
|
+
paymentType: paymentType.type,
|
|
124
|
+
typeVersion: paymentType.typeVersion,
|
|
125
|
+
direction: paymentType.payment.direction,
|
|
126
|
+
// The same helper `createPayment` validates against, so the generated
|
|
127
|
+
// variables are exactly the parameters the API accepts.
|
|
128
|
+
parameters: Array.from(getRequiredPaymentParameters(paymentType))
|
|
129
|
+
}));
|
|
109
130
|
var camelCase = (value, delimiter) => {
|
|
110
131
|
return value.split(delimiter).filter((x) => !!x).map((word, index) => {
|
|
111
132
|
if (index === 0) {
|
|
@@ -188,25 +209,80 @@ __typename
|
|
|
188
209
|
}
|
|
189
210
|
${OnErrorFragment}
|
|
190
211
|
`;
|
|
212
|
+
var PaymentFragment = `
|
|
213
|
+
ik
|
|
214
|
+
ledger {
|
|
215
|
+
id
|
|
216
|
+
ik
|
|
217
|
+
}
|
|
218
|
+
type
|
|
219
|
+
typeVersion
|
|
220
|
+
status
|
|
221
|
+
amount
|
|
222
|
+
mode
|
|
223
|
+
clientSecret
|
|
224
|
+
created
|
|
225
|
+
`;
|
|
226
|
+
var CreatePaymentFragment = `
|
|
227
|
+
__typename
|
|
228
|
+
... on CreatePaymentResult {
|
|
229
|
+
payment {
|
|
230
|
+
${PaymentFragment}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
${OnErrorFragment}
|
|
234
|
+
`;
|
|
191
235
|
var isValidGraphQlName = (name) => {
|
|
192
236
|
return /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.exec(name) !== null;
|
|
193
237
|
};
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
238
|
+
var toPascalCaseGraphQlName = (value) => camelCase(camelCase(value, "_"), "-").split("").map((ch, idx) => {
|
|
239
|
+
if (idx === 0) {
|
|
240
|
+
return ch.toUpperCase();
|
|
241
|
+
}
|
|
242
|
+
return ch;
|
|
243
|
+
}).join("").replace(/\s+/g, "_").replace(/\./g, "_").replace(/[^a-zA-Z0-9_]/g, "").replace(/^(\d)/, "_$1");
|
|
244
|
+
var versionSuffix = (typeVersion) => typeof typeVersion === "number" && typeVersion > 1 ? `_v${typeVersion}` : "";
|
|
245
|
+
var OperationSubject = {
|
|
246
|
+
entry: "entry",
|
|
247
|
+
paymentType: "payment type"
|
|
248
|
+
};
|
|
249
|
+
var assertValidOperationName = ({
|
|
250
|
+
name,
|
|
251
|
+
subject,
|
|
252
|
+
sourceType
|
|
253
|
+
}) => {
|
|
254
|
+
if (!isValidGraphQlName(name)) {
|
|
202
255
|
throw new InvalidGraphQlError(
|
|
203
|
-
`Operation name ${
|
|
204
|
-
|
|
256
|
+
`Operation name ${name} (for ${subject}: ${import_chalk.default.yellow(
|
|
257
|
+
sourceType
|
|
205
258
|
)}) is not a valid GraphQL name`
|
|
206
259
|
);
|
|
207
260
|
}
|
|
261
|
+
};
|
|
262
|
+
var generateGraphQlEntryType = (entryType, typeVersion) => {
|
|
263
|
+
const readableEntryType = toPascalCaseGraphQlName(entryType).concat(
|
|
264
|
+
versionSuffix(typeVersion)
|
|
265
|
+
);
|
|
266
|
+
assertValidOperationName({
|
|
267
|
+
name: readableEntryType,
|
|
268
|
+
subject: OperationSubject.entry,
|
|
269
|
+
sourceType: entryType
|
|
270
|
+
});
|
|
208
271
|
return readableEntryType;
|
|
209
272
|
};
|
|
273
|
+
var generateGraphQlPaymentType = ({
|
|
274
|
+
paymentType,
|
|
275
|
+
direction,
|
|
276
|
+
typeVersion
|
|
277
|
+
}) => {
|
|
278
|
+
const readablePaymentType = toPascalCaseGraphQlName(paymentType).concat(toPascalCaseGraphQlName(direction)).concat(versionSuffix(typeVersion));
|
|
279
|
+
assertValidOperationName({
|
|
280
|
+
name: readablePaymentType,
|
|
281
|
+
subject: OperationSubject.paymentType,
|
|
282
|
+
sourceType: paymentType
|
|
283
|
+
});
|
|
284
|
+
return readablePaymentType;
|
|
285
|
+
};
|
|
210
286
|
var getPredefinedParameters = (definition) => {
|
|
211
287
|
const params = {};
|
|
212
288
|
if (definition.method === "addLedgerEntry") {
|
|
@@ -306,13 +382,64 @@ var entryDefinitionToMutation = (definition) => {
|
|
|
306
382
|
operationName
|
|
307
383
|
};
|
|
308
384
|
};
|
|
385
|
+
var paymentPredefinedParameters = {
|
|
386
|
+
ik: "SafeString!",
|
|
387
|
+
ledgerIk: "SafeString!"
|
|
388
|
+
};
|
|
389
|
+
var paymentDefinitionToMutation = (definition) => {
|
|
390
|
+
const { paymentType, typeVersion, direction, parameters } = definition;
|
|
391
|
+
parameters.forEach((param) => {
|
|
392
|
+
if (!isValidGraphQlName(param)) {
|
|
393
|
+
throw new InvalidGraphQlError(
|
|
394
|
+
`Parameter name ${param} is not a valid GraphQL name`
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
const operationName = `CreatePayment${generateGraphQlPaymentType({
|
|
399
|
+
paymentType,
|
|
400
|
+
direction,
|
|
401
|
+
typeVersion
|
|
402
|
+
})}`;
|
|
403
|
+
const varArgs = [
|
|
404
|
+
...Object.entries(paymentPredefinedParameters).map(
|
|
405
|
+
([name, type]) => `$${name}: ${type}`
|
|
406
|
+
),
|
|
407
|
+
...parameters.filter(
|
|
408
|
+
(p) => !Object.prototype.hasOwnProperty.call(paymentPredefinedParameters, p)
|
|
409
|
+
).map((p) => `$${p}: String!`)
|
|
410
|
+
].join(",\n");
|
|
411
|
+
const command = [
|
|
412
|
+
`mutation ${operationName} (`,
|
|
413
|
+
`${varArgs}) {`,
|
|
414
|
+
`createPayment(`,
|
|
415
|
+
`ik: $ik,`,
|
|
416
|
+
`ledger: { ik: $ledgerIk },`,
|
|
417
|
+
`payment: {`,
|
|
418
|
+
`type: "${paymentType}",`,
|
|
419
|
+
`typeVersion: ${typeVersion},`
|
|
420
|
+
];
|
|
421
|
+
if (parameters.length > 0) {
|
|
422
|
+
command.push(`parameters: {`);
|
|
423
|
+
command.push(parameters.map((p) => `${p}: $${p}`).join("\n"));
|
|
424
|
+
command.push(`}`);
|
|
425
|
+
}
|
|
426
|
+
command.push(`}) { ${CreatePaymentFragment} } }`);
|
|
427
|
+
return {
|
|
428
|
+
mutation: (0, import_printer.print)((0, import_parser.parse)(command.join(""))),
|
|
429
|
+
operationName
|
|
430
|
+
};
|
|
431
|
+
};
|
|
309
432
|
var generateQueriesFileContent = ({
|
|
310
433
|
definitions,
|
|
434
|
+
paymentDefinitions,
|
|
311
435
|
includeStandardQueries
|
|
312
436
|
}) => {
|
|
313
|
-
const generatedCode =
|
|
314
|
-
(def) => entryDefinitionToMutation(def).mutation
|
|
315
|
-
|
|
437
|
+
const generatedCode = [
|
|
438
|
+
...definitions.map((def) => entryDefinitionToMutation(def).mutation),
|
|
439
|
+
...paymentDefinitions.map(
|
|
440
|
+
(def) => paymentDefinitionToMutation(def).mutation
|
|
441
|
+
)
|
|
442
|
+
];
|
|
316
443
|
if (includeStandardQueries) {
|
|
317
444
|
generatedCode.push(standardQueries);
|
|
318
445
|
}
|
|
@@ -321,16 +448,17 @@ var generateQueriesFileContent = ({
|
|
|
321
448
|
};
|
|
322
449
|
var generateQueryFiles = ({
|
|
323
450
|
definitions,
|
|
451
|
+
paymentDefinitions,
|
|
324
452
|
includeStandardQueries
|
|
325
453
|
}) => {
|
|
326
|
-
const generatedCode =
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
454
|
+
const generatedCode = [
|
|
455
|
+
...definitions.map((def) => entryDefinitionToMutation(def)),
|
|
456
|
+
...paymentDefinitions.map((def) => paymentDefinitionToMutation(def))
|
|
457
|
+
].map(({ operationName, mutation }) => ({
|
|
458
|
+
content: `${mutation}
|
|
330
459
|
`,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
});
|
|
460
|
+
fileName: `${operationName}.graphql`
|
|
461
|
+
}));
|
|
334
462
|
if (includeStandardQueries) {
|
|
335
463
|
const parsedStdQueries = (0, import_parser.parse)(standardQueries);
|
|
336
464
|
parsedStdQueries.definitions.forEach((def) => {
|
|
@@ -366,11 +494,14 @@ var validateOutputName = ({
|
|
|
366
494
|
|
|
367
495
|
export {
|
|
368
496
|
schemaToEntryDefinitions,
|
|
497
|
+
schemaToPaymentDefinitions,
|
|
369
498
|
camelCase,
|
|
370
499
|
isValidGraphQlName,
|
|
371
500
|
generateGraphQlEntryType,
|
|
501
|
+
generateGraphQlPaymentType,
|
|
372
502
|
getPredefinedParameters,
|
|
373
503
|
entryDefinitionToMutation,
|
|
504
|
+
paymentDefinitionToMutation,
|
|
374
505
|
generateQueriesFileContent,
|
|
375
506
|
generateQueryFiles,
|
|
376
507
|
validateOutputName
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AccountConsistencyConfigSchema,
|
|
3
|
+
BaseChartOfAccounts,
|
|
4
|
+
ConsistencyConfigSchema,
|
|
5
|
+
PaymentEventKey,
|
|
6
|
+
PaymentEventKeySchema,
|
|
7
|
+
PaymentTypeDirection,
|
|
8
|
+
PaymentTypeDirectionSchema,
|
|
9
|
+
PostLinesAsSchema,
|
|
10
|
+
SYSTEM_LINE_AMOUNT,
|
|
11
|
+
SYSTEM_PARAMETER_NAMES,
|
|
12
|
+
SchemaEntryGroup,
|
|
13
|
+
SchemaLedgerEntityStatusSchema,
|
|
14
|
+
SchemaPaymentTypeStatusSchema,
|
|
15
|
+
SchemaTxMatchInput,
|
|
16
|
+
SystemLineKind,
|
|
17
|
+
SystemLineKindSchema,
|
|
2
18
|
fillParams,
|
|
3
19
|
getInstanceValueByAccountPath,
|
|
4
20
|
getSchemaObjectParameters,
|
|
5
21
|
getStructuralPath,
|
|
6
22
|
getStructuralSubpaths,
|
|
7
23
|
getSubpaths
|
|
8
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-FUUGVGYY.js";
|
|
9
25
|
import {
|
|
10
26
|
BadRequestError,
|
|
11
27
|
CurrencyMatchInputSchema,
|
|
12
|
-
CurrencyModeSchema,
|
|
13
28
|
InternalError,
|
|
14
|
-
LedgerAccountTypeSchema,
|
|
15
29
|
MAX_FREEFORM_TEXT_LENGTH,
|
|
16
30
|
ParameterizedAmount,
|
|
17
31
|
ParameterizedString,
|
|
@@ -23,7 +37,7 @@ import {
|
|
|
23
37
|
mapValues_default,
|
|
24
38
|
safe,
|
|
25
39
|
z
|
|
26
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-65EVYD2Y.js";
|
|
27
41
|
import {
|
|
28
42
|
__commonJS,
|
|
29
43
|
__toESM,
|
|
@@ -4466,297 +4480,6 @@ var safeGetZodErrors = (schema, value, pathPrefix) => {
|
|
|
4466
4480
|
// ../../libs/schema-validation/types.ts
|
|
4467
4481
|
init_cjs_shims();
|
|
4468
4482
|
|
|
4469
|
-
// ../../libs/types/schemas.ts
|
|
4470
|
-
init_cjs_shims();
|
|
4471
|
-
|
|
4472
|
-
// ../../libs/types/tx.ts
|
|
4473
|
-
init_cjs_shims();
|
|
4474
|
-
var SchemaTxMatchInput = z.object({
|
|
4475
|
-
id: z.optional(ParameterizedString),
|
|
4476
|
-
externalId: z.optional(ParameterizedString)
|
|
4477
|
-
});
|
|
4478
|
-
var txTypes = ["credit", "debit"];
|
|
4479
|
-
var TxTypeSchema = z.enum(txTypes);
|
|
4480
|
-
|
|
4481
|
-
// ../../libs/types/schemas.ts
|
|
4482
|
-
var LedgerMigrationStatusSchema = z.enum([
|
|
4483
|
-
"queued",
|
|
4484
|
-
"started",
|
|
4485
|
-
"failed",
|
|
4486
|
-
"completed",
|
|
4487
|
-
"skipped"
|
|
4488
|
-
]);
|
|
4489
|
-
var SafeRecordKey = z.string().refine((v2) => v2 !== "__proto__", "invalid parameter name");
|
|
4490
|
-
var ParametersSchema = z.record(
|
|
4491
|
-
SafeRecordKey,
|
|
4492
|
-
z.string({
|
|
4493
|
-
invalid_type_error: "Invalid parameter type. All parameters must be string-encoded values."
|
|
4494
|
-
})
|
|
4495
|
-
);
|
|
4496
|
-
var EntryParametersSchema = z.record(
|
|
4497
|
-
SafeRecordKey,
|
|
4498
|
-
z.union([
|
|
4499
|
-
z.string({
|
|
4500
|
-
invalid_type_error: "Invalid parameter type. Parameters must be string-encoded values or arrays of objects with string values."
|
|
4501
|
-
}),
|
|
4502
|
-
z.array(z.record(SafeRecordKey, z.string()))
|
|
4503
|
-
])
|
|
4504
|
-
);
|
|
4505
|
-
var ConsistencyModeSchema = z.enum(["strong", "eventual"]);
|
|
4506
|
-
var ConsistencyConfigSchema = (keys, extra) => {
|
|
4507
|
-
const v2 = z.optional(ConsistencyModeSchema);
|
|
4508
|
-
const schemaObject = Object.fromEntries(
|
|
4509
|
-
keys.map((key) => [key, v2])
|
|
4510
|
-
);
|
|
4511
|
-
return z.object({ ...extra, ...schemaObject });
|
|
4512
|
-
};
|
|
4513
|
-
var GroupConsistencyConfig = z.object({
|
|
4514
|
-
key: SafeStringSchema,
|
|
4515
|
-
ownBalanceUpdates: ConsistencyModeSchema
|
|
4516
|
-
});
|
|
4517
|
-
var AccountConsistencyConfigSchema = z.object({
|
|
4518
|
-
lines: z.optional(ConsistencyModeSchema),
|
|
4519
|
-
ownBalanceUpdates: z.optional(ConsistencyModeSchema),
|
|
4520
|
-
totalBalanceUpdates: z.optional(ConsistencyModeSchema),
|
|
4521
|
-
groups: z.optional(z.array(GroupConsistencyConfig))
|
|
4522
|
-
});
|
|
4523
|
-
var SchemaCurrencyMatchInput = z.object({
|
|
4524
|
-
customCurrencyId: z.string().optional(),
|
|
4525
|
-
code: z.string()
|
|
4526
|
-
});
|
|
4527
|
-
var SchemaLinkTypeList = [
|
|
4528
|
-
"IncreaseLink",
|
|
4529
|
-
"UnitLink",
|
|
4530
|
-
"CustomLink",
|
|
4531
|
-
"StripeLink"
|
|
4532
|
-
];
|
|
4533
|
-
var SchemaLinkType = z.enum(SchemaLinkTypeList);
|
|
4534
|
-
var SchemaExternalAccountMatchInput = z.object({
|
|
4535
|
-
linkType: SchemaLinkType.optional(),
|
|
4536
|
-
id: z.string().optional(),
|
|
4537
|
-
externalId: z.string().optional(),
|
|
4538
|
-
linkId: z.string().optional()
|
|
4539
|
-
});
|
|
4540
|
-
var SchemaPaymentInput = z.object({
|
|
4541
|
-
enabled: z.boolean()
|
|
4542
|
-
});
|
|
4543
|
-
var SchemaLedgerEntityStatusSchema = z.enum([
|
|
4544
|
-
"active",
|
|
4545
|
-
"disabled",
|
|
4546
|
-
"archived"
|
|
4547
|
-
]);
|
|
4548
|
-
var BaseSchemaLedgerAccountInput = z.lazy(
|
|
4549
|
-
() => z.object({
|
|
4550
|
-
key: z.string(),
|
|
4551
|
-
name: z.string().optional(),
|
|
4552
|
-
type: LedgerAccountTypeSchema.optional(),
|
|
4553
|
-
currency: SchemaCurrencyMatchInput.optional(),
|
|
4554
|
-
currencyMode: CurrencyModeSchema.optional(),
|
|
4555
|
-
template: z.boolean().optional(),
|
|
4556
|
-
clearing: z.boolean().optional(),
|
|
4557
|
-
children: z.array(BaseSchemaLedgerAccountInput).optional(),
|
|
4558
|
-
linkedAccount: SchemaExternalAccountMatchInput.optional(),
|
|
4559
|
-
payment: SchemaPaymentInput.optional(),
|
|
4560
|
-
consistencyConfig: AccountConsistencyConfigSchema.optional(),
|
|
4561
|
-
status: SchemaLedgerEntityStatusSchema.optional()
|
|
4562
|
-
})
|
|
4563
|
-
);
|
|
4564
|
-
var BaseChartOfAccounts = z.object({
|
|
4565
|
-
defaultConsistencyConfig: AccountConsistencyConfigSchema.optional(),
|
|
4566
|
-
defaultCurrency: z.optional(CurrencyMatchInputSchema),
|
|
4567
|
-
defaultCurrencyMode: CurrencyModeSchema.optional(),
|
|
4568
|
-
accounts: z.array(BaseSchemaLedgerAccountInput)
|
|
4569
|
-
});
|
|
4570
|
-
var SchemaCondition = z.object({
|
|
4571
|
-
ownBalance: z.object({
|
|
4572
|
-
eq: z.string().optional(),
|
|
4573
|
-
lte: z.string().optional(),
|
|
4574
|
-
gte: z.string().optional()
|
|
4575
|
-
}).optional(),
|
|
4576
|
-
totalBalance: z.object({
|
|
4577
|
-
eq: z.string().optional(),
|
|
4578
|
-
lte: z.string().optional(),
|
|
4579
|
-
gte: z.string().optional()
|
|
4580
|
-
}).optional()
|
|
4581
|
-
});
|
|
4582
|
-
var PostLinesAsSchema = z.enum([
|
|
4583
|
-
"raw_lines",
|
|
4584
|
-
"net_amounts",
|
|
4585
|
-
"skip_zero_lines"
|
|
4586
|
-
]);
|
|
4587
|
-
var BaseSchemaLedgerEntryConditionInput = z.object({
|
|
4588
|
-
account: z.object({ path: z.string() }).optional(),
|
|
4589
|
-
postcondition: SchemaCondition.optional(),
|
|
4590
|
-
precondition: SchemaCondition.optional(),
|
|
4591
|
-
currency: SchemaCurrencyMatchInput.optional(),
|
|
4592
|
-
repeated: z.object({
|
|
4593
|
-
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
4594
|
-
message: "repeated.key cannot be empty"
|
|
4595
|
-
})
|
|
4596
|
-
}).optional()
|
|
4597
|
-
});
|
|
4598
|
-
var BaseSchemaLedgerLineTagInput = z.object({
|
|
4599
|
-
key: z.string(),
|
|
4600
|
-
value: z.string()
|
|
4601
|
-
});
|
|
4602
|
-
var BaseSchemaLedgerEntryLineInput = z.object({
|
|
4603
|
-
account: z.object({ path: z.string() }).optional(),
|
|
4604
|
-
amount: z.string().optional(),
|
|
4605
|
-
key: z.string(),
|
|
4606
|
-
currency: SchemaCurrencyMatchInput.optional(),
|
|
4607
|
-
description: z.string().optional(),
|
|
4608
|
-
tx: SchemaTxMatchInput.optional(),
|
|
4609
|
-
tags: z.array(BaseSchemaLedgerLineTagInput).optional(),
|
|
4610
|
-
repeated: z.object({
|
|
4611
|
-
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
4612
|
-
message: "repeated.key cannot be empty"
|
|
4613
|
-
})
|
|
4614
|
-
}).optional()
|
|
4615
|
-
});
|
|
4616
|
-
var BaseSchemaLedgerEntryInput = z.object({
|
|
4617
|
-
type: z.string(),
|
|
4618
|
-
typeVersion: z.number().int().optional(),
|
|
4619
|
-
description: z.string().optional(),
|
|
4620
|
-
conditions: z.array(BaseSchemaLedgerEntryConditionInput).optional(),
|
|
4621
|
-
lines: z.array(BaseSchemaLedgerEntryLineInput).optional(),
|
|
4622
|
-
parameters: z.record(SafeRecordKey, z.string()).optional(),
|
|
4623
|
-
tags: z.array(
|
|
4624
|
-
z.object({
|
|
4625
|
-
key: z.string(),
|
|
4626
|
-
value: z.string()
|
|
4627
|
-
})
|
|
4628
|
-
).optional(),
|
|
4629
|
-
groups: z.array(
|
|
4630
|
-
z.object({
|
|
4631
|
-
key: SafeStringSchema,
|
|
4632
|
-
value: z.string()
|
|
4633
|
-
})
|
|
4634
|
-
).optional(),
|
|
4635
|
-
status: SchemaLedgerEntityStatusSchema.optional(),
|
|
4636
|
-
postLinesAs: PostLinesAsSchema.optional()
|
|
4637
|
-
});
|
|
4638
|
-
var BaseLedgerEntries = z.object({
|
|
4639
|
-
types: z.array(BaseSchemaLedgerEntryInput)
|
|
4640
|
-
});
|
|
4641
|
-
var PaymentEventKey = {
|
|
4642
|
-
/** Exit from the payer not yet having supplied a payment method at checkout. */
|
|
4643
|
-
needs_payment_method_to_processing: "needs_payment_method_to_processing",
|
|
4644
|
-
processing_to_settled: "processing_to_settled"
|
|
4645
|
-
};
|
|
4646
|
-
var PaymentEventKeySchema = z.nativeEnum(PaymentEventKey);
|
|
4647
|
-
var PaymentTypeDirection = {
|
|
4648
|
-
payin: "payin",
|
|
4649
|
-
payout: "payout"
|
|
4650
|
-
};
|
|
4651
|
-
var PaymentTypeDirectionSchema = z.nativeEnum(PaymentTypeDirection);
|
|
4652
|
-
var SystemLineKind = {
|
|
4653
|
-
payment_settlement_line: "payment_settlement_line",
|
|
4654
|
-
payment_fee_line: "payment_fee_line"
|
|
4655
|
-
};
|
|
4656
|
-
var SystemLineKindSchema = z.nativeEnum(SystemLineKind);
|
|
4657
|
-
var SystemLineParameterName = {
|
|
4658
|
-
payment_settlement_line: "settled_amount",
|
|
4659
|
-
payment_fee_line: "fragment_fee_amount"
|
|
4660
|
-
};
|
|
4661
|
-
var SYSTEM_LINE_AMOUNT = {
|
|
4662
|
-
[SystemLineKind.payment_settlement_line]: `{{${SystemLineParameterName.payment_settlement_line}}}`,
|
|
4663
|
-
[SystemLineKind.payment_fee_line]: `-{{${SystemLineParameterName.payment_fee_line}}}`
|
|
4664
|
-
};
|
|
4665
|
-
var SYSTEM_PARAMETER_NAMES = new Set(
|
|
4666
|
-
Object.values(SystemLineParameterName)
|
|
4667
|
-
);
|
|
4668
|
-
var BaseSchemaPaymentInput = z.object({
|
|
4669
|
-
amount: z.string(),
|
|
4670
|
-
direction: PaymentTypeDirectionSchema
|
|
4671
|
-
});
|
|
4672
|
-
var BaseSchemaPaymentEntryLineInput = BaseSchemaLedgerEntryLineInput.pick({
|
|
4673
|
-
key: true,
|
|
4674
|
-
currency: true,
|
|
4675
|
-
description: true
|
|
4676
|
-
}).extend({
|
|
4677
|
-
account: z.object({ path: z.string() }),
|
|
4678
|
-
amount: z.string(),
|
|
4679
|
-
system: SystemLineKindSchema.optional()
|
|
4680
|
-
});
|
|
4681
|
-
var BaseSchemaPaymentEntryInput = z.object({
|
|
4682
|
-
description: z.string().optional(),
|
|
4683
|
-
lines: z.array(BaseSchemaPaymentEntryLineInput)
|
|
4684
|
-
});
|
|
4685
|
-
var SchemaPaymentTypeStatusSchema = z.enum(["active"]);
|
|
4686
|
-
var BaseSchemaPaymentTypeInput = z.object({
|
|
4687
|
-
type: z.string(),
|
|
4688
|
-
typeVersion: z.number().int(),
|
|
4689
|
-
status: SchemaPaymentTypeStatusSchema,
|
|
4690
|
-
payment: BaseSchemaPaymentInput,
|
|
4691
|
-
accounting: z.object({
|
|
4692
|
-
needs_payment_method_to_processing: BaseSchemaPaymentEntryInput.optional(),
|
|
4693
|
-
processing_to_settled: BaseSchemaPaymentEntryInput
|
|
4694
|
-
})
|
|
4695
|
-
});
|
|
4696
|
-
var BaseSchemaPayments = z.object({
|
|
4697
|
-
types: z.array(BaseSchemaPaymentTypeInput)
|
|
4698
|
-
});
|
|
4699
|
-
var SceneEntrySchema = z.object({
|
|
4700
|
-
type: z.string(),
|
|
4701
|
-
typeVersion: z.number().int().positive().optional(),
|
|
4702
|
-
parameters: z.record(SafeRecordKey, z.string())
|
|
4703
|
-
});
|
|
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({
|
|
4711
|
-
eventType: z.literal("entry"),
|
|
4712
|
-
entry: SceneEntrySchema
|
|
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
|
-
]);
|
|
4725
|
-
var BaseScene = z.object({
|
|
4726
|
-
name: z.string(),
|
|
4727
|
-
events: z.array(SceneEventSchema),
|
|
4728
|
-
payments: z.array(ScenePaymentSchema).optional()
|
|
4729
|
-
});
|
|
4730
|
-
var EntryKey = z.object({
|
|
4731
|
-
type: SafeStringSchema,
|
|
4732
|
-
typeVersion: z.number().int().positive()
|
|
4733
|
-
});
|
|
4734
|
-
var SchemaLedgerAccountMatchInput = z.object({
|
|
4735
|
-
path: ParameterizedString
|
|
4736
|
-
});
|
|
4737
|
-
var GroupReconciliationParameters = z.object({
|
|
4738
|
-
clearingAccountPath: SchemaLedgerAccountMatchInput
|
|
4739
|
-
});
|
|
4740
|
-
var SchemaEntryGroup = z.object({
|
|
4741
|
-
key: SafeStringSchema,
|
|
4742
|
-
description: z.string().optional(),
|
|
4743
|
-
reconciliation: GroupReconciliationParameters.optional()
|
|
4744
|
-
});
|
|
4745
|
-
var BaseSchema = z.object({
|
|
4746
|
-
name: z.string().optional(),
|
|
4747
|
-
key: z.string(),
|
|
4748
|
-
chartOfAccounts: BaseChartOfAccounts,
|
|
4749
|
-
ledgerEntries: BaseLedgerEntries.optional(),
|
|
4750
|
-
payments: BaseSchemaPayments.optional(),
|
|
4751
|
-
groups: z.array(SchemaEntryGroup).optional(),
|
|
4752
|
-
scenes: z.array(BaseScene).optional(),
|
|
4753
|
-
consistencyConfig: z.optional(
|
|
4754
|
-
z.object({
|
|
4755
|
-
entries: ConsistencyModeSchema.optional()
|
|
4756
|
-
})
|
|
4757
|
-
)
|
|
4758
|
-
});
|
|
4759
|
-
|
|
4760
4483
|
// ../../libs/schema-validation/utils/transformers/coa.ts
|
|
4761
4484
|
init_cjs_shims();
|
|
4762
4485
|
|
|
@@ -4874,7 +4597,7 @@ var validateDefaultCurrencySettings = ({
|
|
|
4874
4597
|
message: `Default currency customCurrencyId cannot be parameterized`,
|
|
4875
4598
|
path: ["defaultCurrency", "customCurrencyId"]
|
|
4876
4599
|
});
|
|
4877
|
-
} else if (!
|
|
4600
|
+
} else if (!SchemaCurrencyMatchInput.safeParse(defaultCurrency).success) {
|
|
4878
4601
|
if (defaultCurrency.code === "CUSTOM" && !defaultCurrency.customCurrencyId) {
|
|
4879
4602
|
errors.push({
|
|
4880
4603
|
message: `Must provide custom currency ID for custom currency`,
|
|
@@ -5195,7 +4918,7 @@ var validateAccountCurrency = ({
|
|
|
5195
4918
|
path: [...path, "currency"]
|
|
5196
4919
|
});
|
|
5197
4920
|
}
|
|
5198
|
-
if (currency && !
|
|
4921
|
+
if (currency && !SchemaCurrencyMatchInput.safeParse(currency).success) {
|
|
5199
4922
|
if (currency.code === "CUSTOM" && !currency.customCurrencyId) {
|
|
5200
4923
|
errors.push({
|
|
5201
4924
|
message: `Must provide custom currency ID for custom currency (key: ${key}, name: ${name})`,
|
|
@@ -6508,7 +6231,7 @@ var validateLineCurrency = (currency, accountPath, accountPathToAccount, entryPa
|
|
|
6508
6231
|
path: ["currency"]
|
|
6509
6232
|
});
|
|
6510
6233
|
}
|
|
6511
|
-
if (currency && !
|
|
6234
|
+
if (currency && !SchemaCurrencyMatchInput.safeParse(currency).success) {
|
|
6512
6235
|
if (currency.code === "CUSTOM" && !currency.customCurrencyId) {
|
|
6513
6236
|
validationResults.push({
|
|
6514
6237
|
message: `Line must provide custom currency ID for custom currency (Line key: ${lineKey}, entry: ${entryType})`,
|
|
@@ -7872,7 +7595,7 @@ var transformAndValidatePayments = ({
|
|
|
7872
7595
|
};
|
|
7873
7596
|
|
|
7874
7597
|
// ../../libs/schema-validation/types.ts
|
|
7875
|
-
var
|
|
7598
|
+
var SchemaCurrencyMatchInput = z.object({
|
|
7876
7599
|
customCurrencyId: ParameterizedString.optional(),
|
|
7877
7600
|
code: ParameterizedString.refine(
|
|
7878
7601
|
(str) => {
|
|
@@ -7953,7 +7676,7 @@ var SchemaLedgerLineInput = z.object({
|
|
|
7953
7676
|
}),
|
|
7954
7677
|
amount: ParameterizedAmount().optional(),
|
|
7955
7678
|
key: SafeStringSchema,
|
|
7956
|
-
currency: z.optional(
|
|
7679
|
+
currency: z.optional(SchemaCurrencyMatchInput),
|
|
7957
7680
|
description: ParameterizedString.optional(),
|
|
7958
7681
|
tx: SchemaTxMatchInput.optional(),
|
|
7959
7682
|
tags: z.array(SchemaLedgerLineTagInput).optional(),
|
|
@@ -8042,7 +7765,7 @@ var SchemaLedgerEntryConditionInput = z.object({
|
|
|
8042
7765
|
}),
|
|
8043
7766
|
postcondition: SchemaConditionInput.optional(),
|
|
8044
7767
|
precondition: SchemaConditionInput.optional(),
|
|
8045
|
-
currency:
|
|
7768
|
+
currency: SchemaCurrencyMatchInput.optional(),
|
|
8046
7769
|
repeated: z.object({
|
|
8047
7770
|
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
8048
7771
|
message: "repeated.key cannot be empty"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GenGraphQL
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-KJFWVDCE.js";
|
|
4
|
+
import "../chunk-QUNR5ZC3.js";
|
|
5
|
+
import "../chunk-7GWSUHUD.js";
|
|
6
6
|
import "../chunk-ZMFGVGZP.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-RILSVR74.js";
|
|
8
|
+
import "../chunk-J6HLIC77.js";
|
|
9
|
+
import "../chunk-FUUGVGYY.js";
|
|
10
|
+
import "../chunk-65EVYD2Y.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-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-BTKJKLCB.js";
|
|
4
|
+
import "../chunk-2LCTKBU3.js";
|
|
5
5
|
import "../chunk-A4BSWX5D.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-RILSVR74.js";
|
|
7
|
+
import "../chunk-J6HLIC77.js";
|
|
8
|
+
import "../chunk-FUUGVGYY.js";
|
|
9
|
+
import "../chunk-65EVYD2Y.js";
|
|
10
10
|
import "../chunk-W33MLXYW.js";
|
|
11
11
|
import "../chunk-34NLRFFT.js";
|
|
12
12
|
import "../chunk-LFCNPXLH.js";
|