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.
- package/CHANGELOG.md +16 -0
- package/client.d.mts +13 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +13 -0
- package/client.d.ts.map +1 -1
- package/client.js +13 -0
- package/client.js.map +1 -1
- package/client.mjs +13 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/functions/functions.d.mts +233 -14
- package/resources/functions/functions.d.mts.map +1 -1
- package/resources/functions/functions.d.ts +233 -14
- package/resources/functions/functions.d.ts.map +1 -1
- package/resources/functions/functions.js.map +1 -1
- package/resources/functions/functions.mjs.map +1 -1
- package/resources/functions/versions.d.mts +45 -1
- package/resources/functions/versions.d.mts.map +1 -1
- package/resources/functions/versions.d.ts +45 -1
- package/resources/functions/versions.d.ts.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/infer-schema.d.mts +133 -0
- package/resources/infer-schema.d.mts.map +1 -0
- package/resources/infer-schema.d.ts +133 -0
- package/resources/infer-schema.d.ts.map +1 -0
- package/resources/infer-schema.js +54 -0
- package/resources/infer-schema.js.map +1 -0
- package/resources/infer-schema.mjs +50 -0
- package/resources/infer-schema.mjs.map +1 -0
- package/resources/workflows/workflows.d.mts +58 -15
- package/resources/workflows/workflows.d.mts.map +1 -1
- package/resources/workflows/workflows.d.ts +58 -15
- package/resources/workflows/workflows.d.ts.map +1 -1
- package/resources/workflows/workflows.js +17 -7
- package/resources/workflows/workflows.js.map +1 -1
- package/resources/workflows/workflows.mjs +18 -8
- package/resources/workflows/workflows.mjs.map +1 -1
- package/src/client.ts +19 -0
- package/src/resources/functions/functions.ts +287 -8
- package/src/resources/functions/versions.ts +60 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/infer-schema.ts +160 -0
- package/src/resources/workflows/workflows.ts +104 -17
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -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
|
|
495
|
-
*
|
|
496
|
-
*
|
|
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
|
|
952
|
-
*
|
|
953
|
-
*
|
|
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.
|
package/src/resources/index.ts
CHANGED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
import { multipartFormRequestOptions } from '../internal/uploads';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Infer JSON Schemas from uploaded documents using AI.
|
|
10
|
+
*
|
|
11
|
+
* Upload a file (PDF, image, spreadsheet, email, etc.) and receive a general-purpose JSON Schema
|
|
12
|
+
* that captures the document's structure. The inferred schema can be used directly as the
|
|
13
|
+
* `outputSchema` when creating Transform functions.
|
|
14
|
+
*
|
|
15
|
+
* The schema is designed to be broadly applicable to documents of the same type, not just
|
|
16
|
+
* the specific file uploaded.
|
|
17
|
+
*/
|
|
18
|
+
export class InferSchema extends APIResource {
|
|
19
|
+
/**
|
|
20
|
+
* **Analyze a file and infer a JSON Schema from its contents.**
|
|
21
|
+
*
|
|
22
|
+
* Accepts a file via multipart form upload and uses Gemini to analyze the
|
|
23
|
+
* document, returning a description of its contents, an inferred JSON Schema
|
|
24
|
+
* capturing all extractable fields, and document classification metadata.
|
|
25
|
+
*
|
|
26
|
+
* The returned schema is designed to be reusable across many similar documents of
|
|
27
|
+
* the same type, not just the specific file uploaded. It can be used directly as
|
|
28
|
+
* the `outputSchema` when creating a Transform function.
|
|
29
|
+
*
|
|
30
|
+
* The endpoint also detects whether the file contains multiple bundled documents
|
|
31
|
+
* and classifies the content nature (textual, visual, audio, video, or mixed).
|
|
32
|
+
*
|
|
33
|
+
* ## Supported file types
|
|
34
|
+
*
|
|
35
|
+
* PDF, PNG, JPEG, HEIC, HEIF, WebP, CSV, XLS, XLSX, DOCX, JSON, HTML, XML, EML,
|
|
36
|
+
* plain text, WAV, MP3, M4A, MP4.
|
|
37
|
+
*
|
|
38
|
+
* ## File size limit
|
|
39
|
+
*
|
|
40
|
+
* Maximum file size is **20 MB**.
|
|
41
|
+
*
|
|
42
|
+
* ## Example
|
|
43
|
+
*
|
|
44
|
+
* ```bash
|
|
45
|
+
* curl -X POST https://api.bem.ai/v3/infer-schema \
|
|
46
|
+
* -H "x-api-key: YOUR_API_KEY" \
|
|
47
|
+
* -F "file=@invoice.pdf"
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
create(body: InferSchemaCreateParams, options?: RequestOptions): APIPromise<InferSchemaCreateResponse> {
|
|
51
|
+
return this._client.post(
|
|
52
|
+
'/v3/infer-schema',
|
|
53
|
+
multipartFormRequestOptions({ body, ...options }, this._client),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Response from the infer-schema endpoint.
|
|
60
|
+
*/
|
|
61
|
+
export interface InferSchemaCreateResponse {
|
|
62
|
+
/**
|
|
63
|
+
* Analysis result returned by the infer-schema endpoint.
|
|
64
|
+
*/
|
|
65
|
+
analysis: InferSchemaCreateResponse.Analysis;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Original filename of the uploaded file.
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export namespace InferSchemaCreateResponse {
|
|
74
|
+
/**
|
|
75
|
+
* Analysis result returned by the infer-schema endpoint.
|
|
76
|
+
*/
|
|
77
|
+
export interface Analysis {
|
|
78
|
+
/**
|
|
79
|
+
* Classification of the primary content. One of: `textual`, `visual`, `audio`,
|
|
80
|
+
* `video`, `mixed`.
|
|
81
|
+
*/
|
|
82
|
+
contentNature: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* MIME content type of the uploaded file.
|
|
86
|
+
*/
|
|
87
|
+
contentType: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 2-3 sentence description of what the file contains.
|
|
91
|
+
*/
|
|
92
|
+
description: string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* List of distinct document types found in the file with counts.
|
|
96
|
+
*/
|
|
97
|
+
documentTypes: Array<Analysis.DocumentType>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Original filename of the uploaded file.
|
|
101
|
+
*/
|
|
102
|
+
fileName: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* High-level file category (e.g. "document", "image", "spreadsheet", "email").
|
|
106
|
+
*/
|
|
107
|
+
fileType: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Whether the file contains multiple separate documents bundled together.
|
|
111
|
+
*/
|
|
112
|
+
isMultiDocument: boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Size of the uploaded file in bytes.
|
|
116
|
+
*/
|
|
117
|
+
sizeBytes: number;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Inferred JSON Schema representing all extractable data fields.
|
|
121
|
+
*/
|
|
122
|
+
schema?: unknown;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export namespace Analysis {
|
|
126
|
+
/**
|
|
127
|
+
* Describes a distinct document type found in the file.
|
|
128
|
+
*/
|
|
129
|
+
export interface DocumentType {
|
|
130
|
+
/**
|
|
131
|
+
* Number of instances of this document type in the file.
|
|
132
|
+
*/
|
|
133
|
+
count: number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Brief description of this document type.
|
|
137
|
+
*/
|
|
138
|
+
description: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Short snake_case name (e.g. "invoice", "receipt", "utility_bill").
|
|
142
|
+
*/
|
|
143
|
+
name: string;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface InferSchemaCreateParams {
|
|
149
|
+
/**
|
|
150
|
+
* The file to analyze and infer a JSON schema from.
|
|
151
|
+
*/
|
|
152
|
+
file: unknown;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export declare namespace InferSchema {
|
|
156
|
+
export {
|
|
157
|
+
type InferSchemaCreateResponse as InferSchemaCreateResponse,
|
|
158
|
+
type InferSchemaCreateParams as InferSchemaCreateParams,
|
|
159
|
+
};
|
|
160
|
+
}
|