@andco/protocol 0.0.10 → 0.0.12
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/api-errors.d.ts +5 -128
- package/dist/api-errors.d.ts.map +1 -1
- package/dist/api-errors.js +5 -131
- package/dist/authorization-preparation.d.ts +3 -3
- package/dist/authorization-preparation.d.ts.map +1 -1
- package/dist/authorization-preparation.js +4 -0
- package/dist/authorization.js +2 -2
- package/dist/errors.d.ts +60 -16
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +60 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/intent-input.d.ts +1791 -725
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +325 -157
- package/dist/issues.d.ts +61 -0
- package/dist/issues.d.ts.map +1 -0
- package/dist/issues.js +61 -0
- package/dist/messages/index.d.ts +2 -2
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/messages/index.js +10 -3
- package/dist/messages/set-preferences.d.ts +13 -1
- package/dist/messages/set-preferences.d.ts.map +1 -1
- package/dist/messages/set-preferences.js +31 -9
- package/dist/miniapp-manifest.d.ts +2 -2
- package/dist/miniapp-manifest.d.ts.map +1 -1
- package/dist/miniapp-manifest.js +1 -1
- package/dist/native-intent.d.ts +48 -28
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +76 -24
- package/dist/pagination.d.ts +37 -31
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +72 -24
- package/dist/rar/account-matchers.d.ts +47 -240
- package/dist/rar/account-matchers.d.ts.map +1 -1
- package/dist/rar/account-matchers.js +52 -131
- package/dist/rar/bank.d.ts +280 -392
- package/dist/rar/bank.d.ts.map +1 -1
- package/dist/rar/bank.js +68 -137
- package/dist/rar/catalog.d.ts +305 -288
- package/dist/rar/catalog.d.ts.map +1 -1
- package/dist/rar/catalog.js +69 -29
- package/dist/rar/detail.d.ts +15 -32
- package/dist/rar/detail.d.ts.map +1 -1
- package/dist/rar/detail.js +14 -34
- package/dist/rar/index.d.ts +2 -1
- package/dist/rar/index.d.ts.map +1 -1
- package/dist/rar/index.js +2 -1
- package/dist/rar/json-schemas.generated.d.ts +4 -0
- package/dist/rar/json-schemas.generated.d.ts.map +1 -0
- package/dist/rar/json-schemas.generated.js +3570 -0
- package/dist/rar/money.d.ts +5 -5
- package/dist/rar/money.d.ts.map +1 -1
- package/dist/rar/money.js +5 -5
- package/dist/rar/project-users.d.ts +40 -14
- package/dist/rar/project-users.d.ts.map +1 -1
- package/dist/rar/project-users.js +20 -23
- package/dist/rar/subject-data.d.ts +96 -48
- package/dist/rar/subject-data.d.ts.map +1 -1
- package/dist/rar/subject-data.js +61 -34
- package/dist/rar/subject.d.ts +18 -85
- package/dist/rar/subject.d.ts.map +1 -1
- package/dist/rar/subject.js +23 -51
- package/dist/rest/accounts.d.ts +347 -0
- package/dist/rest/accounts.d.ts.map +1 -0
- package/dist/rest/accounts.js +108 -0
- package/dist/rest/addresses.d.ts +581 -0
- package/dist/rest/addresses.d.ts.map +1 -0
- package/dist/rest/addresses.js +190 -0
- package/dist/rest/api-error.d.ts +104 -0
- package/dist/rest/api-error.d.ts.map +1 -0
- package/dist/rest/api-error.js +103 -0
- package/dist/rest/authorization.d.ts +123 -0
- package/dist/rest/authorization.d.ts.map +1 -0
- package/dist/rest/authorization.js +62 -0
- package/dist/rest/catalog.d.ts +199 -0
- package/dist/rest/catalog.d.ts.map +1 -0
- package/dist/rest/catalog.js +63 -0
- package/dist/rest/common.d.ts +637 -0
- package/dist/rest/common.d.ts.map +1 -0
- package/dist/rest/common.js +172 -0
- package/dist/rest/contract.d.ts +3480 -0
- package/dist/rest/contract.d.ts.map +1 -0
- package/dist/rest/contract.js +120 -0
- package/dist/rest/events.d.ts +145 -0
- package/dist/rest/events.d.ts.map +1 -0
- package/dist/rest/events.js +42 -0
- package/dist/rest/http.d.ts +49 -0
- package/dist/rest/http.d.ts.map +1 -0
- package/dist/rest/http.js +25 -0
- package/dist/rest/identity.d.ts +627 -0
- package/dist/rest/identity.d.ts.map +1 -0
- package/dist/rest/identity.js +128 -0
- package/dist/rest/index.d.ts +14 -0
- package/dist/rest/index.d.ts.map +1 -0
- package/dist/rest/index.js +13 -0
- package/dist/rest/intents.d.ts +4556 -0
- package/dist/rest/intents.d.ts.map +1 -0
- package/dist/rest/intents.js +551 -0
- package/dist/rest/signatures.d.ts +110 -0
- package/dist/rest/signatures.d.ts.map +1 -0
- package/dist/rest/signatures.js +113 -0
- package/dist/rest/subjects.d.ts +14 -0
- package/dist/rest/subjects.d.ts.map +1 -0
- package/dist/rest/subjects.js +22 -0
- package/dist/service-grants.d.ts +2 -2
- package/dist/service-grants.d.ts.map +1 -1
- package/dist/service-grants.js +1 -1
- package/dist/transport/generated/oauth-api.d.ts +5547 -1448
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/intents.d.ts +9 -134
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +21 -405
- package/dist/transport/rest.d.ts +15 -5
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/userinfo.d.ts +22 -9
- package/dist/userinfo.d.ts.map +1 -1
- package/dist/userinfo.js +17 -12
- package/package.json +13 -2
package/dist/rar/bank.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../src/rar/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../src/rar/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAgB1C,0EAA0E;AAC1E,eAAO,MAAM,yBAAyB,mCAAoC,CAAC;AAC3E,qGAAqG;AACrG,eAAO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CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAI9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAMxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEzF,4BAA4B;AAC5B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAMjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/dist/rar/bank.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import {
|
|
3
|
-
import { AndcoRarLocationsSchema, actionSet
|
|
4
|
-
import { compareMoney,
|
|
5
|
-
import {
|
|
2
|
+
import { accountMatcherList, DestinationAccountMatcherSchema, GrantedAccountKeySchema, GrantedDestinationAccountMatcherSchema, GrantedOwnAccountMatcherSchema, ManagedAccountKeyMatcherSchema, OwnAccountMatcherSchema, } from "./account-matchers.js";
|
|
3
|
+
import { AndcoRarLocationsSchema, actionSet } from "./detail.js";
|
|
4
|
+
import { compareMoney, TransactionLimitSchema } from "./money.js";
|
|
5
|
+
import { GrantedSubjectSchema, SubjectPickerSchema } from "./subject.js";
|
|
6
6
|
// -- Actions ------------------------------------------------------------------------------------
|
|
7
7
|
/** Reading accounts and their balances. `create` never implies either. */
|
|
8
8
|
export const BANK_ACCOUNT_READ_ACTIONS = ["read", "read_balance"];
|
|
@@ -30,43 +30,82 @@ export const BANK_DEPOSIT_ACTIONS = ["create", "read", "close"];
|
|
|
30
30
|
export const BANK_CURRENCIES = ["CLP"];
|
|
31
31
|
// -- Shared pieces ------------------------------------------------------------------------------
|
|
32
32
|
const currency = /* @__PURE__ */ v.picklist(BANK_CURRENCIES);
|
|
33
|
-
const ownList = /* @__PURE__ */
|
|
34
|
-
const destinationList = /* @__PURE__ */
|
|
35
|
-
const
|
|
33
|
+
const ownList = /* @__PURE__ */ accountMatcherList(OwnAccountMatcherSchema);
|
|
34
|
+
const destinationList = /* @__PURE__ */ accountMatcherList(DestinationAccountMatcherSchema);
|
|
35
|
+
const managedAccountKeyList = /* @__PURE__ */ accountMatcherList(ManagedAccountKeyMatcherSchema);
|
|
36
36
|
const grantedOwnList = /* @__PURE__ */ accountMatcherList(GrantedOwnAccountMatcherSchema);
|
|
37
37
|
const grantedDestinationList = /* @__PURE__ */ accountMatcherList(GrantedDestinationAccountMatcherSchema);
|
|
38
38
|
const grantedAccountKeyList = /* @__PURE__ */ accountMatcherList(GrantedAccountKeySchema);
|
|
39
|
-
const present = (value) => value !== undefined && value !== null;
|
|
40
|
-
/** `value` fixes an exact amount, so it cannot travel with a range. */
|
|
41
|
-
const valueExcludesRange = (limits) => !present(limits.value) || (!present(limits.minimum) && !present(limits.maximum));
|
|
42
|
-
/** A range must not be empty. */
|
|
43
|
-
const rangeIsOrdered = (limits) => !present(limits.minimum) || !present(limits.maximum) || compareMoney(limits.minimum, limits.maximum) <= 0;
|
|
44
39
|
/**
|
|
45
|
-
* Amount limits of a Transfer permission in a Grant Request
|
|
46
|
-
* `minimum`/`maximum` define a range
|
|
47
|
-
*
|
|
48
|
-
* the
|
|
40
|
+
* Amount limits of a Transfer permission in a Grant Request: `value` fixes an exact amount, and
|
|
41
|
+
* `minimum`/`maximum` define a range. They are two forms of a union, so a `value` together with a
|
|
42
|
+
* `minimum` or a `maximum` is refused by the shape, here and in JSON Schema; that the range is not
|
|
43
|
+
* empty is the rule {@link amountRangeIssues}. Every amount is at least
|
|
44
|
+
* {@link MINIMUM_TRANSACTION_AMOUNT}. With `editable`, consent may only lower the maximum or raise
|
|
45
|
+
* the minimum.
|
|
49
46
|
*
|
|
50
47
|
* @example
|
|
51
48
|
* const exact = { value: "25990" };
|
|
52
49
|
* const range = { minimum: "1000", maximum: "5000000", editable: true };
|
|
53
50
|
*/
|
|
54
|
-
export const TransferLimitsRequestSchema = /* @__PURE__ */ v.
|
|
55
|
-
|
|
51
|
+
export const TransferLimitsRequestSchema = /* @__PURE__ */ v.union([
|
|
52
|
+
v.strictObject({
|
|
53
|
+
value: TransactionLimitSchema,
|
|
54
|
+
minimum: v.optional(v.null()),
|
|
55
|
+
maximum: v.optional(v.null()),
|
|
56
|
+
editable: v.nullish(v.boolean()),
|
|
57
|
+
}),
|
|
58
|
+
v.strictObject({
|
|
59
|
+
value: v.optional(v.null()),
|
|
60
|
+
minimum: v.nullish(TransactionLimitSchema),
|
|
61
|
+
maximum: v.nullish(TransactionLimitSchema),
|
|
62
|
+
editable: v.nullish(v.boolean()),
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
/** {@link TransferLimitsRequestSchema} as granted: no `editable`, no `null`. */
|
|
66
|
+
export const TransferLimitsGrantSchema = /* @__PURE__ */ v.union([
|
|
67
|
+
v.strictObject({
|
|
68
|
+
value: TransactionLimitSchema,
|
|
69
|
+
minimum: v.optional(v.never()),
|
|
70
|
+
maximum: v.optional(v.never()),
|
|
71
|
+
}),
|
|
72
|
+
v.strictObject({
|
|
73
|
+
value: v.optional(v.never()),
|
|
74
|
+
minimum: v.optional(TransactionLimitSchema),
|
|
75
|
+
maximum: v.optional(TransactionLimitSchema),
|
|
76
|
+
}),
|
|
77
|
+
]);
|
|
78
|
+
/**
|
|
79
|
+
* The amount an approver may approve, in a Grant Request. `null` or absent means no bound; that the
|
|
80
|
+
* range is not empty is the rule {@link amountRangeIssues}.
|
|
81
|
+
*/
|
|
82
|
+
export const ApprovalLimitsRequestSchema = /* @__PURE__ */ v.strictObject({
|
|
56
83
|
minimum: v.nullish(TransactionLimitSchema),
|
|
57
84
|
maximum: v.nullish(TransactionLimitSchema),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export const TransferLimitsGrantSchema = /* @__PURE__ */ v.pipe(v.strictObject({
|
|
62
|
-
value: v.optional(TransactionLimitSchema),
|
|
85
|
+
});
|
|
86
|
+
/** {@link ApprovalLimitsRequestSchema} as granted. */
|
|
87
|
+
export const ApprovalLimitsGrantSchema = /* @__PURE__ */ v.strictObject({
|
|
63
88
|
minimum: v.optional(TransactionLimitSchema),
|
|
64
89
|
maximum: v.optional(TransactionLimitSchema),
|
|
65
|
-
})
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* The rule of amount limits, Transfer or approval, in either form: `minimum_above_maximum` at
|
|
93
|
+
* `minimum` when the range they define is empty. JSON Schema cannot compare two strings as amounts,
|
|
94
|
+
* so the gate's SQL repeats it.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* amountRangeIssues({ minimum: "50000", maximum: "1000" }); // [{ type: "minimum_above_maximum", path: [{ key: "minimum" }] }]
|
|
98
|
+
*/
|
|
99
|
+
export function amountRangeIssues(limits) {
|
|
100
|
+
const { minimum, maximum } = limits;
|
|
101
|
+
if (minimum === undefined || minimum === null || maximum === undefined || maximum === null) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
if (compareMoney(minimum, maximum) <= 0) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
return [{ type: "minimum_above_maximum", path: [{ key: "minimum" }] }];
|
|
108
|
+
}
|
|
70
109
|
// -- bank_account -------------------------------------------------------------------------------
|
|
71
110
|
/**
|
|
72
111
|
* `bank_account` Grant Request: three forms, one per action family, never mixed in one detail.
|
|
@@ -98,7 +137,7 @@ export const BankAccountGrantRequestSchema = /* @__PURE__ */ v.union([
|
|
|
98
137
|
actions: actionSet(BANK_ACCOUNT_MANAGE_ACTIONS),
|
|
99
138
|
locations: AndcoRarLocationsSchema,
|
|
100
139
|
subject: SubjectPickerSchema,
|
|
101
|
-
accounts:
|
|
140
|
+
accounts: managedAccountKeyList,
|
|
102
141
|
}),
|
|
103
142
|
v.strictObject({
|
|
104
143
|
type: v.literal("bank_account"),
|
|
@@ -271,111 +310,3 @@ export const BankDepositGrantSchema = /* @__PURE__ */ v.strictObject({
|
|
|
271
310
|
subject: GrantedSubjectSchema,
|
|
272
311
|
destinations: grantedOwnList,
|
|
273
312
|
});
|
|
274
|
-
// -- JSON Schema mirrors ------------------------------------------------------------------------
|
|
275
|
-
//
|
|
276
|
-
// Written by hand, like every catalog mirror: `@valibot/to-json-schema` drops `v.check(...)`
|
|
277
|
-
// silently. What JSON Schema cannot say is enforced by valibot and by the gate's SQL: a `minimum`
|
|
278
|
-
// above its `maximum`, uniqueness of matchers that differ only by `editable` or an omitted accountKey
|
|
279
|
-
// `type`, and that an `account` source belongs to the subject.
|
|
280
|
-
const limitJson = { type: "string", pattern: TRANSACTION_LIMIT_PATTERN };
|
|
281
|
-
const currencyJson = { enum: [...BANK_CURRENCIES] };
|
|
282
|
-
const ownListJson = accountMatcherListJsonSchema(OWN_ACCOUNT_MATCHER_JSON_SCHEMA);
|
|
283
|
-
const destinationListJson = accountMatcherListJsonSchema(DESTINATION_ACCOUNT_MATCHER_JSON_SCHEMA);
|
|
284
|
-
const grantedOwnListJson = accountMatcherListJsonSchema(GRANTED_OWN_ACCOUNT_MATCHER_JSON_SCHEMA);
|
|
285
|
-
const grantedDestinationListJson = accountMatcherListJsonSchema(GRANTED_DESTINATION_ACCOUNT_MATCHER_JSON_SCHEMA);
|
|
286
|
-
const accountKeyListJson = accountMatcherListJsonSchema({
|
|
287
|
-
type: "object",
|
|
288
|
-
additionalProperties: false,
|
|
289
|
-
required: ["pattern"],
|
|
290
|
-
properties: {
|
|
291
|
-
type: nullableJson({ const: "account_key" }),
|
|
292
|
-
pattern: { type: "string", pattern: ACCOUNT_KEY_PATTERN_SYNTAX },
|
|
293
|
-
editable: nullableJson({ type: "boolean" }),
|
|
294
|
-
},
|
|
295
|
-
});
|
|
296
|
-
const grantedAccountKeyListJson = accountMatcherListJsonSchema({
|
|
297
|
-
type: "object",
|
|
298
|
-
additionalProperties: false,
|
|
299
|
-
required: ["type", "pattern"],
|
|
300
|
-
properties: { type: { const: "account_key" }, pattern: { type: "string", pattern: ACCOUNT_KEY_PATTERN_SYNTAX } },
|
|
301
|
-
});
|
|
302
|
-
const transferLimitsRequestJson = nullableJson({
|
|
303
|
-
type: "object",
|
|
304
|
-
additionalProperties: false,
|
|
305
|
-
properties: {
|
|
306
|
-
value: nullableJson(limitJson),
|
|
307
|
-
minimum: nullableJson(limitJson),
|
|
308
|
-
maximum: nullableJson(limitJson),
|
|
309
|
-
editable: nullableJson({ type: "boolean" }),
|
|
310
|
-
},
|
|
311
|
-
if: { required: ["value"], properties: { value: { type: "string" } } },
|
|
312
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema draft-07 `if`/`then`, never awaited.
|
|
313
|
-
then: { properties: { minimum: { type: "null" }, maximum: { type: "null" } } },
|
|
314
|
-
});
|
|
315
|
-
const transferLimitsGrantJson = {
|
|
316
|
-
type: "object",
|
|
317
|
-
additionalProperties: false,
|
|
318
|
-
properties: { value: limitJson, minimum: limitJson, maximum: limitJson },
|
|
319
|
-
not: { anyOf: [{ required: ["value", "minimum"] }, { required: ["value", "maximum"] }] },
|
|
320
|
-
};
|
|
321
|
-
const approvalLimitsRequestJson = nullableJson({
|
|
322
|
-
type: "object",
|
|
323
|
-
additionalProperties: false,
|
|
324
|
-
properties: { minimum: nullableJson(limitJson), maximum: nullableJson(limitJson) },
|
|
325
|
-
});
|
|
326
|
-
const approvalLimitsGrantJson = {
|
|
327
|
-
type: "object",
|
|
328
|
-
additionalProperties: false,
|
|
329
|
-
properties: { minimum: limitJson, maximum: limitJson },
|
|
330
|
-
};
|
|
331
|
-
/** JSON Schema mirror of {@link BankAccountGrantRequestSchema}. */
|
|
332
|
-
export const BANK_ACCOUNT_GRANT_REQUEST_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
333
|
-
detailFormJson("bank_account", actionSetJson(BANK_ACCOUNT_READ_ACTIONS), { subject: SUBJECT_PICKER_JSON_SCHEMA, accounts: nullableJson(ownListJson) }, []),
|
|
334
|
-
detailFormJson("bank_account", actionSetJson(BANK_ACCOUNT_MANAGE_ACTIONS), { subject: SUBJECT_PICKER_JSON_SCHEMA, accounts: accountKeyListJson }, ["accounts"]),
|
|
335
|
-
detailFormJson("bank_account", actionSetJson(BANK_ACCOUNT_APPROVAL_ACTIONS), { subject: SUBJECT_PICKER_JSON_SCHEMA }, []),
|
|
336
|
-
]);
|
|
337
|
-
/** JSON Schema mirror of {@link BankAccountGrantSchema}. */
|
|
338
|
-
export const BANK_ACCOUNT_GRANT_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
339
|
-
detailFormJson("bank_account", actionSetJson(BANK_ACCOUNT_READ_ACTIONS), { subject: GRANTED_SUBJECT_JSON_SCHEMA, accounts: grantedOwnListJson }, ["subject", "accounts"]),
|
|
340
|
-
detailFormJson("bank_account", actionSetJson(BANK_ACCOUNT_MANAGE_ACTIONS), { subject: GRANTED_SUBJECT_JSON_SCHEMA, accounts: grantedAccountKeyListJson }, ["subject", "accounts"]),
|
|
341
|
-
detailFormJson("bank_account", actionSetJson(BANK_ACCOUNT_APPROVAL_ACTIONS), { subject: GRANTED_SUBJECT_JSON_SCHEMA }, ["subject"]),
|
|
342
|
-
]);
|
|
343
|
-
/** JSON Schema mirror of {@link BankTransactionGrantRequestSchema}. */
|
|
344
|
-
export const BANK_TRANSACTION_GRANT_REQUEST_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
345
|
-
detailFormJson("bank_transaction", actionSetJson(BANK_TRANSACTION_ACTIONS), { subject: SUBJECT_PICKER_JSON_SCHEMA, accounts: nullableJson(ownListJson) }, []),
|
|
346
|
-
]);
|
|
347
|
-
/** JSON Schema mirror of {@link BankTransactionGrantSchema}. */
|
|
348
|
-
export const BANK_TRANSACTION_GRANT_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
349
|
-
detailFormJson("bank_transaction", actionSetJson(BANK_TRANSACTION_ACTIONS), { subject: GRANTED_SUBJECT_JSON_SCHEMA, accounts: grantedOwnListJson }, ["subject", "accounts"]),
|
|
350
|
-
]);
|
|
351
|
-
/** JSON Schema mirror of {@link BankTransferGrantRequestSchema}. */
|
|
352
|
-
export const BANK_TRANSFER_GRANT_REQUEST_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
353
|
-
detailFormJson("bank_transfer", actionSetJson(BANK_TRANSFER_CREATE_ACTIONS), {
|
|
354
|
-
subject: SUBJECT_PICKER_JSON_SCHEMA,
|
|
355
|
-
sources: nullableJson(ownListJson),
|
|
356
|
-
destinations: destinationListJson,
|
|
357
|
-
currency: currencyJson,
|
|
358
|
-
transactions: transferLimitsRequestJson,
|
|
359
|
-
budgets: { type: "null" },
|
|
360
|
-
}, ["destinations", "currency"]),
|
|
361
|
-
detailFormJson("bank_transfer", actionSetJson(BANK_TRANSFER_APPROVAL_ACTIONS), { subject: SUBJECT_PICKER_JSON_SCHEMA, transactions: approvalLimitsRequestJson }, []),
|
|
362
|
-
]);
|
|
363
|
-
/** JSON Schema mirror of {@link BankTransferGrantSchema}. */
|
|
364
|
-
export const BANK_TRANSFER_GRANT_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
365
|
-
detailFormJson("bank_transfer", actionSetJson(BANK_TRANSFER_CREATE_ACTIONS), {
|
|
366
|
-
subject: GRANTED_SUBJECT_JSON_SCHEMA,
|
|
367
|
-
sources: grantedOwnListJson,
|
|
368
|
-
destinations: grantedDestinationListJson,
|
|
369
|
-
currency: currencyJson,
|
|
370
|
-
transactions: transferLimitsGrantJson,
|
|
371
|
-
}, ["subject", "sources", "destinations", "currency"]),
|
|
372
|
-
detailFormJson("bank_transfer", actionSetJson(BANK_TRANSFER_APPROVAL_ACTIONS), { subject: GRANTED_SUBJECT_JSON_SCHEMA, transactions: approvalLimitsGrantJson }, ["subject"]),
|
|
373
|
-
]);
|
|
374
|
-
/** JSON Schema mirror of {@link BankDepositGrantRequestSchema}. */
|
|
375
|
-
export const BANK_DEPOSIT_GRANT_REQUEST_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
376
|
-
detailFormJson("bank_deposit", actionSetJson(BANK_DEPOSIT_ACTIONS), { subject: SUBJECT_PICKER_JSON_SCHEMA, destinations: ownListJson }, ["destinations"]),
|
|
377
|
-
]);
|
|
378
|
-
/** JSON Schema mirror of {@link BankDepositGrantSchema}. */
|
|
379
|
-
export const BANK_DEPOSIT_GRANT_JSON_SCHEMA = /* @__PURE__ */ detailTypeJson([
|
|
380
|
-
detailFormJson("bank_deposit", actionSetJson(BANK_DEPOSIT_ACTIONS), { subject: GRANTED_SUBJECT_JSON_SCHEMA, destinations: grantedOwnListJson }, ["subject", "destinations"]),
|
|
381
|
-
]);
|