@daytonaio/sdk 0.192.0 → 0.193.0-alpha.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 (126) hide show
  1. package/LICENSE +1 -1
  2. package/cjs/CodeInterpreter.js +1 -1
  3. package/cjs/CodeInterpreter.js.map +1 -1
  4. package/cjs/ComputerUse.js.map +1 -1
  5. package/cjs/Daytona.d.ts +11 -5
  6. package/cjs/Daytona.js +48 -16
  7. package/cjs/Daytona.js.map +1 -1
  8. package/cjs/FileSystem.js +1 -1
  9. package/cjs/FileSystem.js.map +1 -1
  10. package/cjs/Git.js +1 -1
  11. package/cjs/Git.js.map +1 -1
  12. package/cjs/Image.js +1 -1
  13. package/cjs/Image.js.map +1 -1
  14. package/cjs/LspServer.js +1 -1
  15. package/cjs/LspServer.js.map +1 -1
  16. package/cjs/ObjectStorage.js +1 -1
  17. package/cjs/ObjectStorage.js.map +1 -1
  18. package/cjs/Process.js +1 -1
  19. package/cjs/Process.js.map +1 -1
  20. package/cjs/PtyHandle.js +1 -1
  21. package/cjs/PtyHandle.js.map +1 -1
  22. package/cjs/Sandbox.d.ts +5 -1
  23. package/cjs/Sandbox.js +7 -3
  24. package/cjs/Sandbox.js.map +1 -1
  25. package/cjs/Session.d.ts +152 -0
  26. package/cjs/Session.js +523 -0
  27. package/cjs/Session.js.map +1 -0
  28. package/cjs/Snapshot.js +1 -1
  29. package/cjs/Snapshot.js.map +1 -1
  30. package/cjs/Volume.js +1 -1
  31. package/cjs/Volume.js.map +1 -1
  32. package/cjs/errors/DaytonaError.d.ts +4 -2
  33. package/cjs/errors/DaytonaError.js +11 -7
  34. package/cjs/errors/DaytonaError.js.map +1 -1
  35. package/cjs/index.d.ts +2 -1
  36. package/cjs/index.js +6 -2
  37. package/cjs/index.js.map +1 -1
  38. package/cjs/types/Charts.js +1 -1
  39. package/cjs/types/Charts.js.map +1 -1
  40. package/cjs/types/CodeInterpreter.js +1 -1
  41. package/cjs/types/CodeInterpreter.js.map +1 -1
  42. package/cjs/types/ExecuteResponse.js +1 -1
  43. package/cjs/types/ExecuteResponse.js.map +1 -1
  44. package/cjs/types/Pty.js +1 -1
  45. package/cjs/types/Pty.js.map +1 -1
  46. package/cjs/utils/Binary.js +1 -1
  47. package/cjs/utils/Binary.js.map +1 -1
  48. package/cjs/utils/FileTransfer.js +1 -1
  49. package/cjs/utils/FileTransfer.js.map +1 -1
  50. package/cjs/utils/Import.js +1 -1
  51. package/cjs/utils/Import.js.map +1 -1
  52. package/cjs/utils/Multipart.js +1 -1
  53. package/cjs/utils/Multipart.js.map +1 -1
  54. package/cjs/utils/Runtime.js +1 -1
  55. package/cjs/utils/Runtime.js.map +1 -1
  56. package/cjs/utils/Stream.js.map +1 -1
  57. package/cjs/utils/WebSocket.js +1 -1
  58. package/cjs/utils/WebSocket.js.map +1 -1
  59. package/cjs/utils/otel.decorator.js +1 -1
  60. package/cjs/utils/otel.decorator.js.map +1 -1
  61. package/esm/CodeInterpreter.js +1 -1
  62. package/esm/CodeInterpreter.js.map +1 -1
  63. package/esm/ComputerUse.js.map +1 -1
  64. package/esm/Daytona.d.ts +11 -5
  65. package/esm/Daytona.js +49 -17
  66. package/esm/Daytona.js.map +1 -1
  67. package/esm/FileSystem.js +1 -1
  68. package/esm/FileSystem.js.map +1 -1
  69. package/esm/Git.js +1 -1
  70. package/esm/Git.js.map +1 -1
  71. package/esm/Image.js +1 -1
  72. package/esm/Image.js.map +1 -1
  73. package/esm/LspServer.js +1 -1
  74. package/esm/LspServer.js.map +1 -1
  75. package/esm/ObjectStorage.js +1 -1
  76. package/esm/ObjectStorage.js.map +1 -1
  77. package/esm/Process.js +1 -1
  78. package/esm/Process.js.map +1 -1
  79. package/esm/PtyHandle.js +1 -1
  80. package/esm/PtyHandle.js.map +1 -1
  81. package/esm/Sandbox.d.ts +5 -1
  82. package/esm/Sandbox.js +7 -3
  83. package/esm/Sandbox.js.map +1 -1
  84. package/esm/Session.d.ts +152 -0
  85. package/esm/Session.js +516 -0
  86. package/esm/Session.js.map +1 -0
  87. package/esm/Snapshot.js +1 -1
  88. package/esm/Snapshot.js.map +1 -1
  89. package/esm/Volume.js +1 -1
  90. package/esm/Volume.js.map +1 -1
  91. package/esm/errors/DaytonaError.d.ts +4 -2
  92. package/esm/errors/DaytonaError.js +11 -7
  93. package/esm/errors/DaytonaError.js.map +1 -1
  94. package/esm/index.d.ts +2 -1
  95. package/esm/index.js +2 -1
  96. package/esm/index.js.map +1 -1
  97. package/esm/types/Charts.js +1 -1
  98. package/esm/types/Charts.js.map +1 -1
  99. package/esm/types/CodeInterpreter.js +1 -1
  100. package/esm/types/CodeInterpreter.js.map +1 -1
  101. package/esm/types/ExecuteResponse.js +1 -1
  102. package/esm/types/ExecuteResponse.js.map +1 -1
  103. package/esm/types/Pty.js +1 -1
  104. package/esm/types/Pty.js.map +1 -1
  105. package/esm/utils/Binary.js +1 -1
  106. package/esm/utils/Binary.js.map +1 -1
  107. package/esm/utils/FileTransfer.js +1 -1
  108. package/esm/utils/FileTransfer.js.map +1 -1
  109. package/esm/utils/Import.js +2 -2
  110. package/esm/utils/Import.js.map +1 -1
  111. package/esm/utils/Multipart.js +1 -1
  112. package/esm/utils/Multipart.js.map +1 -1
  113. package/esm/utils/Runtime.js +1 -1
  114. package/esm/utils/Runtime.js.map +1 -1
  115. package/esm/utils/Stream.js.map +1 -1
  116. package/esm/utils/WebSocket.js +1 -1
  117. package/esm/utils/WebSocket.js.map +1 -1
  118. package/esm/utils/otel.decorator.js +1 -1
  119. package/esm/utils/otel.decorator.js.map +1 -1
  120. package/package.json +7 -6
  121. package/cjs/Secret.d.ts +0 -139
  122. package/cjs/Secret.js +0 -143
  123. package/cjs/Secret.js.map +0 -1
  124. package/esm/Secret.d.ts +0 -139
  125. package/esm/Secret.js +0 -140
  126. package/esm/Secret.js.map +0 -1
package/cjs/Secret.d.ts DELETED
@@ -1,139 +0,0 @@
1
- import { SecretApi } from '@daytona/api-client';
2
- import type { Secret as SecretModel } from '@daytona/api-client';
3
- /**
4
- * Represents an organization-scoped Secret.
5
- *
6
- * The plaintext `value` is write-only and is never returned by the API. When a Secret is
7
- * referenced from a Sandbox, the injected environment variable holds the opaque
8
- * {@link Secret.placeholder} token, not the real value. The real value is substituted
9
- * transparently on outbound requests to the Secret's allowed {@link Secret.hosts}.
10
- *
11
- * @property {string} id - Unique identifier for the Secret
12
- * @property {string} name - Name of the Secret (unique within the organization)
13
- * @property {string} [description] - Optional description of the Secret
14
- * @property {string} placeholder - Opaque token (`dtn_secret_<id>`) injected as the env var value
15
- * @property {string[]} hosts - Hosts the Secret value may be sent to (may be empty)
16
- * @property {string} createdAt - Date and time when the Secret was created
17
- * @property {string} updatedAt - Date and time when the Secret was last updated
18
- */
19
- export type Secret = SecretModel & {
20
- __brand: 'Secret';
21
- };
22
- /**
23
- * Parameters for creating a new Secret.
24
- *
25
- * @interface
26
- * @property {string} name - Name of the Secret. Must match `^[a-zA-Z_][a-zA-Z0-9_-]*$` and be
27
- * unique within the organization.
28
- * @property {string} value - The plaintext Secret value. Stored encrypted and never returned by the API.
29
- * @property {string} [description] - Optional description of the Secret
30
- * @property {string[]} [hosts] - Hosts the Secret value may be sent to. Each entry is a hostname
31
- * (`api.example.com`) or a `*.` wildcard (`*.example.com`); ports are not supported. Omit to leave
32
- * the Secret unrestricted.
33
- */
34
- export interface CreateSecretParams {
35
- name: string;
36
- value: string;
37
- description?: string;
38
- hosts?: string[];
39
- }
40
- /**
41
- * Parameters for updating an existing Secret. Omitted fields are left unchanged.
42
- *
43
- * @interface
44
- * @property {string} [value] - Replaces the stored Secret value when present
45
- * @property {string} [description] - Optional description of the Secret
46
- * @property {string[]} [hosts] - Hosts the Secret value may be sent to. Same constraints as
47
- * {@link CreateSecretParams.hosts}.
48
- */
49
- export interface UpdateSecretParams {
50
- value?: string;
51
- description?: string;
52
- hosts?: string[];
53
- }
54
- /**
55
- * Service for managing organization-scoped Daytona Secrets.
56
- *
57
- * This service provides methods to create, list, get, update, and delete Secrets. Secrets can be
58
- * mounted into Sandboxes as environment variables by referencing them via the `secrets` field on
59
- * the create-sandbox parameters. The Sandbox only ever sees the Secret's opaque placeholder; the
60
- * real value is substituted at the network egress layer for the Secret's allowed hosts.
61
- *
62
- * @class
63
- */
64
- export declare class SecretService {
65
- private secretApi;
66
- constructor(secretApi: SecretApi);
67
- /**
68
- * Lists all Secrets in the organization.
69
- *
70
- * @returns {Promise<Secret[]>} List of all Secrets in the organization
71
- *
72
- * @example
73
- * const daytona = new Daytona();
74
- * const secrets = await daytona.secret.list();
75
- * console.log(`Found ${secrets.length} secrets`);
76
- * secrets.forEach(secret => console.log(`${secret.name} (${secret.id})`));
77
- */
78
- list(): Promise<Secret[]>;
79
- /**
80
- * Gets a Secret by its ID.
81
- *
82
- * @param {string} secretId - ID of the Secret to retrieve
83
- * @returns {Promise<Secret>} The requested Secret
84
- * @throws {DaytonaNotFoundError} If the Secret does not exist
85
- *
86
- * @example
87
- * const daytona = new Daytona();
88
- * const secret = await daytona.secret.get("secret-id");
89
- * console.log(`Secret ${secret.name} can be used on ${secret.hosts.join(', ')}`);
90
- */
91
- get(secretId: string): Promise<Secret>;
92
- /**
93
- * Creates a new Secret.
94
- *
95
- * @param {CreateSecretParams} params - Parameters for the new Secret
96
- * @returns {Promise<Secret>} The newly created Secret (without the plaintext `value`)
97
- * @throws {DaytonaConflictError} If a Secret with the same name already exists in the organization
98
- *
99
- * @example
100
- * const daytona = new Daytona();
101
- * const secret = await daytona.secret.create({
102
- * name: "anthropic-prod",
103
- * value: "sk-ant-...",
104
- * hosts: ["api.anthropic.com"],
105
- * });
106
- * console.log(`Created secret ${secret.name} with placeholder ${secret.placeholder}`);
107
- */
108
- create(params: CreateSecretParams): Promise<Secret>;
109
- /**
110
- * Updates an existing Secret. Omitted fields are left unchanged.
111
- *
112
- * @param {string} secretId - ID of the Secret to update
113
- * @param {UpdateSecretParams} params - Fields to update
114
- * @returns {Promise<Secret>} The updated Secret
115
- * @throws {DaytonaNotFoundError} If the Secret does not exist
116
- *
117
- * @example
118
- * const daytona = new Daytona();
119
- * const secret = await daytona.secret.update("secret-id", {
120
- * value: "sk-ant-new-value",
121
- * hosts: ["api.anthropic.com", "*.anthropic.com"],
122
- * });
123
- */
124
- update(secretId: string, params: UpdateSecretParams): Promise<Secret>;
125
- /**
126
- * Deletes a Secret.
127
- *
128
- * @param {string} secretId - ID of the Secret to delete
129
- * @returns {Promise<void>}
130
- * @throws {DaytonaNotFoundError} If the Secret does not exist
131
- *
132
- * @example
133
- * const daytona = new Daytona();
134
- * await daytona.secret.delete("secret-id");
135
- * console.log("Secret deleted successfully");
136
- */
137
- delete(secretId: string): Promise<void>;
138
- }
139
- //# sourceMappingURL=Secret.d.ts.map
package/cjs/Secret.js DELETED
@@ -1,143 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright Daytona Platforms Inc.
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SecretService = void 0;
8
- const tslib_1 = require("tslib");
9
- const otel_decorator_1 = require("./utils/otel.decorator");
10
- /**
11
- * Service for managing organization-scoped Daytona Secrets.
12
- *
13
- * This service provides methods to create, list, get, update, and delete Secrets. Secrets can be
14
- * mounted into Sandboxes as environment variables by referencing them via the `secrets` field on
15
- * the create-sandbox parameters. The Sandbox only ever sees the Secret's opaque placeholder; the
16
- * real value is substituted at the network egress layer for the Secret's allowed hosts.
17
- *
18
- * @class
19
- */
20
- let SecretService = (() => {
21
- let _instanceExtraInitializers = [];
22
- let _list_decorators;
23
- let _get_decorators;
24
- let _create_decorators;
25
- let _update_decorators;
26
- let _delete_decorators;
27
- return class SecretService {
28
- static {
29
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
30
- _list_decorators = [(0, otel_decorator_1.WithInstrumentation)()];
31
- _get_decorators = [(0, otel_decorator_1.WithInstrumentation)()];
32
- _create_decorators = [(0, otel_decorator_1.WithInstrumentation)()];
33
- _update_decorators = [(0, otel_decorator_1.WithInstrumentation)()];
34
- _delete_decorators = [(0, otel_decorator_1.WithInstrumentation)()];
35
- tslib_1.__esDecorate(this, null, _list_decorators, { kind: "method", name: "list", static: false, private: false, access: { has: obj => "list" in obj, get: obj => obj.list }, metadata: _metadata }, null, _instanceExtraInitializers);
36
- tslib_1.__esDecorate(this, null, _get_decorators, { kind: "method", name: "get", static: false, private: false, access: { has: obj => "get" in obj, get: obj => obj.get }, metadata: _metadata }, null, _instanceExtraInitializers);
37
- tslib_1.__esDecorate(this, null, _create_decorators, { kind: "method", name: "create", static: false, private: false, access: { has: obj => "create" in obj, get: obj => obj.create }, metadata: _metadata }, null, _instanceExtraInitializers);
38
- tslib_1.__esDecorate(this, null, _update_decorators, { kind: "method", name: "update", static: false, private: false, access: { has: obj => "update" in obj, get: obj => obj.update }, metadata: _metadata }, null, _instanceExtraInitializers);
39
- tslib_1.__esDecorate(this, null, _delete_decorators, { kind: "method", name: "delete", static: false, private: false, access: { has: obj => "delete" in obj, get: obj => obj.delete }, metadata: _metadata }, null, _instanceExtraInitializers);
40
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
41
- }
42
- secretApi = tslib_1.__runInitializers(this, _instanceExtraInitializers);
43
- constructor(secretApi) {
44
- this.secretApi = secretApi;
45
- }
46
- /**
47
- * Lists all Secrets in the organization.
48
- *
49
- * @returns {Promise<Secret[]>} List of all Secrets in the organization
50
- *
51
- * @example
52
- * const daytona = new Daytona();
53
- * const secrets = await daytona.secret.list();
54
- * console.log(`Found ${secrets.length} secrets`);
55
- * secrets.forEach(secret => console.log(`${secret.name} (${secret.id})`));
56
- */
57
- async list() {
58
- const response = await this.secretApi.listSecrets();
59
- return response.data;
60
- }
61
- /**
62
- * Gets a Secret by its ID.
63
- *
64
- * @param {string} secretId - ID of the Secret to retrieve
65
- * @returns {Promise<Secret>} The requested Secret
66
- * @throws {DaytonaNotFoundError} If the Secret does not exist
67
- *
68
- * @example
69
- * const daytona = new Daytona();
70
- * const secret = await daytona.secret.get("secret-id");
71
- * console.log(`Secret ${secret.name} can be used on ${secret.hosts.join(', ')}`);
72
- */
73
- async get(secretId) {
74
- const response = await this.secretApi.getSecret(secretId);
75
- return response.data;
76
- }
77
- /**
78
- * Creates a new Secret.
79
- *
80
- * @param {CreateSecretParams} params - Parameters for the new Secret
81
- * @returns {Promise<Secret>} The newly created Secret (without the plaintext `value`)
82
- * @throws {DaytonaConflictError} If a Secret with the same name already exists in the organization
83
- *
84
- * @example
85
- * const daytona = new Daytona();
86
- * const secret = await daytona.secret.create({
87
- * name: "anthropic-prod",
88
- * value: "sk-ant-...",
89
- * hosts: ["api.anthropic.com"],
90
- * });
91
- * console.log(`Created secret ${secret.name} with placeholder ${secret.placeholder}`);
92
- */
93
- async create(params) {
94
- const response = await this.secretApi.createSecret({
95
- name: params.name,
96
- value: params.value,
97
- description: params.description,
98
- hosts: params.hosts,
99
- });
100
- return response.data;
101
- }
102
- /**
103
- * Updates an existing Secret. Omitted fields are left unchanged.
104
- *
105
- * @param {string} secretId - ID of the Secret to update
106
- * @param {UpdateSecretParams} params - Fields to update
107
- * @returns {Promise<Secret>} The updated Secret
108
- * @throws {DaytonaNotFoundError} If the Secret does not exist
109
- *
110
- * @example
111
- * const daytona = new Daytona();
112
- * const secret = await daytona.secret.update("secret-id", {
113
- * value: "sk-ant-new-value",
114
- * hosts: ["api.anthropic.com", "*.anthropic.com"],
115
- * });
116
- */
117
- async update(secretId, params) {
118
- const response = await this.secretApi.updateSecret(secretId, {
119
- value: params.value,
120
- description: params.description,
121
- hosts: params.hosts,
122
- });
123
- return response.data;
124
- }
125
- /**
126
- * Deletes a Secret.
127
- *
128
- * @param {string} secretId - ID of the Secret to delete
129
- * @returns {Promise<void>}
130
- * @throws {DaytonaNotFoundError} If the Secret does not exist
131
- *
132
- * @example
133
- * const daytona = new Daytona();
134
- * await daytona.secret.delete("secret-id");
135
- * console.log("Secret deleted successfully");
136
- */
137
- async delete(secretId) {
138
- await this.secretApi.deleteSecret(secretId);
139
- }
140
- };
141
- })();
142
- exports.SecretService = SecretService;
143
- //# sourceMappingURL=Secret.js.map
package/cjs/Secret.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Secret.js","sourceRoot":"","sources":["../../../../sdk-typescript/src/Secret.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAIH,2DAA4D;AAsD5D;;;;;;;;;GASG;IACU,aAAa;;;;;;;iBAAb,aAAa;;;gCAcvB,IAAA,oCAAmB,GAAE;+BAkBrB,IAAA,oCAAmB,GAAE;kCAsBrB,IAAA,oCAAmB,GAAE;kCA0BrB,IAAA,oCAAmB,GAAE;kCAsBrB,IAAA,oCAAmB,GAAE;YAvFtB,uKAAM,IAAI,6DAGT;YAeD,oKAAM,GAAG,6DAGR;YAmBD,6KAAM,MAAM,6DAQX;YAkBD,6KAAM,MAAM,6DAOX;YAeD,6KAAM,MAAM,6DAEX;;;QAxGmB,SAAS,GADlB,2DAAa;QACxB,YAAoB,SAAoB;YAApB,cAAS,GAAT,SAAS,CAAW;QAAG,CAAC;QAE5C;;;;;;;;;;WAUG;QAEH,KAAK,CAAC,IAAI;YACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAA;YACnD,OAAO,QAAQ,CAAC,IAAgB,CAAA;QAClC,CAAC;QAED;;;;;;;;;;;WAWG;QAEH,KAAK,CAAC,GAAG,CAAC,QAAgB;YACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YACzD,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAED;;;;;;;;;;;;;;;WAeG;QAEH,KAAK,CAAC,MAAM,CAAC,MAA0B;YACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;gBACjD,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAA;YACF,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAED;;;;;;;;;;;;;;WAcG;QAEH,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,MAA0B;YACvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE;gBAC3D,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAA;YACF,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAED;;;;;;;;;;;WAWG;QAEH,KAAK,CAAC,MAAM,CAAC,QAAgB;YAC3B,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAC7C,CAAC;;;AAzGU,sCAAa"}
package/esm/Secret.d.ts DELETED
@@ -1,139 +0,0 @@
1
- import { SecretApi } from '@daytona/api-client';
2
- import type { Secret as SecretModel } from '@daytona/api-client';
3
- /**
4
- * Represents an organization-scoped Secret.
5
- *
6
- * The plaintext `value` is write-only and is never returned by the API. When a Secret is
7
- * referenced from a Sandbox, the injected environment variable holds the opaque
8
- * {@link Secret.placeholder} token, not the real value. The real value is substituted
9
- * transparently on outbound requests to the Secret's allowed {@link Secret.hosts}.
10
- *
11
- * @property {string} id - Unique identifier for the Secret
12
- * @property {string} name - Name of the Secret (unique within the organization)
13
- * @property {string} [description] - Optional description of the Secret
14
- * @property {string} placeholder - Opaque token (`dtn_secret_<id>`) injected as the env var value
15
- * @property {string[]} hosts - Hosts the Secret value may be sent to (may be empty)
16
- * @property {string} createdAt - Date and time when the Secret was created
17
- * @property {string} updatedAt - Date and time when the Secret was last updated
18
- */
19
- export type Secret = SecretModel & {
20
- __brand: 'Secret';
21
- };
22
- /**
23
- * Parameters for creating a new Secret.
24
- *
25
- * @interface
26
- * @property {string} name - Name of the Secret. Must match `^[a-zA-Z_][a-zA-Z0-9_-]*$` and be
27
- * unique within the organization.
28
- * @property {string} value - The plaintext Secret value. Stored encrypted and never returned by the API.
29
- * @property {string} [description] - Optional description of the Secret
30
- * @property {string[]} [hosts] - Hosts the Secret value may be sent to. Each entry is a hostname
31
- * (`api.example.com`) or a `*.` wildcard (`*.example.com`); ports are not supported. Omit to leave
32
- * the Secret unrestricted.
33
- */
34
- export interface CreateSecretParams {
35
- name: string;
36
- value: string;
37
- description?: string;
38
- hosts?: string[];
39
- }
40
- /**
41
- * Parameters for updating an existing Secret. Omitted fields are left unchanged.
42
- *
43
- * @interface
44
- * @property {string} [value] - Replaces the stored Secret value when present
45
- * @property {string} [description] - Optional description of the Secret
46
- * @property {string[]} [hosts] - Hosts the Secret value may be sent to. Same constraints as
47
- * {@link CreateSecretParams.hosts}.
48
- */
49
- export interface UpdateSecretParams {
50
- value?: string;
51
- description?: string;
52
- hosts?: string[];
53
- }
54
- /**
55
- * Service for managing organization-scoped Daytona Secrets.
56
- *
57
- * This service provides methods to create, list, get, update, and delete Secrets. Secrets can be
58
- * mounted into Sandboxes as environment variables by referencing them via the `secrets` field on
59
- * the create-sandbox parameters. The Sandbox only ever sees the Secret's opaque placeholder; the
60
- * real value is substituted at the network egress layer for the Secret's allowed hosts.
61
- *
62
- * @class
63
- */
64
- export declare class SecretService {
65
- private secretApi;
66
- constructor(secretApi: SecretApi);
67
- /**
68
- * Lists all Secrets in the organization.
69
- *
70
- * @returns {Promise<Secret[]>} List of all Secrets in the organization
71
- *
72
- * @example
73
- * const daytona = new Daytona();
74
- * const secrets = await daytona.secret.list();
75
- * console.log(`Found ${secrets.length} secrets`);
76
- * secrets.forEach(secret => console.log(`${secret.name} (${secret.id})`));
77
- */
78
- list(): Promise<Secret[]>;
79
- /**
80
- * Gets a Secret by its ID.
81
- *
82
- * @param {string} secretId - ID of the Secret to retrieve
83
- * @returns {Promise<Secret>} The requested Secret
84
- * @throws {DaytonaNotFoundError} If the Secret does not exist
85
- *
86
- * @example
87
- * const daytona = new Daytona();
88
- * const secret = await daytona.secret.get("secret-id");
89
- * console.log(`Secret ${secret.name} can be used on ${secret.hosts.join(', ')}`);
90
- */
91
- get(secretId: string): Promise<Secret>;
92
- /**
93
- * Creates a new Secret.
94
- *
95
- * @param {CreateSecretParams} params - Parameters for the new Secret
96
- * @returns {Promise<Secret>} The newly created Secret (without the plaintext `value`)
97
- * @throws {DaytonaConflictError} If a Secret with the same name already exists in the organization
98
- *
99
- * @example
100
- * const daytona = new Daytona();
101
- * const secret = await daytona.secret.create({
102
- * name: "anthropic-prod",
103
- * value: "sk-ant-...",
104
- * hosts: ["api.anthropic.com"],
105
- * });
106
- * console.log(`Created secret ${secret.name} with placeholder ${secret.placeholder}`);
107
- */
108
- create(params: CreateSecretParams): Promise<Secret>;
109
- /**
110
- * Updates an existing Secret. Omitted fields are left unchanged.
111
- *
112
- * @param {string} secretId - ID of the Secret to update
113
- * @param {UpdateSecretParams} params - Fields to update
114
- * @returns {Promise<Secret>} The updated Secret
115
- * @throws {DaytonaNotFoundError} If the Secret does not exist
116
- *
117
- * @example
118
- * const daytona = new Daytona();
119
- * const secret = await daytona.secret.update("secret-id", {
120
- * value: "sk-ant-new-value",
121
- * hosts: ["api.anthropic.com", "*.anthropic.com"],
122
- * });
123
- */
124
- update(secretId: string, params: UpdateSecretParams): Promise<Secret>;
125
- /**
126
- * Deletes a Secret.
127
- *
128
- * @param {string} secretId - ID of the Secret to delete
129
- * @returns {Promise<void>}
130
- * @throws {DaytonaNotFoundError} If the Secret does not exist
131
- *
132
- * @example
133
- * const daytona = new Daytona();
134
- * await daytona.secret.delete("secret-id");
135
- * console.log("Secret deleted successfully");
136
- */
137
- delete(secretId: string): Promise<void>;
138
- }
139
- //# sourceMappingURL=Secret.d.ts.map
package/esm/Secret.js DELETED
@@ -1,140 +0,0 @@
1
- /*
2
- * Copyright Daytona Platforms Inc.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { __esDecorate, __runInitializers } from "tslib";
6
- import { WithInstrumentation } from './utils/otel.decorator.js';
7
- /**
8
- * Service for managing organization-scoped Daytona Secrets.
9
- *
10
- * This service provides methods to create, list, get, update, and delete Secrets. Secrets can be
11
- * mounted into Sandboxes as environment variables by referencing them via the `secrets` field on
12
- * the create-sandbox parameters. The Sandbox only ever sees the Secret's opaque placeholder; the
13
- * real value is substituted at the network egress layer for the Secret's allowed hosts.
14
- *
15
- * @class
16
- */
17
- let SecretService = (() => {
18
- let _instanceExtraInitializers = [];
19
- let _list_decorators;
20
- let _get_decorators;
21
- let _create_decorators;
22
- let _update_decorators;
23
- let _delete_decorators;
24
- return class SecretService {
25
- static {
26
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
27
- _list_decorators = [WithInstrumentation()];
28
- _get_decorators = [WithInstrumentation()];
29
- _create_decorators = [WithInstrumentation()];
30
- _update_decorators = [WithInstrumentation()];
31
- _delete_decorators = [WithInstrumentation()];
32
- __esDecorate(this, null, _list_decorators, { kind: "method", name: "list", static: false, private: false, access: { has: obj => "list" in obj, get: obj => obj.list }, metadata: _metadata }, null, _instanceExtraInitializers);
33
- __esDecorate(this, null, _get_decorators, { kind: "method", name: "get", static: false, private: false, access: { has: obj => "get" in obj, get: obj => obj.get }, metadata: _metadata }, null, _instanceExtraInitializers);
34
- __esDecorate(this, null, _create_decorators, { kind: "method", name: "create", static: false, private: false, access: { has: obj => "create" in obj, get: obj => obj.create }, metadata: _metadata }, null, _instanceExtraInitializers);
35
- __esDecorate(this, null, _update_decorators, { kind: "method", name: "update", static: false, private: false, access: { has: obj => "update" in obj, get: obj => obj.update }, metadata: _metadata }, null, _instanceExtraInitializers);
36
- __esDecorate(this, null, _delete_decorators, { kind: "method", name: "delete", static: false, private: false, access: { has: obj => "delete" in obj, get: obj => obj.delete }, metadata: _metadata }, null, _instanceExtraInitializers);
37
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
38
- }
39
- secretApi = __runInitializers(this, _instanceExtraInitializers);
40
- constructor(secretApi) {
41
- this.secretApi = secretApi;
42
- }
43
- /**
44
- * Lists all Secrets in the organization.
45
- *
46
- * @returns {Promise<Secret[]>} List of all Secrets in the organization
47
- *
48
- * @example
49
- * const daytona = new Daytona();
50
- * const secrets = await daytona.secret.list();
51
- * console.log(`Found ${secrets.length} secrets`);
52
- * secrets.forEach(secret => console.log(`${secret.name} (${secret.id})`));
53
- */
54
- async list() {
55
- const response = await this.secretApi.listSecrets();
56
- return response.data;
57
- }
58
- /**
59
- * Gets a Secret by its ID.
60
- *
61
- * @param {string} secretId - ID of the Secret to retrieve
62
- * @returns {Promise<Secret>} The requested Secret
63
- * @throws {DaytonaNotFoundError} If the Secret does not exist
64
- *
65
- * @example
66
- * const daytona = new Daytona();
67
- * const secret = await daytona.secret.get("secret-id");
68
- * console.log(`Secret ${secret.name} can be used on ${secret.hosts.join(', ')}`);
69
- */
70
- async get(secretId) {
71
- const response = await this.secretApi.getSecret(secretId);
72
- return response.data;
73
- }
74
- /**
75
- * Creates a new Secret.
76
- *
77
- * @param {CreateSecretParams} params - Parameters for the new Secret
78
- * @returns {Promise<Secret>} The newly created Secret (without the plaintext `value`)
79
- * @throws {DaytonaConflictError} If a Secret with the same name already exists in the organization
80
- *
81
- * @example
82
- * const daytona = new Daytona();
83
- * const secret = await daytona.secret.create({
84
- * name: "anthropic-prod",
85
- * value: "sk-ant-...",
86
- * hosts: ["api.anthropic.com"],
87
- * });
88
- * console.log(`Created secret ${secret.name} with placeholder ${secret.placeholder}`);
89
- */
90
- async create(params) {
91
- const response = await this.secretApi.createSecret({
92
- name: params.name,
93
- value: params.value,
94
- description: params.description,
95
- hosts: params.hosts,
96
- });
97
- return response.data;
98
- }
99
- /**
100
- * Updates an existing Secret. Omitted fields are left unchanged.
101
- *
102
- * @param {string} secretId - ID of the Secret to update
103
- * @param {UpdateSecretParams} params - Fields to update
104
- * @returns {Promise<Secret>} The updated Secret
105
- * @throws {DaytonaNotFoundError} If the Secret does not exist
106
- *
107
- * @example
108
- * const daytona = new Daytona();
109
- * const secret = await daytona.secret.update("secret-id", {
110
- * value: "sk-ant-new-value",
111
- * hosts: ["api.anthropic.com", "*.anthropic.com"],
112
- * });
113
- */
114
- async update(secretId, params) {
115
- const response = await this.secretApi.updateSecret(secretId, {
116
- value: params.value,
117
- description: params.description,
118
- hosts: params.hosts,
119
- });
120
- return response.data;
121
- }
122
- /**
123
- * Deletes a Secret.
124
- *
125
- * @param {string} secretId - ID of the Secret to delete
126
- * @returns {Promise<void>}
127
- * @throws {DaytonaNotFoundError} If the Secret does not exist
128
- *
129
- * @example
130
- * const daytona = new Daytona();
131
- * await daytona.secret.delete("secret-id");
132
- * console.log("Secret deleted successfully");
133
- */
134
- async delete(secretId) {
135
- await this.secretApi.deleteSecret(secretId);
136
- }
137
- };
138
- })();
139
- export { SecretService };
140
- //# sourceMappingURL=Secret.js.map
package/esm/Secret.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Secret.js","sourceRoot":"","sources":["../../../../sdk-typescript/src/Secret.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAsD5D;;;;;;;;;GASG;IACU,aAAa;;;;;;;iBAAb,aAAa;;;gCAcvB,mBAAmB,EAAE;+BAkBrB,mBAAmB,EAAE;kCAsBrB,mBAAmB,EAAE;kCA0BrB,mBAAmB,EAAE;kCAsBrB,mBAAmB,EAAE;YAvFtB,+JAAM,IAAI,6DAGT;YAeD,4JAAM,GAAG,6DAGR;YAmBD,qKAAM,MAAM,6DAQX;YAkBD,qKAAM,MAAM,6DAOX;YAeD,qKAAM,MAAM,6DAEX;;;QAxGmB,SAAS,GADlB,mDAAa;QACxB,YAAoB,SAAoB;YAApB,cAAS,GAAT,SAAS,CAAW;QAAG,CAAC;QAE5C;;;;;;;;;;WAUG;QAEH,KAAK,CAAC,IAAI;YACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAA;YACnD,OAAO,QAAQ,CAAC,IAAgB,CAAA;QAClC,CAAC;QAED;;;;;;;;;;;WAWG;QAEH,KAAK,CAAC,GAAG,CAAC,QAAgB;YACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YACzD,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAED;;;;;;;;;;;;;;;WAeG;QAEH,KAAK,CAAC,MAAM,CAAC,MAA0B;YACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;gBACjD,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAA;YACF,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAED;;;;;;;;;;;;;;WAcG;QAEH,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,MAA0B;YACvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE;gBAC3D,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAA;YACF,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAED;;;;;;;;;;;WAWG;QAEH,KAAK,CAAC,MAAM,CAAC,QAAgB;YAC3B,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAC7C,CAAC;;;SAzGU,aAAa"}