@fragment-dev/cli 2026.11.13-2 → 2026.11.13-3
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 +25 -4
- package/dist/{chunk-F5CCJ6FF.js → chunk-2EZPMAOG.js} +1 -1
- package/dist/{chunk-JDYOG2HA.js → chunk-2YTWJRNP.js} +1 -1
- package/dist/{chunk-JTGVX5GX.js → chunk-3XCYMGE3.js} +48 -7
- package/dist/{chunk-CCJ6B7IM.js → chunk-4EBR67QU.js} +1 -1
- package/dist/{chunk-XF4UMVYD.js → chunk-4GSTQ6O4.js} +1 -1
- package/dist/{chunk-6SLKFJ3R.js → chunk-5YXK5XSL.js} +2 -2
- package/dist/{chunk-CCIMF5G2.js → chunk-67N5LE4N.js} +1 -1
- package/dist/{chunk-3ZBETKSW.js → chunk-6T66IJCY.js} +5 -0
- package/dist/{chunk-EKZUX3W4.js → chunk-AEIRSM6M.js} +1 -1
- package/dist/{chunk-HT3U4M2Y.js → chunk-B7254H5E.js} +1 -1
- package/dist/{chunk-OFNXU6XT.js → chunk-BV3DJZN2.js} +1 -1
- package/dist/{chunk-U5ZBL6S4.js → chunk-CSP4CXUF.js} +2 -2
- package/dist/{chunk-R266LOJY.js → chunk-FI2U3AB2.js} +11 -3
- package/dist/{chunk-JSS43ARW.js → chunk-GM4XMO7R.js} +2 -2
- package/dist/{chunk-FCPIWNB2.js → chunk-H34FQN7O.js} +21 -21
- package/dist/{chunk-Z65KYV6Z.js → chunk-HGJQFG33.js} +1 -1
- package/dist/{chunk-XREGFKSL.js → chunk-IWY22QAC.js} +1 -1
- package/dist/{chunk-3CJRW6UH.js → chunk-MHNH7UHD.js} +1 -1
- package/dist/{chunk-S4VUE6OA.js → chunk-NUXJ4UQR.js} +63 -5
- package/dist/{chunk-Q7Z3H3GL.js → chunk-P63ZOWQQ.js} +7 -4
- package/dist/{chunk-562FOENG.js → chunk-PYG6AFYU.js} +1 -1
- package/dist/{chunk-4LUAFIF5.js → chunk-RBNP4MID.js} +9 -5
- package/dist/{chunk-JELZBFKQ.js → chunk-RQFQK7WV.js} +1 -1
- package/dist/{chunk-RF23UYTV.js → chunk-SACWMZFU.js} +1 -1
- package/dist/{chunk-WS34FKDX.js → chunk-SBV53D6N.js} +2 -2
- package/dist/{chunk-IPDXXZMM.js → chunk-SL4IWVLO.js} +1 -1
- package/dist/{chunk-MZLYFF2A.js → chunk-TNZS3WJW.js} +2 -2
- package/dist/{chunk-PCDWKMX2.js → chunk-VEM4AZAI.js} +1 -1
- package/dist/{chunk-CE5IRGV2.js → chunk-VN2DVYGG.js} +1 -1
- package/dist/{chunk-XT7X5Z7E.js → chunk-WQQ3DSJH.js} +1 -1
- package/dist/{chunk-BOA4W5UK.js → chunk-XJS4FFUC.js} +1 -1
- package/dist/{chunk-5S53QKWI.js → chunk-XTEERZ7T.js} +1 -1
- package/dist/{chunk-3DAS3OFL.js → chunk-ZQ2XTJ24.js} +1 -1
- package/dist/commands/add-ledger-entry.js +3 -3
- package/dist/commands/create-custom-link.js +3 -3
- package/dist/commands/create-ledger.js +3 -3
- package/dist/commands/delete-custom-txs.js +3 -3
- package/dist/commands/delete-ledger.js +3 -3
- package/dist/commands/delete-schema.js +3 -3
- package/dist/commands/gen-graphql.js +4 -4
- package/dist/commands/get-schema.js +3 -3
- package/dist/commands/migrate-ledger-entry.js +3 -3
- package/dist/commands/print-schema.js +5 -5
- package/dist/commands/query/ledgerAccounts.js +3 -3
- package/dist/commands/query/ledgers.js +3 -3
- package/dist/commands/query/schema.js +3 -3
- package/dist/commands/query/schemas.js +3 -3
- package/dist/commands/reverse-ledger-entry.js +3 -3
- package/dist/commands/simulate-scenario.js +5 -5
- package/dist/commands/store-schema.js +3 -3
- package/dist/commands/token.js +3 -3
- package/dist/commands/update-ledger-account.js +3 -3
- package/dist/commands/verify-schema.js +5 -5
- package/dist/commands/workspace.js +3 -3
- package/dist/commands.js +33 -33
- package/dist/graphql.js +2 -2
- package/dist/index.js +33 -33
- package/dist/lib/authenticatedCommand.js +2 -2
- package/dist/lib/sdk.js +1 -1
- package/dist/utils/formatChartOfAccounts.js +3 -3
- package/dist/utils/formatEntries.js +3 -3
- package/dist/utils/formatScenarioAccountBalances.js +3 -3
- package/dist/utils/formatScenarioBalances.js +4 -4
- package/dist/utils/schemaBackCompat.js +4 -4
- package/dist/utils/schemaValidation.js +3 -3
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,25 +4,46 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Install on macOS (Apple Silicon or Intel) or Linux x64 with glibc.
|
|
8
|
+
Requires [Node.js 18 or later](https://nodejs.org/en/download) on `PATH`:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
curl -fsSL https://fragment.dev/install.sh | sh
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The installer checks Node before downloading the JavaScript-only CLI archive.
|
|
15
|
+
If Node is missing or unsupported, it exits with installation guidance.
|
|
16
|
+
It requires no npm, Homebrew, or sudo.
|
|
17
|
+
The launcher uses the Node executable selected during installation.
|
|
18
|
+
Rerun the installer if you move or remove that Node executable.
|
|
19
|
+
It installs into `~/.local/share/fragment` and creates `~/.local/bin/fragment`.
|
|
20
|
+
Use the printed executable path immediately if that directory is absent from `PATH`.
|
|
21
|
+
Add the directory to your shell profile for future sessions.
|
|
22
|
+
Existing credentials and installations in other locations remain available.
|
|
23
|
+
The installer refuses to overwrite an existing executable it does not manage.
|
|
24
|
+
|
|
25
|
+
Alternatively, install with npm:
|
|
8
26
|
|
|
9
27
|
```bash
|
|
10
28
|
npm install -g @fragment-dev/cli
|
|
11
29
|
```
|
|
12
30
|
|
|
13
|
-
[Homebrew](https://brew.sh/)
|
|
31
|
+
Or install with [Homebrew](https://brew.sh/):
|
|
14
32
|
|
|
15
33
|
```bash
|
|
16
34
|
brew tap fragment-dev/tap
|
|
17
35
|
brew install fragment-dev/tap/fragment-cli
|
|
18
36
|
```
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
Run `fragment update` to upgrade. To pin a curl installation or roll back:
|
|
21
39
|
|
|
22
40
|
```bash
|
|
23
|
-
fragment
|
|
41
|
+
curl -fsSL https://fragment.dev/install.sh | sh -s -- --version <version>
|
|
24
42
|
```
|
|
25
43
|
|
|
44
|
+
Use `--install-dir <absolute-path>` and `--bin-dir <absolute-path>` to choose installation locations.
|
|
45
|
+
Older releases remain in the installation directory so running commands can finish during updates.
|
|
46
|
+
|
|
26
47
|
# Commands
|
|
27
48
|
|
|
28
49
|
## Browser login for new users
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
parameterizeSchemaLedgerEntryConditionInput,
|
|
11
11
|
parameterizeSchemaLedgerLineInput,
|
|
12
12
|
reparameterizeSchemaLedgerAccountInput
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NUXJ4UQR.js";
|
|
14
14
|
import {
|
|
15
15
|
getStructuralPath
|
|
16
16
|
} from "./chunk-2QGAXOCF.js";
|
|
@@ -269,11 +269,31 @@ var PaymentAccountingEventKey = {
|
|
|
269
269
|
/** A refund of the settled payment is initiated. */
|
|
270
270
|
refund_initiated: "refund_initiated",
|
|
271
271
|
/** An initiated refund failed, so the refunded funds return. */
|
|
272
|
-
refund_failed: "refund_failed"
|
|
272
|
+
refund_failed: "refund_failed",
|
|
273
|
+
/** A chargeback opened, withdrawing the disputed amount and the dispute fee. */
|
|
274
|
+
chargeback_settled: "chargeback_settled",
|
|
275
|
+
/** The fee for contesting a chargeback was collected. */
|
|
276
|
+
chargeback_countered: "chargeback_countered",
|
|
277
|
+
/** Funds withdrawn for a chargeback were returned. */
|
|
278
|
+
chargeback_reversed: "chargeback_reversed"
|
|
273
279
|
};
|
|
274
280
|
var PaymentAccountingEventKeySchema = z.nativeEnum(
|
|
275
281
|
PaymentAccountingEventKey
|
|
276
282
|
);
|
|
283
|
+
var DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS = [
|
|
284
|
+
PaymentAccountingEventKey.chargeback_settled,
|
|
285
|
+
PaymentAccountingEventKey.chargeback_countered,
|
|
286
|
+
PaymentAccountingEventKey.chargeback_reversed
|
|
287
|
+
];
|
|
288
|
+
var SCENE_PAYMENT_ACCOUNTING_EVENT_KEYS = [
|
|
289
|
+
PaymentAccountingEventKey.initiated,
|
|
290
|
+
PaymentAccountingEventKey.settled,
|
|
291
|
+
PaymentAccountingEventKey.refund_initiated,
|
|
292
|
+
PaymentAccountingEventKey.refund_failed
|
|
293
|
+
];
|
|
294
|
+
var ScenePaymentAccountingEventKeySchema = z.enum(
|
|
295
|
+
SCENE_PAYMENT_ACCOUNTING_EVENT_KEYS
|
|
296
|
+
);
|
|
277
297
|
var PaymentTypeDirection = {
|
|
278
298
|
payin: "payin",
|
|
279
299
|
payout: "payout"
|
|
@@ -283,20 +303,36 @@ var SystemLineKind = {
|
|
|
283
303
|
payment_settlement_line: "payment_settlement_line",
|
|
284
304
|
payment_fee_line: "payment_fee_line",
|
|
285
305
|
payment_refund_line: "payment_refund_line",
|
|
286
|
-
payment_refund_reversal_line: "payment_refund_reversal_line"
|
|
306
|
+
payment_refund_reversal_line: "payment_refund_reversal_line",
|
|
307
|
+
payment_chargeback_line: "payment_chargeback_line",
|
|
308
|
+
/** The dispute fee charged when a chargeback opens. It is never returned. */
|
|
309
|
+
payment_chargeback_fee_line: "payment_chargeback_fee_line",
|
|
310
|
+
payment_chargeback_countered_fee_line: "payment_chargeback_countered_fee_line",
|
|
311
|
+
payment_chargeback_reversal_line: "payment_chargeback_reversal_line",
|
|
312
|
+
payment_chargeback_countered_fee_reversal_line: "payment_chargeback_countered_fee_reversal_line"
|
|
287
313
|
};
|
|
288
314
|
var SystemLineKindSchema = z.nativeEnum(SystemLineKind);
|
|
289
315
|
var SystemLineParameterName = {
|
|
290
316
|
payment_settlement_line: "settled_amount",
|
|
291
317
|
payment_fee_line: "fragment_fee_amount",
|
|
292
318
|
payment_refund_line: "refund_amount",
|
|
293
|
-
payment_refund_reversal_line: "refund_amount"
|
|
319
|
+
payment_refund_reversal_line: "refund_amount",
|
|
320
|
+
payment_chargeback_line: "chargeback_amount",
|
|
321
|
+
payment_chargeback_fee_line: "chargeback_fee_amount",
|
|
322
|
+
payment_chargeback_countered_fee_line: "chargeback_countered_fee_amount",
|
|
323
|
+
payment_chargeback_reversal_line: "chargeback_amount",
|
|
324
|
+
payment_chargeback_countered_fee_reversal_line: "chargeback_countered_fee_amount"
|
|
294
325
|
};
|
|
295
326
|
var SYSTEM_LINE_AMOUNT = {
|
|
296
327
|
[SystemLineKind.payment_settlement_line]: `{{${SystemLineParameterName.payment_settlement_line}}}`,
|
|
297
328
|
[SystemLineKind.payment_fee_line]: `-{{${SystemLineParameterName.payment_fee_line}}}`,
|
|
298
329
|
[SystemLineKind.payment_refund_line]: `-{{${SystemLineParameterName.payment_refund_line}}}`,
|
|
299
|
-
[SystemLineKind.payment_refund_reversal_line]: `{{${SystemLineParameterName.payment_refund_reversal_line}}}
|
|
330
|
+
[SystemLineKind.payment_refund_reversal_line]: `{{${SystemLineParameterName.payment_refund_reversal_line}}}`,
|
|
331
|
+
[SystemLineKind.payment_chargeback_line]: `-{{${SystemLineParameterName.payment_chargeback_line}}}`,
|
|
332
|
+
[SystemLineKind.payment_chargeback_fee_line]: `-{{${SystemLineParameterName.payment_chargeback_fee_line}}}`,
|
|
333
|
+
[SystemLineKind.payment_chargeback_countered_fee_line]: `-{{${SystemLineParameterName.payment_chargeback_countered_fee_line}}}`,
|
|
334
|
+
[SystemLineKind.payment_chargeback_reversal_line]: `{{${SystemLineParameterName.payment_chargeback_reversal_line}}}`,
|
|
335
|
+
[SystemLineKind.payment_chargeback_countered_fee_reversal_line]: `{{${SystemLineParameterName.payment_chargeback_countered_fee_reversal_line}}}`
|
|
300
336
|
};
|
|
301
337
|
var SYSTEM_PARAMETER_NAMES = new Set(
|
|
302
338
|
Object.values(SystemLineParameterName)
|
|
@@ -328,7 +364,10 @@ var BaseSchemaPaymentTypeInput = z.object({
|
|
|
328
364
|
initiated: BaseSchemaPaymentEntryInput.optional(),
|
|
329
365
|
settled: BaseSchemaPaymentEntryInput,
|
|
330
366
|
refund_initiated: BaseSchemaPaymentEntryInput.optional(),
|
|
331
|
-
refund_failed: BaseSchemaPaymentEntryInput.optional()
|
|
367
|
+
refund_failed: BaseSchemaPaymentEntryInput.optional(),
|
|
368
|
+
chargeback_settled: BaseSchemaPaymentEntryInput.optional(),
|
|
369
|
+
chargeback_countered: BaseSchemaPaymentEntryInput.optional(),
|
|
370
|
+
chargeback_reversed: BaseSchemaPaymentEntryInput.optional()
|
|
332
371
|
})
|
|
333
372
|
});
|
|
334
373
|
var BaseSchemaPayments = z.object({
|
|
@@ -353,7 +392,7 @@ var ScenePaymentEventSchema = z.object({
|
|
|
353
392
|
eventType: z.literal("payment"),
|
|
354
393
|
payment: z.object({
|
|
355
394
|
ik: z.string(),
|
|
356
|
-
event:
|
|
395
|
+
event: ScenePaymentAccountingEventKeySchema
|
|
357
396
|
})
|
|
358
397
|
});
|
|
359
398
|
var SceneEventSchema = z.discriminatedUnion("eventType", [
|
|
@@ -411,7 +450,9 @@ export {
|
|
|
411
450
|
BaseChartOfAccounts,
|
|
412
451
|
PostLinesAsSchema,
|
|
413
452
|
PaymentAccountingEventKey,
|
|
414
|
-
|
|
453
|
+
DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS,
|
|
454
|
+
SCENE_PAYMENT_ACCOUNTING_EVENT_KEYS,
|
|
455
|
+
ScenePaymentAccountingEventKeySchema,
|
|
415
456
|
PaymentTypeDirection,
|
|
416
457
|
PaymentTypeDirectionSchema,
|
|
417
458
|
SystemLineKind,
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-T3RKAA7V.js";
|
|
8
8
|
import {
|
|
9
9
|
ChartOfAccounts
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NUXJ4UQR.js";
|
|
11
11
|
import {
|
|
12
12
|
BaseSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3XCYMGE3.js";
|
|
14
14
|
import {
|
|
15
15
|
init_cjs_shims
|
|
16
16
|
} from "./chunk-7GH3YGSC.js";
|
|
@@ -1087,6 +1087,11 @@ var SchemaPaymentTypeStatus = /* @__PURE__ */ ((SchemaPaymentTypeStatus2) => {
|
|
|
1087
1087
|
return SchemaPaymentTypeStatus2;
|
|
1088
1088
|
})(SchemaPaymentTypeStatus || {});
|
|
1089
1089
|
var SchemaSystemLineKind = /* @__PURE__ */ ((SchemaSystemLineKind2) => {
|
|
1090
|
+
SchemaSystemLineKind2["PaymentChargebackCounteredFeeLine"] = "payment_chargeback_countered_fee_line";
|
|
1091
|
+
SchemaSystemLineKind2["PaymentChargebackCounteredFeeReversalLine"] = "payment_chargeback_countered_fee_reversal_line";
|
|
1092
|
+
SchemaSystemLineKind2["PaymentChargebackFeeLine"] = "payment_chargeback_fee_line";
|
|
1093
|
+
SchemaSystemLineKind2["PaymentChargebackLine"] = "payment_chargeback_line";
|
|
1094
|
+
SchemaSystemLineKind2["PaymentChargebackReversalLine"] = "payment_chargeback_reversal_line";
|
|
1090
1095
|
SchemaSystemLineKind2["PaymentFeeLine"] = "payment_fee_line";
|
|
1091
1096
|
SchemaSystemLineKind2["PaymentRefundLine"] = "payment_refund_line";
|
|
1092
1097
|
SchemaSystemLineKind2["PaymentRefundReversalLine"] = "payment_refund_reversal_line";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
schemaToEntryDefinitions,
|
|
9
9
|
schemaToPaymentDefinitions,
|
|
10
10
|
validateOutputName
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FI2U3AB2.js";
|
|
12
12
|
import {
|
|
13
13
|
Schema,
|
|
14
14
|
parseWithError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NUXJ4UQR.js";
|
|
16
16
|
import {
|
|
17
17
|
BadRequestError
|
|
18
18
|
} from "./chunk-IJNU7K35.js";
|
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
InvalidGraphQlError
|
|
6
6
|
} from "./chunk-UQALZFPK.js";
|
|
7
7
|
import {
|
|
8
|
+
DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS,
|
|
8
9
|
SYSTEM_PARAMETER_NAMES,
|
|
9
10
|
getSchemaObjectParameters
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3XCYMGE3.js";
|
|
11
12
|
import {
|
|
12
13
|
getStructuralSubpaths
|
|
13
14
|
} from "./chunk-2QGAXOCF.js";
|
|
@@ -39,8 +40,15 @@ var getCallerParameters = (schemaObject) => new Set(
|
|
|
39
40
|
);
|
|
40
41
|
var getRequiredPaymentParameters = ({
|
|
41
42
|
payment,
|
|
42
|
-
accounting
|
|
43
|
-
}) => getCallerParameters({
|
|
43
|
+
accounting
|
|
44
|
+
}) => getCallerParameters({
|
|
45
|
+
payment,
|
|
46
|
+
initiated: accounting.initiated,
|
|
47
|
+
settled: accounting.settled,
|
|
48
|
+
disputeEntries: DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS.map(
|
|
49
|
+
(event) => accounting[event]
|
|
50
|
+
)
|
|
51
|
+
});
|
|
44
52
|
|
|
45
53
|
// src/graphql.ts
|
|
46
54
|
var getAccountParams = (accountPath, schema) => {
|
|
@@ -3,43 +3,43 @@ import {
|
|
|
3
3
|
} from "./chunk-GR3GGYJY.js";
|
|
4
4
|
import {
|
|
5
5
|
VerifySchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SBV53D6N.js";
|
|
7
7
|
import {
|
|
8
8
|
Version
|
|
9
9
|
} from "./chunk-ZPU5TX3B.js";
|
|
10
10
|
import {
|
|
11
11
|
Workspace
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B7254H5E.js";
|
|
13
13
|
import {
|
|
14
14
|
GetSchema as GetSchema2
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XJS4FFUC.js";
|
|
16
16
|
import {
|
|
17
17
|
QuerySchemas
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MHNH7UHD.js";
|
|
19
19
|
import {
|
|
20
20
|
ReverseLedgerEntry
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HGJQFG33.js";
|
|
22
22
|
import {
|
|
23
23
|
SimulateScenario
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ZQ2XTJ24.js";
|
|
25
25
|
import {
|
|
26
26
|
Start
|
|
27
27
|
} from "./chunk-FMDJEY4R.js";
|
|
28
28
|
import {
|
|
29
29
|
StoreSchema
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-67N5LE4N.js";
|
|
31
31
|
import {
|
|
32
32
|
Token
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-2YTWJRNP.js";
|
|
34
34
|
import {
|
|
35
35
|
UpdateLedgerAccount
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-WQQ3DSJH.js";
|
|
37
37
|
import {
|
|
38
38
|
GenGraphQL
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-CSP4CXUF.js";
|
|
40
40
|
import {
|
|
41
41
|
GetSchema
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-VEM4AZAI.js";
|
|
43
43
|
import {
|
|
44
44
|
Init
|
|
45
45
|
} from "./chunk-Z5SFM3A5.js";
|
|
@@ -48,37 +48,37 @@ import {
|
|
|
48
48
|
} from "./chunk-VXYOFJKR.js";
|
|
49
49
|
import {
|
|
50
50
|
MigrateLedgerEntry
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-4EBR67QU.js";
|
|
52
52
|
import {
|
|
53
53
|
PrintSchema
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-GM4XMO7R.js";
|
|
55
55
|
import {
|
|
56
56
|
QueryLedgerAccounts
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-4GSTQ6O4.js";
|
|
58
58
|
import {
|
|
59
59
|
QueryLedgers
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-AEIRSM6M.js";
|
|
61
61
|
import {
|
|
62
62
|
AddLedgerEntry
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-SACWMZFU.js";
|
|
64
64
|
import {
|
|
65
65
|
ApiClientCreate
|
|
66
66
|
} from "./chunk-YWITUQIX.js";
|
|
67
67
|
import {
|
|
68
68
|
CreateCustomLink
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-VN2DVYGG.js";
|
|
70
70
|
import {
|
|
71
71
|
CreateLedger
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-XTEERZ7T.js";
|
|
73
73
|
import {
|
|
74
74
|
DeleteCustomTxs
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-PYG6AFYU.js";
|
|
76
76
|
import {
|
|
77
77
|
DeleteLedger
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-SL4IWVLO.js";
|
|
79
79
|
import {
|
|
80
80
|
DeleteSchema
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-IWY22QAC.js";
|
|
82
82
|
import {
|
|
83
83
|
init_cjs_shims
|
|
84
84
|
} from "./chunk-7GH3YGSC.js";
|
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
AccountConsistencyConfigSchema,
|
|
3
3
|
BaseChartOfAccounts,
|
|
4
4
|
ConsistencyConfigSchema,
|
|
5
|
+
DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS,
|
|
5
6
|
PaymentAccountingEventKey,
|
|
6
|
-
PaymentAccountingEventKeySchema,
|
|
7
7
|
PaymentTypeDirection,
|
|
8
8
|
PaymentTypeDirectionSchema,
|
|
9
9
|
PostLinesAsSchema,
|
|
10
10
|
SYSTEM_LINE_AMOUNT,
|
|
11
11
|
SYSTEM_PARAMETER_NAMES,
|
|
12
|
+
ScenePaymentAccountingEventKeySchema,
|
|
12
13
|
SchemaEntryGroup,
|
|
13
14
|
SchemaLedgerEntityStatusSchema,
|
|
14
15
|
SchemaLinkType,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
SystemLineKindSchema,
|
|
19
20
|
fillParams,
|
|
20
21
|
getSchemaObjectParameters
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3XCYMGE3.js";
|
|
22
23
|
import {
|
|
23
24
|
BadRequestError,
|
|
24
25
|
InternalError,
|
|
@@ -10030,6 +10031,10 @@ var makePaymentEntryTypePrefix = (paymentType) => (
|
|
|
10030
10031
|
// concatenation is a SafeString without a runtime re-parse.
|
|
10031
10032
|
`${PAYMENT_ENTRY_TYPE_PREFIX}_${paymentType}_`
|
|
10032
10033
|
);
|
|
10034
|
+
var makePaymentEntryType = ({
|
|
10035
|
+
paymentType,
|
|
10036
|
+
event
|
|
10037
|
+
}) => `${makePaymentEntryTypePrefix(paymentType)}${event}`;
|
|
10033
10038
|
|
|
10034
10039
|
// ../../libs/schema-validation/utils/transformers/payments.ts
|
|
10035
10040
|
var amountMatchesSystemLine = (amount, system) => amount === SYSTEM_LINE_AMOUNT[system];
|
|
@@ -10068,6 +10073,17 @@ var systemLinesByPaymentAccountingEvent = {
|
|
|
10068
10073
|
],
|
|
10069
10074
|
[PaymentAccountingEventKey.refund_failed]: [
|
|
10070
10075
|
SystemLineKind.payment_refund_reversal_line
|
|
10076
|
+
],
|
|
10077
|
+
[PaymentAccountingEventKey.chargeback_settled]: [
|
|
10078
|
+
SystemLineKind.payment_chargeback_line,
|
|
10079
|
+
SystemLineKind.payment_chargeback_fee_line
|
|
10080
|
+
],
|
|
10081
|
+
[PaymentAccountingEventKey.chargeback_countered]: [
|
|
10082
|
+
SystemLineKind.payment_chargeback_countered_fee_line
|
|
10083
|
+
],
|
|
10084
|
+
[PaymentAccountingEventKey.chargeback_reversed]: [
|
|
10085
|
+
SystemLineKind.payment_chargeback_reversal_line,
|
|
10086
|
+
SystemLineKind.payment_chargeback_countered_fee_reversal_line
|
|
10071
10087
|
]
|
|
10072
10088
|
};
|
|
10073
10089
|
var hasSystemLines = (event) => systemLinesByPaymentAccountingEvent[event].length > 0;
|
|
@@ -10229,6 +10245,21 @@ var validatePaymentEntry = ({
|
|
|
10229
10245
|
errors.push(...validateSystemParameterUsage({ entry, lines, entryIdentity }));
|
|
10230
10246
|
return errors;
|
|
10231
10247
|
};
|
|
10248
|
+
var validateDisputeEntries = (paymentType) => {
|
|
10249
|
+
const definedEvents = DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS.filter(
|
|
10250
|
+
(event) => paymentType.accounting[event] !== void 0
|
|
10251
|
+
);
|
|
10252
|
+
if (definedEvents.length === 0)
|
|
10253
|
+
return [];
|
|
10254
|
+
return DISPUTE_PAYMENT_ACCOUNTING_EVENT_KEYS.filter(
|
|
10255
|
+
(event) => paymentType.accounting[event] === void 0
|
|
10256
|
+
).map((event) => ({
|
|
10257
|
+
path: ["accounting", event],
|
|
10258
|
+
message: `Payment Type (${paymentType.type}) must define a '${event}' entry, because it defines '${definedEvents.join(
|
|
10259
|
+
"', '"
|
|
10260
|
+
)}'. Define every dispute entry or none.`
|
|
10261
|
+
}));
|
|
10262
|
+
};
|
|
10232
10263
|
var validatePaymentType = ({
|
|
10233
10264
|
paymentType,
|
|
10234
10265
|
accountPathToAccount,
|
|
@@ -10285,6 +10316,7 @@ var validatePaymentType = ({
|
|
|
10285
10316
|
message: `Payment Type (${paymentType.type}) must define a '${PaymentAccountingEventKey.settled}' entry.`
|
|
10286
10317
|
});
|
|
10287
10318
|
}
|
|
10319
|
+
errors.push(...validateDisputeEntries(paymentType));
|
|
10288
10320
|
errors.push(
|
|
10289
10321
|
...Object.values(PaymentAccountingEventKey).flatMap((event) => {
|
|
10290
10322
|
const entry = paymentType.accounting[event];
|
|
@@ -10319,6 +10351,28 @@ var validateUniquePaymentTypes = ({
|
|
|
10319
10351
|
path: [...pathPrefix, idx, "type"]
|
|
10320
10352
|
}))
|
|
10321
10353
|
);
|
|
10354
|
+
var validateUniquePaymentEntryTypes = (types) => Array.from(
|
|
10355
|
+
groupByMap(
|
|
10356
|
+
types.flatMap(
|
|
10357
|
+
({ type }, idx) => Object.values(PaymentAccountingEventKey).map((event) => ({
|
|
10358
|
+
type,
|
|
10359
|
+
idx,
|
|
10360
|
+
event
|
|
10361
|
+
}))
|
|
10362
|
+
),
|
|
10363
|
+
({ type, event }) => (
|
|
10364
|
+
// Only equality matters here; an unsafe type string is reported on its own.
|
|
10365
|
+
makePaymentEntryType({ paymentType: type, event })
|
|
10366
|
+
)
|
|
10367
|
+
).values()
|
|
10368
|
+
).flatMap(
|
|
10369
|
+
(group) => group.flatMap(
|
|
10370
|
+
(member) => group.filter((other) => other.type !== member.type).map((other) => ({
|
|
10371
|
+
message: `Payment Type '${member.type}' conflicts with Payment Type '${other.type}': the '${member.event}' entry of '${member.type}' and the '${other.event}' entry of '${other.type}' post the same Ledger Entry type. Rename one.`,
|
|
10372
|
+
path: ["types", member.idx, "type"]
|
|
10373
|
+
}))
|
|
10374
|
+
)
|
|
10375
|
+
);
|
|
10322
10376
|
var validateReservedPaymentEntryTypes = ({
|
|
10323
10377
|
ledgerEntryTypes,
|
|
10324
10378
|
paymentTypes
|
|
@@ -10356,7 +10410,8 @@ var transformAndValidatePayments = ({
|
|
|
10356
10410
|
...validateUniquePaymentTypes({
|
|
10357
10411
|
types: payments.types,
|
|
10358
10412
|
pathPrefix: ["types"]
|
|
10359
|
-
})
|
|
10413
|
+
}),
|
|
10414
|
+
...validateUniquePaymentEntryTypes(payments.types)
|
|
10360
10415
|
);
|
|
10361
10416
|
errors.push(
|
|
10362
10417
|
...payments.types.flatMap(
|
|
@@ -10688,7 +10743,10 @@ var SchemaPaymentTypeInput = z.object({
|
|
|
10688
10743
|
initiated: SchemaPaymentEntryInput.optional(),
|
|
10689
10744
|
settled: SchemaPaymentEntryInput,
|
|
10690
10745
|
refund_initiated: SchemaPaymentEntryInput.optional(),
|
|
10691
|
-
refund_failed: SchemaPaymentEntryInput.optional()
|
|
10746
|
+
refund_failed: SchemaPaymentEntryInput.optional(),
|
|
10747
|
+
chargeback_settled: SchemaPaymentEntryInput.optional(),
|
|
10748
|
+
chargeback_countered: SchemaPaymentEntryInput.optional(),
|
|
10749
|
+
chargeback_reversed: SchemaPaymentEntryInput.optional()
|
|
10692
10750
|
})
|
|
10693
10751
|
});
|
|
10694
10752
|
var enrichPaymentEntry = ({
|
|
@@ -10743,7 +10801,7 @@ var ScenePayment = z.object({
|
|
|
10743
10801
|
});
|
|
10744
10802
|
var ScenePaymentEvent = z.object({
|
|
10745
10803
|
ik: SafeStringSchema,
|
|
10746
|
-
event:
|
|
10804
|
+
event: ScenePaymentAccountingEventKeySchema
|
|
10747
10805
|
});
|
|
10748
10806
|
var SceneEvent = z.object({
|
|
10749
10807
|
eventType: z.enum(["entry", "payment"]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateSchemaStructure
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BV3DJZN2.js";
|
|
4
4
|
import {
|
|
5
5
|
ChartOfAccounts,
|
|
6
6
|
MIN_SCHEMA_LEDGER_ENTRY_DISABLED_DURATION_SECONDS,
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
parseWithError,
|
|
14
14
|
stringify,
|
|
15
15
|
z
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NUXJ4UQR.js";
|
|
17
17
|
import {
|
|
18
18
|
PaymentAccountingEventKey,
|
|
19
19
|
VALID_LEDGER_ACCOUNT_STATUS_TRANSITIONS,
|
|
20
20
|
getSchemaObjectParameters
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3XCYMGE3.js";
|
|
22
22
|
import {
|
|
23
23
|
BadRequestError,
|
|
24
24
|
InternalError,
|
|
@@ -876,7 +876,10 @@ var accountingEventChangePolicies = {
|
|
|
876
876
|
[PaymentAccountingEventKey.initiated]: "immutable" /* immutable */,
|
|
877
877
|
[PaymentAccountingEventKey.settled]: "immutable" /* immutable */,
|
|
878
878
|
[PaymentAccountingEventKey.refund_initiated]: "mutable" /* mutable */,
|
|
879
|
-
[PaymentAccountingEventKey.refund_failed]: "mutable" /* mutable
|
|
879
|
+
[PaymentAccountingEventKey.refund_failed]: "mutable" /* mutable */,
|
|
880
|
+
[PaymentAccountingEventKey.chargeback_settled]: "mutable" /* mutable */,
|
|
881
|
+
[PaymentAccountingEventKey.chargeback_countered]: "mutable" /* mutable */,
|
|
882
|
+
[PaymentAccountingEventKey.chargeback_reversed]: "mutable" /* mutable */
|
|
880
883
|
};
|
|
881
884
|
var canAddAccountingEntryOnceDeployed = (event) => accountingEventChangePolicies[event] === "mutable" /* mutable */;
|
|
882
885
|
var isAccountingEntryCompatible = (event, oldEntry, newEntry) => isEqual_default(oldEntry, newEntry) || oldEntry === void 0 && canAddAccountingEntryOnceDeployed(event);
|