@andco/protocol 0.0.1
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/LICENSE +202 -0
- package/README.md +44 -0
- package/dist/authorization-preparation.d.ts +754 -0
- package/dist/authorization-preparation.d.ts.map +1 -0
- package/dist/authorization-preparation.js +187 -0
- package/dist/authorization.d.ts +99 -0
- package/dist/authorization.d.ts.map +1 -0
- package/dist/authorization.js +227 -0
- package/dist/automatic-charge.d.ts +314 -0
- package/dist/automatic-charge.d.ts.map +1 -0
- package/dist/automatic-charge.js +126 -0
- package/dist/bank-account-authorization.d.ts +6 -0
- package/dist/bank-account-authorization.d.ts.map +1 -0
- package/dist/bank-account-authorization.js +13 -0
- package/dist/callback-state.d.ts +10 -0
- package/dist/callback-state.d.ts.map +1 -0
- package/dist/callback-state.js +28 -0
- package/dist/consent.d.ts +48 -0
- package/dist/consent.d.ts.map +1 -0
- package/dist/consent.js +110 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +20 -0
- package/dist/errors.d.ts +70 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +80 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/intent-input.d.ts +637 -0
- package/dist/intent-input.d.ts.map +1 -0
- package/dist/intent-input.js +101 -0
- package/dist/messages/authorization-response.d.ts +12 -0
- package/dist/messages/authorization-response.d.ts.map +1 -0
- package/dist/messages/authorization-response.js +9 -0
- package/dist/messages/base.d.ts +31 -0
- package/dist/messages/base.d.ts.map +1 -0
- package/dist/messages/base.js +30 -0
- package/dist/messages/click.d.ts +11 -0
- package/dist/messages/click.d.ts.map +1 -0
- package/dist/messages/click.js +8 -0
- package/dist/messages/error.d.ts +13 -0
- package/dist/messages/error.d.ts.map +1 -0
- package/dist/messages/error.js +9 -0
- package/dist/messages/index.d.ts +75 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +27 -0
- package/dist/messages/init.d.ts +9 -0
- package/dist/messages/init.d.ts.map +1 -0
- package/dist/messages/init.js +6 -0
- package/dist/messages/popup.d.ts +108 -0
- package/dist/messages/popup.d.ts.map +1 -0
- package/dist/messages/popup.js +62 -0
- package/dist/messages/ready.d.ts +9 -0
- package/dist/messages/ready.d.ts.map +1 -0
- package/dist/messages/ready.js +6 -0
- package/dist/messages/set-preferences.d.ts +16 -0
- package/dist/messages/set-preferences.d.ts.map +1 -0
- package/dist/messages/set-preferences.js +20 -0
- package/dist/miniapp-icon.d.ts +4 -0
- package/dist/miniapp-icon.d.ts.map +1 -0
- package/dist/miniapp-icon.js +68 -0
- package/dist/miniapp-manifest.d.ts +71 -0
- package/dist/miniapp-manifest.d.ts.map +1 -0
- package/dist/miniapp-manifest.js +46 -0
- package/dist/native-copy.d.ts +7 -0
- package/dist/native-copy.d.ts.map +1 -0
- package/dist/native-copy.js +436 -0
- package/dist/native-intent.d.ts +402 -0
- package/dist/native-intent.d.ts.map +1 -0
- package/dist/native-intent.js +410 -0
- package/dist/native.d.ts +55 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +53 -0
- package/dist/oauth.d.ts +4 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +3 -0
- package/dist/release.d.ts +3 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +2 -0
- package/dist/scopes.d.ts +35 -0
- package/dist/scopes.d.ts.map +1 -0
- package/dist/scopes.js +15 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +14 -0
- package/dist/transport/financial-events.d.ts +134 -0
- package/dist/transport/financial-events.d.ts.map +1 -0
- package/dist/transport/financial-events.js +120 -0
- package/dist/transport/generated/oauth-api.d.ts +1685 -0
- package/dist/transport/generated/oauth-api.d.ts.map +1 -0
- package/dist/transport/generated/oauth-api.js +5 -0
- package/dist/transport/index.d.ts +6 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +5 -0
- package/dist/transport/intents.d.ts +81 -0
- package/dist/transport/intents.d.ts.map +1 -0
- package/dist/transport/intents.js +286 -0
- package/dist/transport/rest.d.ts +76 -0
- package/dist/transport/rest.d.ts.map +1 -0
- package/dist/transport/rest.js +48 -0
- package/dist/transport/runtime.d.ts +8 -0
- package/dist/transport/runtime.d.ts.map +1 -0
- package/dist/transport/runtime.js +16 -0
- package/dist/transport/webhooks.d.ts +27 -0
- package/dist/transport/webhooks.d.ts.map +1 -0
- package/dist/transport/webhooks.js +68 -0
- package/dist/urls.d.ts +71 -0
- package/dist/urls.d.ts.map +1 -0
- package/dist/urls.js +132 -0
- package/dist/userinfo.d.ts +11 -0
- package/dist/userinfo.d.ts.map +1 -0
- package/dist/userinfo.js +9 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +45 -0
- package/dist/webhook-input.d.ts +22 -0
- package/dist/webhook-input.d.ts.map +1 -0
- package/dist/webhook-input.js +11 -0
- package/dist/webhook-signature.d.ts +54 -0
- package/dist/webhook-signature.d.ts.map +1 -0
- package/dist/webhook-signature.js +74 -0
- package/dist/window-features.d.ts +28 -0
- package/dist/window-features.d.ts.map +1 -0
- package/dist/window-features.js +55 -0
- package/package.json +63 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** Andco-owned authorization for Company-funded, operator-bound charges. */
|
|
3
|
+
export declare const AUTOMATIC_CHARGE_TYPE = "https://api.andco.cl/authorization-details/automatic-charge";
|
|
4
|
+
export declare const AUTOMATIC_CHARGE_ACTIONS: readonly ["read", "create_deposit_intent", "read_deposit_intents", "create_automatic_charge", "execute_automatic_charge", "read_automatic_charges", "close"];
|
|
5
|
+
/** Cumulative configuration only: this demo does not calculate or enforce consumption. */
|
|
6
|
+
export declare const AutomaticChargeBudgetSchema: v.StrictObjectSchema<{
|
|
7
|
+
readonly amount: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
8
|
+
readonly interval: v.StrictObjectSchema<{
|
|
9
|
+
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 365, undefined>]>;
|
|
10
|
+
readonly unit: v.PicklistSchema<["days", "months", "years"], undefined>;
|
|
11
|
+
}, undefined>;
|
|
12
|
+
readonly time_zone: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, undefined>]>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
/** Public RAR request; Company identity is supplied only through OAuth org_id. */
|
|
15
|
+
export declare const AutomaticChargeAuthorizationSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
16
|
+
readonly type: v.LiteralSchema<"https://api.andco.cl/authorization-details/automatic-charge", undefined>;
|
|
17
|
+
readonly actions: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["read", "create_deposit_intent", "read_deposit_intents", "create_automatic_charge", "execute_automatic_charge", "read_automatic_charges", "close"], undefined>, undefined>, v.MinLengthAction<("read" | "create_deposit_intent" | "read_deposit_intents" | "create_automatic_charge" | "execute_automatic_charge" | "read_automatic_charges" | "close")[], 1, undefined>, v.CheckAction<("read" | "create_deposit_intent" | "read_deposit_intents" | "create_automatic_charge" | "execute_automatic_charge" | "read_automatic_charges" | "close")[], undefined>]>;
|
|
18
|
+
readonly locations: v.TupleSchema<[v.LiteralSchema<"https://api.andco.cl", undefined>], undefined>;
|
|
19
|
+
readonly sources: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.MaxLengthAction<string[], 100, undefined>, v.CheckAction<string[], undefined>]>, undefined>;
|
|
20
|
+
readonly beneficiaries: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.MaxLengthAction<string[], 100, undefined>, v.CheckAction<string[], undefined>]>, undefined>;
|
|
21
|
+
readonly selection: v.OptionalSchema<v.StrictObjectSchema<{
|
|
22
|
+
readonly min: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
|
|
23
|
+
readonly max: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
|
|
24
|
+
}, undefined>, undefined>;
|
|
25
|
+
readonly transaction: v.StrictObjectSchema<{
|
|
26
|
+
readonly currency: v.LiteralSchema<"CLP", undefined>;
|
|
27
|
+
readonly minimum: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
28
|
+
readonly maximum: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
29
|
+
}, undefined>;
|
|
30
|
+
readonly budget: v.OptionalSchema<v.NullableSchema<v.StrictObjectSchema<{
|
|
31
|
+
readonly amount: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
32
|
+
readonly interval: v.StrictObjectSchema<{
|
|
33
|
+
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 365, undefined>]>;
|
|
34
|
+
readonly unit: v.PicklistSchema<["days", "months", "years"], undefined>;
|
|
35
|
+
}, undefined>;
|
|
36
|
+
readonly time_zone: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, undefined>]>;
|
|
37
|
+
}, undefined>, undefined>, undefined>;
|
|
38
|
+
readonly account_binding: v.OptionalSchema<v.StrictObjectSchema<{
|
|
39
|
+
readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
40
|
+
readonly name: v.StrictObjectSchema<{
|
|
41
|
+
readonly suggested: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
|
|
42
|
+
readonly editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
43
|
+
}, undefined>;
|
|
44
|
+
}, undefined>, undefined>;
|
|
45
|
+
}, undefined>, v.CheckAction<{
|
|
46
|
+
type: "https://api.andco.cl/authorization-details/automatic-charge";
|
|
47
|
+
actions: ("read" | "create_deposit_intent" | "read_deposit_intents" | "create_automatic_charge" | "execute_automatic_charge" | "read_automatic_charges" | "close")[];
|
|
48
|
+
locations: ["https://api.andco.cl"];
|
|
49
|
+
sources?: string[] | undefined;
|
|
50
|
+
beneficiaries?: string[] | undefined;
|
|
51
|
+
selection?: {
|
|
52
|
+
min?: number | undefined;
|
|
53
|
+
max?: number | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
transaction: {
|
|
56
|
+
currency: "CLP";
|
|
57
|
+
minimum: string;
|
|
58
|
+
maximum: string;
|
|
59
|
+
};
|
|
60
|
+
budget?: {
|
|
61
|
+
amount: string;
|
|
62
|
+
interval: {
|
|
63
|
+
count: number;
|
|
64
|
+
unit: "days" | "months" | "years";
|
|
65
|
+
};
|
|
66
|
+
time_zone: string;
|
|
67
|
+
} | null | undefined;
|
|
68
|
+
account_binding?: {
|
|
69
|
+
key: string;
|
|
70
|
+
name: {
|
|
71
|
+
suggested: string;
|
|
72
|
+
editable: boolean;
|
|
73
|
+
};
|
|
74
|
+
} | undefined;
|
|
75
|
+
}, undefined>, v.CheckAction<{
|
|
76
|
+
type: "https://api.andco.cl/authorization-details/automatic-charge";
|
|
77
|
+
actions: ("read" | "create_deposit_intent" | "read_deposit_intents" | "create_automatic_charge" | "execute_automatic_charge" | "read_automatic_charges" | "close")[];
|
|
78
|
+
locations: ["https://api.andco.cl"];
|
|
79
|
+
sources?: string[] | undefined;
|
|
80
|
+
beneficiaries?: string[] | undefined;
|
|
81
|
+
selection?: {
|
|
82
|
+
min?: number | undefined;
|
|
83
|
+
max?: number | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
transaction: {
|
|
86
|
+
currency: "CLP";
|
|
87
|
+
minimum: string;
|
|
88
|
+
maximum: string;
|
|
89
|
+
};
|
|
90
|
+
budget?: {
|
|
91
|
+
amount: string;
|
|
92
|
+
interval: {
|
|
93
|
+
count: number;
|
|
94
|
+
unit: "days" | "months" | "years";
|
|
95
|
+
};
|
|
96
|
+
time_zone: string;
|
|
97
|
+
} | null | undefined;
|
|
98
|
+
account_binding?: {
|
|
99
|
+
key: string;
|
|
100
|
+
name: {
|
|
101
|
+
suggested: string;
|
|
102
|
+
editable: boolean;
|
|
103
|
+
};
|
|
104
|
+
} | undefined;
|
|
105
|
+
}, undefined>, v.CheckAction<{
|
|
106
|
+
type: "https://api.andco.cl/authorization-details/automatic-charge";
|
|
107
|
+
actions: ("read" | "create_deposit_intent" | "read_deposit_intents" | "create_automatic_charge" | "execute_automatic_charge" | "read_automatic_charges" | "close")[];
|
|
108
|
+
locations: ["https://api.andco.cl"];
|
|
109
|
+
sources?: string[] | undefined;
|
|
110
|
+
beneficiaries?: string[] | undefined;
|
|
111
|
+
selection?: {
|
|
112
|
+
min?: number | undefined;
|
|
113
|
+
max?: number | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
transaction: {
|
|
116
|
+
currency: "CLP";
|
|
117
|
+
minimum: string;
|
|
118
|
+
maximum: string;
|
|
119
|
+
};
|
|
120
|
+
budget?: {
|
|
121
|
+
amount: string;
|
|
122
|
+
interval: {
|
|
123
|
+
count: number;
|
|
124
|
+
unit: "days" | "months" | "years";
|
|
125
|
+
};
|
|
126
|
+
time_zone: string;
|
|
127
|
+
} | null | undefined;
|
|
128
|
+
account_binding?: {
|
|
129
|
+
key: string;
|
|
130
|
+
name: {
|
|
131
|
+
suggested: string;
|
|
132
|
+
editable: boolean;
|
|
133
|
+
};
|
|
134
|
+
} | undefined;
|
|
135
|
+
}, undefined>, v.CheckAction<{
|
|
136
|
+
type: "https://api.andco.cl/authorization-details/automatic-charge";
|
|
137
|
+
actions: ("read" | "create_deposit_intent" | "read_deposit_intents" | "create_automatic_charge" | "execute_automatic_charge" | "read_automatic_charges" | "close")[];
|
|
138
|
+
locations: ["https://api.andco.cl"];
|
|
139
|
+
sources?: string[] | undefined;
|
|
140
|
+
beneficiaries?: string[] | undefined;
|
|
141
|
+
selection?: {
|
|
142
|
+
min?: number | undefined;
|
|
143
|
+
max?: number | undefined;
|
|
144
|
+
} | undefined;
|
|
145
|
+
transaction: {
|
|
146
|
+
currency: "CLP";
|
|
147
|
+
minimum: string;
|
|
148
|
+
maximum: string;
|
|
149
|
+
};
|
|
150
|
+
budget?: {
|
|
151
|
+
amount: string;
|
|
152
|
+
interval: {
|
|
153
|
+
count: number;
|
|
154
|
+
unit: "days" | "months" | "years";
|
|
155
|
+
};
|
|
156
|
+
time_zone: string;
|
|
157
|
+
} | null | undefined;
|
|
158
|
+
account_binding?: {
|
|
159
|
+
key: string;
|
|
160
|
+
name: {
|
|
161
|
+
suggested: string;
|
|
162
|
+
editable: boolean;
|
|
163
|
+
};
|
|
164
|
+
} | undefined;
|
|
165
|
+
}, undefined>]>;
|
|
166
|
+
export type AutomaticChargeAuthorization = v.InferOutput<typeof AutomaticChargeAuthorizationSchema>;
|
|
167
|
+
/** Validates a request without silently clamping account or money restrictions. */
|
|
168
|
+
export declare function parseAutomaticChargeAuthorization(value: unknown): AutomaticChargeAuthorization;
|
|
169
|
+
/** Catalog schema shared with Andco seeds; relational ownership and bounds are enforced separately in SQL. */
|
|
170
|
+
export declare const AUTOMATIC_CHARGE_REQUEST_JSON_SCHEMA: {
|
|
171
|
+
$schema: string;
|
|
172
|
+
type: string;
|
|
173
|
+
additionalProperties: boolean;
|
|
174
|
+
required: string[];
|
|
175
|
+
properties: {
|
|
176
|
+
type: {
|
|
177
|
+
const: string;
|
|
178
|
+
};
|
|
179
|
+
actions: {
|
|
180
|
+
type: string;
|
|
181
|
+
minItems: number;
|
|
182
|
+
uniqueItems: boolean;
|
|
183
|
+
items: {
|
|
184
|
+
enum: readonly ["read", "create_deposit_intent", "read_deposit_intents", "create_automatic_charge", "execute_automatic_charge", "read_automatic_charges", "close"];
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
locations: {
|
|
188
|
+
type: string;
|
|
189
|
+
minItems: number;
|
|
190
|
+
maxItems: number;
|
|
191
|
+
items: {
|
|
192
|
+
const: string;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
sources: {
|
|
196
|
+
type: string;
|
|
197
|
+
maxItems: number;
|
|
198
|
+
uniqueItems: boolean;
|
|
199
|
+
items: {
|
|
200
|
+
type: string;
|
|
201
|
+
pattern: string;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
beneficiaries: {
|
|
205
|
+
type: string;
|
|
206
|
+
maxItems: number;
|
|
207
|
+
uniqueItems: boolean;
|
|
208
|
+
items: {
|
|
209
|
+
type: string;
|
|
210
|
+
pattern: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
selection: {
|
|
214
|
+
type: string;
|
|
215
|
+
additionalProperties: boolean;
|
|
216
|
+
properties: {
|
|
217
|
+
min: {
|
|
218
|
+
type: string;
|
|
219
|
+
minimum: number;
|
|
220
|
+
maximum: number;
|
|
221
|
+
};
|
|
222
|
+
max: {
|
|
223
|
+
type: string;
|
|
224
|
+
minimum: number;
|
|
225
|
+
maximum: number;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
transaction: {
|
|
230
|
+
type: string;
|
|
231
|
+
additionalProperties: boolean;
|
|
232
|
+
required: string[];
|
|
233
|
+
properties: {
|
|
234
|
+
currency: {
|
|
235
|
+
const: string;
|
|
236
|
+
};
|
|
237
|
+
minimum: {
|
|
238
|
+
type: string;
|
|
239
|
+
pattern: string;
|
|
240
|
+
};
|
|
241
|
+
maximum: {
|
|
242
|
+
type: string;
|
|
243
|
+
pattern: string;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
budget: {
|
|
248
|
+
anyOf: ({
|
|
249
|
+
type: string;
|
|
250
|
+
additionalProperties?: undefined;
|
|
251
|
+
required?: undefined;
|
|
252
|
+
properties?: undefined;
|
|
253
|
+
} | {
|
|
254
|
+
type: string;
|
|
255
|
+
additionalProperties: boolean;
|
|
256
|
+
required: string[];
|
|
257
|
+
properties: {
|
|
258
|
+
amount: {
|
|
259
|
+
type: string;
|
|
260
|
+
pattern: string;
|
|
261
|
+
};
|
|
262
|
+
time_zone: {
|
|
263
|
+
type: string;
|
|
264
|
+
minLength: number;
|
|
265
|
+
};
|
|
266
|
+
interval: {
|
|
267
|
+
type: string;
|
|
268
|
+
additionalProperties: boolean;
|
|
269
|
+
required: string[];
|
|
270
|
+
properties: {
|
|
271
|
+
count: {
|
|
272
|
+
type: string;
|
|
273
|
+
minimum: number;
|
|
274
|
+
maximum: number;
|
|
275
|
+
};
|
|
276
|
+
unit: {
|
|
277
|
+
enum: string[];
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
})[];
|
|
283
|
+
};
|
|
284
|
+
account_binding: {
|
|
285
|
+
type: string;
|
|
286
|
+
additionalProperties: boolean;
|
|
287
|
+
required: string[];
|
|
288
|
+
properties: {
|
|
289
|
+
key: {
|
|
290
|
+
type: string;
|
|
291
|
+
pattern: string;
|
|
292
|
+
};
|
|
293
|
+
name: {
|
|
294
|
+
type: string;
|
|
295
|
+
additionalProperties: boolean;
|
|
296
|
+
required: string[];
|
|
297
|
+
properties: {
|
|
298
|
+
suggested: {
|
|
299
|
+
type: string;
|
|
300
|
+
minLength: number;
|
|
301
|
+
maxLength: number;
|
|
302
|
+
pattern: string;
|
|
303
|
+
};
|
|
304
|
+
editable: {
|
|
305
|
+
type: string;
|
|
306
|
+
default: boolean;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
//# sourceMappingURL=automatic-charge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automatic-charge.d.ts","sourceRoot":"","sources":["../src/automatic-charge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,gEAAgE,CAAC;AACnG,eAAO,MAAM,wBAAwB,8JAQ3B,CAAC;AAsBX,0FAA0F;AAC1F,eAAO,MAAM,2BAA2B;;;;;;;aAOtC,CAAC;AAEH,kFAAkF;AAClF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAgC9C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAEpG,mFAAmF;AACnF,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,CAE9F;AAUD,8GAA8G;AAC9G,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DhD,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** Andco-owned authorization for Company-funded, operator-bound charges. */
|
|
3
|
+
export const AUTOMATIC_CHARGE_TYPE = "https://api.andco.cl/authorization-details/automatic-charge";
|
|
4
|
+
export const AUTOMATIC_CHARGE_ACTIONS = [
|
|
5
|
+
"read",
|
|
6
|
+
"create_deposit_intent",
|
|
7
|
+
"read_deposit_intents",
|
|
8
|
+
"create_automatic_charge",
|
|
9
|
+
"execute_automatic_charge",
|
|
10
|
+
"read_automatic_charges",
|
|
11
|
+
"close",
|
|
12
|
+
];
|
|
13
|
+
const UUID_PATTERN = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$";
|
|
14
|
+
const MONEY_PATTERN = "^[1-9][0-9]{0,14}$";
|
|
15
|
+
const money = /* @__PURE__ */ v.pipe(v.string(), v.regex(new RegExp(MONEY_PATTERN)));
|
|
16
|
+
const accounts = /* @__PURE__ */ v.pipe(v.array(v.pipe(v.string(), v.regex(new RegExp(UUID_PATTERN)))), v.maxLength(100), v.check((values) => new Set(values).size === values.length));
|
|
17
|
+
const count = /* @__PURE__ */ v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(100));
|
|
18
|
+
const timeZone = /* @__PURE__ */ v.pipe(v.string(), v.check((value) => {
|
|
19
|
+
try {
|
|
20
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
/** Cumulative configuration only: this demo does not calculate or enforce consumption. */
|
|
28
|
+
export const AutomaticChargeBudgetSchema = /* @__PURE__ */ v.strictObject({
|
|
29
|
+
amount: money,
|
|
30
|
+
interval: v.strictObject({
|
|
31
|
+
count: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(365)),
|
|
32
|
+
unit: v.picklist(["days", "months", "years"]),
|
|
33
|
+
}),
|
|
34
|
+
time_zone: timeZone,
|
|
35
|
+
});
|
|
36
|
+
/** Public RAR request; Company identity is supplied only through OAuth org_id. */
|
|
37
|
+
export const AutomaticChargeAuthorizationSchema = /* @__PURE__ */ v.pipe(v.strictObject({
|
|
38
|
+
type: v.literal(AUTOMATIC_CHARGE_TYPE),
|
|
39
|
+
actions: v.pipe(v.array(v.picklist(AUTOMATIC_CHARGE_ACTIONS)), v.minLength(1), v.check((a) => new Set(a).size === a.length)),
|
|
40
|
+
locations: v.tuple([v.literal("https://api.andco.cl")]),
|
|
41
|
+
sources: v.optional(accounts),
|
|
42
|
+
beneficiaries: v.optional(accounts),
|
|
43
|
+
selection: v.optional(v.strictObject({ min: v.optional(count), max: v.optional(count) })),
|
|
44
|
+
transaction: v.strictObject({ currency: v.literal("CLP"), minimum: money, maximum: money }),
|
|
45
|
+
budget: v.optional(v.nullable(AutomaticChargeBudgetSchema)),
|
|
46
|
+
account_binding: v.optional(v.strictObject({
|
|
47
|
+
key: v.pipe(v.string(), v.regex(/^[a-z][a-z0-9_-]{0,63}$/)),
|
|
48
|
+
name: v.strictObject({
|
|
49
|
+
suggested: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80)),
|
|
50
|
+
editable: v.optional(v.boolean(), false),
|
|
51
|
+
}),
|
|
52
|
+
})),
|
|
53
|
+
}), v.check((d) => BigInt(d.transaction.minimum) >= 1000n && BigInt(d.transaction.minimum) <= BigInt(d.transaction.maximum)), v.check((d) => (d.selection?.min ?? 1) <= (d.selection?.max ?? 1)), v.check((d) => !d.sources?.length || d.sources.length >= (d.selection?.min ?? 1)), v.check((d) => !d.account_binding || (!d.sources?.length && (d.selection?.min ?? 1) === 1 && (d.selection?.max ?? 1) === 1)));
|
|
54
|
+
/** Validates a request without silently clamping account or money restrictions. */
|
|
55
|
+
export function parseAutomaticChargeAuthorization(value) {
|
|
56
|
+
return v.parse(AutomaticChargeAuthorizationSchema, value);
|
|
57
|
+
}
|
|
58
|
+
const moneyJson = { type: "string", pattern: MONEY_PATTERN };
|
|
59
|
+
const accountJson = {
|
|
60
|
+
type: "array",
|
|
61
|
+
maxItems: 100,
|
|
62
|
+
uniqueItems: true,
|
|
63
|
+
items: { type: "string", pattern: UUID_PATTERN },
|
|
64
|
+
};
|
|
65
|
+
const countJson = { type: "integer", minimum: 1, maximum: 100 };
|
|
66
|
+
/** Catalog schema shared with Andco seeds; relational ownership and bounds are enforced separately in SQL. */
|
|
67
|
+
export const AUTOMATIC_CHARGE_REQUEST_JSON_SCHEMA = {
|
|
68
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
69
|
+
type: "object",
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
required: ["type", "actions", "locations", "transaction"],
|
|
72
|
+
properties: {
|
|
73
|
+
type: { const: AUTOMATIC_CHARGE_TYPE },
|
|
74
|
+
actions: { type: "array", minItems: 1, uniqueItems: true, items: { enum: AUTOMATIC_CHARGE_ACTIONS } },
|
|
75
|
+
locations: { type: "array", minItems: 1, maxItems: 1, items: { const: "https://api.andco.cl" } },
|
|
76
|
+
sources: accountJson,
|
|
77
|
+
beneficiaries: accountJson,
|
|
78
|
+
selection: { type: "object", additionalProperties: false, properties: { min: countJson, max: countJson } },
|
|
79
|
+
transaction: {
|
|
80
|
+
type: "object",
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
required: ["currency", "minimum", "maximum"],
|
|
83
|
+
properties: { currency: { const: "CLP" }, minimum: moneyJson, maximum: moneyJson },
|
|
84
|
+
},
|
|
85
|
+
budget: {
|
|
86
|
+
anyOf: [
|
|
87
|
+
{ type: "null" },
|
|
88
|
+
{
|
|
89
|
+
type: "object",
|
|
90
|
+
additionalProperties: false,
|
|
91
|
+
required: ["amount", "interval", "time_zone"],
|
|
92
|
+
properties: {
|
|
93
|
+
amount: moneyJson,
|
|
94
|
+
time_zone: { type: "string", minLength: 1 },
|
|
95
|
+
interval: {
|
|
96
|
+
type: "object",
|
|
97
|
+
additionalProperties: false,
|
|
98
|
+
required: ["count", "unit"],
|
|
99
|
+
properties: {
|
|
100
|
+
count: { type: "integer", minimum: 1, maximum: 365 },
|
|
101
|
+
unit: { enum: ["days", "months", "years"] },
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
account_binding: {
|
|
109
|
+
type: "object",
|
|
110
|
+
additionalProperties: false,
|
|
111
|
+
required: ["key", "name"],
|
|
112
|
+
properties: {
|
|
113
|
+
key: { type: "string", pattern: "^[a-z][a-z0-9_-]{0,63}$" },
|
|
114
|
+
name: {
|
|
115
|
+
type: "object",
|
|
116
|
+
additionalProperties: false,
|
|
117
|
+
required: ["suggested"],
|
|
118
|
+
properties: {
|
|
119
|
+
suggested: { type: "string", minLength: 1, maxLength: 80, pattern: "\\S" },
|
|
120
|
+
editable: { type: "boolean", default: false },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** Provider-owned bank account actions. `close` ends this application's deposit collection, never the bank account. */
|
|
3
|
+
export declare const BANK_ACCOUNT_AUTHORIZATION_ACTIONS: readonly ["read", "read_movements", "create_deposit_intent", "read_deposit_intents", "create_withdrawal_intent", "execute_withdrawal", "read_withdrawal_intents", "close"];
|
|
4
|
+
export declare const BankAccountAuthorizationActionSchema: v.PicklistSchema<readonly ["read", "read_movements", "create_deposit_intent", "read_deposit_intents", "create_withdrawal_intent", "execute_withdrawal", "read_withdrawal_intents", "close"], undefined>;
|
|
5
|
+
export type BankAccountAuthorizationAction = v.InferOutput<typeof BankAccountAuthorizationActionSchema>;
|
|
6
|
+
//# sourceMappingURL=bank-account-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bank-account-authorization.d.ts","sourceRoot":"","sources":["../src/bank-account-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,uHAAuH;AACvH,eAAO,MAAM,kCAAkC,4KASrC,CAAC;AACX,eAAO,MAAM,oCAAoC,yMAAiE,CAAC;AACnH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** Provider-owned bank account actions. `close` ends this application's deposit collection, never the bank account. */
|
|
3
|
+
export const BANK_ACCOUNT_AUTHORIZATION_ACTIONS = [
|
|
4
|
+
"read",
|
|
5
|
+
"read_movements",
|
|
6
|
+
"create_deposit_intent",
|
|
7
|
+
"read_deposit_intents",
|
|
8
|
+
"create_withdrawal_intent",
|
|
9
|
+
"execute_withdrawal",
|
|
10
|
+
"read_withdrawal_intents",
|
|
11
|
+
"close",
|
|
12
|
+
];
|
|
13
|
+
export const BankAccountAuthorizationActionSchema = /* @__PURE__ */ v.picklist(BANK_ACCOUNT_AUTHORIZATION_ACTIONS);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Origin and presentation correlation encoded in a browser callback state value. */
|
|
2
|
+
export type AndCoCallbackState = {
|
|
3
|
+
openerOrigin: string;
|
|
4
|
+
presentationId: string;
|
|
5
|
+
};
|
|
6
|
+
/** Creates callback state bound to the exact origin that opened a presentation. */
|
|
7
|
+
export declare function callbackStateCreate(openerOrigin: string, presentationId?: string): string;
|
|
8
|
+
/** Parses callback state, returning null for malformed identifiers or origins. */
|
|
9
|
+
export declare function CALLBACK_STATE_FROM(value: string): AndCoCallbackState | null;
|
|
10
|
+
//# sourceMappingURL=callback-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback-state.d.ts","sourceRoot":"","sources":["../src/callback-state.ts"],"names":[],"mappings":"AAKA,qFAAqF;AACrF,MAAM,MAAM,kBAAkB,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,SAAgB,GAAG,MAAM,CAMhG;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAY5E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { AndCoPresentationIdSchema } from "./messages/base.js";
|
|
3
|
+
import { SafeURL } from "./urls.js";
|
|
4
|
+
import { BASE64_DECODE, BASE64_ENCODE, RANDOM_UUID } from "./utils.js";
|
|
5
|
+
/** Creates callback state bound to the exact origin that opened a presentation. */
|
|
6
|
+
export function callbackStateCreate(openerOrigin, presentationId = RANDOM_UUID()) {
|
|
7
|
+
if (!v.safeParse(AndCoPresentationIdSchema, presentationId).success) {
|
|
8
|
+
throw new TypeError("Invalid AndCo presentation identifier");
|
|
9
|
+
}
|
|
10
|
+
const origin = new SafeURL(openerOrigin).origin;
|
|
11
|
+
return `${BASE64_ENCODE(origin)}.${presentationId}`;
|
|
12
|
+
}
|
|
13
|
+
/** Parses callback state, returning null for malformed identifiers or origins. */
|
|
14
|
+
export function CALLBACK_STATE_FROM(value) {
|
|
15
|
+
const separator = value.indexOf(".");
|
|
16
|
+
const presentationId = value.slice(separator + 1);
|
|
17
|
+
if (separator < 1 || separator === value.length - 1)
|
|
18
|
+
return null;
|
|
19
|
+
if (!v.safeParse(AndCoPresentationIdSchema, presentationId).success)
|
|
20
|
+
return null;
|
|
21
|
+
try {
|
|
22
|
+
const openerOriginValue = BASE64_DECODE(value.slice(0, separator));
|
|
23
|
+
return { openerOrigin: new SafeURL(openerOriginValue).origin, presentationId };
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AndCoAuthorizationPreparation } from "./authorization-preparation.js";
|
|
2
|
+
type PreparedConsentScope = Extract<AndCoAuthorizationPreparation, {
|
|
3
|
+
status: "consent_required";
|
|
4
|
+
}>["scopes"][number];
|
|
5
|
+
/**
|
|
6
|
+
* Whether a Scope's checkbox may not be cleared: the Client's Scope Policy requires it, or an
|
|
7
|
+
* active OAuth Grant on this Connection already covers it and clearing the box would promise a
|
|
8
|
+
* revocation the system does not perform (ADR 0040). Exported so every consent surface -- web and
|
|
9
|
+
* the three native Hosts -- reads the same fact instead of re-deriving it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ANDCO_CONSENT_SCOPE_IS_LOCKED(scope: Pick<PreparedConsentScope, "mode" | "grantedAt">): boolean;
|
|
12
|
+
/** Localized Platform label, falling back to provider-owned copy for custom scopes. */
|
|
13
|
+
export declare function ANDCO_CONSENT_SCOPES(consent: Extract<AndCoAuthorizationPreparation, {
|
|
14
|
+
status: "consent_required";
|
|
15
|
+
}>, locale?: "es" | "en" | "pt"): {
|
|
16
|
+
title: string;
|
|
17
|
+
description: string | undefined;
|
|
18
|
+
required: boolean;
|
|
19
|
+
default: boolean;
|
|
20
|
+
initial: boolean;
|
|
21
|
+
locked: boolean;
|
|
22
|
+
resourceServerId?: string | undefined;
|
|
23
|
+
resourceServerName?: string | undefined;
|
|
24
|
+
scopeDescription?: string | undefined;
|
|
25
|
+
grantedAt: string | null;
|
|
26
|
+
connectionHasPriorGrant: boolean;
|
|
27
|
+
scope: string;
|
|
28
|
+
mode: "optional" | "default" | "required";
|
|
29
|
+
}[];
|
|
30
|
+
/** Permission row displayed by native consent controls. */
|
|
31
|
+
export type AndCoConsentScope = ReturnType<typeof ANDCO_CONSENT_SCOPES>[number];
|
|
32
|
+
/** Initializes the starting selection: required/default permissions, plus anything already granted. */
|
|
33
|
+
export declare function ANDCO_CONSENT_INITIAL_SCOPES(consent: Extract<AndCoAuthorizationPreparation, {
|
|
34
|
+
status: "consent_required";
|
|
35
|
+
}>): Set<string>;
|
|
36
|
+
/** Whether the in-progress selection is complete enough to submit; the server still authorizes on submit. */
|
|
37
|
+
export declare function ANDCO_CONSENT_CAN_SUBMIT(consent: Extract<AndCoAuthorizationPreparation, {
|
|
38
|
+
status: "consent_required";
|
|
39
|
+
}>, scopes: ReadonlySet<string>, bankAccountId?: string, chargeSourceIds?: readonly string[]): boolean;
|
|
40
|
+
/** Presents the same charge restrictions in both native renderers. */
|
|
41
|
+
export declare function ANDCO_CHARGE_SUMMARY(charge: NonNullable<Extract<AndCoAuthorizationPreparation, {
|
|
42
|
+
status: "consent_required";
|
|
43
|
+
}>["chargeAuthorization"]>, locale?: "es" | "en" | "pt"): {
|
|
44
|
+
label: string;
|
|
45
|
+
value: string;
|
|
46
|
+
}[];
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=consent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAgBpF,KAAK,oBAAoB,GAAG,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAErH;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,WAAW,CAAC,WAEpG;AAED,uFAAuF;AACvF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,EAC/E,MAAM,GAAE,IAAI,GAAG,IAAI,GAAG,IAAW;;;;;;;;;;;;;;IAsBlC;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,uGAAuG;AACvG,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,eAOhF;AAED,6GAA6G;AAC7G,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,EAC/E,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAC3B,aAAa,CAAC,EAAE,MAAM,EACtB,eAAe,GAAE,SAAS,MAAM,EAAO,WAexC;AAID,sEAAsE;AACtE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,6BAA6B,EAAE;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC,EAClH,MAAM,GAAE,IAAI,GAAG,IAAI,GAAG,IAAW;;;IAiDlC"}
|