@certen.io/sdk 0.5.0 → 0.7.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/CHANGELOG.md +599 -0
- package/README.md +133 -119
- package/dist/client.d.ts +96 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +258 -20
- package/dist/client.js.map +1 -1
- package/dist/doctor.d.ts +53 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +451 -0
- package/dist/doctor.js.map +1 -0
- package/dist/error-codes.d.ts +14 -0
- package/dist/error-codes.d.ts.map +1 -0
- package/dist/error-codes.js +55 -0
- package/dist/error-codes.js.map +1 -0
- package/dist/errors.d.ts +13 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -1
- package/dist/errors.js.map +1 -1
- package/dist/funding.d.ts +43 -0
- package/dist/funding.d.ts.map +1 -0
- package/dist/funding.js +116 -0
- package/dist/funding.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/oauth.d.ts +56 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +68 -0
- package/dist/oauth.js.map +1 -0
- package/dist/registration.d.ts +33 -0
- package/dist/registration.d.ts.map +1 -0
- package/dist/registration.js +49 -0
- package/dist/registration.js.map +1 -0
- package/dist/resources/admin.d.ts +52 -1
- package/dist/resources/admin.d.ts.map +1 -1
- package/dist/resources/admin.js +55 -0
- package/dist/resources/admin.js.map +1 -1
- package/dist/resources/billing.d.ts +198 -19
- package/dist/resources/billing.d.ts.map +1 -1
- package/dist/resources/billing.js +297 -7
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/chains.d.ts +38 -0
- package/dist/resources/chains.d.ts.map +1 -0
- package/dist/resources/chains.js +46 -0
- package/dist/resources/chains.js.map +1 -0
- package/dist/resources/device.d.ts +43 -0
- package/dist/resources/device.d.ts.map +1 -0
- package/dist/resources/device.js +49 -0
- package/dist/resources/device.js.map +1 -0
- package/dist/resources/execute.d.ts +10 -0
- package/dist/resources/execute.d.ts.map +1 -1
- package/dist/resources/execute.js +28 -6
- package/dist/resources/execute.js.map +1 -1
- package/dist/resources/health.d.ts +34 -0
- package/dist/resources/health.d.ts.map +1 -0
- package/dist/resources/health.js +43 -0
- package/dist/resources/health.js.map +1 -0
- package/dist/resources/identity.d.ts +83 -2
- package/dist/resources/identity.d.ts.map +1 -1
- package/dist/resources/identity.js +154 -2
- package/dist/resources/identity.js.map +1 -1
- package/dist/resources/oauth-clients.d.ts +71 -0
- package/dist/resources/oauth-clients.d.ts.map +1 -0
- package/dist/resources/oauth-clients.js +75 -0
- package/dist/resources/oauth-clients.js.map +1 -0
- package/dist/resources/pending.d.ts +13 -1
- package/dist/resources/pending.d.ts.map +1 -1
- package/dist/resources/pending.js +15 -0
- package/dist/resources/pending.js.map +1 -1
- package/dist/resources/proof.d.ts +82 -0
- package/dist/resources/proof.d.ts.map +1 -0
- package/dist/resources/proof.js +112 -0
- package/dist/resources/proof.js.map +1 -0
- package/dist/resources/registration-tokens.d.ts +51 -0
- package/dist/resources/registration-tokens.d.ts.map +1 -0
- package/dist/resources/registration-tokens.js +54 -0
- package/dist/resources/registration-tokens.js.map +1 -0
- package/dist/resources/sign.d.ts.map +1 -1
- package/dist/resources/sign.js +12 -7
- package/dist/resources/sign.js.map +1 -1
- package/dist/resources/transaction.d.ts +20 -0
- package/dist/resources/transaction.d.ts.map +1 -1
- package/dist/resources/transaction.js +28 -0
- package/dist/resources/transaction.js.map +1 -1
- package/dist/resources/transparency.d.ts +68 -0
- package/dist/resources/transparency.d.ts.map +1 -0
- package/dist/resources/transparency.js +83 -0
- package/dist/resources/transparency.js.map +1 -0
- package/dist/resources/webhooks.d.ts +97 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +112 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/self-signup.d.ts +66 -0
- package/dist/self-signup.d.ts.map +1 -0
- package/dist/self-signup.js +76 -0
- package/dist/self-signup.js.map +1 -0
- package/dist/shared-proof.d.ts +34 -0
- package/dist/shared-proof.d.ts.map +1 -0
- package/dist/shared-proof.js +78 -0
- package/dist/shared-proof.js.map +1 -0
- package/dist/sign-target.d.ts +34 -0
- package/dist/sign-target.d.ts.map +1 -0
- package/dist/sign-target.js +41 -0
- package/dist/sign-target.js.map +1 -0
- package/dist/types.d.ts +831 -22
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-receipt.d.ts +32 -0
- package/dist/verify-receipt.d.ts.map +1 -0
- package/dist/verify-receipt.js +176 -0
- package/dist/verify-receipt.js.map +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,119 +1,133 @@
|
|
|
1
|
-
# @certen.io/sdk
|
|
2
|
-
|
|
3
|
-
TypeScript client for the [CERTEN Gateway](https://gateway.kompendium.co/reference) — proof-gated
|
|
4
|
-
cross-chain execution on Accumulate.
|
|
5
|
-
|
|
6
|
-
**Docs: <https://docs.kompendium.co>** · **Get an API key: <https://gateway.kompendium.co/portal>**
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install @certen.io/sdk
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
import { CertenClient } from '@certen.io/sdk';
|
|
14
|
-
|
|
15
|
-
const certen = new CertenClient({ apiKey: process.env.CERTEN_API_KEY! });
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
1
|
+
# @certen.io/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript client for the [CERTEN Gateway](https://gateway.kompendium.co/reference) — proof-gated
|
|
4
|
+
cross-chain execution on Accumulate.
|
|
5
|
+
|
|
6
|
+
**Docs: <https://docs.kompendium.co>** · **Get an API key: <https://gateway.kompendium.co/portal>**
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @certen.io/sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { CertenClient } from '@certen.io/sdk';
|
|
14
|
+
|
|
15
|
+
const certen = new CertenClient({ apiKey: process.env.CERTEN_API_KEY! });
|
|
16
|
+
|
|
17
|
+
// One call: opens the intent, signs what comes back, submits the signature.
|
|
18
|
+
const { intentId } = await certen.execute.transfer({
|
|
19
|
+
identityId,
|
|
20
|
+
adiUrl: 'acc://your-org.acme',
|
|
21
|
+
fromChain: 'accumulate',
|
|
22
|
+
toChain: 'base-sepolia',
|
|
23
|
+
fromAddress: abstractAccount, // the identity's account on the destination chain
|
|
24
|
+
toAddress: '0xBe00…9251',
|
|
25
|
+
amount: '0.001', // WHOLE units, as a string
|
|
26
|
+
sign: (hashHex) => ed25519Sign(hashHex), // YOU hold the key
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await certen.execute.wait(intentId); // ~60-110s of real validator work
|
|
30
|
+
const proof = await certen.execute.proof(intentId); // hand this to your counterparty
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Prefer `execute.*` — it is the same flow every integration writes, with the details that are easy to
|
|
34
|
+
get wrong already handled. The raw resources are there when you need to drive the steps yourself:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const opened = await certen.transaction.create({ identityId, intent });
|
|
38
|
+
// `signing_data` is absent in provider mode, where the gateway holds the key and there is
|
|
39
|
+
// nothing for you to sign.
|
|
40
|
+
const hash = opened.signing_data?.hash_to_sign;
|
|
41
|
+
if (!hash) throw new Error('provider mode: no signature required from you');
|
|
42
|
+
await certen.transaction.submitSignature(opened.intent_id, {
|
|
43
|
+
signature: ed25519Sign(hash),
|
|
44
|
+
publicKey,
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Your key never leaves your process.** The gateway computes what must be signed and you decide whether to
|
|
49
|
+
sign it. That is the supported posture for anything carrying value — see
|
|
50
|
+
[the external-signing guide](https://docs.kompendium.co/external-signing.html).
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
new CertenClient({
|
|
58
|
+
apiKey: 'ck_live_…', // required
|
|
59
|
+
baseUrl: 'https://…', // optional — see precedence below
|
|
60
|
+
maxRetries: 3, // default 3
|
|
61
|
+
baseBackoffMs: 250,
|
|
62
|
+
maxBackoffMs: 8_000,
|
|
63
|
+
autoIdempotencyKey: true, // default: every POST gets one
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Base URL precedence:** `options.baseUrl` → `$CERTEN_API_URL` → `https://gateway.kompendium.co`. The env var
|
|
68
|
+
is there so a deployment can be retargeted at staging or a self-hosted gateway without a code change.
|
|
69
|
+
|
|
70
|
+
## What it does for you
|
|
71
|
+
|
|
72
|
+
**Automatic idempotency on POSTs.** Every POST gets a generated `Idempotency-Key` so a retried network error
|
|
73
|
+
is safe to replay. This matters more than it sounds: without one, a timeout is indistinguishable from success,
|
|
74
|
+
and a blind retry can open a second intent or burn identity quota. Opt out per-client with
|
|
75
|
+
`autoIdempotencyKey: false`, or per-route with `noAutoIdempotencyRoutes`.
|
|
76
|
+
|
|
77
|
+
**Retries with backoff, and rate-limit awareness.** Transient failures retry with exponential backoff. On a
|
|
78
|
+
`429` the client remembers the reset window and pre-emptively waits rather than hammering.
|
|
79
|
+
|
|
80
|
+
**Typed errors.** Catch the class you care about instead of matching on status codes:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { CertenAuthError, CertenRateLimitError, CertenBadRequestError, CertenServerError } from '@certen.io/sdk';
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
await certen.identity.create({ … });
|
|
87
|
+
} catch (e) {
|
|
88
|
+
if (e instanceof CertenBadRequestError) { /* your request — fix and retry */ }
|
|
89
|
+
if (e instanceof CertenRateLimitError) { /* back off; e carries the reset */ }
|
|
90
|
+
if (e instanceof CertenAuthError) { /* key is wrong, revoked, or lacks the scope */ }
|
|
91
|
+
if (e instanceof CertenServerError) { /* gateway or downstream — safe to retry */ }
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Pagination helpers.** `paginate` and `paginateWithTotal` iterate a paged endpoint as an async generator.
|
|
96
|
+
|
|
97
|
+
## Resources
|
|
98
|
+
|
|
99
|
+
| | |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `certen.identity` | `create` · `get` · `update` · `retire` |
|
|
102
|
+
| `certen.transaction` | `create` · `submitSignature` · `get` · `list` |
|
|
103
|
+
| `certen.sign` | `create` · `submitSignature` |
|
|
104
|
+
| `certen.governance` | `create` · `submitSignature` · `get` |
|
|
105
|
+
| `certen.pending` | `list` |
|
|
106
|
+
| `certen.portfolio` | `get` |
|
|
107
|
+
| `certen.admin` | `createOrg` · `createApiKey` · `listApiKeys` · `revokeApiKey` · `rotateApiKey` · `getAuditLog` · `getUsage` |
|
|
108
|
+
|
|
109
|
+
The gateway serves ~80 endpoints; this covers the integration surface. For anything else, the
|
|
110
|
+
[live spec](https://gateway.kompendium.co/docs/json) is authoritative and the client's `request` path will
|
|
111
|
+
carry it.
|
|
112
|
+
|
|
113
|
+
## Three things to know
|
|
114
|
+
|
|
115
|
+
**Identity creation is asynchronous.** `identity.create` resolves with a `202`-shaped result and provisioning
|
|
116
|
+
continues. Poll `identity.get` until the status is terminal, and check `can_sign` before building on it.
|
|
117
|
+
|
|
118
|
+
**A proof cycle takes ~60–110 seconds.** Real validator work, not a tunable delay. Do not wrap it in a 30s
|
|
119
|
+
timeout.
|
|
120
|
+
|
|
121
|
+
**`vote` is `approve` | `reject` | `abstain`** — a lowercase string, not a number, and not `accept`.
|
|
122
|
+
|
|
123
|
+
## Guides
|
|
124
|
+
|
|
125
|
+
- [Onboard an identity](https://docs.kompendium.co/onboard-an-identity.html)
|
|
126
|
+
- [Sign while holding your own key](https://docs.kompendium.co/external-signing.html)
|
|
127
|
+
- [Proof-gate a contract call](https://docs.kompendium.co/proof-gated-contract-call.html)
|
|
128
|
+
- [M-of-N panels](https://docs.kompendium.co/multisig-panel.html)
|
|
129
|
+
- [Verify a proof](https://docs.kompendium.co/verify-a-proof.html)
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
MIT
|
package/dist/client.d.ts
CHANGED
|
@@ -7,7 +7,16 @@ import { PortfolioResource } from './resources/portfolio.js';
|
|
|
7
7
|
import { BillingResource } from './resources/billing.js';
|
|
8
8
|
import { AdminResource } from './resources/admin.js';
|
|
9
9
|
import { ExecuteResource } from './resources/execute.js';
|
|
10
|
-
import
|
|
10
|
+
import { ChainsResource } from './resources/chains.js';
|
|
11
|
+
import { TransparencyResource } from './resources/transparency.js';
|
|
12
|
+
import { HealthResource } from './resources/health.js';
|
|
13
|
+
import { WebhooksResource } from './resources/webhooks.js';
|
|
14
|
+
import { ProofResource } from './resources/proof.js';
|
|
15
|
+
import { DeviceResource } from './resources/device.js';
|
|
16
|
+
import { OAuthClientsResource } from './resources/oauth-clients.js';
|
|
17
|
+
import { RegistrationTokensResource } from './resources/registration-tokens.js';
|
|
18
|
+
import { type DoctorReport } from './doctor.js';
|
|
19
|
+
import type { CertenClientOptions, MeResponse } from './types.js';
|
|
11
20
|
/**
|
|
12
21
|
* The gateway this SDK talks to when the caller does not say.
|
|
13
22
|
*
|
|
@@ -38,6 +47,79 @@ export declare class CertenClient {
|
|
|
38
47
|
billing: BillingResource;
|
|
39
48
|
/** The proof-gated execution flow as one call: open, sign, submit, poll, prove. See resources/execute.ts. */
|
|
40
49
|
execute: ExecuteResource;
|
|
50
|
+
/** The public contract registry — which chains CERTEN is on, and where. Needs no API key. */
|
|
51
|
+
chains: ChainsResource;
|
|
52
|
+
/**
|
|
53
|
+
* The public transparency log — signed tree heads, consistency proofs, published price books.
|
|
54
|
+
* What makes a receipt checkable rather than merely signed. Needs no API key.
|
|
55
|
+
*/
|
|
56
|
+
transparency: TransparencyResource;
|
|
57
|
+
/**
|
|
58
|
+
* Whether CERTEN can serve right now, and what is wrong when it cannot. Needs no API key —
|
|
59
|
+
* a caller whose credential is rejected can still learn whether the platform is the problem.
|
|
60
|
+
*/
|
|
61
|
+
health: HealthResource;
|
|
62
|
+
/**
|
|
63
|
+
* Webhook endpoints and their delivery history. The gateway has pushed events all along; nothing
|
|
64
|
+
* on this side could register an endpoint or see why a delivery failed.
|
|
65
|
+
*/
|
|
66
|
+
webhooks: WebhooksResource;
|
|
67
|
+
/** Reading and sharing proofs. See resources/proof.ts. */
|
|
68
|
+
proof: ProofResource;
|
|
69
|
+
/** Device authorization, so a terminal can obtain its own key. Needs no API key. */
|
|
70
|
+
device: DeviceResource;
|
|
71
|
+
/**
|
|
72
|
+
* The OAuth2 clients your organization owns. Tokens could be obtained and revoked from code all
|
|
73
|
+
* along; the client that issues them could only be created by hand in the portal.
|
|
74
|
+
*/
|
|
75
|
+
oauthClients: OAuthClientsResource;
|
|
76
|
+
/**
|
|
77
|
+
* Registration tokens — letting a new organization be created without a browser. Minting needs
|
|
78
|
+
* `org:invite`; redeeming needs nothing, and is the standalone `redeemRegistrationToken`.
|
|
79
|
+
*/
|
|
80
|
+
registrationTokens: RegistrationTokensResource;
|
|
81
|
+
/**
|
|
82
|
+
* Diagnose this setup and say what is blocking it.
|
|
83
|
+
*
|
|
84
|
+
* Never throws for a failed check — a diagnosis that cannot report a broken setup is useless.
|
|
85
|
+
* `report.ok` is false when something failed; warnings do not clear it and do not set it.
|
|
86
|
+
* See doctor.ts for what each check exists to catch.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Who this credential is, and what it may do.
|
|
90
|
+
*
|
|
91
|
+
* One call, and the only way to learn your own organization and scopes. It accepted a portal
|
|
92
|
+
* session only until the gateway's 2026-08 change, so a machine holding an API key could not ask
|
|
93
|
+
* — clients resorted to probing endpoints and reading the 403s to guess what they were allowed
|
|
94
|
+
* to do.
|
|
95
|
+
*
|
|
96
|
+
* Check `scopes` before a flow rather than after: a missing scope surfaces otherwise as a 403
|
|
97
|
+
* partway through, when some of the work may already have happened.
|
|
98
|
+
*/
|
|
99
|
+
me(): Promise<MeResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* How this client authenticates. Set once at construction.
|
|
102
|
+
*
|
|
103
|
+
* Not readonly-by-type only for the minted token, which is replaced as it is refreshed.
|
|
104
|
+
*/
|
|
105
|
+
private auth;
|
|
106
|
+
/** The current minted token and when it stops being usable. */
|
|
107
|
+
private minted?;
|
|
108
|
+
/** In-flight mint, so N concurrent requests cause ONE token request rather than N. */
|
|
109
|
+
private minting?;
|
|
110
|
+
/**
|
|
111
|
+
* A usable bearer token, minting or re-minting as needed.
|
|
112
|
+
*
|
|
113
|
+
* Re-mints 60 seconds BEFORE expiry rather than on the 401 that expiry would otherwise cause.
|
|
114
|
+
* Waiting for the rejection means at least one request fails for a reason the caller can do
|
|
115
|
+
* nothing about, and on a long-running agent that is a failure every hour, forever.
|
|
116
|
+
*
|
|
117
|
+
* The single-flight guard matters more than it looks: a process that fires ten concurrent calls
|
|
118
|
+
* on a cold client would otherwise mint ten tokens, and every one but the last is immediately
|
|
119
|
+
* abandoned — an invisible leak of live credentials.
|
|
120
|
+
*/
|
|
121
|
+
private bearerToken;
|
|
122
|
+
doctor(): Promise<DoctorReport>;
|
|
41
123
|
constructor(options: CertenClientOptions & {
|
|
42
124
|
maxRetries?: number;
|
|
43
125
|
baseBackoffMs?: number;
|
|
@@ -60,16 +142,24 @@ export declare class CertenClient {
|
|
|
60
142
|
});
|
|
61
143
|
}
|
|
62
144
|
/**
|
|
63
|
-
* Async iterator helper for paginated list endpoints.
|
|
64
|
-
* `paginateWithTotal` exposes `{ item, index, total }` for progress UIs that
|
|
65
|
-
* need to render "27 of 412". When the server doesn't return `total`, the
|
|
66
|
-
* yielded object's `total` is undefined.
|
|
145
|
+
* Async iterator helper for paginated list endpoints.
|
|
67
146
|
*
|
|
68
|
-
*
|
|
147
|
+
* **Prefer the `listAll()` method on the resource** — `certen.transaction.listAll()`,
|
|
148
|
+
* `certen.pending.listAll()`. They call this internally and need no adapter.
|
|
149
|
+
*
|
|
150
|
+
* This takes a callback returning `{ items }`, and no SDK method returns that shape: `list()`
|
|
151
|
+
* returns `{ transactions }`, `shares()` returns `{ shares }`. So using it directly meant writing
|
|
152
|
+
* the adapter that should have shipped with it. Since 0.7.0 that adapter lives on the resources,
|
|
153
|
+
* and this stays exported for list endpoints the SDK does not model yet, and for callers paginating
|
|
154
|
+
* their own API.
|
|
155
|
+
*
|
|
156
|
+
* `paginateWithTotal` exposes `{ item, index, total }` for progress UIs that need to render
|
|
157
|
+
* "27 of 412". When the server does not return `total`, the yielded object's `total` is undefined.
|
|
69
158
|
*/
|
|
70
159
|
export declare function paginate<T>(fetchPage: (limit: number, offset: number) => Promise<{
|
|
71
160
|
items: T[];
|
|
72
161
|
total?: number;
|
|
162
|
+
hasMore?: boolean;
|
|
73
163
|
}>, pageSize?: number): AsyncIterableIterator<T>;
|
|
74
164
|
export declare function paginateWithTotal<T>(fetchPage: (limit: number, offset: number) => Promise<{
|
|
75
165
|
items: T[];
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAA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