@permute/sdk 0.1.1 → 0.1.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
@@ -80,6 +80,26 @@ Blobs. REST callers provide `sizeBytes`, then send a raw `PUT` to the returned
80
80
  `client.datasets.get(result.id)` for processing status; there is no completion
81
81
  API call.
82
82
 
83
+ CSV, TSV, JSON, NDJSON, and Parquet files can be up to 1 GiB (1,073,741,824
84
+ bytes). Other supported file types can be up to 100 MiB (104,857,600 bytes).
85
+ Permute selects the limit from the submitted `contentType` and rejects an
86
+ oversized file before issuing its signed upload target.
87
+
88
+ Request a signed URL for the original uploaded file, or delete one file or custom
89
+ dataset when the API key has dataset admin access:
90
+
91
+ ```ts
92
+ const downloadUrl = await client.datasets.download(uploaded.id);
93
+ const response = await fetch(downloadUrl);
94
+ const bytes = await response.arrayBuffer();
95
+ console.log(response.headers.get('content-type'), bytes.byteLength);
96
+
97
+ await client.datasets.delete(uploaded.id);
98
+ ```
99
+
100
+ For large files, consume `response.body` as a stream instead of buffering the full
101
+ response. Signed download URLs expire after 15 minutes.
102
+
83
103
  ## Manage Custom Datasets
84
104
 
85
105
  Create a custom dataset by a stable workspace key when one logical source
@@ -176,7 +196,10 @@ console.log(evidence.items);
176
196
 
177
197
  Use SQL only when table names are known and exact rows matter. SQL requests must
178
198
  include `sourceIds`; call `client.sources.get()` first when table names are not
179
- known.
199
+ known, and use the returned table names exactly. Warehouse-backed sources use
200
+ DuckDB SQL and can be queried together. Live remote database connectors use
201
+ their native dialect—GoogleSQL for BigQuery and PostgreSQL for Supabase—and
202
+ must be queried one at a time without other sources.
180
203
 
181
204
  ```ts
182
205
  const details = await client.sources.get(sourceIds[0]);
@@ -201,6 +224,7 @@ try {
201
224
  });
202
225
  } catch (error) {
203
226
  if (error instanceof PermuteApiError) {
227
+ // Invalid SQL returns status 400 with an actionable message when available.
204
228
  console.error(error.status, error.code, error.message, error.requestId);
205
229
  }
206
230
  throw error;
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Workspace, WorkspaceCreateRequest, WorkspaceDeleteResponse, WorkspaceList, WorkspaceUpdateRequest, AnswerRequest, AnswerJobResponse, AnswerResponse, PermuteClientOptions, PermuteRequestOptions, QueryRequest, QueryResponse, SearchRequest, SearchResponse, SourceDetail, SourceList, CustomDatasetCreateRequest, DatasetResponse, FileDatasetCreateRequest, FileDatasetResponse, DatasetRows, CustomDatasetResponse } from './types.js';
1
+ import type { Workspace, WorkspaceCreateRequest, WorkspaceDeleteResponse, WorkspaceList, WorkspaceUpdateRequest, AnswerRequest, AnswerJobResponse, AnswerResponse, PermuteClientOptions, PermuteRequestOptions, QueryRequest, QueryResponse, SearchRequest, SearchResponse, SourceDetail, SourceList, CustomDatasetCreateRequest, DatasetDeleteResponse, DatasetResponse, FileDatasetCreateRequest, FileDatasetResponse, DatasetRows, CustomDatasetResponse } from './types.js';
2
2
  export declare class PermuteApiError extends Error {
3
3
  readonly status: number;
4
4
  readonly code: string;
@@ -79,6 +79,8 @@ export declare class PermuteClient {
79
79
  };
80
80
  getByKey: (key: string, options?: PermuteRequestOptions) => Promise<PermuteDataset | PermuteFileDataset>;
81
81
  get: (datasetId: string, options?: PermuteRequestOptions) => Promise<PermuteDataset | PermuteFileDataset>;
82
+ download: (datasetId: string, options?: PermuteRequestOptions) => Promise<string>;
83
+ delete: (datasetId: string, options?: PermuteRequestOptions) => Promise<DatasetDeleteResponse>;
82
84
  };
83
85
  private readonly apiKey;
84
86
  private readonly baseUrl;
package/dist/client.js CHANGED
@@ -428,6 +428,11 @@ export class PermuteClient {
428
428
  const dataset = await readDataset(datasetId, requestOptions);
429
429
  return wrapDataset(dataset);
430
430
  },
431
+ download: async (datasetId, requestOptions) => {
432
+ const { url } = await this.request('datasetsDownload', { pathParams: { datasetId } }, requestOptions);
433
+ return url;
434
+ },
435
+ delete: (datasetId, requestOptions) => this.request('datasetsDelete', { pathParams: { datasetId } }, requestOptions),
431
436
  };
432
437
  }
433
438
  async search(request, options) {
@@ -164,6 +164,15 @@ export interface components {
164
164
  /** @enum {string} */
165
165
  type: 'file';
166
166
  };
167
+ DatasetDeleteResponse: {
168
+ /** @enum {boolean} */
169
+ deleted: true;
170
+ id: string;
171
+ };
172
+ DatasetDownloadResponse: {
173
+ /** Format: uri */
174
+ url: string;
175
+ };
167
176
  DatasetIdParams: {
168
177
  datasetId: string;
169
178
  };
@@ -413,6 +422,14 @@ export interface components {
413
422
  type: 'record' | 'document' | 'table' | 'text_block' | 'unknown';
414
423
  };
415
424
  Source: {
425
+ availability: {
426
+ /** Format: date-time */
427
+ lastSuccessfulAt?: string;
428
+ reason?: string;
429
+ /** @enum {string} */
430
+ status: 'ready' | 'refreshing' | 'degraded' | 'preparing' | 'failed';
431
+ };
432
+ capabilities: 'query'[];
416
433
  context?: string[];
417
434
  fileType?: string;
418
435
  id: string;
@@ -420,13 +437,21 @@ export interface components {
420
437
  provider?: string;
421
438
  summary?: string | null;
422
439
  /** @enum {string} */
423
- type: 'dataset' | 'connector';
440
+ type: 'dataset' | 'connector' | 'report' | 'dashboard' | 'dataTable';
424
441
  };
425
442
  SourceDetail: {
426
443
  metadata?: {
427
444
  [key: string]: unknown;
428
445
  };
429
446
  source: {
447
+ availability: {
448
+ /** Format: date-time */
449
+ lastSuccessfulAt?: string;
450
+ reason?: string;
451
+ /** @enum {string} */
452
+ status: 'ready' | 'refreshing' | 'degraded' | 'preparing' | 'failed';
453
+ };
454
+ capabilities: 'query'[];
430
455
  context?: string[];
431
456
  fileType?: string;
432
457
  id: string;
@@ -434,7 +459,7 @@ export interface components {
434
459
  provider?: string;
435
460
  summary?: string | null;
436
461
  /** @enum {string} */
437
- type: 'dataset' | 'connector';
462
+ type: 'dataset' | 'connector' | 'report' | 'dashboard' | 'dataTable';
438
463
  };
439
464
  tables: {
440
465
  fieldCount?: number;
@@ -456,6 +481,14 @@ export interface components {
456
481
  };
457
482
  SourceList: {
458
483
  items: {
484
+ availability: {
485
+ /** Format: date-time */
486
+ lastSuccessfulAt?: string;
487
+ reason?: string;
488
+ /** @enum {string} */
489
+ status: 'ready' | 'refreshing' | 'degraded' | 'preparing' | 'failed';
490
+ };
491
+ capabilities: 'query'[];
459
492
  context?: string[];
460
493
  fileType?: string;
461
494
  id: string;
@@ -463,7 +496,7 @@ export interface components {
463
496
  provider?: string;
464
497
  summary?: string | null;
465
498
  /** @enum {string} */
466
- type: 'dataset' | 'connector';
499
+ type: 'dataset' | 'connector' | 'report' | 'dashboard' | 'dataTable';
467
500
  }[];
468
501
  };
469
502
  UploadProgress: {
@@ -8,5 +8,5 @@ export interface RuntimeRoute {
8
8
  querySchema: JsonSchema | null;
9
9
  responseSchema: JsonSchema;
10
10
  }
11
- export type PublicApiOperationId = 'workspacesList' | 'workspacesCreate' | 'workspacesGet' | 'workspacesUpdate' | 'workspacesDelete' | 'sourcesList' | 'sourcesGet' | 'datasetsCreate' | 'datasetsGetByKey' | 'datasetsGet' | 'datasetsWriteTables' | 'searchCreate' | 'answerJobsCreate' | 'answerJobsGet' | 'queriesCreate';
11
+ export type PublicApiOperationId = 'workspacesList' | 'workspacesCreate' | 'workspacesGet' | 'workspacesUpdate' | 'workspacesDelete' | 'sourcesList' | 'sourcesGet' | 'datasetsCreate' | 'datasetsGetByKey' | 'datasetsGet' | 'datasetsDelete' | 'datasetsDownload' | 'datasetsWriteTables' | 'searchCreate' | 'answerJobsCreate' | 'answerJobsGet' | 'queriesCreate';
12
12
  export declare const publicApiRoutes: Record<PublicApiOperationId, RuntimeRoute>;
@@ -237,7 +237,7 @@ export const publicApiRoutes = {
237
237
  },
238
238
  type: {
239
239
  type: 'string',
240
- enum: ['dataset', 'connector'],
240
+ enum: ['dataset', 'connector', 'report', 'dashboard', 'dataTable'],
241
241
  },
242
242
  name: {
243
243
  type: 'string',
@@ -258,8 +258,33 @@ export const publicApiRoutes = {
258
258
  fileType: {
259
259
  type: 'string',
260
260
  },
261
+ capabilities: {
262
+ type: 'array',
263
+ items: {
264
+ type: 'string',
265
+ enum: ['query'],
266
+ },
267
+ },
268
+ availability: {
269
+ type: 'object',
270
+ properties: {
271
+ status: {
272
+ type: 'string',
273
+ enum: ['ready', 'refreshing', 'degraded', 'preparing', 'failed'],
274
+ },
275
+ lastSuccessfulAt: {
276
+ type: 'string',
277
+ format: 'date-time',
278
+ },
279
+ reason: {
280
+ type: 'string',
281
+ },
282
+ },
283
+ required: ['status'],
284
+ additionalProperties: false,
285
+ },
261
286
  },
262
- required: ['id', 'type', 'name'],
287
+ required: ['id', 'type', 'name', 'capabilities', 'availability'],
263
288
  additionalProperties: false,
264
289
  },
265
290
  },
@@ -286,7 +311,7 @@ export const publicApiRoutes = {
286
311
  },
287
312
  type: {
288
313
  type: 'string',
289
- enum: ['dataset', 'connector'],
314
+ enum: ['dataset', 'connector', 'report', 'dashboard', 'dataTable'],
290
315
  },
291
316
  name: {
292
317
  type: 'string',
@@ -307,8 +332,33 @@ export const publicApiRoutes = {
307
332
  fileType: {
308
333
  type: 'string',
309
334
  },
335
+ capabilities: {
336
+ type: 'array',
337
+ items: {
338
+ type: 'string',
339
+ enum: ['query'],
340
+ },
341
+ },
342
+ availability: {
343
+ type: 'object',
344
+ properties: {
345
+ status: {
346
+ type: 'string',
347
+ enum: ['ready', 'refreshing', 'degraded', 'preparing', 'failed'],
348
+ },
349
+ lastSuccessfulAt: {
350
+ type: 'string',
351
+ format: 'date-time',
352
+ },
353
+ reason: {
354
+ type: 'string',
355
+ },
356
+ },
357
+ required: ['status'],
358
+ additionalProperties: false,
359
+ },
310
360
  },
311
- required: ['id', 'type', 'name'],
361
+ required: ['id', 'type', 'name', 'capabilities', 'availability'],
312
362
  additionalProperties: false,
313
363
  },
314
364
  metadata: {
@@ -1031,6 +1081,47 @@ export const publicApiRoutes = {
1031
1081
  ],
1032
1082
  },
1033
1083
  },
1084
+ datasetsDelete: {
1085
+ operationId: 'datasetsDelete',
1086
+ method: 'DELETE',
1087
+ path: '/v1/datasets/{datasetId}',
1088
+ scope: 'workspace',
1089
+ bodySchema: null,
1090
+ querySchema: null,
1091
+ responseSchema: {
1092
+ type: 'object',
1093
+ properties: {
1094
+ id: {
1095
+ type: 'string',
1096
+ },
1097
+ deleted: {
1098
+ type: 'boolean',
1099
+ enum: [true],
1100
+ },
1101
+ },
1102
+ required: ['id', 'deleted'],
1103
+ additionalProperties: false,
1104
+ },
1105
+ },
1106
+ datasetsDownload: {
1107
+ operationId: 'datasetsDownload',
1108
+ method: 'GET',
1109
+ path: '/v1/datasets/{datasetId}/download',
1110
+ scope: 'workspace',
1111
+ bodySchema: null,
1112
+ querySchema: null,
1113
+ responseSchema: {
1114
+ type: 'object',
1115
+ properties: {
1116
+ url: {
1117
+ type: 'string',
1118
+ format: 'uri',
1119
+ },
1120
+ },
1121
+ required: ['url'],
1122
+ additionalProperties: false,
1123
+ },
1124
+ },
1034
1125
  datasetsWriteTables: {
1035
1126
  operationId: 'datasetsWriteTables',
1036
1127
  method: 'POST',
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './types.js';
2
2
  export * from './client.js';
3
3
  export declare const CONTEXT: {
4
+ readonly Acumatica: "acumatica";
4
5
  readonly QuickBooks: "quickbooks";
5
6
  readonly HubSpot: "hubspot";
6
7
  readonly Attio: "attio";
@@ -12,6 +13,7 @@ export declare const CONTEXT: {
12
13
  readonly Klaviyo: "klaviyo";
13
14
  readonly Mercury: "mercury";
14
15
  readonly Monday: "monday";
16
+ readonly Shopify: "shopify";
15
17
  readonly Stripe: "stripe";
16
18
  readonly Xero: "xero";
17
19
  };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './types.js';
2
2
  export * from './client.js';
3
3
  export const CONTEXT = {
4
+ Acumatica: 'acumatica',
4
5
  QuickBooks: 'quickbooks',
5
6
  HubSpot: 'hubspot',
6
7
  Attio: 'attio',
@@ -12,6 +13,7 @@ export const CONTEXT = {
12
13
  Klaviyo: 'klaviyo',
13
14
  Mercury: 'mercury',
14
15
  Monday: 'monday',
16
+ Shopify: 'shopify',
15
17
  Stripe: 'stripe',
16
18
  Xero: 'xero',
17
19
  };
package/dist/types.d.ts CHANGED
@@ -12,6 +12,8 @@ export type CatalogField = PublicApiSchema<'CatalogField'>;
12
12
  export type CatalogTable = PublicApiSchema<'CatalogTable'>;
13
13
  type DatasetApiCreateRequest = PublicApiSchema<'DatasetCreateRequest'>;
14
14
  export type DatasetResponse = PublicApiSchema<'DatasetResponse'>;
15
+ export type DatasetDownloadResponse = PublicApiSchema<'DatasetDownloadResponse'>;
16
+ export type DatasetDeleteResponse = PublicApiSchema<'DatasetDeleteResponse'>;
15
17
  export type CustomDatasetResponse = PublicApiSchema<'CustomDatasetResponse'>;
16
18
  export type FileDatasetResponse = PublicApiSchema<'FileDatasetResponse'>;
17
19
  export type DatasetUploadBody = string | Blob | ArrayBuffer | ArrayBufferView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@permute/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "TypeScript client for the Permute public API",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",