bem-ai-sdk 0.3.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.
@@ -87,6 +87,7 @@ export type CreateFunction =
87
87
  | CreateFunction.TransformFunction
88
88
  | CreateFunction.AnalyzeFunction
89
89
  | CreateFunction.RouteFunction
90
+ | CreateFunction.SendFunction
90
91
  | CreateFunction.SplitFunction
91
92
  | CreateFunction.JoinFunction
92
93
  | CreateFunction.PayloadShapingFunction
@@ -187,6 +188,56 @@ export namespace CreateFunction {
187
188
  tags?: Array<string>;
188
189
  }
189
190
 
191
+ export interface SendFunction {
192
+ /**
193
+ * Name of function. Must be UNIQUE on a per-environment basis.
194
+ */
195
+ functionName: string;
196
+
197
+ type: 'send';
198
+
199
+ /**
200
+ * Destination type for a Send function.
201
+ */
202
+ destinationType?: 'webhook' | 's3' | 'google_drive';
203
+
204
+ /**
205
+ * Display name of function. Human-readable name to help you identify the function.
206
+ */
207
+ displayName?: string;
208
+
209
+ /**
210
+ * Google Drive folder ID. Required when destinationType is google_drive. Managed
211
+ * via Paragon OAuth.
212
+ */
213
+ googleDriveFolderId?: string;
214
+
215
+ /**
216
+ * S3 bucket to upload the payload to. Required when destinationType is s3.
217
+ */
218
+ s3Bucket?: string;
219
+
220
+ /**
221
+ * Optional S3 key prefix (folder path).
222
+ */
223
+ s3Prefix?: string;
224
+
225
+ /**
226
+ * Array of tags to categorize and organize functions.
227
+ */
228
+ tags?: Array<string>;
229
+
230
+ /**
231
+ * Whether to sign webhook payloads with an HMAC-SHA256 signature.
232
+ */
233
+ webhookSigningEnabled?: boolean;
234
+
235
+ /**
236
+ * Webhook URL to POST the payload to. Required when destinationType is webhook.
237
+ */
238
+ webhookUrl?: string;
239
+ }
240
+
190
241
  export interface SplitFunction {
191
242
  /**
192
243
  * Name of function. Must be UNIQUE on a per-environment basis.
@@ -491,15 +542,15 @@ export interface EnrichStep {
491
542
  }
492
543
 
493
544
  /**
494
- * A function that transforms and customizes input payloads using JMESPath
495
- * expressions. Payload shaping allows you to extract specific data, perform
496
- * calculations, and reshape complex input structures into simplified, standardized
497
- * output formats tailored to your downstream systems or business requirements.
545
+ * A function that delivers workflow outputs to an external destination. Send
546
+ * functions receive the output of an upstream workflow node and forward it to a
547
+ * webhook, S3 bucket, or Google Drive folder.
498
548
  */
499
549
  export type Function =
500
550
  | Function.TransformFunction
501
551
  | Function.AnalyzeFunction
502
552
  | Function.RouteFunction
553
+ | Function.SendFunction
503
554
  | Function.SplitFunction
504
555
  | Function.JoinFunction
505
556
  | Function.PayloadShapingFunction
@@ -672,6 +723,81 @@ export namespace Function {
672
723
  usedInWorkflows?: Array<FunctionsAPI.WorkflowUsageInfo>;
673
724
  }
674
725
 
726
+ /**
727
+ * A function that delivers workflow outputs to an external destination. Send
728
+ * functions receive the output of an upstream workflow node and forward it to a
729
+ * webhook, S3 bucket, or Google Drive folder.
730
+ */
731
+ export interface SendFunction {
732
+ /**
733
+ * Destination type for a Send function.
734
+ */
735
+ destinationType: 'webhook' | 's3' | 'google_drive';
736
+
737
+ /**
738
+ * Unique identifier of function.
739
+ */
740
+ functionID: string;
741
+
742
+ /**
743
+ * Name of function. Must be UNIQUE on a per-environment basis.
744
+ */
745
+ functionName: string;
746
+
747
+ type: 'send';
748
+
749
+ /**
750
+ * Version number of function.
751
+ */
752
+ versionNum: number;
753
+
754
+ /**
755
+ * Audit trail information for the function.
756
+ */
757
+ audit?: FunctionsAPI.FunctionAudit;
758
+
759
+ /**
760
+ * Display name of function. Human-readable name to help you identify the function.
761
+ */
762
+ displayName?: string;
763
+
764
+ /**
765
+ * Google Drive folder ID. Present when destinationType is google_drive. Managed
766
+ * via Paragon OAuth.
767
+ */
768
+ googleDriveFolderId?: string;
769
+
770
+ /**
771
+ * S3 bucket to upload the payload to. Present when destinationType is s3.
772
+ */
773
+ s3Bucket?: string;
774
+
775
+ /**
776
+ * S3 key prefix (folder path). Optional, present when destinationType is s3.
777
+ */
778
+ s3Prefix?: string;
779
+
780
+ /**
781
+ * Array of tags to categorize and organize functions.
782
+ */
783
+ tags?: Array<string>;
784
+
785
+ /**
786
+ * List of workflows that use this function.
787
+ */
788
+ usedInWorkflows?: Array<FunctionsAPI.WorkflowUsageInfo>;
789
+
790
+ /**
791
+ * Whether webhook payloads are signed with an HMAC-SHA256 signature.
792
+ */
793
+ webhookSigningEnabled?: boolean;
794
+
795
+ /**
796
+ * Webhook URL to POST the payload to. Present when destinationType is webhook.
797
+ */
798
+ webhookUrl?: string;
799
+ }
800
+
675
801
  export interface SplitFunction {
676
802
  /**
677
803
  * Unique identifier of function.
@@ -948,10 +1074,9 @@ export interface FunctionAudit {
948
1074
  */
949
1075
  export interface FunctionResponse {
950
1076
  /**
951
- * A function that transforms and customizes input payloads using JMESPath
952
- * expressions. Payload shaping allows you to extract specific data, perform
953
- * calculations, and reshape complex input structures into simplified, standardized
954
- * output formats tailored to your downstream systems or business requirements.
1077
+ * A function that delivers workflow outputs to an external destination. Send
1078
+ * functions receive the output of an upstream workflow node and forward it to a
1079
+ * webhook, S3 bucket, or Google Drive folder.
955
1080
  */
956
1081
  function: Function;
957
1082
  }
@@ -962,6 +1087,7 @@ export interface FunctionResponse {
962
1087
  export type FunctionType =
963
1088
  | 'transform'
964
1089
  | 'route'
1090
+ | 'send'
965
1091
  | 'split'
966
1092
  | 'join'
967
1093
  | 'analyze'
@@ -1035,6 +1161,7 @@ export type UpdateFunction =
1035
1161
  | UpdateFunction.TransformFunction
1036
1162
  | UpdateFunction.AnalyzeFunction
1037
1163
  | UpdateFunction.RouteFunction
1164
+ | UpdateFunction.SendFunction
1038
1165
  | UpdateFunction.SplitFunction
1039
1166
  | UpdateFunction.JoinFunction
1040
1167
  | UpdateFunction.PayloadShapingFunction
@@ -1135,6 +1262,56 @@ export namespace UpdateFunction {
1135
1262
  tags?: Array<string>;
1136
1263
  }
1137
1264
 
1265
+ export interface SendFunction {
1266
+ type: 'send';
1267
+
1268
+ /**
1269
+ * Destination type for a Send function.
1270
+ */
1271
+ destinationType?: 'webhook' | 's3' | 'google_drive';
1272
+
1273
+ /**
1274
+ * Display name of function. Human-readable name to help you identify the function.
1275
+ */
1276
+ displayName?: string;
1277
+
1278
+ /**
1279
+ * Name of function. Must be UNIQUE on a per-environment basis.
1280
+ */
1281
+ functionName?: string;
1282
+
1283
+ /**
1284
+ * Google Drive folder ID. Required when destinationType is google_drive. Managed
1285
+ * via Paragon OAuth.
1286
+ */
1287
+ googleDriveFolderId?: string;
1288
+
1289
+ /**
1290
+ * S3 bucket to upload the payload to. Required when destinationType is s3.
1291
+ */
1292
+ s3Bucket?: string;
1293
+
1294
+ /**
1295
+ * Optional S3 key prefix (folder path).
1296
+ */
1297
+ s3Prefix?: string;
1298
+
1299
+ /**
1300
+ * Array of tags to categorize and organize functions.
1301
+ */
1302
+ tags?: Array<string>;
1303
+
1304
+ /**
1305
+ * Whether to sign webhook payloads with an HMAC-SHA256 signature.
1306
+ */
1307
+ webhookSigningEnabled?: boolean;
1308
+
1309
+ /**
1310
+ * Webhook URL to POST the payload to. Required when destinationType is webhook.
1311
+ */
1312
+ webhookUrl?: string;
1313
+ }
1314
+
1138
1315
  export interface SplitFunction {
1139
1316
  type: 'split';
1140
1317
 
@@ -1339,6 +1516,7 @@ export type FunctionCreateParams =
1339
1516
  | FunctionCreateParams.CreateTransformFunction
1340
1517
  | FunctionCreateParams.CreateAnalyzeFunction
1341
1518
  | FunctionCreateParams.CreateRouteFunction
1519
+ | FunctionCreateParams.CreateSendFunction
1342
1520
  | FunctionCreateParams.CreateSplitFunction
1343
1521
  | FunctionCreateParams.CreateJoinFunction
1344
1522
  | FunctionCreateParams.CreatePayloadShapingFunction
@@ -1439,6 +1617,56 @@ export declare namespace FunctionCreateParams {
1439
1617
  tags?: Array<string>;
1440
1618
  }
1441
1619
 
1620
+ export interface CreateSendFunction {
1621
+ /**
1622
+ * Name of function. Must be UNIQUE on a per-environment basis.
1623
+ */
1624
+ functionName: string;
1625
+
1626
+ type: 'send';
1627
+
1628
+ /**
1629
+ * Destination type for a Send function.
1630
+ */
1631
+ destinationType?: 'webhook' | 's3' | 'google_drive';
1632
+
1633
+ /**
1634
+ * Display name of function. Human-readable name to help you identify the function.
1635
+ */
1636
+ displayName?: string;
1637
+
1638
+ /**
1639
+ * Google Drive folder ID. Required when destinationType is google_drive. Managed
1640
+ * via Paragon OAuth.
1641
+ */
1642
+ googleDriveFolderId?: string;
1643
+
1644
+ /**
1645
+ * S3 bucket to upload the payload to. Required when destinationType is s3.
1646
+ */
1647
+ s3Bucket?: string;
1648
+
1649
+ /**
1650
+ * Optional S3 key prefix (folder path).
1651
+ */
1652
+ s3Prefix?: string;
1653
+
1654
+ /**
1655
+ * Array of tags to categorize and organize functions.
1656
+ */
1657
+ tags?: Array<string>;
1658
+
1659
+ /**
1660
+ * Whether to sign webhook payloads with an HMAC-SHA256 signature.
1661
+ */
1662
+ webhookSigningEnabled?: boolean;
1663
+
1664
+ /**
1665
+ * Webhook URL to POST the payload to. Required when destinationType is webhook.
1666
+ */
1667
+ webhookUrl?: string;
1668
+ }
1669
+
1442
1670
  export interface CreateSplitFunction {
1443
1671
  /**
1444
1672
  * Name of function. Must be UNIQUE on a per-environment basis.
@@ -1596,6 +1824,7 @@ export type FunctionUpdateParams =
1596
1824
  | FunctionUpdateParams.UpsertTransformFunction
1597
1825
  | FunctionUpdateParams.UpsertAnalyzeFunction
1598
1826
  | FunctionUpdateParams.UpsertRouteFunction
1827
+ | FunctionUpdateParams.UpsertSendFunction
1599
1828
  | FunctionUpdateParams.UpsertSplitFunction
1600
1829
  | FunctionUpdateParams.UpsertJoinFunction
1601
1830
  | FunctionUpdateParams.UpsertPayloadShapingFunction
@@ -1696,6 +1925,56 @@ export declare namespace FunctionUpdateParams {
1696
1925
  tags?: Array<string>;
1697
1926
  }
1698
1927
 
1928
+ export interface UpsertSendFunction {
1929
+ type: 'send';
1930
+
1931
+ /**
1932
+ * Destination type for a Send function.
1933
+ */
1934
+ destinationType?: 'webhook' | 's3' | 'google_drive';
1935
+
1936
+ /**
1937
+ * Display name of function. Human-readable name to help you identify the function.
1938
+ */
1939
+ displayName?: string;
1940
+
1941
+ /**
1942
+ * Name of function. Must be UNIQUE on a per-environment basis.
1943
+ */
1944
+ functionName?: string;
1945
+
1946
+ /**
1947
+ * Google Drive folder ID. Required when destinationType is google_drive. Managed
1948
+ * via Paragon OAuth.
1949
+ */
1950
+ googleDriveFolderId?: string;
1951
+
1952
+ /**
1953
+ * S3 bucket to upload the payload to. Required when destinationType is s3.
1954
+ */
1955
+ s3Bucket?: string;
1956
+
1957
+ /**
1958
+ * Optional S3 key prefix (folder path).
1959
+ */
1960
+ s3Prefix?: string;
1961
+
1962
+ /**
1963
+ * Array of tags to categorize and organize functions.
1964
+ */
1965
+ tags?: Array<string>;
1966
+
1967
+ /**
1968
+ * Whether to sign webhook payloads with an HMAC-SHA256 signature.
1969
+ */
1970
+ webhookSigningEnabled?: boolean;
1971
+
1972
+ /**
1973
+ * Webhook URL to POST the payload to. Required when destinationType is webhook.
1974
+ */
1975
+ webhookUrl?: string;
1976
+ }
1977
+
1699
1978
  export interface UpsertSplitFunction {
1700
1979
  type: 'split';
1701
1980
 
@@ -51,6 +51,7 @@ export type FunctionVersion =
51
51
  | FunctionVersion.TransformFunctionVersion
52
52
  | FunctionVersion.AnalyzeFunctionVersion
53
53
  | FunctionVersion.RouteFunctionVersion
54
+ | FunctionVersion.SendFunctionVersion
54
55
  | FunctionVersion.SplitFunctionVersion
55
56
  | FunctionVersion.JoinFunctionVersion
56
57
  | FunctionVersion.EnrichFunctionVersion
@@ -238,6 +239,65 @@ export namespace FunctionVersion {
238
239
  usedInWorkflows?: Array<FunctionsAPI.WorkflowUsageInfo>;
239
240
  }
240
241
 
242
+ export interface SendFunctionVersion {
243
+ /**
244
+ * Destination type for a Send function.
245
+ */
246
+ destinationType: 'webhook' | 's3' | 'google_drive';
247
+
248
+ /**
249
+ * Unique identifier of function.
250
+ */
251
+ functionID: string;
252
+
253
+ /**
254
+ * Name of function. Must be UNIQUE on a per-environment basis.
255
+ */
256
+ functionName: string;
257
+
258
+ type: 'send';
259
+
260
+ /**
261
+ * Version number of function.
262
+ */
263
+ versionNum: number;
264
+
265
+ /**
266
+ * Audit trail information for the function version.
267
+ */
268
+ audit?: FunctionsAPI.FunctionAudit;
269
+
270
+ /**
271
+ * The date and time the function version was created.
272
+ */
273
+ createdAt?: string;
274
+
275
+ /**
276
+ * Display name of function. Human-readable name to help you identify the function.
277
+ */
278
+ displayName?: string;
279
+
280
+ googleDriveFolderId?: string;
281
+
282
+ s3Bucket?: string;
283
+
284
+ s3Prefix?: string;
285
+
286
+ /**
287
+ * Array of tags to categorize and organize functions.
288
+ */
289
+ tags?: Array<string>;
290
+
291
+ /**
292
+ * List of workflows that use this function.
293
+ */
294
+ usedInWorkflows?: Array<FunctionsAPI.WorkflowUsageInfo>;
295
+
296
+ webhookSigningEnabled?: boolean;
297
+
298
+ webhookUrl?: string;
299
+ }
300
+
241
301
  export interface SplitFunctionVersion {
242
302
  /**
243
303
  * Unique identifier of function.
@@ -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.3.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.3.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.3.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.3.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.3.0'; // x-release-please-version
1
+ export const VERSION = '0.4.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map