@andco/protocol 0.0.15 → 0.1.0-ti.0
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 +284 -12
- package/dist/rar/bank.d.ts.map +1 -1
- package/dist/rar/bank.js +42 -4
- package/dist/rar/catalog.d.ts +130 -5
- package/dist/rar/catalog.d.ts.map +1 -1
- package/dist/rar/json-schemas.generated.d.ts.map +1 -1
- package/dist/rar/json-schemas.generated.js +372 -4
- 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 +3 -3
- package/dist/rest/accounts.js +1 -1
- package/dist/rest/catalog.d.ts +3 -3
- package/dist/rest/catalog.js +2 -2
- package/dist/rest/contract.d.ts +561 -302
- package/dist/rest/contract.d.ts.map +1 -1
- package/dist/rest/contract.js +6 -2
- 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 +66 -52
- 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 +64 -13
- 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 +352 -88
- 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 +4 -4
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ export type AndCoIntentDepositEvent = AndCoFinancialEvent<"deposit.target_update
|
|
|
58
58
|
*
|
|
59
59
|
* Account events keep saying `deposit` and `withdrawal` on purpose. Here the word names the
|
|
60
60
|
* direction of a Movement — the entry a Transaction leaves in one account — and not the kind of
|
|
61
|
-
* request that produced it. One transfer publishes `transfer.succeeded` on the
|
|
61
|
+
* request that produced it. One transfer publishes `transfer.succeeded` on the Transfer,
|
|
62
62
|
* `withdrawal.posted` on the account the money left, and `deposit.received` on the account it
|
|
63
63
|
* reached, and all three words are correct.
|
|
64
64
|
*/
|
|
@@ -105,7 +105,7 @@ export type AndCoWithdrawalEvent = AndCoFinancialEvent<"withdrawal.posted", {
|
|
|
105
105
|
observed_at: string;
|
|
106
106
|
}>;
|
|
107
107
|
/**
|
|
108
|
-
* Frozen values of a confirmed transfer, in
|
|
108
|
+
* Frozen values of a confirmed transfer, in the transfer vocabulary of the API; these do not assert that a debit was
|
|
109
109
|
* posted.
|
|
110
110
|
*
|
|
111
111
|
* `receiver` is whatever the money was aimed at: an AndCo account by identifier, an AndCo account by
|
|
@@ -129,30 +129,81 @@ export type AndCoConfirmedTransfer = {
|
|
|
129
129
|
};
|
|
130
130
|
comment: string;
|
|
131
131
|
};
|
|
132
|
+
/** The names of the events that tell the decision of an Intent. */
|
|
133
|
+
export declare const ANDCO_INTENT_EVENT_TYPES: readonly ["intent.approval_required", "intent.approved", "intent.rejected", "intent.cancelled", "intent.expired"];
|
|
134
|
+
/** The names of the events that tell what happens to the money of a Transfer. */
|
|
135
|
+
export declare const ANDCO_TRANSFER_EVENT_TYPES: readonly ["transfer.confirmed", "transfer.succeeded", "transfer.failed", "transfer.cancelled"];
|
|
132
136
|
/**
|
|
133
|
-
* The
|
|
137
|
+
* The decision of an Intent, as its Project sees it. An Intent is the request for a decision and
|
|
138
|
+
* ends at it, so these events say who is asked and what was decided, never what the money did:
|
|
134
139
|
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
140
|
+
* - `intent.approval_required`: the Intent waits for a person's Approval, so an integrator can notify
|
|
141
|
+
* its own people without standing up a separate webhook.
|
|
142
|
+
* - `intent.approved`: the Approval is recorded. The payload names the Intent's `type` and, for a
|
|
143
|
+
* transfer, the `transfer_id` of the Transfer that now exists.
|
|
144
|
+
* - `intent.rejected`, `intent.cancelled`, `intent.expired`: the other endings.
|
|
145
|
+
*
|
|
146
|
+
* `account_opening.*`, `account_closure.*` and `deposit.*` keep their own names.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* if (event.type === "intent.approved" && event.payload.transfer_id) await followTransfer(event.payload.transfer_id);
|
|
143
150
|
*/
|
|
144
|
-
export type
|
|
151
|
+
export type AndCoIntentEvent = AndCoFinancialEvent<"intent.approved", {
|
|
152
|
+
intent_id: string;
|
|
153
|
+
type: string;
|
|
154
|
+
transfer_id: string | null;
|
|
155
|
+
observed_at: string;
|
|
156
|
+
}> | AndCoFinancialEvent<"intent.expired", {
|
|
145
157
|
intent_id: string;
|
|
158
|
+
type: string;
|
|
146
159
|
status: "expired";
|
|
147
160
|
expires_at: string;
|
|
148
|
-
}> | AndCoFinancialEvent
|
|
161
|
+
}> | AndCoFinancialEvent<"intent.approval_required" | "intent.rejected" | "intent.cancelled", {
|
|
149
162
|
intent_id: string;
|
|
163
|
+
type: string;
|
|
164
|
+
status: string;
|
|
165
|
+
detail: string | null;
|
|
166
|
+
observed_at: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* What happens to the money of one Transfer, as the Project that created it sees it. The Transfer
|
|
170
|
+
* exists after its Intent was approved, so these events name both ids.
|
|
171
|
+
*
|
|
172
|
+
* `transfer.confirmed` says AndCo holds the command and nobody has to do anything: for a transfer that
|
|
173
|
+
* leaves its holder's own accounts it is published once, when AndCo accepts the transfer, and for a
|
|
174
|
+
* transfer between two accounts of the same holder it is published from its release.
|
|
175
|
+
* `transfer.succeeded` says the money moved, `transfer.failed` that it did not, and
|
|
176
|
+
* `transfer.cancelled` that the Transfer ended before the money left: its deadline passed or its Grant
|
|
177
|
+
* ended.
|
|
178
|
+
*/
|
|
179
|
+
export type AndCoTransferEvent = AndCoFinancialEvent<(typeof ANDCO_TRANSFER_EVENT_TYPES)[number], {
|
|
180
|
+
transfer_id: string;
|
|
181
|
+
intent_id: string | null;
|
|
150
182
|
status: string;
|
|
151
183
|
detail: string | null;
|
|
152
184
|
operation: AndCoConfirmedTransfer | null;
|
|
153
185
|
transaction_id: string | null;
|
|
154
186
|
observed_at: string;
|
|
155
187
|
}>;
|
|
188
|
+
/**
|
|
189
|
+
* Whether a financial event tells the decision of an Intent. Only the five `intent.*` names do: a
|
|
190
|
+
* name that an Intent's events had before the split, such as `transfer.approval_required`, does not.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* if (IS_ANDCO_INTENT_EVENT(event)) await notifyApprovers(event.payload["intent_id"]);
|
|
194
|
+
*/
|
|
195
|
+
export declare function IS_ANDCO_INTENT_EVENT(event: {
|
|
196
|
+
readonly type: string;
|
|
197
|
+
}): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Whether a financial event tells what happens to the money of a Transfer: the four `transfer.*` names.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* if (IS_ANDCO_TRANSFER_EVENT(event) && event.type === "transfer.succeeded") await markPaid(event.payload["transfer_id"]);
|
|
203
|
+
*/
|
|
204
|
+
export declare function IS_ANDCO_TRANSFER_EVENT(event: {
|
|
205
|
+
readonly type: string;
|
|
206
|
+
}): boolean;
|
|
156
207
|
/** Durable events in a standard connection with opaque edge cursors. */
|
|
157
208
|
export type AndCoEventPage = import("../pagination.js").Connection<AndCoFinancialEvent>;
|
|
158
209
|
/** Checkpoint recovery, polling frequency, and failure handling for one subscription. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial-events.d.ts","sourceRoot":"","sources":["../../src/transport/financial-events.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACxF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,cAAc,EAAE,kBAAkB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAExG,mGAAmG;AACnG,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,EAAE,iBAAiB,CAAC;AAExE,8EAA8E;AAC9E,MAAM,MAAM,uBAAuB,GAC/B,mBAAmB,CACjB,wBAAwB,EACxB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CACF,GACD,mBAAmB,CACjB,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AAE,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"financial-events.d.ts","sourceRoot":"","sources":["../../src/transport/financial-events.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACxF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,cAAc,EAAE,kBAAkB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAExG,mGAAmG;AACnG,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,EAAE,iBAAiB,CAAC;AAExE,8EAA8E;AAC9E,MAAM,MAAM,uBAAuB,GAC/B,mBAAmB,CACjB,wBAAwB,EACxB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CACF,GACD,mBAAmB,CACjB,gBAAgB,EAChB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB,CACF,GACD,mBAAmB,CACjB,iBAAiB,EACjB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CACF,GACD,mBAAmB,CACjB,kBAAkB,EAClB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CA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AAC;IACf,kGAAkG;IAClG,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,6GAA6G;IAC7G,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,sBAAsB,GAAG;IACnC,qDAAqD;IACrD,WAAW,IAAI,IAAI,CAAC;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,mBAAmB;AACpE,0FAA0F;AAC1F,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC;AACjF,+EAA+E;AAC/E,MAAM,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,CAAC,GAAG,IAAI;AAChD,kFAAkF;AAClF,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC3D,OAAO,EAAE,6BAA6B,GACrC,sBAAsB,CAmFxB"}
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
/** The names of the events that tell the decision of an Intent. */
|
|
2
|
+
export const ANDCO_INTENT_EVENT_TYPES = [
|
|
3
|
+
"intent.approval_required",
|
|
4
|
+
"intent.approved",
|
|
5
|
+
"intent.rejected",
|
|
6
|
+
"intent.cancelled",
|
|
7
|
+
"intent.expired",
|
|
8
|
+
];
|
|
9
|
+
/** The names of the events that tell what happens to the money of a Transfer. */
|
|
10
|
+
export const ANDCO_TRANSFER_EVENT_TYPES = [
|
|
11
|
+
"transfer.confirmed",
|
|
12
|
+
"transfer.succeeded",
|
|
13
|
+
"transfer.failed",
|
|
14
|
+
"transfer.cancelled",
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Whether a financial event tells the decision of an Intent. Only the five `intent.*` names do: a
|
|
18
|
+
* name that an Intent's events had before the split, such as `transfer.approval_required`, does not.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* if (IS_ANDCO_INTENT_EVENT(event)) await notifyApprovers(event.payload["intent_id"]);
|
|
22
|
+
*/
|
|
23
|
+
export function IS_ANDCO_INTENT_EVENT(event) {
|
|
24
|
+
return ANDCO_INTENT_EVENT_TYPES.includes(event.type);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether a financial event tells what happens to the money of a Transfer: the four `transfer.*` names.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* if (IS_ANDCO_TRANSFER_EVENT(event) && event.type === "transfer.succeeded") await markPaid(event.payload["transfer_id"]);
|
|
31
|
+
*/
|
|
32
|
+
export function IS_ANDCO_TRANSFER_EVENT(event) {
|
|
33
|
+
return ANDCO_TRANSFER_EVENT_TYPES.includes(event.type);
|
|
34
|
+
}
|
|
1
35
|
/** Reconciles bounded pages using opaque continuation cursors. */
|
|
2
36
|
export function subscribeFinancialEvents(
|
|
3
37
|
/** Reads the next bounded page; honor the signal so unsubscribe can abort the request. */
|