@tuvl/client 2026.2.1-beta.1 → 2026.2.1-beta.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  TypeScript client SDK for the [tuvl](https://tuvl.io) workflow orchestration engine.
4
4
 
5
- Supports three transports — plain REST, Server-Sent Events, and gRPC-Web — with automatic transport selection based on the workflow's streaming hints. Also ships first-class support for Human-in-the-Loop (HITL) resumption and explicit version pinning.
5
+ Supports three transports — plain REST, Server-Sent Events, and gRPC-Web — with automatic transport selection based on the workflow's streaming hints. Also ships first-class support for Human-in-the-Loop (HITL) resumption, explicit version pinning, and typed CRUD access to tuvl model endpoints.
6
6
 
7
7
  ---
8
8
 
@@ -272,6 +272,70 @@ Clears the manifest cache for one workflow, or all if no name is given.
272
272
 
273
273
  ---
274
274
 
275
+ ## CRUD — model data access
276
+
277
+ `client.crud(modelName)` returns a `CrudClient` that targets the auto-generated REST endpoints at `/models/{modelname}/`. The token and base URL are shared with the parent `TuvlClient`.
278
+
279
+ ```ts
280
+ import { TuvlClient } from "@tuvl/client";
281
+
282
+ const client = new TuvlClient({ baseUrl: "http://localhost:8000", token });
283
+
284
+ // List all candidates (default limit: 100)
285
+ const all = await client.crud("candidate").list();
286
+
287
+ // Filter + embed relations
288
+ const screened = await client.crud("candidate").list({
289
+ filters: { stage: "screening" },
290
+ include: ["posting"],
291
+ limit: 50,
292
+ offset: 0,
293
+ });
294
+
295
+ // Get one record by UUID
296
+ const c = await client.crud("candidate").get("uuid-here");
297
+
298
+ // Get one with embedded relations
299
+ const cFull = await client.crud("candidate").get("uuid-here", {
300
+ include: ["posting", "assessments"],
301
+ });
302
+
303
+ // Create
304
+ const created = await client.crud<CandidateRead, CandidateCreate>("candidate")
305
+ .create({ name: "Alice", email: "alice@example.com", stage: "applied" });
306
+
307
+ // Partial update (PATCH — only the fields you pass are changed)
308
+ const updated = await client.crud("candidate").update("uuid", { stage: "interview" });
309
+
310
+ // Delete (resolves void on HTTP 204)
311
+ await client.crud("candidate").delete("uuid");
312
+ ```
313
+
314
+ ### `client.crud<TRead, TCreate, TUpdate>(modelName)`
315
+
316
+ Returns a `CrudClient<TRead, TCreate, TUpdate>` instance. All type parameters default to `unknown` / `Partial<TRead>`. The model name is lowercased automatically.
317
+
318
+ ### `CrudListOptions`
319
+
320
+ | Option | Type | Description |
321
+ |---|---|---|
322
+ | `limit` | `number` | Max records to return (server default: 100, max: 1000) |
323
+ | `offset` | `number` | Pagination offset |
324
+ | `filters` | `Record<string, string>` | Field filters: `{ stage: "screening" }` → `?filter[stage]=screening` |
325
+ | `include` | `string[]` | Relation names to embed: `["posting"]` → `?include=posting` |
326
+ | `token` | `string` | Per-call token override |
327
+ | `signal` | `AbortSignal` | Cancellation signal |
328
+
329
+ ### Auth scopes required
330
+
331
+ | Operation | Required scope |
332
+ |---|---|
333
+ | `list()` / `get()` | `{modelname}:read` |
334
+ | `create()` / `update()` | `{modelname}:write` |
335
+ | `delete()` | `{modelname}:delete` |
336
+
337
+ ---
338
+
275
339
  ## TypeScript types
276
340
 
277
341
  ```ts
@@ -292,10 +356,15 @@ import type {
292
356
  ResumeOptions, // options for resumeWorkflow()
293
357
  ResumeRequest, // raw body sent to POST /api/workflows/resume
294
358
  TuvlClientOptions, // constructor options
359
+ CrudListOptions, // options for crud().list()
360
+ CrudGetOptions, // options for crud().get()
361
+ CrudMutateOptions, // options for crud().create() / update() / delete()
295
362
  } from "@tuvl/client";
296
363
 
297
364
  // Error classes are real classes — usable with `instanceof`
298
365
  import { TuvlWorkflowError, TuvlWorkflowSuspendedError } from "@tuvl/client";
366
+ // CRUD client — also exported for use without TuvlClient
367
+ import { CrudClient } from "@tuvl/client";
299
368
  ```
300
369
 
301
370
  ---
package/dist/index.d.mts CHANGED
@@ -1,3 +1,52 @@
1
+ /**
2
+ * Low-level HTTP transport for @tuvl/client.
3
+ *
4
+ * Handles auth header injection, JSON serialisation, and returns raw
5
+ * Response objects so higher-level transports (SSE, gRPC) can consume them.
6
+ */
7
+ interface TransportOptions {
8
+ baseUrl: string;
9
+ defaultToken?: string;
10
+ }
11
+ declare class Transport {
12
+ /** Public so TuvlClient can forward it to the gRPC subtransport. */
13
+ readonly baseUrl: string;
14
+ private defaultToken;
15
+ constructor(options: TransportOptions);
16
+ /** Update the default token (e.g. after refresh). */
17
+ setToken(token: string): void;
18
+ /** Build the Authorization header value, or undefined if no token. */
19
+ private authHeader;
20
+ /** Perform a plain JSON POST and return the parsed response body. */
21
+ post<TBody = unknown, TResponse = unknown>(path: string, body: TBody, options?: {
22
+ token?: string;
23
+ signal?: AbortSignal;
24
+ }): Promise<TResponse>;
25
+ /**
26
+ * Open an SSE-capable stream and return the raw Response.
27
+ * Callers are responsible for reading `response.body`.
28
+ */
29
+ postStream(path: string, body: unknown, options?: {
30
+ token?: string;
31
+ signal?: AbortSignal;
32
+ }): Promise<Response>;
33
+ /** Simple GET returning parsed JSON. */
34
+ get<TResponse = unknown>(path: string, options?: {
35
+ token?: string;
36
+ signal?: AbortSignal;
37
+ }): Promise<TResponse>;
38
+ /** Perform a JSON PATCH and return the parsed response body. */
39
+ patch<TBody = unknown, TResponse = unknown>(path: string, body: TBody, options?: {
40
+ token?: string;
41
+ signal?: AbortSignal;
42
+ }): Promise<TResponse>;
43
+ /** Perform a DELETE request. Expects a 204 No Content response. */
44
+ delete(path: string, options?: {
45
+ token?: string;
46
+ signal?: AbortSignal;
47
+ }): Promise<void>;
48
+ }
49
+
1
50
  /**
2
51
  * Shared types for @tuvl/client.
3
52
  *
@@ -131,6 +180,34 @@ interface TuvlClientOptions {
131
180
  token?: string;
132
181
  manifestCacheTtl?: number;
133
182
  }
183
+ /**
184
+ * Options for listing records from a CRUD model endpoint.
185
+ *
186
+ * `filters` maps to bracket-notation query params: `filter[key]=value`.
187
+ * `include` maps to `?include=relation1,relation2` for eager-loading relations.
188
+ */
189
+ interface CrudListOptions {
190
+ limit?: number;
191
+ offset?: number;
192
+ /** Server-side field filters: { stage: "screening" } → `?filter[stage]=screening` */
193
+ filters?: Record<string, string>;
194
+ /** Relation names to embed: ["posting"] → `?include=posting` */
195
+ include?: string[];
196
+ token?: string;
197
+ signal?: AbortSignal;
198
+ }
199
+ /** Options for retrieving a single CRUD record. */
200
+ interface CrudGetOptions {
201
+ /** Relation names to embed: ["candidate"] → `?include=candidate` */
202
+ include?: string[];
203
+ token?: string;
204
+ signal?: AbortSignal;
205
+ }
206
+ /** Options for create / update / delete calls. */
207
+ interface CrudMutateOptions {
208
+ token?: string;
209
+ signal?: AbortSignal;
210
+ }
134
211
  /**
135
212
  * Thrown by `execute()` when a workflow finishes with `success: false`.
136
213
  */
@@ -147,6 +224,83 @@ declare class TuvlWorkflowSuspendedError extends Error {
147
224
  constructor(suspended: SuspendedEvent);
148
225
  }
149
226
 
227
+ /**
228
+ * CrudClient — typed CRUD access for tuvl model endpoints.
229
+ *
230
+ * The tuvl server mounts auto-generated CRUD routers at:
231
+ * /models/{modelname}/ (list, create)
232
+ * /models/{modelname}/{id} (get, update, delete)
233
+ *
234
+ * Usage via TuvlClient.crud():
235
+ *
236
+ * ```ts
237
+ * const client = new TuvlClient({ baseUrl: "http://localhost:8000", token });
238
+ *
239
+ * // List all candidates
240
+ * const all = await client.crud("candidate").list();
241
+ *
242
+ * // Filter + embed relations
243
+ * const results = await client.crud("candidate").list({
244
+ * filters: { stage: "screening" },
245
+ * include: ["posting"],
246
+ * limit: 50,
247
+ * });
248
+ *
249
+ * // Get one
250
+ * const c = await client.crud("candidate").get("uuid-here");
251
+ *
252
+ * // Create
253
+ * const created = await client.crud<CandidateRead, CandidateCreate>("candidate")
254
+ * .create({ name: "Alice", email: "alice@example.com" });
255
+ *
256
+ * // Update
257
+ * const updated = await client.crud("candidate").update("uuid", { stage: "interview" });
258
+ *
259
+ * // Delete
260
+ * await client.crud("candidate").delete("uuid");
261
+ * ```
262
+ *
263
+ * Type parameters:
264
+ * TRead — shape returned by GET / POST / PATCH (defaults to `unknown`)
265
+ * TCreate — body for POST (defaults to `Partial<TRead>`)
266
+ * TUpdate — body for PATCH (defaults to `Partial<TRead>`)
267
+ */
268
+
269
+ declare class CrudClient<TRead = unknown, TCreate = Partial<TRead>, TUpdate = Partial<TRead>> {
270
+ private readonly transport;
271
+ private readonly basePath;
272
+ constructor(transport: Transport, modelName: string);
273
+ /** Build query string from list options. */
274
+ private _buildQuery;
275
+ /** Build ?include= query string for get-by-id calls. */
276
+ private _buildGetQuery;
277
+ /**
278
+ * GET /models/{model}/
279
+ * Returns all records matching the given filters (server default: up to 100).
280
+ */
281
+ list(options?: CrudListOptions): Promise<TRead[]>;
282
+ /**
283
+ * GET /models/{model}/{id}
284
+ * Returns a single record by UUID, optionally with embedded relations.
285
+ */
286
+ get(id: string, options?: CrudGetOptions): Promise<TRead>;
287
+ /**
288
+ * POST /models/{model}/
289
+ * Creates a new record and returns the created resource (HTTP 201).
290
+ */
291
+ create(body: TCreate, options?: CrudMutateOptions): Promise<TRead>;
292
+ /**
293
+ * PATCH /models/{model}/{id}
294
+ * Partially updates a record (only fields present in `body` are changed).
295
+ */
296
+ update(id: string, body: TUpdate, options?: CrudMutateOptions): Promise<TRead>;
297
+ /**
298
+ * DELETE /models/{model}/{id}
299
+ * Deletes a record (HTTP 204). Throws if the record is not found.
300
+ */
301
+ delete(id: string, options?: CrudMutateOptions): Promise<void>;
302
+ }
303
+
150
304
  /**
151
305
  * TuvlClient — the main entry point for @tuvl/client.
152
306
  *
@@ -229,6 +383,34 @@ declare class TuvlClient {
229
383
  private _executeSse;
230
384
  private _executeGrpc;
231
385
  private _unwrapRest;
386
+ /**
387
+ * Return a typed CRUD client for a tuvl model endpoint.
388
+ *
389
+ * The returned client targets `/models/{modelName}/` and shares the
390
+ * same transport (base URL + auth token) as this TuvlClient instance.
391
+ *
392
+ * @example
393
+ * ```ts
394
+ * // List all candidates
395
+ * const all = await client.crud("candidate").list();
396
+ *
397
+ * // With filters + embedded relations
398
+ * const results = await client.crud("candidate").list({
399
+ * filters: { stage: "screening" },
400
+ * include: ["posting"],
401
+ * limit: 50,
402
+ * });
403
+ *
404
+ * // Get one record
405
+ * const c = await client.crud("candidate").get("uuid-here");
406
+ *
407
+ * // Strongly-typed variant
408
+ * const c2 = await client
409
+ * .crud<CandidateRead, CandidateCreate>("candidate")
410
+ * .create({ name: "Alice", email: "alice@example.com" });
411
+ * ```
412
+ */
413
+ crud<TRead = unknown, TCreate = Partial<TRead>, TUpdate = Partial<TRead>>(modelName: string): CrudClient<TRead, TCreate, TUpdate>;
232
414
  }
233
415
 
234
416
  /**
@@ -384,43 +566,4 @@ interface GrpcRunOptions {
384
566
  */
385
567
  declare function openGrpcStream(options: GrpcRunOptions): AsyncGenerator<GrpcStepEvent>;
386
568
 
387
- /**
388
- * Low-level HTTP transport for @tuvl/client.
389
- *
390
- * Handles auth header injection, JSON serialisation, and returns raw
391
- * Response objects so higher-level transports (SSE, gRPC) can consume them.
392
- */
393
- interface TransportOptions {
394
- baseUrl: string;
395
- defaultToken?: string;
396
- }
397
- declare class Transport {
398
- /** Public so TuvlClient can forward it to the gRPC subtransport. */
399
- readonly baseUrl: string;
400
- private defaultToken;
401
- constructor(options: TransportOptions);
402
- /** Update the default token (e.g. after refresh). */
403
- setToken(token: string): void;
404
- /** Build the Authorization header value, or undefined if no token. */
405
- private authHeader;
406
- /** Perform a plain JSON POST and return the parsed response body. */
407
- post<TBody = unknown, TResponse = unknown>(path: string, body: TBody, options?: {
408
- token?: string;
409
- signal?: AbortSignal;
410
- }): Promise<TResponse>;
411
- /**
412
- * Open an SSE-capable stream and return the raw Response.
413
- * Callers are responsible for reading `response.body`.
414
- */
415
- postStream(path: string, body: unknown, options?: {
416
- token?: string;
417
- signal?: AbortSignal;
418
- }): Promise<Response>;
419
- /** Simple GET returning parsed JSON. */
420
- get<TResponse = unknown>(path: string, options?: {
421
- token?: string;
422
- signal?: AbortSignal;
423
- }): Promise<TResponse>;
424
- }
425
-
426
- export { type BootstrapRequest, type DoneEvent, type ErrorEvent, type ExecuteOptions, type ExecuteVersionedOptions, type MeResponse, type RestEnvelope, type ResumeOptions, type ResumeRequest, type StepEvent, type SuspendedEvent, type TokenResponse, Transport, TuvlAuth, type TuvlAuthOptions, TuvlClient, type TuvlClientOptions, TuvlWorkflowError, TuvlWorkflowSuspendedError, type WorkflowErrorPayload, type WorkflowManifest, type WorkflowManifestMap, openGrpcStream, parseSseStream };
569
+ export { type BootstrapRequest, CrudClient, type CrudGetOptions, type CrudListOptions, type CrudMutateOptions, type DoneEvent, type ErrorEvent, type ExecuteOptions, type ExecuteVersionedOptions, type MeResponse, type RestEnvelope, type ResumeOptions, type ResumeRequest, type StepEvent, type SuspendedEvent, type TokenResponse, Transport, TuvlAuth, type TuvlAuthOptions, TuvlClient, type TuvlClientOptions, TuvlWorkflowError, TuvlWorkflowSuspendedError, type WorkflowErrorPayload, type WorkflowManifest, type WorkflowManifestMap, openGrpcStream, parseSseStream };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,52 @@
1
+ /**
2
+ * Low-level HTTP transport for @tuvl/client.
3
+ *
4
+ * Handles auth header injection, JSON serialisation, and returns raw
5
+ * Response objects so higher-level transports (SSE, gRPC) can consume them.
6
+ */
7
+ interface TransportOptions {
8
+ baseUrl: string;
9
+ defaultToken?: string;
10
+ }
11
+ declare class Transport {
12
+ /** Public so TuvlClient can forward it to the gRPC subtransport. */
13
+ readonly baseUrl: string;
14
+ private defaultToken;
15
+ constructor(options: TransportOptions);
16
+ /** Update the default token (e.g. after refresh). */
17
+ setToken(token: string): void;
18
+ /** Build the Authorization header value, or undefined if no token. */
19
+ private authHeader;
20
+ /** Perform a plain JSON POST and return the parsed response body. */
21
+ post<TBody = unknown, TResponse = unknown>(path: string, body: TBody, options?: {
22
+ token?: string;
23
+ signal?: AbortSignal;
24
+ }): Promise<TResponse>;
25
+ /**
26
+ * Open an SSE-capable stream and return the raw Response.
27
+ * Callers are responsible for reading `response.body`.
28
+ */
29
+ postStream(path: string, body: unknown, options?: {
30
+ token?: string;
31
+ signal?: AbortSignal;
32
+ }): Promise<Response>;
33
+ /** Simple GET returning parsed JSON. */
34
+ get<TResponse = unknown>(path: string, options?: {
35
+ token?: string;
36
+ signal?: AbortSignal;
37
+ }): Promise<TResponse>;
38
+ /** Perform a JSON PATCH and return the parsed response body. */
39
+ patch<TBody = unknown, TResponse = unknown>(path: string, body: TBody, options?: {
40
+ token?: string;
41
+ signal?: AbortSignal;
42
+ }): Promise<TResponse>;
43
+ /** Perform a DELETE request. Expects a 204 No Content response. */
44
+ delete(path: string, options?: {
45
+ token?: string;
46
+ signal?: AbortSignal;
47
+ }): Promise<void>;
48
+ }
49
+
1
50
  /**
2
51
  * Shared types for @tuvl/client.
3
52
  *
@@ -131,6 +180,34 @@ interface TuvlClientOptions {
131
180
  token?: string;
132
181
  manifestCacheTtl?: number;
133
182
  }
183
+ /**
184
+ * Options for listing records from a CRUD model endpoint.
185
+ *
186
+ * `filters` maps to bracket-notation query params: `filter[key]=value`.
187
+ * `include` maps to `?include=relation1,relation2` for eager-loading relations.
188
+ */
189
+ interface CrudListOptions {
190
+ limit?: number;
191
+ offset?: number;
192
+ /** Server-side field filters: { stage: "screening" } → `?filter[stage]=screening` */
193
+ filters?: Record<string, string>;
194
+ /** Relation names to embed: ["posting"] → `?include=posting` */
195
+ include?: string[];
196
+ token?: string;
197
+ signal?: AbortSignal;
198
+ }
199
+ /** Options for retrieving a single CRUD record. */
200
+ interface CrudGetOptions {
201
+ /** Relation names to embed: ["candidate"] → `?include=candidate` */
202
+ include?: string[];
203
+ token?: string;
204
+ signal?: AbortSignal;
205
+ }
206
+ /** Options for create / update / delete calls. */
207
+ interface CrudMutateOptions {
208
+ token?: string;
209
+ signal?: AbortSignal;
210
+ }
134
211
  /**
135
212
  * Thrown by `execute()` when a workflow finishes with `success: false`.
136
213
  */
@@ -147,6 +224,83 @@ declare class TuvlWorkflowSuspendedError extends Error {
147
224
  constructor(suspended: SuspendedEvent);
148
225
  }
149
226
 
227
+ /**
228
+ * CrudClient — typed CRUD access for tuvl model endpoints.
229
+ *
230
+ * The tuvl server mounts auto-generated CRUD routers at:
231
+ * /models/{modelname}/ (list, create)
232
+ * /models/{modelname}/{id} (get, update, delete)
233
+ *
234
+ * Usage via TuvlClient.crud():
235
+ *
236
+ * ```ts
237
+ * const client = new TuvlClient({ baseUrl: "http://localhost:8000", token });
238
+ *
239
+ * // List all candidates
240
+ * const all = await client.crud("candidate").list();
241
+ *
242
+ * // Filter + embed relations
243
+ * const results = await client.crud("candidate").list({
244
+ * filters: { stage: "screening" },
245
+ * include: ["posting"],
246
+ * limit: 50,
247
+ * });
248
+ *
249
+ * // Get one
250
+ * const c = await client.crud("candidate").get("uuid-here");
251
+ *
252
+ * // Create
253
+ * const created = await client.crud<CandidateRead, CandidateCreate>("candidate")
254
+ * .create({ name: "Alice", email: "alice@example.com" });
255
+ *
256
+ * // Update
257
+ * const updated = await client.crud("candidate").update("uuid", { stage: "interview" });
258
+ *
259
+ * // Delete
260
+ * await client.crud("candidate").delete("uuid");
261
+ * ```
262
+ *
263
+ * Type parameters:
264
+ * TRead — shape returned by GET / POST / PATCH (defaults to `unknown`)
265
+ * TCreate — body for POST (defaults to `Partial<TRead>`)
266
+ * TUpdate — body for PATCH (defaults to `Partial<TRead>`)
267
+ */
268
+
269
+ declare class CrudClient<TRead = unknown, TCreate = Partial<TRead>, TUpdate = Partial<TRead>> {
270
+ private readonly transport;
271
+ private readonly basePath;
272
+ constructor(transport: Transport, modelName: string);
273
+ /** Build query string from list options. */
274
+ private _buildQuery;
275
+ /** Build ?include= query string for get-by-id calls. */
276
+ private _buildGetQuery;
277
+ /**
278
+ * GET /models/{model}/
279
+ * Returns all records matching the given filters (server default: up to 100).
280
+ */
281
+ list(options?: CrudListOptions): Promise<TRead[]>;
282
+ /**
283
+ * GET /models/{model}/{id}
284
+ * Returns a single record by UUID, optionally with embedded relations.
285
+ */
286
+ get(id: string, options?: CrudGetOptions): Promise<TRead>;
287
+ /**
288
+ * POST /models/{model}/
289
+ * Creates a new record and returns the created resource (HTTP 201).
290
+ */
291
+ create(body: TCreate, options?: CrudMutateOptions): Promise<TRead>;
292
+ /**
293
+ * PATCH /models/{model}/{id}
294
+ * Partially updates a record (only fields present in `body` are changed).
295
+ */
296
+ update(id: string, body: TUpdate, options?: CrudMutateOptions): Promise<TRead>;
297
+ /**
298
+ * DELETE /models/{model}/{id}
299
+ * Deletes a record (HTTP 204). Throws if the record is not found.
300
+ */
301
+ delete(id: string, options?: CrudMutateOptions): Promise<void>;
302
+ }
303
+
150
304
  /**
151
305
  * TuvlClient — the main entry point for @tuvl/client.
152
306
  *
@@ -229,6 +383,34 @@ declare class TuvlClient {
229
383
  private _executeSse;
230
384
  private _executeGrpc;
231
385
  private _unwrapRest;
386
+ /**
387
+ * Return a typed CRUD client for a tuvl model endpoint.
388
+ *
389
+ * The returned client targets `/models/{modelName}/` and shares the
390
+ * same transport (base URL + auth token) as this TuvlClient instance.
391
+ *
392
+ * @example
393
+ * ```ts
394
+ * // List all candidates
395
+ * const all = await client.crud("candidate").list();
396
+ *
397
+ * // With filters + embedded relations
398
+ * const results = await client.crud("candidate").list({
399
+ * filters: { stage: "screening" },
400
+ * include: ["posting"],
401
+ * limit: 50,
402
+ * });
403
+ *
404
+ * // Get one record
405
+ * const c = await client.crud("candidate").get("uuid-here");
406
+ *
407
+ * // Strongly-typed variant
408
+ * const c2 = await client
409
+ * .crud<CandidateRead, CandidateCreate>("candidate")
410
+ * .create({ name: "Alice", email: "alice@example.com" });
411
+ * ```
412
+ */
413
+ crud<TRead = unknown, TCreate = Partial<TRead>, TUpdate = Partial<TRead>>(modelName: string): CrudClient<TRead, TCreate, TUpdate>;
232
414
  }
233
415
 
234
416
  /**
@@ -384,43 +566,4 @@ interface GrpcRunOptions {
384
566
  */
385
567
  declare function openGrpcStream(options: GrpcRunOptions): AsyncGenerator<GrpcStepEvent>;
386
568
 
387
- /**
388
- * Low-level HTTP transport for @tuvl/client.
389
- *
390
- * Handles auth header injection, JSON serialisation, and returns raw
391
- * Response objects so higher-level transports (SSE, gRPC) can consume them.
392
- */
393
- interface TransportOptions {
394
- baseUrl: string;
395
- defaultToken?: string;
396
- }
397
- declare class Transport {
398
- /** Public so TuvlClient can forward it to the gRPC subtransport. */
399
- readonly baseUrl: string;
400
- private defaultToken;
401
- constructor(options: TransportOptions);
402
- /** Update the default token (e.g. after refresh). */
403
- setToken(token: string): void;
404
- /** Build the Authorization header value, or undefined if no token. */
405
- private authHeader;
406
- /** Perform a plain JSON POST and return the parsed response body. */
407
- post<TBody = unknown, TResponse = unknown>(path: string, body: TBody, options?: {
408
- token?: string;
409
- signal?: AbortSignal;
410
- }): Promise<TResponse>;
411
- /**
412
- * Open an SSE-capable stream and return the raw Response.
413
- * Callers are responsible for reading `response.body`.
414
- */
415
- postStream(path: string, body: unknown, options?: {
416
- token?: string;
417
- signal?: AbortSignal;
418
- }): Promise<Response>;
419
- /** Simple GET returning parsed JSON. */
420
- get<TResponse = unknown>(path: string, options?: {
421
- token?: string;
422
- signal?: AbortSignal;
423
- }): Promise<TResponse>;
424
- }
425
-
426
- export { type BootstrapRequest, type DoneEvent, type ErrorEvent, type ExecuteOptions, type ExecuteVersionedOptions, type MeResponse, type RestEnvelope, type ResumeOptions, type ResumeRequest, type StepEvent, type SuspendedEvent, type TokenResponse, Transport, TuvlAuth, type TuvlAuthOptions, TuvlClient, type TuvlClientOptions, TuvlWorkflowError, TuvlWorkflowSuspendedError, type WorkflowErrorPayload, type WorkflowManifest, type WorkflowManifestMap, openGrpcStream, parseSseStream };
569
+ export { type BootstrapRequest, CrudClient, type CrudGetOptions, type CrudListOptions, type CrudMutateOptions, type DoneEvent, type ErrorEvent, type ExecuteOptions, type ExecuteVersionedOptions, type MeResponse, type RestEnvelope, type ResumeOptions, type ResumeRequest, type StepEvent, type SuspendedEvent, type TokenResponse, Transport, TuvlAuth, type TuvlAuthOptions, TuvlClient, type TuvlClientOptions, TuvlWorkflowError, TuvlWorkflowSuspendedError, type WorkflowErrorPayload, type WorkflowManifest, type WorkflowManifestMap, openGrpcStream, parseSseStream };