@andco/sdk 0.0.1 → 0.0.2

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.
Files changed (2) hide show
  1. package/README.md +30 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -79,7 +79,7 @@ if (error) throw error;
79
79
 
80
80
  Two ways to get an `AndcoClientAuthed`:
81
81
 
82
- - `andco.with(credentials)` binds *explicit* credentials for one unit of work. It accepts
82
+ - `andco.with(credentials)` binds _explicit_ credentials for one unit of work. It accepts
83
83
  `AndcoCredentials`, an `AndcoSession`, or a bare access-token string — the bare string exists
84
84
  for the common server case where a handler already pulled a token out of its own session:
85
85
 
@@ -130,12 +130,17 @@ satisfy `AndcoCredentials` and can be passed straight to `use(...)`.
130
130
  `andco.intents` is domain-neutral: it only knows how to create, read, execute, and observe an
131
131
  Intent generically. It does not know about deposits, withdrawals, or any other domain concept —
132
132
  those belong to whatever Resource Server Definition owns that domain, composed over this same
133
- surface (see [Resource Server Definitions](#resource-server-definitions) above).
133
+ surface (see [Resource Server Definitions](#resource-server-definitions) above), such as the AndCo
134
+ Bank Resource Server Definition in [`@andco/bank-sdk`](../bank-sdk/README.md).
134
135
 
135
136
  ```ts
136
- const { data: intent, error } = await andco.intents.create("deposit", depositInput, {
137
- idempotencyKey: "deposit:8472",
138
- });
137
+ const { data: intent, error } = await andco.intents.create(
138
+ "deposit",
139
+ depositInput,
140
+ {
141
+ idempotencyKey: "deposit:8472",
142
+ },
143
+ );
139
144
  if (error) throw error;
140
145
  ```
141
146
 
@@ -150,6 +155,26 @@ if (error) throw error;
150
155
  - `subscribe(subject, read, decode, handler, options)` — a durable, paged subscription loop, with
151
156
  its own checkpoint and poll-interval reconciliation. Returns an unsubscribe function.
152
157
 
158
+ For the actual bank operations — `createDeposit`, `createWithdrawal`, `createAutomaticCharge`,
159
+ `closeDeposit`, and account/intent event listeners — see
160
+ [`@andco/bank-sdk`](../bank-sdk/README.md), whose `Bank` definition composes this same
161
+ domain-neutral surface:
162
+
163
+ ```ts
164
+ import { Bank } from "@andco/bank-sdk";
165
+
166
+ const bankDefinition = new Bank({ clientId, resource: "https://api.andco.cl" });
167
+ const bank = bankDefinition.use(andco.with(session));
168
+
169
+ const { data: deposit, error } = await bank.intents.createDeposit(
170
+ depositInput,
171
+ {
172
+ idempotencyKey: "deposit:8472",
173
+ },
174
+ );
175
+ if (error) throw error;
176
+ ```
177
+
153
178
  Present the resulting intent with `@andco/sdk-react`, `@andco/sdk-vue`, `@andco/sdk-svelte`, or
154
179
  `@andco/sdk-script`. The browser must retrieve the authoritative intent state after presentation;
155
180
  callback parameters are correlation data, not financial state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andco/sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"