@usestatemachines/sdk 0.1.1

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.
Files changed (203) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +311 -0
  3. package/agents/SKILL.md +90 -0
  4. package/agents/index.d.ts +13 -0
  5. package/agents/index.js +22 -0
  6. package/agents/llms.txt +93 -0
  7. package/agents/prompt.md +49 -0
  8. package/esm/core.d.ts +9 -0
  9. package/esm/core.js +12 -0
  10. package/esm/extensions/client.d.ts +81 -0
  11. package/esm/extensions/client.js +213 -0
  12. package/esm/extensions/connection.d.ts +42 -0
  13. package/esm/extensions/connection.js +133 -0
  14. package/esm/extensions/errors.d.ts +52 -0
  15. package/esm/extensions/errors.js +129 -0
  16. package/esm/extensions/index.d.ts +11 -0
  17. package/esm/extensions/index.js +7 -0
  18. package/esm/extensions/signal.d.ts +14 -0
  19. package/esm/extensions/signal.js +29 -0
  20. package/esm/extensions/wait.d.ts +19 -0
  21. package/esm/extensions/wait.js +102 -0
  22. package/esm/funcs/catalog-get.d.ts +11 -0
  23. package/esm/funcs/catalog-get.js +76 -0
  24. package/esm/funcs/catalog-release.d.ts +11 -0
  25. package/esm/funcs/catalog-release.js +92 -0
  26. package/esm/funcs/credential-get.d.ts +11 -0
  27. package/esm/funcs/credential-get.js +76 -0
  28. package/esm/funcs/environments-create.d.ts +11 -0
  29. package/esm/funcs/environments-create.js +94 -0
  30. package/esm/funcs/environments-events.d.ts +12 -0
  31. package/esm/funcs/environments-events.js +98 -0
  32. package/esm/funcs/environments-get-connection.d.ts +11 -0
  33. package/esm/funcs/environments-get-connection.js +96 -0
  34. package/esm/funcs/environments-get.d.ts +11 -0
  35. package/esm/funcs/environments-get.js +92 -0
  36. package/esm/funcs/environments-list.d.ts +11 -0
  37. package/esm/funcs/environments-list.js +100 -0
  38. package/esm/funcs/environments-reveal.d.ts +11 -0
  39. package/esm/funcs/environments-reveal.js +97 -0
  40. package/esm/funcs/environments-stop.d.ts +11 -0
  41. package/esm/funcs/environments-stop.js +92 -0
  42. package/esm/funcs/workspaces-events.d.ts +12 -0
  43. package/esm/funcs/workspaces-events.js +98 -0
  44. package/esm/funcs/workspaces-get.d.ts +11 -0
  45. package/esm/funcs/workspaces-get.js +92 -0
  46. package/esm/funcs/workspaces-list.d.ts +11 -0
  47. package/esm/funcs/workspaces-list.js +90 -0
  48. package/esm/hooks/hooks.d.ts +24 -0
  49. package/esm/hooks/hooks.js +79 -0
  50. package/esm/hooks/index.d.ts +2 -0
  51. package/esm/hooks/index.js +5 -0
  52. package/esm/hooks/types.d.ts +76 -0
  53. package/esm/hooks/types.js +4 -0
  54. package/esm/index.d.ts +5 -0
  55. package/esm/index.js +7 -0
  56. package/esm/lib/base64.d.ts +9 -0
  57. package/esm/lib/base64.js +30 -0
  58. package/esm/lib/config.d.ts +37 -0
  59. package/esm/lib/config.js +30 -0
  60. package/esm/lib/encodings.d.ts +54 -0
  61. package/esm/lib/encodings.js +406 -0
  62. package/esm/lib/files.d.ts +25 -0
  63. package/esm/lib/files.js +90 -0
  64. package/esm/lib/http.d.ts +66 -0
  65. package/esm/lib/http.js +208 -0
  66. package/esm/lib/logger.d.ts +5 -0
  67. package/esm/lib/logger.js +4 -0
  68. package/esm/lib/matchers.d.ts +58 -0
  69. package/esm/lib/matchers.js +201 -0
  70. package/esm/lib/primitives.d.ts +26 -0
  71. package/esm/lib/primitives.js +119 -0
  72. package/esm/lib/retries.d.ts +37 -0
  73. package/esm/lib/retries.js +156 -0
  74. package/esm/lib/schemas.d.ts +20 -0
  75. package/esm/lib/schemas.js +56 -0
  76. package/esm/lib/sdks.d.ts +62 -0
  77. package/esm/lib/sdks.js +289 -0
  78. package/esm/lib/security.d.ts +83 -0
  79. package/esm/lib/security.js +145 -0
  80. package/esm/lib/url.d.ts +4 -0
  81. package/esm/lib/url.js +23 -0
  82. package/esm/models/actor.d.ts +12 -0
  83. package/esm/models/actor.js +16 -0
  84. package/esm/models/api-profile.d.ts +17 -0
  85. package/esm/models/api-profile.js +22 -0
  86. package/esm/models/app.d.ts +14 -0
  87. package/esm/models/app.js +18 -0
  88. package/esm/models/catalog.d.ts +12 -0
  89. package/esm/models/catalog.js +15 -0
  90. package/esm/models/connection-secret.d.ts +14 -0
  91. package/esm/models/connection-secret.js +18 -0
  92. package/esm/models/connection.d.ts +26 -0
  93. package/esm/models/connection.js +30 -0
  94. package/esm/models/create-environment-input.d.ts +35 -0
  95. package/esm/models/create-environment-input.js +23 -0
  96. package/esm/models/credential-kind.d.ts +9 -0
  97. package/esm/models/credential-kind.js +10 -0
  98. package/esm/models/credential.d.ts +48 -0
  99. package/esm/models/credential.js +44 -0
  100. package/esm/models/environment-app.d.ts +42 -0
  101. package/esm/models/environment-app.js +44 -0
  102. package/esm/models/environment-lifetime.d.ts +10 -0
  103. package/esm/models/environment-lifetime.js +14 -0
  104. package/esm/models/environment.d.ts +47 -0
  105. package/esm/models/environment.js +48 -0
  106. package/esm/models/error-response.d.ts +45 -0
  107. package/esm/models/error-response.js +47 -0
  108. package/esm/models/errors/error-response.d.ts +18 -0
  109. package/esm/models/errors/error-response.js +32 -0
  110. package/esm/models/errors/http-client-errors.d.ts +43 -0
  111. package/esm/models/errors/http-client-errors.js +55 -0
  112. package/esm/models/errors/index.d.ts +6 -0
  113. package/esm/models/errors/index.js +9 -0
  114. package/esm/models/errors/response-validation-error.d.ts +25 -0
  115. package/esm/models/errors/response-validation-error.js +36 -0
  116. package/esm/models/errors/sdk-validation-error.d.ts +20 -0
  117. package/esm/models/errors/sdk-validation-error.js +51 -0
  118. package/esm/models/errors/state-machines-http-error.d.ts +18 -0
  119. package/esm/models/errors/state-machines-http-error.js +25 -0
  120. package/esm/models/errors/unexpected-response-error.d.ts +9 -0
  121. package/esm/models/errors/unexpected-response-error.js +29 -0
  122. package/esm/models/event-page.d.ts +11 -0
  123. package/esm/models/event-page.js +16 -0
  124. package/esm/models/event.d.ts +20 -0
  125. package/esm/models/event.js +22 -0
  126. package/esm/models/index.d.ts +19 -0
  127. package/esm/models/index.js +22 -0
  128. package/esm/models/operations/create-environments.d.ts +27 -0
  129. package/esm/models/operations/create-environments.js +27 -0
  130. package/esm/models/operations/get-catalog.d.ts +13 -0
  131. package/esm/models/operations/get-catalog.js +13 -0
  132. package/esm/models/operations/get-connection.d.ts +25 -0
  133. package/esm/models/operations/get-connection.js +21 -0
  134. package/esm/models/operations/get-credential.d.ts +13 -0
  135. package/esm/models/operations/get-credential.js +13 -0
  136. package/esm/models/operations/get-environment.d.ts +23 -0
  137. package/esm/models/operations/get-environment.js +20 -0
  138. package/esm/models/operations/get-release.d.ts +23 -0
  139. package/esm/models/operations/get-release.js +20 -0
  140. package/esm/models/operations/get-workspace.d.ts +23 -0
  141. package/esm/models/operations/get-workspace.js +20 -0
  142. package/esm/models/operations/index.d.ts +13 -0
  143. package/esm/models/operations/index.js +16 -0
  144. package/esm/models/operations/list-environment-events.d.ts +15 -0
  145. package/esm/models/operations/list-environment-events.js +13 -0
  146. package/esm/models/operations/list-environments.d.ts +49 -0
  147. package/esm/models/operations/list-environments.js +40 -0
  148. package/esm/models/operations/list-workspace-events.d.ts +15 -0
  149. package/esm/models/operations/list-workspace-events.js +13 -0
  150. package/esm/models/operations/list-workspaces.d.ts +32 -0
  151. package/esm/models/operations/list-workspaces.js +27 -0
  152. package/esm/models/operations/reveal-connection.d.ts +37 -0
  153. package/esm/models/operations/reveal-connection.js +29 -0
  154. package/esm/models/operations/stop-environment.d.ts +23 -0
  155. package/esm/models/operations/stop-environment.js +20 -0
  156. package/esm/models/release-actor.d.ts +11 -0
  157. package/esm/models/release-actor.js +15 -0
  158. package/esm/models/release.d.ts +26 -0
  159. package/esm/models/release.js +29 -0
  160. package/esm/models/security.d.ts +11 -0
  161. package/esm/models/security.js +11 -0
  162. package/esm/models/workspace.d.ts +16 -0
  163. package/esm/models/workspace.js +21 -0
  164. package/esm/sdk/catalog.d.ts +6 -0
  165. package/esm/sdk/catalog.js +15 -0
  166. package/esm/sdk/credential.d.ts +5 -0
  167. package/esm/sdk/credential.js +11 -0
  168. package/esm/sdk/environments.d.ts +12 -0
  169. package/esm/sdk/environments.js +35 -0
  170. package/esm/sdk/index.d.ts +1 -0
  171. package/esm/sdk/index.js +4 -0
  172. package/esm/sdk/sdk.d.ts +15 -0
  173. package/esm/sdk/sdk.js +26 -0
  174. package/esm/sdk/workspaces.d.ts +8 -0
  175. package/esm/sdk/workspaces.js +19 -0
  176. package/esm/types/async.d.ts +22 -0
  177. package/esm/types/async.js +27 -0
  178. package/esm/types/blobs.d.ts +3 -0
  179. package/esm/types/blobs.js +24 -0
  180. package/esm/types/const-date-time.d.ts +2 -0
  181. package/esm/types/const-date-time.js +9 -0
  182. package/esm/types/default-to-zero-value.d.ts +11 -0
  183. package/esm/types/default-to-zero-value.js +30 -0
  184. package/esm/types/enums.d.ts +8 -0
  185. package/esm/types/enums.js +26 -0
  186. package/esm/types/fp.d.ts +30 -0
  187. package/esm/types/fp.js +30 -0
  188. package/esm/types/index.d.ts +9 -0
  189. package/esm/types/index.js +9 -0
  190. package/esm/types/operations.d.ts +26 -0
  191. package/esm/types/operations.js +76 -0
  192. package/esm/types/primitives.d.ts +8 -0
  193. package/esm/types/primitives.js +108 -0
  194. package/esm/types/rfcdate.d.ts +20 -0
  195. package/esm/types/rfcdate.js +42 -0
  196. package/esm/types/smart-union.d.ts +6 -0
  197. package/esm/types/smart-union.js +116 -0
  198. package/esm/types/streams.d.ts +1 -0
  199. package/esm/types/streams.js +14 -0
  200. package/esm/types/unrecognized.d.ts +15 -0
  201. package/esm/types/unrecognized.js +30 -0
  202. package/openapi.json +2853 -0
  203. package/package.json +50 -0
@@ -0,0 +1,42 @@
1
+ import * as z from "zod/v4-mini";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
5
+ export declare const Disposal: {
6
+ readonly Pending: "pending";
7
+ readonly Complete: "complete";
8
+ readonly Failed: "failed";
9
+ readonly Unknown: "unknown";
10
+ };
11
+ export type Disposal = OpenEnum<typeof Disposal>;
12
+ export declare const EnvironmentAppStatus: {
13
+ readonly Pending: "pending";
14
+ readonly Starting: "starting";
15
+ readonly Ready: "ready";
16
+ readonly Stopping: "stopping";
17
+ readonly Stopped: "stopped";
18
+ readonly Failed: "failed";
19
+ };
20
+ export type EnvironmentAppStatus = OpenEnum<typeof EnvironmentAppStatus>;
21
+ export type EnvironmentApp = {
22
+ allocatedAt: Date | null;
23
+ appId: string;
24
+ appReleaseId: string;
25
+ disposal: Disposal;
26
+ errorCode: string | null;
27
+ expiresAt: Date | null;
28
+ id: string;
29
+ key: string;
30
+ provider: string;
31
+ readyAt: Date | null;
32
+ region: string | null;
33
+ status: EnvironmentAppStatus;
34
+ stoppedAt: Date | null;
35
+ };
36
+ /** @internal */
37
+ export declare const Disposal$inboundSchema: z.ZodMiniType<Disposal, unknown>;
38
+ /** @internal */
39
+ export declare const EnvironmentAppStatus$inboundSchema: z.ZodMiniType<EnvironmentAppStatus, unknown>;
40
+ /** @internal */
41
+ export declare const EnvironmentApp$inboundSchema: z.ZodMiniType<EnvironmentApp, unknown>;
42
+ export declare function environmentAppFromJSON(jsonString: string): SafeParseResult<EnvironmentApp, 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 * as openEnums from "../types/enums.js";
7
+ import * as types from "../types/primitives.js";
8
+ export const Disposal = {
9
+ Pending: "pending",
10
+ Complete: "complete",
11
+ Failed: "failed",
12
+ Unknown: "unknown",
13
+ };
14
+ export const EnvironmentAppStatus = {
15
+ Pending: "pending",
16
+ Starting: "starting",
17
+ Ready: "ready",
18
+ Stopping: "stopping",
19
+ Stopped: "stopped",
20
+ Failed: "failed",
21
+ };
22
+ /** @internal */
23
+ export const Disposal$inboundSchema = openEnums.inboundSchema(Disposal);
24
+ /** @internal */
25
+ export const EnvironmentAppStatus$inboundSchema = openEnums.inboundSchema(EnvironmentAppStatus);
26
+ /** @internal */
27
+ export const EnvironmentApp$inboundSchema = z.object({
28
+ allocatedAt: types.nullable(types.date()),
29
+ appId: types.string(),
30
+ appReleaseId: types.string(),
31
+ disposal: Disposal$inboundSchema,
32
+ errorCode: types.nullable(types.string()),
33
+ expiresAt: types.nullable(types.date()),
34
+ id: types.string(),
35
+ key: types.string(),
36
+ provider: types.string(),
37
+ readyAt: types.nullable(types.date()),
38
+ region: types.nullable(types.string()),
39
+ status: EnvironmentAppStatus$inboundSchema,
40
+ stoppedAt: types.nullable(types.date()),
41
+ });
42
+ export function environmentAppFromJSON(jsonString) {
43
+ return safeParse(jsonString, (x) => EnvironmentApp$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EnvironmentApp' from JSON`);
44
+ }
@@ -0,0 +1,10 @@
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
+ export type EnvironmentLifetime = {
5
+ defaultMinutes: number;
6
+ maximumMinutes: number;
7
+ };
8
+ /** @internal */
9
+ export declare const EnvironmentLifetime$inboundSchema: z.ZodMiniType<EnvironmentLifetime, unknown>;
10
+ export declare function environmentLifetimeFromJSON(jsonString: string): SafeParseResult<EnvironmentLifetime, SDKValidationError>;
@@ -0,0 +1,14 @@
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 * as types from "../types/primitives.js";
7
+ /** @internal */
8
+ export const EnvironmentLifetime$inboundSchema = z.object({
9
+ defaultMinutes: types.number(),
10
+ maximumMinutes: types.number(),
11
+ });
12
+ export function environmentLifetimeFromJSON(jsonString) {
13
+ return safeParse(jsonString, (x) => EnvironmentLifetime$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EnvironmentLifetime' from JSON`);
14
+ }
@@ -0,0 +1,47 @@
1
+ import * as z from "zod/v4-mini";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { Actor } from "./actor.js";
5
+ import { EnvironmentApp } from "./environment-app.js";
6
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
7
+ export declare const EnvironmentStatus: {
8
+ readonly Queued: "queued";
9
+ readonly Starting: "starting";
10
+ readonly Running: "running";
11
+ readonly Stopping: "stopping";
12
+ readonly Stopped: "stopped";
13
+ readonly Failed: "failed";
14
+ };
15
+ export type EnvironmentStatus = OpenEnum<typeof EnvironmentStatus>;
16
+ export declare const StopReason: {
17
+ readonly Requested: "requested";
18
+ readonly Expired: "expired";
19
+ readonly AppFailed: "app_failed";
20
+ readonly OwnerLost: "owner_lost";
21
+ };
22
+ export type StopReason = OpenEnum<typeof StopReason>;
23
+ export type Environment = {
24
+ apps: Array<EnvironmentApp>;
25
+ createdAt: Date;
26
+ createdBy: Actor | null;
27
+ expiresAt: Date | null;
28
+ id: string;
29
+ labels: {
30
+ [k: string]: string;
31
+ };
32
+ lifetimeMinutes: number;
33
+ name: string | null;
34
+ startedAt: Date | null;
35
+ status: EnvironmentStatus;
36
+ stopReason: StopReason | null;
37
+ stoppedAt: Date | null;
38
+ version: number;
39
+ workspaceId: string;
40
+ };
41
+ /** @internal */
42
+ export declare const EnvironmentStatus$inboundSchema: z.ZodMiniType<EnvironmentStatus, unknown>;
43
+ /** @internal */
44
+ export declare const StopReason$inboundSchema: z.ZodMiniType<StopReason, unknown>;
45
+ /** @internal */
46
+ export declare const Environment$inboundSchema: z.ZodMiniType<Environment, unknown>;
47
+ export declare function environmentFromJSON(jsonString: string): SafeParseResult<Environment, SDKValidationError>;
@@ -0,0 +1,48 @@
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 * as openEnums from "../types/enums.js";
7
+ import * as types from "../types/primitives.js";
8
+ import { Actor$inboundSchema } from "./actor.js";
9
+ import { EnvironmentApp$inboundSchema, } from "./environment-app.js";
10
+ export const EnvironmentStatus = {
11
+ Queued: "queued",
12
+ Starting: "starting",
13
+ Running: "running",
14
+ Stopping: "stopping",
15
+ Stopped: "stopped",
16
+ Failed: "failed",
17
+ };
18
+ export const StopReason = {
19
+ Requested: "requested",
20
+ Expired: "expired",
21
+ AppFailed: "app_failed",
22
+ OwnerLost: "owner_lost",
23
+ };
24
+ /** @internal */
25
+ export const EnvironmentStatus$inboundSchema = openEnums.inboundSchema(EnvironmentStatus);
26
+ /** @internal */
27
+ export const StopReason$inboundSchema = openEnums.inboundSchema(StopReason);
28
+ /** @internal */
29
+ export const Environment$inboundSchema = z
30
+ .object({
31
+ apps: z.array(EnvironmentApp$inboundSchema),
32
+ createdAt: types.date(),
33
+ createdBy: types.nullable(Actor$inboundSchema),
34
+ expiresAt: types.nullable(types.date()),
35
+ id: types.string(),
36
+ labels: z.record(z.string(), types.string()),
37
+ lifetimeMinutes: types.number(),
38
+ name: types.nullable(types.string()),
39
+ startedAt: types.nullable(types.date()),
40
+ status: EnvironmentStatus$inboundSchema,
41
+ stopReason: types.nullable(StopReason$inboundSchema),
42
+ stoppedAt: types.nullable(types.date()),
43
+ version: types.number(),
44
+ workspaceId: types.string(),
45
+ });
46
+ export function environmentFromJSON(jsonString) {
47
+ return safeParse(jsonString, (x) => Environment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Environment' from JSON`);
48
+ }
@@ -0,0 +1,45 @@
1
+ import * as z from "zod/v4-mini";
2
+ import { OpenEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
5
+ export declare const Code: {
6
+ readonly BodyTooLarge: "body-too-large";
7
+ readonly ConnectionUnavailable: "connection-unavailable";
8
+ readonly EnvironmentLimit: "environment-limit";
9
+ readonly Forbidden: "forbidden";
10
+ readonly IdempotencyConflict: "idempotency-conflict";
11
+ readonly IdentityRequestRejected: "identity-request-rejected";
12
+ readonly InternalError: "internal-error";
13
+ readonly InvalidCursor: "invalid-cursor";
14
+ readonly InvalidRequest: "invalid-request";
15
+ readonly InvalidResponse: "invalid-response";
16
+ readonly InvalidWebhook: "invalid-webhook";
17
+ readonly LastOwner: "last-owner";
18
+ readonly LastWorkspace: "last-workspace";
19
+ readonly LifetimeTooLong: "lifetime-too-long";
20
+ readonly NotFound: "not-found";
21
+ readonly NotReady: "not-ready";
22
+ readonly OrganizationRequired: "organization-required";
23
+ readonly ReleaseUnavailable: "release-unavailable";
24
+ readonly RequestCapacityReached: "request-capacity-reached";
25
+ readonly RequestTimeout: "request-timeout";
26
+ readonly ServiceUnavailable: "service-unavailable";
27
+ readonly Unauthorized: "unauthorized";
28
+ readonly VersionConflict: "version-conflict";
29
+ readonly WorkspaceArchived: "workspace-archived";
30
+ readonly WorkspaceNameTaken: "workspace-name-taken";
31
+ };
32
+ export type Code = OpenEnum<typeof Code>;
33
+ export type ErrorT = {
34
+ code: Code;
35
+ fields?: {
36
+ [k: string]: Array<string>;
37
+ } | undefined;
38
+ message: string;
39
+ requestId: string;
40
+ };
41
+ /** @internal */
42
+ export declare const Code$inboundSchema: z.ZodMiniType<Code, unknown>;
43
+ /** @internal */
44
+ export declare const ErrorT$inboundSchema: z.ZodMiniType<ErrorT, unknown>;
45
+ export declare function errorFromJSON(jsonString: string): SafeParseResult<ErrorT, SDKValidationError>;
@@ -0,0 +1,47 @@
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 * as openEnums from "../types/enums.js";
7
+ import * as types from "../types/primitives.js";
8
+ export const Code = {
9
+ BodyTooLarge: "body-too-large",
10
+ ConnectionUnavailable: "connection-unavailable",
11
+ EnvironmentLimit: "environment-limit",
12
+ Forbidden: "forbidden",
13
+ IdempotencyConflict: "idempotency-conflict",
14
+ IdentityRequestRejected: "identity-request-rejected",
15
+ InternalError: "internal-error",
16
+ InvalidCursor: "invalid-cursor",
17
+ InvalidRequest: "invalid-request",
18
+ InvalidResponse: "invalid-response",
19
+ InvalidWebhook: "invalid-webhook",
20
+ LastOwner: "last-owner",
21
+ LastWorkspace: "last-workspace",
22
+ LifetimeTooLong: "lifetime-too-long",
23
+ NotFound: "not-found",
24
+ NotReady: "not-ready",
25
+ OrganizationRequired: "organization-required",
26
+ ReleaseUnavailable: "release-unavailable",
27
+ RequestCapacityReached: "request-capacity-reached",
28
+ RequestTimeout: "request-timeout",
29
+ ServiceUnavailable: "service-unavailable",
30
+ Unauthorized: "unauthorized",
31
+ VersionConflict: "version-conflict",
32
+ WorkspaceArchived: "workspace-archived",
33
+ WorkspaceNameTaken: "workspace-name-taken",
34
+ };
35
+ /** @internal */
36
+ export const Code$inboundSchema = openEnums
37
+ .inboundSchema(Code);
38
+ /** @internal */
39
+ export const ErrorT$inboundSchema = z.object({
40
+ code: Code$inboundSchema,
41
+ fields: types.optional(z.record(z.string(), z.array(types.string()))),
42
+ message: types.string(),
43
+ requestId: types.string(),
44
+ });
45
+ export function errorFromJSON(jsonString) {
46
+ return safeParse(jsonString, (x) => ErrorT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ErrorT' from JSON`);
47
+ }
@@ -0,0 +1,18 @@
1
+ import * as z from "zod/v4-mini";
2
+ import * as models from "../index.js";
3
+ import { StateMachinesHTTPError } from "./state-machines-http-error.js";
4
+ export type ErrorResponseData = {
5
+ error: models.ErrorT;
6
+ };
7
+ export declare class ErrorResponse extends StateMachinesHTTPError {
8
+ error: models.ErrorT;
9
+ /** The original data that was passed to this error instance. */
10
+ data$: ErrorResponseData;
11
+ constructor(err: ErrorResponseData, httpMeta: {
12
+ response: Response;
13
+ request: Request;
14
+ body: string;
15
+ });
16
+ }
17
+ /** @internal */
18
+ export declare const ErrorResponse$inboundSchema: z.ZodMiniType<ErrorResponse, unknown>;
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4-mini";
5
+ import * as models from "../index.js";
6
+ import { StateMachinesHTTPError } from "./state-machines-http-error.js";
7
+ export class ErrorResponse extends StateMachinesHTTPError {
8
+ error;
9
+ /** The original data that was passed to this error instance. */
10
+ data$;
11
+ constructor(err, httpMeta) {
12
+ const message = err.error?.message
13
+ || `API error occurred: ${JSON.stringify(err)}`;
14
+ super(message, httpMeta);
15
+ this.data$ = err;
16
+ this.error = err.error;
17
+ this.name = "ErrorResponse";
18
+ }
19
+ }
20
+ /** @internal */
21
+ export const ErrorResponse$inboundSchema = z.pipe(z.object({
22
+ error: z.lazy(() => models.ErrorT$inboundSchema),
23
+ request$: z.custom(x => x instanceof Request),
24
+ response$: z.custom(x => x instanceof Response),
25
+ body$: z.string(),
26
+ }), z.transform((v) => {
27
+ return new ErrorResponse(v, {
28
+ request: v.request$,
29
+ response: v.response$,
30
+ body: v.body$,
31
+ });
32
+ }));
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Base class for all HTTP errors.
3
+ */
4
+ export declare class HTTPClientError extends Error {
5
+ /** The underlying cause of the error. */
6
+ readonly cause: unknown;
7
+ name: string;
8
+ constructor(message: string, opts?: {
9
+ cause?: unknown;
10
+ });
11
+ }
12
+ /**
13
+ * An error to capture unrecognised or unexpected errors when making HTTP calls.
14
+ */
15
+ export declare class UnexpectedClientError extends HTTPClientError {
16
+ name: string;
17
+ }
18
+ /**
19
+ * An error that is raised when any inputs used to create a request are invalid.
20
+ */
21
+ export declare class InvalidRequestError extends HTTPClientError {
22
+ name: string;
23
+ }
24
+ /**
25
+ * An error that is raised when a HTTP request was aborted by the client error.
26
+ */
27
+ export declare class RequestAbortedError extends HTTPClientError {
28
+ readonly name = "RequestAbortedError";
29
+ }
30
+ /**
31
+ * An error that is raised when a HTTP request timed out due to an AbortSignal
32
+ * signal timeout.
33
+ */
34
+ export declare class RequestTimeoutError extends HTTPClientError {
35
+ readonly name = "RequestTimeoutError";
36
+ }
37
+ /**
38
+ * An error that is raised when a HTTP client is unable to make a request to
39
+ * a server.
40
+ */
41
+ export declare class ConnectionError extends HTTPClientError {
42
+ readonly name = "ConnectionError";
43
+ }
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ /**
5
+ * Base class for all HTTP errors.
6
+ */
7
+ export class HTTPClientError extends Error {
8
+ /** The underlying cause of the error. */
9
+ cause;
10
+ name = "HTTPClientError";
11
+ constructor(message, opts) {
12
+ let msg = message;
13
+ if (opts?.cause) {
14
+ msg += `: ${opts.cause}`;
15
+ }
16
+ super(msg, opts);
17
+ // In older runtimes, the cause field would not have been assigned through
18
+ // the super() call.
19
+ if (typeof this.cause === "undefined") {
20
+ this.cause = opts?.cause;
21
+ }
22
+ }
23
+ }
24
+ /**
25
+ * An error to capture unrecognised or unexpected errors when making HTTP calls.
26
+ */
27
+ export class UnexpectedClientError extends HTTPClientError {
28
+ name = "UnexpectedClientError";
29
+ }
30
+ /**
31
+ * An error that is raised when any inputs used to create a request are invalid.
32
+ */
33
+ export class InvalidRequestError extends HTTPClientError {
34
+ name = "InvalidRequestError";
35
+ }
36
+ /**
37
+ * An error that is raised when a HTTP request was aborted by the client error.
38
+ */
39
+ export class RequestAbortedError extends HTTPClientError {
40
+ name = "RequestAbortedError";
41
+ }
42
+ /**
43
+ * An error that is raised when a HTTP request timed out due to an AbortSignal
44
+ * signal timeout.
45
+ */
46
+ export class RequestTimeoutError extends HTTPClientError {
47
+ name = "RequestTimeoutError";
48
+ }
49
+ /**
50
+ * An error that is raised when a HTTP client is unable to make a request to
51
+ * a server.
52
+ */
53
+ export class ConnectionError extends HTTPClientError {
54
+ name = "ConnectionError";
55
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./error-response.js";
2
+ export * from "./http-client-errors.js";
3
+ export * from "./response-validation-error.js";
4
+ export * from "./sdk-validation-error.js";
5
+ export * from "./state-machines-http-error.js";
6
+ export * from "./unexpected-response-error.js";
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ export * from "./error-response.js";
5
+ export * from "./http-client-errors.js";
6
+ export * from "./response-validation-error.js";
7
+ export * from "./sdk-validation-error.js";
8
+ export * from "./state-machines-http-error.js";
9
+ export * from "./unexpected-response-error.js";
@@ -0,0 +1,25 @@
1
+ import { StateMachinesHTTPError } from "./state-machines-http-error.js";
2
+ export declare class ResponseValidationError extends StateMachinesHTTPError {
3
+ /**
4
+ * The raw value that failed validation.
5
+ */
6
+ readonly rawValue: unknown;
7
+ /**
8
+ * The raw message that failed validation.
9
+ */
10
+ readonly rawMessage: unknown;
11
+ constructor(message: string, extra: {
12
+ response: Response;
13
+ request: Request;
14
+ body: string;
15
+ cause: unknown;
16
+ rawValue: unknown;
17
+ rawMessage: unknown;
18
+ });
19
+ /**
20
+ * Return a pretty-formatted error message if the underlying validation error
21
+ * is a ZodError or some other recognized error type, otherwise return the
22
+ * default error message.
23
+ */
24
+ pretty(): string;
25
+ }
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4/core";
5
+ import { formatZodError } from "./sdk-validation-error.js";
6
+ import { StateMachinesHTTPError } from "./state-machines-http-error.js";
7
+ export class ResponseValidationError extends StateMachinesHTTPError {
8
+ /**
9
+ * The raw value that failed validation.
10
+ */
11
+ rawValue;
12
+ /**
13
+ * The raw message that failed validation.
14
+ */
15
+ rawMessage;
16
+ constructor(message, extra) {
17
+ super(message, extra);
18
+ this.name = "ResponseValidationError";
19
+ this.cause = extra.cause;
20
+ this.rawValue = extra.rawValue;
21
+ this.rawMessage = extra.rawMessage;
22
+ }
23
+ /**
24
+ * Return a pretty-formatted error message if the underlying validation error
25
+ * is a ZodError or some other recognized error type, otherwise return the
26
+ * default error message.
27
+ */
28
+ pretty() {
29
+ if (this.cause instanceof z.$ZodError) {
30
+ return `${this.rawMessage}\n${formatZodError(this.cause)}`;
31
+ }
32
+ else {
33
+ return this.toString();
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,20 @@
1
+ import * as z from "zod/v4/core";
2
+ export declare class SDKValidationError extends Error {
3
+ /**
4
+ * The raw value that failed validation.
5
+ */
6
+ readonly rawValue: unknown;
7
+ /**
8
+ * The raw message that failed validation.
9
+ */
10
+ readonly rawMessage: unknown;
11
+ static [Symbol.hasInstance](instance: unknown): instance is SDKValidationError;
12
+ constructor(message: string, cause: unknown, rawValue: unknown);
13
+ /**
14
+ * Return a pretty-formatted error message if the underlying validation error
15
+ * is a ZodError or some other recognized error type, otherwise return the
16
+ * default error message.
17
+ */
18
+ pretty(): string;
19
+ }
20
+ export declare function formatZodError(err: z.$ZodError): string;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4/core";
5
+ export class SDKValidationError extends Error {
6
+ /**
7
+ * The raw value that failed validation.
8
+ */
9
+ rawValue;
10
+ /**
11
+ * The raw message that failed validation.
12
+ */
13
+ rawMessage;
14
+ // Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError`
15
+ static [Symbol.hasInstance](instance) {
16
+ if (!(instance instanceof Error))
17
+ return false;
18
+ if (!("rawValue" in instance))
19
+ return false;
20
+ if (!("rawMessage" in instance))
21
+ return false;
22
+ if (!("pretty" in instance))
23
+ return false;
24
+ if (typeof instance.pretty !== "function")
25
+ return false;
26
+ return true;
27
+ }
28
+ constructor(message, cause, rawValue) {
29
+ super(`${message}: ${cause}`);
30
+ this.name = "SDKValidationError";
31
+ this.cause = cause;
32
+ this.rawValue = rawValue;
33
+ this.rawMessage = message;
34
+ }
35
+ /**
36
+ * Return a pretty-formatted error message if the underlying validation error
37
+ * is a ZodError or some other recognized error type, otherwise return the
38
+ * default error message.
39
+ */
40
+ pretty() {
41
+ if (this.cause instanceof z.$ZodError) {
42
+ return `${this.rawMessage}\n${formatZodError(this.cause)}`;
43
+ }
44
+ else {
45
+ return this.toString();
46
+ }
47
+ }
48
+ }
49
+ export function formatZodError(err) {
50
+ return z.prettifyError(err);
51
+ }
@@ -0,0 +1,18 @@
1
+ /** The base class for all HTTP error responses */
2
+ export declare class StateMachinesHTTPError extends Error {
3
+ /** HTTP status code */
4
+ readonly statusCode: number;
5
+ /** HTTP body */
6
+ readonly body: string;
7
+ /** HTTP headers */
8
+ readonly headers: Headers;
9
+ /** HTTP content type */
10
+ readonly contentType: string;
11
+ /** Raw response */
12
+ readonly rawResponse: Response;
13
+ constructor(message: string, httpMeta: {
14
+ response: Response;
15
+ request: Request;
16
+ body: string;
17
+ });
18
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ /** The base class for all HTTP error responses */
5
+ export class StateMachinesHTTPError extends Error {
6
+ /** HTTP status code */
7
+ statusCode;
8
+ /** HTTP body */
9
+ body;
10
+ /** HTTP headers */
11
+ headers;
12
+ /** HTTP content type */
13
+ contentType;
14
+ /** Raw response */
15
+ rawResponse;
16
+ constructor(message, httpMeta) {
17
+ super(message);
18
+ this.statusCode = httpMeta.response.status;
19
+ this.body = httpMeta.body;
20
+ this.headers = httpMeta.response.headers;
21
+ this.contentType = httpMeta.response.headers.get("content-type") || "";
22
+ this.rawResponse = httpMeta.response;
23
+ this.name = "StateMachinesHTTPError";
24
+ }
25
+ }
@@ -0,0 +1,9 @@
1
+ import { StateMachinesHTTPError } from "./state-machines-http-error.js";
2
+ /** The fallback error class if no more specific error class is matched */
3
+ export declare class UnexpectedResponseError extends StateMachinesHTTPError {
4
+ constructor(message: string, httpMeta: {
5
+ response: Response;
6
+ request: Request;
7
+ body: string;
8
+ });
9
+ }