@fragment-dev/cli 2026.4.23-1 → 2026.4.23-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.
- package/dist/{chunk-MGSKOQTQ.js → chunk-AZE2ROHU.js} +438 -218
- package/dist/{chunk-Y4KCQNPQ.js → chunk-K4MJG5VG.js} +1 -0
- package/dist/{chunk-NY3HNDIP.js → chunk-KXOV6HHY.js} +1 -1
- package/dist/{chunk-GA6FNH6M.js → chunk-LPDBEFWD.js} +1 -1
- package/dist/{chunk-SPLTGDRO.js → chunk-NA24ZILY.js} +2 -2
- package/dist/{chunk-NIMCALUM.js → chunk-NMX7BQCI.js} +1 -1
- package/dist/{chunk-5RDAFLJ2.js → chunk-ZGV5WNL6.js} +2 -2
- package/dist/commands/gen-graphql.js +4 -4
- package/dist/commands/verify-schema.js +4 -4
- package/dist/commands.js +7 -7
- package/dist/graphql.js +2 -2
- package/dist/index.js +7 -7
- package/dist/utils/schemaValidation.js +3 -3
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,10 @@ import {
|
|
|
2
2
|
fillParams,
|
|
3
3
|
getInstanceValueByAccountPath,
|
|
4
4
|
getSchemaObjectParameters,
|
|
5
|
-
getStructuralPath
|
|
6
|
-
|
|
5
|
+
getStructuralPath,
|
|
6
|
+
getStructuralSubpaths,
|
|
7
|
+
getSubpaths
|
|
8
|
+
} from "./chunk-K4MJG5VG.js";
|
|
7
9
|
import {
|
|
8
10
|
BadRequestError,
|
|
9
11
|
CurrencyMatchInputSchema,
|
|
@@ -53,16 +55,16 @@ var require_util = __commonJS({
|
|
|
53
55
|
return obj;
|
|
54
56
|
};
|
|
55
57
|
util2.getValidEnumValues = (obj) => {
|
|
56
|
-
const validKeys = util2.objectKeys(obj).filter((
|
|
58
|
+
const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
|
|
57
59
|
const filtered = {};
|
|
58
|
-
for (const
|
|
59
|
-
filtered[
|
|
60
|
+
for (const k2 of validKeys) {
|
|
61
|
+
filtered[k2] = obj[k2];
|
|
60
62
|
}
|
|
61
63
|
return util2.objectValues(filtered);
|
|
62
64
|
};
|
|
63
65
|
util2.objectValues = (obj) => {
|
|
64
|
-
return util2.objectKeys(obj).map(function(
|
|
65
|
-
return obj[
|
|
66
|
+
return util2.objectKeys(obj).map(function(e2) {
|
|
67
|
+
return obj[e2];
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
70
|
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
|
|
@@ -86,7 +88,7 @@ var require_util = __commonJS({
|
|
|
86
88
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
87
89
|
}
|
|
88
90
|
util2.joinValues = joinValues;
|
|
89
|
-
util2.jsonStringifyReplacer = (
|
|
91
|
+
util2.jsonStringifyReplacer = (_2, value) => {
|
|
90
92
|
if (typeof value === "bigint") {
|
|
91
93
|
return value.toString();
|
|
92
94
|
}
|
|
@@ -126,8 +128,8 @@ var require_util = __commonJS({
|
|
|
126
128
|
"set"
|
|
127
129
|
]);
|
|
128
130
|
var getParsedType = (data) => {
|
|
129
|
-
const
|
|
130
|
-
switch (
|
|
131
|
+
const t2 = typeof data;
|
|
132
|
+
switch (t2) {
|
|
131
133
|
case "undefined":
|
|
132
134
|
return exports.ZodParsedType.undefined;
|
|
133
135
|
case "string":
|
|
@@ -240,10 +242,10 @@ var require_ZodError = __commonJS({
|
|
|
240
242
|
fieldErrors._errors.push(mapper(issue));
|
|
241
243
|
} else {
|
|
242
244
|
let curr = fieldErrors;
|
|
243
|
-
let
|
|
244
|
-
while (
|
|
245
|
-
const el = issue.path[
|
|
246
|
-
const terminal =
|
|
245
|
+
let i2 = 0;
|
|
246
|
+
while (i2 < issue.path.length) {
|
|
247
|
+
const el = issue.path[i2];
|
|
248
|
+
const terminal = i2 === issue.path.length - 1;
|
|
247
249
|
if (!terminal) {
|
|
248
250
|
curr[el] = curr[el] || { _errors: [] };
|
|
249
251
|
} else {
|
|
@@ -251,7 +253,7 @@ var require_ZodError = __commonJS({
|
|
|
251
253
|
curr[el]._errors.push(mapper(issue));
|
|
252
254
|
}
|
|
253
255
|
curr = curr[el];
|
|
254
|
-
|
|
256
|
+
i2++;
|
|
255
257
|
}
|
|
256
258
|
}
|
|
257
259
|
}
|
|
@@ -459,7 +461,7 @@ var require_parseUtil = __commonJS({
|
|
|
459
461
|
};
|
|
460
462
|
}
|
|
461
463
|
let errorMessage = "";
|
|
462
|
-
const maps = errorMaps.filter((
|
|
464
|
+
const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
|
|
463
465
|
for (const map of maps) {
|
|
464
466
|
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
465
467
|
}
|
|
@@ -486,7 +488,7 @@ var require_parseUtil = __commonJS({
|
|
|
486
488
|
// then global override map
|
|
487
489
|
overrideMap === en_1.default ? void 0 : en_1.default
|
|
488
490
|
// then global default map
|
|
489
|
-
].filter((
|
|
491
|
+
].filter((x2) => !!x2)
|
|
490
492
|
});
|
|
491
493
|
ctx.common.issues.push(issue);
|
|
492
494
|
}
|
|
@@ -505,12 +507,12 @@ var require_parseUtil = __commonJS({
|
|
|
505
507
|
}
|
|
506
508
|
static mergeArray(status, results) {
|
|
507
509
|
const arrayValue = [];
|
|
508
|
-
for (const
|
|
509
|
-
if (
|
|
510
|
+
for (const s2 of results) {
|
|
511
|
+
if (s2.status === "aborted")
|
|
510
512
|
return exports.INVALID;
|
|
511
|
-
if (
|
|
513
|
+
if (s2.status === "dirty")
|
|
512
514
|
status.dirty();
|
|
513
|
-
arrayValue.push(
|
|
515
|
+
arrayValue.push(s2.value);
|
|
514
516
|
}
|
|
515
517
|
return { status: status.value, value: arrayValue };
|
|
516
518
|
}
|
|
@@ -553,13 +555,13 @@ var require_parseUtil = __commonJS({
|
|
|
553
555
|
exports.DIRTY = DIRTY;
|
|
554
556
|
var OK = (value) => ({ status: "valid", value });
|
|
555
557
|
exports.OK = OK;
|
|
556
|
-
var isAborted = (
|
|
558
|
+
var isAborted = (x2) => x2.status === "aborted";
|
|
557
559
|
exports.isAborted = isAborted;
|
|
558
|
-
var isDirty = (
|
|
560
|
+
var isDirty = (x2) => x2.status === "dirty";
|
|
559
561
|
exports.isDirty = isDirty;
|
|
560
|
-
var isValid = (
|
|
562
|
+
var isValid = (x2) => x2.status === "valid";
|
|
561
563
|
exports.isValid = isValid;
|
|
562
|
-
var isAsync = (
|
|
564
|
+
var isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
|
|
563
565
|
exports.isAsync = isAsync;
|
|
564
566
|
}
|
|
565
567
|
});
|
|
@@ -2337,14 +2339,14 @@ var require_types = __commonJS({
|
|
|
2337
2339
|
}
|
|
2338
2340
|
}
|
|
2339
2341
|
if (ctx.common.async) {
|
|
2340
|
-
return Promise.all([...ctx.data].map((item,
|
|
2341
|
-
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path,
|
|
2342
|
+
return Promise.all([...ctx.data].map((item, i2) => {
|
|
2343
|
+
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
2342
2344
|
})).then((result2) => {
|
|
2343
2345
|
return parseUtil_1.ParseStatus.mergeArray(status, result2);
|
|
2344
2346
|
});
|
|
2345
2347
|
}
|
|
2346
|
-
const result = [...ctx.data].map((item,
|
|
2347
|
-
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path,
|
|
2348
|
+
const result = [...ctx.data].map((item, i2) => {
|
|
2349
|
+
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
2348
2350
|
});
|
|
2349
2351
|
return parseUtil_1.ParseStatus.mergeArray(status, result);
|
|
2350
2352
|
}
|
|
@@ -2949,17 +2951,17 @@ var require_types = __commonJS({
|
|
|
2949
2951
|
}
|
|
2950
2952
|
};
|
|
2951
2953
|
exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
|
|
2952
|
-
function mergeValues(a,
|
|
2954
|
+
function mergeValues(a, b2) {
|
|
2953
2955
|
const aType = (0, util_1.getParsedType)(a);
|
|
2954
|
-
const bType = (0, util_1.getParsedType)(
|
|
2955
|
-
if (a ===
|
|
2956
|
+
const bType = (0, util_1.getParsedType)(b2);
|
|
2957
|
+
if (a === b2) {
|
|
2956
2958
|
return { valid: true, data: a };
|
|
2957
2959
|
} else if (aType === util_1.ZodParsedType.object && bType === util_1.ZodParsedType.object) {
|
|
2958
|
-
const bKeys = util_1.util.objectKeys(
|
|
2960
|
+
const bKeys = util_1.util.objectKeys(b2);
|
|
2959
2961
|
const sharedKeys = util_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2960
|
-
const newObj = { ...a, ...
|
|
2962
|
+
const newObj = { ...a, ...b2 };
|
|
2961
2963
|
for (const key of sharedKeys) {
|
|
2962
|
-
const sharedValue = mergeValues(a[key],
|
|
2964
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
2963
2965
|
if (!sharedValue.valid) {
|
|
2964
2966
|
return { valid: false };
|
|
2965
2967
|
}
|
|
@@ -2967,13 +2969,13 @@ var require_types = __commonJS({
|
|
|
2967
2969
|
}
|
|
2968
2970
|
return { valid: true, data: newObj };
|
|
2969
2971
|
} else if (aType === util_1.ZodParsedType.array && bType === util_1.ZodParsedType.array) {
|
|
2970
|
-
if (a.length !==
|
|
2972
|
+
if (a.length !== b2.length) {
|
|
2971
2973
|
return { valid: false };
|
|
2972
2974
|
}
|
|
2973
2975
|
const newArray = [];
|
|
2974
2976
|
for (let index = 0; index < a.length; index++) {
|
|
2975
2977
|
const itemA = a[index];
|
|
2976
|
-
const itemB =
|
|
2978
|
+
const itemB = b2[index];
|
|
2977
2979
|
const sharedValue = mergeValues(itemA, itemB);
|
|
2978
2980
|
if (!sharedValue.valid) {
|
|
2979
2981
|
return { valid: false };
|
|
@@ -2981,7 +2983,7 @@ var require_types = __commonJS({
|
|
|
2981
2983
|
newArray.push(sharedValue.data);
|
|
2982
2984
|
}
|
|
2983
2985
|
return { valid: true, data: newArray };
|
|
2984
|
-
} else if (aType === util_1.ZodParsedType.date && bType === util_1.ZodParsedType.date && +a === +
|
|
2986
|
+
} else if (aType === util_1.ZodParsedType.date && bType === util_1.ZodParsedType.date && +a === +b2) {
|
|
2985
2987
|
return { valid: true, data: a };
|
|
2986
2988
|
} else {
|
|
2987
2989
|
return { valid: false };
|
|
@@ -3078,7 +3080,7 @@ var require_types = __commonJS({
|
|
|
3078
3080
|
if (!schema)
|
|
3079
3081
|
return null;
|
|
3080
3082
|
return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
3081
|
-
}).filter((
|
|
3083
|
+
}).filter((x2) => !!x2);
|
|
3082
3084
|
if (ctx.common.async) {
|
|
3083
3085
|
return Promise.all(items).then((results) => {
|
|
3084
3086
|
return parseUtil_1.ParseStatus.mergeArray(status, results);
|
|
@@ -3280,7 +3282,7 @@ var require_types = __commonJS({
|
|
|
3280
3282
|
}
|
|
3281
3283
|
return { status: status.value, value: parsedSet };
|
|
3282
3284
|
}
|
|
3283
|
-
const elements = [...ctx.data.values()].map((item,
|
|
3285
|
+
const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));
|
|
3284
3286
|
if (ctx.common.async) {
|
|
3285
3287
|
return Promise.all(elements).then((elements2) => finalizeSet(elements2));
|
|
3286
3288
|
} else {
|
|
@@ -3340,7 +3342,7 @@ var require_types = __commonJS({
|
|
|
3340
3342
|
ctx.schemaErrorMap,
|
|
3341
3343
|
(0, errors_1.getErrorMap)(),
|
|
3342
3344
|
errors_1.defaultErrorMap
|
|
3343
|
-
].filter((
|
|
3345
|
+
].filter((x2) => !!x2),
|
|
3344
3346
|
issueData: {
|
|
3345
3347
|
code: ZodError_1.ZodIssueCode.invalid_arguments,
|
|
3346
3348
|
argumentsError: error
|
|
@@ -3356,7 +3358,7 @@ var require_types = __commonJS({
|
|
|
3356
3358
|
ctx.schemaErrorMap,
|
|
3357
3359
|
(0, errors_1.getErrorMap)(),
|
|
3358
3360
|
errors_1.defaultErrorMap
|
|
3359
|
-
].filter((
|
|
3361
|
+
].filter((x2) => !!x2),
|
|
3360
3362
|
issueData: {
|
|
3361
3363
|
code: ZodError_1.ZodIssueCode.invalid_return_type,
|
|
3362
3364
|
returnTypeError: error
|
|
@@ -3369,13 +3371,13 @@ var require_types = __commonJS({
|
|
|
3369
3371
|
const me = this;
|
|
3370
3372
|
return (0, parseUtil_1.OK)(async function(...args) {
|
|
3371
3373
|
const error = new ZodError_1.ZodError([]);
|
|
3372
|
-
const parsedArgs = await me._def.args.parseAsync(args, params).catch((
|
|
3373
|
-
error.addIssue(makeArgsIssue(args,
|
|
3374
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e2) => {
|
|
3375
|
+
error.addIssue(makeArgsIssue(args, e2));
|
|
3374
3376
|
throw error;
|
|
3375
3377
|
});
|
|
3376
3378
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3377
|
-
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((
|
|
3378
|
-
error.addIssue(makeReturnsIssue(result,
|
|
3379
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e2) => {
|
|
3380
|
+
error.addIssue(makeReturnsIssue(result, e2));
|
|
3379
3381
|
throw error;
|
|
3380
3382
|
});
|
|
3381
3383
|
return parsedReturns;
|
|
@@ -3971,10 +3973,10 @@ var require_types = __commonJS({
|
|
|
3971
3973
|
}
|
|
3972
3974
|
}
|
|
3973
3975
|
}
|
|
3974
|
-
static create(a,
|
|
3976
|
+
static create(a, b2) {
|
|
3975
3977
|
return new _ZodPipeline({
|
|
3976
3978
|
in: a,
|
|
3977
|
-
out:
|
|
3979
|
+
out: b2,
|
|
3978
3980
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3979
3981
|
});
|
|
3980
3982
|
}
|
|
@@ -4008,10 +4010,10 @@ var require_types = __commonJS({
|
|
|
4008
4010
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
4009
4011
|
var _a, _b;
|
|
4010
4012
|
if (!check(data)) {
|
|
4011
|
-
const
|
|
4012
|
-
const _fatal = (_b = (_a =
|
|
4013
|
-
const
|
|
4014
|
-
ctx.addIssue({ code: "custom", ...
|
|
4013
|
+
const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
4014
|
+
const _fatal = (_b = (_a = p2.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
4015
|
+
const p22 = typeof p2 === "string" ? { message: p2 } : p2;
|
|
4016
|
+
ctx.addIssue({ code: "custom", ...p22, fatal: _fatal });
|
|
4015
4017
|
}
|
|
4016
4018
|
});
|
|
4017
4019
|
return ZodAny.create();
|
|
@@ -4157,25 +4159,25 @@ var require_external = __commonJS({
|
|
|
4157
4159
|
"../../node_modules/zod/lib/external.js"(exports) {
|
|
4158
4160
|
"use strict";
|
|
4159
4161
|
init_cjs_shims();
|
|
4160
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(
|
|
4161
|
-
if (
|
|
4162
|
-
|
|
4163
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
4164
|
-
if (!desc || ("get" in desc ? !
|
|
4162
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
|
|
4163
|
+
if (k22 === void 0)
|
|
4164
|
+
k22 = k2;
|
|
4165
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
4166
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
4165
4167
|
desc = { enumerable: true, get: function() {
|
|
4166
|
-
return
|
|
4168
|
+
return m2[k2];
|
|
4167
4169
|
} };
|
|
4168
4170
|
}
|
|
4169
|
-
Object.defineProperty(
|
|
4170
|
-
} : function(
|
|
4171
|
-
if (
|
|
4172
|
-
|
|
4173
|
-
|
|
4171
|
+
Object.defineProperty(o2, k22, desc);
|
|
4172
|
+
} : function(o2, m2, k2, k22) {
|
|
4173
|
+
if (k22 === void 0)
|
|
4174
|
+
k22 = k2;
|
|
4175
|
+
o2[k22] = m2[k2];
|
|
4174
4176
|
});
|
|
4175
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
4176
|
-
for (var
|
|
4177
|
-
if (
|
|
4178
|
-
__createBinding(exports2,
|
|
4177
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
4178
|
+
for (var p2 in m2)
|
|
4179
|
+
if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
|
|
4180
|
+
__createBinding(exports2, m2, p2);
|
|
4179
4181
|
};
|
|
4180
4182
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4181
4183
|
__exportStar(require_errors(), exports);
|
|
@@ -4192,49 +4194,49 @@ var require_lib = __commonJS({
|
|
|
4192
4194
|
"../../node_modules/zod/lib/index.js"(exports) {
|
|
4193
4195
|
"use strict";
|
|
4194
4196
|
init_cjs_shims();
|
|
4195
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(
|
|
4196
|
-
if (
|
|
4197
|
-
|
|
4198
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
4199
|
-
if (!desc || ("get" in desc ? !
|
|
4197
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
|
|
4198
|
+
if (k22 === void 0)
|
|
4199
|
+
k22 = k2;
|
|
4200
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
4201
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
4200
4202
|
desc = { enumerable: true, get: function() {
|
|
4201
|
-
return
|
|
4203
|
+
return m2[k2];
|
|
4202
4204
|
} };
|
|
4203
4205
|
}
|
|
4204
|
-
Object.defineProperty(
|
|
4205
|
-
} : function(
|
|
4206
|
-
if (
|
|
4207
|
-
|
|
4208
|
-
|
|
4206
|
+
Object.defineProperty(o2, k22, desc);
|
|
4207
|
+
} : function(o2, m2, k2, k22) {
|
|
4208
|
+
if (k22 === void 0)
|
|
4209
|
+
k22 = k2;
|
|
4210
|
+
o2[k22] = m2[k2];
|
|
4209
4211
|
});
|
|
4210
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(
|
|
4211
|
-
Object.defineProperty(
|
|
4212
|
-
} : function(
|
|
4213
|
-
|
|
4212
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v2) {
|
|
4213
|
+
Object.defineProperty(o2, "default", { enumerable: true, value: v2 });
|
|
4214
|
+
} : function(o2, v2) {
|
|
4215
|
+
o2["default"] = v2;
|
|
4214
4216
|
});
|
|
4215
4217
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
4216
4218
|
if (mod && mod.__esModule)
|
|
4217
4219
|
return mod;
|
|
4218
4220
|
var result = {};
|
|
4219
4221
|
if (mod != null) {
|
|
4220
|
-
for (var
|
|
4221
|
-
if (
|
|
4222
|
-
__createBinding(result, mod,
|
|
4222
|
+
for (var k2 in mod)
|
|
4223
|
+
if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2))
|
|
4224
|
+
__createBinding(result, mod, k2);
|
|
4223
4225
|
}
|
|
4224
4226
|
__setModuleDefault(result, mod);
|
|
4225
4227
|
return result;
|
|
4226
4228
|
};
|
|
4227
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
4228
|
-
for (var
|
|
4229
|
-
if (
|
|
4230
|
-
__createBinding(exports2,
|
|
4229
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
4230
|
+
for (var p2 in m2)
|
|
4231
|
+
if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
|
|
4232
|
+
__createBinding(exports2, m2, p2);
|
|
4231
4233
|
};
|
|
4232
4234
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4233
4235
|
exports.z = void 0;
|
|
4234
|
-
var
|
|
4235
|
-
exports.z =
|
|
4236
|
+
var z3 = __importStar(require_external());
|
|
4237
|
+
exports.z = z3;
|
|
4236
4238
|
__exportStar(require_external(), exports);
|
|
4237
|
-
exports.default =
|
|
4239
|
+
exports.default = z3;
|
|
4238
4240
|
}
|
|
4239
4241
|
});
|
|
4240
4242
|
|
|
@@ -4290,34 +4292,34 @@ var require_ValidationError = __commonJS({
|
|
|
4290
4292
|
"../../node_modules/zod-validation-error/dist/cjs/ValidationError.js"(exports) {
|
|
4291
4293
|
"use strict";
|
|
4292
4294
|
init_cjs_shims();
|
|
4293
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(
|
|
4294
|
-
if (
|
|
4295
|
-
|
|
4296
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
4297
|
-
if (!desc || ("get" in desc ? !
|
|
4295
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
|
|
4296
|
+
if (k22 === void 0)
|
|
4297
|
+
k22 = k2;
|
|
4298
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
4299
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
4298
4300
|
desc = { enumerable: true, get: function() {
|
|
4299
|
-
return
|
|
4301
|
+
return m2[k2];
|
|
4300
4302
|
} };
|
|
4301
4303
|
}
|
|
4302
|
-
Object.defineProperty(
|
|
4303
|
-
} : function(
|
|
4304
|
-
if (
|
|
4305
|
-
|
|
4306
|
-
|
|
4304
|
+
Object.defineProperty(o2, k22, desc);
|
|
4305
|
+
} : function(o2, m2, k2, k22) {
|
|
4306
|
+
if (k22 === void 0)
|
|
4307
|
+
k22 = k2;
|
|
4308
|
+
o2[k22] = m2[k2];
|
|
4307
4309
|
});
|
|
4308
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(
|
|
4309
|
-
Object.defineProperty(
|
|
4310
|
-
} : function(
|
|
4311
|
-
|
|
4310
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v2) {
|
|
4311
|
+
Object.defineProperty(o2, "default", { enumerable: true, value: v2 });
|
|
4312
|
+
} : function(o2, v2) {
|
|
4313
|
+
o2["default"] = v2;
|
|
4312
4314
|
});
|
|
4313
4315
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
4314
4316
|
if (mod && mod.__esModule)
|
|
4315
4317
|
return mod;
|
|
4316
4318
|
var result = {};
|
|
4317
4319
|
if (mod != null) {
|
|
4318
|
-
for (var
|
|
4319
|
-
if (
|
|
4320
|
-
__createBinding(result, mod,
|
|
4320
|
+
for (var k2 in mod)
|
|
4321
|
+
if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2))
|
|
4322
|
+
__createBinding(result, mod, k2);
|
|
4321
4323
|
}
|
|
4322
4324
|
__setModuleDefault(result, mod);
|
|
4323
4325
|
return result;
|
|
@@ -4429,8 +4431,8 @@ var parseWithError = (schema, value, CustomError, options = {}) => {
|
|
|
4429
4431
|
zodMessage = (0, import_zod_validation_error.fromZodError)(cause, {
|
|
4430
4432
|
prefix
|
|
4431
4433
|
}).toString();
|
|
4432
|
-
} catch (
|
|
4433
|
-
zodMessage = `${prefix}: fromZodError failed: ${
|
|
4434
|
+
} catch (e2) {
|
|
4435
|
+
zodMessage = `${prefix}: fromZodError failed: ${e2}`;
|
|
4434
4436
|
}
|
|
4435
4437
|
const sanitizedError = new Error(cause.message);
|
|
4436
4438
|
sanitizedError.name = cause.name;
|
|
@@ -4484,7 +4486,7 @@ var LedgerMigrationStatusSchema = z.enum([
|
|
|
4484
4486
|
"completed",
|
|
4485
4487
|
"skipped"
|
|
4486
4488
|
]);
|
|
4487
|
-
var SafeRecordKey = z.string().refine((
|
|
4489
|
+
var SafeRecordKey = z.string().refine((v2) => v2 !== "__proto__", "invalid parameter name");
|
|
4488
4490
|
var ParametersSchema = z.record(
|
|
4489
4491
|
SafeRecordKey,
|
|
4490
4492
|
z.string({
|
|
@@ -4502,9 +4504,9 @@ var EntryParametersSchema = z.record(
|
|
|
4502
4504
|
);
|
|
4503
4505
|
var ConsistencyModeSchema = z.enum(["strong", "eventual"]);
|
|
4504
4506
|
var ConsistencyConfigSchema = (keys, extra) => {
|
|
4505
|
-
const
|
|
4507
|
+
const v2 = z.optional(ConsistencyModeSchema);
|
|
4506
4508
|
const schemaObject = Object.fromEntries(
|
|
4507
|
-
keys.map((key) => [key,
|
|
4509
|
+
keys.map((key) => [key, v2])
|
|
4508
4510
|
);
|
|
4509
4511
|
return z.object({ ...extra, ...schemaObject });
|
|
4510
4512
|
};
|
|
@@ -4584,7 +4586,7 @@ var BaseSchemaLedgerEntryConditionInput = z.object({
|
|
|
4584
4586
|
precondition: SchemaCondition.optional(),
|
|
4585
4587
|
currency: SchemaCurrencyMatchInput.optional(),
|
|
4586
4588
|
repeated: z.object({
|
|
4587
|
-
key: SafeStringSchema.refine((
|
|
4589
|
+
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
4588
4590
|
message: "repeated.key cannot be empty"
|
|
4589
4591
|
})
|
|
4590
4592
|
}).optional()
|
|
@@ -4602,7 +4604,7 @@ var BaseSchemaLedgerEntryLineInput = z.object({
|
|
|
4602
4604
|
tx: SchemaTxMatchInput.optional(),
|
|
4603
4605
|
tags: z.array(BaseSchemaLedgerLineTagInput).optional(),
|
|
4604
4606
|
repeated: z.object({
|
|
4605
|
-
key: SafeStringSchema.refine((
|
|
4607
|
+
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
4606
4608
|
message: "repeated.key cannot be empty"
|
|
4607
4609
|
})
|
|
4608
4610
|
}).optional()
|
|
@@ -5306,6 +5308,189 @@ var transformAndValidateCoA = ({
|
|
|
5306
5308
|
// ../../libs/schema-validation/utils/transformers/entries.ts
|
|
5307
5309
|
init_cjs_shims();
|
|
5308
5310
|
|
|
5311
|
+
// ../../node_modules/ts-pattern/dist/index.js
|
|
5312
|
+
init_cjs_shims();
|
|
5313
|
+
var t = Symbol.for("@ts-pattern/matcher");
|
|
5314
|
+
var e = Symbol.for("@ts-pattern/isVariadic");
|
|
5315
|
+
var n = "@ts-pattern/anonymous-select-key";
|
|
5316
|
+
var r = (t2) => Boolean(t2 && "object" == typeof t2);
|
|
5317
|
+
var i = (e2) => e2 && !!e2[t];
|
|
5318
|
+
var s = (n2, o2, c2) => {
|
|
5319
|
+
if (i(n2)) {
|
|
5320
|
+
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
|
|
5321
|
+
return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
|
|
5322
|
+
}
|
|
5323
|
+
if (r(n2)) {
|
|
5324
|
+
if (!r(o2))
|
|
5325
|
+
return false;
|
|
5326
|
+
if (Array.isArray(n2)) {
|
|
5327
|
+
if (!Array.isArray(o2))
|
|
5328
|
+
return false;
|
|
5329
|
+
let t2 = [], r2 = [], a = [];
|
|
5330
|
+
for (const s2 of n2.keys()) {
|
|
5331
|
+
const o3 = n2[s2];
|
|
5332
|
+
i(o3) && o3[e] ? a.push(o3) : a.length ? r2.push(o3) : t2.push(o3);
|
|
5333
|
+
}
|
|
5334
|
+
if (a.length) {
|
|
5335
|
+
if (a.length > 1)
|
|
5336
|
+
throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
|
|
5337
|
+
if (o2.length < t2.length + r2.length)
|
|
5338
|
+
return false;
|
|
5339
|
+
const e2 = o2.slice(0, t2.length), n3 = 0 === r2.length ? [] : o2.slice(-r2.length), i2 = o2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
|
|
5340
|
+
return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a.length || s(a[0], i2, c2));
|
|
5341
|
+
}
|
|
5342
|
+
return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
|
|
5343
|
+
}
|
|
5344
|
+
return Reflect.ownKeys(n2).every((e2) => {
|
|
5345
|
+
const r2 = n2[e2];
|
|
5346
|
+
return (e2 in o2 || i(a = r2) && "optional" === a[t]().matcherType) && s(r2, o2[e2], c2);
|
|
5347
|
+
var a;
|
|
5348
|
+
});
|
|
5349
|
+
}
|
|
5350
|
+
return Object.is(o2, n2);
|
|
5351
|
+
};
|
|
5352
|
+
var o = (e2) => {
|
|
5353
|
+
var n2, s2, a;
|
|
5354
|
+
return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
|
|
5355
|
+
};
|
|
5356
|
+
var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
|
|
5357
|
+
function u(t2) {
|
|
5358
|
+
return Object.assign(t2, { optional: () => h(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? y(t2) : y(e2, t2) });
|
|
5359
|
+
}
|
|
5360
|
+
function h(e2) {
|
|
5361
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
5362
|
+
let n2 = {};
|
|
5363
|
+
const r2 = (t3, e3) => {
|
|
5364
|
+
n2[t3] = e3;
|
|
5365
|
+
};
|
|
5366
|
+
return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
|
|
5367
|
+
}, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
|
|
5368
|
+
}
|
|
5369
|
+
function m(...e2) {
|
|
5370
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
5371
|
+
let n2 = {};
|
|
5372
|
+
const r2 = (t3, e3) => {
|
|
5373
|
+
n2[t3] = e3;
|
|
5374
|
+
};
|
|
5375
|
+
return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
|
|
5376
|
+
}, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
|
|
5377
|
+
}
|
|
5378
|
+
function d(...e2) {
|
|
5379
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
5380
|
+
let n2 = {};
|
|
5381
|
+
const r2 = (t3, e3) => {
|
|
5382
|
+
n2[t3] = e3;
|
|
5383
|
+
};
|
|
5384
|
+
return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
|
|
5385
|
+
}, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
|
|
5386
|
+
}
|
|
5387
|
+
function p(e2) {
|
|
5388
|
+
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
|
|
5389
|
+
}
|
|
5390
|
+
function y(...e2) {
|
|
5391
|
+
const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
|
|
5392
|
+
return u({ [t]: () => ({ match: (t2) => {
|
|
5393
|
+
let e3 = { [null != r2 ? r2 : n]: t2 };
|
|
5394
|
+
return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
|
|
5395
|
+
e3[t3] = n2;
|
|
5396
|
+
}), selections: e3 };
|
|
5397
|
+
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
|
|
5398
|
+
}
|
|
5399
|
+
function v(t2) {
|
|
5400
|
+
return "number" == typeof t2;
|
|
5401
|
+
}
|
|
5402
|
+
function b(t2) {
|
|
5403
|
+
return "string" == typeof t2;
|
|
5404
|
+
}
|
|
5405
|
+
function w(t2) {
|
|
5406
|
+
return "bigint" == typeof t2;
|
|
5407
|
+
}
|
|
5408
|
+
var S = u(p(function(t2) {
|
|
5409
|
+
return true;
|
|
5410
|
+
}));
|
|
5411
|
+
var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
|
|
5412
|
+
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.startsWith(n2)))));
|
|
5413
|
+
var n2;
|
|
5414
|
+
}, endsWith: (e2) => {
|
|
5415
|
+
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.endsWith(n2)))));
|
|
5416
|
+
var n2;
|
|
5417
|
+
}, minLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
|
|
5418
|
+
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.includes(n2)))));
|
|
5419
|
+
var n2;
|
|
5420
|
+
}, regex: (e2) => {
|
|
5421
|
+
return j(m(t2, (n2 = e2, p((t3) => b(t3) && Boolean(t3.match(n2))))));
|
|
5422
|
+
var n2;
|
|
5423
|
+
} });
|
|
5424
|
+
var K = j(p(b));
|
|
5425
|
+
var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => p((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p((t3) => v(t3) && t3 < 0))) });
|
|
5426
|
+
var E = x(p(v));
|
|
5427
|
+
var A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => p((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p((t3) => w(t3) && t3 < 0))) });
|
|
5428
|
+
var P = A(p(w));
|
|
5429
|
+
var T = u(p(function(t2) {
|
|
5430
|
+
return "boolean" == typeof t2;
|
|
5431
|
+
}));
|
|
5432
|
+
var B = u(p(function(t2) {
|
|
5433
|
+
return "symbol" == typeof t2;
|
|
5434
|
+
}));
|
|
5435
|
+
var _ = u(p(function(t2) {
|
|
5436
|
+
return null == t2;
|
|
5437
|
+
}));
|
|
5438
|
+
var k = u(p(function(t2) {
|
|
5439
|
+
return null != t2;
|
|
5440
|
+
}));
|
|
5441
|
+
var W = class extends Error {
|
|
5442
|
+
constructor(t2) {
|
|
5443
|
+
let e2;
|
|
5444
|
+
try {
|
|
5445
|
+
e2 = JSON.stringify(t2);
|
|
5446
|
+
} catch (n2) {
|
|
5447
|
+
e2 = t2;
|
|
5448
|
+
}
|
|
5449
|
+
super(`Pattern matching error: no pattern matches value ${e2}`), this.input = void 0, this.input = t2;
|
|
5450
|
+
}
|
|
5451
|
+
};
|
|
5452
|
+
var $ = { matched: false, value: void 0 };
|
|
5453
|
+
function z2(t2) {
|
|
5454
|
+
return new I(t2, $);
|
|
5455
|
+
}
|
|
5456
|
+
var I = class _I {
|
|
5457
|
+
constructor(t2, e2) {
|
|
5458
|
+
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
|
|
5459
|
+
}
|
|
5460
|
+
with(...t2) {
|
|
5461
|
+
if (this.state.matched)
|
|
5462
|
+
return this;
|
|
5463
|
+
const e2 = t2[t2.length - 1], r2 = [t2[0]];
|
|
5464
|
+
let i2;
|
|
5465
|
+
3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
|
|
5466
|
+
let o2 = false, c2 = {};
|
|
5467
|
+
const a = (t3, e3) => {
|
|
5468
|
+
o2 = true, c2[t3] = e3;
|
|
5469
|
+
}, u2 = !r2.some((t3) => s(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? $ : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
|
|
5470
|
+
return new _I(this.input, u2);
|
|
5471
|
+
}
|
|
5472
|
+
when(t2, e2) {
|
|
5473
|
+
if (this.state.matched)
|
|
5474
|
+
return this;
|
|
5475
|
+
const n2 = Boolean(t2(this.input));
|
|
5476
|
+
return new _I(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : $);
|
|
5477
|
+
}
|
|
5478
|
+
otherwise(t2) {
|
|
5479
|
+
return this.state.matched ? this.state.value : t2(this.input);
|
|
5480
|
+
}
|
|
5481
|
+
exhaustive() {
|
|
5482
|
+
if (this.state.matched)
|
|
5483
|
+
return this.state.value;
|
|
5484
|
+
throw new W(this.input);
|
|
5485
|
+
}
|
|
5486
|
+
run() {
|
|
5487
|
+
return this.exhaustive();
|
|
5488
|
+
}
|
|
5489
|
+
returnType() {
|
|
5490
|
+
return this;
|
|
5491
|
+
}
|
|
5492
|
+
};
|
|
5493
|
+
|
|
5309
5494
|
// ../../libs/accounting-validation/index.ts
|
|
5310
5495
|
init_cjs_shims();
|
|
5311
5496
|
import assert from "assert";
|
|
@@ -5359,46 +5544,46 @@ var tokenizeWithVars = (expression) => {
|
|
|
5359
5544
|
};
|
|
5360
5545
|
var evaluateExpressionWithVars = (expression) => {
|
|
5361
5546
|
const tokens = tokenizeWithVars(expression);
|
|
5362
|
-
let
|
|
5547
|
+
let i2 = 0;
|
|
5363
5548
|
const assertNextToken = () => {
|
|
5364
|
-
assert_default(tokens[
|
|
5365
|
-
message: `Unexpected end of expression at position ${tokens[
|
|
5549
|
+
assert_default(tokens[i2 + 1] !== void 0, BadRequestError, () => ({
|
|
5550
|
+
message: `Unexpected end of expression at position ${tokens[i2].start + tokens[i2].repr.length}`
|
|
5366
5551
|
}));
|
|
5367
5552
|
};
|
|
5368
5553
|
const term = () => {
|
|
5369
|
-
const
|
|
5370
|
-
assert_default(
|
|
5554
|
+
const t2 = tokens[i2];
|
|
5555
|
+
assert_default(t2 !== void 0, BadRequestError, () => ({
|
|
5371
5556
|
message: `Unexpected end of expression at position ${expression.length}`
|
|
5372
5557
|
}));
|
|
5373
|
-
if (
|
|
5558
|
+
if (t2.type === "+") {
|
|
5374
5559
|
assertNextToken();
|
|
5375
|
-
|
|
5560
|
+
i2 += 1;
|
|
5376
5561
|
return term();
|
|
5377
5562
|
}
|
|
5378
|
-
if (
|
|
5563
|
+
if (t2.type === "-") {
|
|
5379
5564
|
assertNextToken();
|
|
5380
|
-
|
|
5565
|
+
i2 += 1;
|
|
5381
5566
|
const nextTerm = term();
|
|
5382
5567
|
return typeof nextTerm === "bigint" ? -nextTerm : [-nextTerm[0], nextTerm[1]];
|
|
5383
5568
|
}
|
|
5384
|
-
if (
|
|
5385
|
-
|
|
5386
|
-
return [1,
|
|
5569
|
+
if (t2.type === "var") {
|
|
5570
|
+
i2 += 1;
|
|
5571
|
+
return [1, t2.repr.substring(2, t2.repr.length - 2).trim()];
|
|
5387
5572
|
}
|
|
5388
|
-
const value2 = BigInt(tokens[
|
|
5389
|
-
|
|
5573
|
+
const value2 = BigInt(tokens[i2].repr);
|
|
5574
|
+
i2 += 1;
|
|
5390
5575
|
return value2;
|
|
5391
5576
|
};
|
|
5392
5577
|
const assertTokenIsOp = () => {
|
|
5393
|
-
const
|
|
5394
|
-
assert_default(
|
|
5395
|
-
message: `expected operator + or - at position ${
|
|
5578
|
+
const t2 = tokens[i2];
|
|
5579
|
+
assert_default(t2.type === "-" || t2.type === "+", BadRequestError, () => ({
|
|
5580
|
+
message: `expected operator + or - at position ${t2.start}, found ${t2.repr}`
|
|
5396
5581
|
}));
|
|
5397
5582
|
};
|
|
5398
5583
|
const expr = () => {
|
|
5399
5584
|
const firstTerm = term();
|
|
5400
5585
|
let value2 = typeof firstTerm === "bigint" ? [firstTerm, /* @__PURE__ */ new Map()] : [0n, /* @__PURE__ */ new Map([[firstTerm[1], firstTerm[0]]])];
|
|
5401
|
-
while (
|
|
5586
|
+
while (i2 < tokens.length) {
|
|
5402
5587
|
assertTokenIsOp();
|
|
5403
5588
|
const nextTerm = term();
|
|
5404
5589
|
value2 = typeof nextTerm === "bigint" ? [value2[0] + nextTerm, value2[1]] : [
|
|
@@ -5409,7 +5594,7 @@ var evaluateExpressionWithVars = (expression) => {
|
|
|
5409
5594
|
)
|
|
5410
5595
|
];
|
|
5411
5596
|
}
|
|
5412
|
-
return [value2[0], new Map(Array.from(value2[1]).filter(([,
|
|
5597
|
+
return [value2[0], new Map(Array.from(value2[1]).filter(([, n2]) => n2 !== 0))];
|
|
5413
5598
|
};
|
|
5414
5599
|
const value = expr();
|
|
5415
5600
|
try {
|
|
@@ -5423,29 +5608,29 @@ var evaluateExpressionWithVars = (expression) => {
|
|
|
5423
5608
|
throw new BadRequestError(err.message);
|
|
5424
5609
|
}
|
|
5425
5610
|
};
|
|
5426
|
-
var add = (a,
|
|
5427
|
-
const keys = /* @__PURE__ */ new Set([...a[1].keys(), ...
|
|
5611
|
+
var add = (a, b2) => {
|
|
5612
|
+
const keys = /* @__PURE__ */ new Set([...a[1].keys(), ...b2[1].keys()]);
|
|
5428
5613
|
const result = new Map(
|
|
5429
|
-
Array.from(keys).map((key) => [key, (a[1].get(key) ?? 0) + (
|
|
5614
|
+
Array.from(keys).map((key) => [key, (a[1].get(key) ?? 0) + (b2[1].get(key) ?? 0)]).filter(([, n2]) => n2 !== 0)
|
|
5430
5615
|
);
|
|
5431
|
-
return [a[0] +
|
|
5616
|
+
return [a[0] + b2[0], result];
|
|
5432
5617
|
};
|
|
5433
|
-
var subtract = (a,
|
|
5434
|
-
const keys = /* @__PURE__ */ new Set([...a[1].keys(), ...
|
|
5618
|
+
var subtract = (a, b2) => {
|
|
5619
|
+
const keys = /* @__PURE__ */ new Set([...a[1].keys(), ...b2[1].keys()]);
|
|
5435
5620
|
const result = new Map(
|
|
5436
|
-
Array.from(keys).map((key) => [key, (a[1].get(key) ?? 0) - (
|
|
5621
|
+
Array.from(keys).map((key) => [key, (a[1].get(key) ?? 0) - (b2[1].get(key) ?? 0)]).filter(([, n2]) => n2 !== 0)
|
|
5437
5622
|
);
|
|
5438
|
-
return [a[0] -
|
|
5623
|
+
return [a[0] - b2[0], result];
|
|
5439
5624
|
};
|
|
5440
5625
|
function abs(bigint) {
|
|
5441
5626
|
return bigint < 0n ? -bigint : bigint;
|
|
5442
5627
|
}
|
|
5443
5628
|
var zero = [0n, /* @__PURE__ */ new Map()];
|
|
5444
5629
|
var toString = (value, options = {}) => {
|
|
5445
|
-
const varMap = options.varMap ?? ((
|
|
5630
|
+
const varMap = options.varMap ?? ((v2) => v2);
|
|
5446
5631
|
const noCoefficients = options.noCoefficients ?? false;
|
|
5447
|
-
const terms = Array.from(value[1].entries()).filter(([,
|
|
5448
|
-
([key,
|
|
5632
|
+
const terms = Array.from(value[1].entries()).filter(([, n2]) => n2 !== 0).sort((a, b2) => b2[1] - a[1]).map(
|
|
5633
|
+
([key, n2]) => noCoefficients ? ` ${n2 >= 0 ? "+" : "-"} ${varMap(key)}`.repeat(Math.abs(n2)).substring(1) : `${n2 >= 0 ? "+" : "-"} ${Math.abs(n2) === 1 ? "" : `${Math.abs(n2)} * `}${varMap(key)}`
|
|
5449
5634
|
).join(" ");
|
|
5450
5635
|
if (terms === "") {
|
|
5451
5636
|
return value[0].toString();
|
|
@@ -5471,8 +5656,8 @@ var JSONStringSchema = z.string().transform((str) => {
|
|
|
5471
5656
|
|
|
5472
5657
|
// ../../libs/serde/bigints.ts
|
|
5473
5658
|
init_cjs_shims();
|
|
5474
|
-
var isSafeInteger = (
|
|
5475
|
-
return
|
|
5659
|
+
var isSafeInteger = (n2) => {
|
|
5660
|
+
return n2 >= Number.MIN_SAFE_INTEGER && n2 <= Number.MAX_SAFE_INTEGER;
|
|
5476
5661
|
};
|
|
5477
5662
|
var bigIntToNumberOrStringReplacer = (key, value) => {
|
|
5478
5663
|
if (typeof value === "bigint") {
|
|
@@ -5538,7 +5723,7 @@ var assertValidCurrency = (params) => {
|
|
|
5538
5723
|
|
|
5539
5724
|
// ../../libs/accounting-validation/utils.ts
|
|
5540
5725
|
init_cjs_shims();
|
|
5541
|
-
var abs2 = (
|
|
5726
|
+
var abs2 = (n2) => n2 < 0 ? -n2 : n2;
|
|
5542
5727
|
var getCreditOrDebit = (ledgerAccountType, line) => {
|
|
5543
5728
|
if (ledgerAccountType === "asset" || ledgerAccountType === "expense") {
|
|
5544
5729
|
if (line.amount < 0) {
|
|
@@ -5937,11 +6122,11 @@ var validateUniqueByKey = ({
|
|
|
5937
6122
|
idx,
|
|
5938
6123
|
type
|
|
5939
6124
|
]);
|
|
5940
|
-
return Array.from(groupByMap(types, ([type]) => type).entries()).filter(([_k,
|
|
5941
|
-
([_k, vs]) => vs.map(([
|
|
6125
|
+
return Array.from(groupByMap(types, ([type]) => type).entries()).filter(([_k, v2]) => v2.length > 1).flatMap(
|
|
6126
|
+
([_k, vs]) => vs.map(([_2, v2, item]) => ({
|
|
5942
6127
|
message: getErrorMessage(item),
|
|
5943
6128
|
// message: `${entityName} cannot have duplicate ${key} '${k}'`,
|
|
5944
|
-
path: [...pathPrefix,
|
|
6129
|
+
path: [...pathPrefix, v2, key]
|
|
5945
6130
|
}))
|
|
5946
6131
|
);
|
|
5947
6132
|
};
|
|
@@ -5982,9 +6167,9 @@ var getFullyParameterizedAccount = (accountPath, accountPathToAccount, entryPara
|
|
|
5982
6167
|
};
|
|
5983
6168
|
var validateLineAccount = (entryType, lineKey, accountPath, accountPathToAccount, entryParameters) => {
|
|
5984
6169
|
const validationResults = safeGetZodErrors(
|
|
5985
|
-
ParameterizedString.refine((
|
|
6170
|
+
ParameterizedString.refine((s2) => s2.length > 0, {
|
|
5986
6171
|
message: `Ledger Line (${lineKey}) in Ledger Entry (${entryType}) must specify a Ledger Account path`
|
|
5987
|
-
}).refine((
|
|
6172
|
+
}).refine((s2) => !s2.includes("#"), {
|
|
5988
6173
|
message: `Ledger Line account path '${accountPath}' cannot contain '#'`
|
|
5989
6174
|
}),
|
|
5990
6175
|
accountPath,
|
|
@@ -6161,8 +6346,8 @@ var validateLine = (entryType, entryParameters, entryHasTwoLines, entryHasAnyLin
|
|
|
6161
6346
|
}
|
|
6162
6347
|
return validationResult;
|
|
6163
6348
|
};
|
|
6164
|
-
var isKDefined = (
|
|
6165
|
-
return line[
|
|
6349
|
+
var isKDefined = (k2, line) => {
|
|
6350
|
+
return line[k2] !== void 0;
|
|
6166
6351
|
};
|
|
6167
6352
|
var validateBalancedLineGroup = (entryType, entryParameters, lines, accountPathToAccount) => {
|
|
6168
6353
|
const parameterizedLines = lines.map(
|
|
@@ -6198,11 +6383,11 @@ var validateBalancedLineGroup = (entryType, entryParameters, lines, accountPathT
|
|
|
6198
6383
|
lines: parameterizedLines,
|
|
6199
6384
|
entryType
|
|
6200
6385
|
});
|
|
6201
|
-
} catch (
|
|
6202
|
-
if (
|
|
6386
|
+
} catch (e2) {
|
|
6387
|
+
if (e2 instanceof Error) {
|
|
6203
6388
|
return [
|
|
6204
6389
|
{
|
|
6205
|
-
message:
|
|
6390
|
+
message: e2.message,
|
|
6206
6391
|
path: ["lines"]
|
|
6207
6392
|
}
|
|
6208
6393
|
];
|
|
@@ -6428,16 +6613,16 @@ var validateDescription = (description) => {
|
|
|
6428
6613
|
var validateTags = (tags) => {
|
|
6429
6614
|
const errors = [];
|
|
6430
6615
|
const keyValues = /* @__PURE__ */ new Map();
|
|
6431
|
-
tags.forEach(({ key, value },
|
|
6616
|
+
tags.forEach(({ key, value }, i2) => {
|
|
6432
6617
|
if (!value || !key) {
|
|
6433
6618
|
errors.push({
|
|
6434
|
-
path: ["tags",
|
|
6619
|
+
path: ["tags", i2, !key ? "key" : "value"],
|
|
6435
6620
|
message: "Tag Keys and Values may not be empty or whitespace-only strings."
|
|
6436
6621
|
});
|
|
6437
6622
|
} else {
|
|
6438
6623
|
if (keyValues.has(key) && keyValues.get(key) !== value) {
|
|
6439
6624
|
errors.push({
|
|
6440
|
-
path: ["tags",
|
|
6625
|
+
path: ["tags", i2, "key"],
|
|
6441
6626
|
message: `Tag keys must be unique. Tag key '${key}' already has another value '${keyValues.get(
|
|
6442
6627
|
key
|
|
6443
6628
|
)}'.`
|
|
@@ -6448,43 +6633,43 @@ var validateTags = (tags) => {
|
|
|
6448
6633
|
errors.push(
|
|
6449
6634
|
...validateNonEmptySafeString({
|
|
6450
6635
|
value: key.trim(),
|
|
6451
|
-
path: ["tags",
|
|
6636
|
+
path: ["tags", i2, "key"],
|
|
6452
6637
|
name: "key",
|
|
6453
6638
|
entityName: "Tag"
|
|
6454
6639
|
})
|
|
6455
6640
|
);
|
|
6456
6641
|
if (key.length > MAX_TAG_KEY_LENGTH) {
|
|
6457
6642
|
errors.push({
|
|
6458
|
-
path: ["tags",
|
|
6643
|
+
path: ["tags", i2, "key"],
|
|
6459
6644
|
message: `Tag keys must be at most ${MAX_TAG_KEY_LENGTH} characters. You specified ${key.length} characters.`
|
|
6460
6645
|
});
|
|
6461
6646
|
}
|
|
6462
6647
|
if (value.trim().length === 0) {
|
|
6463
6648
|
errors.push({
|
|
6464
|
-
path: ["tags",
|
|
6649
|
+
path: ["tags", i2, "value"],
|
|
6465
6650
|
message: "Tag values may not be empty or whitespace-only strings."
|
|
6466
6651
|
});
|
|
6467
6652
|
}
|
|
6468
6653
|
errors.push(
|
|
6469
6654
|
...safeGetZodErrors(
|
|
6470
6655
|
ParameterizedString.refine(
|
|
6471
|
-
(
|
|
6656
|
+
(s2) => !s2.includes("#") && !s2.includes("/") && !s2.includes(":"),
|
|
6472
6657
|
{
|
|
6473
6658
|
message: `Tag value '${value}' cannot contain '#', '/', or ':'`
|
|
6474
6659
|
}
|
|
6475
6660
|
),
|
|
6476
6661
|
value
|
|
6477
|
-
).map(({ path:
|
|
6662
|
+
).map(({ path: _2, ...rest }) => ({
|
|
6478
6663
|
// zod requires string args for path, and we want to use a number.
|
|
6479
6664
|
// we'll just provide our own path.
|
|
6480
|
-
path: ["tags",
|
|
6665
|
+
path: ["tags", i2, "value"],
|
|
6481
6666
|
...rest
|
|
6482
6667
|
}))
|
|
6483
6668
|
);
|
|
6484
6669
|
const minLength = getParameterizedStringMinLength(value);
|
|
6485
6670
|
if (minLength > MAX_TAG_VALUE_LENGTH) {
|
|
6486
6671
|
errors.push({
|
|
6487
|
-
path: ["tags",
|
|
6672
|
+
path: ["tags", i2, "value"],
|
|
6488
6673
|
message: `Tag values must be at most ${MAX_TAG_VALUE_LENGTH} characters. Length after filling all parameters is at least ${minLength}.`
|
|
6489
6674
|
});
|
|
6490
6675
|
}
|
|
@@ -6501,25 +6686,25 @@ var validateTags = (tags) => {
|
|
|
6501
6686
|
var validateGroups = (groups) => {
|
|
6502
6687
|
const errors = [];
|
|
6503
6688
|
const keyValues = /* @__PURE__ */ new Map();
|
|
6504
|
-
groups.forEach(({ key },
|
|
6689
|
+
groups.forEach(({ key }, i2) => {
|
|
6505
6690
|
const keyResult = SafeStringSchema.safeParse(key);
|
|
6506
6691
|
if (!keyResult.success) {
|
|
6507
6692
|
errors.push({
|
|
6508
|
-
path: ["groups",
|
|
6693
|
+
path: ["groups", i2, "key"],
|
|
6509
6694
|
message: `Group key '${key}' cannot contain '#', '/', ':', or parameters in {{handlebar}} syntax`
|
|
6510
6695
|
});
|
|
6511
6696
|
}
|
|
6512
6697
|
});
|
|
6513
|
-
groups.forEach(({ key, value },
|
|
6698
|
+
groups.forEach(({ key, value }, i2) => {
|
|
6514
6699
|
if (!value || !key) {
|
|
6515
6700
|
errors.push({
|
|
6516
|
-
path: ["groups",
|
|
6701
|
+
path: ["groups", i2, !key ? "key" : "value"],
|
|
6517
6702
|
message: "Group Keys and Values may not be empty or whitespace-only strings."
|
|
6518
6703
|
});
|
|
6519
6704
|
} else {
|
|
6520
6705
|
if (keyValues.has(key) && keyValues.get(key) !== value) {
|
|
6521
6706
|
errors.push({
|
|
6522
|
-
path: ["groups",
|
|
6707
|
+
path: ["groups", i2, "key"],
|
|
6523
6708
|
message: `Group keys must be unique. Group key '${key}' already has another value '${keyValues.get(
|
|
6524
6709
|
key
|
|
6525
6710
|
)}'.`
|
|
@@ -6530,43 +6715,43 @@ var validateGroups = (groups) => {
|
|
|
6530
6715
|
errors.push(
|
|
6531
6716
|
...validateNonEmptySafeString({
|
|
6532
6717
|
value: key.trim(),
|
|
6533
|
-
path: ["groups",
|
|
6718
|
+
path: ["groups", i2, "key"],
|
|
6534
6719
|
name: "key",
|
|
6535
6720
|
entityName: "Group"
|
|
6536
6721
|
})
|
|
6537
6722
|
);
|
|
6538
6723
|
if (key.length > 128) {
|
|
6539
6724
|
errors.push({
|
|
6540
|
-
path: ["groups",
|
|
6725
|
+
path: ["groups", i2, "key"],
|
|
6541
6726
|
message: `Group keys must be at most 128 characters. You specified ${key.length} characters.`
|
|
6542
6727
|
});
|
|
6543
6728
|
}
|
|
6544
6729
|
if (value.trim().length === 0) {
|
|
6545
6730
|
errors.push({
|
|
6546
|
-
path: ["groups",
|
|
6731
|
+
path: ["groups", i2, "value"],
|
|
6547
6732
|
message: "Group values may not be empty or whitespace-only strings."
|
|
6548
6733
|
});
|
|
6549
6734
|
}
|
|
6550
6735
|
errors.push(
|
|
6551
6736
|
...safeGetZodErrors(
|
|
6552
6737
|
ParameterizedString.refine(
|
|
6553
|
-
(
|
|
6738
|
+
(s2) => !s2.includes("#") && !s2.includes("/") && !s2.includes(":"),
|
|
6554
6739
|
{
|
|
6555
6740
|
message: `Group value '${value}' cannot contain '#', '/', or ':'`
|
|
6556
6741
|
}
|
|
6557
6742
|
),
|
|
6558
6743
|
value
|
|
6559
|
-
).map(({ path:
|
|
6744
|
+
).map(({ path: _2, ...rest }) => ({
|
|
6560
6745
|
// zod requires string args for path, and we want to use a number.
|
|
6561
6746
|
// we'll just provide our own path.
|
|
6562
|
-
path: ["groups",
|
|
6747
|
+
path: ["groups", i2, "value"],
|
|
6563
6748
|
...rest
|
|
6564
6749
|
}))
|
|
6565
6750
|
);
|
|
6566
6751
|
const minLength = getParameterizedStringMinLength(value);
|
|
6567
6752
|
if (minLength > 128) {
|
|
6568
6753
|
errors.push({
|
|
6569
|
-
path: ["groups",
|
|
6754
|
+
path: ["groups", i2, "value"],
|
|
6570
6755
|
message: `Group values must be at most 128 characters. Length after filling all parameters is at least ${minLength}.`
|
|
6571
6756
|
});
|
|
6572
6757
|
}
|
|
@@ -6580,33 +6765,67 @@ var validateGroups = (groups) => {
|
|
|
6580
6765
|
}
|
|
6581
6766
|
return errors;
|
|
6582
6767
|
};
|
|
6583
|
-
var
|
|
6768
|
+
var dedupeKeyFor = (c2) => z2(c2).with(
|
|
6769
|
+
{ kind: "subpath" },
|
|
6770
|
+
({ subpath, currencyKey }) => `subpath:${subpath}:${currencyKey}`
|
|
6771
|
+
).with(
|
|
6772
|
+
{ kind: "group" },
|
|
6773
|
+
({ groupKey, templatePath, currencyKey }) => `group:${groupKey}:${templatePath}:${currencyKey}`
|
|
6774
|
+
).exhaustive();
|
|
6775
|
+
var labelFor = (c2) => z2(c2).with({ kind: "subpath" }, ({ subpath }) => subpath).with(
|
|
6776
|
+
{ kind: "group" },
|
|
6777
|
+
({ groupKey }) => `group key "${groupKey}" ownBalance`
|
|
6778
|
+
).exhaustive();
|
|
6779
|
+
var validateConsistentBalanceUpdates = (lines, groups, accountPathToAccount, defaultConsistencyConfig = {}) => {
|
|
6584
6780
|
const groupsInEntry = new Set(groups.map(({ key }) => key));
|
|
6585
|
-
const
|
|
6586
|
-
const uniqueBalancesUpdated = /* @__PURE__ */ new Set();
|
|
6587
|
-
lines.forEach((line, idx) => {
|
|
6781
|
+
const lineResults = lines.map((line, idx) => {
|
|
6588
6782
|
const templatePath = line.account.path;
|
|
6589
6783
|
const structuralPath = getStructuralPath(templatePath);
|
|
6590
6784
|
const account = accountPathToAccount.get(structuralPath);
|
|
6591
6785
|
const currencyKey = `${line.currency?.code ?? "<unknown>"}:${line.currency?.customCurrencyId ?? "_"}`;
|
|
6592
|
-
const
|
|
6593
|
-
const
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6786
|
+
const templateSubpaths = getSubpaths(templatePath);
|
|
6787
|
+
const structuralSubpaths = getStructuralSubpaths(templatePath);
|
|
6788
|
+
const subpathContributions = templateSubpaths.flatMap((subpath, subpathIdx) => {
|
|
6789
|
+
const subpathAccount = accountPathToAccount.get(
|
|
6790
|
+
structuralSubpaths[subpathIdx]
|
|
6791
|
+
);
|
|
6792
|
+
if (!subpathAccount)
|
|
6793
|
+
return [];
|
|
6794
|
+
const subpathConfig = subpathAccount.consistencyConfig;
|
|
6795
|
+
const totalBalanceUpdates = subpathConfig.totalBalanceUpdates ?? defaultConsistencyConfig.totalBalanceUpdates;
|
|
6796
|
+
const isLeaf = subpath === templatePath;
|
|
6797
|
+
const triggersSyncWrite = totalBalanceUpdates === "strong" || isLeaf && subpathConfig.ownBalanceUpdates === "strong";
|
|
6798
|
+
if (!triggersSyncWrite)
|
|
6799
|
+
return [];
|
|
6800
|
+
return [{ kind: "subpath", subpath, currencyKey }];
|
|
6603
6801
|
});
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6802
|
+
const groupContributions = account?.consistencyConfig.groups?.flatMap(
|
|
6803
|
+
({ key, ownBalanceUpdates }) => groupsInEntry.has(key) && ownBalanceUpdates === "strong" ? [
|
|
6804
|
+
{
|
|
6805
|
+
kind: "group",
|
|
6806
|
+
groupKey: key,
|
|
6807
|
+
templatePath,
|
|
6808
|
+
currencyKey
|
|
6809
|
+
}
|
|
6810
|
+
] : []
|
|
6811
|
+
) ?? [];
|
|
6812
|
+
return {
|
|
6813
|
+
idx,
|
|
6814
|
+
contributions: [...subpathContributions, ...groupContributions]
|
|
6815
|
+
};
|
|
6816
|
+
});
|
|
6817
|
+
const uniqueBalancesUpdated = new Set(
|
|
6818
|
+
lineResults.flatMap((r2) => r2.contributions.map(dedupeKeyFor))
|
|
6819
|
+
);
|
|
6820
|
+
const lineMessages = lineResults.flatMap((r2) => {
|
|
6821
|
+
if (r2.contributions.length === 0)
|
|
6822
|
+
return [];
|
|
6823
|
+
return [
|
|
6824
|
+
{
|
|
6825
|
+
path: ["lines", r2.idx],
|
|
6826
|
+
message: `This line updates the following ${r2.contributions.length} balances: [${r2.contributions.map(labelFor).join(", ")}]`
|
|
6827
|
+
}
|
|
6828
|
+
];
|
|
6610
6829
|
});
|
|
6611
6830
|
if (uniqueBalancesUpdated.size > MAX_CONSISTENT_BALANCE_UPDATES) {
|
|
6612
6831
|
return [
|
|
@@ -6757,7 +6976,7 @@ var validateEntry = (ledgerEntry, accountPathToAccount, defaultConsistencyConfig
|
|
|
6757
6976
|
if (allRepeatedKeys.size > 1) {
|
|
6758
6977
|
errors.push({
|
|
6759
6978
|
path: ["lines"],
|
|
6760
|
-
message: `Entry (${ledgerEntry.type}) has ${allRepeatedKeys.size} repeated key groups across lines and conditions (${[...allRepeatedKeys].map((
|
|
6979
|
+
message: `Entry (${ledgerEntry.type}) has ${allRepeatedKeys.size} repeated key groups across lines and conditions (${[...allRepeatedKeys].map((k2) => `'${k2}'`).join(
|
|
6761
6980
|
", "
|
|
6762
6981
|
)}). Only one repeated key group is allowed per entry. If you need multiple repeated key groups, please reach out.`
|
|
6763
6982
|
});
|
|
@@ -6784,7 +7003,7 @@ var validateEntry = (ledgerEntry, accountPathToAccount, defaultConsistencyConfig
|
|
|
6784
7003
|
...ledgerEntry.conditions.filter((cond) => !cond.repeated)
|
|
6785
7004
|
].flatMap((item) => getSchemaObjectParameters(item));
|
|
6786
7005
|
const collidingKeys = [...entryOnlyParams, ...staticParams].filter(
|
|
6787
|
-
(
|
|
7006
|
+
(p2) => allRepeatedKeys.has(p2)
|
|
6788
7007
|
);
|
|
6789
7008
|
collidingKeys.forEach((key) => {
|
|
6790
7009
|
errors.push({
|
|
@@ -6815,7 +7034,8 @@ var validateEntry = (ledgerEntry, accountPathToAccount, defaultConsistencyConfig
|
|
|
6815
7034
|
...validateConsistentBalanceUpdates(
|
|
6816
7035
|
ledgerEntry.lines,
|
|
6817
7036
|
ledgerEntry.groups,
|
|
6818
|
-
accountPathToAccount
|
|
7037
|
+
accountPathToAccount,
|
|
7038
|
+
defaultConsistencyConfig
|
|
6819
7039
|
)
|
|
6820
7040
|
);
|
|
6821
7041
|
errors.push(...validateParameters(ledgerEntry.parameters));
|
|
@@ -6943,13 +7163,13 @@ var validateEntriesModifyClearingAccount = (group, entriesInGroup) => {
|
|
|
6943
7163
|
}
|
|
6944
7164
|
const clearingAccount = group.reconciliation.clearingAccountPath.path;
|
|
6945
7165
|
const entriesMissingClearingAccount = entriesInGroup.filter(
|
|
6946
|
-
(
|
|
7166
|
+
(e2) => !e2?.lines?.some(
|
|
6947
7167
|
(l) => isAccountPathEquivalent(l.account.path, clearingAccount)
|
|
6948
7168
|
)
|
|
6949
7169
|
);
|
|
6950
7170
|
if (entriesMissingClearingAccount.length > 0) {
|
|
6951
|
-
return entriesMissingClearingAccount.map((
|
|
6952
|
-
message: `All entries in a reconciliation group must modify the clearing account, not present in the entries ${
|
|
7171
|
+
return entriesMissingClearingAccount.map((e2) => ({
|
|
7172
|
+
message: `All entries in a reconciliation group must modify the clearing account, not present in the entries ${e2?.type} v${e2?.typeVersion}`,
|
|
6953
7173
|
path: ["entries"]
|
|
6954
7174
|
}));
|
|
6955
7175
|
}
|
|
@@ -6997,9 +7217,9 @@ var validateClearingAccount = (group, validatedCoA) => {
|
|
|
6997
7217
|
return errors;
|
|
6998
7218
|
};
|
|
6999
7219
|
var setErrorPathPrefix = (errors, index) => {
|
|
7000
|
-
return errors.map((
|
|
7001
|
-
...
|
|
7002
|
-
path: ["groups", index, ...
|
|
7220
|
+
return errors.map((e2) => ({
|
|
7221
|
+
...e2,
|
|
7222
|
+
path: ["groups", index, ...e2.path]
|
|
7003
7223
|
}));
|
|
7004
7224
|
};
|
|
7005
7225
|
var validateGroup = (group, validatedCoA, validatedEntries, index) => {
|
|
@@ -7010,7 +7230,7 @@ var validateGroup = (group, validatedCoA, validatedEntries, index) => {
|
|
|
7010
7230
|
return errors;
|
|
7011
7231
|
}
|
|
7012
7232
|
const entriesInGroup = validatedEntries.types.filter(
|
|
7013
|
-
(
|
|
7233
|
+
(e2) => e2.groups.some((g) => g.key === group.key)
|
|
7014
7234
|
);
|
|
7015
7235
|
errors.push(
|
|
7016
7236
|
...setErrorPathPrefix(
|
|
@@ -7123,7 +7343,7 @@ var SchemaLedgerLineInput = z.object({
|
|
|
7123
7343
|
tx: SchemaTxMatchInput.optional(),
|
|
7124
7344
|
tags: z.array(SchemaLedgerLineTagInput).optional(),
|
|
7125
7345
|
repeated: z.object({
|
|
7126
|
-
key: SafeStringSchema.refine((
|
|
7346
|
+
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
7127
7347
|
message: "repeated.key cannot be empty"
|
|
7128
7348
|
})
|
|
7129
7349
|
}).optional()
|
|
@@ -7173,7 +7393,7 @@ var SchemaLedgerEntryConditionInput = z.object({
|
|
|
7173
7393
|
precondition: SchemaConditionInput.optional(),
|
|
7174
7394
|
currency: SchemaCurrencyMatchInput2.optional(),
|
|
7175
7395
|
repeated: z.object({
|
|
7176
|
-
key: SafeStringSchema.refine((
|
|
7396
|
+
key: SafeStringSchema.refine((k2) => k2.trim().length >= 1, {
|
|
7177
7397
|
message: "repeated.key cannot be empty"
|
|
7178
7398
|
})
|
|
7179
7399
|
}).optional()
|
|
@@ -7220,7 +7440,7 @@ var SchemaLedgerEntryStatus = z.enum([
|
|
|
7220
7440
|
"archived"
|
|
7221
7441
|
]);
|
|
7222
7442
|
var SchemaLedgerEntryInput = z.object({
|
|
7223
|
-
type: SafeStringSchema.refine((
|
|
7443
|
+
type: SafeStringSchema.refine((s2) => s2.trim().length > 0),
|
|
7224
7444
|
typeVersion: z.number().int().positive().optional(),
|
|
7225
7445
|
description: ParameterizedString.optional(),
|
|
7226
7446
|
conditions: z.array(SchemaLedgerEntryConditionInput).optional(),
|
|
@@ -7290,7 +7510,7 @@ var Scene = z.object({
|
|
|
7290
7510
|
var Schema = z.object({
|
|
7291
7511
|
name: z.string().optional(),
|
|
7292
7512
|
key: SafeStringSchema.refine(
|
|
7293
|
-
(
|
|
7513
|
+
(s2) => s2.trim().length > 0 && !s2.includes("{{") && !s2.includes("}}"),
|
|
7294
7514
|
{
|
|
7295
7515
|
message: `Invalid key. Keys cannot contain '{{' or '}}' and must be non-empty`
|
|
7296
7516
|
}
|
|
@@ -7306,7 +7526,7 @@ var Schema = z.object({
|
|
|
7306
7526
|
ledgerEntries: ledgerEntries ?? { types: [] },
|
|
7307
7527
|
validatedCoA: chartOfAccounts
|
|
7308
7528
|
});
|
|
7309
|
-
errors.map((
|
|
7529
|
+
errors.map((e2) => ({ ...e2, path: ["ledgerEntries", ...e2.path] })).forEach(
|
|
7310
7530
|
({ message, path }) => ctx.addIssue({
|
|
7311
7531
|
code: z.ZodIssueCode.custom,
|
|
7312
7532
|
message,
|