@phala/cloud 0.2.1-beta.4 → 0.2.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 (69) hide show
  1. package/LICENSE +201 -0
  2. package/dist/actions/apps/get_app_cvms.d.ts +30 -0
  3. package/dist/actions/apps/get_app_info.d.ts +30 -0
  4. package/dist/actions/apps/get_app_list.d.ts +74 -0
  5. package/dist/actions/apps/get_app_revision_detail.d.ts +48 -0
  6. package/dist/actions/apps/get_app_revisions.d.ts +42 -0
  7. package/dist/actions/cvms/commit_cvm_compose_file_update.d.ts +7 -7
  8. package/dist/actions/cvms/commit_cvm_provision.d.ts +31 -31
  9. package/dist/actions/cvms/delete_cvm.d.ts +10 -7
  10. package/dist/actions/cvms/get_available_os_images.d.ts +10 -7
  11. package/dist/actions/cvms/get_cvm_attestation.d.ts +10 -7
  12. package/dist/actions/cvms/get_cvm_compose_file.d.ts +18 -15
  13. package/dist/actions/cvms/get_cvm_containers_stats.d.ts +14 -11
  14. package/dist/actions/cvms/get_cvm_docker_compose.d.ts +10 -7
  15. package/dist/actions/cvms/get_cvm_info.d.ts +19 -35
  16. package/dist/actions/cvms/get_cvm_list.d.ts +11 -537
  17. package/dist/actions/cvms/get_cvm_network.d.ts +10 -7
  18. package/dist/actions/cvms/get_cvm_prelaunch_script.d.ts +42 -0
  19. package/dist/actions/cvms/get_cvm_state.d.ts +10 -7
  20. package/dist/actions/cvms/get_cvm_stats.d.ts +10 -7
  21. package/dist/actions/cvms/get_cvm_status_batch.d.ts +167 -0
  22. package/dist/actions/cvms/provision_cvm.d.ts +404 -21
  23. package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +32 -32
  24. package/dist/actions/cvms/restart_cvm.d.ts +17 -14
  25. package/dist/actions/cvms/shutdown_cvm.d.ts +18 -15
  26. package/dist/actions/cvms/start_cvm.d.ts +18 -15
  27. package/dist/actions/cvms/stop_cvm.d.ts +18 -15
  28. package/dist/actions/cvms/update_cvm_envs.d.ts +32 -118
  29. package/dist/actions/cvms/update_cvm_resources.d.ts +13 -10
  30. package/dist/actions/cvms/update_cvm_visibility.d.ts +33 -14
  31. package/dist/actions/cvms/update_docker_compose.d.ts +420 -0
  32. package/dist/actions/cvms/update_os_image.d.ts +9 -6
  33. package/dist/actions/cvms/update_prelaunch_script.d.ts +417 -0
  34. package/dist/actions/cvms/watch_cvm_state.d.ts +1 -1
  35. package/dist/actions/get_available_nodes.d.ts +6 -6
  36. package/dist/actions/get_current_user.d.ts +36 -89
  37. package/dist/actions/index.d.ts +13 -2
  38. package/dist/actions/kms/get_app_env_encrypt_pubkey.d.ts +6 -6
  39. package/dist/actions/kms/get_kms_info.d.ts +6 -6
  40. package/dist/actions/kms/get_kms_list.d.ts +6 -6
  41. package/dist/actions/kms/next_app_ids.d.ts +6 -6
  42. package/dist/actions/list-instance-types.d.ts +16 -16
  43. package/dist/actions/workspaces/get_workspace.d.ts +6 -6
  44. package/dist/actions/workspaces/get_workspace_nodes.d.ts +266 -0
  45. package/dist/actions/workspaces/get_workspace_quotas.d.ts +1169 -0
  46. package/dist/actions/workspaces/list_workspaces.d.ts +6 -6
  47. package/dist/client.d.ts +49 -9
  48. package/dist/create-client.d.ts +72 -36
  49. package/dist/credentials/current_user_v20251028.d.ts +30 -0
  50. package/dist/credentials/current_user_v20260121.d.ts +276 -0
  51. package/dist/credentials/index.d.ts +4 -0
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.js +1714 -664
  54. package/dist/index.mjs +1629 -657
  55. package/dist/types/app_info_v20251028.d.ts +1266 -0
  56. package/dist/types/app_info_v20260121.d.ts +3293 -0
  57. package/dist/types/app_revision.d.ts +453 -0
  58. package/dist/types/client.d.ts +40 -2
  59. package/dist/types/cvm_id.d.ts +29 -11
  60. package/dist/types/cvm_info.d.ts +16 -502
  61. package/dist/types/cvm_info_v20251028.d.ts +988 -0
  62. package/dist/types/cvm_info_v20260121.d.ts +1264 -0
  63. package/dist/types/index.d.ts +6 -0
  64. package/dist/types/version-mappings.d.ts +38 -0
  65. package/dist/utils/define-action.d.ts +15 -14
  66. package/dist/utils/errors.d.ts +2 -2
  67. package/dist/utils/hostname.d.ts +77 -0
  68. package/dist/utils/index.d.ts +1 -0
  69. package/package.json +2 -2
@@ -213,7 +213,7 @@ export type ListWorkspacesRequest = {
213
213
  limit?: number;
214
214
  };
215
215
  declare const listWorkspaces: {
216
- (client: Client, params?: ListWorkspacesRequest | undefined): Promise<z.objectOutputType<{
216
+ (client: Client<import("../..").ApiVersion>, params?: ListWorkspacesRequest | undefined): Promise<z.objectOutputType<{
217
217
  data: z.ZodArray<z.ZodObject<{
218
218
  id: z.ZodString;
219
219
  name: z.ZodString;
@@ -250,14 +250,14 @@ declare const listWorkspaces: {
250
250
  total: z.ZodNullable<z.ZodNumber>;
251
251
  }, z.ZodTypeAny, "passthrough">>;
252
252
  }, z.ZodTypeAny, "passthrough">>;
253
- <T extends z.ZodTypeAny>(client: Client, params?: ListWorkspacesRequest | undefined, parameters?: {
253
+ <T extends z.ZodTypeAny>(client: Client<import("../..").ApiVersion>, params?: ListWorkspacesRequest | undefined, parameters?: {
254
254
  schema: T;
255
255
  } | undefined): Promise<z.TypeOf<T>>;
256
- (client: Client, params?: ListWorkspacesRequest | undefined, parameters?: {
256
+ (client: Client<import("../..").ApiVersion>, params?: ListWorkspacesRequest | undefined, parameters?: {
257
257
  schema: false;
258
258
  } | undefined): Promise<unknown>;
259
259
  }, safeListWorkspaces: {
260
- (client: Client, params?: ListWorkspacesRequest | undefined): Promise<import("../..").SafeResult<z.objectOutputType<{
260
+ (client: Client<import("../..").ApiVersion>, params?: ListWorkspacesRequest | undefined): Promise<import("../..").SafeResult<z.objectOutputType<{
261
261
  data: z.ZodArray<z.ZodObject<{
262
262
  id: z.ZodString;
263
263
  name: z.ZodString;
@@ -294,10 +294,10 @@ declare const listWorkspaces: {
294
294
  total: z.ZodNullable<z.ZodNumber>;
295
295
  }, z.ZodTypeAny, "passthrough">>;
296
296
  }, z.ZodTypeAny, "passthrough">>>;
297
- <T extends z.ZodTypeAny>(client: Client, params?: ListWorkspacesRequest | undefined, parameters?: {
297
+ <T extends z.ZodTypeAny>(client: Client<import("../..").ApiVersion>, params?: ListWorkspacesRequest | undefined, parameters?: {
298
298
  schema: T;
299
299
  } | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
300
- (client: Client, params?: ListWorkspacesRequest | undefined, parameters?: {
300
+ (client: Client<import("../..").ApiVersion>, params?: ListWorkspacesRequest | undefined, parameters?: {
301
301
  schema: false;
302
302
  } | undefined): Promise<import("../..").SafeResult<unknown>>;
303
303
  };
package/dist/client.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ofetch, type FetchOptions, type FetchRequest } from "ofetch";
2
2
  import { type Handler } from "mitt";
3
- import { type SafeResult, type ClientConfig } from "./types/client";
3
+ import { type SafeResult, type ClientConfig, type ResolvedClientConfig, type FullResponse, type RequestOptions, type ApiVersion, type DefaultApiVersion } from "./types/client";
4
4
  import type { Prettify } from "./types/common";
5
5
  import { PhalaCloudError } from "./utils/errors";
6
- export type { SafeResult } from "./types/client";
7
- export declare const SUPPORTED_API_VERSIONS: readonly ["2025-05-31", "2025-10-28"];
6
+ export type { SafeResult, FullResponse, RequestOptions, ApiVersion, DefaultApiVersion, } from "./types/client";
7
+ export declare const SUPPORTED_API_VERSIONS: readonly ["2025-10-28", "2026-01-21"];
8
+ export declare const DEFAULT_API_VERSION: DefaultApiVersion;
8
9
  /**
9
10
  * Client event types
10
11
  */
@@ -14,11 +15,11 @@ type ClientEvents = {
14
15
  /**
15
16
  * HTTP Client class with ofetch compatibility
16
17
  */
17
- export declare class Client {
18
+ export declare class Client<V extends ApiVersion = DefaultApiVersion> {
18
19
  protected fetchInstance: typeof ofetch;
19
- readonly config: ClientConfig;
20
+ readonly config: ResolvedClientConfig<V>;
20
21
  private emitter;
21
- constructor(config?: ClientConfig);
22
+ constructor(config?: ClientConfig<V>);
22
23
  /**
23
24
  * Get the underlying ofetch instance for advanced usage
24
25
  */
@@ -71,6 +72,17 @@ export declare class Client {
71
72
  */
72
73
  once<K extends keyof ClientEvents>(type: K, handler: Handler<ClientEvents[K]>): void;
73
74
  once(type: "*", handler: Handler): void;
75
+ /**
76
+ * Generic request method (throws PhalaCloudError on error)
77
+ */
78
+ request<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
79
+ /**
80
+ * Generic request method that returns the full response (status + headers + data)
81
+ *
82
+ * Unlike other direct methods, this does NOT throw for non-2xx HTTP statuses.
83
+ * It only throws for network/transport/unexpected errors.
84
+ */
85
+ requestFull<T = unknown>(url: string, options?: RequestOptions): Promise<FullResponse<T>>;
74
86
  /**
75
87
  * Perform GET request (throws PhalaCloudError on error)
76
88
  */
@@ -126,6 +138,25 @@ export declare class Client {
126
138
  * Safe DELETE request (returns SafeResult)
127
139
  */
128
140
  safeDelete<T = unknown>(request: FetchRequest, options?: Omit<FetchOptions, "method">): Promise<SafeResult<T, PhalaCloudError>>;
141
+ /**
142
+ * Safe wrapper around the generic request method (returns SafeResult)
143
+ */
144
+ safeRequestMethod<T = unknown>(url: string, options?: RequestOptions): Promise<SafeResult<T, PhalaCloudError>>;
145
+ /**
146
+ * Safe wrapper around requestFull (returns SafeResult)
147
+ */
148
+ safeRequestFull<T = unknown>(url: string, options?: RequestOptions): Promise<SafeResult<FullResponse<T>, PhalaCloudError>>;
149
+ /**
150
+ * Create a new client with a different API version
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const client = createClient(); // defaults to 2026-01-21
155
+ * const legacyClient = client.withVersion("2025-10-28");
156
+ * const data = await getCvmInfo(legacyClient, { id: "xxx" });
157
+ * ```
158
+ */
159
+ withVersion<NewV extends ApiVersion>(version: NewV): Client<NewV>;
129
160
  /**
130
161
  * Extend client with additional actions
131
162
  *
@@ -138,8 +169,8 @@ export declare class Client {
138
169
  * await client.getCurrentUser() // Method call instead of function call
139
170
  * ```
140
171
  */
141
- extend<TActions extends Record<string, unknown>>(actions: TActions | ((client: Client) => TActions)): Prettify<this & {
142
- [K in keyof TActions]: TActions[K] extends (client: Client) => infer R ? () => R : TActions[K] extends (client: Client, ...args: infer P) => infer R ? (...args: P) => R : never;
172
+ extend<TActions extends Record<string, unknown>>(actions: TActions | ((client: Client<V>) => TActions)): Prettify<this & {
173
+ [K in keyof TActions]: TActions[K] extends (client: Client<V>) => infer R ? () => R : TActions[K] extends (client: Client<V>, ...args: infer P) => infer R ? (...args: P) => R : never;
143
174
  }>;
144
175
  }
145
176
  /**
@@ -164,8 +195,17 @@ export declare class Client {
164
195
  * // Using environment variables (set PHALA_CLOUD_API_KEY)
165
196
  * const client = createClient()
166
197
  *
198
+ * // Using a specific API version
199
+ * const client = createClient({ version: '2025-10-28' })
200
+ *
167
201
  * // To enable debug logging:
168
202
  * // DEBUG=phala::api-client node your-script.js
169
203
  * ```
170
204
  */
171
- export declare function createClient(config?: ClientConfig): Client;
205
+ export declare function createClient(config: ClientConfig<"2026-01-21"> & {
206
+ version: "2026-01-21";
207
+ }): Client<"2026-01-21">;
208
+ export declare function createClient(config: ClientConfig<"2025-10-28"> & {
209
+ version: "2025-10-28";
210
+ }): Client<"2025-10-28">;
211
+ export declare function createClient(config?: ClientConfig): Client<DefaultApiVersion>;
@@ -1,18 +1,21 @@
1
1
  import { Client as BaseClient } from "./client";
2
- import type { ClientConfig } from "./types/client";
2
+ import type { ClientConfig, ApiVersion, DefaultApiVersion } from "./types/client";
3
3
  import type { z } from "zod";
4
- import { type CurrentUser } from "./actions/get_current_user";
4
+ import type { GetCurrentUserResponse, GetCvmListResponse, GetCvmInfoResponse } from "./types/version-mappings";
5
5
  import { type AvailableNodes } from "./actions/get_available_nodes";
6
6
  import { type AllFamiliesResponse, type FamilyInstanceTypesResponse, type ListFamilyInstanceTypesRequest } from "./actions/list-instance-types";
7
7
  import { type ListWorkspacesRequest, type ListWorkspaces, type WorkspaceResponse } from "./actions/workspaces/list_workspaces";
8
- import { type GetCvmInfoRequest, type GetCvmInfoResponse } from "./actions/cvms/get_cvm_info";
9
- import { type GetCvmListRequest, type GetCvmListResponse } from "./actions/cvms/get_cvm_list";
8
+ import { type GetCvmInfoRequest } from "./actions/cvms/get_cvm_info";
9
+ import { type GetCvmListRequest } from "./actions/cvms/get_cvm_list";
10
10
  import { type ProvisionCvmRequest, type ProvisionCvm } from "./actions/cvms/provision_cvm";
11
11
  import { type CommitCvmProvisionRequest, type CommitCvmProvision } from "./actions/cvms/commit_cvm_provision";
12
12
  import { type GetCvmComposeFileRequest, type GetCvmComposeFileResult } from "./actions/cvms/get_cvm_compose_file";
13
13
  import { type ProvisionCvmComposeFileUpdateRequest, type ProvisionCvmComposeFileUpdateResult } from "./actions/cvms/provision_cvm_compose_file_update";
14
14
  import { type CommitCvmComposeFileUpdateRequest, type CommitCvmComposeFileUpdate } from "./actions/cvms/commit_cvm_compose_file_update";
15
15
  import { type UpdateCvmEnvsRequest, type UpdateCvmEnvsResult } from "./actions/cvms/update_cvm_envs";
16
+ import { type UpdateDockerComposeRequest, type UpdateDockerComposeResult } from "./actions/cvms/update_docker_compose";
17
+ import { type UpdatePreLaunchScriptRequest, type UpdatePreLaunchScriptResult } from "./actions/cvms/update_prelaunch_script";
18
+ import { type GetCvmPreLaunchScriptRequest } from "./actions/cvms/get_cvm_prelaunch_script";
16
19
  import { type GetKmsInfoRequest } from "./actions/kms/get_kms_info";
17
20
  import { type GetKmsListRequest, type GetKmsListResponse } from "./actions/kms/get_kms_list";
18
21
  import { type GetAppEnvEncryptPubKeyRequest, type GetAppEnvEncryptPubKey as GetAppEnvEncryptPubKeyResult } from "./actions/kms/get_app_env_encrypt_pubkey";
@@ -51,6 +54,10 @@ import type { SafeResult } from "./types/client";
51
54
  * const user = await client.getCurrentUser()
52
55
  * const cvms = await client.getCvmList()
53
56
  * const result = await client.provisionCvm({...})
57
+ *
58
+ * // With specific API version
59
+ * const clientV20251028 = createClient({ apiKey: 'your-api-key', version: '2025-10-28' })
60
+ * const cvms = await clientV20251028.getCvmList() // Returns PaginatedCvmInfosV20251028
54
61
  * ```
55
62
  *
56
63
  * For tree-shaking optimization, use `createBaseClient` with individual action imports:
@@ -64,22 +71,33 @@ import type { SafeResult } from "./types/client";
64
71
  * @param config - Client configuration
65
72
  * @returns Client extended with all available actions
66
73
  */
67
- export declare function createClient(config?: ClientConfig): Client;
74
+ export declare function createClient(config: ClientConfig<"2026-01-21"> & {
75
+ version: "2026-01-21";
76
+ }): Client<"2026-01-21">;
77
+ export declare function createClient(config: ClientConfig<"2025-10-28"> & {
78
+ version: "2025-10-28";
79
+ }): Client<"2025-10-28">;
80
+ export declare function createClient(config?: ClientConfig): Client<DefaultApiVersion>;
68
81
  /**
69
82
  * Extended client type with all action methods
70
83
  *
71
84
  * This type definition ensures proper type inference for all action methods,
72
85
  * including their overload signatures for schema parameters.
73
86
  */
74
- export interface Client extends BaseClient {
75
- getCurrentUser(): Promise<CurrentUser>;
87
+ export interface Client<V extends ApiVersion = DefaultApiVersion> extends BaseClient<V> {
88
+ withVersion<NewV extends ApiVersion>(version: NewV): Client<NewV>;
89
+ request<T = unknown>(url: string, options?: import("./types/client").RequestOptions): Promise<T>;
90
+ requestFull<T = unknown>(url: string, options?: import("./types/client").RequestOptions): Promise<import("./types/client").FullResponse<T>>;
91
+ safeRequestMethod<T = unknown>(url: string, options?: import("./types/client").RequestOptions): Promise<SafeResult<T, import("./utils/errors").PhalaCloudError>>;
92
+ safeRequestFull<T = unknown>(url: string, options?: import("./types/client").RequestOptions): Promise<SafeResult<import("./types/client").FullResponse<T>, import("./utils/errors").PhalaCloudError>>;
93
+ getCurrentUser(): Promise<GetCurrentUserResponse<V>>;
76
94
  getCurrentUser<T extends z.ZodTypeAny>(parameters: {
77
95
  schema: T;
78
96
  }): Promise<z.infer<T>>;
79
97
  getCurrentUser(parameters: {
80
98
  schema: false;
81
99
  }): Promise<unknown>;
82
- safeGetCurrentUser(): Promise<SafeResult<CurrentUser>>;
100
+ safeGetCurrentUser(): Promise<SafeResult<GetCurrentUserResponse<V>>>;
83
101
  safeGetCurrentUser<T extends z.ZodTypeAny>(parameters: {
84
102
  schema: T;
85
103
  }): Promise<SafeResult<z.infer<T>>>;
@@ -142,20 +160,8 @@ export interface Client extends BaseClient {
142
160
  safeListWorkspaces(request: ListWorkspacesRequest | undefined, parameters: {
143
161
  schema: false;
144
162
  }): Promise<SafeResult<unknown>>;
145
- getCvmList(request?: GetCvmListRequest): Promise<GetCvmListResponse>;
146
- getCvmList<T extends z.ZodTypeAny>(request: GetCvmListRequest | undefined, parameters: {
147
- schema: T;
148
- }): Promise<z.infer<T>>;
149
- getCvmList(request: GetCvmListRequest | undefined, parameters: {
150
- schema: false;
151
- }): Promise<unknown>;
152
- safeGetCvmList(request?: GetCvmListRequest): Promise<SafeResult<GetCvmListResponse>>;
153
- safeGetCvmList<T extends z.ZodTypeAny>(request: GetCvmListRequest | undefined, parameters: {
154
- schema: T;
155
- }): Promise<SafeResult<z.infer<T>>>;
156
- safeGetCvmList(request: GetCvmListRequest | undefined, parameters: {
157
- schema: false;
158
- }): Promise<SafeResult<unknown>>;
163
+ getCvmList(request?: GetCvmListRequest): Promise<GetCvmListResponse<V>>;
164
+ safeGetCvmList(request?: GetCvmListRequest): Promise<SafeResult<GetCvmListResponse<V>>>;
159
165
  getKmsList(request?: GetKmsListRequest): Promise<GetKmsListResponse>;
160
166
  getKmsList<T extends z.ZodTypeAny>(request: GetKmsListRequest | undefined, parameters: {
161
167
  schema: T;
@@ -184,20 +190,8 @@ export interface Client extends BaseClient {
184
190
  safeGetWorkspace(teamSlug: string, parameters: {
185
191
  schema: false;
186
192
  }): Promise<SafeResult<unknown>>;
187
- getCvmInfo(request: GetCvmInfoRequest): Promise<GetCvmInfoResponse>;
188
- getCvmInfo<T extends z.ZodTypeAny>(request: GetCvmInfoRequest, parameters: {
189
- schema: T;
190
- }): Promise<z.infer<T>>;
191
- getCvmInfo(request: GetCvmInfoRequest, parameters: {
192
- schema: false;
193
- }): Promise<unknown>;
194
- safeGetCvmInfo(request: GetCvmInfoRequest): Promise<SafeResult<GetCvmInfoResponse>>;
195
- safeGetCvmInfo<T extends z.ZodTypeAny>(request: GetCvmInfoRequest, parameters: {
196
- schema: T;
197
- }): Promise<SafeResult<z.infer<T>>>;
198
- safeGetCvmInfo(request: GetCvmInfoRequest, parameters: {
199
- schema: false;
200
- }): Promise<SafeResult<unknown>>;
193
+ getCvmInfo(request: GetCvmInfoRequest): Promise<GetCvmInfoResponse<V>>;
194
+ safeGetCvmInfo(request: GetCvmInfoRequest): Promise<SafeResult<GetCvmInfoResponse<V>>>;
201
195
  getCvmComposeFile(request: GetCvmComposeFileRequest): Promise<GetCvmComposeFileResult>;
202
196
  getCvmComposeFile<T extends z.ZodTypeAny>(request: GetCvmComposeFileRequest, parameters: {
203
197
  schema: T;
@@ -282,6 +276,48 @@ export interface Client extends BaseClient {
282
276
  safeUpdateCvmEnvs(request: UpdateCvmEnvsRequest, parameters: {
283
277
  schema: false;
284
278
  }): Promise<SafeResult<unknown>>;
279
+ updateDockerCompose(request: UpdateDockerComposeRequest): Promise<UpdateDockerComposeResult>;
280
+ updateDockerCompose<T extends z.ZodTypeAny>(request: UpdateDockerComposeRequest, parameters: {
281
+ schema: T;
282
+ }): Promise<z.infer<T>>;
283
+ updateDockerCompose(request: UpdateDockerComposeRequest, parameters: {
284
+ schema: false;
285
+ }): Promise<unknown>;
286
+ safeUpdateDockerCompose(request: UpdateDockerComposeRequest): Promise<SafeResult<UpdateDockerComposeResult>>;
287
+ safeUpdateDockerCompose<T extends z.ZodTypeAny>(request: UpdateDockerComposeRequest, parameters: {
288
+ schema: T;
289
+ }): Promise<SafeResult<z.infer<T>>>;
290
+ safeUpdateDockerCompose(request: UpdateDockerComposeRequest, parameters: {
291
+ schema: false;
292
+ }): Promise<SafeResult<unknown>>;
293
+ updatePreLaunchScript(request: UpdatePreLaunchScriptRequest): Promise<UpdatePreLaunchScriptResult>;
294
+ updatePreLaunchScript<T extends z.ZodTypeAny>(request: UpdatePreLaunchScriptRequest, parameters: {
295
+ schema: T;
296
+ }): Promise<z.infer<T>>;
297
+ updatePreLaunchScript(request: UpdatePreLaunchScriptRequest, parameters: {
298
+ schema: false;
299
+ }): Promise<unknown>;
300
+ safeUpdatePreLaunchScript(request: UpdatePreLaunchScriptRequest): Promise<SafeResult<UpdatePreLaunchScriptResult>>;
301
+ safeUpdatePreLaunchScript<T extends z.ZodTypeAny>(request: UpdatePreLaunchScriptRequest, parameters: {
302
+ schema: T;
303
+ }): Promise<SafeResult<z.infer<T>>>;
304
+ safeUpdatePreLaunchScript(request: UpdatePreLaunchScriptRequest, parameters: {
305
+ schema: false;
306
+ }): Promise<SafeResult<unknown>>;
307
+ getCvmPreLaunchScript(request: GetCvmPreLaunchScriptRequest): Promise<string>;
308
+ getCvmPreLaunchScript<T extends z.ZodTypeAny>(request: GetCvmPreLaunchScriptRequest, parameters: {
309
+ schema: T;
310
+ }): Promise<z.infer<T>>;
311
+ getCvmPreLaunchScript(request: GetCvmPreLaunchScriptRequest, parameters: {
312
+ schema: false;
313
+ }): Promise<unknown>;
314
+ safeGetCvmPreLaunchScript(request: GetCvmPreLaunchScriptRequest): Promise<SafeResult<string>>;
315
+ safeGetCvmPreLaunchScript<T extends z.ZodTypeAny>(request: GetCvmPreLaunchScriptRequest, parameters: {
316
+ schema: T;
317
+ }): Promise<SafeResult<z.infer<T>>>;
318
+ safeGetCvmPreLaunchScript(request: GetCvmPreLaunchScriptRequest, parameters: {
319
+ schema: false;
320
+ }): Promise<SafeResult<unknown>>;
285
321
  getKmsInfo(request: GetKmsInfoRequest): Promise<KmsInfo>;
286
322
  getKmsInfo<T extends z.ZodTypeAny>(request: GetKmsInfoRequest, parameters: {
287
323
  schema: T;
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Current user schema for API version 2025-10-28 (legacy flat format)
4
+ */
5
+ export declare const CurrentUserV20251028Schema: z.ZodObject<{
6
+ username: z.ZodString;
7
+ email: z.ZodString;
8
+ credits: z.ZodNumber;
9
+ granted_credits: z.ZodNumber;
10
+ avatar: z.ZodString;
11
+ team_name: z.ZodString;
12
+ team_tier: z.ZodString;
13
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
14
+ username: z.ZodString;
15
+ email: z.ZodString;
16
+ credits: z.ZodNumber;
17
+ granted_credits: z.ZodNumber;
18
+ avatar: z.ZodString;
19
+ team_name: z.ZodString;
20
+ team_tier: z.ZodString;
21
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
22
+ username: z.ZodString;
23
+ email: z.ZodString;
24
+ credits: z.ZodNumber;
25
+ granted_credits: z.ZodNumber;
26
+ avatar: z.ZodString;
27
+ team_name: z.ZodString;
28
+ team_tier: z.ZodString;
29
+ }, z.ZodTypeAny, "passthrough">>;
30
+ export type CurrentUserV20251028 = z.infer<typeof CurrentUserV20251028Schema>;
@@ -0,0 +1,276 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Current user schema for API version 2026-01-21 (three-layer structure)
4
+ */
5
+ export declare const UserInfoSchema: z.ZodObject<{
6
+ username: z.ZodString;
7
+ email: z.ZodString;
8
+ role: z.ZodEnum<["admin", "user"]>;
9
+ avatar: z.ZodString;
10
+ email_verified: z.ZodBoolean;
11
+ totp_enabled: z.ZodBoolean;
12
+ has_backup_codes: z.ZodBoolean;
13
+ flag_has_password: z.ZodBoolean;
14
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
15
+ username: z.ZodString;
16
+ email: z.ZodString;
17
+ role: z.ZodEnum<["admin", "user"]>;
18
+ avatar: z.ZodString;
19
+ email_verified: z.ZodBoolean;
20
+ totp_enabled: z.ZodBoolean;
21
+ has_backup_codes: z.ZodBoolean;
22
+ flag_has_password: z.ZodBoolean;
23
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
24
+ username: z.ZodString;
25
+ email: z.ZodString;
26
+ role: z.ZodEnum<["admin", "user"]>;
27
+ avatar: z.ZodString;
28
+ email_verified: z.ZodBoolean;
29
+ totp_enabled: z.ZodBoolean;
30
+ has_backup_codes: z.ZodBoolean;
31
+ flag_has_password: z.ZodBoolean;
32
+ }, z.ZodTypeAny, "passthrough">>;
33
+ export type UserInfo = z.infer<typeof UserInfoSchema>;
34
+ export declare const WorkspaceInfoSchema: z.ZodObject<{
35
+ id: z.ZodString;
36
+ name: z.ZodString;
37
+ slug: z.ZodNullable<z.ZodString>;
38
+ tier: z.ZodString;
39
+ role: z.ZodString;
40
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
42
+ id: z.ZodString;
43
+ name: z.ZodString;
44
+ slug: z.ZodNullable<z.ZodString>;
45
+ tier: z.ZodString;
46
+ role: z.ZodString;
47
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
49
+ id: z.ZodString;
50
+ name: z.ZodString;
51
+ slug: z.ZodNullable<z.ZodString>;
52
+ tier: z.ZodString;
53
+ role: z.ZodString;
54
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ }, z.ZodTypeAny, "passthrough">>;
56
+ export type WorkspaceInfo = z.infer<typeof WorkspaceInfoSchema>;
57
+ export declare const CreditsInfoSchema: z.ZodObject<{
58
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
59
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
60
+ is_post_paid: z.ZodBoolean;
61
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
62
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
63
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
64
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
65
+ is_post_paid: z.ZodBoolean;
66
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
67
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
68
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
69
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
70
+ is_post_paid: z.ZodBoolean;
71
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
72
+ }, z.ZodTypeAny, "passthrough">>;
73
+ export type CreditsInfo = z.infer<typeof CreditsInfoSchema>;
74
+ export declare const CurrentUserV20260121Schema: z.ZodObject<{
75
+ user: z.ZodObject<{
76
+ username: z.ZodString;
77
+ email: z.ZodString;
78
+ role: z.ZodEnum<["admin", "user"]>;
79
+ avatar: z.ZodString;
80
+ email_verified: z.ZodBoolean;
81
+ totp_enabled: z.ZodBoolean;
82
+ has_backup_codes: z.ZodBoolean;
83
+ flag_has_password: z.ZodBoolean;
84
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
85
+ username: z.ZodString;
86
+ email: z.ZodString;
87
+ role: z.ZodEnum<["admin", "user"]>;
88
+ avatar: z.ZodString;
89
+ email_verified: z.ZodBoolean;
90
+ totp_enabled: z.ZodBoolean;
91
+ has_backup_codes: z.ZodBoolean;
92
+ flag_has_password: z.ZodBoolean;
93
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
94
+ username: z.ZodString;
95
+ email: z.ZodString;
96
+ role: z.ZodEnum<["admin", "user"]>;
97
+ avatar: z.ZodString;
98
+ email_verified: z.ZodBoolean;
99
+ totp_enabled: z.ZodBoolean;
100
+ has_backup_codes: z.ZodBoolean;
101
+ flag_has_password: z.ZodBoolean;
102
+ }, z.ZodTypeAny, "passthrough">>;
103
+ workspace: z.ZodObject<{
104
+ id: z.ZodString;
105
+ name: z.ZodString;
106
+ slug: z.ZodNullable<z.ZodString>;
107
+ tier: z.ZodString;
108
+ role: z.ZodString;
109
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
111
+ id: z.ZodString;
112
+ name: z.ZodString;
113
+ slug: z.ZodNullable<z.ZodString>;
114
+ tier: z.ZodString;
115
+ role: z.ZodString;
116
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
118
+ id: z.ZodString;
119
+ name: z.ZodString;
120
+ slug: z.ZodNullable<z.ZodString>;
121
+ tier: z.ZodString;
122
+ role: z.ZodString;
123
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ }, z.ZodTypeAny, "passthrough">>;
125
+ credits: z.ZodObject<{
126
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
127
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
128
+ is_post_paid: z.ZodBoolean;
129
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
130
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
131
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
132
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
133
+ is_post_paid: z.ZodBoolean;
134
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
135
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
136
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
137
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
138
+ is_post_paid: z.ZodBoolean;
139
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
140
+ }, z.ZodTypeAny, "passthrough">>;
141
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
142
+ user: z.ZodObject<{
143
+ username: z.ZodString;
144
+ email: z.ZodString;
145
+ role: z.ZodEnum<["admin", "user"]>;
146
+ avatar: z.ZodString;
147
+ email_verified: z.ZodBoolean;
148
+ totp_enabled: z.ZodBoolean;
149
+ has_backup_codes: z.ZodBoolean;
150
+ flag_has_password: z.ZodBoolean;
151
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
152
+ username: z.ZodString;
153
+ email: z.ZodString;
154
+ role: z.ZodEnum<["admin", "user"]>;
155
+ avatar: z.ZodString;
156
+ email_verified: z.ZodBoolean;
157
+ totp_enabled: z.ZodBoolean;
158
+ has_backup_codes: z.ZodBoolean;
159
+ flag_has_password: z.ZodBoolean;
160
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
161
+ username: z.ZodString;
162
+ email: z.ZodString;
163
+ role: z.ZodEnum<["admin", "user"]>;
164
+ avatar: z.ZodString;
165
+ email_verified: z.ZodBoolean;
166
+ totp_enabled: z.ZodBoolean;
167
+ has_backup_codes: z.ZodBoolean;
168
+ flag_has_password: z.ZodBoolean;
169
+ }, z.ZodTypeAny, "passthrough">>;
170
+ workspace: z.ZodObject<{
171
+ id: z.ZodString;
172
+ name: z.ZodString;
173
+ slug: z.ZodNullable<z.ZodString>;
174
+ tier: z.ZodString;
175
+ role: z.ZodString;
176
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
178
+ id: z.ZodString;
179
+ name: z.ZodString;
180
+ slug: z.ZodNullable<z.ZodString>;
181
+ tier: z.ZodString;
182
+ role: z.ZodString;
183
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
184
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
185
+ id: z.ZodString;
186
+ name: z.ZodString;
187
+ slug: z.ZodNullable<z.ZodString>;
188
+ tier: z.ZodString;
189
+ role: z.ZodString;
190
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
191
+ }, z.ZodTypeAny, "passthrough">>;
192
+ credits: z.ZodObject<{
193
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
194
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
195
+ is_post_paid: z.ZodBoolean;
196
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
197
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
198
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
199
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
200
+ is_post_paid: z.ZodBoolean;
201
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
202
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
203
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
204
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
205
+ is_post_paid: z.ZodBoolean;
206
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
207
+ }, z.ZodTypeAny, "passthrough">>;
208
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
209
+ user: z.ZodObject<{
210
+ username: z.ZodString;
211
+ email: z.ZodString;
212
+ role: z.ZodEnum<["admin", "user"]>;
213
+ avatar: z.ZodString;
214
+ email_verified: z.ZodBoolean;
215
+ totp_enabled: z.ZodBoolean;
216
+ has_backup_codes: z.ZodBoolean;
217
+ flag_has_password: z.ZodBoolean;
218
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
219
+ username: z.ZodString;
220
+ email: z.ZodString;
221
+ role: z.ZodEnum<["admin", "user"]>;
222
+ avatar: z.ZodString;
223
+ email_verified: z.ZodBoolean;
224
+ totp_enabled: z.ZodBoolean;
225
+ has_backup_codes: z.ZodBoolean;
226
+ flag_has_password: z.ZodBoolean;
227
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
228
+ username: z.ZodString;
229
+ email: z.ZodString;
230
+ role: z.ZodEnum<["admin", "user"]>;
231
+ avatar: z.ZodString;
232
+ email_verified: z.ZodBoolean;
233
+ totp_enabled: z.ZodBoolean;
234
+ has_backup_codes: z.ZodBoolean;
235
+ flag_has_password: z.ZodBoolean;
236
+ }, z.ZodTypeAny, "passthrough">>;
237
+ workspace: z.ZodObject<{
238
+ id: z.ZodString;
239
+ name: z.ZodString;
240
+ slug: z.ZodNullable<z.ZodString>;
241
+ tier: z.ZodString;
242
+ role: z.ZodString;
243
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
245
+ id: z.ZodString;
246
+ name: z.ZodString;
247
+ slug: z.ZodNullable<z.ZodString>;
248
+ tier: z.ZodString;
249
+ role: z.ZodString;
250
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
252
+ id: z.ZodString;
253
+ name: z.ZodString;
254
+ slug: z.ZodNullable<z.ZodString>;
255
+ tier: z.ZodString;
256
+ role: z.ZodString;
257
+ avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
258
+ }, z.ZodTypeAny, "passthrough">>;
259
+ credits: z.ZodObject<{
260
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
261
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
262
+ is_post_paid: z.ZodBoolean;
263
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
264
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
265
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
266
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
267
+ is_post_paid: z.ZodBoolean;
268
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
269
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
270
+ balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
271
+ granted_balance: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
272
+ is_post_paid: z.ZodBoolean;
273
+ outstanding_amount: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
274
+ }, z.ZodTypeAny, "passthrough">>;
275
+ }, z.ZodTypeAny, "passthrough">>;
276
+ export type CurrentUserV20260121 = z.infer<typeof CurrentUserV20260121Schema>;
@@ -0,0 +1,4 @@
1
+ export { CurrentUserV20260121Schema, type CurrentUserV20260121, UserInfoSchema, type UserInfo, WorkspaceInfoSchema, type WorkspaceInfo, CreditsInfoSchema, type CreditsInfo, } from "./current_user_v20260121";
2
+ export { CurrentUserV20251028Schema, type CurrentUserV20251028, } from "./current_user_v20251028";
3
+ export { CurrentUserV20251028Schema as CurrentUserSchema, type CurrentUserV20251028 as CurrentUser, } from "./current_user_v20251028";
4
+ export { CurrentUserV20260121Schema as AuthResponseSchema, type CurrentUserV20260121 as AuthResponse, } from "./current_user_v20260121";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { createClient as createBaseClient, type Client as BaseClient, SUPPORTED_API_VERSIONS, } from "./client";
2
2
  export { createClient, type Client } from "./create-client";
3
3
  export * from "./types";
4
+ export * from "./credentials";
4
5
  export * from "./actions";
5
6
  export * from "./utils";
6
7
  export { defineAction, defineSimpleAction } from "./utils/define-action";