@capxul/sdk 0.1.0-alpha.0 → 0.1.0-alpha.11
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/CHANGELOG.md +136 -0
- package/README.md +87 -5
- package/dist/{client-o4R-ZFh2.d.ts → client-DSxth_GE.d.cts} +467 -117
- package/dist/{client-BNGGubL2.d.cts → client-xqKjPV9I.d.ts} +467 -117
- package/dist/client.cjs +2141 -476
- package/dist/client.d.cts +4 -5
- package/dist/client.d.ts +4 -5
- package/dist/client.js +2141 -476
- package/dist/errors-GgKrSUKp.d.cts +70 -0
- package/dist/errors-QHD5Tlok.d.ts +70 -0
- package/dist/errors.d.cts +2 -55
- package/dist/errors.d.ts +2 -55
- package/dist/index.cjs +2427 -764
- package/dist/index.d.cts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.js +2425 -765
- package/dist/next-action-DkrwXYay.d.cts +177 -0
- package/dist/next-action-DkrwXYay.d.ts +177 -0
- package/dist/types-PM4AQRLP.d.ts +1136 -0
- package/dist/types-hfcOE7Oi.d.cts +1136 -0
- package/dist/webhooks.d.cts +2 -3
- package/dist/webhooks.d.ts +2 -3
- package/package.json +12 -11
- package/dist/types-Cokyqgwm.d.cts +0 -202
- package/dist/types-Cokyqgwm.d.ts +0 -202
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,141 @@
|
|
|
1
1
|
# @capxul/sdk
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4822b87: Auth-error surfacing on OTP send + SDK error-code union widening.
|
|
8
|
+
|
|
9
|
+
PR #586 merged 2026-05-07. SDK now exposes `PROVIDER_ERROR`,
|
|
10
|
+
`INTERNAL_ERROR`, `ENV_MISSING`, and `UNKNOWN` in the public error
|
|
11
|
+
union (ADR-020) so consumers can narrow exhaustively. Anti-enumeration
|
|
12
|
+
timing is equalized via symmetric cooldown + bounded random sleep
|
|
13
|
+
(ADR-021); per-IP rate limit is the residual gap tracked at #584.
|
|
14
|
+
|
|
15
|
+
Closes the silent-200 OTP delivery bug (#579) that blocked Pi-setup.
|
|
16
|
+
|
|
17
|
+
## 0.1.0-alpha.9
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- Add the canonical auth bootstrap flow.
|
|
22
|
+
|
|
23
|
+
`verifyOtp()` now resolves a verified email session into either an
|
|
24
|
+
`existing_member` identity or a `bootstrap_required` continuation. New and
|
|
25
|
+
incomplete members continue through `completeBootstrap()`, which validates a
|
|
26
|
+
server-issued bootstrap token, claims the username, provisions the account/Safe
|
|
27
|
+
through the backend bootstrap path, and returns the authenticated product
|
|
28
|
+
identity. The React SDK adds `useAuthBootstrapFlow()` as the typed first-run
|
|
29
|
+
flow wrapper.
|
|
30
|
+
|
|
31
|
+
## 0.1.0-alpha.8
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- 57203a4: Withdrawals v1 W2 (#465) — public surface tightening + org-scope create
|
|
36
|
+
- `WithdrawalsCreateInput.destination` no longer accepts `kind`. The
|
|
37
|
+
backend now resolves the `external_account` row by FK and infers
|
|
38
|
+
the kind + rail server-side. Anything that doesn't route to
|
|
39
|
+
`chain_wallet` (or is chain_wallet but non-EVM in slice 1) returns
|
|
40
|
+
`VERIFICATION_REQUIRED` with `details.rail` + `details.currentKind`.
|
|
41
|
+
- `organizations.withdrawals.create` is now a real mutation (no
|
|
42
|
+
longer a `NOT_IMPLEMENTED` stub). Returns the `processing` row
|
|
43
|
+
only — Safe + Zodiac submission orchestration ships in W3+.
|
|
44
|
+
- `Errors.verificationRequired({ rail, currentKind })` factory
|
|
45
|
+
added; the `VERIFICATION_REQUIRED` code now broadens to cover
|
|
46
|
+
both KYC tier gates and unsupported withdrawal rails.
|
|
47
|
+
|
|
48
|
+
**Migration:** Remove `destination.kind` from any
|
|
49
|
+
`capxul.withdrawals.create({ destination: { kind, externalAccountId } })`
|
|
50
|
+
call sites. Pass only `externalAccountId`.
|
|
51
|
+
|
|
52
|
+
## 0.1.0-alpha.4
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- Post-alpha hardening — WAVE 1 + WAVE 2 cumulative
|
|
57
|
+
|
|
58
|
+
**WAVE 1 (merged 2026-05-03 12:44Z):**
|
|
59
|
+
- S2 story 1: wire onboarding readback hooks (#469) — `me.update`, `accounts.retrieve`, `accounts.update`, `useAccount`, `useSafe`
|
|
60
|
+
- S3 phase 1: Ink reference CLI scaffold + `auth+me` end-to-end against live alpha-3 Convex (#470). Stickiness gate (D3) fired.
|
|
61
|
+
- S5: split `CapxulProvider` into public single-input `BrowserCapxulConfig` + test-only `CapxulTestProvider` from `@capxul/sdk-react/proof` (#473). Q1 lock honored. 7 type-level provider-shape guards including `@ts-expect-error` against test-provider leaking to public barrel.
|
|
62
|
+
|
|
63
|
+
**WAVE 2 (merged 2026-05-03 12:54-13:16Z):**
|
|
64
|
+
- S3 phase 2: per-domain CLI commands closing #458 (#476) — `account retrieve/update`, `safe retrieve`, `payment retrieve`, `withdrawal retrieve/list`. 12/12 agent-driver tests pass.
|
|
65
|
+
- S2 story 2: `capxul.tokenTransfers.*` non-canonical SDK namespace (#479) — Option A per #477 (canon-aligned `transfers.*` shape deferred to alpha.5+ pending backend canon work). New `useTokenTransfers` + `useTokenTransfer` hooks; new `getByTxLogIndex` backend query. Hook proof matrix length unchanged at 41 (non-canonical hooks deliberately excluded).
|
|
66
|
+
|
|
67
|
+
**S1 (#456) closed no-op** — alpha publish infrastructure (tsup, lazy-DX, transport state machine, npm metadata, READMEs, CHANGELOG, changesets, OIDC release workflow) physically merged into `api-first` via PRs #449-#452 earlier the same day; the slice merge produced 0 file changes per clean-room probe.
|
|
68
|
+
|
|
69
|
+
**Friction issues filed for alpha.4+ polish:**
|
|
70
|
+
- #474 — `me.get` returns `NOT_IMPLEMENTED` when `config.data` is undefined; should be `NOT_AUTHENTICATED`.
|
|
71
|
+
- #475 — `@capxul/sdk/headless` slim entry point excludes xstate flow machines + brand constructors (1.6 MB → much smaller).
|
|
72
|
+
- #477 / #478 — `transfers.*` / `balanceLedger.*` / `treasury` canon-shape alignment with indexer feed.
|
|
73
|
+
- #471 — Vercel-capxul-web preview-deploy systemic failure on api-first base (separate from epic).
|
|
74
|
+
|
|
75
|
+
## 0.1.0-alpha.3
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Re-export `tryCatch` from `@capxul/sdk`.
|
|
80
|
+
|
|
81
|
+
`tryCatch` is referenced in `packages/sdk/README.md` (live on npm at
|
|
82
|
+
`0.1.0-alpha.2`) and in `.claude/rules/sdk.md` as the canonical
|
|
83
|
+
async-error helper for SDK operations:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { tryCatch } from "@capxul/sdk";
|
|
87
|
+
|
|
88
|
+
const [err, payment] = await tryCatch(capxul.payments.create({ ... }));
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The helper lives at `@repo/observability/try-catch.ts` and is bundled
|
|
92
|
+
into the SDK dist via tsup `noExternal`, but it was never re-exported
|
|
93
|
+
from `packages/sdk/src/index.ts`. Consumers following the README example
|
|
94
|
+
hit `Module '"@capxul/sdk"' has no exported member 'tryCatch'.` at
|
|
95
|
+
import time.
|
|
96
|
+
|
|
97
|
+
Caught during alpha.2 spike-install verification (REVIEW.html, "What's
|
|
98
|
+
not proven" row 6). One-line public-export addition; no runtime change.
|
|
99
|
+
|
|
100
|
+
## 0.1.0-alpha.2
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- Add `convex` as a peer dependency.
|
|
105
|
+
|
|
106
|
+
`@capxul/sdk`'s bundled `_generated/api` snapshot calls
|
|
107
|
+
`anyApi` / `componentsGeneric` from `convex/server` at runtime — they
|
|
108
|
+
are not just types — and tsup correctly externalizes `convex` /
|
|
109
|
+
`convex/server` / `convex/react` so the consumer's own Convex install
|
|
110
|
+
is reused. The peer was missing from the published manifest, so
|
|
111
|
+
`require('@capxul/sdk')` failed with `Cannot find module 'convex/server'`
|
|
112
|
+
in any spike that hadn't already installed `convex`.
|
|
113
|
+
|
|
114
|
+
`@capxul/sdk-react` mirrors the peer because its bundle re-exports
|
|
115
|
+
flow-machine constructors from `@capxul/sdk` and may transitively
|
|
116
|
+
pull in the same module.
|
|
117
|
+
|
|
118
|
+
Caught during alpha.1 spike-install verification.
|
|
119
|
+
|
|
120
|
+
## 0.1.0-alpha.1
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- Move workspace `@repo/*` packages from `dependencies` to
|
|
125
|
+
`devDependencies` so the published `package.json` doesn't list them
|
|
126
|
+
as runtime deps. The tsup pipeline bundles every `@repo/*` import
|
|
127
|
+
inline (`noExternal`), so the published code has zero references to
|
|
128
|
+
those packages — but until now the published `package.json` still
|
|
129
|
+
declared them, and `npm install @capxul/sdk@0.1.0-alpha.0` failed
|
|
130
|
+
trying to resolve `@repo/api-contract@0.0.0` etc. on the public
|
|
131
|
+
registry.
|
|
132
|
+
|
|
133
|
+
`@capxul/sdk-react` keeps `@capxul/sdk` as a runtime dep — that one
|
|
134
|
+
is published.
|
|
135
|
+
|
|
136
|
+
No public surface changes. Pure publish-metadata correction caught
|
|
137
|
+
during alpha.0 spike-install verification.
|
|
138
|
+
|
|
3
139
|
Changelog managed by [changesets](https://github.com/changesets/changesets) —
|
|
4
140
|
see `.changeset/README.md` for the operator workflow.
|
|
5
141
|
|
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ pnpm add @capxul/sdk @capxul/sdk-react
|
|
|
19
19
|
React-flavored entry point lives in `@capxul/sdk-react`. Pick:
|
|
20
20
|
|
|
21
21
|
- **Browser apps (recommended).** Install both. Use
|
|
22
|
-
`<CapxulProvider
|
|
23
|
-
and the `useMe` / `useCapxulStatus` hooks.
|
|
24
|
-
README for the lazy-DX example.
|
|
22
|
+
`<CapxulProvider config={{ mode: "publishable-key", publishableKey }}>`
|
|
23
|
+
from `@capxul/sdk-react` and the `useMe` / `useCapxulStatus` hooks.
|
|
24
|
+
See that package's README for the lazy-DX example.
|
|
25
25
|
- **Server / CLI / scripts.** Install only `@capxul/sdk`. Build a
|
|
26
26
|
`CapxulClient` directly with your own auth and Convex adapters
|
|
27
27
|
(see "Server-side construction" below).
|
|
@@ -76,11 +76,93 @@ runtime URLs lazily — no need to ship secrets to the client:
|
|
|
76
76
|
```tsx
|
|
77
77
|
import { CapxulProvider, useMe, useCapxulStatus } from "@capxul/sdk-react";
|
|
78
78
|
|
|
79
|
-
<CapxulProvider
|
|
79
|
+
<CapxulProvider
|
|
80
|
+
config={{
|
|
81
|
+
mode: "publishable-key",
|
|
82
|
+
publishableKey: process.env.NEXT_PUBLIC_CAPXUL_PUBLISHABLE_KEY!,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
80
85
|
<App />
|
|
81
86
|
</CapxulProvider>;
|
|
82
87
|
```
|
|
83
88
|
|
|
89
|
+
## Publishable-key transport
|
|
90
|
+
|
|
91
|
+
The browser transport accepts a publishable key, then lazily resolves
|
|
92
|
+
runtime URLs by POSTing to `/v1/client/bootstrap` on the first auth or
|
|
93
|
+
`ensureRuntime()` call. The successful backend response is intentionally
|
|
94
|
+
small:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{ "authBaseUrl": "https://<deployment>.convex.site/api/auth", "convexUrl": "https://<deployment>.convex.cloud" }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The resolved runtime is cached for the lifetime of the transport. Concurrent
|
|
101
|
+
callers share one bootstrap request, successful resolutions are reused, and
|
|
102
|
+
failed bootstrap attempts reset so the next call can retry. Tests and
|
|
103
|
+
non-default deployments can inject both `fetchImpl` and an absolute
|
|
104
|
+
`bootstrapUrl`:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { makeHttpTransport, CapxulError } from "@capxul/sdk";
|
|
108
|
+
|
|
109
|
+
const transport = makeHttpTransport({
|
|
110
|
+
mode: "publishable-key",
|
|
111
|
+
publishableKey: process.env.NEXT_PUBLIC_CAPXUL_PUBLISHABLE_KEY!,
|
|
112
|
+
bootstrapUrl: "https://api.capxul.com/v1/client/bootstrap",
|
|
113
|
+
fetchImpl: fetch,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
await transport.ensureRuntime();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Local setup errors and backend bootstrap errors both use `CapxulError`, but
|
|
120
|
+
carry different `details.source` values:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
try {
|
|
124
|
+
await transport.ensureRuntime();
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error instanceof CapxulError) {
|
|
127
|
+
if (error.details?.source === "sdk-config") {
|
|
128
|
+
// Missing or malformed local config, such as publishableKey or bootstrapUrl.
|
|
129
|
+
}
|
|
130
|
+
if (error.details?.source === "backend-bootstrap") {
|
|
131
|
+
// Sanitized backend refusal, such as NOT_AUTHENTICATED or PERMISSION_DENIED.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Runtime proof status:
|
|
138
|
+
|
|
139
|
+
| Surface | Source support | Runtime proof | Status |
|
|
140
|
+
|---|---|---|---|
|
|
141
|
+
| SDK transport | `makeHttpTransport({ mode: "publishable-key", publishableKey })` | `packages/sdk/tests/unit/transport.test.ts` proves config validation, singleflight bootstrap, retry after failure, lifecycle transitions, and sanitized backend errors. | Proven with mocked fetch |
|
|
142
|
+
| React provider | `CapxulProvider config={{ mode: "publishable-key", ... }}` | `packages/sdk-react/ops/proof/react-headless.test.tsx` proves bootstrap before a real `useMe()` read through the provider and lazy Convex data client. | Proven with mocked fetch + headless React |
|
|
143
|
+
| Reference CLI | `bootstrap probe --mock --json` | `apps/reference-cli/scripts/agent-driver.ts` phase 0 and the direct CLI command prove provider/bootstrap/auth ordering and sanitized output. | Proven locally; live endpoint remains manual-key gated |
|
|
144
|
+
|
|
145
|
+
Copy-paste local replication:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
corepack pnpm --filter @capxul/sdk check-types
|
|
149
|
+
corepack pnpm --filter @capxul/sdk build
|
|
150
|
+
corepack pnpm --filter @capxul/sdk-react check-types
|
|
151
|
+
corepack pnpm --filter @capxul/sdk-react build
|
|
152
|
+
corepack pnpm --filter @capxul/reference-cli check-types
|
|
153
|
+
corepack pnpm --filter @capxul/reference-cli build
|
|
154
|
+
node apps/reference-cli/dist/cli.js bootstrap probe --mock --json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Run the SDK and React SDK builds before the reference CLI typecheck in a
|
|
158
|
+
fresh checkout; the CLI depends on their generated declaration outputs.
|
|
159
|
+
|
|
160
|
+
Expected sanitized pass signal:
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{"command":"bootstrap.probe","ok":true,"mode":"publishable-key","status":"ready","bootstrapRequests":1,"authRequests":1,"keyLengthClass":"provided","mocked":true}
|
|
164
|
+
```
|
|
165
|
+
|
|
84
166
|
## Public surface (alpha)
|
|
85
167
|
|
|
86
168
|
```ts
|
|
@@ -90,7 +172,7 @@ capxul.accounts // create, retrieve, list
|
|
|
90
172
|
capxul.organizations // CRUD + members + payments + treasury
|
|
91
173
|
capxul.payments // create, retrieve, list
|
|
92
174
|
capxul.invoices // create, retrieve, list
|
|
93
|
-
capxul.withdrawals //
|
|
175
|
+
capxul.withdrawals // create, retrieve, list
|
|
94
176
|
capxul.documents // KYC uploads, invoices, receipts, tax forms
|
|
95
177
|
capxul.flows.{auth, onboarding, provisioning} // XState v5 flows
|
|
96
178
|
```
|