@andco/protocol 0.0.15 → 0.1.0-ti.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/dist/authorization-preparation.d.ts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/intent-input.d.ts +67 -54
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +39 -23
- package/dist/intent-status.d.ts +5 -6
- package/dist/intent-status.d.ts.map +1 -1
- package/dist/intent-status.js +12 -7
- package/dist/miniapp-manifest.d.ts +2 -2
- package/dist/miniapp-manifest.js +1 -1
- package/dist/native-intent.d.ts +12 -12
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +7 -4
- package/dist/rar/account-matchers.d.ts +10 -10
- package/dist/rar/account-matchers.js +2 -2
- package/dist/rar/bank.d.ts +295 -23
- package/dist/rar/bank.d.ts.map +1 -1
- package/dist/rar/bank.js +54 -16
- package/dist/rar/catalog.d.ts +134 -9
- package/dist/rar/catalog.d.ts.map +1 -1
- package/dist/rar/catalog.js +6 -6
- package/dist/rar/json-schemas.generated.d.ts.map +1 -1
- package/dist/rar/json-schemas.generated.js +375 -7
- package/dist/rar/money.d.ts +1 -1
- package/dist/rar/money.js +1 -1
- package/dist/rar/subject-data.d.ts +1 -1
- package/dist/rar/subject-data.js +1 -1
- package/dist/rest/accounts.d.ts +69 -47
- package/dist/rest/accounts.d.ts.map +1 -1
- package/dist/rest/accounts.js +32 -22
- package/dist/rest/catalog.d.ts +3 -3
- package/dist/rest/catalog.js +2 -2
- package/dist/rest/contract.d.ts +581 -316
- package/dist/rest/contract.d.ts.map +1 -1
- package/dist/rest/contract.js +10 -6
- package/dist/rest/events.js +1 -1
- package/dist/rest/identity.d.ts +22 -22
- package/dist/rest/identity.d.ts.map +1 -1
- package/dist/rest/identity.js +4 -4
- package/dist/rest/intents.d.ts +301 -142
- package/dist/rest/intents.d.ts.map +1 -1
- package/dist/rest/intents.js +67 -53
- package/dist/rest/signatures.d.ts +19 -5
- package/dist/rest/signatures.d.ts.map +1 -1
- package/dist/rest/signatures.js +47 -5
- package/dist/rest/transfers.d.ts +738 -362
- package/dist/rest/transfers.d.ts.map +1 -1
- package/dist/rest/transfers.js +71 -44
- package/dist/signing.d.ts +6 -2
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +2 -1
- package/dist/transfer.d.ts +101 -65
- package/dist/transfer.d.ts.map +1 -1
- package/dist/transfer.js +69 -43
- package/dist/transport/financial-events.d.ts +65 -14
- package/dist/transport/financial-events.d.ts.map +1 -1
- package/dist/transport/financial-events.js +34 -0
- package/dist/transport/generated/oauth-api.d.ts +384 -110
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/intents.d.ts +6 -6
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/rest.d.ts +9 -8
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/transport/rest.js +1 -1
- package/package.json +1 -1
package/dist/rest/accounts.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ declare const InvalidCursor_base: (abstract new (data: {}, message?: string, hin
|
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
119
|
/**
|
|
120
|
-
* The `after` of the
|
|
120
|
+
* The `after` of the movements walk is not the cursor AndCo issued for the next page. The
|
|
121
121
|
* AndCo's cursor travels untouched: take it from `pageInfo.endCursor` and nothing else.
|
|
122
122
|
*/
|
|
123
123
|
export declare class InvalidCursor extends /* @__PURE__ */ InvalidCursor_base {
|
|
@@ -131,7 +131,7 @@ export declare const BankAccount: v.StrictObjectSchema<{
|
|
|
131
131
|
readonly number: v.StringSchema<undefined>;
|
|
132
132
|
readonly type: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "Null while the balance projection does not know the account yet.">]>;
|
|
133
133
|
readonly currency: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "Null while the balance projection does not know the account yet.">]>;
|
|
134
|
-
readonly balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The
|
|
134
|
+
readonly balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The balance AndCo maintains for the account, as a decimal string, never a number. It is what the account holds after its last movement; funds on hold are not subtracted from it. Null while AndCo does not know the account's balance yet, for example right after it is opened, and null when the Grant lacks `read_balance`; a listing never fails for it and never makes up a zero.">]>;
|
|
135
135
|
}, undefined>;
|
|
136
136
|
/** One of the subject's personal digital accounts. */
|
|
137
137
|
export type BankAccount = v.InferOutput<typeof BankAccount>;
|
|
@@ -146,7 +146,7 @@ export declare const AccountPage: v.SchemaWithPipe<readonly [v.StrictObjectSchem
|
|
|
146
146
|
readonly number: v.StringSchema<undefined>;
|
|
147
147
|
readonly type: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "Null while the balance projection does not know the account yet.">]>;
|
|
148
148
|
readonly currency: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "Null while the balance projection does not know the account yet.">]>;
|
|
149
|
-
readonly balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The
|
|
149
|
+
readonly balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The balance AndCo maintains for the account, as a decimal string, never a number. It is what the account holds after its last movement; funds on hold are not subtracted from it. Null while AndCo does not know the account's balance yet, for example right after it is opened, and null when the Grant lacks `read_balance`; a listing never fails for it and never makes up a zero.">]>;
|
|
150
150
|
}, undefined>;
|
|
151
151
|
}, undefined>, undefined>;
|
|
152
152
|
readonly pageInfo: v.StrictObjectSchema<{
|
|
@@ -176,41 +176,54 @@ export declare const AccountPage: v.SchemaWithPipe<readonly [v.StrictObjectSchem
|
|
|
176
176
|
};
|
|
177
177
|
}, string>]>;
|
|
178
178
|
/**
|
|
179
|
-
* One account
|
|
180
|
-
*
|
|
181
|
-
*
|
|
179
|
+
* One Movement of an account: a credit or a debit, as AndCo reports it. The node is a closed list of
|
|
180
|
+
* fields with the names AndCo gives them, in snake_case: nothing else leaves the API, and a camelCase
|
|
181
|
+
* node or a field outside the list is refused. "Transaction" means only a ledger id, `transaction_id`.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* const movement: Movement = {
|
|
185
|
+
* object: "movement", id, transaction_id: "88213", description: "Transferencia", amount: 500000,
|
|
186
|
+
* currency: "CLP", movement_type: "withdrawal", movement_origin: null, movement_date,
|
|
187
|
+
* running_balance: 1200000, payment_type: null, reversed: false, note: null, transfer_id,
|
|
188
|
+
* };
|
|
182
189
|
*/
|
|
183
|
-
export declare const
|
|
190
|
+
export declare const Movement: v.StrictObjectSchema<{
|
|
191
|
+
readonly object: v.LiteralSchema<"movement", undefined>;
|
|
184
192
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
185
|
-
readonly
|
|
193
|
+
readonly transaction_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "The ledger id of the transaction that posted this Movement, or null when AndCo has none. A Transfer that succeeded carries the same id of its debit.">]>;
|
|
186
194
|
readonly description: v.StringSchema<undefined>;
|
|
187
|
-
readonly amount: v.SchemaWithPipe<readonly [v.
|
|
188
|
-
readonly
|
|
189
|
-
readonly
|
|
190
|
-
readonly
|
|
191
|
-
readonly
|
|
192
|
-
readonly
|
|
195
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>, v.DescriptionAction<number, "A positive integer in whole pesos (CLP). What tells an inflow from an outflow is `movement_type`, not a sign.">]>;
|
|
196
|
+
readonly currency: v.SchemaWithPipe<readonly [v.LiteralSchema<"CLP", undefined>, v.DescriptionAction<"CLP", "The currency of the account: a permission never assumes it, so the node names it.">]>;
|
|
197
|
+
readonly movement_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["deposit", "interest", "withdrawal"], undefined>, v.DescriptionAction<"deposit" | "interest" | "withdrawal", "The kind of Movement, in AndCo's own words. `deposit` and `interest` bring money into this account and raise its balance; `withdrawal` takes money out and lowers it. `amount` is always positive, so `movement_type` is what tells an inflow from an outflow.">]>;
|
|
198
|
+
readonly movement_origin: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
199
|
+
readonly movement_date: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
200
|
+
readonly running_balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>, v.DescriptionAction<number | null, "The balance after this Movement, an integer in whole pesos, or null when AndCo did not send one: it is never made up. Real balances do go negative, so the sign is not narrowed away.">]>;
|
|
201
|
+
readonly payment_type: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
193
202
|
readonly reversed: v.BooleanSchema<undefined>;
|
|
194
203
|
readonly note: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
204
|
+
readonly transfer_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The id of the Transfer that this debit belongs to, only when the Grant may read that Transfer: one this client created for the same subject, or any Transfer of an account that a `bank_transfer` `read` detail covers. Always present. A null never means that no Transfer exists: it means no Transfer that this Grant may read, and it is also null for a credit, for a Movement without a `transaction_id` and for one that AndCo has posted before AndCo recorded the Transfer, which fills on a later read.">]>;
|
|
195
205
|
}, undefined>;
|
|
196
|
-
/** One
|
|
197
|
-
export type
|
|
198
|
-
/** A page of one account's
|
|
199
|
-
export declare const
|
|
206
|
+
/** One Movement of an account. */
|
|
207
|
+
export type Movement = v.InferOutput<typeof Movement>;
|
|
208
|
+
/** A page of one account's Movements, read live from the bank. */
|
|
209
|
+
export declare const MovementPage: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
200
210
|
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
201
211
|
readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
202
212
|
readonly node: v.StrictObjectSchema<{
|
|
213
|
+
readonly object: v.LiteralSchema<"movement", undefined>;
|
|
203
214
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
204
|
-
readonly
|
|
215
|
+
readonly transaction_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "The ledger id of the transaction that posted this Movement, or null when AndCo has none. A Transfer that succeeded carries the same id of its debit.">]>;
|
|
205
216
|
readonly description: v.StringSchema<undefined>;
|
|
206
|
-
readonly amount: v.SchemaWithPipe<readonly [v.
|
|
207
|
-
readonly
|
|
208
|
-
readonly
|
|
209
|
-
readonly
|
|
210
|
-
readonly
|
|
211
|
-
readonly
|
|
217
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>, v.DescriptionAction<number, "A positive integer in whole pesos (CLP). What tells an inflow from an outflow is `movement_type`, not a sign.">]>;
|
|
218
|
+
readonly currency: v.SchemaWithPipe<readonly [v.LiteralSchema<"CLP", undefined>, v.DescriptionAction<"CLP", "The currency of the account: a permission never assumes it, so the node names it.">]>;
|
|
219
|
+
readonly movement_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["deposit", "interest", "withdrawal"], undefined>, v.DescriptionAction<"deposit" | "interest" | "withdrawal", "The kind of Movement, in AndCo's own words. `deposit` and `interest` bring money into this account and raise its balance; `withdrawal` takes money out and lowers it. `amount` is always positive, so `movement_type` is what tells an inflow from an outflow.">]>;
|
|
220
|
+
readonly movement_origin: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
221
|
+
readonly movement_date: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
222
|
+
readonly running_balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>, v.DescriptionAction<number | null, "The balance after this Movement, an integer in whole pesos, or null when AndCo did not send one: it is never made up. Real balances do go negative, so the sign is not narrowed away.">]>;
|
|
223
|
+
readonly payment_type: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
212
224
|
readonly reversed: v.BooleanSchema<undefined>;
|
|
213
225
|
readonly note: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
226
|
+
readonly transfer_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The id of the Transfer that this debit belongs to, only when the Grant may read that Transfer: one this client created for the same subject, or any Transfer of an account that a `bank_transfer` `read` detail covers. Always present. A null never means that no Transfer exists: it means no Transfer that this Grant may read, and it is also null for a credit, for a Movement without a `transaction_id` and for one that AndCo has posted before AndCo recorded the Transfer, which fills on a later read.">]>;
|
|
214
227
|
}, undefined>;
|
|
215
228
|
}, undefined>, undefined>;
|
|
216
229
|
readonly pageInfo: v.StrictObjectSchema<{
|
|
@@ -223,17 +236,20 @@ export declare const BankTransactionPage: v.SchemaWithPipe<readonly [v.StrictObj
|
|
|
223
236
|
edges: {
|
|
224
237
|
cursor: string | null;
|
|
225
238
|
node: {
|
|
239
|
+
object: "movement";
|
|
226
240
|
id: string;
|
|
227
|
-
|
|
241
|
+
transaction_id: string | null;
|
|
228
242
|
description: string;
|
|
229
|
-
amount:
|
|
243
|
+
amount: number;
|
|
244
|
+
currency: "CLP";
|
|
230
245
|
movement_type: "deposit" | "interest" | "withdrawal";
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
246
|
+
movement_origin: string | null;
|
|
247
|
+
movement_date: string;
|
|
248
|
+
running_balance: number | null;
|
|
249
|
+
payment_type: string | null;
|
|
235
250
|
reversed: boolean;
|
|
236
251
|
note: string | null;
|
|
252
|
+
transfer_id: string | null;
|
|
237
253
|
};
|
|
238
254
|
}[];
|
|
239
255
|
pageInfo: {
|
|
@@ -262,7 +278,7 @@ export declare const listAccounts: import("@orpc/contract").ProcedureContractBui
|
|
|
262
278
|
readonly number: v.StringSchema<undefined>;
|
|
263
279
|
readonly type: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "Null while the balance projection does not know the account yet.">]>;
|
|
264
280
|
readonly currency: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "Null while the balance projection does not know the account yet.">]>;
|
|
265
|
-
readonly balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The
|
|
281
|
+
readonly balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The balance AndCo maintains for the account, as a decimal string, never a number. It is what the account holds after its last movement; funds on hold are not subtracted from it. Null while AndCo does not know the account's balance yet, for example right after it is opened, and null when the Grant lacks `read_balance`; a listing never fails for it and never makes up a zero.">]>;
|
|
266
282
|
}, undefined>;
|
|
267
283
|
}, undefined>, undefined>;
|
|
268
284
|
readonly pageInfo: v.StrictObjectSchema<{
|
|
@@ -291,8 +307,8 @@ export declare const listAccounts: import("@orpc/contract").ProcedureContractBui
|
|
|
291
307
|
hasNextPage: boolean;
|
|
292
308
|
};
|
|
293
309
|
}, string>]>, import("./api-error.js").AndcoAPIErrorMap<readonly [typeof InvalidRequest, typeof InvalidAccountsCursor, typeof InvalidToken, typeof InvalidOrigin, typeof InsufficientAuthorization, typeof UnsupportedVersion, typeof ServerError, typeof BankConnectionInteractionRequired, typeof TemporarilyUnavailable]>>;
|
|
294
|
-
/** Lists one account's
|
|
295
|
-
export declare const
|
|
310
|
+
/** Lists one account's Movements, newest first, read from the bank. */
|
|
311
|
+
export declare const listAccountMovements: import("@orpc/contract").ProcedureContractBuilderWithInputOutput<v.ObjectSchema<{
|
|
296
312
|
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2048, undefined>, v.DescriptionAction<string, "Opaque cursor previously returned by this collection.">]>, undefined>;
|
|
297
313
|
readonly first: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Cursor page size; forward and backward argument families are exclusive.">]>;
|
|
298
314
|
readonly bank_account_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account's identifier (a UUID) or its Account Key.">]>;
|
|
@@ -300,17 +316,20 @@ export declare const listAccountTransactions: import("@orpc/contract").Procedure
|
|
|
300
316
|
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
301
317
|
readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
302
318
|
readonly node: v.StrictObjectSchema<{
|
|
319
|
+
readonly object: v.LiteralSchema<"movement", undefined>;
|
|
303
320
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
304
|
-
readonly
|
|
321
|
+
readonly transaction_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | null, "The ledger id of the transaction that posted this Movement, or null when AndCo has none. A Transfer that succeeded carries the same id of its debit.">]>;
|
|
305
322
|
readonly description: v.StringSchema<undefined>;
|
|
306
|
-
readonly amount: v.SchemaWithPipe<readonly [v.
|
|
307
|
-
readonly
|
|
308
|
-
readonly
|
|
309
|
-
readonly
|
|
310
|
-
readonly
|
|
311
|
-
readonly
|
|
323
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>, v.DescriptionAction<number, "A positive integer in whole pesos (CLP). What tells an inflow from an outflow is `movement_type`, not a sign.">]>;
|
|
324
|
+
readonly currency: v.SchemaWithPipe<readonly [v.LiteralSchema<"CLP", undefined>, v.DescriptionAction<"CLP", "The currency of the account: a permission never assumes it, so the node names it.">]>;
|
|
325
|
+
readonly movement_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["deposit", "interest", "withdrawal"], undefined>, v.DescriptionAction<"deposit" | "interest" | "withdrawal", "The kind of Movement, in AndCo's own words. `deposit` and `interest` bring money into this account and raise its balance; `withdrawal` takes money out and lowers it. `amount` is always positive, so `movement_type` is what tells an inflow from an outflow.">]>;
|
|
326
|
+
readonly movement_origin: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
327
|
+
readonly movement_date: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
328
|
+
readonly running_balance: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>, v.DescriptionAction<number | null, "The balance after this Movement, an integer in whole pesos, or null when AndCo did not send one: it is never made up. Real balances do go negative, so the sign is not narrowed away.">]>;
|
|
329
|
+
readonly payment_type: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
312
330
|
readonly reversed: v.BooleanSchema<undefined>;
|
|
313
331
|
readonly note: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
332
|
+
readonly transfer_id: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>, v.DescriptionAction<string | null, "The id of the Transfer that this debit belongs to, only when the Grant may read that Transfer: one this client created for the same subject, or any Transfer of an account that a `bank_transfer` `read` detail covers. Always present. A null never means that no Transfer exists: it means no Transfer that this Grant may read, and it is also null for a credit, for a Movement without a `transaction_id` and for one that AndCo has posted before AndCo recorded the Transfer, which fills on a later read.">]>;
|
|
314
333
|
}, undefined>;
|
|
315
334
|
}, undefined>, undefined>;
|
|
316
335
|
readonly pageInfo: v.StrictObjectSchema<{
|
|
@@ -323,17 +342,20 @@ export declare const listAccountTransactions: import("@orpc/contract").Procedure
|
|
|
323
342
|
edges: {
|
|
324
343
|
cursor: string | null;
|
|
325
344
|
node: {
|
|
345
|
+
object: "movement";
|
|
326
346
|
id: string;
|
|
327
|
-
|
|
347
|
+
transaction_id: string | null;
|
|
328
348
|
description: string;
|
|
329
|
-
amount:
|
|
349
|
+
amount: number;
|
|
350
|
+
currency: "CLP";
|
|
330
351
|
movement_type: "deposit" | "interest" | "withdrawal";
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
352
|
+
movement_origin: string | null;
|
|
353
|
+
movement_date: string;
|
|
354
|
+
running_balance: number | null;
|
|
355
|
+
payment_type: string | null;
|
|
335
356
|
reversed: boolean;
|
|
336
357
|
note: string | null;
|
|
358
|
+
transfer_id: string | null;
|
|
337
359
|
};
|
|
338
360
|
}[];
|
|
339
361
|
pageInfo: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/rest/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,OAAO,EAIL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EAER,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,0FAAyE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElG;;;;;GAKG;AACH,qBAAa,iCAAkC,SAAQ,eAAe,CAAC,sCAsBtE;gBAEG,IAAI,EAAE;QAAE,IAAI,EAAE,iCAAiC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,EAC3F,OAAO,CAAC,EAAE,MAAM;CAInB;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,yGAAyG;AACzG,qBAAa,qBAAsB,SAAQ,eAAe,CAAC,0BAI1D;gBACa,OAAO,CAAC,EAAE,MAAM;CAG7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,kBAIlD;gBACa,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,sDAAsD;AACtD,eAAO,MAAM,WAAW;;;;;;;;aA6BtB,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5D,wCAAwC;AACxC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAGvB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/rest/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,OAAO,EAIL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EAER,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,0FAAyE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElG;;;;;GAKG;AACH,qBAAa,iCAAkC,SAAQ,eAAe,CAAC,sCAsBtE;gBAEG,IAAI,EAAE;QAAE,IAAI,EAAE,iCAAiC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,EAC3F,OAAO,CAAC,EAAE,MAAM;CAInB;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,yGAAyG;AACzG,qBAAa,qBAAsB,SAAQ,eAAe,CAAC,0BAI1D;gBACa,OAAO,CAAC,EAAE,MAAM;CAG7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,kBAIlD;gBACa,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,sDAAsD;AACtD,eAAO,MAAM,WAAW;;;;;;;;aA6BtB,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5D,wCAAwC;AACxC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAGvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;aAgDnB,CAAC;AAEH,kCAAkC;AAClC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEtD,kEAAkE;AAClE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAGxB,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6TAiCH,CAAC;AAEvB,uEAAuE;AACvE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gWAoCV,CAAC"}
|
package/dist/rest/accounts.js
CHANGED
|
@@ -36,7 +36,7 @@ export class InvalidAccountsCursor extends /* @__PURE__ */ AndcoAPIError.define(
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* The `after` of the
|
|
39
|
+
* The `after` of the movements walk is not the cursor AndCo issued for the next page. The
|
|
40
40
|
* AndCo's cursor travels untouched: take it from `pageInfo.endCursor` and nothing else.
|
|
41
41
|
*/
|
|
42
42
|
export class InvalidCursor extends /* @__PURE__ */ AndcoAPIError.define("invalid_cursor", 400, v.pipe(v.object({}), v.description("`after` is not a cursor AndCo issued."))) {
|
|
@@ -52,30 +52,40 @@ export const BankAccount = /* @__PURE__ */ v.strictObject({
|
|
|
52
52
|
number: v.string(),
|
|
53
53
|
type: v.pipe(v.nullable(v.string()), v.description("Null while the balance projection does not know the account yet.")),
|
|
54
54
|
currency: v.pipe(v.nullable(v.pipe(v.string(), v.regex(/^[A-Z]{3}$/))), v.description("Null while the balance projection does not know the account yet.")),
|
|
55
|
-
balance: v.pipe(v.nullable(BankDecimal), v.description("The
|
|
55
|
+
balance: v.pipe(v.nullable(BankDecimal), v.description("The balance AndCo maintains for the account, as a decimal string, never a number. It is what the account holds after its last movement; funds on hold are not subtracted from it. Null while AndCo does not know the account's balance yet, for example right after it is opened, and null when the Grant lacks `read_balance`; a listing never fails for it and never makes up a zero.")),
|
|
56
56
|
});
|
|
57
57
|
/** A page of the subject's accounts. */
|
|
58
58
|
export const AccountPage = /* @__PURE__ */ connection(BankAccount, "A standard connection. Edge cursors remain present on nonempty terminal pages. Reads are live; offset positions can shift under concurrent changes.");
|
|
59
59
|
/**
|
|
60
|
-
* One account
|
|
61
|
-
*
|
|
62
|
-
*
|
|
60
|
+
* One Movement of an account: a credit or a debit, as AndCo reports it. The node is a closed list of
|
|
61
|
+
* fields with the names AndCo gives them, in snake_case: nothing else leaves the API, and a camelCase
|
|
62
|
+
* node or a field outside the list is refused. "Transaction" means only a ledger id, `transaction_id`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const movement: Movement = {
|
|
66
|
+
* object: "movement", id, transaction_id: "88213", description: "Transferencia", amount: 500000,
|
|
67
|
+
* currency: "CLP", movement_type: "withdrawal", movement_origin: null, movement_date,
|
|
68
|
+
* running_balance: 1200000, payment_type: null, reversed: false, note: null, transfer_id,
|
|
69
|
+
* };
|
|
63
70
|
*/
|
|
64
|
-
export const
|
|
71
|
+
export const Movement = /* @__PURE__ */ v.strictObject({
|
|
72
|
+
object: v.literal("movement"),
|
|
65
73
|
id: v.pipe(v.string(), v.uuid()),
|
|
66
|
-
|
|
74
|
+
transaction_id: v.pipe(v.nullable(v.string()), v.description("The ledger id of the transaction that posted this Movement, or null when AndCo has none. A Transfer that succeeded carries the same id of its debit.")),
|
|
67
75
|
description: v.string(),
|
|
68
|
-
amount: v.pipe(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
amount: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(Number.MAX_SAFE_INTEGER), v.description("A positive integer in whole pesos (CLP). What tells an inflow from an outflow is `movement_type`, not a sign.")),
|
|
77
|
+
currency: v.pipe(v.literal("CLP"), v.description("The currency of the account: a permission never assumes it, so the node names it.")),
|
|
78
|
+
movement_type: v.pipe(v.picklist(["deposit", "interest", "withdrawal"]), v.description("The kind of Movement, in AndCo's own words. `deposit` and `interest` bring money into this account and raise its balance; `withdrawal` takes money out and lowers it. `amount` is always positive, so `movement_type` is what tells an inflow from an outflow.")),
|
|
79
|
+
movement_origin: v.nullable(v.string()),
|
|
80
|
+
movement_date: v.pipe(v.string(), v.isoTimestamp()),
|
|
81
|
+
running_balance: v.pipe(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(Number.MIN_SAFE_INTEGER), v.maxValue(Number.MAX_SAFE_INTEGER))), v.description("The balance after this Movement, an integer in whole pesos, or null when AndCo did not send one: it is never made up. Real balances do go negative, so the sign is not narrowed away.")),
|
|
82
|
+
payment_type: v.nullable(v.string()),
|
|
74
83
|
reversed: v.boolean(),
|
|
75
84
|
note: v.nullable(v.string()),
|
|
85
|
+
transfer_id: v.pipe(v.nullable(v.pipe(v.string(), v.uuid())), v.description("The id of the Transfer that this debit belongs to, only when the Grant may read that Transfer: one this client created for the same subject, or any Transfer of an account that a `bank_transfer` `read` detail covers. Always present. A null never means that no Transfer exists: it means no Transfer that this Grant may read, and it is also null for a credit, for a Movement without a `transaction_id` and for one that AndCo has posted before AndCo recorded the Transfer, which fills on a later read.")),
|
|
76
86
|
});
|
|
77
|
-
/** A page of one account's
|
|
78
|
-
export const
|
|
87
|
+
/** A page of one account's Movements, read live from the bank. */
|
|
88
|
+
export const MovementPage = /* @__PURE__ */ cursorlessConnection(Movement, "A connection read live from AndCo, which issues one cursor per page and walks forward only. `pageInfo.endCursor` is that cursor and is null on the last page; `pageInfo.startCursor` is always null and `pageInfo.hasPreviousPage` always false. An edge's `cursor` is null: AndCo names no position inside a page, so a walk resumes from the end of a page, never from one Movement.");
|
|
79
89
|
/** Lists the personal digital accounts the Grant reaches, with their balances. */
|
|
80
90
|
export const listAccounts = /* @__PURE__ */ oc
|
|
81
91
|
.meta(http({
|
|
@@ -91,18 +101,18 @@ export const listAccounts = /* @__PURE__ */ oc
|
|
|
91
101
|
...PageQuery,
|
|
92
102
|
}))
|
|
93
103
|
.output(AccountPage);
|
|
94
|
-
/** Lists one account's
|
|
95
|
-
export const
|
|
104
|
+
/** Lists one account's Movements, newest first, read from the bank. */
|
|
105
|
+
export const listAccountMovements = /* @__PURE__ */ oc
|
|
96
106
|
.meta(http({
|
|
97
107
|
method: "GET",
|
|
98
|
-
path: "/accounts/{bank_account_id}/
|
|
99
|
-
summary: "List one account's
|
|
100
|
-
description: "Answers the
|
|
101
|
-
successDescription: "Authorized cursor page of account
|
|
108
|
+
path: "/accounts/{bank_account_id}/movements",
|
|
109
|
+
summary: "List one account's Movements",
|
|
110
|
+
description: "Answers the Movements the account's statement presentation reads, so an integrator sees exactly what a person would see, newest first, one page at a time: feed `pageInfo.endCursor` back as `?after=` while `pageInfo.hasNextPage`. Granted by a `bank_movement` authorization detail with `read` whose `accounts` reach this account. The account is named by its identifier or by its Account Key, whichever the integrator knows: a segment shaped like a UUID is an identifier, any other is an Account Key of the Grant's subject. The permission is the same for both and the key is resolved on this request: an account the Grant does not reach, by identifier or by key, and a key that names no account of the subject answer `404`, as if it did not exist, whether or not the account exists. The page is read from AndCo on behalf of the subject, and its read model walks forward only: `pageInfo.endCursor` is AndCo's own cursor for the next page, handed over untouched, and `after` accepts nothing else (`invalid_cursor` otherwise). There is no cursor per Movement, no backward walk and no offset: `before`, `last`, `offset` and `limit` answer `invalid_request`. Returns edges and camelCase pageInfo.",
|
|
111
|
+
successDescription: "Authorized cursor page of account Movements, newest first",
|
|
102
112
|
}))
|
|
103
113
|
.errors(errors(InvalidRequest, InvalidIdentifier, InvalidCursor, InvalidToken, InvalidOrigin, InsufficientAuthorization, NotFound, UnsupportedVersion, ServerError, BankConnectionInteractionRequired, TemporarilyUnavailable))
|
|
104
114
|
.input(v.object({
|
|
105
115
|
bank_account_id: v.pipe(v.string(), v.maxLength(64), v.description("The account's identifier (a UUID) or its Account Key.")),
|
|
106
116
|
...ForwardPageQuery,
|
|
107
117
|
}))
|
|
108
|
-
.output(
|
|
118
|
+
.output(MovementPage);
|
package/dist/rest/catalog.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BankConnectionInteractionRequired } from "./accounts.js";
|
|
|
3
3
|
import { InsufficientAuthorization, InvalidOrigin, InvalidRequest, InvalidToken, ServerError, TemporarilyUnavailable, UnsupportedVersion } from "./common.js";
|
|
4
4
|
/** A bank a transfer can be sent to. */
|
|
5
5
|
export declare const BankCatalogEntry: v.StrictObjectSchema<{
|
|
6
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code
|
|
6
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code: the `bank_code` of a Receptor.">]>;
|
|
7
7
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The bank's name as the bank lists it.">]>;
|
|
8
8
|
}, undefined>;
|
|
9
9
|
/** The whole list of banks as one page. */
|
|
@@ -11,7 +11,7 @@ export declare const BankCatalogPage: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
11
11
|
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
12
12
|
readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
13
13
|
readonly node: v.StrictObjectSchema<{
|
|
14
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code
|
|
14
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code: the `bank_code` of a Receptor.">]>;
|
|
15
15
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The bank's name as the bank lists it.">]>;
|
|
16
16
|
}, undefined>;
|
|
17
17
|
}, undefined>, undefined>;
|
|
@@ -110,7 +110,7 @@ export declare const getBankCatalog: import("@orpc/contract").ProcedureContractB
|
|
|
110
110
|
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
111
111
|
readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
112
112
|
readonly node: v.StrictObjectSchema<{
|
|
113
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code
|
|
113
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code: the `bank_code` of a Receptor.">]>;
|
|
114
114
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "The bank's name as the bank lists it.">]>;
|
|
115
115
|
}, undefined>;
|
|
116
116
|
}, undefined>, undefined>;
|
package/dist/rest/catalog.js
CHANGED
|
@@ -6,7 +6,7 @@ import { BackwardPageQuery, connection, cursorlessConnection, ForwardPageQuery,
|
|
|
6
6
|
import { http } from "./http.js";
|
|
7
7
|
/** A bank a transfer can be sent to. */
|
|
8
8
|
export const BankCatalogEntry = /* @__PURE__ */ v.strictObject({
|
|
9
|
-
id: v.pipe(v.string(), v.regex(/^\d{4}$/), v.description("The bank's four-digit code
|
|
9
|
+
id: v.pipe(v.string(), v.regex(/^\d{4}$/), v.description("The bank's four-digit code: the `bank_code` of a Receptor.")),
|
|
10
10
|
name: v.pipe(v.string(), v.description("The bank's name as the bank lists it.")),
|
|
11
11
|
});
|
|
12
12
|
/** The whole list of banks as one page. */
|
|
@@ -36,7 +36,7 @@ export const getBankCatalog = /* @__PURE__ */ oc
|
|
|
36
36
|
method: "GET",
|
|
37
37
|
path: "/catalog/banks",
|
|
38
38
|
summary: "List the banks a transfer can be sent to",
|
|
39
|
-
description: "The banks
|
|
39
|
+
description: "The banks a transfer can be sent to, each with its four-digit code and its name: the `bank_code` values a Receptor (a `bank_transfer` destination of type `external`) names, so an integrator never guesses one. `@andco/protocol` also exports the known codes as `CHILEAN_BANK_CODES`, which no validation reads; a code the catalog does not know fails with `unsupported_bank` when the transfer is executed. Granted by a `bank_transfer` authorization detail with `create`. It is read on behalf of the subject through one of the accounts that detail reaches, so a subject without any answers `409 interaction_required`. It is one bounded list, answered whole as a single page: `pageInfo.hasNextPage` is false, no edge carries a cursor and the pagination parameters do not apply. Returns edges and camelCase pageInfo.",
|
|
40
40
|
successDescription: "The banks a transfer can be sent to, ordered as the bank lists them",
|
|
41
41
|
}))
|
|
42
42
|
.errors(errors(InvalidToken, InvalidOrigin, InsufficientAuthorization, UnsupportedVersion, ServerError, BankConnectionInteractionRequired, TemporarilyUnavailable))
|