@andco/protocol 0.0.14 → 0.0.15
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 +2 -2
- package/dist/api-errors.d.ts +9 -9
- package/dist/api-errors.js +9 -9
- package/dist/authorization-preparation.js +2 -2
- package/dist/authorization.d.ts +1 -1
- package/dist/authorization.js +1 -1
- package/dist/consent.d.ts +2 -2
- package/dist/consent.js +2 -2
- package/dist/errors.d.ts +9 -9
- package/dist/errors.js +9 -9
- 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 +431 -872
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +142 -121
- package/dist/miniapp-manifest.d.ts +1 -1
- package/dist/native-intent.d.ts +82 -68
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +134 -84
- package/dist/native.d.ts +1 -1
- package/dist/rar/account-matchers.d.ts +35 -30
- package/dist/rar/account-matchers.d.ts.map +1 -1
- package/dist/rar/account-matchers.js +27 -21
- package/dist/rar/bank.d.ts +81 -81
- package/dist/rar/bank.js +1 -1
- package/dist/rar/catalog.d.ts +48 -48
- package/dist/rar/catalog.js +6 -6
- package/dist/rar/detail.d.ts +1 -1
- package/dist/rar/detail.js +1 -1
- package/dist/rar/json-schemas.generated.d.ts +1 -1
- package/dist/rar/json-schemas.generated.d.ts.map +1 -1
- package/dist/rar/json-schemas.generated.js +25 -21
- package/dist/rar/subject-data.d.ts +1 -1
- package/dist/rar/subject-data.js +1 -1
- package/dist/rar/subject.d.ts +1 -1
- package/dist/rar/subject.js +1 -1
- package/dist/rest/accounts.d.ts +28 -28
- package/dist/rest/accounts.d.ts.map +1 -1
- package/dist/rest/accounts.js +22 -22
- package/dist/rest/api-error.d.ts +1 -1
- package/dist/rest/api-error.js +1 -1
- package/dist/rest/catalog.d.ts +3 -3
- package/dist/rest/catalog.js +2 -2
- package/dist/rest/common.d.ts +3 -3
- package/dist/rest/common.js +3 -3
- package/dist/rest/contract.d.ts +905 -528
- package/dist/rest/contract.d.ts.map +1 -1
- package/dist/rest/contract.js +17 -5
- package/dist/rest/events.d.ts +1 -1
- package/dist/rest/events.d.ts.map +1 -1
- package/dist/rest/events.js +2 -2
- package/dist/rest/identity.d.ts +22 -22
- package/dist/rest/identity.js +5 -5
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.d.ts.map +1 -1
- package/dist/rest/index.js +1 -0
- package/dist/rest/intents.d.ts +787 -716
- package/dist/rest/intents.d.ts.map +1 -1
- package/dist/rest/intents.js +62 -53
- package/dist/rest/signatures.d.ts +11 -5
- package/dist/rest/signatures.d.ts.map +1 -1
- package/dist/rest/signatures.js +10 -0
- package/dist/rest/transfers.d.ts +612 -0
- package/dist/rest/transfers.d.ts.map +1 -0
- package/dist/rest/transfers.js +115 -0
- package/dist/scopes.d.ts +1 -1
- package/dist/signing.d.ts +12 -2
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +6 -0
- package/dist/transfer.d.ts +363 -0
- package/dist/transfer.d.ts.map +1 -0
- package/dist/transfer.js +287 -0
- package/dist/transport/financial-events.d.ts +21 -17
- package/dist/transport/financial-events.d.ts.map +1 -1
- package/dist/transport/generated/oauth-api.d.ts +1017 -194
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/intents.d.ts +28 -12
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +1 -1
- package/dist/transport/rest.d.ts +4 -4
- package/dist/urls.d.ts +2 -2
- package/dist/urls.js +3 -3
- package/dist/userinfo.d.ts +2 -2
- package/dist/userinfo.js +2 -2
- package/dist/webhooks.d.ts +16 -16
- package/dist/webhooks.js +14 -14
- package/dist/window-features.d.ts +2 -2
- package/dist/window-features.js +2 -2
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { duplicateIssues } from "../issues.js";
|
|
3
|
+
import { BankCodeSchema, TransferAccountTypeSchema } from "../transfer.js";
|
|
3
4
|
/**
|
|
4
|
-
* Syntax of an Account Key: the name that identifies one
|
|
5
|
+
* Syntax of an Account Key: the name that identifies one cuenta digital among the accounts of its
|
|
5
6
|
* Subject, unique per Subject regardless of which Project opened it.
|
|
6
7
|
*/
|
|
7
8
|
export const ACCOUNT_KEY_SYNTAX = "^[a-z][a-z0-9_-]{0,63}$";
|
|
@@ -28,9 +29,12 @@ export const AccountKeyPatternSchema = /* @__PURE__ */ v.pipe(v.string(), v.rege
|
|
|
28
29
|
export const ACCOUNT_MATCHER_LIST_CEILING = 100;
|
|
29
30
|
/** Upper bound of each optional field of an `external` matcher. */
|
|
30
31
|
const EXTERNAL_FIELD_CEILING = 128;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The fields an `external` matcher may fix, each narrowing the accounts it admits. They are the
|
|
34
|
+
* Receptor's own fields in Core's vocabulary (`receiver`), so a Receptor is compared field by field.
|
|
35
|
+
*/
|
|
36
|
+
export const ACCOUNT_EXTERNAL_FIELDS = ["bank_code", "account_type", "account_number", "national_id", "name"];
|
|
37
|
+
/** An AndCo account identifier: any 8-4-4-4-12 hex, with no version or variant check. */
|
|
34
38
|
const accountId = /* @__PURE__ */ v.pipe(v.string(), v.uuid());
|
|
35
39
|
const externalField = /* @__PURE__ */ v.pipe(v.string(), v.minLength(1), v.maxLength(EXTERNAL_FIELD_CEILING), v.regex(/\S/));
|
|
36
40
|
const editable = /* @__PURE__ */ v.nullish(v.boolean());
|
|
@@ -77,7 +81,7 @@ export const ManagedAccountKeyMatcherSchema = /* @__PURE__ */ v.strictObject({
|
|
|
77
81
|
editable,
|
|
78
82
|
});
|
|
79
83
|
/**
|
|
80
|
-
* One exact
|
|
84
|
+
* One exact AndCo account. As a source or in `accounts` it must be an account of the Subject; the
|
|
81
85
|
* gate checks ownership, since the schema cannot.
|
|
82
86
|
*/
|
|
83
87
|
export const AccountInternalMatcherSchema = /* @__PURE__ */ v.strictObject({
|
|
@@ -92,31 +96,33 @@ export const AnyOwnMatcherSchema = /* @__PURE__ */ v.strictObject({
|
|
|
92
96
|
editable,
|
|
93
97
|
selection,
|
|
94
98
|
});
|
|
95
|
-
/** Every
|
|
99
|
+
/** Every AndCo account, of any Subject. Only a destination. */
|
|
96
100
|
export const AnyLocalMatcherSchema = /* @__PURE__ */ v.strictObject({
|
|
97
101
|
type: v.literal("any"),
|
|
98
102
|
limit: v.literal("local"),
|
|
99
103
|
editable,
|
|
100
104
|
});
|
|
101
|
-
/** Every account, at
|
|
105
|
+
/** Every account, at AndCo or at another bank. Only a destination, and never `editable`. */
|
|
102
106
|
export const AnyAllMatcherSchema = /* @__PURE__ */ v.strictObject({
|
|
103
107
|
type: v.literal("any"),
|
|
104
108
|
limit: v.literal("all"),
|
|
105
109
|
});
|
|
106
110
|
/**
|
|
107
|
-
* Accounts at other banks, narrowed by every field it fixes
|
|
108
|
-
*
|
|
111
|
+
* Accounts at other banks, narrowed by every field it fixes, in the Receptor's vocabulary: Core's
|
|
112
|
+
* four-digit `bank_code`, its `account_type` code (`"10"`, `"20"`, `"40"`), the `account_number`, and
|
|
113
|
+
* the holder's `national_id` (RUT) and `name`. `{ type: "external" }` alone admits every account
|
|
114
|
+
* outside AndCo. Only a destination.
|
|
109
115
|
*
|
|
110
116
|
* @example
|
|
111
|
-
* const payroll: AccountExternal = { type: "external",
|
|
117
|
+
* const payroll: AccountExternal = { type: "external", bank_code: "0001", account_number: "00123456" };
|
|
112
118
|
*/
|
|
113
119
|
export const AccountExternalMatcherSchema = /* @__PURE__ */ v.strictObject({
|
|
114
120
|
type: v.literal("external"),
|
|
115
|
-
|
|
116
|
-
account_type: v.nullish(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
bank_code: v.nullish(BankCodeSchema),
|
|
122
|
+
account_type: v.nullish(TransferAccountTypeSchema),
|
|
123
|
+
account_number: v.nullish(externalField),
|
|
124
|
+
national_id: v.nullish(externalField),
|
|
125
|
+
name: v.nullish(externalField),
|
|
120
126
|
editable,
|
|
121
127
|
});
|
|
122
128
|
/**
|
|
@@ -160,11 +166,11 @@ export const GrantedAnyAllSchema = AnyAllMatcherSchema;
|
|
|
160
166
|
/** {@link AccountExternalMatcherSchema} as granted: absent fields are unrestricted, never `null`. */
|
|
161
167
|
export const GrantedAccountExternalSchema = /* @__PURE__ */ v.strictObject({
|
|
162
168
|
type: v.literal("external"),
|
|
163
|
-
|
|
164
|
-
account_type: v.optional(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
bank_code: v.optional(BankCodeSchema),
|
|
170
|
+
account_type: v.optional(TransferAccountTypeSchema),
|
|
171
|
+
account_number: v.optional(externalField),
|
|
172
|
+
national_id: v.optional(externalField),
|
|
173
|
+
name: v.optional(externalField),
|
|
168
174
|
});
|
|
169
175
|
/** {@link OwnAccountMatcherSchema} as granted. */
|
|
170
176
|
export const GrantedOwnAccountMatcherSchema = /* @__PURE__ */ v.union([
|
|
@@ -348,7 +354,7 @@ function externalContains(outer, inner) {
|
|
|
348
354
|
* - `external` is contained by `any(all)`, and by an `external` whose every fixed field `inner`
|
|
349
355
|
* fixes to the same value. Nothing else contains it, and it contains nothing but such an
|
|
350
356
|
* `external`.
|
|
351
|
-
* - `any(local)` contains every
|
|
357
|
+
* - `any(local)` contains every AndCo matcher: `any(local)`, `any(own)`, `accountKey` and `account`.
|
|
352
358
|
* - `any(own)` contains `any(own)` and `accountKey` (an accountKey names an account of the Subject by
|
|
353
359
|
* construction), and an `account` only when `facts.ownAccounts` says it is the Subject's.
|
|
354
360
|
* - `accountKey:q` contains `accountKey:p` per {@link accountKeyPatternContains}, and an `account` only when
|
package/dist/rar/bank.d.ts
CHANGED
|
@@ -472,7 +472,7 @@ export type BankTransactionGrant = v.InferOutput<typeof BankTransactionGrantSche
|
|
|
472
472
|
* locations: ["https://api.andco.com"],
|
|
473
473
|
* subject: { type: "organization" },
|
|
474
474
|
* sources: [{ type: "account_key", pattern: "caja-*", editable: true }],
|
|
475
|
-
* destinations: [{ type: "account_key", pattern: "proveedores" }, { type: "external",
|
|
475
|
+
* destinations: [{ type: "account_key", pattern: "proveedores" }, { type: "external", bank_code: "0001" }],
|
|
476
476
|
* currency: "CLP",
|
|
477
477
|
* transactions: { minimum: "1000", maximum: "5000000", editable: true },
|
|
478
478
|
* budgets: null,
|
|
@@ -574,11 +574,11 @@ export declare const BankTransferCreateGrantRequestSchema: v.StrictObjectSchema<
|
|
|
574
574
|
readonly limit: v.LiteralSchema<"all", undefined>;
|
|
575
575
|
}, undefined>, v.StrictObjectSchema<{
|
|
576
576
|
readonly type: v.LiteralSchema<"external", undefined>;
|
|
577
|
-
readonly
|
|
578
|
-
readonly account_type: v.NullishSchema<v.SchemaWithPipe<readonly [v.
|
|
579
|
-
readonly
|
|
580
|
-
readonly
|
|
581
|
-
readonly
|
|
577
|
+
readonly bank_code: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>, undefined>;
|
|
578
|
+
readonly account_type: v.NullishSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>, undefined>;
|
|
579
|
+
readonly account_number: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
580
|
+
readonly national_id: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
581
|
+
readonly name: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
582
582
|
readonly editable: v.NullishSchema<v.BooleanSchema<undefined>, undefined>;
|
|
583
583
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
584
584
|
type?: "account_key" | null | undefined;
|
|
@@ -603,11 +603,11 @@ export declare const BankTransferCreateGrantRequestSchema: v.StrictObjectSchema<
|
|
|
603
603
|
limit: "all";
|
|
604
604
|
} | {
|
|
605
605
|
type: "external";
|
|
606
|
-
|
|
607
|
-
account_type?:
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
606
|
+
bank_code?: string | null | undefined;
|
|
607
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
608
|
+
account_number?: string | null | undefined;
|
|
609
|
+
national_id?: string | null | undefined;
|
|
610
|
+
name?: string | null | undefined;
|
|
611
611
|
editable?: boolean | null | undefined;
|
|
612
612
|
})[], 1, undefined>, v.MaxLengthAction<({
|
|
613
613
|
type?: "account_key" | null | undefined;
|
|
@@ -632,11 +632,11 @@ export declare const BankTransferCreateGrantRequestSchema: v.StrictObjectSchema<
|
|
|
632
632
|
limit: "all";
|
|
633
633
|
} | {
|
|
634
634
|
type: "external";
|
|
635
|
-
|
|
636
|
-
account_type?:
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
635
|
+
bank_code?: string | null | undefined;
|
|
636
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
637
|
+
account_number?: string | null | undefined;
|
|
638
|
+
national_id?: string | null | undefined;
|
|
639
|
+
name?: string | null | undefined;
|
|
640
640
|
editable?: boolean | null | undefined;
|
|
641
641
|
})[], 100, undefined>, v.MetadataAction<({
|
|
642
642
|
type?: "account_key" | null | undefined;
|
|
@@ -661,11 +661,11 @@ export declare const BankTransferCreateGrantRequestSchema: v.StrictObjectSchema<
|
|
|
661
661
|
limit: "all";
|
|
662
662
|
} | {
|
|
663
663
|
type: "external";
|
|
664
|
-
|
|
665
|
-
account_type?:
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
664
|
+
bank_code?: string | null | undefined;
|
|
665
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
666
|
+
account_number?: string | null | undefined;
|
|
667
|
+
national_id?: string | null | undefined;
|
|
668
|
+
name?: string | null | undefined;
|
|
669
669
|
editable?: boolean | null | undefined;
|
|
670
670
|
})[], {
|
|
671
671
|
readonly uniqueItems: true;
|
|
@@ -815,11 +815,11 @@ export declare const BankTransferGrantRequestSchema: v.UnionSchema<[v.StrictObje
|
|
|
815
815
|
readonly limit: v.LiteralSchema<"all", undefined>;
|
|
816
816
|
}, undefined>, v.StrictObjectSchema<{
|
|
817
817
|
readonly type: v.LiteralSchema<"external", undefined>;
|
|
818
|
-
readonly
|
|
819
|
-
readonly account_type: v.NullishSchema<v.SchemaWithPipe<readonly [v.
|
|
820
|
-
readonly
|
|
821
|
-
readonly
|
|
822
|
-
readonly
|
|
818
|
+
readonly bank_code: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>, undefined>;
|
|
819
|
+
readonly account_type: v.NullishSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>, undefined>;
|
|
820
|
+
readonly account_number: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
821
|
+
readonly national_id: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
822
|
+
readonly name: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
823
823
|
readonly editable: v.NullishSchema<v.BooleanSchema<undefined>, undefined>;
|
|
824
824
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
825
825
|
type?: "account_key" | null | undefined;
|
|
@@ -844,11 +844,11 @@ export declare const BankTransferGrantRequestSchema: v.UnionSchema<[v.StrictObje
|
|
|
844
844
|
limit: "all";
|
|
845
845
|
} | {
|
|
846
846
|
type: "external";
|
|
847
|
-
|
|
848
|
-
account_type?:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
847
|
+
bank_code?: string | null | undefined;
|
|
848
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
849
|
+
account_number?: string | null | undefined;
|
|
850
|
+
national_id?: string | null | undefined;
|
|
851
|
+
name?: string | null | undefined;
|
|
852
852
|
editable?: boolean | null | undefined;
|
|
853
853
|
})[], 1, undefined>, v.MaxLengthAction<({
|
|
854
854
|
type?: "account_key" | null | undefined;
|
|
@@ -873,11 +873,11 @@ export declare const BankTransferGrantRequestSchema: v.UnionSchema<[v.StrictObje
|
|
|
873
873
|
limit: "all";
|
|
874
874
|
} | {
|
|
875
875
|
type: "external";
|
|
876
|
-
|
|
877
|
-
account_type?:
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
876
|
+
bank_code?: string | null | undefined;
|
|
877
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
878
|
+
account_number?: string | null | undefined;
|
|
879
|
+
national_id?: string | null | undefined;
|
|
880
|
+
name?: string | null | undefined;
|
|
881
881
|
editable?: boolean | null | undefined;
|
|
882
882
|
})[], 100, undefined>, v.MetadataAction<({
|
|
883
883
|
type?: "account_key" | null | undefined;
|
|
@@ -902,11 +902,11 @@ export declare const BankTransferGrantRequestSchema: v.UnionSchema<[v.StrictObje
|
|
|
902
902
|
limit: "all";
|
|
903
903
|
} | {
|
|
904
904
|
type: "external";
|
|
905
|
-
|
|
906
|
-
account_type?:
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
905
|
+
bank_code?: string | null | undefined;
|
|
906
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
907
|
+
account_number?: string | null | undefined;
|
|
908
|
+
national_id?: string | null | undefined;
|
|
909
|
+
name?: string | null | undefined;
|
|
910
910
|
editable?: boolean | null | undefined;
|
|
911
911
|
})[], {
|
|
912
912
|
readonly uniqueItems: true;
|
|
@@ -1014,11 +1014,11 @@ export declare const BankTransferCreateGrantSchema: v.StrictObjectSchema<{
|
|
|
1014
1014
|
readonly limit: v.LiteralSchema<"all", undefined>;
|
|
1015
1015
|
}, undefined>, v.StrictObjectSchema<{
|
|
1016
1016
|
readonly type: v.LiteralSchema<"external", undefined>;
|
|
1017
|
-
readonly
|
|
1018
|
-
readonly account_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.
|
|
1019
|
-
readonly
|
|
1020
|
-
readonly
|
|
1021
|
-
readonly
|
|
1017
|
+
readonly bank_code: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>, undefined>;
|
|
1018
|
+
readonly account_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>, undefined>;
|
|
1019
|
+
readonly account_number: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
1020
|
+
readonly national_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
1021
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
1022
1022
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
1023
1023
|
type: "any";
|
|
1024
1024
|
limit: "all";
|
|
@@ -1036,11 +1036,11 @@ export declare const BankTransferCreateGrantSchema: v.StrictObjectSchema<{
|
|
|
1036
1036
|
limit: "local";
|
|
1037
1037
|
} | {
|
|
1038
1038
|
type: "external";
|
|
1039
|
-
|
|
1040
|
-
account_type?:
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1039
|
+
bank_code?: string | undefined;
|
|
1040
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
1041
|
+
account_number?: string | undefined;
|
|
1042
|
+
national_id?: string | undefined;
|
|
1043
|
+
name?: string | undefined;
|
|
1044
1044
|
})[], 1, undefined>, v.MaxLengthAction<({
|
|
1045
1045
|
type: "any";
|
|
1046
1046
|
limit: "all";
|
|
@@ -1058,11 +1058,11 @@ export declare const BankTransferCreateGrantSchema: v.StrictObjectSchema<{
|
|
|
1058
1058
|
limit: "local";
|
|
1059
1059
|
} | {
|
|
1060
1060
|
type: "external";
|
|
1061
|
-
|
|
1062
|
-
account_type?:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1061
|
+
bank_code?: string | undefined;
|
|
1062
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
1063
|
+
account_number?: string | undefined;
|
|
1064
|
+
national_id?: string | undefined;
|
|
1065
|
+
name?: string | undefined;
|
|
1066
1066
|
})[], 100, undefined>, v.MetadataAction<({
|
|
1067
1067
|
type: "any";
|
|
1068
1068
|
limit: "all";
|
|
@@ -1080,11 +1080,11 @@ export declare const BankTransferCreateGrantSchema: v.StrictObjectSchema<{
|
|
|
1080
1080
|
limit: "local";
|
|
1081
1081
|
} | {
|
|
1082
1082
|
type: "external";
|
|
1083
|
-
|
|
1084
|
-
account_type?:
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1083
|
+
bank_code?: string | undefined;
|
|
1084
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
1085
|
+
account_number?: string | undefined;
|
|
1086
|
+
national_id?: string | undefined;
|
|
1087
|
+
name?: string | undefined;
|
|
1088
1088
|
})[], {
|
|
1089
1089
|
readonly uniqueItems: true;
|
|
1090
1090
|
}>]>;
|
|
@@ -1190,11 +1190,11 @@ export declare const BankTransferGrantSchema: v.UnionSchema<[v.StrictObjectSchem
|
|
|
1190
1190
|
readonly limit: v.LiteralSchema<"all", undefined>;
|
|
1191
1191
|
}, undefined>, v.StrictObjectSchema<{
|
|
1192
1192
|
readonly type: v.LiteralSchema<"external", undefined>;
|
|
1193
|
-
readonly
|
|
1194
|
-
readonly account_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.
|
|
1195
|
-
readonly
|
|
1196
|
-
readonly
|
|
1197
|
-
readonly
|
|
1193
|
+
readonly bank_code: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>, undefined>;
|
|
1194
|
+
readonly account_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>, undefined>;
|
|
1195
|
+
readonly account_number: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
1196
|
+
readonly national_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
1197
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
1198
1198
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
1199
1199
|
type: "any";
|
|
1200
1200
|
limit: "all";
|
|
@@ -1212,11 +1212,11 @@ export declare const BankTransferGrantSchema: v.UnionSchema<[v.StrictObjectSchem
|
|
|
1212
1212
|
limit: "local";
|
|
1213
1213
|
} | {
|
|
1214
1214
|
type: "external";
|
|
1215
|
-
|
|
1216
|
-
account_type?:
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1215
|
+
bank_code?: string | undefined;
|
|
1216
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
1217
|
+
account_number?: string | undefined;
|
|
1218
|
+
national_id?: string | undefined;
|
|
1219
|
+
name?: string | undefined;
|
|
1220
1220
|
})[], 1, undefined>, v.MaxLengthAction<({
|
|
1221
1221
|
type: "any";
|
|
1222
1222
|
limit: "all";
|
|
@@ -1234,11 +1234,11 @@ export declare const BankTransferGrantSchema: v.UnionSchema<[v.StrictObjectSchem
|
|
|
1234
1234
|
limit: "local";
|
|
1235
1235
|
} | {
|
|
1236
1236
|
type: "external";
|
|
1237
|
-
|
|
1238
|
-
account_type?:
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1237
|
+
bank_code?: string | undefined;
|
|
1238
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
1239
|
+
account_number?: string | undefined;
|
|
1240
|
+
national_id?: string | undefined;
|
|
1241
|
+
name?: string | undefined;
|
|
1242
1242
|
})[], 100, undefined>, v.MetadataAction<({
|
|
1243
1243
|
type: "any";
|
|
1244
1244
|
limit: "all";
|
|
@@ -1256,11 +1256,11 @@ export declare const BankTransferGrantSchema: v.UnionSchema<[v.StrictObjectSchem
|
|
|
1256
1256
|
limit: "local";
|
|
1257
1257
|
} | {
|
|
1258
1258
|
type: "external";
|
|
1259
|
-
|
|
1260
|
-
account_type?:
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1259
|
+
bank_code?: string | undefined;
|
|
1260
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
1261
|
+
account_number?: string | undefined;
|
|
1262
|
+
national_id?: string | undefined;
|
|
1263
|
+
name?: string | undefined;
|
|
1264
1264
|
})[], {
|
|
1265
1265
|
readonly uniqueItems: true;
|
|
1266
1266
|
}>]>;
|
package/dist/rar/bank.js
CHANGED
|
@@ -215,7 +215,7 @@ export const BankTransactionGrantSchema = /* @__PURE__ */ v.strictObject({
|
|
|
215
215
|
* locations: ["https://api.andco.com"],
|
|
216
216
|
* subject: { type: "organization" },
|
|
217
217
|
* sources: [{ type: "account_key", pattern: "caja-*", editable: true }],
|
|
218
|
-
* destinations: [{ type: "account_key", pattern: "proveedores" }, { type: "external",
|
|
218
|
+
* destinations: [{ type: "account_key", pattern: "proveedores" }, { type: "external", bank_code: "0001" }],
|
|
219
219
|
* currency: "CLP",
|
|
220
220
|
* transactions: { minimum: "1000", maximum: "5000000", editable: true },
|
|
221
221
|
* budgets: null,
|
package/dist/rar/catalog.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { ErrorExtendable } from "../errors.js";
|
|
3
3
|
import { type Issue } from "../issues.js";
|
|
4
|
-
/** Every authorization detail type
|
|
4
|
+
/** Every authorization detail type AndCo's Resource Server implements. */
|
|
5
5
|
export declare const ANDCO_RAR_TYPES: readonly ["bank_account", "bank_transaction", "bank_transfer", "bank_deposit", "identity", "address", "organization", "profile", "project_users"];
|
|
6
6
|
export type AndcoRarType = (typeof ANDCO_RAR_TYPES)[number];
|
|
7
7
|
/**
|
|
@@ -32,7 +32,7 @@ export type AndcoRarCatalogEntry = {
|
|
|
32
32
|
readonly grant: v.GenericSchema;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
* The whole
|
|
35
|
+
* The whole AndCo authorization detail catalog, keyed by type. The gate's seeds store `actions` as
|
|
36
36
|
* each type's registered actions and, as its request schema, the JSON Schema `ANDCO_RAR_JSON_SCHEMAS`
|
|
37
37
|
* holds, generated from `grantRequest`; a guard test compares them. The schemas describe shape only:
|
|
38
38
|
* the rules JSON Schema cannot say are {@link andcoRarIssues}, which the parse functions apply and
|
|
@@ -488,11 +488,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
488
488
|
readonly limit: v.LiteralSchema<"all", undefined>;
|
|
489
489
|
}, undefined>, v.StrictObjectSchema<{
|
|
490
490
|
readonly type: v.LiteralSchema<"external", undefined>;
|
|
491
|
-
readonly
|
|
492
|
-
readonly account_type: v.NullishSchema<v.SchemaWithPipe<readonly [v.
|
|
493
|
-
readonly
|
|
494
|
-
readonly
|
|
495
|
-
readonly
|
|
491
|
+
readonly bank_code: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>, undefined>;
|
|
492
|
+
readonly account_type: v.NullishSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>, undefined>;
|
|
493
|
+
readonly account_number: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
494
|
+
readonly national_id: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
495
|
+
readonly name: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
496
496
|
readonly editable: v.NullishSchema<v.BooleanSchema<undefined>, undefined>;
|
|
497
497
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
498
498
|
type?: "account_key" | null | undefined;
|
|
@@ -517,11 +517,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
517
517
|
limit: "all";
|
|
518
518
|
} | {
|
|
519
519
|
type: "external";
|
|
520
|
-
|
|
521
|
-
account_type?:
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
520
|
+
bank_code?: string | null | undefined;
|
|
521
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
522
|
+
account_number?: string | null | undefined;
|
|
523
|
+
national_id?: string | null | undefined;
|
|
524
|
+
name?: string | null | undefined;
|
|
525
525
|
editable?: boolean | null | undefined;
|
|
526
526
|
})[], 1, undefined>, v.MaxLengthAction<({
|
|
527
527
|
type?: "account_key" | null | undefined;
|
|
@@ -546,11 +546,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
546
546
|
limit: "all";
|
|
547
547
|
} | {
|
|
548
548
|
type: "external";
|
|
549
|
-
|
|
550
|
-
account_type?:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
549
|
+
bank_code?: string | null | undefined;
|
|
550
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
551
|
+
account_number?: string | null | undefined;
|
|
552
|
+
national_id?: string | null | undefined;
|
|
553
|
+
name?: string | null | undefined;
|
|
554
554
|
editable?: boolean | null | undefined;
|
|
555
555
|
})[], 100, undefined>, v.MetadataAction<({
|
|
556
556
|
type?: "account_key" | null | undefined;
|
|
@@ -575,11 +575,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
575
575
|
limit: "all";
|
|
576
576
|
} | {
|
|
577
577
|
type: "external";
|
|
578
|
-
|
|
579
|
-
account_type?:
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
578
|
+
bank_code?: string | null | undefined;
|
|
579
|
+
account_type?: "10" | "20" | "40" | null | undefined;
|
|
580
|
+
account_number?: string | null | undefined;
|
|
581
|
+
national_id?: string | null | undefined;
|
|
582
|
+
name?: string | null | undefined;
|
|
583
583
|
editable?: boolean | null | undefined;
|
|
584
584
|
})[], {
|
|
585
585
|
readonly uniqueItems: true;
|
|
@@ -685,11 +685,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
685
685
|
readonly limit: v.LiteralSchema<"all", undefined>;
|
|
686
686
|
}, undefined>, v.StrictObjectSchema<{
|
|
687
687
|
readonly type: v.LiteralSchema<"external", undefined>;
|
|
688
|
-
readonly
|
|
689
|
-
readonly account_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.
|
|
690
|
-
readonly
|
|
691
|
-
readonly
|
|
692
|
-
readonly
|
|
688
|
+
readonly bank_code: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>, undefined>;
|
|
689
|
+
readonly account_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>, undefined>;
|
|
690
|
+
readonly account_number: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
691
|
+
readonly national_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
692
|
+
readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
693
693
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
694
694
|
type: "any";
|
|
695
695
|
limit: "all";
|
|
@@ -707,11 +707,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
707
707
|
limit: "local";
|
|
708
708
|
} | {
|
|
709
709
|
type: "external";
|
|
710
|
-
|
|
711
|
-
account_type?:
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
710
|
+
bank_code?: string | undefined;
|
|
711
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
712
|
+
account_number?: string | undefined;
|
|
713
|
+
national_id?: string | undefined;
|
|
714
|
+
name?: string | undefined;
|
|
715
715
|
})[], 1, undefined>, v.MaxLengthAction<({
|
|
716
716
|
type: "any";
|
|
717
717
|
limit: "all";
|
|
@@ -729,11 +729,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
729
729
|
limit: "local";
|
|
730
730
|
} | {
|
|
731
731
|
type: "external";
|
|
732
|
-
|
|
733
|
-
account_type?:
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
732
|
+
bank_code?: string | undefined;
|
|
733
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
734
|
+
account_number?: string | undefined;
|
|
735
|
+
national_id?: string | undefined;
|
|
736
|
+
name?: string | undefined;
|
|
737
737
|
})[], 100, undefined>, v.MetadataAction<({
|
|
738
738
|
type: "any";
|
|
739
739
|
limit: "all";
|
|
@@ -751,11 +751,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
751
751
|
limit: "local";
|
|
752
752
|
} | {
|
|
753
753
|
type: "external";
|
|
754
|
-
|
|
755
|
-
account_type?:
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
754
|
+
bank_code?: string | undefined;
|
|
755
|
+
account_type?: "10" | "20" | "40" | undefined;
|
|
756
|
+
account_number?: string | undefined;
|
|
757
|
+
national_id?: string | undefined;
|
|
758
|
+
name?: string | undefined;
|
|
759
759
|
})[], {
|
|
760
760
|
readonly uniqueItems: true;
|
|
761
761
|
}>]>;
|
|
@@ -1090,11 +1090,11 @@ export declare const ANDCO_RAR_CATALOG: {
|
|
|
1090
1090
|
}, undefined>;
|
|
1091
1091
|
};
|
|
1092
1092
|
};
|
|
1093
|
-
/** Any
|
|
1093
|
+
/** Any AndCo authorization detail in its Grant Request form. */
|
|
1094
1094
|
export type AndcoGrantRequest = {
|
|
1095
1095
|
[Type in AndcoRarType]: v.InferOutput<(typeof ANDCO_RAR_CATALOG)[Type]["grantRequest"]>;
|
|
1096
1096
|
}[AndcoRarType];
|
|
1097
|
-
/** Any
|
|
1097
|
+
/** Any AndCo authorization detail in its Grant form, as `GET /authorization` returns it. */
|
|
1098
1098
|
export type AndcoGrant = {
|
|
1099
1099
|
[Type in AndcoRarType]: v.InferOutput<(typeof ANDCO_RAR_CATALOG)[Type]["grant"]>;
|
|
1100
1100
|
}[AndcoRarType];
|
|
@@ -1116,7 +1116,7 @@ export declare function isAndcoRarType(type: unknown): type is AndcoRarType;
|
|
|
1116
1116
|
/** Whether `type` is one of {@link ANDCO_RESERVED_RAR_TYPES}. */
|
|
1117
1117
|
export declare function isAndcoReservedRarType(type: unknown): type is AndcoReservedRarType;
|
|
1118
1118
|
/**
|
|
1119
|
-
* Whether an authorization detail is one of
|
|
1119
|
+
* Whether an authorization detail is one of AndCo's own types. Over a union with third-party details
|
|
1120
1120
|
* (`AndcoGrantDetail`) it narrows to {@link AndcoGrant}, which `detail["type"] === "bank_account"` cannot do:
|
|
1121
1121
|
* a third party may name its own types freely, so its `type` is any string.
|
|
1122
1122
|
*
|
|
@@ -1127,7 +1127,7 @@ export declare function isAndcoGrant(detail: {
|
|
|
1127
1127
|
readonly type: string;
|
|
1128
1128
|
}): detail is AndcoGrant;
|
|
1129
1129
|
/**
|
|
1130
|
-
* The rules of an
|
|
1130
|
+
* The rules of an AndCo authorization detail that already matches its schema, in either form: what
|
|
1131
1131
|
* JSON Schema cannot say, each answered as an {@link Issue} with its code in `type`.
|
|
1132
1132
|
*
|
|
1133
1133
|
* - `duplicate_action` at an action listed twice.
|
|
@@ -1153,7 +1153,7 @@ export declare function isAndcoGrant(detail: {
|
|
|
1153
1153
|
*/
|
|
1154
1154
|
export declare function andcoRarIssues(detail: AndcoGrantRequest | AndcoGrant): Issue[];
|
|
1155
1155
|
/**
|
|
1156
|
-
* Validates one
|
|
1156
|
+
* Validates one AndCo authorization detail in its Grant Request form, dispatching on `type`.
|
|
1157
1157
|
* Throws {@link AndcoRarError}: `not_implemented` for a reserved type, `invalid_request` otherwise.
|
|
1158
1158
|
*
|
|
1159
1159
|
* @example
|
|
@@ -1169,7 +1169,7 @@ export declare function andcoRarIssues(detail: AndcoGrantRequest | AndcoGrant):
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
export declare function parseAndcoGrantRequest(detail: unknown): AndcoGrantRequest;
|
|
1171
1171
|
/**
|
|
1172
|
-
* Validates one
|
|
1172
|
+
* Validates one AndCo authorization detail in its Grant form, as `GET /authorization` returns it.
|
|
1173
1173
|
* Throws {@link AndcoRarError} like {@link parseAndcoGrantRequest}.
|
|
1174
1174
|
*
|
|
1175
1175
|
* @example
|