@fragment-dev/cli 2026.10.30-1 → 2026.10.30-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/bin/dev.js +1 -1
- package/bin/run.js +3 -1
- package/dist/chunk-2QGAXOCF.js +38 -0
- package/dist/{chunk-RWQZFXSF.js → chunk-3SE5DFKP.js} +1 -205
- package/dist/{chunk-DXYJ2C6A.js → chunk-4CPAGLCS.js} +5 -5
- package/dist/chunk-4E5LH6UM.js +46 -0
- package/dist/{chunk-XOKV3CLM.js → chunk-6CHMI6QB.js} +1149 -103
- package/dist/{chunk-NOFQF7LO.js → chunk-AXYDDQ64.js} +1 -1
- package/dist/{chunk-XKJQ557J.js → chunk-C3IGD3FR.js} +4 -2
- package/dist/{chunk-HZNM6VFG.js → chunk-ERS7TGXY.js} +4 -4
- package/dist/chunk-EXTVHTGU.js +88 -0
- package/dist/{chunk-FP3RI3B7.js → chunk-FTALVA4K.js} +20 -12
- package/dist/{chunk-2AWFI2YX.js → chunk-G7IGOKUP.js} +1 -1
- package/dist/{chunk-743236RA.js → chunk-GKWT6QEB.js} +5 -5
- package/dist/{chunk-GV36M6WY.js → chunk-HOYPQHWF.js} +7 -7
- package/dist/chunk-HYJ6MTD2.js +41 -0
- package/dist/chunk-JSWKMWBO.js +175 -0
- package/dist/{chunk-GCPPWOLT.js → chunk-LID4G5RM.js} +1 -1
- package/dist/chunk-MI5NFPWE.js +211 -0
- package/dist/{chunk-WNHRPKY6.js → chunk-MXOS5EPJ.js} +1 -1
- package/dist/chunk-N2SKO3MO.js +97 -0
- package/dist/chunk-NSEYKDYC.js +398 -0
- package/dist/chunk-OCE3DJ2V.js +76 -0
- package/dist/chunk-POIPF2YW.js +609 -0
- package/dist/chunk-PW3XYURG.js +4917 -0
- package/dist/chunk-T3RKAA7V.js +30 -0
- package/dist/{chunk-QJZAZHCO.js → chunk-WRHRJO7G.js} +16 -38
- package/dist/{chunk-YKGESMWT.js → chunk-WSFEOM2D.js} +1 -217
- package/dist/chunk-XKVEOJUH.js +85 -0
- package/dist/chunk-ZRPKEOB3.js +20 -0
- package/dist/commands/api-client/create.js +4 -3
- package/dist/commands/gen-graphql.js +11 -7
- package/dist/commands/login.js +4 -3
- package/dist/commands/print-schema.js +31 -0
- package/dist/commands/simulate-scenario.js +31 -0
- package/dist/commands/verify-schema.js +12 -8
- package/dist/commands.js +31 -17
- package/dist/graphql.js +8 -4
- package/dist/index.js +31 -17
- package/dist/lib/browserLogin.js +3 -2
- package/dist/utils/formatAccountHierarchy.js +11 -0
- package/dist/utils/formatAccountReference.js +12 -0
- package/dist/utils/formatBalance.js +11 -0
- package/dist/utils/formatChartOfAccounts.js +18 -0
- package/dist/utils/formatEntries.js +17 -0
- package/dist/utils/formatScenarioAccountBalances.js +18 -0
- package/dist/utils/formatScenarioBalances.js +19 -0
- package/dist/utils/formatTable.js +9 -0
- package/dist/utils/formatValidationErrors.js +6 -3
- package/dist/utils/schemaBackCompat.js +11 -7
- package/dist/utils/schemaValidation.js +10 -6
- package/oclif.manifest.json +92 -1
- package/package.json +8 -2
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import {
|
|
2
|
+
z
|
|
3
|
+
} from "./chunk-3SE5DFKP.js";
|
|
4
|
+
import {
|
|
5
|
+
init_cjs_shims
|
|
6
|
+
} from "./chunk-7GH3YGSC.js";
|
|
7
|
+
|
|
8
|
+
// ../../libs/types/strings.ts
|
|
9
|
+
init_cjs_shims();
|
|
10
|
+
var UNSAFE_CHARACTERS = ["#", "/", ":"];
|
|
11
|
+
var isUnsafeString = (value) => {
|
|
12
|
+
return !!UNSAFE_CHARACTERS.find((character) => {
|
|
13
|
+
return value.includes(character);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var unsafePathCharacters = ["#"];
|
|
17
|
+
var SafePathStringSchema = z.string().superRefine((value, ctx) => {
|
|
18
|
+
if (value === "") {
|
|
19
|
+
ctx.addIssue({
|
|
20
|
+
code: z.ZodIssueCode.custom,
|
|
21
|
+
message: `Path cannot be an empty string. Received ${value}`
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (value.startsWith("/") || value.endsWith("/")) {
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: z.ZodIssueCode.custom,
|
|
27
|
+
message: `Path cannot start or end with a forward slash. Received ${value}`
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (value.includes("//")) {
|
|
31
|
+
ctx.addIssue({
|
|
32
|
+
code: z.ZodIssueCode.custom,
|
|
33
|
+
message: `Path cannot contain consecutive forward slashes. Received ${value}`
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (unsafePathCharacters.find((character) => value.includes(character))) {
|
|
37
|
+
ctx.addIssue({
|
|
38
|
+
code: z.ZodIssueCode.custom,
|
|
39
|
+
message: `Path cannot contain the characters: ${unsafePathCharacters.join(
|
|
40
|
+
","
|
|
41
|
+
)}. Received ${value}`
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}).brand();
|
|
45
|
+
var emailRegex = /^[^\s@+]+@[^\s@/]+\.[^\s@/]+$/;
|
|
46
|
+
var EmailAddressSchema = z.string().superRefine((value, ctx) => {
|
|
47
|
+
if (!emailRegex.test(value)) {
|
|
48
|
+
ctx.addIssue({
|
|
49
|
+
code: z.ZodIssueCode.custom,
|
|
50
|
+
message: `Invalid email address. Cannot include whitespace, +, more than one @, or @ at the end. Received ${value}`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}).brand();
|
|
54
|
+
var paramRegex = /{{([^{}]*?)}}/g;
|
|
55
|
+
var getStringParameters = (s) => [...s.matchAll(paramRegex)].map((match) => match[1].trim()).filter((param) => {
|
|
56
|
+
return param !== "__proto__";
|
|
57
|
+
});
|
|
58
|
+
var getStringParametersInternal = (s, params) => {
|
|
59
|
+
getStringParameters(s).forEach((param) => {
|
|
60
|
+
params.add(param);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var SafeStringSchema = z.string().refine((s) => !isUnsafeString(s) && getStringParameters(s).length === 0, {
|
|
64
|
+
message: `String cannot contain '#', '/', ':', or parameters in {{handlebar}} syntax`
|
|
65
|
+
}).brand();
|
|
66
|
+
var DateTimeSchema = z.string().datetime().brand();
|
|
67
|
+
var ParameterizedString = z.string().transform((s) => {
|
|
68
|
+
return s.replace(/\{(\s*)(.*?)\s*\{/g, "{$2{").replace(/\}(\s*)(.*?)\s*\}/g, "}$2}").replace(/\{\{(\s*)(.*?)\s*\}\}/g, "{{$2}}");
|
|
69
|
+
}).refine(
|
|
70
|
+
(s) => {
|
|
71
|
+
return /^[^{}]*({{[^{}]*}}[^{}]*)*$/m.test(s);
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
message: `Parameterized string must have exactly two left brackets followed by exactly two right brackets.`
|
|
75
|
+
}
|
|
76
|
+
).refine(
|
|
77
|
+
(s) => {
|
|
78
|
+
const regex = /{{([^{}]*?)}}/g;
|
|
79
|
+
const matches = [...s.trim().matchAll(regex)];
|
|
80
|
+
return matches.every(
|
|
81
|
+
([_, param]) => param !== "" && !param.includes(" ") && param[0].match(/[a-zA-Z]/)
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
message: `Parameters (e.g. {{param}}) must be a non-empty string beginning with an alphabetical character and may not include whitespace.`
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
var ParameterizedAmount = ({
|
|
89
|
+
optional,
|
|
90
|
+
errorMessage
|
|
91
|
+
} = {}) => {
|
|
92
|
+
const schema = optional ? ParameterizedString.optional() : ParameterizedString;
|
|
93
|
+
return schema.superRefine((s, ctx) => {
|
|
94
|
+
if (!s) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const withoutHandlebars = s.replace(/\{\{[^}]*\}\}/g, "");
|
|
98
|
+
const mathOperatorsRegex = /[*x×/÷%]/i;
|
|
99
|
+
const firstMathOperatorMatch = withoutHandlebars.match(mathOperatorsRegex);
|
|
100
|
+
if (firstMathOperatorMatch) {
|
|
101
|
+
const operator = firstMathOperatorMatch[0];
|
|
102
|
+
ctx.addIssue({
|
|
103
|
+
code: z.ZodIssueCode.custom,
|
|
104
|
+
message: errorMessage ?? `Unsupported operator "${operator}". Only + and - are allowed in expressions.`
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
let remaining = s.trim();
|
|
109
|
+
const valueRegex = /^(-?\d+|\{\{[^}]*\}*\}\})/;
|
|
110
|
+
const plusminusRegex = /^[+-]/;
|
|
111
|
+
let expect = "start";
|
|
112
|
+
while (remaining.length > 0) {
|
|
113
|
+
switch (expect) {
|
|
114
|
+
case "start": {
|
|
115
|
+
const m1 = remaining.match(valueRegex);
|
|
116
|
+
if (m1 && m1[0].length > 0) {
|
|
117
|
+
expect = "plusminus";
|
|
118
|
+
remaining = remaining.slice(m1[0].length).trim();
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const m2 = remaining.match(plusminusRegex);
|
|
122
|
+
if (m2 && m2[0].length > 0) {
|
|
123
|
+
expect = "value";
|
|
124
|
+
remaining = remaining.slice(m2[0].length).trim();
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
ctx.addIssue({
|
|
128
|
+
code: z.ZodIssueCode.custom,
|
|
129
|
+
message: errorMessage ?? `Invalid expression at character "${remaining[0]}". Expressions must start with +, -, a number or {{param}}`
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
case "plusminus": {
|
|
134
|
+
const m1 = remaining.match(plusminusRegex);
|
|
135
|
+
if (m1 && m1[0].length > 0) {
|
|
136
|
+
expect = "value";
|
|
137
|
+
remaining = remaining.slice(m1[0].length).trim();
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
ctx.addIssue({
|
|
141
|
+
code: z.ZodIssueCode.custom,
|
|
142
|
+
message: errorMessage ?? `Invalid expression at character "${remaining[0]}". Expected + or - at this point.`
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
case "value": {
|
|
147
|
+
const m1 = remaining.match(valueRegex);
|
|
148
|
+
if (m1 && m1[0].length > 0) {
|
|
149
|
+
expect = "plusminus";
|
|
150
|
+
remaining = remaining.slice(m1[0].length).trim();
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
ctx.addIssue({
|
|
154
|
+
code: z.ZodIssueCode.custom,
|
|
155
|
+
message: errorMessage ?? `Invalid expression at character "${remaining[0]}". Expected a number or {{param}}`
|
|
156
|
+
});
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
default: {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (expect !== "plusminus") {
|
|
165
|
+
ctx.addIssue({
|
|
166
|
+
code: z.ZodIssueCode.custom,
|
|
167
|
+
message: errorMessage ?? "Invalid expression. Unexpected end of string."
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
var safe = (splits, ...values) => SafeStringSchema.parse(
|
|
173
|
+
splits.reduce((acc, split, i) => acc + split + (values[i] || ""), "")
|
|
174
|
+
);
|
|
175
|
+
var SfnExecutionNameSchema = SafeStringSchema.superRefine(
|
|
176
|
+
(val, ctx) => {
|
|
177
|
+
if (val.length < 1 || val.length > 80) {
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
code: z.ZodIssueCode.custom,
|
|
180
|
+
message: `Name must be between 1 and 80 characters long. Received: ${val.length}.`
|
|
181
|
+
});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (val.startsWith("_") || val.endsWith("_")) {
|
|
185
|
+
ctx.addIssue({
|
|
186
|
+
code: z.ZodIssueCode.custom,
|
|
187
|
+
message: `Name cannot start or end with an underscore.`
|
|
188
|
+
});
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(val)) {
|
|
192
|
+
ctx.addIssue({
|
|
193
|
+
code: z.ZodIssueCode.custom,
|
|
194
|
+
message: `Name can only contain alphanumeric characters, hyphens, and underscores.`
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
).brand();
|
|
199
|
+
var MAX_FREEFORM_TEXT_LENGTH = 1e3;
|
|
200
|
+
var PlainRequestPayloadSchema = z.any().brand();
|
|
201
|
+
var HashedRequestPayloadSchema = z.any().brand();
|
|
202
|
+
|
|
203
|
+
export {
|
|
204
|
+
getStringParameters,
|
|
205
|
+
getStringParametersInternal,
|
|
206
|
+
SafeStringSchema,
|
|
207
|
+
ParameterizedString,
|
|
208
|
+
ParameterizedAmount,
|
|
209
|
+
safe,
|
|
210
|
+
MAX_FREEFORM_TEXT_LENGTH
|
|
211
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatChartOfAccounts
|
|
3
|
+
} from "./chunk-EXTVHTGU.js";
|
|
4
|
+
import {
|
|
5
|
+
formatEntries
|
|
6
|
+
} from "./chunk-JSWKMWBO.js";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_SCHEMA_PATH
|
|
9
|
+
} from "./chunk-A4BSWX5D.js";
|
|
10
|
+
import {
|
|
11
|
+
FragmentCommand,
|
|
12
|
+
require_lib
|
|
13
|
+
} from "./chunk-VPOARVKJ.js";
|
|
14
|
+
import {
|
|
15
|
+
getParsedSchemaString,
|
|
16
|
+
parseJSON
|
|
17
|
+
} from "./chunk-QZNZYG2G.js";
|
|
18
|
+
import {
|
|
19
|
+
__toESM,
|
|
20
|
+
init_cjs_shims
|
|
21
|
+
} from "./chunk-7GH3YGSC.js";
|
|
22
|
+
|
|
23
|
+
// src/commands/print-schema.ts
|
|
24
|
+
init_cjs_shims();
|
|
25
|
+
var import_core = __toESM(require_lib(), 1);
|
|
26
|
+
var PrintSchema = class _PrintSchema extends FragmentCommand {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.run = async () => {
|
|
30
|
+
const { flags } = await this.parse(_PrintSchema);
|
|
31
|
+
const schemaString = getParsedSchemaString({
|
|
32
|
+
command: this,
|
|
33
|
+
schemaPath: flags.path,
|
|
34
|
+
silenceNonErrorLogging: true,
|
|
35
|
+
requireEnvVariables: false
|
|
36
|
+
});
|
|
37
|
+
const [schema, parseError] = parseJSON(schemaString);
|
|
38
|
+
if (parseError) {
|
|
39
|
+
this.error(`Failed to parse ${flags.path}: ${parseError.message}`, {
|
|
40
|
+
exit: 1
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
if (flags.entry !== void 0) {
|
|
45
|
+
this.log(formatEntries({ schema, entry: flags.entry }));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (flags.account !== void 0) {
|
|
49
|
+
this.log(formatChartOfAccounts({ schema, account: flags.account }));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.log(
|
|
53
|
+
[
|
|
54
|
+
formatChartOfAccounts({ schema, account: void 0 }),
|
|
55
|
+
formatEntries({ schema, entry: void 0 })
|
|
56
|
+
].join("\n\n")
|
|
57
|
+
);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
this.error(error instanceof Error ? error.message : String(error), {
|
|
60
|
+
exit: 1
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
static {
|
|
66
|
+
this.description = "Pretty-print the chart of accounts and entries in a local schema";
|
|
67
|
+
}
|
|
68
|
+
static {
|
|
69
|
+
this.examples = [
|
|
70
|
+
"<%= config.bin %> <%= command.id %> --path ./fragment.jsonc",
|
|
71
|
+
"<%= config.bin %> <%= command.id %> --path ./fragment.jsonc --account assets/cash",
|
|
72
|
+
'<%= config.bin %> <%= command.id %> --account "Cash"',
|
|
73
|
+
"<%= config.bin %> <%= command.id %> --entry carrier_paid"
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
static {
|
|
77
|
+
this.flags = {
|
|
78
|
+
path: import_core.Flags.string({
|
|
79
|
+
char: "p",
|
|
80
|
+
description: "Path to a schema JSON or JSONC file",
|
|
81
|
+
default: DEFAULT_SCHEMA_PATH
|
|
82
|
+
}),
|
|
83
|
+
account: import_core.Flags.string({
|
|
84
|
+
description: "Show one account by name, key, or full path",
|
|
85
|
+
exclusive: ["entry"]
|
|
86
|
+
}),
|
|
87
|
+
entry: import_core.Flags.string({
|
|
88
|
+
description: "Show an entry type and its versions, including posting lines",
|
|
89
|
+
exclusive: ["account"]
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
PrintSchema
|
|
97
|
+
};
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import {
|
|
2
|
+
z
|
|
3
|
+
} from "./chunk-3SE5DFKP.js";
|
|
4
|
+
import {
|
|
5
|
+
init_cjs_shims
|
|
6
|
+
} from "./chunk-7GH3YGSC.js";
|
|
7
|
+
|
|
8
|
+
// ../../libs/types/currencyCodes.ts
|
|
9
|
+
init_cjs_shims();
|
|
10
|
+
var nonISOCurrencyCodes = [
|
|
11
|
+
// Crypto currencies
|
|
12
|
+
"ADA",
|
|
13
|
+
"BTC",
|
|
14
|
+
"DAI",
|
|
15
|
+
"ETH",
|
|
16
|
+
"SOL",
|
|
17
|
+
"USDC",
|
|
18
|
+
"USDT",
|
|
19
|
+
"USDG",
|
|
20
|
+
"EURC",
|
|
21
|
+
"CADC",
|
|
22
|
+
"CADT",
|
|
23
|
+
"XLM",
|
|
24
|
+
"UNI",
|
|
25
|
+
"BCH",
|
|
26
|
+
"LTC",
|
|
27
|
+
"AAVE",
|
|
28
|
+
"LINK",
|
|
29
|
+
"MATIC",
|
|
30
|
+
"PTS"
|
|
31
|
+
];
|
|
32
|
+
var ISOCurrencyCodes = [
|
|
33
|
+
// Fiat currencies
|
|
34
|
+
"AED",
|
|
35
|
+
"AFN",
|
|
36
|
+
"ALL",
|
|
37
|
+
"AMD",
|
|
38
|
+
"ANG",
|
|
39
|
+
"AOA",
|
|
40
|
+
"ARS",
|
|
41
|
+
"AUD",
|
|
42
|
+
"AWG",
|
|
43
|
+
"AZN",
|
|
44
|
+
"BAM",
|
|
45
|
+
"BBD",
|
|
46
|
+
"BDT",
|
|
47
|
+
"BGN",
|
|
48
|
+
"BHD",
|
|
49
|
+
"BIF",
|
|
50
|
+
"BMD",
|
|
51
|
+
"BND",
|
|
52
|
+
"BOB",
|
|
53
|
+
"BRL",
|
|
54
|
+
"BSD",
|
|
55
|
+
"BTN",
|
|
56
|
+
"BWP",
|
|
57
|
+
"BYR",
|
|
58
|
+
"BZD",
|
|
59
|
+
"CAD",
|
|
60
|
+
"CDF",
|
|
61
|
+
"CHF",
|
|
62
|
+
"CLP",
|
|
63
|
+
"CNY",
|
|
64
|
+
"COP",
|
|
65
|
+
"CRC",
|
|
66
|
+
"CUC",
|
|
67
|
+
"CUP",
|
|
68
|
+
"CVE",
|
|
69
|
+
"CZK",
|
|
70
|
+
"DJF",
|
|
71
|
+
"DKK",
|
|
72
|
+
"DOP",
|
|
73
|
+
"DZD",
|
|
74
|
+
"EGP",
|
|
75
|
+
"ERN",
|
|
76
|
+
"ETB",
|
|
77
|
+
"EUR",
|
|
78
|
+
"FJD",
|
|
79
|
+
"FKP",
|
|
80
|
+
"GBP",
|
|
81
|
+
"GEL",
|
|
82
|
+
"GGP",
|
|
83
|
+
"GHS",
|
|
84
|
+
"GIP",
|
|
85
|
+
"GMD",
|
|
86
|
+
"GNF",
|
|
87
|
+
"GTQ",
|
|
88
|
+
"GYD",
|
|
89
|
+
"HKD",
|
|
90
|
+
"HNL",
|
|
91
|
+
"HRK",
|
|
92
|
+
"HTG",
|
|
93
|
+
"HUF",
|
|
94
|
+
"IDR",
|
|
95
|
+
"ILS",
|
|
96
|
+
"IMP",
|
|
97
|
+
"INR",
|
|
98
|
+
"IQD",
|
|
99
|
+
"IRR",
|
|
100
|
+
"ISK",
|
|
101
|
+
"JMD",
|
|
102
|
+
"JOD",
|
|
103
|
+
"JPY",
|
|
104
|
+
"KES",
|
|
105
|
+
"KGS",
|
|
106
|
+
"KHR",
|
|
107
|
+
"KMF",
|
|
108
|
+
"KPW",
|
|
109
|
+
"KRW",
|
|
110
|
+
"KWD",
|
|
111
|
+
"KYD",
|
|
112
|
+
"KZT",
|
|
113
|
+
"LAK",
|
|
114
|
+
"LBP",
|
|
115
|
+
"LKR",
|
|
116
|
+
"LRD",
|
|
117
|
+
"LSL",
|
|
118
|
+
"LYD",
|
|
119
|
+
"MAD",
|
|
120
|
+
"MDL",
|
|
121
|
+
"MGA",
|
|
122
|
+
"MKD",
|
|
123
|
+
"MMK",
|
|
124
|
+
"MNT",
|
|
125
|
+
"MOP",
|
|
126
|
+
"MUR",
|
|
127
|
+
"MVR",
|
|
128
|
+
"MWK",
|
|
129
|
+
"MXN",
|
|
130
|
+
"MYR",
|
|
131
|
+
"MZN",
|
|
132
|
+
"NAD",
|
|
133
|
+
"NGN",
|
|
134
|
+
"NIO",
|
|
135
|
+
"NOK",
|
|
136
|
+
"NPR",
|
|
137
|
+
"NZD",
|
|
138
|
+
"OMR",
|
|
139
|
+
"PAB",
|
|
140
|
+
"PEN",
|
|
141
|
+
"PGK",
|
|
142
|
+
"PHP",
|
|
143
|
+
"PKR",
|
|
144
|
+
"PLN",
|
|
145
|
+
"PYG",
|
|
146
|
+
"QAR",
|
|
147
|
+
"RON",
|
|
148
|
+
"RSD",
|
|
149
|
+
"RUB",
|
|
150
|
+
"RWF",
|
|
151
|
+
"SAR",
|
|
152
|
+
"SBD",
|
|
153
|
+
"SCR",
|
|
154
|
+
"SDG",
|
|
155
|
+
"SEK",
|
|
156
|
+
"SGD",
|
|
157
|
+
"SHP",
|
|
158
|
+
"SLE",
|
|
159
|
+
"SLL",
|
|
160
|
+
"SOS",
|
|
161
|
+
"SPL",
|
|
162
|
+
"SRD",
|
|
163
|
+
"SVC",
|
|
164
|
+
"SYP",
|
|
165
|
+
"STN",
|
|
166
|
+
"SZL",
|
|
167
|
+
"THB",
|
|
168
|
+
"TJS",
|
|
169
|
+
"TMT",
|
|
170
|
+
"TND",
|
|
171
|
+
"TOP",
|
|
172
|
+
"TRY",
|
|
173
|
+
"TTD",
|
|
174
|
+
"TVD",
|
|
175
|
+
"TWD",
|
|
176
|
+
"TZS",
|
|
177
|
+
"UAH",
|
|
178
|
+
"UGX",
|
|
179
|
+
"USD",
|
|
180
|
+
"UYU",
|
|
181
|
+
"UZS",
|
|
182
|
+
"VEF",
|
|
183
|
+
"VND",
|
|
184
|
+
"VUV",
|
|
185
|
+
"WST",
|
|
186
|
+
"XAF",
|
|
187
|
+
"XCD",
|
|
188
|
+
"XOF",
|
|
189
|
+
"XPF",
|
|
190
|
+
"YER",
|
|
191
|
+
"ZAR",
|
|
192
|
+
"ZMW"
|
|
193
|
+
];
|
|
194
|
+
var currencyCodes = [
|
|
195
|
+
...nonISOCurrencyCodes,
|
|
196
|
+
...ISOCurrencyCodes,
|
|
197
|
+
"LOGICAL",
|
|
198
|
+
"CUSTOM"
|
|
199
|
+
];
|
|
200
|
+
var accountCurrencyCodes = [...currencyCodes, "MULTI"];
|
|
201
|
+
var currencyPrecision = {
|
|
202
|
+
ADA: 6,
|
|
203
|
+
BTC: 8,
|
|
204
|
+
DAI: 18,
|
|
205
|
+
ETH: 18,
|
|
206
|
+
SOL: 9,
|
|
207
|
+
USDC: 6,
|
|
208
|
+
USDT: 6,
|
|
209
|
+
XLM: 7,
|
|
210
|
+
BCH: 8,
|
|
211
|
+
LTC: 8,
|
|
212
|
+
AAVE: 18,
|
|
213
|
+
UNI: 18,
|
|
214
|
+
LINK: 18,
|
|
215
|
+
MATIC: 18,
|
|
216
|
+
USDG: 6,
|
|
217
|
+
EURC: 6,
|
|
218
|
+
CADC: 18,
|
|
219
|
+
CADT: 6,
|
|
220
|
+
AED: 2,
|
|
221
|
+
AFN: 2,
|
|
222
|
+
ALL: 2,
|
|
223
|
+
AMD: 2,
|
|
224
|
+
ANG: 2,
|
|
225
|
+
AOA: 2,
|
|
226
|
+
ARS: 2,
|
|
227
|
+
AUD: 2,
|
|
228
|
+
AWG: 2,
|
|
229
|
+
AZN: 2,
|
|
230
|
+
BAM: 2,
|
|
231
|
+
BBD: 2,
|
|
232
|
+
BDT: 2,
|
|
233
|
+
BGN: 2,
|
|
234
|
+
BHD: 3,
|
|
235
|
+
BIF: 0,
|
|
236
|
+
BMD: 2,
|
|
237
|
+
BND: 2,
|
|
238
|
+
BOB: 2,
|
|
239
|
+
BRL: 2,
|
|
240
|
+
BSD: 2,
|
|
241
|
+
BTN: 2,
|
|
242
|
+
BWP: 2,
|
|
243
|
+
BZD: 2,
|
|
244
|
+
CAD: 2,
|
|
245
|
+
CDF: 2,
|
|
246
|
+
CHF: 2,
|
|
247
|
+
CLP: 0,
|
|
248
|
+
COP: 2,
|
|
249
|
+
CRC: 2,
|
|
250
|
+
CUC: 2,
|
|
251
|
+
CUP: 2,
|
|
252
|
+
CVE: 2,
|
|
253
|
+
CZK: 2,
|
|
254
|
+
DJF: 0,
|
|
255
|
+
DKK: 2,
|
|
256
|
+
DOP: 2,
|
|
257
|
+
DZD: 2,
|
|
258
|
+
EGP: 2,
|
|
259
|
+
ERN: 2,
|
|
260
|
+
ETB: 2,
|
|
261
|
+
EUR: 2,
|
|
262
|
+
FJD: 2,
|
|
263
|
+
FKP: 2,
|
|
264
|
+
GBP: 2,
|
|
265
|
+
GEL: 2,
|
|
266
|
+
GHS: 2,
|
|
267
|
+
GIP: 2,
|
|
268
|
+
GMD: 2,
|
|
269
|
+
GNF: 0,
|
|
270
|
+
GTQ: 2,
|
|
271
|
+
GYD: 2,
|
|
272
|
+
HKD: 2,
|
|
273
|
+
HNL: 2,
|
|
274
|
+
HRK: 2,
|
|
275
|
+
HTG: 2,
|
|
276
|
+
HUF: 2,
|
|
277
|
+
IDR: 2,
|
|
278
|
+
ILS: 2,
|
|
279
|
+
INR: 2,
|
|
280
|
+
IQD: 3,
|
|
281
|
+
IRR: 2,
|
|
282
|
+
ISK: 0,
|
|
283
|
+
JMD: 2,
|
|
284
|
+
JOD: 3,
|
|
285
|
+
JPY: 0,
|
|
286
|
+
KES: 2,
|
|
287
|
+
KGS: 2,
|
|
288
|
+
KHR: 2,
|
|
289
|
+
KMF: 0,
|
|
290
|
+
KPW: 2,
|
|
291
|
+
KRW: 0,
|
|
292
|
+
KWD: 3,
|
|
293
|
+
KYD: 2,
|
|
294
|
+
KZT: 2,
|
|
295
|
+
LAK: 2,
|
|
296
|
+
LBP: 2,
|
|
297
|
+
LKR: 2,
|
|
298
|
+
LRD: 2,
|
|
299
|
+
LSL: 2,
|
|
300
|
+
LYD: 3,
|
|
301
|
+
MAD: 2,
|
|
302
|
+
MDL: 2,
|
|
303
|
+
MGA: 2,
|
|
304
|
+
MKD: 2,
|
|
305
|
+
MMK: 2,
|
|
306
|
+
MNT: 2,
|
|
307
|
+
MOP: 2,
|
|
308
|
+
MUR: 2,
|
|
309
|
+
MVR: 2,
|
|
310
|
+
MWK: 2,
|
|
311
|
+
MXN: 2,
|
|
312
|
+
MYR: 2,
|
|
313
|
+
MZN: 2,
|
|
314
|
+
NAD: 2,
|
|
315
|
+
NGN: 2,
|
|
316
|
+
NIO: 2,
|
|
317
|
+
NOK: 2,
|
|
318
|
+
NPR: 2,
|
|
319
|
+
NZD: 2,
|
|
320
|
+
OMR: 3,
|
|
321
|
+
PAB: 2,
|
|
322
|
+
PEN: 2,
|
|
323
|
+
PGK: 2,
|
|
324
|
+
PHP: 2,
|
|
325
|
+
PKR: 2,
|
|
326
|
+
PLN: 2,
|
|
327
|
+
PYG: 0,
|
|
328
|
+
QAR: 2,
|
|
329
|
+
RON: 2,
|
|
330
|
+
RSD: 2,
|
|
331
|
+
CNY: 2,
|
|
332
|
+
RUB: 2,
|
|
333
|
+
RWF: 0,
|
|
334
|
+
SAR: 2,
|
|
335
|
+
SBD: 2,
|
|
336
|
+
SCR: 2,
|
|
337
|
+
SDG: 2,
|
|
338
|
+
SEK: 2,
|
|
339
|
+
SGD: 2,
|
|
340
|
+
SHP: 2,
|
|
341
|
+
SLE: 2,
|
|
342
|
+
SLL: 2,
|
|
343
|
+
SOS: 2,
|
|
344
|
+
SRD: 2,
|
|
345
|
+
SVC: 2,
|
|
346
|
+
SYP: 2,
|
|
347
|
+
SZL: 2,
|
|
348
|
+
THB: 2,
|
|
349
|
+
TJS: 2,
|
|
350
|
+
TMT: 2,
|
|
351
|
+
TND: 3,
|
|
352
|
+
TOP: 2,
|
|
353
|
+
TRY: 2,
|
|
354
|
+
TTD: 2,
|
|
355
|
+
TWD: 2,
|
|
356
|
+
TZS: 2,
|
|
357
|
+
UAH: 2,
|
|
358
|
+
UGX: 0,
|
|
359
|
+
USD: 2,
|
|
360
|
+
UYU: 2,
|
|
361
|
+
UZS: 2,
|
|
362
|
+
VND: 0,
|
|
363
|
+
VUV: 0,
|
|
364
|
+
WST: 2,
|
|
365
|
+
XAF: 0,
|
|
366
|
+
XCD: 2,
|
|
367
|
+
XOF: 0,
|
|
368
|
+
XPF: 0,
|
|
369
|
+
YER: 2,
|
|
370
|
+
ZAR: 2,
|
|
371
|
+
ZMW: 2,
|
|
372
|
+
LOGICAL: 0,
|
|
373
|
+
CUSTOM: 0,
|
|
374
|
+
PTS: 0,
|
|
375
|
+
STN: 2,
|
|
376
|
+
BYR: 2,
|
|
377
|
+
GGP: 2,
|
|
378
|
+
IMP: 2,
|
|
379
|
+
SPL: 2,
|
|
380
|
+
TVD: 2,
|
|
381
|
+
VEF: 2
|
|
382
|
+
};
|
|
383
|
+
var currencyModes = ["single", "multi"];
|
|
384
|
+
var CurrencyModeSchema = z.enum(currencyModes);
|
|
385
|
+
var CurrencyCodeSchema = z.enum(currencyCodes);
|
|
386
|
+
var AccountCurrencyCodeSchema = z.enum(accountCurrencyCodes);
|
|
387
|
+
var CurrencyMatchInputSchema = z.object({
|
|
388
|
+
customCurrencyId: z.optional(z.string()),
|
|
389
|
+
code: CurrencyCodeSchema
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
export {
|
|
393
|
+
currencyCodes,
|
|
394
|
+
currencyPrecision,
|
|
395
|
+
CurrencyModeSchema,
|
|
396
|
+
CurrencyCodeSchema,
|
|
397
|
+
CurrencyMatchInputSchema
|
|
398
|
+
};
|