@andco/protocol 0.0.3 → 0.0.5
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 +1 -1
- package/README.md +51 -3
- package/dist/api-errors.d.ts +114 -0
- package/dist/api-errors.d.ts.map +1 -0
- package/dist/api-errors.js +116 -0
- package/dist/authorization-preparation.d.ts +52 -543
- package/dist/authorization-preparation.d.ts.map +1 -1
- package/dist/authorization-preparation.js +19 -42
- package/dist/authorization.d.ts +64 -22
- package/dist/authorization.d.ts.map +1 -1
- package/dist/authorization.js +136 -55
- package/dist/consent.d.ts +5 -8
- package/dist/consent.d.ts.map +1 -1
- package/dist/consent.js +5 -62
- package/dist/constants.d.ts +19 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -3
- package/dist/errors.d.ts +154 -58
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +174 -57
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/intent-input.d.ts +1022 -288
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +284 -40
- package/dist/messages/error.d.ts +1 -2
- package/dist/messages/error.d.ts.map +1 -1
- package/dist/messages/error.js +5 -2
- package/dist/messages/index.d.ts +1 -1
- package/dist/native-copy.d.ts +23 -2
- package/dist/native-copy.d.ts.map +1 -1
- package/dist/native-copy.js +65 -117
- package/dist/native-intent.d.ts +126 -75
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +140 -48
- package/dist/rar/account-matchers.d.ts +579 -0
- package/dist/rar/account-matchers.d.ts.map +1 -0
- package/dist/rar/account-matchers.js +480 -0
- package/dist/rar/bank.d.ts +1549 -0
- package/dist/rar/bank.d.ts.map +1 -0
- package/dist/rar/bank.js +379 -0
- package/dist/rar/catalog.d.ts +1155 -0
- package/dist/rar/catalog.d.ts.map +1 -0
- package/dist/rar/catalog.js +175 -0
- package/dist/rar/detail.d.ts +39 -0
- package/dist/rar/detail.d.ts.map +1 -0
- package/dist/rar/detail.js +44 -0
- package/dist/rar/index.d.ts +9 -0
- package/dist/rar/index.d.ts.map +1 -0
- package/dist/rar/index.js +8 -0
- package/dist/rar/money.d.ts +58 -0
- package/dist/rar/money.d.ts.map +1 -0
- package/dist/rar/money.js +61 -0
- package/dist/rar/project-users.d.ts +43 -0
- package/dist/rar/project-users.d.ts.map +1 -0
- package/dist/rar/project-users.js +63 -0
- package/dist/rar/subject-data.d.ts +170 -0
- package/dist/rar/subject-data.d.ts.map +1 -0
- package/dist/rar/subject-data.js +127 -0
- package/dist/rar/subject.d.ts +166 -0
- package/dist/rar/subject.d.ts.map +1 -0
- package/dist/rar/subject.js +119 -0
- package/dist/scopes.d.ts +5 -30
- package/dist/scopes.d.ts.map +1 -1
- package/dist/scopes.js +0 -13
- package/dist/service-grants.d.ts +44 -0
- package/dist/service-grants.d.ts.map +1 -0
- package/dist/service-grants.js +45 -0
- package/dist/signing.d.ts +56 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +233 -0
- package/dist/transport/financial-events.d.ts +90 -35
- package/dist/transport/financial-events.d.ts.map +1 -1
- package/dist/transport/financial-events.js +7 -1
- package/dist/transport/generated/oauth-api.d.ts +932 -441
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/index.js +0 -1
- package/dist/transport/intents.d.ts +155 -23
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +192 -59
- package/dist/transport/rest.d.ts +19 -8
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/transport/rest.js +1 -1
- package/dist/urls.d.ts.map +1 -1
- package/dist/urls.js +1 -1
- package/dist/userinfo.d.ts +10 -1
- package/dist/userinfo.d.ts.map +1 -1
- package/dist/userinfo.js +10 -1
- package/dist/utils.d.ts +15 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +31 -0
- package/dist/webhooks.d.ts +154 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +249 -0
- package/package.json +21 -2
- package/dist/automatic-charge.d.ts +0 -314
- package/dist/automatic-charge.d.ts.map +0 -1
- package/dist/automatic-charge.js +0 -126
- package/dist/bank-account-authorization.d.ts +0 -6
- package/dist/bank-account-authorization.d.ts.map +0 -1
- package/dist/bank-account-authorization.js +0 -13
- package/dist/transport/webhooks.d.ts +0 -27
- package/dist/transport/webhooks.d.ts.map +0 -1
- package/dist/transport/webhooks.js +0 -68
- package/dist/webhook-input.d.ts +0 -22
- package/dist/webhook-input.d.ts.map +0 -1
- package/dist/webhook-input.js +0 -11
- package/dist/webhook-signature.d.ts +0 -54
- package/dist/webhook-signature.d.ts.map +0 -1
- package/dist/webhook-signature.js +0 -74
|
@@ -1,314 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/automatic-charge.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type AndCoWebhookSubscriptionCreate } from "../webhook-input.js";
|
|
2
|
-
import type { components } from "./generated/oauth-api.js";
|
|
3
|
-
import type { AndCoRestClient } from "./rest.js";
|
|
4
|
-
export type { AndCoWebhookSubscriptionCreate } from "../webhook-input.js";
|
|
5
|
-
export type AndCoWebhookSubscription = components["schemas"]["WebhookSubscription"];
|
|
6
|
-
export type AndCoWebhookDelivery = components["schemas"]["WebhookDelivery"];
|
|
7
|
-
export type AndCoWebhookAttempt = components["schemas"]["WebhookAttempt"];
|
|
8
|
-
export type AndCoWebhookDeliveryPage = components["schemas"]["WebhookDeliveryPage"];
|
|
9
|
-
export type AndCoWebhookAttemptPage = components["schemas"]["WebhookAttemptPage"];
|
|
10
|
-
type PageOptions = {
|
|
11
|
-
after?: string;
|
|
12
|
-
limit?: number;
|
|
13
|
-
};
|
|
14
|
-
/** Registers and inspects durable backend endpoints under the current exact Grant. */
|
|
15
|
-
export declare class AndCoWebhooksClient {
|
|
16
|
-
private readonly rest;
|
|
17
|
-
constructor(rest: AndCoRestClient);
|
|
18
|
-
create(input: AndCoWebhookSubscriptionCreate, options: {
|
|
19
|
-
idempotencyKey: string;
|
|
20
|
-
}): Promise<AndCoWebhookSubscription>;
|
|
21
|
-
get(subscriptionId: string): Promise<AndCoWebhookSubscription>;
|
|
22
|
-
getDeliveries(subscriptionId: string, options?: PageOptions): Promise<AndCoWebhookDeliveryPage>;
|
|
23
|
-
getAttempts(subscriptionId: string, deliveryId: string, options?: PageOptions): Promise<AndCoWebhookAttemptPage>;
|
|
24
|
-
/** Requeues a failed delivery; pending, in-flight, and acknowledged deliveries are unchanged. */
|
|
25
|
-
redrive(subscriptionId: string, deliveryId: string): Promise<AndCoWebhookDelivery>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/transport/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAgC,MAAM,qBAAqB,CAAC;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,YAAY,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAC;AAEpF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAC1E,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAC;AACpF,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAClF,KAAK,WAAW,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAStD,sFAAsF;AACtF,qBAAa,mBAAmB;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,eAAe;IAC5C,MAAM,CACjB,KAAK,EAAE,8BAA8B,EACrC,OAAO,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,GAClC,OAAO,CAAC,wBAAwB,CAAC;IAWvB,GAAG,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQ9D,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IASnG,WAAW,CACtB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,uBAAuB,CAAC;IAgBnC,iGAAiG;IACpF,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAUhG"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { safeParseWebhookSubscription } from "../webhook-input.js";
|
|
2
|
-
import { AndCoIntentError, ASSERT_INTENT_ID } from "./intents.js";
|
|
3
|
-
function validatePage(options) {
|
|
4
|
-
if ((options.after !== undefined && options.after.length > 128) ||
|
|
5
|
-
(options.limit !== undefined && (!Number.isInteger(options.limit) || options.limit < 1 || options.limit > 100)))
|
|
6
|
-
throw new TypeError("Invalid webhook page options");
|
|
7
|
-
}
|
|
8
|
-
/** Registers and inspects durable backend endpoints under the current exact Grant. */
|
|
9
|
-
export class AndCoWebhooksClient {
|
|
10
|
-
rest;
|
|
11
|
-
constructor(rest) {
|
|
12
|
-
this.rest = rest;
|
|
13
|
-
}
|
|
14
|
-
async create(input, options) {
|
|
15
|
-
const parsed = safeParseWebhookSubscription(input);
|
|
16
|
-
if (!parsed.success || !/^[A-Za-z0-9._:-]{1,128}$/.test(options.idempotencyKey))
|
|
17
|
-
throw new TypeError("Invalid webhook registration");
|
|
18
|
-
const { data, error, response } = await this.rest.POST("/event-subscriptions", {
|
|
19
|
-
body: parsed.output,
|
|
20
|
-
params: { header: { "Idempotency-Key": options.idempotencyKey } },
|
|
21
|
-
});
|
|
22
|
-
if (error || !data)
|
|
23
|
-
throw new AndCoIntentError(error?.error ?? "invalid_webhook_response", response.status);
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
async get(subscriptionId) {
|
|
27
|
-
ASSERT_INTENT_ID(subscriptionId);
|
|
28
|
-
const { data, error, response } = await this.rest.GET("/event-subscriptions/{subscription_id}", {
|
|
29
|
-
params: { path: { subscription_id: subscriptionId } },
|
|
30
|
-
});
|
|
31
|
-
if (error || !data)
|
|
32
|
-
throw new AndCoIntentError(error?.error ?? "invalid_webhook_response", response.status);
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
async getDeliveries(subscriptionId, options = {}) {
|
|
36
|
-
ASSERT_INTENT_ID(subscriptionId);
|
|
37
|
-
validatePage(options);
|
|
38
|
-
const { data, error, response } = await this.rest.GET("/event-subscriptions/{subscription_id}/deliveries", {
|
|
39
|
-
params: { path: { subscription_id: subscriptionId }, query: { after: options.after, limit: options.limit } },
|
|
40
|
-
});
|
|
41
|
-
if (error || !data)
|
|
42
|
-
throw new AndCoIntentError(error?.error ?? "invalid_webhook_response", response.status);
|
|
43
|
-
return data;
|
|
44
|
-
}
|
|
45
|
-
async getAttempts(subscriptionId, deliveryId, options = {}) {
|
|
46
|
-
ASSERT_INTENT_ID(subscriptionId);
|
|
47
|
-
ASSERT_INTENT_ID(deliveryId);
|
|
48
|
-
validatePage(options);
|
|
49
|
-
const { data, error, response } = await this.rest.GET("/event-subscriptions/{subscription_id}/deliveries/{delivery_id}/attempts", {
|
|
50
|
-
params: {
|
|
51
|
-
path: { subscription_id: subscriptionId, delivery_id: deliveryId },
|
|
52
|
-
query: { after: options.after, limit: options.limit },
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
if (error || !data)
|
|
56
|
-
throw new AndCoIntentError(error?.error ?? "invalid_webhook_response", response.status);
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
/** Requeues a failed delivery; pending, in-flight, and acknowledged deliveries are unchanged. */
|
|
60
|
-
async redrive(subscriptionId, deliveryId) {
|
|
61
|
-
ASSERT_INTENT_ID(subscriptionId);
|
|
62
|
-
ASSERT_INTENT_ID(deliveryId);
|
|
63
|
-
const { data, error, response } = await this.rest.POST("/event-subscriptions/{subscription_id}/deliveries/{delivery_id}/redrive", { params: { path: { subscription_id: subscriptionId, delivery_id: deliveryId } } });
|
|
64
|
-
if (error || !data)
|
|
65
|
-
throw new AndCoIntentError(error?.error ?? "invalid_webhook_response", response.status);
|
|
66
|
-
return data;
|
|
67
|
-
}
|
|
68
|
-
}
|
package/dist/webhook-input.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
/** Backend registration is limited to one explicit subject under the current Grant. */
|
|
3
|
-
export declare const WebhookSubscriptionCreateSchema: v.StrictObjectSchema<{
|
|
4
|
-
readonly subject: v.StrictObjectSchema<{
|
|
5
|
-
readonly kind: v.PicklistSchema<["intent", "account"], undefined>;
|
|
6
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
7
|
-
}, undefined>;
|
|
8
|
-
readonly url: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
9
|
-
readonly event_types: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MaxLengthAction<string, 128, undefined>]>, undefined>, v.MinLengthAction<string[], 1, undefined>, v.MaxLengthAction<string[], 32, undefined>, v.CheckAction<string[], undefined>]>;
|
|
10
|
-
readonly signing_secret: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
11
|
-
}, undefined>;
|
|
12
|
-
export type AndCoWebhookSubscriptionCreate = v.InferOutput<typeof WebhookSubscriptionCreateSchema>;
|
|
13
|
-
export declare function safeParseWebhookSubscription(input: unknown): v.SafeParseResult<v.StrictObjectSchema<{
|
|
14
|
-
readonly subject: v.StrictObjectSchema<{
|
|
15
|
-
readonly kind: v.PicklistSchema<["intent", "account"], undefined>;
|
|
16
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
17
|
-
}, undefined>;
|
|
18
|
-
readonly url: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
19
|
-
readonly event_types: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MaxLengthAction<string, 128, undefined>]>, undefined>, v.MinLengthAction<string[], 1, undefined>, v.MaxLengthAction<string[], 32, undefined>, v.CheckAction<string[], undefined>]>;
|
|
20
|
-
readonly signing_secret: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
21
|
-
}, undefined>>;
|
|
22
|
-
//# sourceMappingURL=webhook-input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-input.d.ts","sourceRoot":"","sources":["../src/webhook-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,uFAAuF;AACvF,eAAO,MAAM,+BAA+B;;;;;;;;aAU1C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACnG,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO;;;;;;;;eAE1D"}
|
package/dist/webhook-input.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
/** Backend registration is limited to one explicit subject under the current Grant. */
|
|
3
|
-
export const WebhookSubscriptionCreateSchema = /* @__PURE__ */ v.strictObject({
|
|
4
|
-
subject: v.strictObject({ kind: v.picklist(["intent", "account"]), id: v.pipe(v.string(), v.uuid()) }),
|
|
5
|
-
url: v.pipe(v.string(), v.url(), v.maxLength(2048)),
|
|
6
|
-
event_types: v.pipe(v.array(v.pipe(v.string(), v.regex(/^[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$/), v.maxLength(128))), v.minLength(1), v.maxLength(32), v.check((types) => new Set(types).size === types.length)),
|
|
7
|
-
signing_secret: v.pipe(v.string(), v.regex(/^[A-Za-z0-9_-]{43}$/)),
|
|
8
|
-
});
|
|
9
|
-
export function safeParseWebhookSubscription(input) {
|
|
10
|
-
return v.safeParse(WebhookSubscriptionCreateSchema, input);
|
|
11
|
-
}
|