@boltic/sdk 0.1.2 → 0.1.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.
@@ -1,3 +1,12 @@
1
+ /** Properties describing the activity to execute (dynamic, varies by integration) */
2
+ declare type ActivityProperties = Record<string, unknown>;
3
+
4
+ /** Result/context payload sent alongside activity nodes */
5
+ declare interface ActivityResultPayload {
6
+ payload: Record<string, unknown>;
7
+ global_variables: Record<string, unknown>;
8
+ }
9
+
1
10
  declare interface AddIndexRequest {
2
11
  field_names: string[];
3
12
  method: 'btree' | 'hash' | 'spgist' | 'gin' | 'brin';
@@ -51,6 +60,41 @@ declare class AuthManager {
51
60
  toJSON(): object;
52
61
  }
53
62
 
63
+ /**
64
+ * Base API Client — provides common functionality for all API clients.
65
+ *
66
+ * Subclasses pass a `servicePath` to target different backend services
67
+ * while sharing auth, headers, error handling, and HTTP infrastructure.
68
+ */
69
+ declare abstract class BaseApiClient {
70
+ protected httpAdapter: HttpAdapter;
71
+ protected config: BaseApiClientConfig;
72
+ protected baseURL: string;
73
+ protected environment: Environment;
74
+ protected region: Region;
75
+ constructor(apiKey: string, config?: Omit<BaseApiClientConfig, 'apiKey'>, servicePath?: string);
76
+ /**
77
+ * Resolve a secondary service URL using the same region/environment
78
+ * but a different service path.
79
+ */
80
+ protected resolveAdditionalServiceURL(servicePath: string): string;
81
+ protected buildHeaders(): Record<string, string>;
82
+ protected formatErrorResponse(error: unknown, prefix?: string): BolticErrorResponse;
83
+ toString(): string;
84
+ toJSON(): object;
85
+ }
86
+
87
+ declare interface BaseApiClientConfig {
88
+ apiKey: string;
89
+ environment?: Environment;
90
+ region?: Region;
91
+ timeout?: number;
92
+ debug?: boolean;
93
+ retryAttempts?: number;
94
+ retryDelay?: number;
95
+ headers?: Record<string, string>;
96
+ }
97
+
54
98
  declare class BaseClient {
55
99
  private httpAdapter;
56
100
  private authManager;
@@ -80,6 +124,7 @@ declare class BolticClient {
80
124
  private sqlResource;
81
125
  private indexResource;
82
126
  private databaseResource;
127
+ private workflowResource;
83
128
  private currentDatabase;
84
129
  private clientOptions;
85
130
  constructor(apiKey: string, options?: ClientOptions);
@@ -128,10 +173,6 @@ declare class BolticClient {
128
173
  message: string;
129
174
  }>>;
130
175
  rename: (oldName: string, newName: string) => Promise<BolticSuccessResponse<TableRecord>>;
131
- setAccess: (request: {
132
- table_name: string;
133
- is_shared: boolean;
134
- }) => Promise<BolticSuccessResponse<TableRecord>>;
135
176
  };
136
177
  get columns(): {
137
178
  create: (tableName: string, column: FieldDefinition) => Promise<BolticErrorResponse | BolticSuccessResponse<ColumnRecord>>;
@@ -196,7 +237,32 @@ declare class BolticClient {
196
237
  record(tableName: string): RecordBuilder;
197
238
  get sql(): {
198
239
  textToSQL: (prompt: string, options?: TextToSQLOptions) => Promise<AsyncIterable<string>>;
199
- executeSQL: (query: string) => Promise<BolticErrorResponse | ExecuteSQLApiResponse_2>;
240
+ executeSQL: (query: string) => Promise<BolticErrorResponse | ExecuteSQLApiResponse>;
241
+ };
242
+ /**
243
+ * Workflow integration operations.
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * // Execute and poll for result
248
+ * const result = await client.workflow.executeIntegration({
249
+ * nodes: [{ id: 'api1', data: { ... }, activity_data: { ... } }],
250
+ * });
251
+ *
252
+ * // Get execution result by ID
253
+ * const exec = await client.workflow.getIntegrationExecuteById('run-uuid');
254
+ *
255
+ * // List integrations
256
+ * const integrations = await client.workflow.getIntegrations();
257
+ * ```
258
+ */
259
+ get workflow(): {
260
+ executeIntegration: (params: ExecuteIntegrationParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ExecuteActivityResponseData | IntegrationExecutionData>>;
261
+ getIntegrationExecuteById: (executionId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationExecutionData>>;
262
+ getIntegrations: (params?: GetIntegrationsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationsListData>>;
263
+ getCredentials: (params: GetCredentialsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<CredentialsListData>>;
264
+ getIntegrationResource: (params: GetIntegrationResourceParams) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationResourceData>>;
265
+ getIntegrationForm: (params: GetIntegrationFormParams) => Promise<BolticErrorResponse | BolticSuccessResponse<Record<string, unknown> | IntegrationFormJsonSchema>>;
200
266
  };
201
267
  getSqlResource(): SqlResource;
202
268
  updateApiKey(newApiKey: string): void;
@@ -231,25 +297,6 @@ declare interface BolticErrorResponse {
231
297
  };
232
298
  }
233
299
 
234
- declare interface BolticErrorResponse_2 {
235
- data?: never;
236
- message?: string;
237
- error: {
238
- code?: string;
239
- message?: string;
240
- meta?: string[];
241
- };
242
- }
243
-
244
- declare interface BolticErrorResponse_3 {
245
- data?: never;
246
- error: {
247
- code?: string;
248
- message?: string;
249
- meta?: string[];
250
- };
251
- }
252
-
253
300
  declare interface BolticListResponse<T> {
254
301
  data: T[];
255
302
  pagination?: {
@@ -267,18 +314,6 @@ declare interface BolticListResponse<T> {
267
314
  };
268
315
  }
269
316
 
270
- declare interface BolticListResponse_2<T = unknown> {
271
- data: T[];
272
- pagination?: {
273
- total_count: number;
274
- total_pages: number;
275
- current_page: number;
276
- per_page: number;
277
- type: string;
278
- };
279
- message?: string;
280
- }
281
-
282
317
  declare interface BolticSuccessResponse<T> {
283
318
  data: T;
284
319
  message?: string;
@@ -289,11 +324,6 @@ declare interface BolticSuccessResponse<T> {
289
324
  };
290
325
  }
291
326
 
292
- declare interface BolticSuccessResponse_2<T = unknown> {
293
- data: T;
294
- message?: string;
295
- }
296
-
297
327
  declare interface ClientConfig extends EnvironmentConfig {
298
328
  apiKey: string;
299
329
  environment: Environment;
@@ -407,6 +437,9 @@ export declare function createMockResponse<T>(data: T, pagination?: PaginationIn
407
437
 
408
438
  export declare function createTestClient(options?: MockClientOptions): BolticClient;
409
439
 
440
+ /** Data returned from the get-credentials API */
441
+ declare type CredentialsListData = Record<string, unknown>;
442
+
410
443
  declare interface DatabaseContext {
411
444
  databaseId?: string;
412
445
  dbInternalName?: string;
@@ -560,25 +593,39 @@ declare interface EnvironmentConfig {
560
593
 
561
594
  declare type ErrorInterceptor = (error: unknown) => unknown | Promise<unknown>;
562
595
 
563
- declare interface ExecuteSQLApiResponse {
564
- data: Record<string, unknown>[];
565
- count?: number;
566
- pagination?: {
567
- total_count: number;
568
- total_pages: number;
569
- current_page: number;
570
- per_page: number;
596
+ /** Data returned from the execute-activity API */
597
+ declare interface ExecuteActivityResponseData {
598
+ execution_id: string;
599
+ [key: string]: unknown;
600
+ }
601
+
602
+ /**
603
+ * Parameters accepted by `workflow.executeIntegration()`.
604
+ *
605
+ * @remarks
606
+ * When `executeOnly` is `false` (default), the SDK will poll
607
+ * `getIntegrationExecuteById` until the execution reaches a terminal state.
608
+ */
609
+ declare interface ExecuteIntegrationParams {
610
+ /**
611
+ * If `true`, return immediately after the execute call without polling.
612
+ * @defaultValue false
613
+ */
614
+ executeOnly?: boolean;
615
+ /** Activity data describing what to execute. The SDK wraps this into the `nodes[]` structure the API expects. */
616
+ data: {
571
617
  type: string;
618
+ name: string;
619
+ properties: ActivityProperties;
572
620
  };
573
- message?: string;
574
- error?: {
575
- code?: string;
576
- message?: string;
577
- meta?: string[];
578
- };
621
+ /**
622
+ * Result/context payload for the execute request.
623
+ * Falls back to a sensible default when omitted.
624
+ */
625
+ result?: ActivityResultPayload;
579
626
  }
580
627
 
581
- declare interface ExecuteSQLApiResponse_2 {
628
+ declare interface ExecuteSQLApiResponse {
582
629
  data: Record<string, unknown>[];
583
630
  count?: number;
584
631
  pagination?: {
@@ -634,6 +681,73 @@ declare interface FilterParams {
634
681
  values: any[];
635
682
  }
636
683
 
684
+ /** Parameters accepted by `workflow.getCredentials()`. */
685
+ declare interface GetCredentialsParams {
686
+ /** Integration name (e.g. "freshsales"). Automatically uppercased by the SDK. */
687
+ entity: string;
688
+ /**
689
+ * Current page number for pagination.
690
+ * @defaultValue 1
691
+ */
692
+ current_page?: number;
693
+ /**
694
+ * Number of items per page.
695
+ * @defaultValue 999
696
+ */
697
+ page_size?: number;
698
+ }
699
+
700
+ /** Parameters accepted by `workflow.getIntegrationForm()`. */
701
+ declare interface GetIntegrationFormParams {
702
+ /** Integration slug identifier (e.g. "blt-int.asana"). */
703
+ integration_slug: string;
704
+ /** Resource type (e.g. "project", "task"). */
705
+ resource: string;
706
+ /** Operation type (e.g. "create", "update", "read"). */
707
+ operation: string;
708
+ /** Credential secret for the integration. */
709
+ secret: string;
710
+ /**
711
+ * When `true`, returns only the form schema without executing.
712
+ * @defaultValue true
713
+ */
714
+ getFormOnly?: boolean;
715
+ /**
716
+ * When `true`, the response `data` is returned as a JSON Schema object
717
+ * describing the expected input shape (type, required, default, enum).
718
+ *
719
+ * When `false` or omitted, the response `data` is a flat JSON object
720
+ * with default/fallback values for each field.
721
+ *
722
+ * @defaultValue false
723
+ */
724
+ asJsonSchema?: boolean;
725
+ }
726
+
727
+ /** Parameters accepted by `workflow.getIntegrationResource()`. */
728
+ declare interface GetIntegrationResourceParams {
729
+ /** Integration slug identifier (e.g. "blt-int.asana"). */
730
+ integration_slug: string;
731
+ }
732
+
733
+ /** Parameters accepted by `workflow.getIntegrations()`. */
734
+ declare interface GetIntegrationsParams {
735
+ /**
736
+ * Page number for pagination.
737
+ * @defaultValue 1
738
+ */
739
+ page?: number;
740
+ /**
741
+ * Number of items per page.
742
+ * @defaultValue 999
743
+ */
744
+ per_page?: number;
745
+ }
746
+
747
+ declare interface HttpAdapter {
748
+ request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
749
+ }
750
+
637
751
  declare interface HttpRequestConfig {
638
752
  url: string;
639
753
  method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
@@ -665,6 +779,21 @@ declare interface IndexListItem {
665
779
  created_by?: string;
666
780
  }
667
781
 
782
+ /** Data returned from the get-execution-by-id API */
783
+ declare type IntegrationExecutionData = Record<string, unknown>;
784
+
785
+ /** JSON Schema output for an integration form */
786
+ declare interface IntegrationFormJsonSchema {
787
+ type: 'object';
788
+ properties: Record<string, JsonSchemaProperty>;
789
+ }
790
+
791
+ /** Data returned from the get-integration-resource API */
792
+ declare type IntegrationResourceData = Record<string, unknown>;
793
+
794
+ /** Data returned from the get-integrations API */
795
+ declare type IntegrationsListData = Record<string, unknown>;
796
+
668
797
  declare interface InterceptorManager {
669
798
  request: {
670
799
  use(interceptor: RequestInterceptor): number;
@@ -693,6 +822,15 @@ declare class InterceptorManagerImpl implements InterceptorManager {
693
822
  executeErrorInterceptors(error: unknown): Promise<unknown>;
694
823
  }
695
824
 
825
+ /** A single property in the generated JSON Schema */
826
+ declare interface JsonSchemaProperty {
827
+ type: string;
828
+ required?: boolean;
829
+ default?: unknown;
830
+ description?: string;
831
+ enum?: string[];
832
+ }
833
+
696
834
  declare interface ListIndexesQuery {
697
835
  page?: {
698
836
  page_no: number;
@@ -998,7 +1136,7 @@ export declare class SqlTestClient {
998
1136
  /**
999
1137
  * Test helper for SQL execution
1000
1138
  */
1001
- executeSQL(query: string): Promise<BolticErrorResponse_2 | ExecuteSQLApiResponse_2>;
1139
+ executeSQL(query: string): Promise<BolticErrorResponse | ExecuteSQLApiResponse>;
1002
1140
  /**
1003
1141
  * Utility to simulate streaming text-to-SQL for testing
1004
1142
  */
@@ -1011,7 +1149,6 @@ export declare class SqlTestClient {
1011
1149
  declare class TableBuilder {
1012
1150
  private tableName;
1013
1151
  private description?;
1014
- private isPublic;
1015
1152
  private fields;
1016
1153
  private tablesApiClient?;
1017
1154
  constructor(options: TableBuilderOptions, tablesApiClient?: TablesApiClient);
@@ -1023,10 +1160,6 @@ declare class TableBuilder {
1023
1160
  * Set table description
1024
1161
  */
1025
1162
  describe(description: string): TableBuilder;
1026
- /**
1027
- * Set if table is public
1028
- */
1029
- public(isPublic?: boolean): TableBuilder;
1030
1163
  /**
1031
1164
  * Add a text field
1032
1165
  */
@@ -1195,7 +1328,6 @@ declare interface TableCreateResponse {
1195
1328
  declare interface TableListOptions extends TableQueryOptions {
1196
1329
  page?: number;
1197
1330
  pageSize?: number;
1198
- isShared?: boolean;
1199
1331
  db_id?: string;
1200
1332
  }
1201
1333
 
@@ -1205,7 +1337,6 @@ declare interface TableQueryOptions {
1205
1337
  name?: string;
1206
1338
  db_id?: string;
1207
1339
  resource_id?: string;
1208
- is_public?: boolean;
1209
1340
  created_by?: string;
1210
1341
  created_at?: {
1211
1342
  $gte?: string;
@@ -1234,6 +1365,7 @@ declare interface TableRecord {
1234
1365
  type?: string;
1235
1366
  parent_table_id?: string;
1236
1367
  is_deleted: boolean;
1368
+ /** @deprecated All tables are now public by default. This field is always true and ineffective. */
1237
1369
  is_public: boolean;
1238
1370
  created_by: string;
1239
1371
  created_at: string;
@@ -1244,67 +1376,45 @@ declare interface TableRecord {
1244
1376
  source?: 'boltic' | 'copilot';
1245
1377
  }
1246
1378
 
1247
- /**
1248
- * Tables API Client - handles all table-related API operations
1249
- */
1250
- declare class TablesApiClient {
1251
- private httpAdapter;
1252
- private config;
1253
- private baseURL;
1254
- constructor(apiKey: string, config?: Omit<TablesApiClientConfig, 'apiKey'>);
1255
- private getBaseURL;
1379
+ declare class TablesApiClient extends BaseApiClient {
1380
+ constructor(apiKey: string, config?: Omit<BaseApiClientConfig, 'apiKey'>);
1256
1381
  /**
1257
1382
  * Create a new table
1258
1383
  */
1259
- createTable(request: TableCreateRequest, options?: TableCreateOptions): Promise<BolticSuccessResponse_2<TableCreateResponse> | BolticErrorResponse_3>;
1384
+ createTable(request: TableCreateRequest, options?: TableCreateOptions): Promise<BolticSuccessResponse<TableCreateResponse> | BolticErrorResponse>;
1260
1385
  /**
1261
1386
  * List tables with filtering and pagination
1262
1387
  */
1263
- listTables(options?: TableListOptions): Promise<BolticListResponse_2<TableRecord> | BolticErrorResponse_3>;
1388
+ listTables(options?: TableListOptions): Promise<BolticListResponse<TableRecord> | BolticErrorResponse>;
1264
1389
  /**
1265
1390
  * Get a specific table by ID
1266
1391
  */
1267
1392
  getTable(tableId: string, options?: {
1268
1393
  fields?: Array<keyof TableRecord>;
1269
1394
  db_id?: string;
1270
- }): Promise<BolticSuccessResponse_2<TableRecord> | BolticErrorResponse_3>;
1395
+ }): Promise<BolticSuccessResponse<TableRecord> | BolticErrorResponse>;
1271
1396
  /**
1272
1397
  * Update an existing table
1273
1398
  */
1274
1399
  updateTable(tableId: string, updates: {
1275
1400
  name?: string;
1276
1401
  description?: string;
1277
- is_shared?: boolean;
1278
1402
  fields?: Array<keyof TableRecord>;
1279
1403
  db_id?: string;
1280
- }): Promise<BolticSuccessResponse_2<TableRecord> | BolticErrorResponse_3>;
1404
+ }): Promise<BolticSuccessResponse<TableRecord> | BolticErrorResponse>;
1281
1405
  /**
1282
1406
  * Delete a table
1283
1407
  */
1284
1408
  deleteTable(tableId: string, options?: {
1285
1409
  db_id?: string;
1286
- }): Promise<BolticSuccessResponse_2<{
1410
+ }): Promise<BolticSuccessResponse<{
1287
1411
  message: string;
1288
- }> | BolticErrorResponse_3>;
1289
- private buildHeaders;
1290
- private formatErrorResponse;
1291
- }
1292
-
1293
- declare interface TablesApiClientConfig {
1294
- apiKey: string;
1295
- environment?: Environment;
1296
- region?: Region;
1297
- timeout?: number;
1298
- debug?: boolean;
1299
- retryAttempts?: number;
1300
- retryDelay?: number;
1301
- headers?: Record<string, string>;
1412
+ }> | BolticErrorResponse>;
1302
1413
  }
1303
1414
 
1304
1415
  declare interface TableUpdateRequest {
1305
1416
  name?: string;
1306
1417
  description?: string;
1307
- is_shared?: boolean;
1308
1418
  fields?: Array<keyof TableRecord>;
1309
1419
  }
1310
1420
 
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./test-client-Bo_BCApL.js");class t{static async*fromSSE(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:o}=await t.read();if(e)break;const r=s.decode(o,{stream:!0}).split("\n");for(const t of r)if(t.startsWith("data: ")){const e=t.slice(6);"[DONE]"!==e&&(yield e)}}}finally{t.releaseLock()}}static async*fromChunked(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:o}=await t.read();if(e)break;const r=s.decode(o,{stream:!0});yield r}}finally{t.releaseLock()}}static async collectAll(e){let t="";for await(const s of e)t+=s;return t}static async*fromString(e,t=10){for(let s=0;s<e.length;s+=t)yield e.slice(s,s+t),await new Promise(e=>setTimeout(e,50))}static async*map(e,t){for await(const s of e)yield await t(s)}static async*filter(e,t){for await(const s of e)await t(s)&&(yield s)}static async*take(e,t){let s=0;for await(const o of e){if(s>=t)break;yield o,s++}}}exports.createErrorResponse=e.createErrorResponse,exports.createMockResponse=e.createMockResponse,exports.createTestClient=e.createTestClient,exports.SqlTestClient=class{constructor(e){this.sql=e}async generateSQL(e,s){const o=await this.sql.textToSQL(e,s);return t.collectAll(o)}async executeSQL(e){return this.sql.executeSQL(e)}async*simulateStreamingSQL(e,t=10,s=50){for(let o=0;o<e.length;o+=t)yield e.slice(o,o+t),await new Promise(e=>setTimeout(e,s))}},exports.TEST_UTILS_VERSION="1.0.0";
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./test-client-BgkvBtst.js");class t{static async*fromSSE(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:o}=await t.read();if(e)break;const r=s.decode(o,{stream:!0}).split("\n");for(const t of r)if(t.startsWith("data: ")){const e=t.slice(6);"[DONE]"!==e&&(yield e)}}}finally{t.releaseLock()}}static async*fromChunked(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:o}=await t.read();if(e)break;const r=s.decode(o,{stream:!0});yield r}}finally{t.releaseLock()}}static async collectAll(e){let t="";for await(const s of e)t+=s;return t}static async*fromString(e,t=10){for(let s=0;s<e.length;s+=t)yield e.slice(s,s+t),await new Promise(e=>setTimeout(e,50))}static async*map(e,t){for await(const s of e)yield await t(s)}static async*filter(e,t){for await(const s of e)await t(s)&&(yield s)}static async*take(e,t){let s=0;for await(const o of e){if(s>=t)break;yield o,s++}}}exports.createErrorResponse=e.createErrorResponse,exports.createMockResponse=e.createMockResponse,exports.createTestClient=e.createTestClient,exports.SqlTestClient=class{constructor(e){this.sql=e}async generateSQL(e,s){const o=await this.sql.textToSQL(e,s);return t.collectAll(o)}async executeSQL(e){return this.sql.executeSQL(e)}async*simulateStreamingSQL(e,t=10,s=50){for(let o=0;o<e.length;o+=t)yield e.slice(o,o+t),await new Promise(e=>setTimeout(e,s))}},exports.TEST_UTILS_VERSION="1.0.0";
2
2
  //# sourceMappingURL=testing.js.map
@@ -1,2 +1,2 @@
1
- import{o as e,p as t,q as s}from"./test-client-C9T839dW.mjs";class a{static async*fromSSE(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:a}=await t.read();if(e)break;const o=s.decode(a,{stream:!0}).split("\n");for(const t of o)if(t.startsWith("data: ")){const e=t.slice(6);"[DONE]"!==e&&(yield e)}}}finally{t.releaseLock()}}static async*fromChunked(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:a}=await t.read();if(e)break;const o=s.decode(a,{stream:!0});yield o}}finally{t.releaseLock()}}static async collectAll(e){let t="";for await(const s of e)t+=s;return t}static async*fromString(e,t=10){for(let s=0;s<e.length;s+=t)yield e.slice(s,s+t),await new Promise(e=>setTimeout(e,50))}static async*map(e,t){for await(const s of e)yield await t(s)}static async*filter(e,t){for await(const s of e)await t(s)&&(yield s)}static async*take(e,t){let s=0;for await(const a of e){if(s>=t)break;yield a,s++}}}class o{constructor(e){this.sql=e}async generateSQL(e,t){const s=await this.sql.textToSQL(e,t);return a.collectAll(s)}async executeSQL(e){return this.sql.executeSQL(e)}async*simulateStreamingSQL(e,t=10,s=50){for(let a=0;a<e.length;a+=t)yield e.slice(a,a+t),await new Promise(e=>setTimeout(e,s))}}const r="1.0.0";export{o as SqlTestClient,r as TEST_UTILS_VERSION,e as createErrorResponse,t as createMockResponse,s as createTestClient};
1
+ import{o as e,p as t,q as s}from"./test-client-BEAX5vfC.mjs";class a{static async*fromSSE(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:a}=await t.read();if(e)break;const o=s.decode(a,{stream:!0}).split("\n");for(const t of o)if(t.startsWith("data: ")){const e=t.slice(6);"[DONE]"!==e&&(yield e)}}}finally{t.releaseLock()}}static async*fromChunked(e){if(!e.body)throw new Error("Response body is null");const t=e.body.getReader(),s=new TextDecoder;try{for(;;){const{done:e,value:a}=await t.read();if(e)break;const o=s.decode(a,{stream:!0});yield o}}finally{t.releaseLock()}}static async collectAll(e){let t="";for await(const s of e)t+=s;return t}static async*fromString(e,t=10){for(let s=0;s<e.length;s+=t)yield e.slice(s,s+t),await new Promise(e=>setTimeout(e,50))}static async*map(e,t){for await(const s of e)yield await t(s)}static async*filter(e,t){for await(const s of e)await t(s)&&(yield s)}static async*take(e,t){let s=0;for await(const a of e){if(s>=t)break;yield a,s++}}}class o{constructor(e){this.sql=e}async generateSQL(e,t){const s=await this.sql.textToSQL(e,t);return a.collectAll(s)}async executeSQL(e){return this.sql.executeSQL(e)}async*simulateStreamingSQL(e,t=10,s=50){for(let a=0;a<e.length;a+=t)yield e.slice(a,a+t),await new Promise(e=>setTimeout(e,s))}}const r="1.0.0";export{o as SqlTestClient,r as TEST_UTILS_VERSION,e as createErrorResponse,t as createMockResponse,s as createTestClient};
2
2
  //# sourceMappingURL=testing.mjs.map