bem-ai-sdk 0.1.1 → 0.3.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 +22 -0
- package/client.d.mts +15 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +15 -2
- 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/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- 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/index.d.mts +1 -1
- package/resources/workflows/index.d.mts.map +1 -1
- package/resources/workflows/index.d.ts +1 -1
- package/resources/workflows/index.d.ts.map +1 -1
- package/resources/workflows/index.js.map +1 -1
- package/resources/workflows/index.mjs.map +1 -1
- package/resources/workflows/versions.d.mts +3 -0
- package/resources/workflows/versions.d.mts.map +1 -1
- package/resources/workflows/versions.d.ts +3 -0
- package/resources/workflows/versions.d.ts.map +1 -1
- package/resources/workflows/workflows.d.mts +169 -102
- package/resources/workflows/workflows.d.mts.map +1 -1
- package/resources/workflows/workflows.d.ts +169 -102
- package/resources/workflows/workflows.d.ts.map +1 -1
- package/resources/workflows/workflows.js.map +1 -1
- package/resources/workflows/workflows.mjs.map +1 -1
- package/src/client.ts +25 -2
- package/src/resources/index.ts +4 -1
- package/src/resources/infer-schema.ts +160 -0
- package/src/resources/workflows/index.ts +3 -1
- package/src/resources/workflows/versions.ts +3 -0
- package/src/resources/workflows/workflows.ts +187 -106
- 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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Infer JSON Schemas from uploaded documents using AI.
|
|
6
|
+
*
|
|
7
|
+
* Upload a file (PDF, image, spreadsheet, email, etc.) and receive a general-purpose JSON Schema
|
|
8
|
+
* that captures the document's structure. The inferred schema can be used directly as the
|
|
9
|
+
* `outputSchema` when creating Transform functions.
|
|
10
|
+
*
|
|
11
|
+
* The schema is designed to be broadly applicable to documents of the same type, not just
|
|
12
|
+
* the specific file uploaded.
|
|
13
|
+
*/
|
|
14
|
+
export declare class InferSchema extends APIResource {
|
|
15
|
+
/**
|
|
16
|
+
* **Analyze a file and infer a JSON Schema from its contents.**
|
|
17
|
+
*
|
|
18
|
+
* Accepts a file via multipart form upload and uses Gemini to analyze the
|
|
19
|
+
* document, returning a description of its contents, an inferred JSON Schema
|
|
20
|
+
* capturing all extractable fields, and document classification metadata.
|
|
21
|
+
*
|
|
22
|
+
* The returned schema is designed to be reusable across many similar documents of
|
|
23
|
+
* the same type, not just the specific file uploaded. It can be used directly as
|
|
24
|
+
* the `outputSchema` when creating a Transform function.
|
|
25
|
+
*
|
|
26
|
+
* The endpoint also detects whether the file contains multiple bundled documents
|
|
27
|
+
* and classifies the content nature (textual, visual, audio, video, or mixed).
|
|
28
|
+
*
|
|
29
|
+
* ## Supported file types
|
|
30
|
+
*
|
|
31
|
+
* PDF, PNG, JPEG, HEIC, HEIF, WebP, CSV, XLS, XLSX, DOCX, JSON, HTML, XML, EML,
|
|
32
|
+
* plain text, WAV, MP3, M4A, MP4.
|
|
33
|
+
*
|
|
34
|
+
* ## File size limit
|
|
35
|
+
*
|
|
36
|
+
* Maximum file size is **20 MB**.
|
|
37
|
+
*
|
|
38
|
+
* ## Example
|
|
39
|
+
*
|
|
40
|
+
* ```bash
|
|
41
|
+
* curl -X POST https://api.bem.ai/v3/infer-schema \
|
|
42
|
+
* -H "x-api-key: YOUR_API_KEY" \
|
|
43
|
+
* -F "file=@invoice.pdf"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
create(body: InferSchemaCreateParams, options?: RequestOptions): APIPromise<InferSchemaCreateResponse>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Response from the infer-schema endpoint.
|
|
50
|
+
*/
|
|
51
|
+
export interface InferSchemaCreateResponse {
|
|
52
|
+
/**
|
|
53
|
+
* Analysis result returned by the infer-schema endpoint.
|
|
54
|
+
*/
|
|
55
|
+
analysis: InferSchemaCreateResponse.Analysis;
|
|
56
|
+
/**
|
|
57
|
+
* Original filename of the uploaded file.
|
|
58
|
+
*/
|
|
59
|
+
filename: string;
|
|
60
|
+
}
|
|
61
|
+
export declare namespace InferSchemaCreateResponse {
|
|
62
|
+
/**
|
|
63
|
+
* Analysis result returned by the infer-schema endpoint.
|
|
64
|
+
*/
|
|
65
|
+
interface Analysis {
|
|
66
|
+
/**
|
|
67
|
+
* Classification of the primary content. One of: `textual`, `visual`, `audio`,
|
|
68
|
+
* `video`, `mixed`.
|
|
69
|
+
*/
|
|
70
|
+
contentNature: string;
|
|
71
|
+
/**
|
|
72
|
+
* MIME content type of the uploaded file.
|
|
73
|
+
*/
|
|
74
|
+
contentType: string;
|
|
75
|
+
/**
|
|
76
|
+
* 2-3 sentence description of what the file contains.
|
|
77
|
+
*/
|
|
78
|
+
description: string;
|
|
79
|
+
/**
|
|
80
|
+
* List of distinct document types found in the file with counts.
|
|
81
|
+
*/
|
|
82
|
+
documentTypes: Array<Analysis.DocumentType>;
|
|
83
|
+
/**
|
|
84
|
+
* Original filename of the uploaded file.
|
|
85
|
+
*/
|
|
86
|
+
fileName: string;
|
|
87
|
+
/**
|
|
88
|
+
* High-level file category (e.g. "document", "image", "spreadsheet", "email").
|
|
89
|
+
*/
|
|
90
|
+
fileType: string;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the file contains multiple separate documents bundled together.
|
|
93
|
+
*/
|
|
94
|
+
isMultiDocument: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Size of the uploaded file in bytes.
|
|
97
|
+
*/
|
|
98
|
+
sizeBytes: number;
|
|
99
|
+
/**
|
|
100
|
+
* Inferred JSON Schema representing all extractable data fields.
|
|
101
|
+
*/
|
|
102
|
+
schema?: unknown;
|
|
103
|
+
}
|
|
104
|
+
namespace Analysis {
|
|
105
|
+
/**
|
|
106
|
+
* Describes a distinct document type found in the file.
|
|
107
|
+
*/
|
|
108
|
+
interface DocumentType {
|
|
109
|
+
/**
|
|
110
|
+
* Number of instances of this document type in the file.
|
|
111
|
+
*/
|
|
112
|
+
count: number;
|
|
113
|
+
/**
|
|
114
|
+
* Brief description of this document type.
|
|
115
|
+
*/
|
|
116
|
+
description: string;
|
|
117
|
+
/**
|
|
118
|
+
* Short snake_case name (e.g. "invoice", "receipt", "utility_bill").
|
|
119
|
+
*/
|
|
120
|
+
name: string;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export interface InferSchemaCreateParams {
|
|
125
|
+
/**
|
|
126
|
+
* The file to analyze and infer a JSON schema from.
|
|
127
|
+
*/
|
|
128
|
+
file: unknown;
|
|
129
|
+
}
|
|
130
|
+
export declare namespace InferSchema {
|
|
131
|
+
export { type InferSchemaCreateResponse as InferSchemaCreateResponse, type InferSchemaCreateParams as InferSchemaCreateParams, };
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=infer-schema.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-schema.d.mts","sourceRoot":"","sources":["../src/resources/infer-schema.ts"],"names":[],"mappings":"OAEO,EA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AAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
4
|
+
/**
|
|
5
|
+
* Infer JSON Schemas from uploaded documents using AI.
|
|
6
|
+
*
|
|
7
|
+
* Upload a file (PDF, image, spreadsheet, email, etc.) and receive a general-purpose JSON Schema
|
|
8
|
+
* that captures the document's structure. The inferred schema can be used directly as the
|
|
9
|
+
* `outputSchema` when creating Transform functions.
|
|
10
|
+
*
|
|
11
|
+
* The schema is designed to be broadly applicable to documents of the same type, not just
|
|
12
|
+
* the specific file uploaded.
|
|
13
|
+
*/
|
|
14
|
+
export declare class InferSchema extends APIResource {
|
|
15
|
+
/**
|
|
16
|
+
* **Analyze a file and infer a JSON Schema from its contents.**
|
|
17
|
+
*
|
|
18
|
+
* Accepts a file via multipart form upload and uses Gemini to analyze the
|
|
19
|
+
* document, returning a description of its contents, an inferred JSON Schema
|
|
20
|
+
* capturing all extractable fields, and document classification metadata.
|
|
21
|
+
*
|
|
22
|
+
* The returned schema is designed to be reusable across many similar documents of
|
|
23
|
+
* the same type, not just the specific file uploaded. It can be used directly as
|
|
24
|
+
* the `outputSchema` when creating a Transform function.
|
|
25
|
+
*
|
|
26
|
+
* The endpoint also detects whether the file contains multiple bundled documents
|
|
27
|
+
* and classifies the content nature (textual, visual, audio, video, or mixed).
|
|
28
|
+
*
|
|
29
|
+
* ## Supported file types
|
|
30
|
+
*
|
|
31
|
+
* PDF, PNG, JPEG, HEIC, HEIF, WebP, CSV, XLS, XLSX, DOCX, JSON, HTML, XML, EML,
|
|
32
|
+
* plain text, WAV, MP3, M4A, MP4.
|
|
33
|
+
*
|
|
34
|
+
* ## File size limit
|
|
35
|
+
*
|
|
36
|
+
* Maximum file size is **20 MB**.
|
|
37
|
+
*
|
|
38
|
+
* ## Example
|
|
39
|
+
*
|
|
40
|
+
* ```bash
|
|
41
|
+
* curl -X POST https://api.bem.ai/v3/infer-schema \
|
|
42
|
+
* -H "x-api-key: YOUR_API_KEY" \
|
|
43
|
+
* -F "file=@invoice.pdf"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
create(body: InferSchemaCreateParams, options?: RequestOptions): APIPromise<InferSchemaCreateResponse>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Response from the infer-schema endpoint.
|
|
50
|
+
*/
|
|
51
|
+
export interface InferSchemaCreateResponse {
|
|
52
|
+
/**
|
|
53
|
+
* Analysis result returned by the infer-schema endpoint.
|
|
54
|
+
*/
|
|
55
|
+
analysis: InferSchemaCreateResponse.Analysis;
|
|
56
|
+
/**
|
|
57
|
+
* Original filename of the uploaded file.
|
|
58
|
+
*/
|
|
59
|
+
filename: string;
|
|
60
|
+
}
|
|
61
|
+
export declare namespace InferSchemaCreateResponse {
|
|
62
|
+
/**
|
|
63
|
+
* Analysis result returned by the infer-schema endpoint.
|
|
64
|
+
*/
|
|
65
|
+
interface Analysis {
|
|
66
|
+
/**
|
|
67
|
+
* Classification of the primary content. One of: `textual`, `visual`, `audio`,
|
|
68
|
+
* `video`, `mixed`.
|
|
69
|
+
*/
|
|
70
|
+
contentNature: string;
|
|
71
|
+
/**
|
|
72
|
+
* MIME content type of the uploaded file.
|
|
73
|
+
*/
|
|
74
|
+
contentType: string;
|
|
75
|
+
/**
|
|
76
|
+
* 2-3 sentence description of what the file contains.
|
|
77
|
+
*/
|
|
78
|
+
description: string;
|
|
79
|
+
/**
|
|
80
|
+
* List of distinct document types found in the file with counts.
|
|
81
|
+
*/
|
|
82
|
+
documentTypes: Array<Analysis.DocumentType>;
|
|
83
|
+
/**
|
|
84
|
+
* Original filename of the uploaded file.
|
|
85
|
+
*/
|
|
86
|
+
fileName: string;
|
|
87
|
+
/**
|
|
88
|
+
* High-level file category (e.g. "document", "image", "spreadsheet", "email").
|
|
89
|
+
*/
|
|
90
|
+
fileType: string;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the file contains multiple separate documents bundled together.
|
|
93
|
+
*/
|
|
94
|
+
isMultiDocument: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Size of the uploaded file in bytes.
|
|
97
|
+
*/
|
|
98
|
+
sizeBytes: number;
|
|
99
|
+
/**
|
|
100
|
+
* Inferred JSON Schema representing all extractable data fields.
|
|
101
|
+
*/
|
|
102
|
+
schema?: unknown;
|
|
103
|
+
}
|
|
104
|
+
namespace Analysis {
|
|
105
|
+
/**
|
|
106
|
+
* Describes a distinct document type found in the file.
|
|
107
|
+
*/
|
|
108
|
+
interface DocumentType {
|
|
109
|
+
/**
|
|
110
|
+
* Number of instances of this document type in the file.
|
|
111
|
+
*/
|
|
112
|
+
count: number;
|
|
113
|
+
/**
|
|
114
|
+
* Brief description of this document type.
|
|
115
|
+
*/
|
|
116
|
+
description: string;
|
|
117
|
+
/**
|
|
118
|
+
* Short snake_case name (e.g. "invoice", "receipt", "utility_bill").
|
|
119
|
+
*/
|
|
120
|
+
name: string;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export interface InferSchemaCreateParams {
|
|
125
|
+
/**
|
|
126
|
+
* The file to analyze and infer a JSON schema from.
|
|
127
|
+
*/
|
|
128
|
+
file: unknown;
|
|
129
|
+
}
|
|
130
|
+
export declare namespace InferSchema {
|
|
131
|
+
export { type InferSchemaCreateResponse as InferSchemaCreateResponse, type InferSchemaCreateParams as InferSchemaCreateParams, };
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=infer-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-schema.d.ts","sourceRoot":"","sources":["../src/resources/infer-schema.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE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AK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InferSchema = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const uploads_1 = require("../internal/uploads.js");
|
|
7
|
+
/**
|
|
8
|
+
* Infer JSON Schemas from uploaded documents using AI.
|
|
9
|
+
*
|
|
10
|
+
* Upload a file (PDF, image, spreadsheet, email, etc.) and receive a general-purpose JSON Schema
|
|
11
|
+
* that captures the document's structure. The inferred schema can be used directly as the
|
|
12
|
+
* `outputSchema` when creating Transform functions.
|
|
13
|
+
*
|
|
14
|
+
* The schema is designed to be broadly applicable to documents of the same type, not just
|
|
15
|
+
* the specific file uploaded.
|
|
16
|
+
*/
|
|
17
|
+
class InferSchema extends resource_1.APIResource {
|
|
18
|
+
/**
|
|
19
|
+
* **Analyze a file and infer a JSON Schema from its contents.**
|
|
20
|
+
*
|
|
21
|
+
* Accepts a file via multipart form upload and uses Gemini to analyze the
|
|
22
|
+
* document, returning a description of its contents, an inferred JSON Schema
|
|
23
|
+
* capturing all extractable fields, and document classification metadata.
|
|
24
|
+
*
|
|
25
|
+
* The returned schema is designed to be reusable across many similar documents of
|
|
26
|
+
* the same type, not just the specific file uploaded. It can be used directly as
|
|
27
|
+
* the `outputSchema` when creating a Transform function.
|
|
28
|
+
*
|
|
29
|
+
* The endpoint also detects whether the file contains multiple bundled documents
|
|
30
|
+
* and classifies the content nature (textual, visual, audio, video, or mixed).
|
|
31
|
+
*
|
|
32
|
+
* ## Supported file types
|
|
33
|
+
*
|
|
34
|
+
* PDF, PNG, JPEG, HEIC, HEIF, WebP, CSV, XLS, XLSX, DOCX, JSON, HTML, XML, EML,
|
|
35
|
+
* plain text, WAV, MP3, M4A, MP4.
|
|
36
|
+
*
|
|
37
|
+
* ## File size limit
|
|
38
|
+
*
|
|
39
|
+
* Maximum file size is **20 MB**.
|
|
40
|
+
*
|
|
41
|
+
* ## Example
|
|
42
|
+
*
|
|
43
|
+
* ```bash
|
|
44
|
+
* curl -X POST https://api.bem.ai/v3/infer-schema \
|
|
45
|
+
* -H "x-api-key: YOUR_API_KEY" \
|
|
46
|
+
* -F "file=@invoice.pdf"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
create(body, options) {
|
|
50
|
+
return this._client.post('/v3/infer-schema', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.InferSchema = InferSchema;
|
|
54
|
+
//# sourceMappingURL=infer-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-schema.js","sourceRoot":"","sources":["../src/resources/infer-schema.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAkE;AAElE;;;;;;;;;GASG;AACH,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,kBAAkB,EAClB,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF;AAtCD,kCAsCC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Infer JSON Schemas from uploaded documents using AI.
|
|
6
|
+
*
|
|
7
|
+
* Upload a file (PDF, image, spreadsheet, email, etc.) and receive a general-purpose JSON Schema
|
|
8
|
+
* that captures the document's structure. The inferred schema can be used directly as the
|
|
9
|
+
* `outputSchema` when creating Transform functions.
|
|
10
|
+
*
|
|
11
|
+
* The schema is designed to be broadly applicable to documents of the same type, not just
|
|
12
|
+
* the specific file uploaded.
|
|
13
|
+
*/
|
|
14
|
+
export class InferSchema extends APIResource {
|
|
15
|
+
/**
|
|
16
|
+
* **Analyze a file and infer a JSON Schema from its contents.**
|
|
17
|
+
*
|
|
18
|
+
* Accepts a file via multipart form upload and uses Gemini to analyze the
|
|
19
|
+
* document, returning a description of its contents, an inferred JSON Schema
|
|
20
|
+
* capturing all extractable fields, and document classification metadata.
|
|
21
|
+
*
|
|
22
|
+
* The returned schema is designed to be reusable across many similar documents of
|
|
23
|
+
* the same type, not just the specific file uploaded. It can be used directly as
|
|
24
|
+
* the `outputSchema` when creating a Transform function.
|
|
25
|
+
*
|
|
26
|
+
* The endpoint also detects whether the file contains multiple bundled documents
|
|
27
|
+
* and classifies the content nature (textual, visual, audio, video, or mixed).
|
|
28
|
+
*
|
|
29
|
+
* ## Supported file types
|
|
30
|
+
*
|
|
31
|
+
* PDF, PNG, JPEG, HEIC, HEIF, WebP, CSV, XLS, XLSX, DOCX, JSON, HTML, XML, EML,
|
|
32
|
+
* plain text, WAV, MP3, M4A, MP4.
|
|
33
|
+
*
|
|
34
|
+
* ## File size limit
|
|
35
|
+
*
|
|
36
|
+
* Maximum file size is **20 MB**.
|
|
37
|
+
*
|
|
38
|
+
* ## Example
|
|
39
|
+
*
|
|
40
|
+
* ```bash
|
|
41
|
+
* curl -X POST https://api.bem.ai/v3/infer-schema \
|
|
42
|
+
* -H "x-api-key: YOUR_API_KEY" \
|
|
43
|
+
* -F "file=@invoice.pdf"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
create(body, options) {
|
|
47
|
+
return this._client.post('/v3/infer-schema', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=infer-schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-schema.mjs","sourceRoot":"","sources":["../src/resources/infer-schema.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,2BAA2B,EAAE;AAEtC;;;;;;;;;GASG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,kBAAkB,EAClB,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Versions, type VersionRetrieveResponse, type VersionRetrieveParams, type VersionListParams, } from "./versions.mjs";
|
|
2
|
-
export { Workflows, type FunctionVersionIdentifier, type Workflow, type
|
|
2
|
+
export { Workflows, type FunctionVersionIdentifier, type Workflow, type WorkflowAudit, type WorkflowEdgeResponse, type WorkflowNodeResponse, type WorkflowCreateResponse, type WorkflowRetrieveResponse, type WorkflowUpdateResponse, type WorkflowCopyResponse, type WorkflowCreateParams, type WorkflowUpdateParams, type WorkflowListParams, type WorkflowCallParams, type WorkflowCopyParams, type WorkflowsWorkflowVersionsPage, type WorkflowsWorkflowsPage, } from "./workflows.mjs";
|
|
3
3
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB;OACM,EACL,SAAS,EACT,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB;OACM,EACL,SAAS,EACT,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,GAC5B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Versions, type VersionRetrieveResponse, type VersionRetrieveParams, type VersionListParams, } from "./versions.js";
|
|
2
|
-
export { Workflows, type FunctionVersionIdentifier, type Workflow, type
|
|
2
|
+
export { Workflows, type FunctionVersionIdentifier, type Workflow, type WorkflowAudit, type WorkflowEdgeResponse, type WorkflowNodeResponse, type WorkflowCreateResponse, type WorkflowRetrieveResponse, type WorkflowUpdateResponse, type WorkflowCopyResponse, type WorkflowCreateParams, type WorkflowUpdateParams, type WorkflowListParams, type WorkflowCallParams, type WorkflowCopyParams, type WorkflowsWorkflowVersionsPage, type WorkflowsWorkflowsPage, } from "./workflows.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB;OACM,EACL,SAAS,EACT,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB;OACM,EACL,SAAS,EACT,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,GAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAKoB;AAJlB,oGAAA,QAAQ,OAAA;AAKV,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAKoB;AAJlB,oGAAA,QAAQ,OAAA;AAKV,4CAkBqB;AAjBnB,sGAAA,SAAS,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAIT;OACM,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/workflows/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAIT;OACM,EACL,SAAS,GAiBV"}
|
|
@@ -22,6 +22,9 @@ export interface VersionRetrieveResponse {
|
|
|
22
22
|
* Error message if the workflow version retrieval failed.
|
|
23
23
|
*/
|
|
24
24
|
error?: string;
|
|
25
|
+
/**
|
|
26
|
+
* V3 read representation of a workflow version.
|
|
27
|
+
*/
|
|
25
28
|
workflow?: WorkflowsAPI.Workflow;
|
|
26
29
|
}
|
|
27
30
|
export interface VersionRetrieveParams {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.mts","sourceRoot":"","sources":["../../src/resources/workflows/versions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,6BAA6B,EAAE;OACjC,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAwB,KAAK,0BAA0B,EAAE;OACtE,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,uBAAuB,CAAC;IAKtC;;OAEG;IACH,IAAI,CACF,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,6BAA6B,EAAE,YAAY,CAAC,QAAQ,CAAC;CAOrE;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,0BAA0B;IACnE,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAA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B,IAAI,iBAAiB,GAC5C,CAAC;CACH;AAED,OAAO,EAAE,KAAK,6BAA6B,EAAE,CAAC"}
|
|
@@ -22,6 +22,9 @@ export interface VersionRetrieveResponse {
|
|
|
22
22
|
* Error message if the workflow version retrieval failed.
|
|
23
23
|
*/
|
|
24
24
|
error?: string;
|
|
25
|
+
/**
|
|
26
|
+
* V3 read representation of a workflow version.
|
|
27
|
+
*/
|
|
25
28
|
workflow?: WorkflowsAPI.Workflow;
|
|
26
29
|
}
|
|
27
30
|
export interface VersionRetrieveParams {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/resources/workflows/versions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,6BAA6B,EAAE;OACjC,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAwB,KAAK,0BAA0B,EAAE;OACtE,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,uBAAuB,CAAC;IAKtC;;OAEG;IACH,IAAI,CACF,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,6BAA6B,EAAE,YAAY,CAAC,QAAQ,CAAC;CAOrE;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,0BAA0B;IACnE,SAAS,CAAC,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