@withone/sdk 0.0.4 → 0.3.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/README.md CHANGED
@@ -42,8 +42,20 @@ console.log(res.status, res.data)
42
42
  compile. Const headers the action requires are injected for you, never asked.
43
43
  - **Connections.** `one.connection(key)` scopes a call to a connection; the key
44
44
  is sent as `X-One-Connection-Key`.
45
- - **From the environment.** `One.fromEnv()` reads `ONE_SECRET` and the optional
46
- `ONE_BASE_URL`.
45
+ - **From the environment.** `One.fromEnv()` reads `ONE_SECRET` or
46
+ `ONE_ACCESS_TOKEN` for the credential, plus the optional `ONE_BASE_URL`.
47
+ `ONE_SECRET` wins when both are set, since it is the broader of the two.
48
+ - **On a user's grant.** `One.withAccessToken(token)` authenticates with an
49
+ OAuth access token instead of a secret key. What it can reach is whatever
50
+ that user consented to, not the whole account.
51
+ - **Tenant scope.** A secret key carries its tenant server-side, so nothing
52
+ extra is needed. An access token does not: one token can hold grants on
53
+ several organizations, so a request that names none resolves to the user's
54
+ personal scope and an organization-owned connection reads as absent rather
55
+ than erroring. **Not selectable from Node yet** - the Rust client has
56
+ `OneBuilder::organization` / `::project`, but `ClientOptions` does not carry
57
+ them, so a token-authenticated Node client is limited to the user's own
58
+ connections for now.
47
59
 
48
60
  ### Overrides
49
61
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,409 @@
1
- import { RetryConfig, JsonValue, ClientOptions as ClientOptions$1, One as One$1 } from '../native.js';
1
+ import { JsonValue, RetryConfig, ClientOptions as ClientOptions$1, One as One$1 } from '../native.js';
2
2
  export { JsonValue, RetryConfig } from '../native.js';
3
3
  import { A as Action, a as ActionCall } from './action-arV2Nfkm.mjs';
4
4
 
5
+ /** A failed SDK operation with stable transport and retry metadata. */
6
+ declare class OneError extends Error {
7
+ /** Stable error kind (`status`, `timeout`, `transport`, `missing_secret`, ...). */
8
+ readonly code: string;
9
+ /** Upstream HTTP status, for an upstream (`status`) failure. */
10
+ readonly status: number | undefined;
11
+ /** Upstream response body, for an upstream (`status`) failure. */
12
+ readonly body: string | undefined;
13
+ /** Whether retrying the call might succeed. */
14
+ readonly retryable: boolean;
15
+ constructor(
16
+ /** Stable error kind (`status`, `timeout`, `transport`, `missing_secret`, ...). */
17
+ code: string, message: string,
18
+ /** Upstream HTTP status, for an upstream (`status`) failure. */
19
+ status: number | undefined,
20
+ /** Upstream response body, for an upstream (`status`) failure. */
21
+ body: string | undefined,
22
+ /** Whether retrying the call might succeed. */
23
+ retryable: boolean);
24
+ }
25
+
26
+ /** A verified delivery handed to your handlers. */
27
+ interface Delivery<P = JsonValue> {
28
+ /** On-the-wire event string (`connection.created`, ...). */
29
+ readonly event: string;
30
+ /** Stable delivery id, identical on every retry. Deduplicate on it. */
31
+ readonly id: string;
32
+ /** When One emitted the event. */
33
+ readonly timestamp: Date;
34
+ /** The event-specific payload. */
35
+ readonly payload: P;
36
+ /**
37
+ * Metadata recorded on the event when it was captured, if any. This is the
38
+ * event's own metadata - a subscription's `metadata` field is not echoed back
39
+ * on delivery.
40
+ */
41
+ readonly metadata: JsonValue | null;
42
+ /**
43
+ * The connection this delivery concerns, for events that carry one. `null`
44
+ * for account-level events and for an `oauth.failed` that fired before the
45
+ * connection existed.
46
+ */
47
+ readonly connection: string | null;
48
+ /**
49
+ * Whether this is a test delivery from the dashboard's "send test" action.
50
+ *
51
+ * A test delivery reuses a real event name but carries a synthetic payload,
52
+ * so typed handlers are skipped for it and only `onAny` runs.
53
+ */
54
+ readonly isTest: boolean;
55
+ }
56
+ /** A webhook handler. May be async; `handle` awaits it. */
57
+ type Handler<P = JsonValue> = (delivery: Delivery<P>) => void | Promise<void>;
58
+ /** Options for a webhook listener. */
59
+ interface WebhookOptions {
60
+ /** The subscription's signing secret, used to verify every delivery. */
61
+ secret: string;
62
+ /**
63
+ * Rejects deliveries whose *event* is older than this many milliseconds.
64
+ *
65
+ * **Off by default, and not replay protection.** The signed timestamp is when
66
+ * the event occurred, not when the attempt was sent, so any limit starts
67
+ * rejecting authentic deliveries once the delivery queue falls behind.
68
+ * Deduplicate on `Delivery.id` instead - it is stable across retries.
69
+ */
70
+ toleranceMs?: number;
71
+ }
72
+ interface Registered {
73
+ connection: string | null;
74
+ run: Handler;
75
+ }
76
+ /**
77
+ * Registry and dispatch for webhook deliveries.
78
+ *
79
+ * Signature checking, the tolerance window, and envelope parsing live in the
80
+ * native client so the Rust and TypeScript SDKs cannot drift on them. Only the
81
+ * handler registry is here, because handlers are closures and those should not
82
+ * cross the native boundary.
83
+ */
84
+ declare class WebhooksBase {
85
+ private readonly client;
86
+ private readonly options;
87
+ protected readonly handlers: Map<string, Registered[]>;
88
+ protected readonly anyHandlers: Registered[];
89
+ constructor(client: One, options: WebhookOptions);
90
+ /** @internal Registers a typed handler; generated methods wrap this. */
91
+ protected register(event: string, connection: string | null, run: Handler): this;
92
+ /**
93
+ * Registers handlers scoped to one connection: they fire only for deliveries
94
+ * carrying that connection's key.
95
+ *
96
+ * The block keeps the scope lexical, so a reader never has to scan backwards
97
+ * to work out which connection a handler belongs to, and only the
98
+ * connection-carrying events are offered inside it.
99
+ */
100
+ connection(key: string, block: (scope: ConnectionWebhooksBase) => unknown): this;
101
+ /** @internal The generated subclass supplies its own scope type. */
102
+ protected scopeConstructor(): new (key: string) => ConnectionWebhooksBase;
103
+ /**
104
+ * Registers a handler fired for every verified delivery, including event
105
+ * types this SDK build does not recognize. Runs after event-specific
106
+ * handlers.
107
+ */
108
+ onAny(handler: Handler): this;
109
+ /**
110
+ * The event types `listen` subscribes to.
111
+ *
112
+ * An unscoped catch-all subscribes to this build's whole catalog; the server
113
+ * matches exact event strings, so events added after this build are not
114
+ * covered. A catch-all scoped to a connection adds only the
115
+ * connection-carrying events, since the server cannot filter by connection
116
+ * and the rest would just be discarded on arrival.
117
+ */
118
+ events(): string[];
119
+ /** @internal The generated subclass supplies the full event catalog. */
120
+ protected catalog(): readonly string[];
121
+ /** @internal The generated subclass supplies the connection-carrying subset. */
122
+ protected connectionCatalog(): readonly string[];
123
+ /**
124
+ * Verifies the signature and freshness of a delivery without dispatching.
125
+ * Use it when you want to route deliveries yourself.
126
+ *
127
+ * `rawBody` must be the exact bytes One sent. A JSON body parser that has
128
+ * already re-serialized the request will fail verification.
129
+ */
130
+ verify(rawBody: Buffer, signature: string): Delivery;
131
+ /**
132
+ * Verifies, parses, and dispatches a delivery to every handler registered for
133
+ * its event type, then to the catch-all handlers. Handlers run sequentially
134
+ * and are awaited.
135
+ */
136
+ handle(rawBody: Buffer, signature: string): Promise<Delivery>;
137
+ /**
138
+ * Registers this listener with One under the stable name `key`, pointing at
139
+ * `url` and subscribing to exactly the events handlers were attached for.
140
+ *
141
+ * Idempotent: calling it on every boot reconciles the one listener named
142
+ * `key` rather than accumulating duplicates.
143
+ */
144
+ listen(key: string, url: string): Promise<JsonValue>;
145
+ }
146
+ /** Handlers scoped to a single connection. */
147
+ declare class ConnectionWebhooksBase {
148
+ protected readonly key: string;
149
+ private readonly handlers;
150
+ private readonly anyHandlers;
151
+ constructor(key: string);
152
+ /** @internal Registers a typed handler; generated methods wrap this. */
153
+ protected register(event: string, run: Handler): this;
154
+ /** Registers a handler for every event concerning this connection. */
155
+ onAny(handler: Handler): this;
156
+ /** @internal Hands the collected handlers to the parent registry. */
157
+ drain(): Map<string, Registered[]>;
158
+ /** @internal Hands the collected catch-all handlers to the parent registry. */
159
+ drainAny(): Registered[];
160
+ }
161
+
162
+ /**
163
+ * Identifies the key without ever carrying its material - the secret exists
164
+ * only in the create response, never in a delivery.
165
+ */
166
+ interface ApiKeyCreatedPayload {
167
+ connection_type: string;
168
+ created_at: string;
169
+ environment: string;
170
+ event_access_id: string;
171
+ name?: string | null;
172
+ organization_id?: string | null;
173
+ project_id?: string | null;
174
+ }
175
+ interface ApiKeyRevokedPayload {
176
+ connection_type: string;
177
+ environment: string;
178
+ event_access_id: string;
179
+ name?: string | null;
180
+ organization_id?: string | null;
181
+ project_id?: string | null;
182
+ revoked_at: string;
183
+ }
184
+ interface ConnectionCreatedPayload {
185
+ connection_id: string;
186
+ connection_type: string;
187
+ created_at: string;
188
+ environment: string;
189
+ key: string;
190
+ name?: string | null;
191
+ organization_id?: string | null;
192
+ platform: string;
193
+ project_id?: string | null;
194
+ state: string;
195
+ }
196
+ interface ConnectionDeletedPayload {
197
+ connection_id: string;
198
+ deleted_at: string;
199
+ key?: string | null;
200
+ name?: string | null;
201
+ organization_id?: string | null;
202
+ platform: string;
203
+ project_id?: string | null;
204
+ }
205
+ interface ConnectionOAuthCreatedPayload {
206
+ authorized_at: string;
207
+ connection_id: string;
208
+ key: string;
209
+ platform: string;
210
+ user_id: string;
211
+ }
212
+ /**
213
+ * Carries the connection's state after the change, so a subscriber can apply
214
+ * it without refetching.
215
+ */
216
+ interface ConnectionUpdatedPayload {
217
+ connection_id: string;
218
+ key: string;
219
+ name?: string | null;
220
+ organization_id?: string | null;
221
+ platform: string;
222
+ project_id?: string | null;
223
+ tags: string[];
224
+ updated_at: string;
225
+ }
226
+ interface MemberAddedPayload {
227
+ added_at: string;
228
+ email: string;
229
+ organization_id?: string | null;
230
+ organization_name?: string | null;
231
+ project_id?: string | null;
232
+ project_name?: string | null;
233
+ user_id: string;
234
+ }
235
+ interface MemberRemovedPayload {
236
+ email: string;
237
+ organization_id?: string | null;
238
+ organization_name?: string | null;
239
+ project_id?: string | null;
240
+ project_name?: string | null;
241
+ removed_at: string;
242
+ user_id: string;
243
+ }
244
+ interface MemberRoleUpdatedPayload {
245
+ email: string;
246
+ new_role: string;
247
+ old_role: string;
248
+ organization_id?: string | null;
249
+ organization_name?: string | null;
250
+ project_id?: string | null;
251
+ project_name?: string | null;
252
+ updated_at: string;
253
+ user_id: string;
254
+ }
255
+ interface OAuthFailedPayload {
256
+ connection_id?: string | null;
257
+ error: string;
258
+ failed_at: string;
259
+ key?: string | null;
260
+ platform: string;
261
+ }
262
+ interface OAuthRefreshedPayload {
263
+ connection_id: string;
264
+ key?: string | null;
265
+ platform: string;
266
+ refreshed_at: string;
267
+ }
268
+ interface OrganizationCreatedPayload {
269
+ created_at: string;
270
+ id: string;
271
+ name: string;
272
+ }
273
+ interface OrganizationDeletedPayload {
274
+ deleted_at: string;
275
+ id: string;
276
+ name: string;
277
+ }
278
+ interface OrganizationUpdatedPayload {
279
+ id: string;
280
+ name: string;
281
+ updated_at: string;
282
+ }
283
+ interface PassthroughExecutedPayload {
284
+ connection_id: string;
285
+ duration_ms: number;
286
+ error?: string | null;
287
+ key?: string | null;
288
+ method: string;
289
+ path: string;
290
+ platform: string;
291
+ status_code?: number | null;
292
+ timestamp: string;
293
+ }
294
+ interface ProjectCreatedPayload {
295
+ created_at: string;
296
+ id: string;
297
+ name: string;
298
+ organization_id: string;
299
+ }
300
+ interface ProjectDeletedPayload {
301
+ deleted_at: string;
302
+ id: string;
303
+ name: string;
304
+ organization_id: string;
305
+ }
306
+ interface ProjectUpdatedPayload {
307
+ id: string;
308
+ name: string;
309
+ organization_id: string;
310
+ updated_at: string;
311
+ }
312
+ /** Every event a One webhook subscription can deliver. */
313
+ type WebhookEventType = 'api_key.created' | 'api_key.revoked' | 'connection.created' | 'connection.deleted' | 'connection.oauth.created' | 'connection.updated' | 'member.added' | 'member.removed' | 'member.role_updated' | 'oauth.failed' | 'oauth.refreshed' | 'organization.created' | 'organization.deleted' | 'organization.updated' | 'passthrough.executed' | 'project.created' | 'project.deleted' | 'project.updated';
314
+ /** Maps each event to the payload its deliveries carry. */
315
+ interface WebhookPayloads {
316
+ 'api_key.created': ApiKeyCreatedPayload;
317
+ 'api_key.revoked': ApiKeyRevokedPayload;
318
+ 'connection.created': ConnectionCreatedPayload;
319
+ 'connection.deleted': ConnectionDeletedPayload;
320
+ 'connection.oauth.created': ConnectionOAuthCreatedPayload;
321
+ 'connection.updated': ConnectionUpdatedPayload;
322
+ 'member.added': MemberAddedPayload;
323
+ 'member.removed': MemberRemovedPayload;
324
+ 'member.role_updated': MemberRoleUpdatedPayload;
325
+ 'oauth.failed': OAuthFailedPayload;
326
+ 'oauth.refreshed': OAuthRefreshedPayload;
327
+ 'organization.created': OrganizationCreatedPayload;
328
+ 'organization.deleted': OrganizationDeletedPayload;
329
+ 'organization.updated': OrganizationUpdatedPayload;
330
+ 'passthrough.executed': PassthroughExecutedPayload;
331
+ 'project.created': ProjectCreatedPayload;
332
+ 'project.deleted': ProjectDeletedPayload;
333
+ 'project.updated': ProjectUpdatedPayload;
334
+ }
335
+ /**
336
+ * A registry of typed webhook handlers plus the listener registration that
337
+ * makes One send them.
338
+ */
339
+ declare class Webhooks extends WebhooksBase {
340
+ /** Scopes to the generated connection registry, so a `connection(..)` block
341
+ * offers the typed per-event methods rather than the bare base. */
342
+ protected scopeConstructor(): new (key: string) => ConnectionWebhooks;
343
+ /** The full catalog, so an unscoped catch-all subscribes to everything. */
344
+ protected catalog(): readonly string[];
345
+ /** The connection-carrying subset, for a catch-all scoped to a connection. */
346
+ protected connectionCatalog(): readonly string[];
347
+ /** Narrows the block's scope to the typed registry. */
348
+ connection(key: string, block: (scope: ConnectionWebhooks) => unknown): this;
349
+ /** Registers a handler for `api_key.created`. */
350
+ apiKeyCreated(handler: Handler<ApiKeyCreatedPayload>): this;
351
+ /** Registers a handler for `api_key.revoked`. */
352
+ apiKeyRevoked(handler: Handler<ApiKeyRevokedPayload>): this;
353
+ /** Registers a handler for `connection.created`. */
354
+ connectionCreated(handler: Handler<ConnectionCreatedPayload>): this;
355
+ /** Registers a handler for `connection.deleted`. */
356
+ connectionDeleted(handler: Handler<ConnectionDeletedPayload>): this;
357
+ /** Registers a handler for `connection.oauth.created`. */
358
+ connectionOauthCreated(handler: Handler<ConnectionOAuthCreatedPayload>): this;
359
+ /** Registers a handler for `connection.updated`. */
360
+ connectionUpdated(handler: Handler<ConnectionUpdatedPayload>): this;
361
+ /** Registers a handler for `member.added`. */
362
+ memberAdded(handler: Handler<MemberAddedPayload>): this;
363
+ /** Registers a handler for `member.removed`. */
364
+ memberRemoved(handler: Handler<MemberRemovedPayload>): this;
365
+ /** Registers a handler for `member.role_updated`. */
366
+ memberRoleUpdated(handler: Handler<MemberRoleUpdatedPayload>): this;
367
+ /** Registers a handler for `oauth.failed`. */
368
+ oauthFailed(handler: Handler<OAuthFailedPayload>): this;
369
+ /** Registers a handler for `oauth.refreshed`. */
370
+ oauthRefreshed(handler: Handler<OAuthRefreshedPayload>): this;
371
+ /** Registers a handler for `organization.created`. */
372
+ organizationCreated(handler: Handler<OrganizationCreatedPayload>): this;
373
+ /** Registers a handler for `organization.deleted`. */
374
+ organizationDeleted(handler: Handler<OrganizationDeletedPayload>): this;
375
+ /** Registers a handler for `organization.updated`. */
376
+ organizationUpdated(handler: Handler<OrganizationUpdatedPayload>): this;
377
+ /** Registers a handler for `passthrough.executed`. */
378
+ passthroughExecuted(handler: Handler<PassthroughExecutedPayload>): this;
379
+ /** Registers a handler for `project.created`. */
380
+ projectCreated(handler: Handler<ProjectCreatedPayload>): this;
381
+ /** Registers a handler for `project.deleted`. */
382
+ projectDeleted(handler: Handler<ProjectDeletedPayload>): this;
383
+ /** Registers a handler for `project.updated`. */
384
+ projectUpdated(handler: Handler<ProjectUpdatedPayload>): this;
385
+ }
386
+ /**
387
+ * Handlers scoped to one connection. Only the events that carry a connection
388
+ * are offered here, so a scoped handler can never be one that could not fire.
389
+ */
390
+ declare class ConnectionWebhooks extends ConnectionWebhooksBase {
391
+ /** Registers a handler for `connection.created` on this connection. */
392
+ connectionCreated(handler: Handler<ConnectionCreatedPayload>): this;
393
+ /** Registers a handler for `connection.deleted` on this connection. */
394
+ connectionDeleted(handler: Handler<ConnectionDeletedPayload>): this;
395
+ /** Registers a handler for `connection.oauth.created` on this connection. */
396
+ connectionOauthCreated(handler: Handler<ConnectionOAuthCreatedPayload>): this;
397
+ /** Registers a handler for `connection.updated` on this connection. */
398
+ connectionUpdated(handler: Handler<ConnectionUpdatedPayload>): this;
399
+ /** Registers a handler for `oauth.failed` on this connection. */
400
+ oauthFailed(handler: Handler<OAuthFailedPayload>): this;
401
+ /** Registers a handler for `oauth.refreshed` on this connection. */
402
+ oauthRefreshed(handler: Handler<OAuthRefreshedPayload>): this;
403
+ /** Registers a handler for `passthrough.executed` on this connection. */
404
+ passthroughExecuted(handler: Handler<PassthroughExecutedPayload>): this;
405
+ }
406
+
5
407
  /** Per-call overrides, passed as the second arg to `run`. */
6
408
  interface CallOptions {
7
409
  /** Retry policy for this call, overriding the client default. */
@@ -22,6 +424,15 @@ interface Hooks {
22
424
  onSuccess?: (result: CallResult) => void;
23
425
  onError?: (error: OneError) => void;
24
426
  }
427
+ interface CompletedCall<T> {
428
+ output: T;
429
+ result: CallResult;
430
+ }
431
+ declare class CallLifecycle {
432
+ private readonly hooks;
433
+ constructor(hooks: Hooks);
434
+ execute<Native, Output>(call: () => Promise<Native>, complete: (value: Native) => CompletedCall<Output>): Promise<Output>;
435
+ }
25
436
  /**
26
437
  * The One SDK client. A thin typed facade over the native Rust client — HTTP,
27
438
  * retries, and route templating live in Rust; this routes calls, supplies the
@@ -29,19 +440,47 @@ interface Hooks {
29
440
  */
30
441
  declare class One {
31
442
  private readonly native;
32
- private readonly hooks;
443
+ private readonly lifecycle;
33
444
  constructor(secret: string, options?: ClientOptions);
34
- /** Creates a client from the environment (`ONE_SECRET`, `ONE_BASE_URL`). */
445
+ /**
446
+ * Creates a client that authenticates on an end user's OAuth grant.
447
+ *
448
+ * The counterpart to the constructor, as a factory because a class can only
449
+ * have one constructor and the two credentials are alternatives: a client
450
+ * authenticates as an agency with its secret key, or on a user's grant with
451
+ * their token, never both. What the token may reach is the scopes the user
452
+ * consented to, so a call outside them fails at the API, not here.
453
+ */
454
+ static withAccessToken(accessToken: string, options?: ClientOptions): One;
455
+ /**
456
+ * Creates a client from the environment: `ONE_SECRET` or `ONE_ACCESS_TOKEN`
457
+ * for the credential, plus the optional `ONE_BASE_URL`. `ONE_SECRET` wins
458
+ * when both are set.
459
+ */
35
460
  static fromEnv(): One;
461
+ /**
462
+ * Builds a facade around a native client a factory produced, bypassing the
463
+ * constructor because that one takes a secret key. One place assigns the
464
+ * fields, so a new factory cannot forget the lifecycle and leave hooks
465
+ * silently unfired.
466
+ */
467
+ private static wrapping;
36
468
  /** Scopes subsequent calls to a connection by its key. */
37
469
  connection(key: string): ConnectionScope;
470
+ /**
471
+ * Starts building a webhook listener, verified with the subscription's
472
+ * signing secret.
473
+ */
474
+ webhooks(options: WebhookOptions): Webhooks;
475
+ /** @internal Registers a webhook listener; the route and request shape live in Rust. */
476
+ registerWebhook(key: string, url: string, events: string[], secret: string): Promise<JsonValue>;
38
477
  }
39
478
  /** A connection-scoped runner. Run typed actions against one connection. */
40
479
  declare class ConnectionScope {
41
480
  private readonly native;
42
481
  private readonly key;
43
- private readonly hooks;
44
- constructor(native: One$1, key: string, hooks: Hooks);
482
+ private readonly lifecycle;
483
+ constructor(native: One$1, key: string, lifecycle: CallLifecycle);
45
484
  /** Runs a typed action and resolves with the response, typed as the action's
46
485
  * default output. `options` sets per-call retry and timeout. */
47
486
  run<Out = JsonValue>(action: Action<Out>, options?: CallOptions): Promise<CallResult<Out>>;
@@ -59,44 +498,21 @@ declare class ConnectionScope {
59
498
  * upstream response headers (rate-limit, request-id, `Link`, …).
60
499
  */
61
500
  declare class CallResult<Out = JsonValue> {
62
- /** HTTP status returned by the upstream platform. */
501
+ /** HTTP status returned by the request. */
63
502
  readonly status: number;
64
503
  /** Response headers, name → value. */
65
504
  readonly headers: Record<string, string>;
66
- /** Response body, typed as the action's default output. */
505
+ /** Response body, typed as the call's default output. */
67
506
  readonly data: Out;
68
507
  constructor(
69
- /** HTTP status returned by the upstream platform. */
508
+ /** HTTP status returned by the request. */
70
509
  status: number,
71
510
  /** Response headers, name → value. */
72
511
  headers: Record<string, string>,
73
- /** Response body, typed as the action's default output. */
512
+ /** Response body, typed as the call's default output. */
74
513
  data: Out);
75
514
  /** Decodes the body into a caller type — overrides the action's default output. */
76
515
  json<T>(): T;
77
516
  }
78
- /**
79
- * A failed call. Carries the upstream HTTP `status` and `body` and whether the
80
- * failure is `retryable` — the typed mirror of the Rust `one::Error`.
81
- */
82
- declare class OneError extends Error {
83
- /** Stable error kind (`status`, `timeout`, `transport`, `missing_secret`, …). */
84
- readonly code: string;
85
- /** Upstream HTTP status, for an upstream (`status`) failure. */
86
- readonly status: number | undefined;
87
- /** Upstream response body, for an upstream (`status`) failure. */
88
- readonly body: string | undefined;
89
- /** Whether retrying the call might succeed. */
90
- readonly retryable: boolean;
91
- constructor(
92
- /** Stable error kind (`status`, `timeout`, `transport`, `missing_secret`, …). */
93
- code: string, message: string,
94
- /** Upstream HTTP status, for an upstream (`status`) failure. */
95
- status: number | undefined,
96
- /** Upstream response body, for an upstream (`status`) failure. */
97
- body: string | undefined,
98
- /** Whether retrying the call might succeed. */
99
- retryable: boolean);
100
- }
101
517
 
102
- export { Action, ActionCall, type CallOptions, CallResult, type ClientOptions, ConnectionScope, One, OneError };
518
+ export { Action, ActionCall, type CallOptions, CallResult, type ClientOptions, ConnectionScope, ConnectionWebhooks, type Delivery, type Handler, One, OneError, type WebhookEventType, type WebhookOptions, type WebhookPayloads, Webhooks };