bem-ai-sdk 0.2.0 → 0.4.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +13 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +13 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +13 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +13 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/functions/functions.d.mts +233 -14
  12. package/resources/functions/functions.d.mts.map +1 -1
  13. package/resources/functions/functions.d.ts +233 -14
  14. package/resources/functions/functions.d.ts.map +1 -1
  15. package/resources/functions/functions.js.map +1 -1
  16. package/resources/functions/functions.mjs.map +1 -1
  17. package/resources/functions/versions.d.mts +45 -1
  18. package/resources/functions/versions.d.mts.map +1 -1
  19. package/resources/functions/versions.d.ts +45 -1
  20. package/resources/functions/versions.d.ts.map +1 -1
  21. package/resources/index.d.mts +1 -0
  22. package/resources/index.d.mts.map +1 -1
  23. package/resources/index.d.ts +1 -0
  24. package/resources/index.d.ts.map +1 -1
  25. package/resources/index.js +3 -1
  26. package/resources/index.js.map +1 -1
  27. package/resources/index.mjs +1 -0
  28. package/resources/index.mjs.map +1 -1
  29. package/resources/infer-schema.d.mts +133 -0
  30. package/resources/infer-schema.d.mts.map +1 -0
  31. package/resources/infer-schema.d.ts +133 -0
  32. package/resources/infer-schema.d.ts.map +1 -0
  33. package/resources/infer-schema.js +54 -0
  34. package/resources/infer-schema.js.map +1 -0
  35. package/resources/infer-schema.mjs +50 -0
  36. package/resources/infer-schema.mjs.map +1 -0
  37. package/resources/workflows/workflows.d.mts +58 -15
  38. package/resources/workflows/workflows.d.mts.map +1 -1
  39. package/resources/workflows/workflows.d.ts +58 -15
  40. package/resources/workflows/workflows.d.ts.map +1 -1
  41. package/resources/workflows/workflows.js +17 -7
  42. package/resources/workflows/workflows.js.map +1 -1
  43. package/resources/workflows/workflows.mjs +18 -8
  44. package/resources/workflows/workflows.mjs.map +1 -1
  45. package/src/client.ts +19 -0
  46. package/src/resources/functions/functions.ts +287 -8
  47. package/src/resources/functions/versions.ts +60 -0
  48. package/src/resources/index.ts +1 -0
  49. package/src/resources/infer-schema.ts +160 -0
  50. package/src/resources/workflows/workflows.ts +104 -17
  51. package/src/version.ts +1 -1
  52. package/version.d.mts +1 -1
  53. package/version.d.ts +1 -1
  54. package/version.js +1 -1
  55. package/version.mjs +1 -1
@@ -15,7 +15,7 @@ import {
15
15
  } from '../../core/pagination';
16
16
  import { buildHeaders } from '../../internal/headers';
17
17
  import { RequestOptions } from '../../internal/request-options';
18
- import { multipartFormRequestOptions } from '../../internal/uploads';
18
+ import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
19
19
  import { path } from '../../internal/utils/path';
20
20
 
21
21
  /**
@@ -70,16 +70,25 @@ export class Workflows extends APIResource {
70
70
  }
71
71
 
72
72
  /**
73
- * **Invoke a workflow by submitting a multipart form request.**
73
+ * **Invoke a workflow.**
74
74
  *
75
- * Workflows can only be called via multipart form in V3. Submit the input file
76
- * along with an optional reference ID for tracking.
75
+ * Submit the input file as either a multipart form request or a JSON request with
76
+ * base64-encoded file content. The workflow name is derived from the URL path.
77
+ *
78
+ * ## Input Formats
79
+ *
80
+ * - **Multipart form** (`multipart/form-data`): attach the file directly via the
81
+ * `file` or `files` fields. Set `wait` in the form body to control synchronous
82
+ * behaviour.
83
+ * - **JSON** (`application/json`): base64-encode the file content and set it in
84
+ * `input.singleFile.inputContent` or `input.batchFiles.inputs[*].inputContent`.
85
+ * Pass `wait=true` as a query parameter to control synchronous behaviour.
77
86
  *
78
87
  * ## Synchronous vs Asynchronous
79
88
  *
80
89
  * By default the call is created asynchronously and this endpoint returns
81
- * `202 Accepted` immediately with a `pending` call object. Set the `wait` field to
82
- * `true` to block until the call completes (up to 30 seconds):
90
+ * `202 Accepted` immediately with a `pending` call object. Set `wait` to `true` to
91
+ * block until the call completes (up to 30 seconds):
83
92
  *
84
93
  * - On success: returns `200 OK` with the completed call, `outputs` populated
85
94
  * - On failure: returns `500 Internal Server Error` with the call and an `error`
@@ -93,12 +102,13 @@ export class Workflows extends APIResource {
93
102
  */
94
103
  call(
95
104
  workflowName: string,
96
- body: WorkflowCallParams,
105
+ params: WorkflowCallParams,
97
106
  options?: RequestOptions,
98
107
  ): APIPromise<CallsAPI.CallGetResponse> {
108
+ const { wait, ...body } = params;
99
109
  return this._client.post(
100
110
  path`/v3/workflows/${workflowName}/call`,
101
- multipartFormRequestOptions({ body, ...options }, this._client),
111
+ maybeMultipartFormRequestOptions({ query: { wait }, body, ...options }, this._client),
102
112
  );
103
113
  }
104
114
 
@@ -498,25 +508,102 @@ export interface WorkflowListParams extends WorkflowsPageParams {
498
508
 
499
509
  export interface WorkflowCallParams {
500
510
  /**
501
- * Your reference ID for tracking this call.
511
+ * Body param: Input to the workflow call. Provide exactly one of `singleFile` or
512
+ * `batchFiles`.
502
513
  */
503
- callReferenceID?: string;
514
+ input: WorkflowCallParams.Input;
504
515
 
505
516
  /**
506
- * Single input file (for transform, analyze, route, and split functions).
517
+ * Query param: When `true`, the endpoint blocks until the call completes (up to 30
518
+ * seconds) and returns the finished call object. Default: `false`.
507
519
  */
508
- file?: unknown;
520
+ wait?: boolean;
509
521
 
510
522
  /**
511
- * Multiple input files (for join functions).
523
+ * Body param: Your reference ID for tracking this call.
512
524
  */
513
- files?: Array<unknown>;
525
+ callReferenceID?: string;
526
+ }
514
527
 
528
+ export namespace WorkflowCallParams {
515
529
  /**
516
- * When `true`, the endpoint blocks until the call completes (up to 30 seconds) and
517
- * returns the finished call object. Default: `false`.
530
+ * Input to the workflow call. Provide exactly one of `singleFile` or `batchFiles`.
518
531
  */
519
- wait?: string;
532
+ export interface Input {
533
+ batchFiles?: Input.BatchFiles;
534
+
535
+ singleFile?: Input.SingleFile;
536
+ }
537
+
538
+ export namespace Input {
539
+ export interface BatchFiles {
540
+ inputs?: Array<BatchFiles.Input>;
541
+ }
542
+
543
+ export namespace BatchFiles {
544
+ export interface Input {
545
+ /**
546
+ * Base64-encoded file content
547
+ */
548
+ inputContent: string;
549
+
550
+ /**
551
+ * The input type of the content you're sending for transformation.
552
+ */
553
+ inputType:
554
+ | 'csv'
555
+ | 'docx'
556
+ | 'email'
557
+ | 'heic'
558
+ | 'html'
559
+ | 'jpeg'
560
+ | 'json'
561
+ | 'heif'
562
+ | 'm4a'
563
+ | 'mp3'
564
+ | 'pdf'
565
+ | 'png'
566
+ | 'text'
567
+ | 'wav'
568
+ | 'webp'
569
+ | 'xls'
570
+ | 'xlsx'
571
+ | 'xml';
572
+
573
+ itemReferenceID?: string;
574
+ }
575
+ }
576
+
577
+ export interface SingleFile {
578
+ /**
579
+ * Base64-encoded file content
580
+ */
581
+ inputContent: string;
582
+
583
+ /**
584
+ * The input type of the content you're sending for transformation.
585
+ */
586
+ inputType:
587
+ | 'csv'
588
+ | 'docx'
589
+ | 'email'
590
+ | 'heic'
591
+ | 'html'
592
+ | 'jpeg'
593
+ | 'json'
594
+ | 'heif'
595
+ | 'm4a'
596
+ | 'mp3'
597
+ | 'pdf'
598
+ | 'png'
599
+ | 'text'
600
+ | 'wav'
601
+ | 'webp'
602
+ | 'xls'
603
+ | 'xlsx'
604
+ | 'xml';
605
+ }
606
+ }
520
607
  }
521
608
 
522
609
  export interface WorkflowCopyParams {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.4.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.4.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.4.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.0'; // x-release-please-version
4
+ exports.VERSION = '0.4.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.4.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map