@distilled.cloud/daytona 0.0.0-placeholder → 1.0.0-rc.13

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 +201 -0
  2. package/README.md +34 -0
  3. package/lib/credentials.d.ts +46 -0
  4. package/lib/credentials.d.ts.map +1 -0
  5. package/lib/credentials.js +67 -0
  6. package/lib/credentials.js.map +1 -0
  7. package/lib/endpoints.d.ts +15 -0
  8. package/lib/endpoints.d.ts.map +1 -0
  9. package/lib/endpoints.js +28 -0
  10. package/lib/endpoints.js.map +1 -0
  11. package/lib/errors.d.ts +53 -0
  12. package/lib/errors.d.ts.map +1 -0
  13. package/lib/errors.js +30 -0
  14. package/lib/errors.js.map +1 -0
  15. package/lib/index.d.ts +30 -0
  16. package/lib/index.d.ts.map +1 -0
  17. package/lib/index.js +30 -0
  18. package/lib/index.js.map +1 -0
  19. package/lib/pagination.d.ts +10 -0
  20. package/lib/pagination.d.ts.map +1 -0
  21. package/lib/pagination.js +10 -0
  22. package/lib/pagination.js.map +1 -0
  23. package/lib/protocol.d.ts +18 -0
  24. package/lib/protocol.d.ts.map +1 -0
  25. package/lib/protocol.js +75 -0
  26. package/lib/protocol.js.map +1 -0
  27. package/lib/response-validation.test.d.ts +4 -0
  28. package/lib/response-validation.test.d.ts.map +1 -0
  29. package/lib/response-validation.test.js +31 -0
  30. package/lib/response-validation.test.js.map +1 -0
  31. package/lib/retry.d.ts +50 -0
  32. package/lib/retry.d.ts.map +1 -0
  33. package/lib/retry.js +43 -0
  34. package/lib/retry.js.map +1 -0
  35. package/lib/services/api_keys.d.ts +120 -0
  36. package/lib/services/api_keys.d.ts.map +1 -0
  37. package/lib/services/api_keys.js +126 -0
  38. package/lib/services/api_keys.js.map +1 -0
  39. package/lib/services/audit.d.ts +159 -0
  40. package/lib/services/audit.d.ts.map +1 -0
  41. package/lib/services/audit.js +126 -0
  42. package/lib/services/audit.js.map +1 -0
  43. package/lib/services/computer_use.d.ts +484 -0
  44. package/lib/services/computer_use.d.ts.map +1 -0
  45. package/lib/services/computer_use.js +672 -0
  46. package/lib/services/computer_use.js.map +1 -0
  47. package/lib/services/config.d.ts +138 -0
  48. package/lib/services/config.d.ts.map +1 -0
  49. package/lib/services/config.js +88 -0
  50. package/lib/services/config.js.map +1 -0
  51. package/lib/services/docker_registry.d.ts +126 -0
  52. package/lib/services/docker_registry.d.ts.map +1 -0
  53. package/lib/services/docker_registry.js +135 -0
  54. package/lib/services/docker_registry.js.map +1 -0
  55. package/lib/services/file_system.d.ts +203 -0
  56. package/lib/services/file_system.d.ts.map +1 -0
  57. package/lib/services/file_system.js +255 -0
  58. package/lib/services/file_system.js.map +1 -0
  59. package/lib/services/git.d.ts +338 -0
  60. package/lib/services/git.d.ts.map +1 -0
  61. package/lib/services/git.js +417 -0
  62. package/lib/services/git.js.map +1 -0
  63. package/lib/services/health.d.ts +41 -0
  64. package/lib/services/health.d.ts.map +1 -0
  65. package/lib/services/health.js +49 -0
  66. package/lib/services/health.js.map +1 -0
  67. package/lib/services/index.d.ts +31 -0
  68. package/lib/services/index.d.ts.map +1 -0
  69. package/lib/services/index.js +32 -0
  70. package/lib/services/index.js.map +1 -0
  71. package/lib/services/info.d.ts +37 -0
  72. package/lib/services/info.d.ts.map +1 -0
  73. package/lib/services/info.js +55 -0
  74. package/lib/services/info.js.map +1 -0
  75. package/lib/services/interpreter.d.ts +56 -0
  76. package/lib/services/interpreter.d.ts.map +1 -0
  77. package/lib/services/interpreter.js +83 -0
  78. package/lib/services/interpreter.js.map +1 -0
  79. package/lib/services/jobs.d.ts +104 -0
  80. package/lib/services/jobs.d.ts.map +1 -0
  81. package/lib/services/jobs.js +94 -0
  82. package/lib/services/jobs.js.map +1 -0
  83. package/lib/services/lsp.d.ts +137 -0
  84. package/lib/services/lsp.d.ts.map +1 -0
  85. package/lib/services/lsp.js +160 -0
  86. package/lib/services/lsp.js.map +1 -0
  87. package/lib/services/object_storage.d.ts +31 -0
  88. package/lib/services/object_storage.d.ts.map +1 -0
  89. package/lib/services/object_storage.js +33 -0
  90. package/lib/services/object_storage.js.map +1 -0
  91. package/lib/services/organizations.d.ts +963 -0
  92. package/lib/services/organizations.d.ts.map +1 -0
  93. package/lib/services/organizations.js +1143 -0
  94. package/lib/services/organizations.js.map +1 -0
  95. package/lib/services/port.d.ts +29 -0
  96. package/lib/services/port.d.ts.map +1 -0
  97. package/lib/services/port.js +41 -0
  98. package/lib/services/port.js.map +1 -0
  99. package/lib/services/preview.d.ts +73 -0
  100. package/lib/services/preview.d.ts.map +1 -0
  101. package/lib/services/preview.js +125 -0
  102. package/lib/services/preview.js.map +1 -0
  103. package/lib/services/process.d.ts +329 -0
  104. package/lib/services/process.d.ts.map +1 -0
  105. package/lib/services/process.js +421 -0
  106. package/lib/services/process.js.map +1 -0
  107. package/lib/services/regions.d.ts +41 -0
  108. package/lib/services/regions.d.ts.map +1 -0
  109. package/lib/services/regions.js +36 -0
  110. package/lib/services/regions.js.map +1 -0
  111. package/lib/services/runners.d.ts +358 -0
  112. package/lib/services/runners.d.ts.map +1 -0
  113. package/lib/services/runners.js +316 -0
  114. package/lib/services/runners.js.map +1 -0
  115. package/lib/services/sandbox.d.ts +1276 -0
  116. package/lib/services/sandbox.d.ts.map +1 -0
  117. package/lib/services/sandbox.js +1218 -0
  118. package/lib/services/sandbox.js.map +1 -0
  119. package/lib/services/secret.d.ts +120 -0
  120. package/lib/services/secret.d.ts.map +1 -0
  121. package/lib/services/secret.js +113 -0
  122. package/lib/services/secret.js.map +1 -0
  123. package/lib/services/server.d.ts +44 -0
  124. package/lib/services/server.d.ts.map +1 -0
  125. package/lib/services/server.js +46 -0
  126. package/lib/services/server.js.map +1 -0
  127. package/lib/services/snapshots.d.ts +208 -0
  128. package/lib/services/snapshots.d.ts.map +1 -0
  129. package/lib/services/snapshots.js +189 -0
  130. package/lib/services/snapshots.js.map +1 -0
  131. package/lib/services/system.d.ts +24 -0
  132. package/lib/services/system.d.ts.map +1 -0
  133. package/lib/services/system.js +31 -0
  134. package/lib/services/system.js.map +1 -0
  135. package/lib/services/telemetry.d.ts +141 -0
  136. package/lib/services/telemetry.d.ts.map +1 -0
  137. package/lib/services/telemetry.js +165 -0
  138. package/lib/services/telemetry.js.map +1 -0
  139. package/lib/services/usage.d.ts +111 -0
  140. package/lib/services/usage.d.ts.map +1 -0
  141. package/lib/services/usage.js +146 -0
  142. package/lib/services/usage.js.map +1 -0
  143. package/lib/services/users.d.ts +125 -0
  144. package/lib/services/users.d.ts.map +1 -0
  145. package/lib/services/users.js +172 -0
  146. package/lib/services/users.js.map +1 -0
  147. package/lib/services/volumes.d.ts +83 -0
  148. package/lib/services/volumes.d.ts.map +1 -0
  149. package/lib/services/volumes.js +96 -0
  150. package/lib/services/volumes.js.map +1 -0
  151. package/lib/services/warm_pools.d.ts +79 -0
  152. package/lib/services/warm_pools.d.ts.map +1 -0
  153. package/lib/services/warm_pools.js +90 -0
  154. package/lib/services/warm_pools.js.map +1 -0
  155. package/lib/services/webhooks.d.ts +67 -0
  156. package/lib/services/webhooks.d.ts.map +1 -0
  157. package/lib/services/webhooks.js +103 -0
  158. package/lib/services/webhooks.js.map +1 -0
  159. package/lib/traits.d.ts +10 -0
  160. package/lib/traits.d.ts.map +1 -0
  161. package/lib/traits.js +11 -0
  162. package/lib/traits.js.map +1 -0
  163. package/package.json +78 -7
  164. package/src/credentials.ts +135 -0
  165. package/src/endpoints.ts +28 -0
  166. package/src/errors.ts +85 -0
  167. package/src/index.ts +33 -0
  168. package/src/pagination.ts +9 -0
  169. package/src/protocol.ts +108 -0
  170. package/src/response-validation.test.ts +45 -0
  171. package/src/retry.ts +74 -0
  172. package/src/services/api_keys.ts +378 -0
  173. package/src/services/audit.ts +416 -0
  174. package/src/services/computer_use.ts +1496 -0
  175. package/src/services/config.ts +256 -0
  176. package/src/services/docker_registry.ts +325 -0
  177. package/src/services/file_system.ts +575 -0
  178. package/src/services/git.ts +928 -0
  179. package/src/services/health.ts +116 -0
  180. package/src/services/index.ts +31 -0
  181. package/src/services/info.ts +116 -0
  182. package/src/services/interpreter.ts +182 -0
  183. package/src/services/jobs.ts +249 -0
  184. package/src/services/lsp.ts +367 -0
  185. package/src/services/object_storage.ts +75 -0
  186. package/src/services/organizations.ts +2712 -0
  187. package/src/services/port.ts +87 -0
  188. package/src/services/preview.ts +256 -0
  189. package/src/services/process.ts +948 -0
  190. package/src/services/regions.ts +90 -0
  191. package/src/services/runners.ts +811 -0
  192. package/src/services/sandbox.ts +3158 -0
  193. package/src/services/secret.ts +289 -0
  194. package/src/services/server.ts +111 -0
  195. package/src/services/snapshots.ts +508 -0
  196. package/src/services/system.ts +64 -0
  197. package/src/services/telemetry.ts +385 -0
  198. package/src/services/usage.ts +316 -0
  199. package/src/services/users.ts +380 -0
  200. package/src/services/volumes.ts +233 -0
  201. package/src/services/warm_pools.ts +209 -0
  202. package/src/services/webhooks.ts +214 -0
  203. package/src/traits.ts +44 -0
@@ -0,0 +1,45 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { runValidationModes } from "@distilled.cloud/core/testing";
3
+ import * as Effect from "effect/Effect";
4
+ import { credentials } from "./credentials.ts";
5
+ import { DaytonaParseError } from "./errors.ts";
6
+ import * as Retry from "./retry.ts";
7
+ import { getSnapshotBuildLogsUrl } from "./services/snapshots.ts";
8
+ import type { DaytonaOpError } from "./protocol.ts";
9
+
10
+ // getSnapshotBuildLogsUrl declares `{ url: string }`.
11
+ const run = (body: string) =>
12
+ runValidationModes(
13
+ getSnapshotBuildLogsUrl({ id: "snap-1" }).pipe(
14
+ Retry.none,
15
+ Effect.provide(credentials({ apiKey: "test" })),
16
+ ),
17
+ { body },
18
+ );
19
+
20
+ describe("Daytona response validation", () => {
21
+ test("a matching body succeeds unchanged in both modes", async () => {
22
+ const body = { url: "https://logs.example/snap-1" };
23
+ const { lenient, strict } = await run(JSON.stringify(body));
24
+ expect(lenient).toMatchObject({ _tag: "Success", success: body });
25
+ expect(strict).toMatchObject({ _tag: "Success", success: body });
26
+ });
27
+
28
+ test("a body missing required members: lenient returns it, strict fails", async () => {
29
+ const { lenient, strict } = await run("{}");
30
+ expect(lenient).toMatchObject({ _tag: "Success", success: {} });
31
+ expect(strict._tag).toBe("Failure");
32
+ expect((strict as any).failure).toBeInstanceOf(DaytonaParseError);
33
+ });
34
+
35
+ test("a non-JSON body: lenient returns the text, strict fails", async () => {
36
+ const { lenient, strict } = await run("not json");
37
+ expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
38
+ expect((strict as any).failure).toBeInstanceOf(DaytonaParseError);
39
+ });
40
+ });
41
+
42
+ // DaytonaParseError is part of every operation's declared error type.
43
+ export const parseErrorIsDeclared: [DaytonaParseError] extends [DaytonaOpError]
44
+ ? true
45
+ : false = true;
package/src/retry.ts ADDED
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Daytona retry surface — a veneer over `@distilled.cloud/core/retry`.
3
+ *
4
+ * The `Retry` service tag is threaded into every generated operation via
5
+ * `API.make({ retry: Retry })`, so a caller-installed policy applies to all
6
+ * Daytona calls below it and core's `makeDefault` is the fallback when none
7
+ * is provided.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import * as Daytona from "@distilled.cloud/daytona";
12
+ *
13
+ * myEffect.pipe(Daytona.Retry.transient);
14
+ * ```
15
+ */
16
+ import * as Context from "effect/Context";
17
+ import * as Effect from "effect/Effect";
18
+ import * as Layer from "effect/Layer";
19
+ import * as Retries from "@distilled.cloud/core/retry";
20
+
21
+ export type Options = Retries.Options;
22
+ export type Factory = Retries.Factory;
23
+ export type Policy = Retries.Policy;
24
+
25
+ /** Context tag for configuring retry behavior of Daytona API calls. */
26
+ export class Retry extends Context.Service<Retry, Policy>()("DaytonaRetry") {}
27
+
28
+ /** Provides a custom retry policy to every Daytona API call below it. */
29
+ export const policy: {
30
+ (
31
+ options: Options,
32
+ ): <A, E, R>(
33
+ effect: Effect.Effect<A, E, R>,
34
+ ) => Effect.Effect<A, E, Exclude<R, Retry>>;
35
+ (
36
+ factory: Factory,
37
+ ): <A, E, R>(
38
+ effect: Effect.Effect<A, E, R>,
39
+ ) => Effect.Effect<A, E, Exclude<R, Retry>>;
40
+ } = (optionsOrFactory: Options | Factory) =>
41
+ Effect.provide(Layer.succeed(Retry, optionsOrFactory));
42
+
43
+ /** Disables all automatic retries. */
44
+ export const none: <A, E, R>(
45
+ effect: Effect.Effect<A, E, R>,
46
+ ) => Effect.Effect<A, E, Exclude<R, Retry>> = Effect.provide(
47
+ Layer.succeed(Retry, { while: () => false }),
48
+ );
49
+
50
+ /**
51
+ * The default retry policy (core's): transient/throttling/retryable errors,
52
+ * capped exponential backoff with jitter, server `retryAfter` hints honored
53
+ * with precedence.
54
+ */
55
+ export const makeDefault: Factory = Retries.makeDefault;
56
+
57
+ export const jittered = Retries.jittered;
58
+ export const capped = Retries.capped;
59
+
60
+ /** Retry options that retry all throttling errors indefinitely. */
61
+ export const throttlingOptions: Options = Retries.throttlingOptions;
62
+
63
+ /** Retries all throttling errors indefinitely (honoring server hints). */
64
+ export const throttling: <A, E, R>(
65
+ effect: Effect.Effect<A, E, R>,
66
+ ) => Effect.Effect<A, E, Exclude<R, Retry>> = policy(Retries.throttlingFactory);
67
+
68
+ /** Retry options that retry all transient errors indefinitely. */
69
+ export const transientOptions: Options = Retries.transientOptions;
70
+
71
+ /** Retries all transient errors indefinitely. */
72
+ export const transient: <A, E, R>(
73
+ effect: Effect.Effect<A, E, R>,
74
+ ) => Effect.Effect<A, E, Exclude<R, Retry>> = policy(Retries.transientFactory);
@@ -0,0 +1,378 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-daytona/specs/{openapi,toolbox-openapi,analytics-openapi}.json). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.ts";
5
+ import {
6
+ DaytonaProtocol,
7
+ type DaytonaOpError,
8
+ type DaytonaOpContext,
9
+ } from "../protocol.ts";
10
+ import { UnknownDaytonaError } from "../errors.ts";
11
+ import * as Retry from "../retry.ts";
12
+
13
+ export type { DaytonaOpError, DaytonaOpContext };
14
+
15
+ export type CreateApiKeyRequestPermissionsItem =
16
+ | "write:registries"
17
+ | "delete:registries"
18
+ | "write:snapshots"
19
+ | "delete:snapshots"
20
+ | "write:sandboxes"
21
+ | "delete:sandboxes"
22
+ | "read:volumes"
23
+ | "write:volumes"
24
+ | "delete:volumes"
25
+ | "write:regions"
26
+ | "delete:regions"
27
+ | "read:runners"
28
+ | "write:runners"
29
+ | "delete:runners"
30
+ | "read:audit_logs"
31
+ | "manage:api_keys"
32
+ | "manage:secrets"
33
+ | "read:limits"
34
+ | "manage:sso"
35
+ | "read:billing"
36
+ | "manage:billing";
37
+ export const CreateApiKeyRequestPermissionsItem = S.String;
38
+
39
+ /** The list of organization resource permissions explicitly assigned to the API key */
40
+ export type CreateApiKeyRequestPermissionsList = Array<
41
+ CreateApiKeyRequestPermissionsItem | (string & {})
42
+ >;
43
+ export const CreateApiKeyRequestPermissionsList = /*@__PURE__*/ S.Array(
44
+ CreateApiKeyRequestPermissionsItem,
45
+ ) as any as S.Schema<CreateApiKeyRequestPermissionsList>;
46
+
47
+ export interface CreateApiKeyRequest {
48
+ /** Use with JWT to specify the organization ID */
49
+ xDaytonaOrganizationID?: string;
50
+ /** The name of the API key */
51
+ name: string;
52
+ /** The list of organization resource permissions explicitly assigned to the API key */
53
+ permissions: CreateApiKeyRequestPermissionsList;
54
+ /** When the API key expires */
55
+ expiresAt?: string | null;
56
+ }
57
+ export const CreateApiKeyRequest = /*@__PURE__*/ S.suspend(() =>
58
+ S.Struct({
59
+ xDaytonaOrganizationID: S.optional(
60
+ S.String.pipe(T.Header("X-Daytona-Organization-ID")),
61
+ ),
62
+ name: S.String,
63
+ permissions: CreateApiKeyRequestPermissionsList,
64
+ expiresAt: S.optional(S.NullOr(S.String)),
65
+ }).pipe(T.Http({ method: "POST", uri: "/api-keys", code: 200 })),
66
+ ).annotate({
67
+ identifier: "CreateApiKeyRequest",
68
+ }) as any as S.Schema<CreateApiKeyRequest>;
69
+
70
+ export type ApiKeyResponsePermissionsItem =
71
+ | "write:registries"
72
+ | "delete:registries"
73
+ | "write:snapshots"
74
+ | "delete:snapshots"
75
+ | "write:sandboxes"
76
+ | "delete:sandboxes"
77
+ | "read:volumes"
78
+ | "write:volumes"
79
+ | "delete:volumes"
80
+ | "write:regions"
81
+ | "delete:regions"
82
+ | "read:runners"
83
+ | "write:runners"
84
+ | "delete:runners"
85
+ | "read:audit_logs"
86
+ | "manage:api_keys"
87
+ | "manage:secrets"
88
+ | "read:limits"
89
+ | "manage:sso"
90
+ | "read:billing"
91
+ | "manage:billing";
92
+ export const ApiKeyResponsePermissionsItem = S.String;
93
+
94
+ /** The list of organization resource permissions assigned to the API key */
95
+ export type ApiKeyResponsePermissionsList =
96
+ Array<ApiKeyResponsePermissionsItem>;
97
+ export const ApiKeyResponsePermissionsList = /*@__PURE__*/ S.Array(
98
+ ApiKeyResponsePermissionsItem,
99
+ ) as any as S.Schema<ApiKeyResponsePermissionsList>;
100
+
101
+ export interface ApiKeyResponse {
102
+ /** The name of the API key */
103
+ name: string;
104
+ /** The API key value */
105
+ value: string;
106
+ /** When the API key was created */
107
+ createdAt: string;
108
+ /** The list of organization resource permissions assigned to the API key */
109
+ permissions: ApiKeyResponsePermissionsList;
110
+ /** When the API key expires */
111
+ expiresAt: string | null;
112
+ }
113
+ export const ApiKeyResponse = /*@__PURE__*/ S.suspend(() =>
114
+ S.Struct({
115
+ name: S.String,
116
+ value: S.String,
117
+ createdAt: S.String,
118
+ permissions: ApiKeyResponsePermissionsList,
119
+ expiresAt: S.NullOr(S.String),
120
+ }),
121
+ ).annotate({ identifier: "ApiKeyResponse" }) as any as S.Schema<ApiKeyResponse>;
122
+
123
+ export interface DeleteApiKeyRequest {
124
+ name: string;
125
+ /** Use with JWT to specify the organization ID */
126
+ xDaytonaOrganizationID?: string;
127
+ }
128
+ export const DeleteApiKeyRequest = /*@__PURE__*/ S.suspend(() =>
129
+ S.Struct({
130
+ name: S.String.pipe(T.Label()),
131
+ xDaytonaOrganizationID: S.optional(
132
+ S.String.pipe(T.Header("X-Daytona-Organization-ID")),
133
+ ),
134
+ }).pipe(T.Http({ method: "DELETE", uri: "/api-keys/{name}", code: 200 })),
135
+ ).annotate({
136
+ identifier: "DeleteApiKeyRequest",
137
+ }) as any as S.Schema<DeleteApiKeyRequest>;
138
+
139
+ export interface DeleteApiKeyResponse {}
140
+ export const DeleteApiKeyResponse = /*@__PURE__*/ S.suspend(() =>
141
+ S.Struct({}),
142
+ ).annotate({
143
+ identifier: "DeleteApiKeyResponse",
144
+ }) as any as S.Schema<DeleteApiKeyResponse>;
145
+
146
+ export interface DeleteApiKeyForUserRequest {
147
+ userId: string;
148
+ name: string;
149
+ /** Use with JWT to specify the organization ID */
150
+ xDaytonaOrganizationID?: string;
151
+ }
152
+ export const DeleteApiKeyForUserRequest = /*@__PURE__*/ S.suspend(() =>
153
+ S.Struct({
154
+ userId: S.String.pipe(T.Label()),
155
+ name: S.String.pipe(T.Label()),
156
+ xDaytonaOrganizationID: S.optional(
157
+ S.String.pipe(T.Header("X-Daytona-Organization-ID")),
158
+ ),
159
+ }).pipe(
160
+ T.Http({ method: "DELETE", uri: "/api-keys/{userId}/{name}", code: 200 }),
161
+ ),
162
+ ).annotate({
163
+ identifier: "DeleteApiKeyForUserRequest",
164
+ }) as any as S.Schema<DeleteApiKeyForUserRequest>;
165
+
166
+ export interface DeleteApiKeyForUserResponse {}
167
+ export const DeleteApiKeyForUserResponse = /*@__PURE__*/ S.suspend(() =>
168
+ S.Struct({}),
169
+ ).annotate({
170
+ identifier: "DeleteApiKeyForUserResponse",
171
+ }) as any as S.Schema<DeleteApiKeyForUserResponse>;
172
+
173
+ export interface GetApiKeyRequest {
174
+ name: string;
175
+ /** Use with JWT to specify the organization ID */
176
+ xDaytonaOrganizationID?: string;
177
+ }
178
+ export const GetApiKeyRequest = /*@__PURE__*/ S.suspend(() =>
179
+ S.Struct({
180
+ name: S.String.pipe(T.Label()),
181
+ xDaytonaOrganizationID: S.optional(
182
+ S.String.pipe(T.Header("X-Daytona-Organization-ID")),
183
+ ),
184
+ }).pipe(T.Http({ method: "GET", uri: "/api-keys/{name}", code: 200 })),
185
+ ).annotate({
186
+ identifier: "GetApiKeyRequest",
187
+ }) as any as S.Schema<GetApiKeyRequest>;
188
+
189
+ export type ApiKeyListPermissionsItem =
190
+ | "write:registries"
191
+ | "delete:registries"
192
+ | "write:snapshots"
193
+ | "delete:snapshots"
194
+ | "write:sandboxes"
195
+ | "delete:sandboxes"
196
+ | "read:volumes"
197
+ | "write:volumes"
198
+ | "delete:volumes"
199
+ | "write:regions"
200
+ | "delete:regions"
201
+ | "read:runners"
202
+ | "write:runners"
203
+ | "delete:runners"
204
+ | "read:audit_logs"
205
+ | "manage:api_keys"
206
+ | "manage:secrets"
207
+ | "read:limits"
208
+ | "manage:sso"
209
+ | "read:billing"
210
+ | "manage:billing";
211
+ export const ApiKeyListPermissionsItem = S.String;
212
+
213
+ /** The list of organization resource permissions assigned to the API key */
214
+ export type ApiKeyListPermissionsList = Array<ApiKeyListPermissionsItem>;
215
+ export const ApiKeyListPermissionsList = /*@__PURE__*/ S.Array(
216
+ ApiKeyListPermissionsItem,
217
+ ) as any as S.Schema<ApiKeyListPermissionsList>;
218
+
219
+ export interface ApiKeyList {
220
+ /** The name of the API key */
221
+ name: string;
222
+ /** The masked API key value */
223
+ value: string;
224
+ /** When the API key was created */
225
+ createdAt: string;
226
+ /** The list of organization resource permissions assigned to the API key */
227
+ permissions: ApiKeyListPermissionsList;
228
+ /** When the API key was last used */
229
+ lastUsedAt: string | null;
230
+ /** When the API key expires */
231
+ expiresAt: string | null;
232
+ /** The user ID of the user who created the API key */
233
+ userId: string;
234
+ /** The organization ID associated with the API key */
235
+ organizationId?: string;
236
+ }
237
+ export const ApiKeyList = /*@__PURE__*/ S.suspend(() =>
238
+ S.Struct({
239
+ name: S.String,
240
+ value: S.String,
241
+ createdAt: S.String,
242
+ permissions: ApiKeyListPermissionsList,
243
+ lastUsedAt: S.NullOr(S.String),
244
+ expiresAt: S.NullOr(S.String),
245
+ userId: S.String,
246
+ organizationId: S.optional(S.String),
247
+ }),
248
+ ).annotate({ identifier: "ApiKeyList" }) as any as S.Schema<ApiKeyList>;
249
+
250
+ export interface GetCurrentApiKeyRequest {
251
+ /** Use with JWT to specify the organization ID */
252
+ xDaytonaOrganizationID?: string;
253
+ }
254
+ export const GetCurrentApiKeyRequest = /*@__PURE__*/ S.suspend(() =>
255
+ S.Struct({
256
+ xDaytonaOrganizationID: S.optional(
257
+ S.String.pipe(T.Header("X-Daytona-Organization-ID")),
258
+ ),
259
+ }).pipe(T.Http({ method: "GET", uri: "/api-keys/current", code: 200 })),
260
+ ).annotate({
261
+ identifier: "GetCurrentApiKeyRequest",
262
+ }) as any as S.Schema<GetCurrentApiKeyRequest>;
263
+
264
+ export interface ListApiKeysRequest {
265
+ /** Use with JWT to specify the organization ID */
266
+ xDaytonaOrganizationID?: string;
267
+ }
268
+ export const ListApiKeysRequest = /*@__PURE__*/ S.suspend(() =>
269
+ S.Struct({
270
+ xDaytonaOrganizationID: S.optional(
271
+ S.String.pipe(T.Header("X-Daytona-Organization-ID")),
272
+ ),
273
+ }).pipe(T.Http({ method: "GET", uri: "/api-keys", code: 200 })),
274
+ ).annotate({
275
+ identifier: "ListApiKeysRequest",
276
+ }) as any as S.Schema<ListApiKeysRequest>;
277
+
278
+ export type ListApiKeysResponseBodyList = Array<ApiKeyList>;
279
+ export const ListApiKeysResponseBodyList = /*@__PURE__*/ S.Array(
280
+ ApiKeyList,
281
+ ) as any as S.Schema<ListApiKeysResponseBodyList>;
282
+
283
+ export type ListApiKeysResponse = ListApiKeysResponseBodyList;
284
+ export const ListApiKeysResponse = /*@__PURE__*/ S.suspend(() =>
285
+ ListApiKeysResponseBodyList.pipe(T.RawResponseRoot()),
286
+ ).annotate({
287
+ identifier: "ListApiKeysResponse",
288
+ }) as any as S.Schema<ListApiKeysResponse>;
289
+
290
+ export type CreateApiKeyError = DaytonaOpError;
291
+ /** Create API key */
292
+ export const createApiKey: API.OperationMethod<
293
+ CreateApiKeyRequest,
294
+ ApiKeyResponse,
295
+ CreateApiKeyError,
296
+ DaytonaOpContext
297
+ > = /*@__PURE__*/ API.make(() => ({
298
+ input: CreateApiKeyRequest,
299
+ output: ApiKeyResponse,
300
+ errors: [UnknownDaytonaError],
301
+ protocol: DaytonaProtocol,
302
+ retry: Retry.Retry,
303
+ }));
304
+
305
+ export type DeleteApiKeyError = DaytonaOpError;
306
+ /** Delete API key */
307
+ export const deleteApiKey: API.OperationMethod<
308
+ DeleteApiKeyRequest,
309
+ DeleteApiKeyResponse,
310
+ DeleteApiKeyError,
311
+ DaytonaOpContext
312
+ > = /*@__PURE__*/ API.make(() => ({
313
+ input: DeleteApiKeyRequest,
314
+ output: DeleteApiKeyResponse,
315
+ errors: [UnknownDaytonaError],
316
+ protocol: DaytonaProtocol,
317
+ retry: Retry.Retry,
318
+ }));
319
+
320
+ export type DeleteApiKeyForUserError = DaytonaOpError;
321
+ /** Delete API key for user */
322
+ export const deleteApiKeyForUser: API.OperationMethod<
323
+ DeleteApiKeyForUserRequest,
324
+ DeleteApiKeyForUserResponse,
325
+ DeleteApiKeyForUserError,
326
+ DaytonaOpContext
327
+ > = /*@__PURE__*/ API.make(() => ({
328
+ input: DeleteApiKeyForUserRequest,
329
+ output: DeleteApiKeyForUserResponse,
330
+ errors: [UnknownDaytonaError],
331
+ protocol: DaytonaProtocol,
332
+ retry: Retry.Retry,
333
+ }));
334
+
335
+ export type GetApiKeyError = DaytonaOpError;
336
+ /** Get API key */
337
+ export const getApiKey: API.OperationMethod<
338
+ GetApiKeyRequest,
339
+ ApiKeyList,
340
+ GetApiKeyError,
341
+ DaytonaOpContext
342
+ > = /*@__PURE__*/ API.make(() => ({
343
+ input: GetApiKeyRequest,
344
+ output: ApiKeyList,
345
+ errors: [UnknownDaytonaError],
346
+ protocol: DaytonaProtocol,
347
+ retry: Retry.Retry,
348
+ }));
349
+
350
+ export type GetCurrentApiKeyError = DaytonaOpError;
351
+ /** Get current API key's details */
352
+ export const getCurrentApiKey: API.OperationMethod<
353
+ GetCurrentApiKeyRequest,
354
+ ApiKeyList,
355
+ GetCurrentApiKeyError,
356
+ DaytonaOpContext
357
+ > = /*@__PURE__*/ API.make(() => ({
358
+ input: GetCurrentApiKeyRequest,
359
+ output: ApiKeyList,
360
+ errors: [UnknownDaytonaError],
361
+ protocol: DaytonaProtocol,
362
+ retry: Retry.Retry,
363
+ }));
364
+
365
+ export type ListApiKeysError = DaytonaOpError;
366
+ /** List API keys */
367
+ export const listApiKeys: API.OperationMethod<
368
+ ListApiKeysRequest,
369
+ ListApiKeysResponse,
370
+ ListApiKeysError,
371
+ DaytonaOpContext
372
+ > = /*@__PURE__*/ API.make(() => ({
373
+ input: ListApiKeysRequest,
374
+ output: ListApiKeysResponse,
375
+ errors: [UnknownDaytonaError],
376
+ protocol: DaytonaProtocol,
377
+ retry: Retry.Retry,
378
+ }));