@usestatemachines/sdk 0.9.1 → 0.11.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 +16 -2
- package/agents/index.js +2 -2
- package/agents/llms.txt +4 -4
- package/esm/extensions/client.d.ts +31 -1
- package/esm/extensions/client.js +74 -2
- package/esm/extensions/errors.d.ts +7 -0
- package/esm/extensions/errors.js +46 -2
- package/esm/extensions/index.d.ts +2 -2
- package/esm/funcs/imports-complete.d.ts +12 -0
- package/esm/funcs/imports-complete.js +93 -0
- package/esm/funcs/imports-create.d.ts +12 -0
- package/esm/funcs/imports-create.js +89 -0
- package/esm/funcs/imports-delete.d.ts +12 -0
- package/esm/funcs/imports-delete.js +93 -0
- package/esm/funcs/imports-get.d.ts +12 -0
- package/esm/funcs/imports-get.js +93 -0
- package/esm/funcs/imports-list.d.ts +11 -0
- package/esm/funcs/imports-list.js +93 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/absent-reason.d.ts +36 -0
- package/esm/models/absent-reason.js +44 -0
- package/esm/models/absent-record-source.d.ts +13 -0
- package/esm/models/absent-record-source.js +14 -0
- package/esm/models/absent-record.d.ts +23 -0
- package/esm/models/absent-record.js +18 -0
- package/esm/models/create-snapshot-from-environment.d.ts +13 -0
- package/esm/models/create-snapshot-from-environment.js +12 -0
- package/esm/models/create-snapshot-from-import.d.ts +16 -0
- package/esm/models/create-snapshot-from-import.js +12 -0
- package/esm/models/create-snapshot.d.ts +9 -0
- package/esm/models/create-snapshot.js +14 -0
- package/esm/models/created-import.d.ts +38 -0
- package/esm/models/created-import.js +30 -0
- package/esm/models/import-problem.d.ts +40 -0
- package/esm/models/import-problem.js +28 -0
- package/esm/models/import-status.d.ts +13 -0
- package/esm/models/import-status.js +14 -0
- package/esm/models/import.d.ts +45 -0
- package/esm/models/import.js +36 -0
- package/esm/models/index.d.ts +12 -0
- package/esm/models/index.js +12 -0
- package/esm/models/operations/complete-import.d.ts +11 -0
- package/esm/models/operations/complete-import.js +11 -0
- package/esm/models/operations/create-import.d.ts +36 -0
- package/esm/models/operations/create-import.js +26 -0
- package/esm/models/operations/create-snapshot.d.ts +3 -14
- package/esm/models/operations/create-snapshot.js +2 -9
- package/esm/models/operations/delete-import.d.ts +11 -0
- package/esm/models/operations/delete-import.js +11 -0
- package/esm/models/operations/get-import.d.ts +11 -0
- package/esm/models/operations/get-import.js +11 -0
- package/esm/models/operations/index.d.ts +5 -0
- package/esm/models/operations/index.js +5 -0
- package/esm/models/operations/list-imports.d.ts +30 -0
- package/esm/models/operations/list-imports.js +25 -0
- package/esm/models/snapshot-app-load.d.ts +20 -0
- package/esm/models/snapshot-app-load.js +15 -0
- package/esm/models/snapshot-failure-union.d.ts +40 -0
- package/esm/models/snapshot-failure-union.js +42 -0
- package/esm/models/snapshot.d.ts +15 -19
- package/esm/models/snapshot.js +6 -19
- package/esm/sdk/imports.d.ts +10 -0
- package/esm/sdk/imports.js +27 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +5 -0
- package/openapi.json +1253 -187
- package/package.json +1 -1
|
@@ -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 importsComplete(client: StateMachinesCore, request: operations.CompleteImportRequest, options?: RequestOptions): APIPromise<Result<models.Import, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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 importsComplete(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.CompleteImportRequest$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}/complete")(pathParams);
|
|
33
|
+
const headers = new Headers(compactMap({
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
}));
|
|
36
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
37
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
38
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
39
|
+
const context = {
|
|
40
|
+
options: client._options,
|
|
41
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
42
|
+
operationID: "completeImport",
|
|
43
|
+
oAuth2Scopes: null,
|
|
44
|
+
resolvedSecurity: requestSecurity,
|
|
45
|
+
securitySource: client._options.apiKey,
|
|
46
|
+
retryConfig: options?.retries
|
|
47
|
+
|| client._options.retryConfig
|
|
48
|
+
|| {
|
|
49
|
+
strategy: "backoff",
|
|
50
|
+
backoff: {
|
|
51
|
+
initialInterval: 1000,
|
|
52
|
+
maxInterval: 5000,
|
|
53
|
+
exponent: 1.5,
|
|
54
|
+
maxElapsedTime: 600000,
|
|
55
|
+
},
|
|
56
|
+
retryConnectionErrors: true,
|
|
57
|
+
}
|
|
58
|
+
|| { strategy: "none" },
|
|
59
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
60
|
+
};
|
|
61
|
+
const requestRes = client._createRequest(context, {
|
|
62
|
+
security: requestSecurity,
|
|
63
|
+
method: "POST",
|
|
64
|
+
baseURL: options?.serverURL,
|
|
65
|
+
path: path,
|
|
66
|
+
headers: headers,
|
|
67
|
+
body: body,
|
|
68
|
+
userAgent: client._options.userAgent,
|
|
69
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
70
|
+
}, options);
|
|
71
|
+
if (!requestRes.ok) {
|
|
72
|
+
return [requestRes, { status: "invalid" }];
|
|
73
|
+
}
|
|
74
|
+
const req = requestRes.value;
|
|
75
|
+
const doResult = await client._do(req, {
|
|
76
|
+
context,
|
|
77
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
78
|
+
retryConfig: context.retryConfig,
|
|
79
|
+
retryCodes: context.retryCodes,
|
|
80
|
+
});
|
|
81
|
+
if (!doResult.ok) {
|
|
82
|
+
return [doResult, { status: "request-error", request: req }];
|
|
83
|
+
}
|
|
84
|
+
const response = doResult.value;
|
|
85
|
+
const responseFields = {
|
|
86
|
+
HttpMeta: { Response: response, Request: req },
|
|
87
|
+
};
|
|
88
|
+
const [result] = await M.match(M.json(200, models.Import$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 });
|
|
89
|
+
if (!result.ok) {
|
|
90
|
+
return [result, { status: "complete", request: req, response }];
|
|
91
|
+
}
|
|
92
|
+
return [result, { status: "complete", request: req, response }];
|
|
93
|
+
}
|
|
@@ -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 importsCreate(client: StateMachinesCore, request: operations.CreateImportRequest, options?: RequestOptions): APIPromise<Result<models.CreatedImport, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeJSON, 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 importsCreate(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.CreateImportRequest$outboundSchema, value), "Input validation failed");
|
|
21
|
+
if (!parsed.ok) {
|
|
22
|
+
return [parsed, { status: "invalid" }];
|
|
23
|
+
}
|
|
24
|
+
const payload = parsed.value;
|
|
25
|
+
const body = encodeJSON("body", payload.body, { explode: true });
|
|
26
|
+
const path = pathToFunc("/v1/imports")();
|
|
27
|
+
const headers = new Headers(compactMap({
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
Accept: "application/json",
|
|
30
|
+
"idempotency-key": encodeSimple("idempotency-key", payload["idempotency-key"], { explode: false, charEncoding: "none" }),
|
|
31
|
+
}));
|
|
32
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
33
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
34
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
35
|
+
const context = {
|
|
36
|
+
options: client._options,
|
|
37
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
38
|
+
operationID: "createImport",
|
|
39
|
+
oAuth2Scopes: null,
|
|
40
|
+
resolvedSecurity: requestSecurity,
|
|
41
|
+
securitySource: client._options.apiKey,
|
|
42
|
+
retryConfig: options?.retries
|
|
43
|
+
|| client._options.retryConfig
|
|
44
|
+
|| {
|
|
45
|
+
strategy: "backoff",
|
|
46
|
+
backoff: {
|
|
47
|
+
initialInterval: 1000,
|
|
48
|
+
maxInterval: 5000,
|
|
49
|
+
exponent: 1.5,
|
|
50
|
+
maxElapsedTime: 600000,
|
|
51
|
+
},
|
|
52
|
+
retryConnectionErrors: true,
|
|
53
|
+
}
|
|
54
|
+
|| { strategy: "none" },
|
|
55
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
56
|
+
};
|
|
57
|
+
const requestRes = client._createRequest(context, {
|
|
58
|
+
security: requestSecurity,
|
|
59
|
+
method: "POST",
|
|
60
|
+
baseURL: options?.serverURL,
|
|
61
|
+
path: path,
|
|
62
|
+
headers: headers,
|
|
63
|
+
body: body,
|
|
64
|
+
userAgent: client._options.userAgent,
|
|
65
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
66
|
+
}, options);
|
|
67
|
+
if (!requestRes.ok) {
|
|
68
|
+
return [requestRes, { status: "invalid" }];
|
|
69
|
+
}
|
|
70
|
+
const req = requestRes.value;
|
|
71
|
+
const doResult = await client._do(req, {
|
|
72
|
+
context,
|
|
73
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
74
|
+
retryConfig: context.retryConfig,
|
|
75
|
+
retryCodes: context.retryCodes,
|
|
76
|
+
});
|
|
77
|
+
if (!doResult.ok) {
|
|
78
|
+
return [doResult, { status: "request-error", request: req }];
|
|
79
|
+
}
|
|
80
|
+
const response = doResult.value;
|
|
81
|
+
const responseFields = {
|
|
82
|
+
HttpMeta: { Response: response, Request: req },
|
|
83
|
+
};
|
|
84
|
+
const [result] = await M.match(M.json([200, 201], models.CreatedImport$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 });
|
|
85
|
+
if (!result.ok) {
|
|
86
|
+
return [result, { status: "complete", request: req, response }];
|
|
87
|
+
}
|
|
88
|
+
return [result, { status: "complete", request: req, response }];
|
|
89
|
+
}
|
|
@@ -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 importsDelete(client: StateMachinesCore, request: operations.DeleteImportRequest, options?: RequestOptions): APIPromise<Result<models.Import, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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 importsDelete(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.DeleteImportRequest$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}")(pathParams);
|
|
33
|
+
const headers = new Headers(compactMap({
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
}));
|
|
36
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
37
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
38
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
39
|
+
const context = {
|
|
40
|
+
options: client._options,
|
|
41
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
42
|
+
operationID: "deleteImport",
|
|
43
|
+
oAuth2Scopes: null,
|
|
44
|
+
resolvedSecurity: requestSecurity,
|
|
45
|
+
securitySource: client._options.apiKey,
|
|
46
|
+
retryConfig: options?.retries
|
|
47
|
+
|| client._options.retryConfig
|
|
48
|
+
|| {
|
|
49
|
+
strategy: "backoff",
|
|
50
|
+
backoff: {
|
|
51
|
+
initialInterval: 1000,
|
|
52
|
+
maxInterval: 5000,
|
|
53
|
+
exponent: 1.5,
|
|
54
|
+
maxElapsedTime: 600000,
|
|
55
|
+
},
|
|
56
|
+
retryConnectionErrors: true,
|
|
57
|
+
}
|
|
58
|
+
|| { strategy: "none" },
|
|
59
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
60
|
+
};
|
|
61
|
+
const requestRes = client._createRequest(context, {
|
|
62
|
+
security: requestSecurity,
|
|
63
|
+
method: "DELETE",
|
|
64
|
+
baseURL: options?.serverURL,
|
|
65
|
+
path: path,
|
|
66
|
+
headers: headers,
|
|
67
|
+
body: body,
|
|
68
|
+
userAgent: client._options.userAgent,
|
|
69
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
70
|
+
}, options);
|
|
71
|
+
if (!requestRes.ok) {
|
|
72
|
+
return [requestRes, { status: "invalid" }];
|
|
73
|
+
}
|
|
74
|
+
const req = requestRes.value;
|
|
75
|
+
const doResult = await client._do(req, {
|
|
76
|
+
context,
|
|
77
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
78
|
+
retryConfig: context.retryConfig,
|
|
79
|
+
retryCodes: context.retryCodes,
|
|
80
|
+
});
|
|
81
|
+
if (!doResult.ok) {
|
|
82
|
+
return [doResult, { status: "request-error", request: req }];
|
|
83
|
+
}
|
|
84
|
+
const response = doResult.value;
|
|
85
|
+
const responseFields = {
|
|
86
|
+
HttpMeta: { Response: response, Request: req },
|
|
87
|
+
};
|
|
88
|
+
const [result] = await M.match(M.json(200, models.Import$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 });
|
|
89
|
+
if (!result.ok) {
|
|
90
|
+
return [result, { status: "complete", request: req, response }];
|
|
91
|
+
}
|
|
92
|
+
return [result, { status: "complete", request: req, response }];
|
|
93
|
+
}
|
|
@@ -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 importsGet(client: StateMachinesCore, request: operations.GetImportRequest, options?: RequestOptions): APIPromise<Result<models.Import, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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 importsGet(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.GetImportRequest$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}")(pathParams);
|
|
33
|
+
const headers = new Headers(compactMap({
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
}));
|
|
36
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
37
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
38
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
39
|
+
const context = {
|
|
40
|
+
options: client._options,
|
|
41
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
42
|
+
operationID: "getImport",
|
|
43
|
+
oAuth2Scopes: null,
|
|
44
|
+
resolvedSecurity: requestSecurity,
|
|
45
|
+
securitySource: client._options.apiKey,
|
|
46
|
+
retryConfig: options?.retries
|
|
47
|
+
|| client._options.retryConfig
|
|
48
|
+
|| {
|
|
49
|
+
strategy: "backoff",
|
|
50
|
+
backoff: {
|
|
51
|
+
initialInterval: 1000,
|
|
52
|
+
maxInterval: 5000,
|
|
53
|
+
exponent: 1.5,
|
|
54
|
+
maxElapsedTime: 600000,
|
|
55
|
+
},
|
|
56
|
+
retryConnectionErrors: true,
|
|
57
|
+
}
|
|
58
|
+
|| { strategy: "none" },
|
|
59
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
60
|
+
};
|
|
61
|
+
const requestRes = client._createRequest(context, {
|
|
62
|
+
security: requestSecurity,
|
|
63
|
+
method: "GET",
|
|
64
|
+
baseURL: options?.serverURL,
|
|
65
|
+
path: path,
|
|
66
|
+
headers: headers,
|
|
67
|
+
body: body,
|
|
68
|
+
userAgent: client._options.userAgent,
|
|
69
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
70
|
+
}, options);
|
|
71
|
+
if (!requestRes.ok) {
|
|
72
|
+
return [requestRes, { status: "invalid" }];
|
|
73
|
+
}
|
|
74
|
+
const req = requestRes.value;
|
|
75
|
+
const doResult = await client._do(req, {
|
|
76
|
+
context,
|
|
77
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
78
|
+
retryConfig: context.retryConfig,
|
|
79
|
+
retryCodes: context.retryCodes,
|
|
80
|
+
});
|
|
81
|
+
if (!doResult.ok) {
|
|
82
|
+
return [doResult, { status: "request-error", request: req }];
|
|
83
|
+
}
|
|
84
|
+
const response = doResult.value;
|
|
85
|
+
const responseFields = {
|
|
86
|
+
HttpMeta: { Response: response, Request: req },
|
|
87
|
+
};
|
|
88
|
+
const [result] = await M.match(M.json(200, models.Import$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 });
|
|
89
|
+
if (!result.ok) {
|
|
90
|
+
return [result, { status: "complete", request: req, response }];
|
|
91
|
+
}
|
|
92
|
+
return [result, { status: "complete", request: req, response }];
|
|
93
|
+
}
|
|
@@ -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 importsList(client: StateMachinesCore, request?: operations.ListImportsRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListImportsResponse, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { encodeFormQuery } 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 importsList(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(z.optional(operations.ListImportsRequest$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 path = pathToFunc("/v1/imports")();
|
|
26
|
+
const query = encodeFormQuery({
|
|
27
|
+
"cursor": payload?.cursor,
|
|
28
|
+
"limit": payload?.limit,
|
|
29
|
+
"status": payload?.status,
|
|
30
|
+
"workspaceId": payload?.workspaceId,
|
|
31
|
+
});
|
|
32
|
+
const headers = new Headers(compactMap({
|
|
33
|
+
Accept: "application/json",
|
|
34
|
+
}));
|
|
35
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
36
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
37
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
38
|
+
const context = {
|
|
39
|
+
options: client._options,
|
|
40
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
41
|
+
operationID: "listImports",
|
|
42
|
+
oAuth2Scopes: null,
|
|
43
|
+
resolvedSecurity: requestSecurity,
|
|
44
|
+
securitySource: client._options.apiKey,
|
|
45
|
+
retryConfig: options?.retries
|
|
46
|
+
|| client._options.retryConfig
|
|
47
|
+
|| {
|
|
48
|
+
strategy: "backoff",
|
|
49
|
+
backoff: {
|
|
50
|
+
initialInterval: 1000,
|
|
51
|
+
maxInterval: 5000,
|
|
52
|
+
exponent: 1.5,
|
|
53
|
+
maxElapsedTime: 600000,
|
|
54
|
+
},
|
|
55
|
+
retryConnectionErrors: true,
|
|
56
|
+
}
|
|
57
|
+
|| { strategy: "none" },
|
|
58
|
+
retryCodes: options?.retryCodes || ["502", "503", "504"],
|
|
59
|
+
};
|
|
60
|
+
const requestRes = client._createRequest(context, {
|
|
61
|
+
security: requestSecurity,
|
|
62
|
+
method: "GET",
|
|
63
|
+
baseURL: options?.serverURL,
|
|
64
|
+
path: path,
|
|
65
|
+
headers: headers,
|
|
66
|
+
query: query,
|
|
67
|
+
body: body,
|
|
68
|
+
userAgent: client._options.userAgent,
|
|
69
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
70
|
+
}, options);
|
|
71
|
+
if (!requestRes.ok) {
|
|
72
|
+
return [requestRes, { status: "invalid" }];
|
|
73
|
+
}
|
|
74
|
+
const req = requestRes.value;
|
|
75
|
+
const doResult = await client._do(req, {
|
|
76
|
+
context,
|
|
77
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
78
|
+
retryConfig: context.retryConfig,
|
|
79
|
+
retryCodes: context.retryCodes,
|
|
80
|
+
});
|
|
81
|
+
if (!doResult.ok) {
|
|
82
|
+
return [doResult, { status: "request-error", request: req }];
|
|
83
|
+
}
|
|
84
|
+
const response = doResult.value;
|
|
85
|
+
const responseFields = {
|
|
86
|
+
HttpMeta: { Response: response, Request: req },
|
|
87
|
+
};
|
|
88
|
+
const [result] = await M.match(M.json(200, operations.ListImportsResponse$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 });
|
|
89
|
+
if (!result.ok) {
|
|
90
|
+
return [result, { status: "complete", request: req, response }];
|
|
91
|
+
}
|
|
92
|
+
return [result, { status: "complete", request: req, response }];
|
|
93
|
+
}
|
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.11.0";
|
|
35
35
|
readonly genVersion: "2.941.0";
|
|
36
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.
|
|
36
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.11.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.11.0",
|
|
28
28
|
genVersion: "2.941.0",
|
|
29
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
29
|
+
userAgent: "speakeasy-sdk/typescript 0.11.0 2.941.0 1.0.0 @usestatemachines/sdk",
|
|
30
30
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as z from "zod/v4-mini";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminated-union.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdk-validation-error.js";
|
|
5
|
+
export type AbsentReasonReference = {
|
|
6
|
+
nativeId: string;
|
|
7
|
+
object: string;
|
|
8
|
+
pointer: string;
|
|
9
|
+
type: "reference";
|
|
10
|
+
};
|
|
11
|
+
export type AbsentReasonProblem = {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
pointer: string | null;
|
|
15
|
+
type: "problem";
|
|
16
|
+
};
|
|
17
|
+
export type AbsentReasonIdentity = {
|
|
18
|
+
message: string;
|
|
19
|
+
type: "identity";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Why the record did not load.
|
|
23
|
+
*/
|
|
24
|
+
export type AbsentReason = AbsentReasonIdentity | AbsentReasonProblem | AbsentReasonReference | discriminatedUnionTypes.Unknown<"type">;
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const AbsentReasonReference$inboundSchema: z.ZodMiniType<AbsentReasonReference, unknown>;
|
|
27
|
+
export declare function absentReasonReferenceFromJSON(jsonString: string): SafeParseResult<AbsentReasonReference, SDKValidationError>;
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const AbsentReasonProblem$inboundSchema: z.ZodMiniType<AbsentReasonProblem, unknown>;
|
|
30
|
+
export declare function absentReasonProblemFromJSON(jsonString: string): SafeParseResult<AbsentReasonProblem, SDKValidationError>;
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const AbsentReasonIdentity$inboundSchema: z.ZodMiniType<AbsentReasonIdentity, unknown>;
|
|
33
|
+
export declare function absentReasonIdentityFromJSON(jsonString: string): SafeParseResult<AbsentReasonIdentity, SDKValidationError>;
|
|
34
|
+
/** @internal */
|
|
35
|
+
export declare const AbsentReason$inboundSchema: z.ZodMiniType<AbsentReason, unknown>;
|
|
36
|
+
export declare function absentReasonFromJSON(jsonString: string): SafeParseResult<AbsentReason, SDKValidationError>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4-mini";
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
import { discriminatedUnion } from "../types/discriminated-union.js";
|
|
7
|
+
import * as types from "../types/primitives.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const AbsentReasonReference$inboundSchema = z.object({
|
|
10
|
+
nativeId: types.string(),
|
|
11
|
+
object: types.string(),
|
|
12
|
+
pointer: types.string(),
|
|
13
|
+
type: types.literal("reference"),
|
|
14
|
+
});
|
|
15
|
+
export function absentReasonReferenceFromJSON(jsonString) {
|
|
16
|
+
return safeParse(jsonString, (x) => AbsentReasonReference$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AbsentReasonReference' from JSON`);
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const AbsentReasonProblem$inboundSchema = z.object({
|
|
20
|
+
code: types.string(),
|
|
21
|
+
message: types.string(),
|
|
22
|
+
pointer: types.nullable(types.string()),
|
|
23
|
+
type: types.literal("problem"),
|
|
24
|
+
});
|
|
25
|
+
export function absentReasonProblemFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => AbsentReasonProblem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AbsentReasonProblem' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const AbsentReasonIdentity$inboundSchema = z.object({
|
|
30
|
+
message: types.string(),
|
|
31
|
+
type: types.literal("identity"),
|
|
32
|
+
});
|
|
33
|
+
export function absentReasonIdentityFromJSON(jsonString) {
|
|
34
|
+
return safeParse(jsonString, (x) => AbsentReasonIdentity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AbsentReasonIdentity' from JSON`);
|
|
35
|
+
}
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const AbsentReason$inboundSchema = discriminatedUnion("type", {
|
|
38
|
+
identity: z.lazy(() => AbsentReasonIdentity$inboundSchema),
|
|
39
|
+
problem: z.lazy(() => AbsentReasonProblem$inboundSchema),
|
|
40
|
+
reference: z.lazy(() => AbsentReasonReference$inboundSchema),
|
|
41
|
+
});
|
|
42
|
+
export function absentReasonFromJSON(jsonString) {
|
|
43
|
+
return safeParse(jsonString, (x) => AbsentReason$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AbsentReason' from JSON`);
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
* The file of the record in the import, such as `salesforce/records/Opportunity.jsonl`, and its line, counted from 1.
|
|
6
|
+
*/
|
|
7
|
+
export type AbsentRecordSource = {
|
|
8
|
+
file: string;
|
|
9
|
+
line: number | null;
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const AbsentRecordSource$inboundSchema: z.ZodMiniType<AbsentRecordSource, unknown>;
|
|
13
|
+
export declare function absentRecordSourceFromJSON(jsonString: string): SafeParseResult<AbsentRecordSource, SDKValidationError>;
|