@runtypelabs/sdk 1.7.1 → 1.7.3

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 (80) hide show
  1. package/dist/index.cjs +7026 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +5147 -0
  4. package/dist/index.d.ts +5146 -27
  5. package/dist/index.js +6955 -77
  6. package/dist/index.js.map +1 -1
  7. package/package.json +14 -7
  8. package/dist/batch-builder.d.ts +0 -106
  9. package/dist/batch-builder.d.ts.map +0 -1
  10. package/dist/batch-builder.js +0 -124
  11. package/dist/batch-builder.js.map +0 -1
  12. package/dist/batches-namespace.d.ts +0 -132
  13. package/dist/batches-namespace.d.ts.map +0 -1
  14. package/dist/batches-namespace.js +0 -128
  15. package/dist/batches-namespace.js.map +0 -1
  16. package/dist/case-types.d.ts +0 -42
  17. package/dist/case-types.d.ts.map +0 -1
  18. package/dist/case-types.js +0 -16
  19. package/dist/case-types.js.map +0 -1
  20. package/dist/client-token-types.d.ts +0 -143
  21. package/dist/client-token-types.d.ts.map +0 -1
  22. package/dist/client-token-types.js +0 -11
  23. package/dist/client-token-types.js.map +0 -1
  24. package/dist/client.d.ts +0 -131
  25. package/dist/client.d.ts.map +0 -1
  26. package/dist/client.js +0 -501
  27. package/dist/client.js.map +0 -1
  28. package/dist/endpoints.d.ts +0 -1248
  29. package/dist/endpoints.d.ts.map +0 -1
  30. package/dist/endpoints.js +0 -1649
  31. package/dist/endpoints.js.map +0 -1
  32. package/dist/error-handling-types.d.ts +0 -71
  33. package/dist/error-handling-types.d.ts.map +0 -1
  34. package/dist/error-handling-types.js +0 -12
  35. package/dist/error-handling-types.js.map +0 -1
  36. package/dist/eval-builder.d.ts +0 -216
  37. package/dist/eval-builder.d.ts.map +0 -1
  38. package/dist/eval-builder.js +0 -225
  39. package/dist/eval-builder.js.map +0 -1
  40. package/dist/evals-namespace.d.ts +0 -205
  41. package/dist/evals-namespace.d.ts.map +0 -1
  42. package/dist/evals-namespace.js +0 -208
  43. package/dist/evals-namespace.js.map +0 -1
  44. package/dist/flow-builder.d.ts +0 -717
  45. package/dist/flow-builder.d.ts.map +0 -1
  46. package/dist/flow-builder.js +0 -592
  47. package/dist/flow-builder.js.map +0 -1
  48. package/dist/flow-result.d.ts +0 -117
  49. package/dist/flow-result.d.ts.map +0 -1
  50. package/dist/flow-result.js +0 -175
  51. package/dist/flow-result.js.map +0 -1
  52. package/dist/flows-namespace.d.ts +0 -442
  53. package/dist/flows-namespace.d.ts.map +0 -1
  54. package/dist/flows-namespace.js +0 -686
  55. package/dist/flows-namespace.js.map +0 -1
  56. package/dist/generated-tool-gate.d.ts +0 -75
  57. package/dist/generated-tool-gate.d.ts.map +0 -1
  58. package/dist/generated-tool-gate.js +0 -314
  59. package/dist/generated-tool-gate.js.map +0 -1
  60. package/dist/index.d.ts.map +0 -1
  61. package/dist/prompts-namespace.d.ts +0 -237
  62. package/dist/prompts-namespace.d.ts.map +0 -1
  63. package/dist/prompts-namespace.js +0 -222
  64. package/dist/prompts-namespace.js.map +0 -1
  65. package/dist/runtype.d.ts +0 -232
  66. package/dist/runtype.d.ts.map +0 -1
  67. package/dist/runtype.js +0 -367
  68. package/dist/runtype.js.map +0 -1
  69. package/dist/stream-utils.d.ts +0 -58
  70. package/dist/stream-utils.d.ts.map +0 -1
  71. package/dist/stream-utils.js +0 -373
  72. package/dist/stream-utils.js.map +0 -1
  73. package/dist/transform.d.ts +0 -30
  74. package/dist/transform.d.ts.map +0 -1
  75. package/dist/transform.js +0 -196
  76. package/dist/transform.js.map +0 -1
  77. package/dist/types.d.ts +0 -717
  78. package/dist/types.d.ts.map +0 -1
  79. package/dist/types.js +0 -7
  80. package/dist/types.js.map +0 -1
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@runtypelabs/sdk",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
+ "type": "module",
4
5
  "description": "TypeScript SDK for the Runtype API with fluent methods. Use it to quickly realize AI products, agents, and workflows.",
5
- "main": "dist/index.js",
6
+ "main": "dist/index.cjs",
6
7
  "module": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
13
19
  }
14
20
  },
15
21
  "files": [
@@ -18,6 +24,7 @@
18
24
  ],
19
25
  "dependencies": {},
20
26
  "devDependencies": {
27
+ "tsup": "^8.0.2",
21
28
  "typescript": "^5.3.3",
22
29
  "vitest": "^4.0.18"
23
30
  },
@@ -52,8 +59,8 @@
52
59
  },
53
60
  "sideEffects": false,
54
61
  "scripts": {
55
- "build": "tsc",
56
- "dev": "tsc --watch",
62
+ "build": "tsup",
63
+ "dev": "tsup --watch",
57
64
  "clean": "rm -rf dist",
58
65
  "test": "vitest run",
59
66
  "test:watch": "vitest watch"
@@ -1,106 +0,0 @@
1
- /**
2
- * BatchBuilder - Fluent builder for batch operations
3
- *
4
- * Provides a chainable API for building batch dispatch configurations
5
- * that execute a flow across multiple records of the same type.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { BatchBuilder } from '@runtypelabs/sdk'
10
- *
11
- * const batch = await new BatchBuilder()
12
- * .useFlow('flow_abc123')
13
- * .forRecordType('customer')
14
- * .withOptions({ async: true })
15
- * .run(apiClient)
16
- * ```
17
- */
18
- export interface BatchOptions {
19
- /** Run batch asynchronously (default: true) */
20
- async?: boolean;
21
- /** Maximum concurrent executions */
22
- concurrency?: number;
23
- /** Continue on individual record failures */
24
- continueOnError?: boolean;
25
- /** Store results for each record */
26
- storeResults?: boolean;
27
- /** Model override for batch execution */
28
- modelOverride?: string;
29
- }
30
- export interface BatchRequest {
31
- flowId: string;
32
- recordType: string;
33
- options?: BatchOptions;
34
- /** Optional filter for records */
35
- filter?: Record<string, any>;
36
- /** Optional limit on number of records */
37
- limit?: number;
38
- }
39
- export interface BatchResult {
40
- batchId: string;
41
- status: 'queued' | 'running' | 'completed' | 'failed';
42
- totalRecords: number;
43
- processedRecords: number;
44
- failedRecords: number;
45
- }
46
- export declare class BatchBuilder {
47
- private flowId;
48
- private recordType;
49
- private batchOptions;
50
- private filterConfig;
51
- private limitConfig;
52
- /**
53
- * Specify the flow to execute for each record
54
- */
55
- useFlow(flowId: string): this;
56
- /**
57
- * Specify the record type to batch process
58
- */
59
- forRecordType(recordType: string): this;
60
- /**
61
- * Set batch execution options
62
- */
63
- withOptions(options: BatchOptions): this;
64
- /**
65
- * Filter records to process
66
- *
67
- * @example
68
- * ```typescript
69
- * .withFilter({ status: 'pending', createdAt: { $gt: '2024-01-01' } })
70
- * ```
71
- */
72
- withFilter(filter: Record<string, any>): this;
73
- /**
74
- * Limit the number of records to process
75
- */
76
- withLimit(limit: number): this;
77
- /**
78
- * Build the batch request configuration
79
- */
80
- build(): BatchRequest;
81
- /**
82
- * Execute the batch operation
83
- *
84
- * @param client - Client with batch dispatch capability
85
- * @returns BatchResult with batch status
86
- */
87
- run(client: BatchClient): Promise<BatchResult>;
88
- }
89
- /**
90
- * Interface for clients that can execute batch operations
91
- */
92
- export interface BatchClient {
93
- batch(config: BatchRequest): Promise<BatchResult>;
94
- }
95
- /**
96
- * BatchBuilder that is bound to a client for direct execution
97
- */
98
- export declare class ClientBatchBuilder extends BatchBuilder {
99
- private boundClient;
100
- constructor(client: BatchClient);
101
- /**
102
- * Execute the batch using the bound client
103
- */
104
- run(): Promise<BatchResult>;
105
- }
106
- //# sourceMappingURL=batch-builder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-builder.d.ts","sourceRoot":"","sources":["../src/batch-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,MAAM,WAAW,YAAY;IAC3B,+CAA+C;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AG,IAAI;IAK9B;;OAEG;IACH,KAAK,IAAI,YAAY;IA4BrB;;;;;OAKG;IACG,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAIrD;AAMD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAClD;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAO,CAAC,WAAW,CAAa;gBAEpB,MAAM,EAAE,WAAW;IAK/B;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;CAIlC"}
@@ -1,124 +0,0 @@
1
- "use strict";
2
- /**
3
- * BatchBuilder - Fluent builder for batch operations
4
- *
5
- * Provides a chainable API for building batch dispatch configurations
6
- * that execute a flow across multiple records of the same type.
7
- *
8
- * @example
9
- * ```typescript
10
- * import { BatchBuilder } from '@runtypelabs/sdk'
11
- *
12
- * const batch = await new BatchBuilder()
13
- * .useFlow('flow_abc123')
14
- * .forRecordType('customer')
15
- * .withOptions({ async: true })
16
- * .run(apiClient)
17
- * ```
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.ClientBatchBuilder = exports.BatchBuilder = void 0;
21
- // ============================================================================
22
- // BatchBuilder Class
23
- // ============================================================================
24
- class BatchBuilder {
25
- constructor() {
26
- this.flowId = '';
27
- this.recordType = '';
28
- this.batchOptions = {};
29
- }
30
- /**
31
- * Specify the flow to execute for each record
32
- */
33
- useFlow(flowId) {
34
- this.flowId = flowId;
35
- return this;
36
- }
37
- /**
38
- * Specify the record type to batch process
39
- */
40
- forRecordType(recordType) {
41
- this.recordType = recordType;
42
- return this;
43
- }
44
- /**
45
- * Set batch execution options
46
- */
47
- withOptions(options) {
48
- this.batchOptions = { ...this.batchOptions, ...options };
49
- return this;
50
- }
51
- /**
52
- * Filter records to process
53
- *
54
- * @example
55
- * ```typescript
56
- * .withFilter({ status: 'pending', createdAt: { $gt: '2024-01-01' } })
57
- * ```
58
- */
59
- withFilter(filter) {
60
- this.filterConfig = filter;
61
- return this;
62
- }
63
- /**
64
- * Limit the number of records to process
65
- */
66
- withLimit(limit) {
67
- this.limitConfig = limit;
68
- return this;
69
- }
70
- /**
71
- * Build the batch request configuration
72
- */
73
- build() {
74
- if (!this.flowId) {
75
- throw new Error('BatchBuilder: flowId is required. Call .useFlow(flowId) first.');
76
- }
77
- if (!this.recordType) {
78
- throw new Error('BatchBuilder: recordType is required. Call .forRecordType(type) first.');
79
- }
80
- const request = {
81
- flowId: this.flowId,
82
- recordType: this.recordType,
83
- };
84
- if (Object.keys(this.batchOptions).length > 0) {
85
- request.options = this.batchOptions;
86
- }
87
- if (this.filterConfig) {
88
- request.filter = this.filterConfig;
89
- }
90
- if (this.limitConfig !== undefined) {
91
- request.limit = this.limitConfig;
92
- }
93
- return request;
94
- }
95
- /**
96
- * Execute the batch operation
97
- *
98
- * @param client - Client with batch dispatch capability
99
- * @returns BatchResult with batch status
100
- */
101
- async run(client) {
102
- const config = this.build();
103
- return client.batch(config);
104
- }
105
- }
106
- exports.BatchBuilder = BatchBuilder;
107
- /**
108
- * BatchBuilder that is bound to a client for direct execution
109
- */
110
- class ClientBatchBuilder extends BatchBuilder {
111
- constructor(client) {
112
- super();
113
- this.boundClient = client;
114
- }
115
- /**
116
- * Execute the batch using the bound client
117
- */
118
- async run() {
119
- const config = this.build();
120
- return this.boundClient.batch(config);
121
- }
122
- }
123
- exports.ClientBatchBuilder = ClientBatchBuilder;
124
- //# sourceMappingURL=batch-builder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-builder.js","sourceRoot":"","sources":["../src/batch-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAuCH,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,MAAa,YAAY;IAAzB;QACU,WAAM,GAAW,EAAE,CAAA;QACnB,eAAU,GAAW,E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,CAAC;YACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAA;QACpC,CAAC;QAED,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,CAAA;QAClC,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CAAC,MAAmB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;CACF;AA7FD,oCA6FC;AAaD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,YAAY;IAGlD,YAAY,MAAmB;QAC7B,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG;QACP,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;CACF;AAfD,gDAeC"}
@@ -1,132 +0,0 @@
1
- /**
2
- * BatchesNamespace - Static namespace for batch operations
3
- *
4
- * Provides direct methods for scheduling and managing batch operations.
5
- * Batches are always asynchronous - they don't return results immediately.
6
- */
7
- import type { RuntypeClient } from './runtype';
8
- export interface BatchScheduleConfig {
9
- /** Flow ID to execute for each record */
10
- flowId: string;
11
- /** Record type to batch process */
12
- recordType: string;
13
- /** When to execute (defaults to immediately) */
14
- at?: Date;
15
- /** Run batch asynchronously (default: true) */
16
- async?: boolean;
17
- /** Maximum concurrent executions */
18
- concurrency?: number;
19
- /** Continue on individual record failures */
20
- continueOnError?: boolean;
21
- /** Store results for each record */
22
- storeResults?: boolean;
23
- /** Model override for batch execution */
24
- modelOverride?: string;
25
- /** Optional filter for records */
26
- filter?: Record<string, any>;
27
- /** Optional limit on number of records */
28
- limit?: number;
29
- }
30
- export interface BatchStatus {
31
- batchId: string;
32
- status: 'queued' | 'scheduled' | 'running' | 'completed' | 'failed' | 'cancelled';
33
- totalRecords: number;
34
- processedRecords: number;
35
- failedRecords: number;
36
- scheduledAt?: string;
37
- startedAt?: string;
38
- completedAt?: string;
39
- }
40
- export interface BatchListParams {
41
- /** Filter by status */
42
- status?: 'queued' | 'scheduled' | 'running' | 'completed' | 'failed' | 'cancelled';
43
- /** Filter by flow ID */
44
- flowId?: string;
45
- /** Filter by record type */
46
- recordType?: string;
47
- /** Pagination limit */
48
- limit?: number;
49
- /** Pagination offset */
50
- offset?: number;
51
- }
52
- export declare class BatchesNamespace {
53
- private getClient;
54
- constructor(getClient: () => RuntypeClient);
55
- /**
56
- * Schedule a batch operation
57
- *
58
- * Creates and schedules a batch to run a flow on all records of a type.
59
- * By default, runs immediately. Use `at` to schedule for a specific time.
60
- *
61
- * @example
62
- * ```typescript
63
- * // Run immediately
64
- * const batch = await Runtype.batches.schedule({
65
- * flowId: 'flow_123',
66
- * recordType: 'customers',
67
- * })
68
- *
69
- * // Schedule for later
70
- * const batch = await Runtype.batches.schedule({
71
- * flowId: 'flow_123',
72
- * recordType: 'customers',
73
- * at: new Date('2024-01-15T09:00:00Z'),
74
- * })
75
- *
76
- * // With options
77
- * const batch = await Runtype.batches.schedule({
78
- * flowId: 'flow_123',
79
- * recordType: 'customers',
80
- * concurrency: 5,
81
- * continueOnError: true,
82
- * filter: { status: 'active' },
83
- * limit: 100,
84
- * })
85
- * ```
86
- */
87
- schedule(config: BatchScheduleConfig): Promise<BatchStatus>;
88
- /**
89
- * Get batch status by ID
90
- *
91
- * @example
92
- * ```typescript
93
- * const status = await Runtype.batches.get('batch_456')
94
- * console.log(status.status, status.processedRecords, '/', status.totalRecords)
95
- * ```
96
- */
97
- get(batchId: string): Promise<BatchStatus>;
98
- /**
99
- * Cancel a batch operation
100
- *
101
- * Cancels a queued or running batch. Records already processed are not rolled back.
102
- *
103
- * @example
104
- * ```typescript
105
- * await Runtype.batches.cancel('batch_456')
106
- * ```
107
- */
108
- cancel(batchId: string): Promise<{
109
- success: boolean;
110
- message: string;
111
- }>;
112
- /**
113
- * List batch operations
114
- *
115
- * @example
116
- * ```typescript
117
- * // List all batches
118
- * const batches = await Runtype.batches.list()
119
- *
120
- * // Filter by status
121
- * const running = await Runtype.batches.list({ status: 'running' })
122
- *
123
- * // Filter by flow
124
- * const flowBatches = await Runtype.batches.list({ flowId: 'flow_123' })
125
- * ```
126
- */
127
- list(params?: BatchListParams): Promise<{
128
- data: BatchStatus[];
129
- total: number;
130
- }>;
131
- }
132
- //# sourceMappingURL=batches-namespace.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batches-namespace.d.ts","sourceRoot":"","sources":["../src/batches-namespace.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAM9C,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,gDAAgD;IAChD,EAAE,CAAC,EAAE,IAAI,CAAA;IACT,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oCAAoC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,MAA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F"}
@@ -1,128 +0,0 @@
1
- "use strict";
2
- /**
3
- * BatchesNamespace - Static namespace for batch operations
4
- *
5
- * Provides direct methods for scheduling and managing batch operations.
6
- * Batches are always asynchronous - they don't return results immediately.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BatchesNamespace = void 0;
10
- // ============================================================================
11
- // BatchesNamespace
12
- // ============================================================================
13
- class BatchesNamespace {
14
- constructor(getClient) {
15
- this.getClient = getClient;
16
- }
17
- /**
18
- * Schedule a batch operation
19
- *
20
- * Creates and schedules a batch to run a flow on all records of a type.
21
- * By default, runs immediately. Use `at` to schedule for a specific time.
22
- *
23
- * @example
24
- * ```typescript
25
- * // Run immediately
26
- * const batch = await Runtype.batches.schedule({
27
- * flowId: 'flow_123',
28
- * recordType: 'customers',
29
- * })
30
- *
31
- * // Schedule for later
32
- * const batch = await Runtype.batches.schedule({
33
- * flowId: 'flow_123',
34
- * recordType: 'customers',
35
- * at: new Date('2024-01-15T09:00:00Z'),
36
- * })
37
- *
38
- * // With options
39
- * const batch = await Runtype.batches.schedule({
40
- * flowId: 'flow_123',
41
- * recordType: 'customers',
42
- * concurrency: 5,
43
- * continueOnError: true,
44
- * filter: { status: 'active' },
45
- * limit: 100,
46
- * })
47
- * ```
48
- */
49
- async schedule(config) {
50
- const client = this.getClient();
51
- const payload = {
52
- flowId: config.flowId,
53
- recordType: config.recordType,
54
- };
55
- if (config.at) {
56
- payload.scheduledAt = config.at.toISOString();
57
- }
58
- const options = {};
59
- if (config.async !== undefined)
60
- options.async = config.async;
61
- if (config.concurrency !== undefined)
62
- options.concurrency = config.concurrency;
63
- if (config.continueOnError !== undefined)
64
- options.continueOnError = config.continueOnError;
65
- if (config.storeResults !== undefined)
66
- options.storeResults = config.storeResults;
67
- if (config.modelOverride !== undefined)
68
- options.modelOverride = config.modelOverride;
69
- if (Object.keys(options).length > 0) {
70
- payload.options = options;
71
- }
72
- if (config.filter) {
73
- payload.filter = config.filter;
74
- }
75
- if (config.limit !== undefined) {
76
- payload.limit = config.limit;
77
- }
78
- return client.post('/batches', payload);
79
- }
80
- /**
81
- * Get batch status by ID
82
- *
83
- * @example
84
- * ```typescript
85
- * const status = await Runtype.batches.get('batch_456')
86
- * console.log(status.status, status.processedRecords, '/', status.totalRecords)
87
- * ```
88
- */
89
- async get(batchId) {
90
- const client = this.getClient();
91
- return client.get(`/batches/${batchId}`);
92
- }
93
- /**
94
- * Cancel a batch operation
95
- *
96
- * Cancels a queued or running batch. Records already processed are not rolled back.
97
- *
98
- * @example
99
- * ```typescript
100
- * await Runtype.batches.cancel('batch_456')
101
- * ```
102
- */
103
- async cancel(batchId) {
104
- const client = this.getClient();
105
- return client.post(`/batches/${batchId}/cancel`);
106
- }
107
- /**
108
- * List batch operations
109
- *
110
- * @example
111
- * ```typescript
112
- * // List all batches
113
- * const batches = await Runtype.batches.list()
114
- *
115
- * // Filter by status
116
- * const running = await Runtype.batches.list({ status: 'running' })
117
- *
118
- * // Filter by flow
119
- * const flowBatches = await Runtype.batches.list({ flowId: 'flow_123' })
120
- * ```
121
- */
122
- async list(params) {
123
- const client = this.getClient();
124
- return client.get('/batches', params);
125
- }
126
- }
127
- exports.BatchesNamespace = BatchesNamespace;
128
- //# sourceMappingURL=batches-namespace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batches-namespace.js","sourceRoot":"","sources":["../src/batches-namespace.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAuDH,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAa,gBAAgB;IAC3B,YAAoB,SAA8B;QAA9B,cAAS,GAAT,SAAS,CAAqB;IAAG,CAAC;IAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,KAAK,CAAC,QAAQ,CAAC,MAA2B;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAE/B,MAAM,OAAO,GAAQ;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;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SAAS,EAAE,CAAA;QAC/B,OAAO,MAAM,CAAC,GAAG,CAAc,YAAY,OAAO,EAAE,CAAC,CAAA;IACvD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAC/B,OAAO,MAAM,CAAC,IAAI,CAAwC,YAAY,OAAO,SAAS,CAAC,CAAA;IACzF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,IAAI,CAAC,MAAwB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAC/B,OAAO,MAAM,CAAC,GAAG,CAAyC,UAAU,EAAE,MAAM,CAAC,CAAA;IAC/E,CAAC;CACF;AArHD,4CAqHC"}
@@ -1,42 +0,0 @@
1
- /**
2
- * @module case-types
3
- * @layer sdk
4
- *
5
- * TypeScript utility types for compile-time snake_case/camelCase conversion.
6
- * These types enable TypeScript to catch case mismatches at compile time rather than runtime.
7
- *
8
- * NOTE: This is a standalone copy for the SDK package (@runtypelabs/sdk) which has zero dependencies.
9
- * The source of truth is @runtypelabs/shared (packages/shared/src/transforms/case-types.ts).
10
- * When updating, sync changes with the shared package.
11
- *
12
- * @see packages/shared/src/transforms/case-types.ts
13
- */
14
- /**
15
- * Convert a snake_case string literal type to camelCase
16
- *
17
- * @example
18
- * type Result = SnakeToCamelString<'flow_name'> // 'flowName'
19
- * type Result = SnakeToCamelString<'user_id'> // 'userId'
20
- */
21
- export type SnakeToCamelString<S extends string> = S extends `${infer H}_${infer T}` ? `${H}${Capitalize<SnakeToCamelString<T>>}` : S;
22
- /**
23
- * Convert a camelCase string literal type to snake_case
24
- *
25
- * @example
26
- * type Result = CamelToSnakeString<'flowName'> // 'flow_name'
27
- * type Result = CamelToSnakeString<'userId'> // 'user_id'
28
- */
29
- export type CamelToSnakeString<S extends string> = S extends `${infer H}${infer T}` ? H extends Uppercase<H> ? H extends Lowercase<H> ? `${H}${CamelToSnakeString<T>}` : `_${Lowercase<H>}${CamelToSnakeString<T>}` : `${H}${CamelToSnakeString<T>}` : S;
30
- /**
31
- * Recursively convert object type keys from snake_case to camelCase
32
- */
33
- export type ToCamelCase<T> = T extends Array<infer U> ? Array<ToCamelCase<U>> : T extends object ? {
34
- [K in keyof T as SnakeToCamelString<K & string>]: ToCamelCase<T[K]>;
35
- } : T;
36
- /**
37
- * Recursively convert object type keys from camelCase to snake_case
38
- */
39
- export type ToSnakeCase<T> = T extends Array<infer U> ? Array<ToSnakeCase<U>> : T extends object ? {
40
- [K in keyof T as CamelToSnakeString<K & string>]: ToSnakeCase<T[K]>;
41
- } : T;
42
- //# sourceMappingURL=case-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"case-types.d.ts","sourceRoot":"","sources":["../src/case-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GAChF,GAAG,CAAC,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,GAC1C,CAAC,CAAA;AAEL;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAC/E,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GACpB,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,GACpB,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAC9B,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAC5C,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAChC,CAAC,CAAA;AAML;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IACvB,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACpB,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,kBAAkB,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACvE,CAAC,CAAA;AAET;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IACvB,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACpB,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,kBAAkB,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACvE,CAAC,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module case-types
4
- * @layer sdk
5
- *
6
- * TypeScript utility types for compile-time snake_case/camelCase conversion.
7
- * These types enable TypeScript to catch case mismatches at compile time rather than runtime.
8
- *
9
- * NOTE: This is a standalone copy for the SDK package (@runtypelabs/sdk) which has zero dependencies.
10
- * The source of truth is @runtypelabs/shared (packages/shared/src/transforms/case-types.ts).
11
- * When updating, sync changes with the shared package.
12
- *
13
- * @see packages/shared/src/transforms/case-types.ts
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- //# sourceMappingURL=case-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"case-types.js","sourceRoot":"","sources":["../src/case-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG"}