@usestatemachines/sdk 0.4.0 → 0.6.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.
Files changed (270) hide show
  1. package/README.md +177 -470
  2. package/agents/SKILL.md +38 -47
  3. package/agents/index.js +7 -7
  4. package/agents/llms.txt +49 -45
  5. package/agents/prompt.md +11 -11
  6. package/esm/extensions/client.d.ts +105 -116
  7. package/esm/extensions/client.js +162 -309
  8. package/esm/extensions/credentials.d.ts +13 -0
  9. package/esm/extensions/credentials.js +73 -0
  10. package/esm/extensions/environment.d.ts +25 -0
  11. package/esm/extensions/environment.js +1 -0
  12. package/esm/extensions/errors.d.ts +42 -75
  13. package/esm/extensions/errors.js +125 -110
  14. package/esm/extensions/index.d.ts +6 -11
  15. package/esm/extensions/index.js +2 -7
  16. package/esm/extensions/wait.d.ts +17 -18
  17. package/esm/extensions/wait.js +60 -56
  18. package/esm/extensions/yaml.d.ts +6 -0
  19. package/esm/extensions/yaml.js +137 -0
  20. package/esm/funcs/{catalog-release.d.ts → apps-list.d.ts} +1 -1
  21. package/esm/funcs/apps-list.js +91 -0
  22. package/esm/funcs/{credential-get.d.ts → apps-versions.d.ts} +1 -1
  23. package/esm/funcs/{workspaces-events.js → apps-versions.js} +6 -7
  24. package/esm/funcs/{environments-get-connection.d.ts → audit-events-list.d.ts} +1 -1
  25. package/esm/funcs/audit-events-list.js +93 -0
  26. package/esm/funcs/{workspaces-events.d.ts → environments-connect.d.ts} +1 -1
  27. package/esm/funcs/{environments-reveal.js → environments-connect.js} +7 -6
  28. package/esm/funcs/environments-create.d.ts +2 -1
  29. package/esm/funcs/environments-create.js +5 -10
  30. package/esm/funcs/{environments-events.d.ts → environments-delete.d.ts} +1 -1
  31. package/esm/funcs/{environments-stop.js → environments-delete.js} +8 -6
  32. package/esm/funcs/environments-get.d.ts +2 -1
  33. package/esm/funcs/environments-get.js +2 -1
  34. package/esm/funcs/environments-list.d.ts +1 -1
  35. package/esm/funcs/environments-list.js +11 -16
  36. package/esm/funcs/environments-pause.d.ts +12 -0
  37. package/esm/funcs/{environments-suspend.js → environments-pause.js} +7 -5
  38. package/esm/funcs/environments-resume.d.ts +2 -1
  39. package/esm/funcs/environments-resume.js +3 -1
  40. package/esm/funcs/environments-update.d.ts +12 -0
  41. package/esm/funcs/{get-environment-position.js → environments-update.js} +10 -8
  42. package/esm/funcs/me.d.ts +11 -0
  43. package/esm/funcs/{catalog-get.js → me.js} +5 -5
  44. package/esm/funcs/{catalog-get.d.ts → requests-body.d.ts} +1 -1
  45. package/esm/funcs/{environments-get-connection.js → requests-body.js} +8 -8
  46. package/esm/funcs/requests-get.d.ts +12 -0
  47. package/esm/funcs/{catalog-release.js → requests-get.js} +7 -6
  48. package/esm/funcs/{environments-stop.d.ts → requests-list.d.ts} +1 -1
  49. package/esm/funcs/{list-environment-history.js → requests-list.js} +15 -12
  50. package/esm/funcs/requests-stats.d.ts +12 -0
  51. package/esm/funcs/{environments-events.js → requests-stats.js} +15 -14
  52. package/esm/funcs/snapshots-create.d.ts +12 -0
  53. package/esm/funcs/{snapshots-capture.js → snapshots-create.js} +6 -11
  54. package/esm/funcs/snapshots-delete.d.ts +2 -1
  55. package/esm/funcs/snapshots-delete.js +2 -1
  56. package/esm/funcs/snapshots-get.d.ts +2 -1
  57. package/esm/funcs/snapshots-get.js +2 -1
  58. package/esm/funcs/snapshots-list.d.ts +1 -1
  59. package/esm/funcs/snapshots-list.js +9 -13
  60. package/esm/funcs/snapshots-update.d.ts +2 -1
  61. package/esm/funcs/snapshots-update.js +2 -1
  62. package/esm/funcs/workspaces-get.d.ts +2 -1
  63. package/esm/funcs/workspaces-get.js +2 -1
  64. package/esm/funcs/workspaces-list.d.ts +1 -1
  65. package/esm/funcs/workspaces-list.js +3 -1
  66. package/esm/lib/config.d.ts +3 -3
  67. package/esm/lib/config.js +3 -3
  68. package/esm/models/actor.d.ts +2 -3
  69. package/esm/models/actor.js +2 -3
  70. package/esm/models/{api-profile.d.ts → api.d.ts} +4 -4
  71. package/esm/models/{api-profile.js → api.js} +4 -5
  72. package/esm/models/app.d.ts +9 -1
  73. package/esm/models/app.js +7 -1
  74. package/esm/models/{event.d.ts → audit-event.d.ts} +6 -6
  75. package/esm/models/{event.js → audit-event.js} +7 -6
  76. package/esm/models/body-preview.d.ts +31 -0
  77. package/esm/models/body-preview.js +34 -0
  78. package/esm/models/create-environment.d.ts +51 -0
  79. package/esm/models/create-environment.js +35 -0
  80. package/esm/models/credentials.d.ts +31 -0
  81. package/esm/models/credentials.js +31 -0
  82. package/esm/models/environment-failure.d.ts +22 -0
  83. package/esm/models/environment-failure.js +25 -0
  84. package/esm/models/environment-status.d.ts +14 -0
  85. package/esm/models/environment-status.js +15 -0
  86. package/esm/models/environment.d.ts +27 -27
  87. package/esm/models/environment.js +28 -27
  88. package/esm/models/error.d.ts +38 -0
  89. package/esm/models/error.js +39 -0
  90. package/esm/models/errors/{error-response.d.ts → error.d.ts} +5 -5
  91. package/esm/models/errors/{error-response.js → error.js} +4 -4
  92. package/esm/models/errors/index.d.ts +1 -1
  93. package/esm/models/errors/index.js +1 -1
  94. package/esm/models/index.d.ts +17 -22
  95. package/esm/models/index.js +17 -22
  96. package/esm/models/me.d.ts +66 -0
  97. package/esm/models/me.js +75 -0
  98. package/esm/models/operations/create-credentials.d.ts +25 -0
  99. package/esm/models/operations/create-credentials.js +20 -0
  100. package/esm/models/operations/create-environment.d.ts +14 -0
  101. package/esm/models/operations/create-environment.js +18 -0
  102. package/esm/models/operations/create-snapshot.d.ts +25 -0
  103. package/esm/models/operations/create-snapshot.js +25 -0
  104. package/esm/models/operations/delete-environment.d.ts +13 -0
  105. package/esm/models/operations/delete-environment.js +17 -0
  106. package/esm/models/operations/delete-snapshot.d.ts +0 -12
  107. package/esm/models/operations/delete-snapshot.js +0 -9
  108. package/esm/models/operations/get-environment.d.ts +0 -12
  109. package/esm/models/operations/get-environment.js +0 -9
  110. package/esm/models/operations/get-request-body.d.ts +21 -0
  111. package/esm/models/operations/get-request-body.js +18 -0
  112. package/esm/models/operations/get-request-stats.d.ts +51 -0
  113. package/esm/models/operations/get-request-stats.js +40 -0
  114. package/esm/models/operations/get-request.d.ts +11 -0
  115. package/esm/models/operations/get-request.js +11 -0
  116. package/esm/models/operations/get-snapshot.d.ts +0 -12
  117. package/esm/models/operations/get-snapshot.js +0 -9
  118. package/esm/models/operations/get-workspace.d.ts +0 -12
  119. package/esm/models/operations/get-workspace.js +0 -9
  120. package/esm/models/operations/index.d.ts +13 -15
  121. package/esm/models/operations/index.js +13 -15
  122. package/esm/models/operations/list-apps.d.ts +26 -0
  123. package/esm/models/operations/list-apps.js +23 -0
  124. package/esm/models/operations/list-audit-events.d.ts +30 -0
  125. package/esm/models/operations/list-audit-events.js +25 -0
  126. package/esm/models/operations/list-environments.d.ts +6 -21
  127. package/esm/models/operations/list-environments.js +3 -16
  128. package/esm/models/operations/list-requests.d.ts +68 -0
  129. package/esm/models/operations/list-requests.js +53 -0
  130. package/esm/models/operations/list-snapshots.d.ts +8 -6
  131. package/esm/models/operations/list-snapshots.js +4 -3
  132. package/esm/models/operations/list-versions.d.ts +28 -0
  133. package/esm/models/operations/list-versions.js +24 -0
  134. package/esm/models/operations/list-workspaces.d.ts +8 -4
  135. package/esm/models/operations/list-workspaces.js +7 -4
  136. package/esm/models/operations/pause-environment.d.ts +13 -0
  137. package/esm/models/operations/pause-environment.js +17 -0
  138. package/esm/models/operations/resume-environment.d.ts +2 -12
  139. package/esm/models/operations/resume-environment.js +8 -11
  140. package/esm/models/operations/update-environment.d.ts +29 -0
  141. package/esm/models/operations/update-environment.js +20 -0
  142. package/esm/models/operations/update-snapshot.d.ts +0 -14
  143. package/esm/models/operations/update-snapshot.js +0 -10
  144. package/esm/models/permission.d.ts +17 -0
  145. package/esm/models/permission.js +18 -0
  146. package/esm/models/principal.d.ts +20 -0
  147. package/esm/models/principal.js +24 -0
  148. package/esm/models/request-detail.d.ts +39 -0
  149. package/esm/models/request-detail.js +38 -0
  150. package/esm/models/request-stats.d.ts +26 -0
  151. package/esm/models/request-stats.js +31 -0
  152. package/esm/models/request.d.ts +30 -0
  153. package/esm/models/request.js +34 -0
  154. package/esm/models/snapshot-status.d.ts +13 -0
  155. package/esm/models/snapshot-status.js +14 -0
  156. package/esm/models/snapshot.d.ts +47 -0
  157. package/esm/models/snapshot.js +54 -0
  158. package/esm/models/version.d.ts +27 -0
  159. package/esm/models/version.js +31 -0
  160. package/esm/models/workspace.d.ts +2 -4
  161. package/esm/models/workspace.js +2 -4
  162. package/esm/sdk/apps.d.ts +6 -0
  163. package/esm/sdk/apps.js +15 -0
  164. package/esm/sdk/audit-events.d.ts +5 -0
  165. package/esm/sdk/audit-events.js +11 -0
  166. package/esm/sdk/environments.d.ts +8 -9
  167. package/esm/sdk/environments.js +19 -23
  168. package/esm/sdk/requests.d.ts +9 -0
  169. package/esm/sdk/requests.js +23 -0
  170. package/esm/sdk/sdk.d.ts +11 -11
  171. package/esm/sdk/sdk.js +16 -23
  172. package/esm/sdk/snapshots.d.ts +6 -5
  173. package/esm/sdk/snapshots.js +7 -7
  174. package/esm/sdk/workspaces.d.ts +1 -2
  175. package/esm/sdk/workspaces.js +0 -4
  176. package/esm/types/smart-union.js +1 -2
  177. package/openapi.json +1630 -2380
  178. package/package.json +15 -13
  179. package/esm/extensions/apps.d.ts +0 -18
  180. package/esm/extensions/apps.js +0 -39
  181. package/esm/extensions/connection.d.ts +0 -42
  182. package/esm/extensions/connection.js +0 -133
  183. package/esm/extensions/running-environment.d.ts +0 -46
  184. package/esm/extensions/running-environment.js +0 -66
  185. package/esm/funcs/create-environment-definition.d.ts +0 -11
  186. package/esm/funcs/create-environment-definition.js +0 -94
  187. package/esm/funcs/credential-get.js +0 -76
  188. package/esm/funcs/environments-reveal.d.ts +0 -11
  189. package/esm/funcs/environments-suspend.d.ts +0 -11
  190. package/esm/funcs/get-environment-exchange.d.ts +0 -11
  191. package/esm/funcs/get-environment-exchange.js +0 -96
  192. package/esm/funcs/get-environment-position.d.ts +0 -11
  193. package/esm/funcs/list-environment-history.d.ts +0 -11
  194. package/esm/funcs/snapshots-capture.d.ts +0 -11
  195. package/esm/models/app-instance-snapshot.d.ts +0 -15
  196. package/esm/models/app-instance-snapshot.js +0 -19
  197. package/esm/models/catalog.d.ts +0 -12
  198. package/esm/models/catalog.js +0 -15
  199. package/esm/models/connection-secret.d.ts +0 -30
  200. package/esm/models/connection-secret.js +0 -31
  201. package/esm/models/connection.d.ts +0 -40
  202. package/esm/models/connection.js +0 -44
  203. package/esm/models/create-environment-input.d.ts +0 -39
  204. package/esm/models/create-environment-input.js +0 -25
  205. package/esm/models/credential-kind.d.ts +0 -9
  206. package/esm/models/credential-kind.js +0 -10
  207. package/esm/models/credential.d.ts +0 -48
  208. package/esm/models/credential.js +0 -44
  209. package/esm/models/environment-app.d.ts +0 -53
  210. package/esm/models/environment-app.js +0 -57
  211. package/esm/models/environment-exchange.d.ts +0 -116
  212. package/esm/models/environment-exchange.js +0 -126
  213. package/esm/models/environment-lifetime.d.ts +0 -10
  214. package/esm/models/environment-lifetime.js +0 -14
  215. package/esm/models/environment-position.d.ts +0 -25
  216. package/esm/models/environment-position.js +0 -32
  217. package/esm/models/environment-snapshot.d.ts +0 -40
  218. package/esm/models/environment-snapshot.js +0 -42
  219. package/esm/models/error-response.d.ts +0 -58
  220. package/esm/models/error-response.js +0 -60
  221. package/esm/models/event-page.d.ts +0 -11
  222. package/esm/models/event-page.js +0 -16
  223. package/esm/models/history-body.d.ts +0 -28
  224. package/esm/models/history-body.js +0 -33
  225. package/esm/models/history-cause.d.ts +0 -48
  226. package/esm/models/history-cause.js +0 -63
  227. package/esm/models/history-position.d.ts +0 -11
  228. package/esm/models/history-position.js +0 -15
  229. package/esm/models/history-transaction.d.ts +0 -16
  230. package/esm/models/history-transaction.js +0 -20
  231. package/esm/models/operations/capture-snapshot.d.ts +0 -41
  232. package/esm/models/operations/capture-snapshot.js +0 -36
  233. package/esm/models/operations/create-environment-definition.d.ts +0 -225
  234. package/esm/models/operations/create-environment-definition.js +0 -149
  235. package/esm/models/operations/create-environments.d.ts +0 -27
  236. package/esm/models/operations/create-environments.js +0 -27
  237. package/esm/models/operations/get-catalog.d.ts +0 -13
  238. package/esm/models/operations/get-catalog.js +0 -13
  239. package/esm/models/operations/get-connection.d.ts +0 -25
  240. package/esm/models/operations/get-connection.js +0 -21
  241. package/esm/models/operations/get-credential.d.ts +0 -13
  242. package/esm/models/operations/get-credential.js +0 -13
  243. package/esm/models/operations/get-environment-exchange.d.ts +0 -25
  244. package/esm/models/operations/get-environment-exchange.js +0 -21
  245. package/esm/models/operations/get-environment-position.d.ts +0 -23
  246. package/esm/models/operations/get-environment-position.js +0 -20
  247. package/esm/models/operations/get-release.d.ts +0 -23
  248. package/esm/models/operations/get-release.js +0 -20
  249. package/esm/models/operations/list-environment-events.d.ts +0 -15
  250. package/esm/models/operations/list-environment-events.js +0 -13
  251. package/esm/models/operations/list-environment-history.d.ts +0 -28
  252. package/esm/models/operations/list-environment-history.js +0 -24
  253. package/esm/models/operations/list-workspace-events.d.ts +0 -15
  254. package/esm/models/operations/list-workspace-events.js +0 -13
  255. package/esm/models/operations/reveal-connection.d.ts +0 -59
  256. package/esm/models/operations/reveal-connection.js +0 -55
  257. package/esm/models/operations/stop-environment.d.ts +0 -23
  258. package/esm/models/operations/stop-environment.js +0 -20
  259. package/esm/models/operations/suspend-environment.d.ts +0 -23
  260. package/esm/models/operations/suspend-environment.js +0 -20
  261. package/esm/models/release-actor.d.ts +0 -11
  262. package/esm/models/release-actor.js +0 -15
  263. package/esm/models/release.d.ts +0 -37
  264. package/esm/models/release.js +0 -39
  265. package/esm/sdk/catalog.d.ts +0 -6
  266. package/esm/sdk/catalog.js +0 -15
  267. package/esm/sdk/credential.d.ts +0 -5
  268. package/esm/sdk/credential.js +0 -11
  269. package/esm/types/discriminated-union.d.ts +0 -24
  270. package/esm/types/discriminated-union.js +0 -60
@@ -1,15 +1,64 @@
1
- import { DisposalIncompleteError, EnvironmentFailedError, SnapshotFailedError, TimeoutError, toStateMachinesError, } from './errors.js';
1
+ import { EnvironmentFailedError, isTransient, SnapshotFailedError, toStateMachinesError, UnexpectedStatusError, WaitTimeoutError, } from './errors.js';
2
2
  import { linkSignal } from './signal.js';
3
3
  export const defaultTimeoutMs = 600000;
4
4
  const readTimeoutMs = 30000;
5
- export function poll(read, done, options) {
6
- return pollUntil(read, done, options, (timeoutMs, last) => new TimeoutError(timeoutMs, last));
5
+ /**
6
+ * The statuses each status reaches with no call from the customer: a boot ends, a restart
7
+ * fails, the time limit passes, a paused or failed environment expires after a day.
8
+ */
9
+ const environmentReaches = {
10
+ starting: ['running', 'failed', 'deleted'],
11
+ running: ['failed', 'deleted'],
12
+ paused: ['deleted'],
13
+ failed: ['deleted'],
14
+ deleted: [],
15
+ };
16
+ const snapshotReaches = {
17
+ saving: ['ready', 'failed'],
18
+ ready: [],
19
+ failed: [],
20
+ deleted: [],
21
+ };
22
+ /** True at the target; false while the target is still reachable; throws otherwise. */
23
+ export function environmentAt(target) {
24
+ return (environment) => {
25
+ const { status } = environment;
26
+ if (status === target) {
27
+ return true;
28
+ }
29
+ // An unknown status may be a step this SDK predates, so the wait goes on.
30
+ const reaches = environmentReaches[status] ?? null;
31
+ if (!reaches || reaches.includes(target)) {
32
+ return false;
33
+ }
34
+ if (status === 'failed' ||
35
+ (status === 'deleted' && environment.reason === 'failed')) {
36
+ throw new EnvironmentFailedError(environment);
37
+ }
38
+ throw new UnexpectedStatusError(environment, target);
39
+ };
40
+ }
41
+ export function snapshotAt(target) {
42
+ return (snapshot) => {
43
+ const { status } = snapshot;
44
+ if (status === target) {
45
+ return true;
46
+ }
47
+ const reaches = snapshotReaches[status] ?? null;
48
+ if (!reaches || reaches.includes(target)) {
49
+ return false;
50
+ }
51
+ if (status === 'failed') {
52
+ throw new SnapshotFailedError(snapshot);
53
+ }
54
+ throw new UnexpectedStatusError(snapshot, target);
55
+ };
7
56
  }
8
57
  /**
9
- * Reads until `done` returns true. `done` throws to end the wait with a failure.
58
+ * Reads until `done` returns true; `done` throws to end the wait with a failure.
10
59
  * Transient read failures are retried with backoff until the deadline.
11
60
  */
12
- export async function pollUntil(read, done, options = {}, timeout) {
61
+ export async function poll(id, read, done, options = {}) {
13
62
  const { signal } = options;
14
63
  const timeoutMs = options.timeoutMs ?? defaultTimeoutMs;
15
64
  if (!(timeoutMs >= 0)) {
@@ -17,11 +66,12 @@ export async function pollUntil(read, done, options = {}, timeout) {
17
66
  }
18
67
  const deadline = Date.now() + timeoutMs;
19
68
  let last = null;
69
+ const timeout = () => new WaitTimeoutError(last, timeoutMs, id);
20
70
  for (let attempt = 0;; attempt += 1) {
21
71
  signal?.throwIfAborted();
22
72
  const remaining = deadline - Date.now();
23
73
  if (remaining <= 0) {
24
- throw timeout(timeoutMs, last);
74
+ throw timeout();
25
75
  }
26
76
  let waitMs = backoff(attempt);
27
77
  let value = null;
@@ -34,14 +84,14 @@ export async function pollUntil(read, done, options = {}, timeout) {
34
84
  // Classify by signal state: a stalled body read surfaces as an arbitrary error.
35
85
  signal?.throwIfAborted();
36
86
  if (Date.now() >= deadline) {
37
- throw timeout(timeoutMs, last);
87
+ throw timeout();
38
88
  }
39
89
  if (!link.signal.aborted) {
40
90
  const failure = toStateMachinesError(error);
41
- if (!failure.retryable) {
91
+ if (!isTransient(failure)) {
42
92
  throw failure;
43
93
  }
44
- waitMs = Math.max(waitMs, failure.retryAfter ?? 0);
94
+ waitMs = Math.max(waitMs, failure.retryAfterMs ?? 0);
45
95
  }
46
96
  }
47
97
  finally {
@@ -50,7 +100,7 @@ export async function pollUntil(read, done, options = {}, timeout) {
50
100
  // A read can settle after an abort or past the deadline; neither may resolve the wait.
51
101
  signal?.throwIfAborted();
52
102
  if (Date.now() >= deadline) {
53
- throw timeout(timeoutMs, last);
103
+ throw timeout();
54
104
  }
55
105
  if (value !== null && done(value)) {
56
106
  return value;
@@ -58,52 +108,6 @@ export async function pollUntil(read, done, options = {}, timeout) {
58
108
  await sleep(Math.min(waitMs, deadline - Date.now()), signal);
59
109
  }
60
110
  }
61
- /** Resolves on `running`. Never suspends or stops the environment. */
62
- export function ready(environment) {
63
- switch (environment.status) {
64
- case 'running':
65
- return true;
66
- case 'failed':
67
- case 'suspending':
68
- case 'suspended':
69
- case 'stopping':
70
- case 'stopped':
71
- throw new EnvironmentFailedError(environment);
72
- default:
73
- return false;
74
- }
75
- }
76
- /** Resolves on `suspended`, when the environment can resume. */
77
- export function suspended(environment) {
78
- switch (environment.status) {
79
- case 'suspended':
80
- return true;
81
- case 'failed':
82
- case 'stopping':
83
- case 'stopped':
84
- throw new EnvironmentFailedError(environment);
85
- default:
86
- return false;
87
- }
88
- }
89
- /** Resolves once the environment ended and every app's sandbox is confirmed disposed. */
90
- export function disposed(environment) {
91
- if (environment.status !== 'stopped' && environment.status !== 'failed') {
92
- return false;
93
- }
94
- const unconfirmed = environment.apps.some(({ disposal }) => disposal === 'failed' || disposal === 'unknown');
95
- if (unconfirmed) {
96
- throw new DisposalIncompleteError(environment);
97
- }
98
- return environment.apps.every((app) => app.disposal === 'complete');
99
- }
100
- /** Resolves on `ready`. A failed or deleted snapshot ends the wait. */
101
- export function snapshotReady(snapshot) {
102
- if (snapshot.status === 'failed' || snapshot.deletedAt) {
103
- throw new SnapshotFailedError(snapshot);
104
- }
105
- return snapshot.status === 'ready';
106
- }
107
111
  /** 1 s × 1.5ⁿ, capped at 5 s, with ±20% jitter. */
108
112
  export function backoff(attempt) {
109
113
  return Math.min(5000, 1000 * 1.5 ** attempt) * (0.8 + Math.random() * 0.4);
@@ -0,0 +1,6 @@
1
+ import type { CreateEnvironment } from '../models/create-environment.js';
2
+ /**
3
+ * Parses a YAML document with the fields of `CreateEnvironment`. The SDK checks the shape;
4
+ * the API checks the values. Anchors, aliases, tags and duplicate keys are refused.
5
+ */
6
+ export declare function parseEnvironmentYaml(text: string): CreateEnvironment;
@@ -0,0 +1,137 @@
1
+ import { isAlias, isScalar, parseDocument, visit } from 'yaml';
2
+ import { invalidInput } from './errors.js';
3
+ const APP_FIELDS = new Set(['app', 'name', 'settings']);
4
+ /**
5
+ * Parses a YAML document with the fields of `CreateEnvironment`. The SDK checks the shape;
6
+ * the API checks the values. Anchors, aliases, tags and duplicate keys are refused.
7
+ */
8
+ export function parseEnvironmentYaml(text) {
9
+ const document = parseDocument(text, {
10
+ version: '1.2',
11
+ strict: true,
12
+ uniqueKeys: true,
13
+ merge: false,
14
+ resolveKnownTags: false,
15
+ });
16
+ const issue = document.errors[0] ?? document.warnings[0];
17
+ if (issue) {
18
+ const position = issue.linePos?.[0];
19
+ throw bad({
20
+ $: [
21
+ `Invalid YAML${position ? ` at ${position.line}:${position.col}` : ''}: ${issue.code}.`,
22
+ ],
23
+ });
24
+ }
25
+ let refused = null;
26
+ visit(document, {
27
+ Node(_key, node) {
28
+ if (isAlias(node) || ('anchor' in node && node.anchor) || node.tag) {
29
+ refused = 'Anchors, aliases and tags are not supported.';
30
+ return visit.BREAK;
31
+ }
32
+ return undefined;
33
+ },
34
+ Pair(_key, pair) {
35
+ if (!isScalar(pair.key) || typeof pair.key.value !== 'string') {
36
+ refused = 'Every key must be a string.';
37
+ return visit.BREAK;
38
+ }
39
+ return undefined;
40
+ },
41
+ });
42
+ if (refused) {
43
+ throw bad({ $: [refused] });
44
+ }
45
+ const value = document.toJS({ maxAliasCount: 0 });
46
+ const fields = {};
47
+ const add = (path, message) => {
48
+ fields[path] = [...(fields[path] ?? []), message];
49
+ };
50
+ if (!isRecord(value)) {
51
+ throw bad({ $: ['The document must be a mapping.'] });
52
+ }
53
+ for (const [key, field] of Object.entries(value)) {
54
+ switch (key) {
55
+ case 'workspaceId':
56
+ case 'snapshotId':
57
+ if (typeof field !== 'string') {
58
+ add(key, 'Expected a string.');
59
+ }
60
+ break;
61
+ case 'name':
62
+ if (field !== null && typeof field !== 'string') {
63
+ add(key, 'Expected a string or null.');
64
+ }
65
+ break;
66
+ case 'tokenInUrl':
67
+ if (typeof field !== 'boolean') {
68
+ add(key, 'Expected a boolean.');
69
+ }
70
+ break;
71
+ case 'timeLimitMinutes':
72
+ if (!Number.isInteger(field)) {
73
+ add(key, 'Expected an integer.');
74
+ }
75
+ break;
76
+ case 'labels':
77
+ if (!isRecord(field)) {
78
+ add(key, 'Expected a mapping.');
79
+ break;
80
+ }
81
+ for (const [label, text] of Object.entries(field)) {
82
+ if (typeof text !== 'string') {
83
+ add(`labels.${label}`, 'Expected a string.');
84
+ }
85
+ }
86
+ break;
87
+ case 'apps':
88
+ if (!Array.isArray(field)) {
89
+ add(key, 'Expected a list.');
90
+ break;
91
+ }
92
+ for (const [index, app] of field.entries()) {
93
+ checkApp(app, `apps.${index}`, add);
94
+ }
95
+ break;
96
+ default:
97
+ add(key, 'Unknown field.');
98
+ }
99
+ }
100
+ if ('apps' in value === 'snapshotId' in value) {
101
+ add('$', 'Pass exactly one of apps and snapshotId.');
102
+ }
103
+ if (Object.keys(fields).length > 0) {
104
+ throw bad(fields);
105
+ }
106
+ return value;
107
+ }
108
+ function checkApp(app, path, add) {
109
+ if (typeof app === 'string') {
110
+ return;
111
+ }
112
+ if (!isRecord(app)) {
113
+ add(path, 'Expected an app ID or a mapping with app.');
114
+ return;
115
+ }
116
+ const { app: id, name, settings } = app;
117
+ if (typeof id !== 'string') {
118
+ add(`${path}.app`, 'Expected a string.');
119
+ }
120
+ if ('name' in app && typeof name !== 'string') {
121
+ add(`${path}.name`, 'Expected a string.');
122
+ }
123
+ if ('settings' in app && !isRecord(settings)) {
124
+ add(`${path}.settings`, 'Expected a mapping.');
125
+ }
126
+ for (const key of Object.keys(app)) {
127
+ if (!APP_FIELDS.has(key)) {
128
+ add(`${path}.${key}`, 'Unknown field.');
129
+ }
130
+ }
131
+ }
132
+ function isRecord(value) {
133
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
134
+ }
135
+ function bad(fields) {
136
+ return invalidInput('The environment YAML is invalid.', fields);
137
+ }
@@ -8,4 +8,4 @@ import { StateMachinesHTTPError } from "../models/errors/state-machines-http-err
8
8
  import * as operations from "../models/operations/index.js";
9
9
  import { APIPromise } from "../types/async.js";
10
10
  import { Result } from "../types/fp.js";
11
- export declare function catalogRelease(client: StateMachinesCore, request: operations.GetReleaseRequest, options?: RequestOptions): APIPromise<Result<operations.GetReleaseResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
11
+ export declare function appsList(client: StateMachinesCore, request?: operations.ListAppsRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListAppsResponse, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
@@ -0,0 +1,91 @@
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 appsList(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.ListAppsRequest$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/apps")();
26
+ const query = encodeFormQuery({
27
+ "cursor": payload?.cursor,
28
+ "limit": payload?.limit,
29
+ });
30
+ const headers = new Headers(compactMap({
31
+ Accept: "application/json",
32
+ }));
33
+ const secConfig = await extractSecurity(client._options.apiKey);
34
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
35
+ const requestSecurity = resolveGlobalSecurity(securityInput);
36
+ const context = {
37
+ options: client._options,
38
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
39
+ operationID: "listApps",
40
+ oAuth2Scopes: null,
41
+ resolvedSecurity: requestSecurity,
42
+ securitySource: client._options.apiKey,
43
+ retryConfig: options?.retries
44
+ || client._options.retryConfig
45
+ || {
46
+ strategy: "backoff",
47
+ backoff: {
48
+ initialInterval: 1000,
49
+ maxInterval: 5000,
50
+ exponent: 1.5,
51
+ maxElapsedTime: 600000,
52
+ },
53
+ retryConnectionErrors: true,
54
+ }
55
+ || { strategy: "none" },
56
+ retryCodes: options?.retryCodes || ["502", "503", "504"],
57
+ };
58
+ const requestRes = client._createRequest(context, {
59
+ security: requestSecurity,
60
+ method: "GET",
61
+ baseURL: options?.serverURL,
62
+ path: path,
63
+ headers: headers,
64
+ query: query,
65
+ body: body,
66
+ userAgent: client._options.userAgent,
67
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
68
+ }, options);
69
+ if (!requestRes.ok) {
70
+ return [requestRes, { status: "invalid" }];
71
+ }
72
+ const req = requestRes.value;
73
+ const doResult = await client._do(req, {
74
+ context,
75
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
76
+ retryConfig: context.retryConfig,
77
+ retryCodes: context.retryCodes,
78
+ });
79
+ if (!doResult.ok) {
80
+ return [doResult, { status: "request-error", request: req }];
81
+ }
82
+ const response = doResult.value;
83
+ const responseFields = {
84
+ HttpMeta: { Response: response, Request: req },
85
+ };
86
+ const [result] = await M.match(M.json(200, operations.ListAppsResponse$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 });
87
+ if (!result.ok) {
88
+ return [result, { status: "complete", request: req, response }];
89
+ }
90
+ return [result, { status: "complete", request: req, response }];
91
+ }
@@ -8,4 +8,4 @@ import { StateMachinesHTTPError } from "../models/errors/state-machines-http-err
8
8
  import * as operations from "../models/operations/index.js";
9
9
  import { APIPromise } from "../types/async.js";
10
10
  import { Result } from "../types/fp.js";
11
- export declare function credentialGet(client: StateMachinesCore, options?: RequestOptions): APIPromise<Result<operations.GetCredentialResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
11
+ export declare function appsVersions(client: StateMachinesCore, request: operations.ListVersionsRequest, options?: RequestOptions): APIPromise<Result<operations.ListVersionsResponse, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
@@ -10,26 +10,25 @@ import { safeParse } from "../lib/schemas.js";
10
10
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
11
  import { pathToFunc } from "../lib/url.js";
12
12
  import * as errors from "../models/errors/index.js";
13
- import * as models from "../models/index.js";
14
13
  import * as operations from "../models/operations/index.js";
15
14
  import { APIPromise } from "../types/async.js";
16
- export function workspacesEvents(client, request, options) {
15
+ export function appsVersions(client, request, options) {
17
16
  return new APIPromise($do(client, request, options));
18
17
  }
19
18
  async function $do(client, request, options) {
20
- const parsed = safeParse(request, (value) => z.parse(operations.ListWorkspaceEventsRequest$outboundSchema, value), "Input validation failed");
19
+ const parsed = safeParse(request, (value) => z.parse(operations.ListVersionsRequest$outboundSchema, value), "Input validation failed");
21
20
  if (!parsed.ok) {
22
21
  return [parsed, { status: "invalid" }];
23
22
  }
24
23
  const payload = parsed.value;
25
24
  const body = null;
26
25
  const pathParams = {
27
- workspaceId: encodeSimple("workspaceId", payload.workspaceId, {
26
+ appId: encodeSimple("appId", payload.appId, {
28
27
  explode: false,
29
28
  charEncoding: "percent",
30
29
  }),
31
30
  };
32
- const path = pathToFunc("/v1/workspaces/{workspaceId}/events")(pathParams);
31
+ const path = pathToFunc("/v1/apps/{appId}/versions")(pathParams);
33
32
  const query = encodeFormQuery({
34
33
  "cursor": payload.cursor,
35
34
  "limit": payload.limit,
@@ -43,7 +42,7 @@ async function $do(client, request, options) {
43
42
  const context = {
44
43
  options: client._options,
45
44
  baseURL: options?.serverURL ?? client._baseURL ?? "",
46
- operationID: "listWorkspaceEvents",
45
+ operationID: "listVersions",
47
46
  oAuth2Scopes: null,
48
47
  resolvedSecurity: requestSecurity,
49
48
  securitySource: client._options.apiKey,
@@ -90,7 +89,7 @@ async function $do(client, request, options) {
90
89
  const responseFields = {
91
90
  HttpMeta: { Response: response, Request: req },
92
91
  };
93
- const [result] = await M.match(M.json(200, models.EventPage$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
92
+ const [result] = await M.match(M.json(200, operations.ListVersionsResponse$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
93
  if (!result.ok) {
95
94
  return [result, { status: "complete", request: req, response }];
96
95
  }
@@ -8,4 +8,4 @@ import { StateMachinesHTTPError } from "../models/errors/state-machines-http-err
8
8
  import * as operations from "../models/operations/index.js";
9
9
  import { APIPromise } from "../types/async.js";
10
10
  import { Result } from "../types/fp.js";
11
- export declare function environmentsGetConnection(client: StateMachinesCore, request: operations.GetConnectionRequest, options?: RequestOptions): APIPromise<Result<operations.GetConnectionResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
11
+ export declare function auditEventsList(client: StateMachinesCore, request?: operations.ListAuditEventsRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListAuditEventsResponse, 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 auditEventsList(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.ListAuditEventsRequest$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/audit-events")();
26
+ const query = encodeFormQuery({
27
+ "cursor": payload?.cursor,
28
+ "environmentId": payload?.environmentId,
29
+ "limit": payload?.limit,
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: "listAuditEvents",
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.ListAuditEventsResponse$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
+ }
@@ -9,4 +9,4 @@ import * as models from "../models/index.js";
9
9
  import * as operations from "../models/operations/index.js";
10
10
  import { APIPromise } from "../types/async.js";
11
11
  import { Result } from "../types/fp.js";
12
- export declare function workspacesEvents(client: StateMachinesCore, request: operations.ListWorkspaceEventsRequest, options?: RequestOptions): APIPromise<Result<models.EventPage, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
12
+ export declare function environmentsConnect(client: StateMachinesCore, request: operations.CreateCredentialsRequest, options?: RequestOptions): APIPromise<Result<models.Credentials, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
@@ -10,20 +10,21 @@ import { safeParse } from "../lib/schemas.js";
10
10
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
11
  import { pathToFunc } from "../lib/url.js";
12
12
  import * as errors from "../models/errors/index.js";
13
+ import * as models from "../models/index.js";
13
14
  import * as operations from "../models/operations/index.js";
14
15
  import { APIPromise } from "../types/async.js";
15
- export function environmentsReveal(client, request, options) {
16
+ export function environmentsConnect(client, request, options) {
16
17
  return new APIPromise($do(client, request, options));
17
18
  }
18
19
  async function $do(client, request, options) {
19
- const parsed = safeParse(request, (value) => z.parse(operations.RevealConnectionRequest$outboundSchema, value), "Input validation failed");
20
+ const parsed = safeParse(request, (value) => z.parse(operations.CreateCredentialsRequest$outboundSchema, value), "Input validation failed");
20
21
  if (!parsed.ok) {
21
22
  return [parsed, { status: "invalid" }];
22
23
  }
23
24
  const payload = parsed.value;
24
25
  const body = encodeJSON("body", payload.body, { explode: true });
25
26
  const pathParams = {
26
- appKey: encodeSimple("appKey", payload.appKey, {
27
+ appName: encodeSimple("appName", payload.appName, {
27
28
  explode: false,
28
29
  charEncoding: "percent",
29
30
  }),
@@ -32,7 +33,7 @@ async function $do(client, request, options) {
32
33
  charEncoding: "percent",
33
34
  }),
34
35
  };
35
- const path = pathToFunc("/v1/environments/{environmentId}/apps/{appKey}/connection/reveal")(pathParams);
36
+ const path = pathToFunc("/v1/environments/{environmentId}/apps/{appName}/credentials")(pathParams);
36
37
  const headers = new Headers(compactMap({
37
38
  "Content-Type": "application/json",
38
39
  Accept: "application/json",
@@ -43,7 +44,7 @@ async function $do(client, request, options) {
43
44
  const context = {
44
45
  options: client._options,
45
46
  baseURL: options?.serverURL ?? client._baseURL ?? "",
46
- operationID: "revealConnection",
47
+ operationID: "createCredentials",
47
48
  oAuth2Scopes: null,
48
49
  resolvedSecurity: requestSecurity,
49
50
  securitySource: client._options.apiKey,
@@ -89,7 +90,7 @@ async function $do(client, request, options) {
89
90
  const responseFields = {
90
91
  HttpMeta: { Response: response, Request: req },
91
92
  };
92
- const [result] = await M.match(M.json(200, operations.RevealConnectionResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
93
+ const [result] = await M.match(M.json(200, models.Credentials$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
94
  if (!result.ok) {
94
95
  return [result, { status: "complete", request: req, response }];
95
96
  }
@@ -5,7 +5,8 @@ import * as errors from "../models/errors/index.js";
5
5
  import { ResponseValidationError } from "../models/errors/response-validation-error.js";
6
6
  import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
7
7
  import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
8
+ import * as models from "../models/index.js";
8
9
  import * as operations from "../models/operations/index.js";
9
10
  import { APIPromise } from "../types/async.js";
10
11
  import { Result } from "../types/fp.js";
11
- export declare function environmentsCreate(client: StateMachinesCore, request: operations.CreateEnvironmentsRequest, options?: RequestOptions): APIPromise<Result<operations.CreateEnvironmentsResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
12
+ export declare function environmentsCreate(client: StateMachinesCore, request: operations.CreateEnvironmentRequest, options?: RequestOptions): APIPromise<Result<models.Environment, errors.ErrorT | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;