@usestatemachines/sdk 0.11.0 → 0.12.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/README.md +80 -15
- package/agents/SKILL.md +9 -4
- package/agents/index.js +4 -4
- package/agents/llms.txt +7 -5
- package/esm/extensions/client.d.ts +56 -8
- package/esm/extensions/client.js +67 -5
- package/esm/extensions/credentials.js +4 -0
- package/esm/extensions/environment.d.ts +11 -2
- package/esm/extensions/errors.d.ts +33 -0
- package/esm/extensions/errors.js +53 -0
- package/esm/extensions/import-data.d.ts +43 -0
- package/esm/extensions/import-data.js +88 -0
- package/esm/extensions/index.d.ts +4 -3
- package/esm/extensions/index.js +1 -1
- package/esm/extensions/packaging.d.ts +1 -0
- package/esm/extensions/packaging.js +1 -0
- package/esm/extensions/zip.d.ts +8 -0
- package/esm/extensions/zip.js +121 -0
- package/esm/funcs/environments-actors.d.ts +11 -0
- package/esm/funcs/environments-actors.js +102 -0
- package/esm/funcs/get-import-file.d.ts +12 -0
- package/esm/funcs/get-import-file.js +97 -0
- package/esm/funcs/list-import-files.d.ts +12 -0
- package/esm/funcs/list-import-files.js +98 -0
- package/esm/funcs/upload-import.d.ts +12 -0
- package/esm/funcs/upload-import.js +96 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/absent-record.d.ts +7 -3
- package/esm/models/absent-record.js +3 -2
- package/esm/models/actor.d.ts +3 -0
- package/esm/models/app-user.d.ts +17 -0
- package/esm/models/app-user.js +18 -0
- package/esm/models/credentials.d.ts +6 -1
- package/esm/models/credentials.js +2 -0
- package/esm/models/environment.d.ts +4 -4
- package/esm/models/environment.js +3 -4
- package/esm/models/error.d.ts +7 -0
- package/esm/models/error.js +4 -0
- package/esm/models/filled-field.d.ts +14 -0
- package/esm/models/filled-field.js +16 -0
- package/esm/models/import-actor.d.ts +16 -0
- package/esm/models/import-actor.js +15 -0
- package/esm/models/import-file.d.ts +56 -0
- package/esm/models/import-file.js +67 -0
- package/esm/models/import-folder.d.ts +56 -0
- package/esm/models/import-folder.js +75 -0
- package/esm/models/import-problem.d.ts +4 -4
- package/esm/models/import-problem.js +1 -1
- package/esm/models/index.d.ts +18 -1
- package/esm/models/index.js +18 -1
- package/esm/models/known-difference.d.ts +21 -0
- package/esm/models/known-difference.js +16 -0
- package/esm/models/launch-ui-session.d.ts +12 -2
- package/esm/models/launch-ui-session.js +2 -1
- package/esm/models/made-id.d.ts +22 -0
- package/esm/models/made-id.js +17 -0
- package/esm/models/matched-record.d.ts +22 -0
- package/esm/models/matched-record.js +17 -0
- package/esm/models/object-load.d.ts +21 -0
- package/esm/models/object-load.js +17 -0
- package/esm/models/operations/create-credentials.d.ts +10 -0
- package/esm/models/operations/create-credentials.js +1 -0
- package/esm/models/operations/get-import-file.d.ts +13 -0
- package/esm/models/operations/get-import-file.js +12 -0
- package/esm/models/operations/index.d.ts +4 -0
- package/esm/models/operations/index.js +4 -0
- package/esm/models/operations/list-actors.d.ts +32 -0
- package/esm/models/operations/list-actors.js +26 -0
- package/esm/models/operations/list-import-files.d.ts +15 -0
- package/esm/models/operations/list-import-files.js +13 -0
- package/esm/models/operations/list-snapshots.d.ts +2 -2
- package/esm/models/operations/list-snapshots.js +1 -1
- package/esm/models/operations/upload-import.d.ts +13 -0
- package/esm/models/operations/upload-import.js +17 -0
- package/esm/models/problem-counts.d.ts +17 -0
- package/esm/models/problem-counts.js +14 -0
- package/esm/models/received-import.d.ts +9 -0
- package/esm/models/received-import.js +13 -0
- package/esm/models/record-source.d.ts +13 -0
- package/esm/models/{absent-record-source.js → record-source.js} +3 -3
- package/esm/models/snapshot-app-full-load-counts.d.ts +57 -0
- package/esm/models/snapshot-app-full-load-counts.js +25 -0
- package/esm/models/snapshot-app-full-load.d.ts +101 -0
- package/esm/models/snapshot-app-full-load.js +42 -0
- package/esm/models/snapshot-app-limited-load-counts.d.ts +16 -0
- package/esm/models/snapshot-app-limited-load-counts.js +14 -0
- package/esm/models/snapshot-app-limited-load.d.ts +18 -0
- package/esm/models/snapshot-app-limited-load.js +16 -0
- package/esm/models/snapshot-app-load-counts.d.ts +13 -0
- package/esm/models/snapshot-app-load-counts.js +15 -0
- package/esm/models/snapshot-app-load.d.ts +5 -12
- package/esm/models/snapshot-app-load.js +6 -6
- package/esm/models/snapshot-list-item.d.ts +53 -0
- package/esm/models/snapshot-list-item.js +42 -0
- package/esm/models/snapshot.d.ts +1 -1
- package/esm/models/version.d.ts +3 -0
- package/esm/sdk/environments.d.ts +1 -0
- package/esm/sdk/environments.js +4 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +12 -0
- package/openapi.json +1868 -510
- package/package.json +7 -3
- package/esm/models/absent-record-source.d.ts +0 -13
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// APPNOTE.TXT 4.3 and 4.4: the signature of each record, version 2.0 to
|
|
2
|
+
// read, a Unix host in the high byte of `version made by`, bit 11 of the
|
|
3
|
+
// flags for a UTF-8 name, method 0 to store, 1980-01-01 as the earliest
|
|
4
|
+
// MS-DOS date, and 0xffff and 0xffffffff for values in ZIP64. Info-ZIP keeps
|
|
5
|
+
// the mode of a file from a Unix host in the high 16 bits of the external
|
|
6
|
+
// attributes.
|
|
7
|
+
const LOCAL_HEADER = 0x04034b50;
|
|
8
|
+
const DIRECTORY_HEADER = 0x02014b50;
|
|
9
|
+
const END_OF_DIRECTORY = 0x06054b50;
|
|
10
|
+
const VERSION = 20;
|
|
11
|
+
const MADE_BY_UNIX = (3 << 8) | VERSION;
|
|
12
|
+
const UTF8_NAME = 0x800;
|
|
13
|
+
const STORED = 0;
|
|
14
|
+
const EARLIEST_DATE = (1 << 5) | 1;
|
|
15
|
+
const REGULAR_FILE = 0o100644 * 0x10000;
|
|
16
|
+
const MOST_ENTRIES = 0xfffe;
|
|
17
|
+
const MOST_BYTES = 0xfffffffe;
|
|
18
|
+
const utf8 = new TextEncoder();
|
|
19
|
+
const textOrder = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
20
|
+
/**
|
|
21
|
+
* A zip file of `files`, keyed by their paths, in the order of their paths.
|
|
22
|
+
* Each file is stored, with a UTF-8 name, the earliest MS-DOS time, and no
|
|
23
|
+
* extra field, so the same files always give the same bytes. It refuses what
|
|
24
|
+
* needs ZIP64. It needs no `node:zlib`, because the SDK imports no Node
|
|
25
|
+
* module and runs in Cloudflare Workers.
|
|
26
|
+
*/
|
|
27
|
+
export function zipFiles(files) {
|
|
28
|
+
if (files.size > MOST_ENTRIES) {
|
|
29
|
+
throw new RangeError(`A zip file holds at most ${MOST_ENTRIES} files.`);
|
|
30
|
+
}
|
|
31
|
+
const parts = [];
|
|
32
|
+
const directory = [];
|
|
33
|
+
let offset = 0;
|
|
34
|
+
for (const [path, bytes] of [...files].sort(([a], [b]) => textOrder(a, b))) {
|
|
35
|
+
if (bytes.length > MOST_BYTES) {
|
|
36
|
+
throw new RangeError(`A file in a zip file holds at most ${MOST_BYTES} bytes.`);
|
|
37
|
+
}
|
|
38
|
+
const name = utf8.encode(path);
|
|
39
|
+
const shared = [
|
|
40
|
+
[2, VERSION],
|
|
41
|
+
[2, UTF8_NAME],
|
|
42
|
+
[2, STORED],
|
|
43
|
+
[2, 0],
|
|
44
|
+
[2, EARLIEST_DATE],
|
|
45
|
+
[4, crc32(bytes)],
|
|
46
|
+
[4, bytes.length],
|
|
47
|
+
[4, bytes.length],
|
|
48
|
+
[2, name.length],
|
|
49
|
+
[2, 0],
|
|
50
|
+
];
|
|
51
|
+
const local = record([[4, LOCAL_HEADER], ...shared], name);
|
|
52
|
+
directory.push(record([
|
|
53
|
+
[4, DIRECTORY_HEADER],
|
|
54
|
+
[2, MADE_BY_UNIX],
|
|
55
|
+
...shared,
|
|
56
|
+
[2, 0],
|
|
57
|
+
[2, 0],
|
|
58
|
+
[2, 0],
|
|
59
|
+
[4, REGULAR_FILE],
|
|
60
|
+
[4, offset],
|
|
61
|
+
], name));
|
|
62
|
+
parts.push(local, bytes);
|
|
63
|
+
offset += local.length + bytes.length;
|
|
64
|
+
}
|
|
65
|
+
const size = directory.reduce((sum, header) => sum + header.length, 0);
|
|
66
|
+
if (offset + size > MOST_BYTES) {
|
|
67
|
+
throw new RangeError(`A zip file holds at most ${MOST_BYTES} bytes.`);
|
|
68
|
+
}
|
|
69
|
+
const end = record([
|
|
70
|
+
[4, END_OF_DIRECTORY],
|
|
71
|
+
[2, 0],
|
|
72
|
+
[2, 0],
|
|
73
|
+
[2, files.size],
|
|
74
|
+
[2, files.size],
|
|
75
|
+
[4, size],
|
|
76
|
+
[4, offset],
|
|
77
|
+
[2, 0],
|
|
78
|
+
]);
|
|
79
|
+
return concatenated([...parts, ...directory, end]);
|
|
80
|
+
}
|
|
81
|
+
function record(fields, name = new Uint8Array()) {
|
|
82
|
+
const size = fields.reduce((sum, [bytes]) => sum + bytes, 0);
|
|
83
|
+
const bytes = new Uint8Array(size + name.length);
|
|
84
|
+
const view = new DataView(bytes.buffer);
|
|
85
|
+
let at = 0;
|
|
86
|
+
for (const [field, value] of fields) {
|
|
87
|
+
if (field === 2) {
|
|
88
|
+
view.setUint16(at, value, true);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
view.setUint32(at, value, true);
|
|
92
|
+
}
|
|
93
|
+
at += field;
|
|
94
|
+
}
|
|
95
|
+
bytes.set(name, size);
|
|
96
|
+
return bytes;
|
|
97
|
+
}
|
|
98
|
+
function concatenated(parts) {
|
|
99
|
+
const bytes = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
|
|
100
|
+
let at = 0;
|
|
101
|
+
for (const part of parts) {
|
|
102
|
+
bytes.set(part, at);
|
|
103
|
+
at += part.length;
|
|
104
|
+
}
|
|
105
|
+
return bytes;
|
|
106
|
+
}
|
|
107
|
+
// The CRC-32 of zip files, from ISO 3309, with the reflected polynomial 0xedb88320.
|
|
108
|
+
const CRC_TABLE = Uint32Array.from({ length: 256 }, (_, byte) => {
|
|
109
|
+
let crc = byte;
|
|
110
|
+
for (let bit = 0; bit < 8; bit += 1) {
|
|
111
|
+
crc = crc & 1 ? 0xedb88320 ^ (crc >>> 1) : crc >>> 1;
|
|
112
|
+
}
|
|
113
|
+
return crc;
|
|
114
|
+
});
|
|
115
|
+
function crc32(bytes) {
|
|
116
|
+
let crc = 0xffffffff;
|
|
117
|
+
for (const byte of bytes) {
|
|
118
|
+
crc = CRC_TABLE[(crc ^ byte) & 0xff] ^ (crc >>> 8);
|
|
119
|
+
}
|
|
120
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
121
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
export declare function environmentsActors(client: StateMachinesCore, request: operations.ListActorsRequest, options?: RequestOptions): APIPromise<Result<operations.ListActorsResponse, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
export function environmentsActors(client, request, options) {
|
|
16
|
+
return new APIPromise($do(client, request, options));
|
|
17
|
+
}
|
|
18
|
+
async function $do(client, request, options) {
|
|
19
|
+
const parsed = safeParse(request, (value) => z.parse(operations.ListActorsRequest$outboundSchema, value), "Input validation failed");
|
|
20
|
+
if (!parsed.ok) {
|
|
21
|
+
return [parsed, { status: "invalid" }];
|
|
22
|
+
}
|
|
23
|
+
const payload = parsed.value;
|
|
24
|
+
const body = null;
|
|
25
|
+
const pathParams = {
|
|
26
|
+
appName: encodeSimple("appName", payload.appName, {
|
|
27
|
+
explode: false,
|
|
28
|
+
charEncoding: "percent",
|
|
29
|
+
}),
|
|
30
|
+
environmentId: encodeSimple("environmentId", payload.environmentId, {
|
|
31
|
+
explode: false,
|
|
32
|
+
charEncoding: "percent",
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
const path = pathToFunc("/v1/environments/{environmentId}/apps/{appName}/actors")(pathParams);
|
|
36
|
+
const query = encodeFormQuery({
|
|
37
|
+
"cursor": payload.cursor,
|
|
38
|
+
"limit": payload.limit,
|
|
39
|
+
"search": payload.search,
|
|
40
|
+
});
|
|
41
|
+
const headers = new Headers(compactMap({
|
|
42
|
+
Accept: "application/json",
|
|
43
|
+
}));
|
|
44
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
45
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
46
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
47
|
+
const context = {
|
|
48
|
+
options: client._options,
|
|
49
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
50
|
+
operationID: "listActors",
|
|
51
|
+
oAuth2Scopes: null,
|
|
52
|
+
resolvedSecurity: requestSecurity,
|
|
53
|
+
securitySource: client._options.apiKey,
|
|
54
|
+
retryConfig: options?.retries
|
|
55
|
+
|| client._options.retryConfig
|
|
56
|
+
|| {
|
|
57
|
+
strategy: "backoff",
|
|
58
|
+
backoff: {
|
|
59
|
+
initialInterval: 1000,
|
|
60
|
+
maxInterval: 5000,
|
|
61
|
+
exponent: 1.5,
|
|
62
|
+
maxElapsedTime: 600000,
|
|
63
|
+
},
|
|
64
|
+
retryConnectionErrors: true,
|
|
65
|
+
}
|
|
66
|
+
|| { strategy: "none" },
|
|
67
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
68
|
+
};
|
|
69
|
+
const requestRes = client._createRequest(context, {
|
|
70
|
+
security: requestSecurity,
|
|
71
|
+
method: "GET",
|
|
72
|
+
baseURL: options?.serverURL,
|
|
73
|
+
path: path,
|
|
74
|
+
headers: headers,
|
|
75
|
+
query: query,
|
|
76
|
+
body: body,
|
|
77
|
+
userAgent: client._options.userAgent,
|
|
78
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
79
|
+
}, options);
|
|
80
|
+
if (!requestRes.ok) {
|
|
81
|
+
return [requestRes, { status: "invalid" }];
|
|
82
|
+
}
|
|
83
|
+
const req = requestRes.value;
|
|
84
|
+
const doResult = await client._do(req, {
|
|
85
|
+
context,
|
|
86
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
87
|
+
retryConfig: context.retryConfig,
|
|
88
|
+
retryCodes: context.retryCodes,
|
|
89
|
+
});
|
|
90
|
+
if (!doResult.ok) {
|
|
91
|
+
return [doResult, { status: "request-error", request: req }];
|
|
92
|
+
}
|
|
93
|
+
const response = doResult.value;
|
|
94
|
+
const responseFields = {
|
|
95
|
+
HttpMeta: { Response: response, Request: req },
|
|
96
|
+
};
|
|
97
|
+
const [result] = await M.match(M.json(200, operations.ListActorsResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorT$inboundSchema), M.jsonErr([500, 503], errors.ErrorT$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
98
|
+
if (!result.ok) {
|
|
99
|
+
return [result, { status: "complete", request: req, response }];
|
|
100
|
+
}
|
|
101
|
+
return [result, { status: "complete", request: req, response }];
|
|
102
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
export declare function getImportFile(client: StateMachinesCore, request: operations.GetImportFileRequest, options?: RequestOptions): APIPromise<Result<models.ImportFile, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
export function getImportFile(client, request, options) {
|
|
17
|
+
return new APIPromise($do(client, request, options));
|
|
18
|
+
}
|
|
19
|
+
async function $do(client, request, options) {
|
|
20
|
+
const parsed = safeParse(request, (value) => z.parse(operations.GetImportFileRequest$outboundSchema, value), "Input validation failed");
|
|
21
|
+
if (!parsed.ok) {
|
|
22
|
+
return [parsed, { status: "invalid" }];
|
|
23
|
+
}
|
|
24
|
+
const payload = parsed.value;
|
|
25
|
+
const body = null;
|
|
26
|
+
const pathParams = {
|
|
27
|
+
importId: encodeSimple("importId", payload.importId, {
|
|
28
|
+
explode: false,
|
|
29
|
+
charEncoding: "percent",
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
const path = pathToFunc("/v1/imports/{importId}/file")(pathParams);
|
|
33
|
+
const query = encodeFormQuery({
|
|
34
|
+
"path": payload.path,
|
|
35
|
+
});
|
|
36
|
+
const headers = new Headers(compactMap({
|
|
37
|
+
Accept: "application/json",
|
|
38
|
+
}));
|
|
39
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
40
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
41
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
42
|
+
const context = {
|
|
43
|
+
options: client._options,
|
|
44
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
45
|
+
operationID: "getImportFile",
|
|
46
|
+
oAuth2Scopes: null,
|
|
47
|
+
resolvedSecurity: requestSecurity,
|
|
48
|
+
securitySource: client._options.apiKey,
|
|
49
|
+
retryConfig: options?.retries
|
|
50
|
+
|| client._options.retryConfig
|
|
51
|
+
|| {
|
|
52
|
+
strategy: "backoff",
|
|
53
|
+
backoff: {
|
|
54
|
+
initialInterval: 1000,
|
|
55
|
+
maxInterval: 5000,
|
|
56
|
+
exponent: 1.5,
|
|
57
|
+
maxElapsedTime: 600000,
|
|
58
|
+
},
|
|
59
|
+
retryConnectionErrors: true,
|
|
60
|
+
}
|
|
61
|
+
|| { strategy: "none" },
|
|
62
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
63
|
+
};
|
|
64
|
+
const requestRes = client._createRequest(context, {
|
|
65
|
+
security: requestSecurity,
|
|
66
|
+
method: "GET",
|
|
67
|
+
baseURL: options?.serverURL,
|
|
68
|
+
path: path,
|
|
69
|
+
headers: headers,
|
|
70
|
+
query: query,
|
|
71
|
+
body: body,
|
|
72
|
+
userAgent: client._options.userAgent,
|
|
73
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
74
|
+
}, options);
|
|
75
|
+
if (!requestRes.ok) {
|
|
76
|
+
return [requestRes, { status: "invalid" }];
|
|
77
|
+
}
|
|
78
|
+
const req = requestRes.value;
|
|
79
|
+
const doResult = await client._do(req, {
|
|
80
|
+
context,
|
|
81
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
82
|
+
retryConfig: context.retryConfig,
|
|
83
|
+
retryCodes: context.retryCodes,
|
|
84
|
+
});
|
|
85
|
+
if (!doResult.ok) {
|
|
86
|
+
return [doResult, { status: "request-error", request: req }];
|
|
87
|
+
}
|
|
88
|
+
const response = doResult.value;
|
|
89
|
+
const responseFields = {
|
|
90
|
+
HttpMeta: { Response: response, Request: req },
|
|
91
|
+
};
|
|
92
|
+
const [result] = await M.match(M.json(200, models.ImportFile$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorT$inboundSchema), M.jsonErr([500, 503], errors.ErrorT$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
93
|
+
if (!result.ok) {
|
|
94
|
+
return [result, { status: "complete", request: req, response }];
|
|
95
|
+
}
|
|
96
|
+
return [result, { status: "complete", request: req, response }];
|
|
97
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
export declare function listImportFiles(client: StateMachinesCore, request: operations.ListImportFilesRequest, options?: RequestOptions): APIPromise<Result<models.ImportFolder, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
export function listImportFiles(client, request, options) {
|
|
17
|
+
return new APIPromise($do(client, request, options));
|
|
18
|
+
}
|
|
19
|
+
async function $do(client, request, options) {
|
|
20
|
+
const parsed = safeParse(request, (value) => z.parse(operations.ListImportFilesRequest$outboundSchema, value), "Input validation failed");
|
|
21
|
+
if (!parsed.ok) {
|
|
22
|
+
return [parsed, { status: "invalid" }];
|
|
23
|
+
}
|
|
24
|
+
const payload = parsed.value;
|
|
25
|
+
const body = null;
|
|
26
|
+
const pathParams = {
|
|
27
|
+
importId: encodeSimple("importId", payload.importId, {
|
|
28
|
+
explode: false,
|
|
29
|
+
charEncoding: "percent",
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
const path = pathToFunc("/v1/imports/{importId}/files")(pathParams);
|
|
33
|
+
const query = encodeFormQuery({
|
|
34
|
+
"cursor": payload.cursor,
|
|
35
|
+
"path": payload.path,
|
|
36
|
+
});
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
}));
|
|
40
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
41
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
42
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
43
|
+
const context = {
|
|
44
|
+
options: client._options,
|
|
45
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
46
|
+
operationID: "listImportFiles",
|
|
47
|
+
oAuth2Scopes: null,
|
|
48
|
+
resolvedSecurity: requestSecurity,
|
|
49
|
+
securitySource: client._options.apiKey,
|
|
50
|
+
retryConfig: options?.retries
|
|
51
|
+
|| client._options.retryConfig
|
|
52
|
+
|| {
|
|
53
|
+
strategy: "backoff",
|
|
54
|
+
backoff: {
|
|
55
|
+
initialInterval: 1000,
|
|
56
|
+
maxInterval: 5000,
|
|
57
|
+
exponent: 1.5,
|
|
58
|
+
maxElapsedTime: 600000,
|
|
59
|
+
},
|
|
60
|
+
retryConnectionErrors: true,
|
|
61
|
+
}
|
|
62
|
+
|| { strategy: "none" },
|
|
63
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
64
|
+
};
|
|
65
|
+
const requestRes = client._createRequest(context, {
|
|
66
|
+
security: requestSecurity,
|
|
67
|
+
method: "GET",
|
|
68
|
+
baseURL: options?.serverURL,
|
|
69
|
+
path: path,
|
|
70
|
+
headers: headers,
|
|
71
|
+
query: query,
|
|
72
|
+
body: body,
|
|
73
|
+
userAgent: client._options.userAgent,
|
|
74
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
75
|
+
}, options);
|
|
76
|
+
if (!requestRes.ok) {
|
|
77
|
+
return [requestRes, { status: "invalid" }];
|
|
78
|
+
}
|
|
79
|
+
const req = requestRes.value;
|
|
80
|
+
const doResult = await client._do(req, {
|
|
81
|
+
context,
|
|
82
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
83
|
+
retryConfig: context.retryConfig,
|
|
84
|
+
retryCodes: context.retryCodes,
|
|
85
|
+
});
|
|
86
|
+
if (!doResult.ok) {
|
|
87
|
+
return [doResult, { status: "request-error", request: req }];
|
|
88
|
+
}
|
|
89
|
+
const response = doResult.value;
|
|
90
|
+
const responseFields = {
|
|
91
|
+
HttpMeta: { Response: response, Request: req },
|
|
92
|
+
};
|
|
93
|
+
const [result] = await M.match(M.json(200, models.ImportFolder$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorT$inboundSchema), M.jsonErr([500, 503], errors.ErrorT$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
94
|
+
if (!result.ok) {
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
97
|
+
return [result, { status: "complete", request: req, response }];
|
|
98
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StateMachinesCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
7
|
+
import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
export declare function uploadImport(client: StateMachinesCore, request: operations.UploadImportRequest, options?: RequestOptions): APIPromise<Result<models.ReceivedImport, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
export function uploadImport(client, request, options) {
|
|
17
|
+
return new APIPromise($do(client, request, options));
|
|
18
|
+
}
|
|
19
|
+
async function $do(client, request, options) {
|
|
20
|
+
const parsed = safeParse(request, (value) => z.parse(operations.UploadImportRequest$outboundSchema, value), "Input validation failed");
|
|
21
|
+
if (!parsed.ok) {
|
|
22
|
+
return [parsed, { status: "invalid" }];
|
|
23
|
+
}
|
|
24
|
+
const payload = parsed.value;
|
|
25
|
+
const body = payload.body instanceof Uint8Array
|
|
26
|
+
? new Uint8Array(payload.body).buffer
|
|
27
|
+
: payload.body;
|
|
28
|
+
const pathParams = {
|
|
29
|
+
importId: encodeSimple("importId", payload.importId, {
|
|
30
|
+
explode: false,
|
|
31
|
+
charEncoding: "percent",
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
const path = pathToFunc("/v1/imports/{importId}/upload")(pathParams);
|
|
35
|
+
const headers = new Headers(compactMap({
|
|
36
|
+
"Content-Type": "application/zip",
|
|
37
|
+
Accept: "application/json",
|
|
38
|
+
}));
|
|
39
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
40
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
41
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
42
|
+
const context = {
|
|
43
|
+
options: client._options,
|
|
44
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
45
|
+
operationID: "uploadImport",
|
|
46
|
+
oAuth2Scopes: null,
|
|
47
|
+
resolvedSecurity: requestSecurity,
|
|
48
|
+
securitySource: client._options.apiKey,
|
|
49
|
+
retryConfig: options?.retries
|
|
50
|
+
|| client._options.retryConfig
|
|
51
|
+
|| {
|
|
52
|
+
strategy: "backoff",
|
|
53
|
+
backoff: {
|
|
54
|
+
initialInterval: 1000,
|
|
55
|
+
maxInterval: 5000,
|
|
56
|
+
exponent: 1.5,
|
|
57
|
+
maxElapsedTime: 600000,
|
|
58
|
+
},
|
|
59
|
+
retryConnectionErrors: true,
|
|
60
|
+
}
|
|
61
|
+
|| { strategy: "none" },
|
|
62
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
63
|
+
};
|
|
64
|
+
const requestRes = client._createRequest(context, {
|
|
65
|
+
security: requestSecurity,
|
|
66
|
+
method: "PUT",
|
|
67
|
+
baseURL: options?.serverURL,
|
|
68
|
+
path: path,
|
|
69
|
+
headers: headers,
|
|
70
|
+
body: body,
|
|
71
|
+
userAgent: client._options.userAgent,
|
|
72
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
73
|
+
}, options);
|
|
74
|
+
if (!requestRes.ok) {
|
|
75
|
+
return [requestRes, { status: "invalid" }];
|
|
76
|
+
}
|
|
77
|
+
const req = requestRes.value;
|
|
78
|
+
const doResult = await client._do(req, {
|
|
79
|
+
context,
|
|
80
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
81
|
+
retryConfig: context.retryConfig,
|
|
82
|
+
retryCodes: context.retryCodes,
|
|
83
|
+
});
|
|
84
|
+
if (!doResult.ok) {
|
|
85
|
+
return [doResult, { status: "request-error", request: req }];
|
|
86
|
+
}
|
|
87
|
+
const response = doResult.value;
|
|
88
|
+
const responseFields = {
|
|
89
|
+
HttpMeta: { Response: response, Request: req },
|
|
90
|
+
};
|
|
91
|
+
const [result] = await M.match(M.json(200, models.ReceivedImport$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorT$inboundSchema), M.jsonErr([500, 503], errors.ErrorT$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
92
|
+
if (!result.ok) {
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
31
31
|
export declare const SDK_METADATA: {
|
|
32
32
|
readonly language: "typescript";
|
|
33
33
|
readonly openapiDocVersion: "1.0.0";
|
|
34
|
-
readonly sdkVersion: "0.
|
|
34
|
+
readonly sdkVersion: "0.12.0";
|
|
35
35
|
readonly genVersion: "2.941.0";
|
|
36
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.
|
|
36
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.12.0 2.941.0 1.0.0 @usestatemachines/sdk";
|
|
37
37
|
};
|
package/esm/lib/config.js
CHANGED
|
@@ -24,7 +24,7 @@ export function serverURLFromOptions(options) {
|
|
|
24
24
|
export const SDK_METADATA = {
|
|
25
25
|
language: "typescript",
|
|
26
26
|
openapiDocVersion: "1.0.0",
|
|
27
|
-
sdkVersion: "0.
|
|
27
|
+
sdkVersion: "0.12.0",
|
|
28
28
|
genVersion: "2.941.0",
|
|
29
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
29
|
+
userAgent: "speakeasy-sdk/typescript 0.12.0 2.941.0 1.0.0 @usestatemachines/sdk",
|
|
30
30
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as z from "zod/v4-mini";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { AbsentReason } from "./absent-reason.js";
|
|
4
|
-
import { AbsentRecordSource } from "./absent-record-source.js";
|
|
5
4
|
import { SDKValidationError } from "./errors/sdk-validation-error.js";
|
|
5
|
+
import { RecordSource } from "./record-source.js";
|
|
6
6
|
export type AbsentRecord = {
|
|
7
7
|
/**
|
|
8
8
|
* The vendor's ID of the record, or null for a record that holds none.
|
|
@@ -14,9 +14,13 @@ export type AbsentRecord = {
|
|
|
14
14
|
*/
|
|
15
15
|
reason: AbsentReason;
|
|
16
16
|
/**
|
|
17
|
-
* The file
|
|
17
|
+
* The file that holds the record in the import, such as `salesforce/records/Opportunity.jsonl` or the manifest `acme.yaml`, and the line where the record starts, counted from 1.
|
|
18
18
|
*/
|
|
19
|
-
source:
|
|
19
|
+
source: RecordSource;
|
|
20
|
+
/**
|
|
21
|
+
* The text that the record wrote as its ID, such as `acme`, when the text is no vendor ID.
|
|
22
|
+
*/
|
|
23
|
+
text?: string | undefined;
|
|
20
24
|
};
|
|
21
25
|
/** @internal */
|
|
22
26
|
export declare const AbsentRecord$inboundSchema: z.ZodMiniType<AbsentRecord, unknown>;
|
|
@@ -5,13 +5,14 @@ import * as z from "zod/v4-mini";
|
|
|
5
5
|
import { safeParse } from "../lib/schemas.js";
|
|
6
6
|
import * as types from "../types/primitives.js";
|
|
7
7
|
import { AbsentReason$inboundSchema } from "./absent-reason.js";
|
|
8
|
-
import {
|
|
8
|
+
import { RecordSource$inboundSchema } from "./record-source.js";
|
|
9
9
|
/** @internal */
|
|
10
10
|
export const AbsentRecord$inboundSchema = z.object({
|
|
11
11
|
nativeId: types.nullable(types.string()),
|
|
12
12
|
object: types.string(),
|
|
13
13
|
reason: AbsentReason$inboundSchema,
|
|
14
|
-
source:
|
|
14
|
+
source: RecordSource$inboundSchema,
|
|
15
|
+
text: types.optional(types.string()),
|
|
15
16
|
});
|
|
16
17
|
export function absentRecordFromJSON(jsonString) {
|
|
17
18
|
return safeParse(jsonString, (x) => AbsentRecord$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AbsentRecord' from JSON`);
|
package/esm/models/actor.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as z from "zod/v4-mini";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdk-validation-error.js";
|
|
4
|
+
/**
|
|
5
|
+
* A user of the app's seed, for display.
|
|
6
|
+
*/
|
|
4
7
|
export type Actor = {
|
|
5
8
|
id: string;
|
|
6
9
|
name: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as z from "zod/v4-mini";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdk-validation-error.js";
|
|
4
|
+
/**
|
|
5
|
+
* A user of an app who can sign in, as the app answers it.
|
|
6
|
+
*/
|
|
7
|
+
export type AppUser = {
|
|
8
|
+
default: boolean;
|
|
9
|
+
email: string | null;
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
role: string | null;
|
|
13
|
+
username: string | null;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const AppUser$inboundSchema: z.ZodMiniType<AppUser, unknown>;
|
|
17
|
+
export declare function appUserFromJSON(jsonString: string): SafeParseResult<AppUser, SDKValidationError>;
|