@phala/cloud 0.2.1-beta.3 → 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.
- package/LICENSE +201 -0
- package/dist/actions/apps/get_app_cvms.d.ts +30 -0
- package/dist/actions/apps/get_app_info.d.ts +30 -0
- package/dist/actions/apps/get_app_list.d.ts +74 -0
- package/dist/actions/apps/get_app_revision_detail.d.ts +48 -0
- package/dist/actions/apps/get_app_revisions.d.ts +42 -0
- package/dist/actions/cvms/commit_cvm_compose_file_update.d.ts +7 -7
- package/dist/actions/cvms/commit_cvm_provision.d.ts +31 -31
- package/dist/actions/cvms/delete_cvm.d.ts +10 -7
- package/dist/actions/cvms/get_available_os_images.d.ts +10 -7
- package/dist/actions/cvms/get_cvm_attestation.d.ts +10 -7
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +18 -15
- package/dist/actions/cvms/get_cvm_containers_stats.d.ts +14 -11
- package/dist/actions/cvms/get_cvm_docker_compose.d.ts +10 -7
- package/dist/actions/cvms/get_cvm_info.d.ts +19 -35
- package/dist/actions/cvms/get_cvm_list.d.ts +11 -537
- package/dist/actions/cvms/get_cvm_network.d.ts +10 -7
- package/dist/actions/cvms/get_cvm_prelaunch_script.d.ts +42 -0
- package/dist/actions/cvms/get_cvm_state.d.ts +10 -7
- package/dist/actions/cvms/get_cvm_stats.d.ts +10 -7
- package/dist/actions/cvms/get_cvm_status_batch.d.ts +167 -0
- package/dist/actions/cvms/provision_cvm.d.ts +404 -21
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +32 -32
- package/dist/actions/cvms/restart_cvm.d.ts +17 -14
- package/dist/actions/cvms/shutdown_cvm.d.ts +18 -15
- package/dist/actions/cvms/start_cvm.d.ts +18 -15
- package/dist/actions/cvms/stop_cvm.d.ts +18 -15
- package/dist/actions/cvms/update_cvm_envs.d.ts +426 -0
- package/dist/actions/cvms/update_cvm_resources.d.ts +13 -10
- package/dist/actions/cvms/update_cvm_visibility.d.ts +33 -14
- package/dist/actions/cvms/update_docker_compose.d.ts +420 -0
- package/dist/actions/cvms/update_os_image.d.ts +9 -6
- package/dist/actions/cvms/update_prelaunch_script.d.ts +417 -0
- package/dist/actions/cvms/watch_cvm_state.d.ts +1 -1
- package/dist/actions/get_available_nodes.d.ts +6 -6
- package/dist/actions/get_current_user.d.ts +36 -89
- package/dist/actions/index.d.ts +14 -2
- package/dist/actions/kms/get_app_env_encrypt_pubkey.d.ts +6 -6
- package/dist/actions/kms/get_kms_info.d.ts +6 -6
- package/dist/actions/kms/get_kms_list.d.ts +6 -6
- package/dist/actions/kms/next_app_ids.d.ts +6 -6
- package/dist/actions/list-instance-types.d.ts +16 -16
- package/dist/actions/workspaces/get_workspace.d.ts +6 -6
- package/dist/actions/workspaces/get_workspace_nodes.d.ts +266 -0
- package/dist/actions/workspaces/get_workspace_quotas.d.ts +1169 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +6 -6
- package/dist/client.d.ts +49 -9
- package/dist/create-client.d.ts +87 -36
- package/dist/credentials/current_user_v20251028.d.ts +30 -0
- package/dist/credentials/current_user_v20260121.d.ts +276 -0
- package/dist/credentials/index.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1782 -633
- package/dist/index.mjs +1693 -626
- package/dist/types/app_info_v20251028.d.ts +1266 -0
- package/dist/types/app_info_v20260121.d.ts +3293 -0
- package/dist/types/app_revision.d.ts +453 -0
- package/dist/types/client.d.ts +40 -2
- package/dist/types/cvm_id.d.ts +45 -10
- package/dist/types/cvm_info.d.ts +16 -502
- package/dist/types/cvm_info_v20251028.d.ts +988 -0
- package/dist/types/cvm_info_v20260121.d.ts +1264 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/version-mappings.d.ts +38 -0
- package/dist/utils/define-action.d.ts +15 -14
- package/dist/utils/errors.d.ts +2 -2
- package/dist/utils/hostname.d.ts +77 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -333,7 +333,11 @@ function formatStructuredError(error, options) {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
// src/client.ts
|
|
336
|
-
var SUPPORTED_API_VERSIONS = [
|
|
336
|
+
var SUPPORTED_API_VERSIONS = [
|
|
337
|
+
"2025-10-28",
|
|
338
|
+
"2026-01-21"
|
|
339
|
+
];
|
|
340
|
+
var DEFAULT_API_VERSION = "2026-01-21";
|
|
337
341
|
var logger = debug("phala::api-client");
|
|
338
342
|
function formatHeaders(headers) {
|
|
339
343
|
return Object.entries(headers).map(([key, value]) => ` -H "${key}: ${value}"`).join("\n");
|
|
@@ -357,17 +361,19 @@ function formatResponse(status, statusText, headers, body) {
|
|
|
357
361
|
bodyStr
|
|
358
362
|
].filter(Boolean).join("\n");
|
|
359
363
|
}
|
|
360
|
-
var Client = class {
|
|
364
|
+
var Client = class _Client {
|
|
361
365
|
constructor(config = {}) {
|
|
362
366
|
this.emitter = mitt();
|
|
363
|
-
const
|
|
367
|
+
const resolvedApiKey = config.apiKey || process?.env?.PHALA_CLOUD_API_KEY;
|
|
368
|
+
const resolvedBaseURL = config.baseURL || process?.env?.PHALA_CLOUD_API_PREFIX || "https://cloud-api.phala.network/api/v1";
|
|
369
|
+
const version = config.version && SUPPORTED_API_VERSIONS.includes(config.version) ? config.version : DEFAULT_API_VERSION;
|
|
370
|
+
this.config = {
|
|
364
371
|
...config,
|
|
365
|
-
apiKey:
|
|
366
|
-
baseURL:
|
|
372
|
+
apiKey: resolvedApiKey,
|
|
373
|
+
baseURL: resolvedBaseURL,
|
|
374
|
+
version
|
|
367
375
|
};
|
|
368
|
-
const
|
|
369
|
-
this.config = resolvedConfig;
|
|
370
|
-
const { apiKey, baseURL, timeout, headers, useCookieAuth, onResponseError, ...fetchOptions } = resolvedConfig;
|
|
376
|
+
const { apiKey, baseURL, timeout, headers, useCookieAuth, onResponseError, ...fetchOptions } = this.config;
|
|
371
377
|
const requestHeaders = {
|
|
372
378
|
"X-Phala-Version": version,
|
|
373
379
|
"Content-Type": "application/json"
|
|
@@ -426,8 +432,8 @@ var Client = class {
|
|
|
426
432
|
},
|
|
427
433
|
// Generic handlers for response error (similar to request.ts)
|
|
428
434
|
onResponseError: ({ request, response, options }) => {
|
|
429
|
-
console.warn(`HTTP ${response.status}: ${response.url}`);
|
|
430
435
|
if (logger.enabled) {
|
|
436
|
+
console.warn(`HTTP ${response.status}: ${response.url}`);
|
|
431
437
|
const method = options.method || "GET";
|
|
432
438
|
const url = typeof request === "string" ? request : request.url;
|
|
433
439
|
logger(
|
|
@@ -463,6 +469,49 @@ var Client = class {
|
|
|
463
469
|
this.emitter.on(type, wrappedHandler);
|
|
464
470
|
}
|
|
465
471
|
// ===== Direct methods (throw on error) =====
|
|
472
|
+
/**
|
|
473
|
+
* Generic request method (throws PhalaCloudError on error)
|
|
474
|
+
*/
|
|
475
|
+
async request(url, options) {
|
|
476
|
+
try {
|
|
477
|
+
const method = options?.method || "GET";
|
|
478
|
+
return await this.fetchInstance(url, {
|
|
479
|
+
...options,
|
|
480
|
+
method
|
|
481
|
+
});
|
|
482
|
+
} catch (error) {
|
|
483
|
+
const requestError = this.convertToRequestError(error);
|
|
484
|
+
const phalaCloudError = this.emitError(requestError);
|
|
485
|
+
throw phalaCloudError;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Generic request method that returns the full response (status + headers + data)
|
|
490
|
+
*
|
|
491
|
+
* Unlike other direct methods, this does NOT throw for non-2xx HTTP statuses.
|
|
492
|
+
* It only throws for network/transport/unexpected errors.
|
|
493
|
+
*/
|
|
494
|
+
async requestFull(url, options) {
|
|
495
|
+
try {
|
|
496
|
+
const method = options?.method || "GET";
|
|
497
|
+
const response = await this.fetchInstance.raw(url, {
|
|
498
|
+
...options,
|
|
499
|
+
method,
|
|
500
|
+
ignoreResponseError: true
|
|
501
|
+
});
|
|
502
|
+
return {
|
|
503
|
+
status: response.status,
|
|
504
|
+
statusText: response.statusText,
|
|
505
|
+
headers: response.headers,
|
|
506
|
+
data: response._data,
|
|
507
|
+
ok: response.ok
|
|
508
|
+
};
|
|
509
|
+
} catch (error) {
|
|
510
|
+
const requestError = this.convertToRequestError(error);
|
|
511
|
+
const phalaCloudError = this.emitError(requestError);
|
|
512
|
+
throw phalaCloudError;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
466
515
|
/**
|
|
467
516
|
* Perform GET request (throws PhalaCloudError on error)
|
|
468
517
|
*/
|
|
@@ -613,6 +662,34 @@ var Client = class {
|
|
|
613
662
|
async safeDelete(request, options) {
|
|
614
663
|
return this.safeRequest(() => this.delete(request, options));
|
|
615
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* Safe wrapper around the generic request method (returns SafeResult)
|
|
667
|
+
*/
|
|
668
|
+
async safeRequestMethod(url, options) {
|
|
669
|
+
return this.safeRequest(() => this.request(url, options));
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Safe wrapper around requestFull (returns SafeResult)
|
|
673
|
+
*/
|
|
674
|
+
async safeRequestFull(url, options) {
|
|
675
|
+
return this.safeRequest(() => this.requestFull(url, options));
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Create a new client with a different API version
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```typescript
|
|
682
|
+
* const client = createClient(); // defaults to 2026-01-21
|
|
683
|
+
* const legacyClient = client.withVersion("2025-10-28");
|
|
684
|
+
* const data = await getCvmInfo(legacyClient, { id: "xxx" });
|
|
685
|
+
* ```
|
|
686
|
+
*/
|
|
687
|
+
withVersion(version) {
|
|
688
|
+
return new _Client({
|
|
689
|
+
...this.config,
|
|
690
|
+
version
|
|
691
|
+
});
|
|
692
|
+
}
|
|
616
693
|
/**
|
|
617
694
|
* Extend client with additional actions
|
|
618
695
|
*
|
|
@@ -640,8 +717,113 @@ function createClient(config = {}) {
|
|
|
640
717
|
return new Client(config);
|
|
641
718
|
}
|
|
642
719
|
|
|
643
|
-
// src/
|
|
720
|
+
// src/credentials/current_user_v20260121.ts
|
|
644
721
|
import { z as z2 } from "zod";
|
|
722
|
+
var UserInfoSchema = z2.object({
|
|
723
|
+
username: z2.string(),
|
|
724
|
+
email: z2.string(),
|
|
725
|
+
role: z2.enum(["admin", "user"]),
|
|
726
|
+
avatar: z2.string(),
|
|
727
|
+
email_verified: z2.boolean(),
|
|
728
|
+
totp_enabled: z2.boolean(),
|
|
729
|
+
has_backup_codes: z2.boolean(),
|
|
730
|
+
flag_has_password: z2.boolean()
|
|
731
|
+
}).passthrough();
|
|
732
|
+
var WorkspaceInfoSchema = z2.object({
|
|
733
|
+
id: z2.string(),
|
|
734
|
+
name: z2.string(),
|
|
735
|
+
slug: z2.string().nullable(),
|
|
736
|
+
tier: z2.string(),
|
|
737
|
+
role: z2.string(),
|
|
738
|
+
avatar: z2.string().nullable().optional()
|
|
739
|
+
}).passthrough();
|
|
740
|
+
var CreditsInfoSchema = z2.object({
|
|
741
|
+
balance: z2.string().or(z2.number()),
|
|
742
|
+
granted_balance: z2.string().or(z2.number()),
|
|
743
|
+
is_post_paid: z2.boolean(),
|
|
744
|
+
outstanding_amount: z2.string().or(z2.number()).nullable()
|
|
745
|
+
}).passthrough();
|
|
746
|
+
var CurrentUserV20260121Schema = z2.object({
|
|
747
|
+
user: UserInfoSchema,
|
|
748
|
+
workspace: WorkspaceInfoSchema,
|
|
749
|
+
credits: CreditsInfoSchema
|
|
750
|
+
}).passthrough();
|
|
751
|
+
|
|
752
|
+
// src/credentials/current_user_v20251028.ts
|
|
753
|
+
import { z as z3 } from "zod";
|
|
754
|
+
var CurrentUserV20251028Schema = z3.object({
|
|
755
|
+
username: z3.string(),
|
|
756
|
+
email: z3.string(),
|
|
757
|
+
credits: z3.number(),
|
|
758
|
+
granted_credits: z3.number(),
|
|
759
|
+
avatar: z3.string(),
|
|
760
|
+
team_name: z3.string(),
|
|
761
|
+
team_tier: z3.string()
|
|
762
|
+
}).passthrough();
|
|
763
|
+
|
|
764
|
+
// src/actions/get_current_user.ts
|
|
765
|
+
function getSchemaForVersion(version) {
|
|
766
|
+
return version === "2025-10-28" ? CurrentUserV20251028Schema : CurrentUserV20260121Schema;
|
|
767
|
+
}
|
|
768
|
+
async function getCurrentUser(client, parameters) {
|
|
769
|
+
const response = await client.get("/auth/me");
|
|
770
|
+
if (parameters?.schema === false) {
|
|
771
|
+
return response;
|
|
772
|
+
}
|
|
773
|
+
const schema = parameters?.schema || getSchemaForVersion(client.config.version);
|
|
774
|
+
return schema.parse(response);
|
|
775
|
+
}
|
|
776
|
+
async function safeGetCurrentUser(client, parameters) {
|
|
777
|
+
try {
|
|
778
|
+
const data = await getCurrentUser(client, parameters);
|
|
779
|
+
return { success: true, data };
|
|
780
|
+
} catch (error) {
|
|
781
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
782
|
+
return { success: false, error };
|
|
783
|
+
}
|
|
784
|
+
return {
|
|
785
|
+
success: false,
|
|
786
|
+
error: {
|
|
787
|
+
name: "Error",
|
|
788
|
+
message: error instanceof Error ? error.message : String(error)
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// src/actions/get_available_nodes.ts
|
|
795
|
+
import { z as z5 } from "zod";
|
|
796
|
+
|
|
797
|
+
// src/types/kms_info.ts
|
|
798
|
+
import { z as z4 } from "zod";
|
|
799
|
+
|
|
800
|
+
// src/types/supported_chains.ts
|
|
801
|
+
import { anvil, base, mainnet } from "viem/chains";
|
|
802
|
+
var SUPPORTED_CHAINS = {
|
|
803
|
+
[mainnet.id]: mainnet,
|
|
804
|
+
[base.id]: base,
|
|
805
|
+
[anvil.id]: anvil
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
// src/types/kms_info.ts
|
|
809
|
+
var KmsInfoBaseSchema = z4.object({
|
|
810
|
+
id: z4.string(),
|
|
811
|
+
slug: z4.string().nullable(),
|
|
812
|
+
url: z4.string(),
|
|
813
|
+
version: z4.string(),
|
|
814
|
+
chain_id: z4.number().nullable(),
|
|
815
|
+
kms_contract_address: z4.string().nullable().transform((val) => val),
|
|
816
|
+
gateway_app_id: z4.string().nullable().transform((val) => val)
|
|
817
|
+
}).passthrough();
|
|
818
|
+
var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
|
|
819
|
+
if (data.chain_id != null) {
|
|
820
|
+
const chain = SUPPORTED_CHAINS[data.chain_id];
|
|
821
|
+
if (chain) {
|
|
822
|
+
return { ...data, chain };
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return data;
|
|
826
|
+
});
|
|
645
827
|
|
|
646
828
|
// src/utils/validate-parameters.ts
|
|
647
829
|
function validateActionParameters(parameters) {
|
|
@@ -789,95 +971,44 @@ function defineAction(schema, fn) {
|
|
|
789
971
|
};
|
|
790
972
|
}
|
|
791
973
|
|
|
792
|
-
// src/actions/get_current_user.ts
|
|
793
|
-
var CurrentUserSchema = z2.object({
|
|
794
|
-
username: z2.string(),
|
|
795
|
-
email: z2.string(),
|
|
796
|
-
credits: z2.number(),
|
|
797
|
-
granted_credits: z2.number(),
|
|
798
|
-
avatar: z2.string(),
|
|
799
|
-
team_name: z2.string(),
|
|
800
|
-
team_tier: z2.string()
|
|
801
|
-
}).passthrough();
|
|
802
|
-
var { action: getCurrentUser, safeAction: safeGetCurrentUser } = defineSimpleAction(
|
|
803
|
-
CurrentUserSchema,
|
|
804
|
-
async (client) => {
|
|
805
|
-
return await client.get("/auth/me");
|
|
806
|
-
}
|
|
807
|
-
);
|
|
808
|
-
|
|
809
|
-
// src/actions/get_available_nodes.ts
|
|
810
|
-
import { z as z4 } from "zod";
|
|
811
|
-
|
|
812
|
-
// src/types/kms_info.ts
|
|
813
|
-
import { z as z3 } from "zod";
|
|
814
|
-
|
|
815
|
-
// src/types/supported_chains.ts
|
|
816
|
-
import { anvil, base, mainnet } from "viem/chains";
|
|
817
|
-
var SUPPORTED_CHAINS = {
|
|
818
|
-
[mainnet.id]: mainnet,
|
|
819
|
-
[base.id]: base,
|
|
820
|
-
[anvil.id]: anvil
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
// src/types/kms_info.ts
|
|
824
|
-
var KmsInfoBaseSchema = z3.object({
|
|
825
|
-
id: z3.string(),
|
|
826
|
-
slug: z3.string().nullable(),
|
|
827
|
-
url: z3.string(),
|
|
828
|
-
version: z3.string(),
|
|
829
|
-
chain_id: z3.number().nullable(),
|
|
830
|
-
kms_contract_address: z3.string().nullable().transform((val) => val),
|
|
831
|
-
gateway_app_id: z3.string().nullable().transform((val) => val)
|
|
832
|
-
}).passthrough();
|
|
833
|
-
var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
|
|
834
|
-
if (data.chain_id != null) {
|
|
835
|
-
const chain = SUPPORTED_CHAINS[data.chain_id];
|
|
836
|
-
if (chain) {
|
|
837
|
-
return { ...data, chain };
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
return data;
|
|
841
|
-
});
|
|
842
|
-
|
|
843
974
|
// src/actions/get_available_nodes.ts
|
|
844
|
-
var AvailableOSImageSchema =
|
|
845
|
-
name:
|
|
846
|
-
is_dev:
|
|
847
|
-
version:
|
|
848
|
-
|
|
849
|
-
|
|
975
|
+
var AvailableOSImageSchema = z5.object({
|
|
976
|
+
name: z5.string(),
|
|
977
|
+
is_dev: z5.boolean(),
|
|
978
|
+
version: z5.union([
|
|
979
|
+
z5.tuple([z5.number(), z5.number(), z5.number()]),
|
|
980
|
+
z5.tuple([z5.number(), z5.number(), z5.number(), z5.number()])
|
|
850
981
|
]),
|
|
851
|
-
os_image_hash:
|
|
982
|
+
os_image_hash: z5.string().nullable().optional()
|
|
852
983
|
}).passthrough();
|
|
853
|
-
var TeepodCapacitySchema =
|
|
854
|
-
teepod_id:
|
|
855
|
-
name:
|
|
856
|
-
listed:
|
|
857
|
-
resource_score:
|
|
858
|
-
remaining_vcpu:
|
|
859
|
-
remaining_memory:
|
|
860
|
-
remaining_cvm_slots:
|
|
861
|
-
images:
|
|
862
|
-
support_onchain_kms:
|
|
863
|
-
fmspc:
|
|
864
|
-
device_id:
|
|
865
|
-
region_identifier:
|
|
866
|
-
default_kms:
|
|
867
|
-
kms_list:
|
|
984
|
+
var TeepodCapacitySchema = z5.object({
|
|
985
|
+
teepod_id: z5.number(),
|
|
986
|
+
name: z5.string(),
|
|
987
|
+
listed: z5.boolean(),
|
|
988
|
+
resource_score: z5.number(),
|
|
989
|
+
remaining_vcpu: z5.number(),
|
|
990
|
+
remaining_memory: z5.number(),
|
|
991
|
+
remaining_cvm_slots: z5.number(),
|
|
992
|
+
images: z5.array(AvailableOSImageSchema),
|
|
993
|
+
support_onchain_kms: z5.boolean().optional(),
|
|
994
|
+
fmspc: z5.string().nullable().optional(),
|
|
995
|
+
device_id: z5.string().nullable().optional(),
|
|
996
|
+
region_identifier: z5.string().nullable().optional(),
|
|
997
|
+
default_kms: z5.string().nullable().optional(),
|
|
998
|
+
kms_list: z5.array(z5.string()).default([])
|
|
868
999
|
}).passthrough();
|
|
869
|
-
var ResourceThresholdSchema =
|
|
870
|
-
max_instances:
|
|
871
|
-
max_vcpu:
|
|
872
|
-
max_memory:
|
|
873
|
-
max_disk:
|
|
1000
|
+
var ResourceThresholdSchema = z5.object({
|
|
1001
|
+
max_instances: z5.number().nullable().optional(),
|
|
1002
|
+
max_vcpu: z5.number().nullable().optional(),
|
|
1003
|
+
max_memory: z5.number().nullable().optional(),
|
|
1004
|
+
max_disk: z5.number().nullable().optional()
|
|
874
1005
|
}).passthrough();
|
|
875
|
-
var AvailableNodesSchema =
|
|
876
|
-
tier:
|
|
1006
|
+
var AvailableNodesSchema = z5.object({
|
|
1007
|
+
tier: z5.string(),
|
|
877
1008
|
// TeamTier is string enum
|
|
878
1009
|
capacity: ResourceThresholdSchema,
|
|
879
|
-
nodes:
|
|
880
|
-
kms_list:
|
|
1010
|
+
nodes: z5.array(TeepodCapacitySchema),
|
|
1011
|
+
kms_list: z5.array(KmsInfoSchema)
|
|
881
1012
|
}).passthrough();
|
|
882
1013
|
var { action: getAvailableNodes, safeAction: safeGetAvailableNodes } = defineSimpleAction(
|
|
883
1014
|
AvailableNodesSchema,
|
|
@@ -887,33 +1018,33 @@ var { action: getAvailableNodes, safeAction: safeGetAvailableNodes } = defineSim
|
|
|
887
1018
|
);
|
|
888
1019
|
|
|
889
1020
|
// src/actions/list-instance-types.ts
|
|
890
|
-
import { z as
|
|
891
|
-
var InstanceTypeSchema =
|
|
892
|
-
id:
|
|
893
|
-
name:
|
|
894
|
-
description:
|
|
895
|
-
vcpu:
|
|
896
|
-
memory_mb:
|
|
897
|
-
hourly_rate:
|
|
898
|
-
requires_gpu:
|
|
899
|
-
default_disk_size_gb:
|
|
900
|
-
family:
|
|
1021
|
+
import { z as z6 } from "zod";
|
|
1022
|
+
var InstanceTypeSchema = z6.object({
|
|
1023
|
+
id: z6.string(),
|
|
1024
|
+
name: z6.string(),
|
|
1025
|
+
description: z6.string(),
|
|
1026
|
+
vcpu: z6.number(),
|
|
1027
|
+
memory_mb: z6.number(),
|
|
1028
|
+
hourly_rate: z6.string(),
|
|
1029
|
+
requires_gpu: z6.boolean(),
|
|
1030
|
+
default_disk_size_gb: z6.number().default(20),
|
|
1031
|
+
family: z6.string().nullable()
|
|
901
1032
|
}).passthrough();
|
|
902
|
-
var FamilyGroupSchema =
|
|
903
|
-
name:
|
|
904
|
-
items:
|
|
905
|
-
total:
|
|
1033
|
+
var FamilyGroupSchema = z6.object({
|
|
1034
|
+
name: z6.string(),
|
|
1035
|
+
items: z6.array(InstanceTypeSchema),
|
|
1036
|
+
total: z6.number()
|
|
906
1037
|
}).strict();
|
|
907
|
-
var AllFamiliesResponseSchema =
|
|
908
|
-
result:
|
|
1038
|
+
var AllFamiliesResponseSchema = z6.object({
|
|
1039
|
+
result: z6.array(FamilyGroupSchema)
|
|
909
1040
|
}).strict();
|
|
910
|
-
var FamilyInstanceTypesResponseSchema =
|
|
911
|
-
items:
|
|
912
|
-
total:
|
|
913
|
-
family:
|
|
1041
|
+
var FamilyInstanceTypesResponseSchema = z6.object({
|
|
1042
|
+
items: z6.array(InstanceTypeSchema),
|
|
1043
|
+
total: z6.number(),
|
|
1044
|
+
family: z6.string()
|
|
914
1045
|
}).strict();
|
|
915
|
-
var ListFamilyInstanceTypesRequestSchema =
|
|
916
|
-
family:
|
|
1046
|
+
var ListFamilyInstanceTypesRequestSchema = z6.object({
|
|
1047
|
+
family: z6.string()
|
|
917
1048
|
}).strict();
|
|
918
1049
|
var { action: listAllInstanceTypeFamilies, safeAction: safeListAllInstanceTypeFamilies } = defineAction(
|
|
919
1050
|
AllFamiliesResponseSchema,
|
|
@@ -927,22 +1058,22 @@ var { action: listFamilyInstanceTypes, safeAction: safeListFamilyInstanceTypes }
|
|
|
927
1058
|
});
|
|
928
1059
|
|
|
929
1060
|
// src/actions/workspaces/list_workspaces.ts
|
|
930
|
-
import { z as
|
|
931
|
-
var WorkspaceResponseSchema =
|
|
932
|
-
id:
|
|
933
|
-
name:
|
|
934
|
-
slug:
|
|
935
|
-
tier:
|
|
936
|
-
role:
|
|
937
|
-
created_at:
|
|
1061
|
+
import { z as z7 } from "zod";
|
|
1062
|
+
var WorkspaceResponseSchema = z7.object({
|
|
1063
|
+
id: z7.string(),
|
|
1064
|
+
name: z7.string(),
|
|
1065
|
+
slug: z7.string().nullable(),
|
|
1066
|
+
tier: z7.string(),
|
|
1067
|
+
role: z7.string(),
|
|
1068
|
+
created_at: z7.string()
|
|
938
1069
|
}).passthrough();
|
|
939
|
-
var PaginationMetadataSchema =
|
|
940
|
-
has_more:
|
|
941
|
-
next_cursor:
|
|
942
|
-
total:
|
|
1070
|
+
var PaginationMetadataSchema = z7.object({
|
|
1071
|
+
has_more: z7.boolean(),
|
|
1072
|
+
next_cursor: z7.string().nullable(),
|
|
1073
|
+
total: z7.number().nullable()
|
|
943
1074
|
}).passthrough();
|
|
944
|
-
var ListWorkspacesSchema =
|
|
945
|
-
data:
|
|
1075
|
+
var ListWorkspacesSchema = z7.object({
|
|
1076
|
+
data: z7.array(WorkspaceResponseSchema),
|
|
946
1077
|
pagination: PaginationMetadataSchema
|
|
947
1078
|
}).passthrough();
|
|
948
1079
|
var { action: listWorkspaces, safeAction: safeListWorkspaces } = defineAction(ListWorkspacesSchema, async (client, request) => {
|
|
@@ -958,196 +1089,393 @@ var { action: getWorkspace, safeAction: safeGetWorkspace } = defineAction(Worksp
|
|
|
958
1089
|
return await client.get(`/workspaces/${teamSlug}`);
|
|
959
1090
|
});
|
|
960
1091
|
|
|
961
|
-
// src/types/
|
|
962
|
-
import { z as
|
|
963
|
-
var
|
|
964
|
-
id:
|
|
965
|
-
name:
|
|
966
|
-
status:
|
|
967
|
-
uptime:
|
|
968
|
-
app_url:
|
|
969
|
-
app_id:
|
|
970
|
-
instance_id:
|
|
971
|
-
configuration:
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
image_version: z7.string().nullable()
|
|
978
|
-
});
|
|
979
|
-
var ManagedUserSchema = z7.object({
|
|
980
|
-
id: z7.number(),
|
|
981
|
-
username: z7.string()
|
|
982
|
-
});
|
|
983
|
-
var CvmNodeSchema = z7.object({
|
|
984
|
-
id: z7.number(),
|
|
985
|
-
name: z7.string(),
|
|
986
|
-
region_identifier: z7.string().nullable().optional()
|
|
1092
|
+
// src/types/cvm_info_v20251028.ts
|
|
1093
|
+
import { z as z8 } from "zod";
|
|
1094
|
+
var VmInfoV20251028Schema = z8.object({
|
|
1095
|
+
id: z8.string(),
|
|
1096
|
+
name: z8.string(),
|
|
1097
|
+
status: z8.string(),
|
|
1098
|
+
uptime: z8.string(),
|
|
1099
|
+
app_url: z8.string().nullable(),
|
|
1100
|
+
app_id: z8.string(),
|
|
1101
|
+
instance_id: z8.string().nullable(),
|
|
1102
|
+
configuration: z8.any().optional(),
|
|
1103
|
+
exited_at: z8.string().nullable(),
|
|
1104
|
+
boot_progress: z8.string().nullable(),
|
|
1105
|
+
boot_error: z8.string().nullable(),
|
|
1106
|
+
shutdown_progress: z8.string().nullable(),
|
|
1107
|
+
image_version: z8.string().nullable()
|
|
987
1108
|
});
|
|
988
|
-
var
|
|
989
|
-
|
|
990
|
-
|
|
1109
|
+
var ManagedUserV20251028Schema = z8.object({
|
|
1110
|
+
id: z8.number(),
|
|
1111
|
+
username: z8.string()
|
|
991
1112
|
});
|
|
992
|
-
var
|
|
993
|
-
|
|
994
|
-
name:
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1113
|
+
var CvmNodeV20251028Schema = z8.object({
|
|
1114
|
+
id: z8.number(),
|
|
1115
|
+
name: z8.string(),
|
|
1116
|
+
region_identifier: z8.string().nullable().optional()
|
|
1117
|
+
});
|
|
1118
|
+
var MachineInfoV20251028Schema = z8.object({
|
|
1119
|
+
vcpu: z8.number(),
|
|
1120
|
+
memory: z8.number(),
|
|
1121
|
+
disk_size: z8.number(),
|
|
1122
|
+
gpu_count: z8.number().default(0)
|
|
1123
|
+
});
|
|
1124
|
+
var CvmNetworkUrlsV20251028Schema = z8.object({
|
|
1125
|
+
app: z8.string(),
|
|
1126
|
+
instance: z8.string()
|
|
1127
|
+
});
|
|
1128
|
+
var CvmInfoV20251028Schema = z8.object({
|
|
1129
|
+
hosted: VmInfoV20251028Schema,
|
|
1130
|
+
name: z8.string(),
|
|
1131
|
+
managed_user: ManagedUserV20251028Schema.nullable(),
|
|
1132
|
+
node: CvmNodeV20251028Schema.nullable(),
|
|
1133
|
+
listed: z8.boolean().default(false),
|
|
1134
|
+
status: z8.string(),
|
|
1135
|
+
in_progress: z8.boolean().default(false),
|
|
1136
|
+
dapp_dashboard_url: z8.string().nullable(),
|
|
1137
|
+
syslog_endpoint: z8.string().nullable(),
|
|
1138
|
+
allow_upgrade: z8.boolean().default(false),
|
|
1139
|
+
project_id: z8.string().nullable(),
|
|
1140
|
+
project_type: z8.string().nullable(),
|
|
1141
|
+
billing_period: z8.string().nullable(),
|
|
1007
1142
|
kms_info: KmsInfoSchema.nullable(),
|
|
1008
|
-
vcpu:
|
|
1009
|
-
memory:
|
|
1010
|
-
disk_size:
|
|
1011
|
-
gateway_domain:
|
|
1012
|
-
public_urls:
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1143
|
+
vcpu: z8.number().nullable(),
|
|
1144
|
+
memory: z8.number().nullable(),
|
|
1145
|
+
disk_size: z8.number().nullable(),
|
|
1146
|
+
gateway_domain: z8.string().nullable(),
|
|
1147
|
+
public_urls: z8.array(CvmNetworkUrlsV20251028Schema),
|
|
1148
|
+
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
1149
|
+
updated_at: z8.string().nullable().optional()
|
|
1150
|
+
});
|
|
1151
|
+
var CvmDetailV20251028Schema = z8.object({
|
|
1152
|
+
id: z8.number(),
|
|
1153
|
+
name: z8.string(),
|
|
1154
|
+
status: z8.string(),
|
|
1155
|
+
in_progress: z8.boolean().optional().default(false),
|
|
1156
|
+
teepod_id: z8.number().nullable(),
|
|
1157
|
+
teepod: CvmNodeV20251028Schema.optional().nullable(),
|
|
1158
|
+
app_id: z8.string(),
|
|
1159
|
+
vm_uuid: z8.string().nullable(),
|
|
1160
|
+
instance_id: z8.string().nullable(),
|
|
1161
|
+
vcpu: z8.number(),
|
|
1162
|
+
memory: z8.number(),
|
|
1163
|
+
disk_size: z8.number(),
|
|
1164
|
+
base_image: z8.string().nullable(),
|
|
1165
|
+
encrypted_env_pubkey: z8.string().nullable(),
|
|
1166
|
+
listed: z8.boolean().optional().default(false),
|
|
1167
|
+
project_id: z8.string().optional().nullable(),
|
|
1168
|
+
project_type: z8.string().optional().nullable(),
|
|
1169
|
+
instance_type: z8.string().optional().nullable(),
|
|
1170
|
+
public_sysinfo: z8.boolean().optional().default(false),
|
|
1171
|
+
public_logs: z8.boolean().optional().default(false),
|
|
1172
|
+
dapp_dashboard_url: z8.string().optional().nullable(),
|
|
1173
|
+
syslog_endpoint: z8.string().optional().nullable(),
|
|
1036
1174
|
kms_info: KmsInfoSchema.optional().nullable(),
|
|
1037
|
-
contract_address:
|
|
1038
|
-
deployer_address:
|
|
1039
|
-
scheduled_delete_at:
|
|
1040
|
-
public_urls:
|
|
1041
|
-
gateway_domain:
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1175
|
+
contract_address: z8.string().optional().nullable(),
|
|
1176
|
+
deployer_address: z8.string().optional().nullable(),
|
|
1177
|
+
scheduled_delete_at: z8.string().optional().nullable(),
|
|
1178
|
+
public_urls: z8.array(CvmNetworkUrlsV20251028Schema).optional().default([]),
|
|
1179
|
+
gateway_domain: z8.string().optional().nullable(),
|
|
1180
|
+
machine_info: MachineInfoV20251028Schema.optional().nullable(),
|
|
1181
|
+
updated_at: z8.string().optional().nullable()
|
|
1182
|
+
});
|
|
1183
|
+
var PaginatedCvmInfosV20251028Schema = z8.object({
|
|
1184
|
+
items: z8.array(CvmInfoV20251028Schema),
|
|
1185
|
+
total: z8.number(),
|
|
1186
|
+
page: z8.number(),
|
|
1187
|
+
page_size: z8.number(),
|
|
1188
|
+
pages: z8.number()
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
// src/types/cvm_info_v20260121.ts
|
|
1192
|
+
import { z as z9 } from "zod";
|
|
1193
|
+
var BillingPeriodSchema = z9.enum(["skip", "hourly", "monthly"]);
|
|
1194
|
+
var KmsTypeSchema = z9.enum(["phala", "ethereum", "base", "legacy"]);
|
|
1195
|
+
var UserRefSchema = z9.object({
|
|
1196
|
+
object_type: z9.literal("user"),
|
|
1197
|
+
id: z9.string().nullable().optional(),
|
|
1198
|
+
username: z9.string().nullable().optional(),
|
|
1199
|
+
avatar_url: z9.string().nullable().optional()
|
|
1200
|
+
});
|
|
1201
|
+
var WorkspaceRefSchema = z9.object({
|
|
1202
|
+
object_type: z9.literal("workspace"),
|
|
1203
|
+
id: z9.string(),
|
|
1204
|
+
name: z9.string(),
|
|
1205
|
+
slug: z9.string().nullable().optional(),
|
|
1206
|
+
avatar_url: z9.string().nullable().optional()
|
|
1207
|
+
});
|
|
1208
|
+
var CvmResourceInfoV20260121Schema = z9.object({
|
|
1209
|
+
instance_type: z9.string().nullable().optional(),
|
|
1210
|
+
vcpu: z9.number().int().nullable().optional(),
|
|
1211
|
+
memory_in_gb: z9.number().nullable().optional(),
|
|
1212
|
+
disk_in_gb: z9.number().int().nullable().optional(),
|
|
1213
|
+
gpus: z9.number().int().nullable().optional(),
|
|
1214
|
+
compute_billing_price: z9.string().nullable().optional(),
|
|
1215
|
+
billing_period: BillingPeriodSchema.nullable().optional()
|
|
1216
|
+
});
|
|
1217
|
+
var CvmOsInfoV20260121Schema = z9.object({
|
|
1218
|
+
name: z9.string().nullable().optional(),
|
|
1219
|
+
version: z9.string().nullable().optional(),
|
|
1220
|
+
is_dev: z9.boolean().nullable().optional(),
|
|
1221
|
+
os_image_hash: z9.string().nullable().optional()
|
|
1222
|
+
});
|
|
1223
|
+
var CvmKmsInfoV20260121Schema = z9.object({
|
|
1224
|
+
chain_id: z9.number().int().nullable().optional(),
|
|
1225
|
+
dstack_kms_address: z9.string().nullable().optional(),
|
|
1226
|
+
dstack_app_address: z9.string().nullable().optional(),
|
|
1227
|
+
deployer_address: z9.string().nullable().optional(),
|
|
1228
|
+
rpc_endpoint: z9.string().nullable().optional(),
|
|
1229
|
+
encrypted_env_pubkey: z9.string().nullable().optional()
|
|
1230
|
+
});
|
|
1231
|
+
var CvmProgressInfoV20260121Schema = z9.object({
|
|
1232
|
+
target: z9.string().nullable().optional(),
|
|
1233
|
+
started_at: z9.string().nullable().optional(),
|
|
1234
|
+
correlation_id: z9.string().nullable().optional()
|
|
1235
|
+
});
|
|
1236
|
+
var CvmGatewayInfoV20260121Schema = z9.object({
|
|
1237
|
+
base_domain: z9.string().nullable().optional(),
|
|
1238
|
+
cname: z9.string().nullable().optional()
|
|
1239
|
+
});
|
|
1240
|
+
var CvmNodeInfoV20260121Schema = z9.object({
|
|
1241
|
+
name: z9.string().nullable().optional(),
|
|
1242
|
+
region: z9.string().nullable().optional(),
|
|
1243
|
+
device_id: z9.string().nullable().optional(),
|
|
1244
|
+
ppid: z9.string().nullable().optional(),
|
|
1245
|
+
status: z9.string().nullable().optional(),
|
|
1246
|
+
version: z9.string().nullable().optional()
|
|
1247
|
+
});
|
|
1248
|
+
var CvmInfoV20260121Schema = z9.object({
|
|
1249
|
+
id: z9.string(),
|
|
1250
|
+
// hashed CvmId
|
|
1251
|
+
name: z9.string(),
|
|
1252
|
+
app_id: z9.string().nullable().optional(),
|
|
1253
|
+
vm_uuid: z9.string().nullable().optional(),
|
|
1254
|
+
resource: CvmResourceInfoV20260121Schema,
|
|
1255
|
+
node_info: CvmNodeInfoV20260121Schema.nullable().optional(),
|
|
1256
|
+
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
1257
|
+
kms_type: KmsTypeSchema.nullable().optional(),
|
|
1258
|
+
kms_info: CvmKmsInfoV20260121Schema.nullable().optional(),
|
|
1259
|
+
status: z9.string(),
|
|
1260
|
+
progress: CvmProgressInfoV20260121Schema.nullable().optional(),
|
|
1261
|
+
compose_hash: z9.string().nullable().optional(),
|
|
1262
|
+
gateway: CvmGatewayInfoV20260121Schema,
|
|
1263
|
+
services: z9.array(z9.record(z9.any())).optional().default([]),
|
|
1264
|
+
endpoints: z9.array(CvmNetworkUrlsV20251028Schema).nullable().optional(),
|
|
1265
|
+
public_logs: z9.boolean().optional(),
|
|
1266
|
+
public_sysinfo: z9.boolean().optional(),
|
|
1267
|
+
public_tcbinfo: z9.boolean().optional(),
|
|
1268
|
+
gateway_enabled: z9.boolean().optional(),
|
|
1269
|
+
secure_time: z9.boolean().optional(),
|
|
1270
|
+
storage_fs: z9.string().optional(),
|
|
1271
|
+
workspace: WorkspaceRefSchema.nullable().optional(),
|
|
1272
|
+
creator: UserRefSchema.nullable().optional()
|
|
1273
|
+
});
|
|
1274
|
+
var CvmInfoDetailV20260121Schema = CvmInfoV20260121Schema.extend({
|
|
1275
|
+
compose_file: z9.union([z9.record(z9.any()), z9.string()]).nullable().optional()
|
|
1276
|
+
});
|
|
1277
|
+
var PaginatedCvmInfosV20260121Schema = z9.object({
|
|
1278
|
+
items: z9.array(CvmInfoV20260121Schema),
|
|
1279
|
+
total: z9.number(),
|
|
1280
|
+
page: z9.number(),
|
|
1281
|
+
page_size: z9.number(),
|
|
1282
|
+
pages: z9.number()
|
|
1066
1283
|
});
|
|
1067
1284
|
|
|
1068
1285
|
// src/types/cvm_id.ts
|
|
1069
|
-
import { z as
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1286
|
+
import { z as z10 } from "zod";
|
|
1287
|
+
|
|
1288
|
+
// src/utils/hostname.ts
|
|
1289
|
+
function isValidHostname(name) {
|
|
1290
|
+
if (typeof name !== "string" || name.length < 5 || name.length > 63) {
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
return /^[a-zA-Z](?!.*--)([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name);
|
|
1294
|
+
}
|
|
1295
|
+
function convertToHostname(input) {
|
|
1296
|
+
if (typeof input !== "string") {
|
|
1297
|
+
return generateFallbackHostname();
|
|
1298
|
+
}
|
|
1299
|
+
let result = input;
|
|
1300
|
+
result = result.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1301
|
+
result = result.replace(/_/g, "-");
|
|
1302
|
+
result = result.replace(/[^a-z0-9\s-]/gi, "-").replace(/\s+/g, "-");
|
|
1303
|
+
result = result.replace(/-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
1304
|
+
if (result.length === 0) {
|
|
1305
|
+
return generateFallbackHostname();
|
|
1306
|
+
}
|
|
1307
|
+
if (/^\d/.test(result)) {
|
|
1308
|
+
result = `dstack-app-${result}`;
|
|
1309
|
+
}
|
|
1310
|
+
if (result.length < 5) {
|
|
1311
|
+
result = `dstack-app-${result}`;
|
|
1312
|
+
}
|
|
1313
|
+
result = result.slice(0, 63).replace(/-+$/, "");
|
|
1314
|
+
if (result.length === 0) {
|
|
1315
|
+
return generateFallbackHostname();
|
|
1316
|
+
}
|
|
1317
|
+
if (!isValidHostname(result)) {
|
|
1318
|
+
return generateFallbackHostname();
|
|
1319
|
+
}
|
|
1320
|
+
return result;
|
|
1321
|
+
}
|
|
1322
|
+
function generateFallbackHostname() {
|
|
1323
|
+
const timestamp = Date.now().toString(36);
|
|
1324
|
+
const random = Math.random().toString(36).substring(2, 6);
|
|
1325
|
+
return `dstack-app-${timestamp}-${random}`;
|
|
1326
|
+
}
|
|
1327
|
+
function generateDefaultCvmName(prefix = "dstack-app") {
|
|
1328
|
+
const random = Array.from(
|
|
1329
|
+
{ length: 5 },
|
|
1330
|
+
() => "abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(Math.random() * 36)]
|
|
1331
|
+
).join("");
|
|
1332
|
+
const result = `${prefix}-${random}`;
|
|
1333
|
+
if (result.length > 63) {
|
|
1334
|
+
const shortRandom = Array.from(
|
|
1335
|
+
{ length: 3 },
|
|
1336
|
+
() => "abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(Math.random() * 36)]
|
|
1337
|
+
).join("");
|
|
1338
|
+
return `${prefix.slice(0, 55)}-${shortRandom}`;
|
|
1339
|
+
}
|
|
1340
|
+
return result;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// src/types/cvm_id.ts
|
|
1344
|
+
var CvmIdObjectSchema = z10.object({
|
|
1345
|
+
/** Direct CVM ID (any format) - accepts any string including names */
|
|
1346
|
+
id: z10.string().optional(),
|
|
1073
1347
|
/** UUID format (with or without dashes) */
|
|
1074
|
-
uuid:
|
|
1348
|
+
uuid: z10.string().regex(
|
|
1075
1349
|
/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i,
|
|
1076
1350
|
"Invalid UUID format"
|
|
1077
1351
|
).optional(),
|
|
1078
1352
|
/** App ID (40 characters, optionally prefixed with 'app_id_') */
|
|
1079
|
-
app_id:
|
|
1353
|
+
app_id: z10.string().optional(),
|
|
1080
1354
|
/** Instance ID (40 characters, optionally prefixed with 'instance_') */
|
|
1081
|
-
instance_id:
|
|
1355
|
+
instance_id: z10.string().optional(),
|
|
1356
|
+
/** CVM name (RFC 1123 hostname format: 5-63 chars, starts with letter, alphanumeric + hyphens) */
|
|
1357
|
+
name: z10.string().refine(isValidHostname, {
|
|
1358
|
+
message: "Name must be 5-63 characters, start with letter, and contain only letters/numbers/hyphens"
|
|
1359
|
+
}).optional()
|
|
1082
1360
|
});
|
|
1083
1361
|
var refineCvmId = (schema) => schema.refine(
|
|
1084
1362
|
(data) => {
|
|
1085
1363
|
const obj = data;
|
|
1086
|
-
return !!(obj.id || obj.uuid || obj.app_id || obj.instance_id);
|
|
1364
|
+
return !!(obj.id || obj.uuid || obj.app_id || obj.instance_id || obj.name);
|
|
1087
1365
|
},
|
|
1088
1366
|
{
|
|
1089
|
-
message: "One of id, uuid, app_id, or
|
|
1367
|
+
message: "One of id, uuid, app_id, instance_id, or name must be provided"
|
|
1090
1368
|
}
|
|
1091
1369
|
);
|
|
1092
1370
|
var CvmIdBaseSchema = refineCvmId(CvmIdObjectSchema);
|
|
1093
1371
|
var CvmIdSchema = CvmIdBaseSchema.transform((data) => {
|
|
1094
|
-
let
|
|
1372
|
+
let rawValue;
|
|
1095
1373
|
if (data.id) {
|
|
1096
|
-
|
|
1374
|
+
rawValue = data.id;
|
|
1097
1375
|
} else if (data.uuid) {
|
|
1098
|
-
|
|
1376
|
+
rawValue = data.uuid;
|
|
1099
1377
|
} else if (data.app_id) {
|
|
1100
|
-
|
|
1378
|
+
rawValue = data.app_id;
|
|
1101
1379
|
} else if (data.instance_id) {
|
|
1102
|
-
|
|
1380
|
+
rawValue = data.instance_id;
|
|
1381
|
+
} else if (data.name) {
|
|
1382
|
+
return { cvmId: data.name };
|
|
1103
1383
|
} else {
|
|
1104
1384
|
throw new Error("No valid identifier provided");
|
|
1105
1385
|
}
|
|
1386
|
+
const uuidRegex = /^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i;
|
|
1387
|
+
const appIdRegex = /^[0-9a-f]{40}$/i;
|
|
1388
|
+
let cvmId;
|
|
1389
|
+
if (uuidRegex.test(rawValue)) {
|
|
1390
|
+
cvmId = rawValue.replace(/-/g, "");
|
|
1391
|
+
} else if (appIdRegex.test(rawValue)) {
|
|
1392
|
+
cvmId = `app_${rawValue}`;
|
|
1393
|
+
} else {
|
|
1394
|
+
cvmId = rawValue;
|
|
1395
|
+
}
|
|
1106
1396
|
return { cvmId };
|
|
1107
1397
|
});
|
|
1108
1398
|
|
|
1109
1399
|
// src/actions/cvms/get_cvm_info.ts
|
|
1110
1400
|
var GetCvmInfoRequestSchema = CvmIdSchema;
|
|
1111
|
-
|
|
1401
|
+
function getSchemaForVersion2(version) {
|
|
1402
|
+
return version === "2025-10-28" ? CvmDetailV20251028Schema : CvmInfoDetailV20260121Schema;
|
|
1403
|
+
}
|
|
1404
|
+
async function getCvmInfo(client, request) {
|
|
1112
1405
|
const { cvmId } = GetCvmInfoRequestSchema.parse(request);
|
|
1113
|
-
|
|
1114
|
-
|
|
1406
|
+
const response = await client.get(`/cvms/${cvmId}`);
|
|
1407
|
+
const schema = getSchemaForVersion2(client.config.version);
|
|
1408
|
+
return schema.parse(response);
|
|
1409
|
+
}
|
|
1410
|
+
async function safeGetCvmInfo(client, request) {
|
|
1411
|
+
try {
|
|
1412
|
+
const data = await getCvmInfo(client, request);
|
|
1413
|
+
return { success: true, data };
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
1416
|
+
return { success: false, error };
|
|
1417
|
+
}
|
|
1418
|
+
return {
|
|
1419
|
+
success: false,
|
|
1420
|
+
error: {
|
|
1421
|
+
name: "Error",
|
|
1422
|
+
message: error instanceof Error ? error.message : String(error)
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1115
1427
|
|
|
1116
1428
|
// src/actions/cvms/get_cvm_list.ts
|
|
1117
|
-
import { z as
|
|
1118
|
-
var GetCvmListRequestSchema =
|
|
1119
|
-
page:
|
|
1120
|
-
page_size:
|
|
1121
|
-
node_id:
|
|
1122
|
-
teepod_id:
|
|
1123
|
-
user_id:
|
|
1124
|
-
}).strict();
|
|
1125
|
-
var GetCvmListSchema = z9.object({
|
|
1126
|
-
items: z9.array(CvmInfoSchema),
|
|
1127
|
-
total: z9.number(),
|
|
1128
|
-
page: z9.number(),
|
|
1129
|
-
page_size: z9.number(),
|
|
1130
|
-
pages: z9.number()
|
|
1429
|
+
import { z as z11 } from "zod";
|
|
1430
|
+
var GetCvmListRequestSchema = z11.object({
|
|
1431
|
+
page: z11.number().int().min(1).optional(),
|
|
1432
|
+
page_size: z11.number().int().min(1).optional(),
|
|
1433
|
+
node_id: z11.number().int().min(1).optional(),
|
|
1434
|
+
teepod_id: z11.number().int().min(1).optional(),
|
|
1435
|
+
user_id: z11.string().optional()
|
|
1131
1436
|
}).strict();
|
|
1132
|
-
|
|
1437
|
+
function getSchemaForVersion3(version) {
|
|
1438
|
+
return version === "2025-10-28" ? PaginatedCvmInfosV20251028Schema : PaginatedCvmInfosV20260121Schema;
|
|
1439
|
+
}
|
|
1440
|
+
async function getCvmList(client, request) {
|
|
1133
1441
|
const validatedRequest = GetCvmListRequestSchema.parse(request ?? {});
|
|
1134
|
-
|
|
1135
|
-
|
|
1442
|
+
const response = await client.get("/cvms/paginated", { params: validatedRequest });
|
|
1443
|
+
const schema = getSchemaForVersion3(client.config.version);
|
|
1444
|
+
return schema.parse(response);
|
|
1445
|
+
}
|
|
1446
|
+
async function safeGetCvmList(client, request) {
|
|
1447
|
+
try {
|
|
1448
|
+
const data = await getCvmList(client, request);
|
|
1449
|
+
return { success: true, data };
|
|
1450
|
+
} catch (error) {
|
|
1451
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
1452
|
+
return { success: false, error };
|
|
1453
|
+
}
|
|
1454
|
+
return {
|
|
1455
|
+
success: false,
|
|
1456
|
+
error: {
|
|
1457
|
+
name: "Error",
|
|
1458
|
+
message: error instanceof Error ? error.message : String(error)
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1136
1463
|
|
|
1137
1464
|
// src/actions/cvms/provision_cvm.ts
|
|
1138
|
-
import { z as
|
|
1139
|
-
var ProvisionCvmSchema =
|
|
1140
|
-
app_id:
|
|
1141
|
-
app_env_encrypt_pubkey:
|
|
1142
|
-
compose_hash:
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1465
|
+
import { z as z12 } from "zod";
|
|
1466
|
+
var ProvisionCvmSchema = z12.object({
|
|
1467
|
+
app_id: z12.string().nullable().optional(),
|
|
1468
|
+
app_env_encrypt_pubkey: z12.string().nullable().optional(),
|
|
1469
|
+
compose_hash: z12.string(),
|
|
1470
|
+
kms_info: KmsInfoSchema.nullable().optional(),
|
|
1471
|
+
fmspc: z12.string().nullable().optional(),
|
|
1472
|
+
device_id: z12.string().nullable().optional(),
|
|
1473
|
+
os_image_hash: z12.string().nullable().optional(),
|
|
1474
|
+
instance_type: z12.string().nullable().optional(),
|
|
1475
|
+
teepod_id: z12.number().nullable().optional(),
|
|
1148
1476
|
// Will be transformed to node_id
|
|
1149
|
-
node_id:
|
|
1150
|
-
kms_id:
|
|
1477
|
+
node_id: z12.number().nullable().optional(),
|
|
1478
|
+
kms_id: z12.string().nullable().optional()
|
|
1151
1479
|
}).passthrough().transform((data) => {
|
|
1152
1480
|
if ("teepod_id" in data && data.teepod_id !== void 0) {
|
|
1153
1481
|
const { teepod_id, ...rest } = data;
|
|
@@ -1155,47 +1483,55 @@ var ProvisionCvmSchema = z10.object({
|
|
|
1155
1483
|
}
|
|
1156
1484
|
return data;
|
|
1157
1485
|
});
|
|
1158
|
-
var
|
|
1159
|
-
|
|
1486
|
+
var NAME_VALIDATION_MESSAGE = "Name must be 5-63 characters, start with letter, and contain only letters/numbers/hyphens";
|
|
1487
|
+
var ProvisionCvmRequestSchema = z12.object({
|
|
1488
|
+
node_id: z12.number().optional(),
|
|
1160
1489
|
// recommended - optional, system auto-selects if not specified
|
|
1161
|
-
teepod_id:
|
|
1490
|
+
teepod_id: z12.number().optional(),
|
|
1162
1491
|
// deprecated, for compatibility
|
|
1163
|
-
region:
|
|
1492
|
+
region: z12.string().optional(),
|
|
1164
1493
|
// optional - region filter for auto-selection
|
|
1165
|
-
name:
|
|
1166
|
-
instance_type:
|
|
1167
|
-
// defaults to "tdx.small"
|
|
1168
|
-
image:
|
|
1169
|
-
vcpu:
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1494
|
+
name: z12.string().min(5, NAME_VALIDATION_MESSAGE).max(63, NAME_VALIDATION_MESSAGE).refine((val) => isValidHostname(val), NAME_VALIDATION_MESSAGE),
|
|
1495
|
+
instance_type: z12.string().optional(),
|
|
1496
|
+
// optional, defaults to "tdx.small" when no resource params specified
|
|
1497
|
+
image: z12.string().optional(),
|
|
1498
|
+
vcpu: z12.number().optional(),
|
|
1499
|
+
// deprecated, use instance_type instead
|
|
1500
|
+
memory: z12.number().optional(),
|
|
1501
|
+
// deprecated, use instance_type instead
|
|
1502
|
+
disk_size: z12.number().optional(),
|
|
1503
|
+
compose_file: z12.object({
|
|
1504
|
+
allowed_envs: z12.array(z12.string()).optional(),
|
|
1505
|
+
pre_launch_script: z12.string().optional(),
|
|
1506
|
+
docker_compose_file: z12.string().optional(),
|
|
1507
|
+
name: z12.string().optional().default(""),
|
|
1177
1508
|
// optional with default empty string
|
|
1178
|
-
kms_enabled:
|
|
1179
|
-
public_logs:
|
|
1180
|
-
public_sysinfo:
|
|
1181
|
-
gateway_enabled:
|
|
1509
|
+
kms_enabled: z12.boolean().optional(),
|
|
1510
|
+
public_logs: z12.boolean().optional(),
|
|
1511
|
+
public_sysinfo: z12.boolean().optional(),
|
|
1512
|
+
gateway_enabled: z12.boolean().optional(),
|
|
1182
1513
|
// recommended
|
|
1183
|
-
tproxy_enabled:
|
|
1514
|
+
tproxy_enabled: z12.boolean().optional()
|
|
1184
1515
|
// deprecated, for compatibility
|
|
1185
1516
|
}),
|
|
1186
|
-
listed:
|
|
1187
|
-
kms_id:
|
|
1188
|
-
kms:
|
|
1517
|
+
listed: z12.boolean().optional(),
|
|
1518
|
+
kms_id: z12.string().optional(),
|
|
1519
|
+
kms: z12.enum(["PHALA", "ETHEREUM", "BASE"]).optional(),
|
|
1189
1520
|
// KMS type selection (defaults to PHALA)
|
|
1190
|
-
kms_contract:
|
|
1521
|
+
kms_contract: z12.string().optional(),
|
|
1191
1522
|
// KMS contract address for on-chain KMS
|
|
1192
|
-
env_keys:
|
|
1523
|
+
env_keys: z12.array(z12.string()).optional(),
|
|
1193
1524
|
// Manual nonce specification (Advanced - PHALA KMS only)
|
|
1194
|
-
nonce:
|
|
1525
|
+
nonce: z12.number().optional(),
|
|
1195
1526
|
// User-specified nonce for deterministic app_id generation
|
|
1196
|
-
app_id:
|
|
1527
|
+
app_id: z12.string().optional()
|
|
1197
1528
|
// Expected app_id (must match calculated app_id from nonce)
|
|
1198
|
-
}).passthrough()
|
|
1529
|
+
}).passthrough().transform((data) => {
|
|
1530
|
+
if (!data.instance_type && !data.vcpu && !data.memory) {
|
|
1531
|
+
return { ...data, instance_type: "tdx.small" };
|
|
1532
|
+
}
|
|
1533
|
+
return data;
|
|
1534
|
+
});
|
|
1199
1535
|
function handleGatewayCompatibility(appCompose) {
|
|
1200
1536
|
if (!appCompose.compose_file) {
|
|
1201
1537
|
return appCompose;
|
|
@@ -1231,63 +1567,64 @@ var { action: provisionCvm, safeAction: safeProvisionCvm } = defineAction(Provis
|
|
|
1231
1567
|
});
|
|
1232
1568
|
|
|
1233
1569
|
// src/actions/cvms/commit_cvm_provision.ts
|
|
1234
|
-
import { z as
|
|
1235
|
-
var CommitCvmProvisionSchema =
|
|
1236
|
-
id:
|
|
1237
|
-
name:
|
|
1238
|
-
status:
|
|
1239
|
-
teepod_id:
|
|
1240
|
-
teepod:
|
|
1241
|
-
id:
|
|
1242
|
-
name:
|
|
1570
|
+
import { z as z13 } from "zod";
|
|
1571
|
+
var CommitCvmProvisionSchema = z13.object({
|
|
1572
|
+
id: z13.number(),
|
|
1573
|
+
name: z13.string(),
|
|
1574
|
+
status: z13.string(),
|
|
1575
|
+
teepod_id: z13.number(),
|
|
1576
|
+
teepod: z13.object({
|
|
1577
|
+
id: z13.number(),
|
|
1578
|
+
name: z13.string()
|
|
1243
1579
|
}).nullable(),
|
|
1244
|
-
user_id:
|
|
1245
|
-
app_id:
|
|
1246
|
-
vm_uuid:
|
|
1247
|
-
instance_id:
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1580
|
+
user_id: z13.number().nullable(),
|
|
1581
|
+
app_id: z13.string().nullable(),
|
|
1582
|
+
vm_uuid: z13.string().nullable(),
|
|
1583
|
+
instance_id: z13.string().nullable(),
|
|
1584
|
+
// Deprecated fields - will be removed in next API version
|
|
1585
|
+
app_url: z13.string().nullable().default(null),
|
|
1586
|
+
base_image: z13.string().nullable(),
|
|
1587
|
+
vcpu: z13.number(),
|
|
1588
|
+
memory: z13.number(),
|
|
1589
|
+
disk_size: z13.number(),
|
|
1590
|
+
manifest_version: z13.number().nullable().default(2),
|
|
1591
|
+
version: z13.string().nullable().default("1.0.0"),
|
|
1592
|
+
runner: z13.string().nullable().default("docker-compose"),
|
|
1593
|
+
docker_compose_file: z13.string().nullable(),
|
|
1594
|
+
features: z13.array(z13.string()).nullable().default(["kms", "tproxy-net"]),
|
|
1595
|
+
created_at: z13.string(),
|
|
1596
|
+
encrypted_env_pubkey: z13.string().nullable().optional(),
|
|
1597
|
+
app_auth_contract_address: z13.string().nullable().optional(),
|
|
1598
|
+
deployer_address: z13.string().nullable().optional()
|
|
1262
1599
|
}).passthrough();
|
|
1263
|
-
var CommitCvmProvisionRequestSchema =
|
|
1264
|
-
encrypted_env:
|
|
1265
|
-
app_id:
|
|
1266
|
-
compose_hash:
|
|
1267
|
-
kms_id:
|
|
1268
|
-
contract_address:
|
|
1269
|
-
deployer_address:
|
|
1270
|
-
env_keys:
|
|
1600
|
+
var CommitCvmProvisionRequestSchema = z13.object({
|
|
1601
|
+
encrypted_env: z13.string().optional().nullable(),
|
|
1602
|
+
app_id: z13.string(),
|
|
1603
|
+
compose_hash: z13.string(),
|
|
1604
|
+
kms_id: z13.string().optional(),
|
|
1605
|
+
contract_address: z13.string().optional(),
|
|
1606
|
+
deployer_address: z13.string().optional(),
|
|
1607
|
+
env_keys: z13.array(z13.string()).optional().nullable()
|
|
1271
1608
|
}).passthrough();
|
|
1272
1609
|
var { action: commitCvmProvision, safeAction: safeCommitCvmProvision } = defineAction(CommitCvmProvisionSchema, async (client, payload) => {
|
|
1273
1610
|
return await client.post("/cvms", payload);
|
|
1274
1611
|
});
|
|
1275
1612
|
|
|
1276
1613
|
// src/types/app_compose.ts
|
|
1277
|
-
import { z as
|
|
1278
|
-
var LooseAppComposeSchema =
|
|
1279
|
-
allowed_envs:
|
|
1280
|
-
docker_compose_file:
|
|
1281
|
-
features:
|
|
1282
|
-
name:
|
|
1283
|
-
manifest_version:
|
|
1284
|
-
kms_enabled:
|
|
1285
|
-
public_logs:
|
|
1286
|
-
public_sysinfo:
|
|
1287
|
-
tproxy_enabled:
|
|
1288
|
-
pre_launch_script:
|
|
1289
|
-
env_pubkey:
|
|
1290
|
-
salt:
|
|
1614
|
+
import { z as z14 } from "zod";
|
|
1615
|
+
var LooseAppComposeSchema = z14.object({
|
|
1616
|
+
allowed_envs: z14.array(z14.string()).optional(),
|
|
1617
|
+
docker_compose_file: z14.string(),
|
|
1618
|
+
features: z14.array(z14.string()).optional(),
|
|
1619
|
+
name: z14.string().optional(),
|
|
1620
|
+
manifest_version: z14.number().optional(),
|
|
1621
|
+
kms_enabled: z14.boolean().optional(),
|
|
1622
|
+
public_logs: z14.boolean().optional(),
|
|
1623
|
+
public_sysinfo: z14.boolean().optional(),
|
|
1624
|
+
tproxy_enabled: z14.boolean().optional(),
|
|
1625
|
+
pre_launch_script: z14.string().optional(),
|
|
1626
|
+
env_pubkey: z14.string().optional(),
|
|
1627
|
+
salt: z14.string().optional().nullable()
|
|
1291
1628
|
}).passthrough();
|
|
1292
1629
|
|
|
1293
1630
|
// src/utils/get_compose_hash.ts
|
|
@@ -1350,20 +1687,20 @@ var { action: getCvmComposeFile, safeAction: safeGetCvmComposeFile } = defineAct
|
|
|
1350
1687
|
});
|
|
1351
1688
|
|
|
1352
1689
|
// src/actions/cvms/provision_cvm_compose_file_update.ts
|
|
1353
|
-
import { z as
|
|
1354
|
-
var ProvisionCvmComposeFileUpdateRequestSchema =
|
|
1355
|
-
id:
|
|
1356
|
-
uuid:
|
|
1357
|
-
app_id:
|
|
1690
|
+
import { z as z15 } from "zod";
|
|
1691
|
+
var ProvisionCvmComposeFileUpdateRequestSchema = z15.object({
|
|
1692
|
+
id: z15.string().optional(),
|
|
1693
|
+
uuid: z15.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
|
|
1694
|
+
app_id: z15.string().refine(
|
|
1358
1695
|
(val) => !val.startsWith("app_") && val.length === 40,
|
|
1359
1696
|
"app_id should be 40 characters without prefix"
|
|
1360
1697
|
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
1361
|
-
instance_id:
|
|
1698
|
+
instance_id: z15.string().refine(
|
|
1362
1699
|
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
1363
1700
|
"instance_id should be 40 characters without prefix"
|
|
1364
1701
|
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1365
1702
|
app_compose: LooseAppComposeSchema,
|
|
1366
|
-
update_env_vars:
|
|
1703
|
+
update_env_vars: z15.boolean().optional().nullable()
|
|
1367
1704
|
}).refine(
|
|
1368
1705
|
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1369
1706
|
"One of id, uuid, app_id, or instance_id must be provided"
|
|
@@ -1374,10 +1711,10 @@ var ProvisionCvmComposeFileUpdateRequestSchema = z13.object({
|
|
|
1374
1711
|
_raw: data
|
|
1375
1712
|
};
|
|
1376
1713
|
});
|
|
1377
|
-
var ProvisionCvmComposeFileUpdateResultSchema =
|
|
1378
|
-
app_id:
|
|
1379
|
-
device_id:
|
|
1380
|
-
compose_hash:
|
|
1714
|
+
var ProvisionCvmComposeFileUpdateResultSchema = z15.object({
|
|
1715
|
+
app_id: z15.string().nullable(),
|
|
1716
|
+
device_id: z15.string().nullable(),
|
|
1717
|
+
compose_hash: z15.string(),
|
|
1381
1718
|
kms_info: KmsInfoSchema.nullable().optional()
|
|
1382
1719
|
}).passthrough();
|
|
1383
1720
|
var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmComposeFileUpdate } = defineAction(ProvisionCvmComposeFileUpdateResultSchema, async (client, request) => {
|
|
@@ -1389,22 +1726,22 @@ var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmCompose
|
|
|
1389
1726
|
});
|
|
1390
1727
|
|
|
1391
1728
|
// src/actions/cvms/commit_cvm_compose_file_update.ts
|
|
1392
|
-
import { z as
|
|
1393
|
-
var CommitCvmComposeFileUpdateRequestSchema =
|
|
1394
|
-
id:
|
|
1395
|
-
uuid:
|
|
1396
|
-
app_id:
|
|
1729
|
+
import { z as z16 } from "zod";
|
|
1730
|
+
var CommitCvmComposeFileUpdateRequestSchema = z16.object({
|
|
1731
|
+
id: z16.string().optional(),
|
|
1732
|
+
uuid: z16.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
|
|
1733
|
+
app_id: z16.string().refine(
|
|
1397
1734
|
(val) => !val.startsWith("app_") && val.length === 40,
|
|
1398
1735
|
"app_id should be 40 characters without prefix"
|
|
1399
1736
|
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
1400
|
-
instance_id:
|
|
1737
|
+
instance_id: z16.string().refine(
|
|
1401
1738
|
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
1402
1739
|
"instance_id should be 40 characters without prefix"
|
|
1403
1740
|
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1404
|
-
compose_hash:
|
|
1405
|
-
encrypted_env:
|
|
1406
|
-
env_keys:
|
|
1407
|
-
update_env_vars:
|
|
1741
|
+
compose_hash: z16.string().min(1, "Compose hash is required"),
|
|
1742
|
+
encrypted_env: z16.string().optional(),
|
|
1743
|
+
env_keys: z16.array(z16.string()).optional(),
|
|
1744
|
+
update_env_vars: z16.boolean().optional().nullable()
|
|
1408
1745
|
}).refine(
|
|
1409
1746
|
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1410
1747
|
"One of id, uuid, app_id, or instance_id must be provided"
|
|
@@ -1413,10 +1750,10 @@ var CommitCvmComposeFileUpdateRequestSchema = z14.object({
|
|
|
1413
1750
|
compose_hash: data.compose_hash,
|
|
1414
1751
|
encrypted_env: data.encrypted_env,
|
|
1415
1752
|
env_keys: data.env_keys,
|
|
1416
|
-
update_env_vars:
|
|
1753
|
+
update_env_vars: data.update_env_vars ?? void 0,
|
|
1417
1754
|
_raw: data
|
|
1418
1755
|
}));
|
|
1419
|
-
var CommitCvmComposeFileUpdateSchema =
|
|
1756
|
+
var CommitCvmComposeFileUpdateSchema = z16.any().transform(() => void 0);
|
|
1420
1757
|
var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUpdate } = defineAction(
|
|
1421
1758
|
CommitCvmComposeFileUpdateSchema,
|
|
1422
1759
|
async (client, request) => {
|
|
@@ -1424,15 +1761,241 @@ var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUp
|
|
|
1424
1761
|
return await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
|
|
1425
1762
|
compose_hash: validatedRequest.compose_hash,
|
|
1426
1763
|
encrypted_env: validatedRequest.encrypted_env,
|
|
1427
|
-
env_keys: validatedRequest.env_keys
|
|
1764
|
+
env_keys: validatedRequest.env_keys,
|
|
1765
|
+
update_env_vars: validatedRequest.update_env_vars
|
|
1428
1766
|
});
|
|
1429
1767
|
}
|
|
1430
1768
|
);
|
|
1431
1769
|
|
|
1770
|
+
// src/actions/cvms/update_cvm_envs.ts
|
|
1771
|
+
import { z as z17 } from "zod";
|
|
1772
|
+
var UpdateCvmEnvsRequestSchema = refineCvmId(
|
|
1773
|
+
CvmIdObjectSchema.extend({
|
|
1774
|
+
encrypted_env: z17.string().describe("Encrypted environment variables (hex string)"),
|
|
1775
|
+
env_keys: z17.array(z17.string()).optional().describe("List of allowed environment variable keys"),
|
|
1776
|
+
compose_hash: z17.string().optional().describe("Compose hash for verification (Phase 2, required when env_keys changes)"),
|
|
1777
|
+
transaction_hash: z17.string().optional().describe(
|
|
1778
|
+
"On-chain transaction hash for verification (Phase 2, required when env_keys changes)"
|
|
1779
|
+
)
|
|
1780
|
+
})
|
|
1781
|
+
).transform((data) => {
|
|
1782
|
+
const { cvmId } = CvmIdSchema.parse(data);
|
|
1783
|
+
return {
|
|
1784
|
+
cvmId,
|
|
1785
|
+
request: {
|
|
1786
|
+
encrypted_env: data.encrypted_env,
|
|
1787
|
+
env_keys: data.env_keys,
|
|
1788
|
+
compose_hash: data.compose_hash,
|
|
1789
|
+
transaction_hash: data.transaction_hash
|
|
1790
|
+
},
|
|
1791
|
+
_raw: data
|
|
1792
|
+
};
|
|
1793
|
+
});
|
|
1794
|
+
var UpdateCvmEnvsInProgressSchema = z17.object({
|
|
1795
|
+
status: z17.literal("in_progress"),
|
|
1796
|
+
message: z17.string(),
|
|
1797
|
+
correlation_id: z17.string(),
|
|
1798
|
+
allowed_envs_changed: z17.boolean()
|
|
1799
|
+
});
|
|
1800
|
+
var UpdateCvmEnvsPreconditionRequiredSchema = z17.object({
|
|
1801
|
+
status: z17.literal("precondition_required"),
|
|
1802
|
+
message: z17.string(),
|
|
1803
|
+
compose_hash: z17.string(),
|
|
1804
|
+
app_id: z17.string(),
|
|
1805
|
+
device_id: z17.string(),
|
|
1806
|
+
kms_info: KmsInfoSchema
|
|
1807
|
+
});
|
|
1808
|
+
var UpdateCvmEnvsResultSchema = z17.union([
|
|
1809
|
+
UpdateCvmEnvsInProgressSchema,
|
|
1810
|
+
UpdateCvmEnvsPreconditionRequiredSchema
|
|
1811
|
+
]);
|
|
1812
|
+
var { action: updateCvmEnvs, safeAction: safeUpdateCvmEnvs } = defineAction(UpdateCvmEnvsResultSchema, async (client, request) => {
|
|
1813
|
+
const validatedRequest = UpdateCvmEnvsRequestSchema.parse(request);
|
|
1814
|
+
try {
|
|
1815
|
+
const response = await client.patch(
|
|
1816
|
+
`/cvms/${validatedRequest.cvmId}/envs`,
|
|
1817
|
+
validatedRequest.request
|
|
1818
|
+
);
|
|
1819
|
+
return response;
|
|
1820
|
+
} catch (error) {
|
|
1821
|
+
if (error instanceof PhalaCloudError && error.status === 465) {
|
|
1822
|
+
const detail = error.detail;
|
|
1823
|
+
if (detail && typeof detail === "object") {
|
|
1824
|
+
const detailObj = detail;
|
|
1825
|
+
return {
|
|
1826
|
+
status: "precondition_required",
|
|
1827
|
+
message: detailObj.message || "Compose hash verification required",
|
|
1828
|
+
compose_hash: detailObj.compose_hash,
|
|
1829
|
+
app_id: detailObj.app_id,
|
|
1830
|
+
device_id: detailObj.device_id,
|
|
1831
|
+
kms_info: detailObj.kms_info
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
throw error;
|
|
1836
|
+
}
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1839
|
+
// src/actions/cvms/update_docker_compose.ts
|
|
1840
|
+
import { z as z18 } from "zod";
|
|
1841
|
+
var UpdateDockerComposeRequestSchema = refineCvmId(
|
|
1842
|
+
CvmIdObjectSchema.extend({
|
|
1843
|
+
docker_compose_file: z18.string().describe("Docker Compose YAML content"),
|
|
1844
|
+
compose_hash: z18.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
1845
|
+
transaction_hash: z18.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
1846
|
+
})
|
|
1847
|
+
).transform((data) => {
|
|
1848
|
+
const { cvmId } = CvmIdSchema.parse(data);
|
|
1849
|
+
return {
|
|
1850
|
+
cvmId,
|
|
1851
|
+
request: {
|
|
1852
|
+
docker_compose_file: data.docker_compose_file,
|
|
1853
|
+
compose_hash: data.compose_hash,
|
|
1854
|
+
transaction_hash: data.transaction_hash
|
|
1855
|
+
},
|
|
1856
|
+
_raw: data
|
|
1857
|
+
};
|
|
1858
|
+
});
|
|
1859
|
+
var UpdateDockerComposeInProgressSchema = z18.object({
|
|
1860
|
+
status: z18.literal("in_progress"),
|
|
1861
|
+
message: z18.string(),
|
|
1862
|
+
correlation_id: z18.string()
|
|
1863
|
+
});
|
|
1864
|
+
var UpdateDockerComposePreconditionRequiredSchema = z18.object({
|
|
1865
|
+
status: z18.literal("precondition_required"),
|
|
1866
|
+
message: z18.string(),
|
|
1867
|
+
compose_hash: z18.string(),
|
|
1868
|
+
app_id: z18.string(),
|
|
1869
|
+
device_id: z18.string(),
|
|
1870
|
+
kms_info: KmsInfoSchema
|
|
1871
|
+
});
|
|
1872
|
+
var UpdateDockerComposeResultSchema = z18.union([
|
|
1873
|
+
UpdateDockerComposeInProgressSchema,
|
|
1874
|
+
UpdateDockerComposePreconditionRequiredSchema
|
|
1875
|
+
]);
|
|
1876
|
+
var { action: updateDockerCompose, safeAction: safeUpdateDockerCompose } = defineAction(UpdateDockerComposeResultSchema, async (client, request) => {
|
|
1877
|
+
const validatedRequest = UpdateDockerComposeRequestSchema.parse(request);
|
|
1878
|
+
const headers = {
|
|
1879
|
+
"Content-Type": "text/yaml"
|
|
1880
|
+
};
|
|
1881
|
+
if (validatedRequest.request.compose_hash) {
|
|
1882
|
+
headers["X-Compose-Hash"] = validatedRequest.request.compose_hash;
|
|
1883
|
+
}
|
|
1884
|
+
if (validatedRequest.request.transaction_hash) {
|
|
1885
|
+
headers["X-Transaction-Hash"] = validatedRequest.request.transaction_hash;
|
|
1886
|
+
}
|
|
1887
|
+
try {
|
|
1888
|
+
const response = await client.patch(
|
|
1889
|
+
`/cvms/${validatedRequest.cvmId}/docker-compose`,
|
|
1890
|
+
validatedRequest.request.docker_compose_file,
|
|
1891
|
+
{ headers }
|
|
1892
|
+
);
|
|
1893
|
+
return response;
|
|
1894
|
+
} catch (error) {
|
|
1895
|
+
if (error instanceof PhalaCloudError && error.status === 465) {
|
|
1896
|
+
const detail = error.detail;
|
|
1897
|
+
if (detail && typeof detail === "object") {
|
|
1898
|
+
const detailObj = detail;
|
|
1899
|
+
return {
|
|
1900
|
+
status: "precondition_required",
|
|
1901
|
+
message: detailObj.message || "Compose hash verification required",
|
|
1902
|
+
compose_hash: detailObj.compose_hash,
|
|
1903
|
+
app_id: detailObj.app_id,
|
|
1904
|
+
device_id: detailObj.device_id,
|
|
1905
|
+
kms_info: detailObj.kms_info
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
throw error;
|
|
1910
|
+
}
|
|
1911
|
+
});
|
|
1912
|
+
|
|
1913
|
+
// src/actions/cvms/update_prelaunch_script.ts
|
|
1914
|
+
import { z as z19 } from "zod";
|
|
1915
|
+
var UpdatePreLaunchScriptRequestSchema = refineCvmId(
|
|
1916
|
+
CvmIdObjectSchema.extend({
|
|
1917
|
+
pre_launch_script: z19.string().describe("Pre-launch script content (shell script)"),
|
|
1918
|
+
compose_hash: z19.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
1919
|
+
transaction_hash: z19.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
1920
|
+
})
|
|
1921
|
+
).transform((data) => {
|
|
1922
|
+
const { cvmId } = CvmIdSchema.parse(data);
|
|
1923
|
+
return {
|
|
1924
|
+
cvmId,
|
|
1925
|
+
request: {
|
|
1926
|
+
pre_launch_script: data.pre_launch_script,
|
|
1927
|
+
compose_hash: data.compose_hash,
|
|
1928
|
+
transaction_hash: data.transaction_hash
|
|
1929
|
+
},
|
|
1930
|
+
_raw: data
|
|
1931
|
+
};
|
|
1932
|
+
});
|
|
1933
|
+
var UpdatePreLaunchScriptInProgressSchema = z19.object({
|
|
1934
|
+
status: z19.literal("in_progress"),
|
|
1935
|
+
message: z19.string(),
|
|
1936
|
+
correlation_id: z19.string()
|
|
1937
|
+
});
|
|
1938
|
+
var UpdatePreLaunchScriptPreconditionRequiredSchema = z19.object({
|
|
1939
|
+
status: z19.literal("precondition_required"),
|
|
1940
|
+
message: z19.string(),
|
|
1941
|
+
compose_hash: z19.string(),
|
|
1942
|
+
app_id: z19.string(),
|
|
1943
|
+
device_id: z19.string(),
|
|
1944
|
+
kms_info: KmsInfoSchema
|
|
1945
|
+
});
|
|
1946
|
+
var UpdatePreLaunchScriptResultSchema = z19.union([
|
|
1947
|
+
UpdatePreLaunchScriptInProgressSchema,
|
|
1948
|
+
UpdatePreLaunchScriptPreconditionRequiredSchema
|
|
1949
|
+
]);
|
|
1950
|
+
var { action: updatePreLaunchScript, safeAction: safeUpdatePreLaunchScript } = defineAction(UpdatePreLaunchScriptResultSchema, async (client, request) => {
|
|
1951
|
+
const validatedRequest = UpdatePreLaunchScriptRequestSchema.parse(request);
|
|
1952
|
+
const headers = {
|
|
1953
|
+
"Content-Type": "text/plain"
|
|
1954
|
+
};
|
|
1955
|
+
if (validatedRequest.request.compose_hash) {
|
|
1956
|
+
headers["X-Compose-Hash"] = validatedRequest.request.compose_hash;
|
|
1957
|
+
}
|
|
1958
|
+
if (validatedRequest.request.transaction_hash) {
|
|
1959
|
+
headers["X-Transaction-Hash"] = validatedRequest.request.transaction_hash;
|
|
1960
|
+
}
|
|
1961
|
+
try {
|
|
1962
|
+
const response = await client.patch(
|
|
1963
|
+
`/cvms/${validatedRequest.cvmId}/pre-launch-script`,
|
|
1964
|
+
validatedRequest.request.pre_launch_script,
|
|
1965
|
+
{ headers }
|
|
1966
|
+
);
|
|
1967
|
+
return response;
|
|
1968
|
+
} catch (error) {
|
|
1969
|
+
if (error instanceof PhalaCloudError && error.status === 465) {
|
|
1970
|
+
const detail = error.detail;
|
|
1971
|
+
if (detail && typeof detail === "object") {
|
|
1972
|
+
const detailObj = detail;
|
|
1973
|
+
return {
|
|
1974
|
+
status: "precondition_required",
|
|
1975
|
+
message: detailObj.message || "Compose hash verification required",
|
|
1976
|
+
compose_hash: detailObj.compose_hash,
|
|
1977
|
+
app_id: detailObj.app_id,
|
|
1978
|
+
device_id: detailObj.device_id,
|
|
1979
|
+
kms_info: detailObj.kms_info
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
throw error;
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
|
|
1987
|
+
// src/actions/cvms/get_cvm_prelaunch_script.ts
|
|
1988
|
+
import { z as z20 } from "zod";
|
|
1989
|
+
var GetCvmPreLaunchScriptRequestSchema = CvmIdSchema;
|
|
1990
|
+
var { action: getCvmPreLaunchScript, safeAction: safeGetCvmPreLaunchScript } = defineAction(z20.string(), async (client, request) => {
|
|
1991
|
+
const { cvmId } = GetCvmPreLaunchScriptRequestSchema.parse(request);
|
|
1992
|
+
return await client.get(`/cvms/${cvmId}/pre-launch-script`);
|
|
1993
|
+
});
|
|
1994
|
+
|
|
1432
1995
|
// src/actions/kms/get_kms_info.ts
|
|
1433
|
-
import { z as
|
|
1434
|
-
var GetKmsInfoRequestSchema =
|
|
1435
|
-
kms_id:
|
|
1996
|
+
import { z as z21 } from "zod";
|
|
1997
|
+
var GetKmsInfoRequestSchema = z21.object({
|
|
1998
|
+
kms_id: z21.string().min(1, "KMS ID is required")
|
|
1436
1999
|
});
|
|
1437
2000
|
var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSchema, async (client, request) => {
|
|
1438
2001
|
const validatedRequest = GetKmsInfoRequestSchema.parse(request);
|
|
@@ -1440,18 +2003,18 @@ var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSch
|
|
|
1440
2003
|
});
|
|
1441
2004
|
|
|
1442
2005
|
// src/actions/kms/get_kms_list.ts
|
|
1443
|
-
import { z as
|
|
1444
|
-
var GetKmsListRequestSchema =
|
|
1445
|
-
page:
|
|
1446
|
-
page_size:
|
|
1447
|
-
is_onchain:
|
|
2006
|
+
import { z as z22 } from "zod";
|
|
2007
|
+
var GetKmsListRequestSchema = z22.object({
|
|
2008
|
+
page: z22.number().int().min(1).optional(),
|
|
2009
|
+
page_size: z22.number().int().min(1).optional(),
|
|
2010
|
+
is_onchain: z22.boolean().optional()
|
|
1448
2011
|
}).strict();
|
|
1449
|
-
var GetKmsListSchema =
|
|
1450
|
-
items:
|
|
1451
|
-
total:
|
|
1452
|
-
page:
|
|
1453
|
-
page_size:
|
|
1454
|
-
pages:
|
|
2012
|
+
var GetKmsListSchema = z22.object({
|
|
2013
|
+
items: z22.array(KmsInfoSchema),
|
|
2014
|
+
total: z22.number(),
|
|
2015
|
+
page: z22.number(),
|
|
2016
|
+
page_size: z22.number(),
|
|
2017
|
+
pages: z22.number()
|
|
1455
2018
|
}).strict();
|
|
1456
2019
|
var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsListSchema, async (client, request) => {
|
|
1457
2020
|
const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
|
|
@@ -1459,17 +2022,17 @@ var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsList
|
|
|
1459
2022
|
});
|
|
1460
2023
|
|
|
1461
2024
|
// src/actions/kms/get_app_env_encrypt_pubkey.ts
|
|
1462
|
-
import { z as
|
|
1463
|
-
var GetAppEnvEncryptPubKeyRequestSchema =
|
|
1464
|
-
kms:
|
|
1465
|
-
app_id:
|
|
2025
|
+
import { z as z23 } from "zod";
|
|
2026
|
+
var GetAppEnvEncryptPubKeyRequestSchema = z23.object({
|
|
2027
|
+
kms: z23.string().min(1, "KMS ID or slug is required"),
|
|
2028
|
+
app_id: z23.string().refine(
|
|
1466
2029
|
(val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
|
|
1467
2030
|
"App ID must be exactly 40 characters or 42 characters with 0x prefix"
|
|
1468
2031
|
)
|
|
1469
2032
|
}).strict();
|
|
1470
|
-
var GetAppEnvEncryptPubKeySchema =
|
|
1471
|
-
public_key:
|
|
1472
|
-
signature:
|
|
2033
|
+
var GetAppEnvEncryptPubKeySchema = z23.object({
|
|
2034
|
+
public_key: z23.string(),
|
|
2035
|
+
signature: z23.string()
|
|
1473
2036
|
}).strict();
|
|
1474
2037
|
var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } = defineAction(GetAppEnvEncryptPubKeySchema, async (client, payload) => {
|
|
1475
2038
|
const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
|
|
@@ -1477,15 +2040,15 @@ var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } =
|
|
|
1477
2040
|
});
|
|
1478
2041
|
|
|
1479
2042
|
// src/actions/kms/next_app_ids.ts
|
|
1480
|
-
import { z as
|
|
1481
|
-
var NextAppIdsRequestSchema =
|
|
1482
|
-
counts:
|
|
2043
|
+
import { z as z24 } from "zod";
|
|
2044
|
+
var NextAppIdsRequestSchema = z24.object({
|
|
2045
|
+
counts: z24.number().int().min(1).max(20).optional().default(1)
|
|
1483
2046
|
}).strict();
|
|
1484
|
-
var NextAppIdsSchema =
|
|
1485
|
-
app_ids:
|
|
1486
|
-
|
|
1487
|
-
app_id:
|
|
1488
|
-
nonce:
|
|
2047
|
+
var NextAppIdsSchema = z24.object({
|
|
2048
|
+
app_ids: z24.array(
|
|
2049
|
+
z24.object({
|
|
2050
|
+
app_id: z24.string(),
|
|
2051
|
+
nonce: z24.number().int().min(0)
|
|
1489
2052
|
})
|
|
1490
2053
|
)
|
|
1491
2054
|
}).strict();
|
|
@@ -1496,6 +2059,36 @@ var { action: nextAppIds, safeAction: safeNextAppIds } = defineAction(NextAppIds
|
|
|
1496
2059
|
return await client.get(`/kms/phala/next_app_id?${params.toString()}`);
|
|
1497
2060
|
});
|
|
1498
2061
|
|
|
2062
|
+
// src/types/cvm_info.ts
|
|
2063
|
+
import { z as z25 } from "zod";
|
|
2064
|
+
var VMSchema = z25.object({
|
|
2065
|
+
id: z25.number(),
|
|
2066
|
+
name: z25.string(),
|
|
2067
|
+
status: z25.string(),
|
|
2068
|
+
teepod_id: z25.number(),
|
|
2069
|
+
teepod: z25.object({
|
|
2070
|
+
id: z25.number(),
|
|
2071
|
+
name: z25.string(),
|
|
2072
|
+
region_identifier: z25.string().nullable().optional()
|
|
2073
|
+
}).optional().nullable(),
|
|
2074
|
+
user_id: z25.number().optional().nullable(),
|
|
2075
|
+
app_id: z25.string(),
|
|
2076
|
+
vm_uuid: z25.string().nullable(),
|
|
2077
|
+
instance_id: z25.string().nullable(),
|
|
2078
|
+
app_url: z25.string().optional().nullable(),
|
|
2079
|
+
base_image: z25.string().nullable(),
|
|
2080
|
+
vcpu: z25.number(),
|
|
2081
|
+
memory: z25.number(),
|
|
2082
|
+
disk_size: z25.number(),
|
|
2083
|
+
manifest_version: z25.number().optional().nullable(),
|
|
2084
|
+
version: z25.string().optional().nullable(),
|
|
2085
|
+
runner: z25.string().optional().nullable(),
|
|
2086
|
+
docker_compose_file: z25.string().optional().nullable(),
|
|
2087
|
+
features: z25.array(z25.string()).optional().nullable(),
|
|
2088
|
+
created_at: z25.string(),
|
|
2089
|
+
encrypted_env_pubkey: z25.string().nullable()
|
|
2090
|
+
});
|
|
2091
|
+
|
|
1499
2092
|
// src/actions/cvms/start_cvm.ts
|
|
1500
2093
|
var StartCvmRequestSchema = CvmIdSchema;
|
|
1501
2094
|
var { action: startCvm, safeAction: safeStartCvm } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -1521,10 +2114,10 @@ var { action: shutdownCvm, safeAction: safeShutdownCvm } = defineAction(VMSchema
|
|
|
1521
2114
|
});
|
|
1522
2115
|
|
|
1523
2116
|
// src/actions/cvms/restart_cvm.ts
|
|
1524
|
-
import { z as
|
|
2117
|
+
import { z as z26 } from "zod";
|
|
1525
2118
|
var RestartCvmRequestSchema = refineCvmId(
|
|
1526
2119
|
CvmIdObjectSchema.extend({
|
|
1527
|
-
force:
|
|
2120
|
+
force: z26.boolean().optional()
|
|
1528
2121
|
})
|
|
1529
2122
|
);
|
|
1530
2123
|
var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -1535,10 +2128,10 @@ var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema,
|
|
|
1535
2128
|
});
|
|
1536
2129
|
|
|
1537
2130
|
// src/actions/cvms/delete_cvm.ts
|
|
1538
|
-
import { z as
|
|
2131
|
+
import { z as z27 } from "zod";
|
|
1539
2132
|
var DeleteCvmRequestSchema = CvmIdSchema;
|
|
1540
2133
|
var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
1541
|
-
|
|
2134
|
+
z27.void(),
|
|
1542
2135
|
async (client, request) => {
|
|
1543
2136
|
const { cvmId } = DeleteCvmRequestSchema.parse(request);
|
|
1544
2137
|
await client.delete(`/cvms/${cvmId}`);
|
|
@@ -1547,41 +2140,41 @@ var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
|
1547
2140
|
);
|
|
1548
2141
|
|
|
1549
2142
|
// src/actions/cvms/get_cvm_stats.ts
|
|
1550
|
-
import { z as
|
|
1551
|
-
var DiskInfoSchema =
|
|
1552
|
-
name:
|
|
1553
|
-
mount_point:
|
|
1554
|
-
total_size:
|
|
1555
|
-
free_size:
|
|
1556
|
-
});
|
|
1557
|
-
var SystemInfoSchema =
|
|
1558
|
-
os_name:
|
|
1559
|
-
os_version:
|
|
1560
|
-
kernel_version:
|
|
1561
|
-
cpu_model:
|
|
1562
|
-
num_cpus:
|
|
1563
|
-
total_memory:
|
|
1564
|
-
available_memory:
|
|
1565
|
-
used_memory:
|
|
1566
|
-
free_memory:
|
|
1567
|
-
total_swap:
|
|
1568
|
-
used_swap:
|
|
1569
|
-
free_swap:
|
|
1570
|
-
uptime:
|
|
1571
|
-
loadavg_one:
|
|
1572
|
-
loadavg_five:
|
|
1573
|
-
loadavg_fifteen:
|
|
1574
|
-
disks:
|
|
1575
|
-
});
|
|
1576
|
-
var CvmSystemInfoSchema =
|
|
1577
|
-
is_online:
|
|
1578
|
-
is_public:
|
|
1579
|
-
error:
|
|
2143
|
+
import { z as z28 } from "zod";
|
|
2144
|
+
var DiskInfoSchema = z28.object({
|
|
2145
|
+
name: z28.string(),
|
|
2146
|
+
mount_point: z28.string(),
|
|
2147
|
+
total_size: z28.number(),
|
|
2148
|
+
free_size: z28.number()
|
|
2149
|
+
});
|
|
2150
|
+
var SystemInfoSchema = z28.object({
|
|
2151
|
+
os_name: z28.string(),
|
|
2152
|
+
os_version: z28.string(),
|
|
2153
|
+
kernel_version: z28.string(),
|
|
2154
|
+
cpu_model: z28.string(),
|
|
2155
|
+
num_cpus: z28.number(),
|
|
2156
|
+
total_memory: z28.number(),
|
|
2157
|
+
available_memory: z28.number(),
|
|
2158
|
+
used_memory: z28.number(),
|
|
2159
|
+
free_memory: z28.number(),
|
|
2160
|
+
total_swap: z28.number(),
|
|
2161
|
+
used_swap: z28.number(),
|
|
2162
|
+
free_swap: z28.number(),
|
|
2163
|
+
uptime: z28.number(),
|
|
2164
|
+
loadavg_one: z28.number(),
|
|
2165
|
+
loadavg_five: z28.number(),
|
|
2166
|
+
loadavg_fifteen: z28.number(),
|
|
2167
|
+
disks: z28.array(DiskInfoSchema)
|
|
2168
|
+
});
|
|
2169
|
+
var CvmSystemInfoSchema = z28.object({
|
|
2170
|
+
is_online: z28.boolean(),
|
|
2171
|
+
is_public: z28.boolean().default(false),
|
|
2172
|
+
error: z28.string().nullable(),
|
|
1580
2173
|
sysinfo: SystemInfoSchema.nullable(),
|
|
1581
|
-
status:
|
|
1582
|
-
in_progress:
|
|
1583
|
-
boot_progress:
|
|
1584
|
-
boot_error:
|
|
2174
|
+
status: z28.string().nullable(),
|
|
2175
|
+
in_progress: z28.boolean().default(false),
|
|
2176
|
+
boot_progress: z28.string().nullable(),
|
|
2177
|
+
boot_error: z28.string().nullable()
|
|
1585
2178
|
});
|
|
1586
2179
|
var GetCvmStatsRequestSchema = CvmIdSchema;
|
|
1587
2180
|
var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSystemInfoSchema, async (client, request) => {
|
|
@@ -1590,18 +2183,18 @@ var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSyste
|
|
|
1590
2183
|
});
|
|
1591
2184
|
|
|
1592
2185
|
// src/actions/cvms/get_cvm_network.ts
|
|
1593
|
-
import { z as
|
|
1594
|
-
var
|
|
1595
|
-
app:
|
|
1596
|
-
instance:
|
|
1597
|
-
});
|
|
1598
|
-
var CvmNetworkSchema =
|
|
1599
|
-
is_online:
|
|
1600
|
-
is_public:
|
|
1601
|
-
error:
|
|
1602
|
-
internal_ip:
|
|
1603
|
-
latest_handshake:
|
|
1604
|
-
public_urls:
|
|
2186
|
+
import { z as z29 } from "zod";
|
|
2187
|
+
var CvmNetworkUrlsSchema = z29.object({
|
|
2188
|
+
app: z29.string(),
|
|
2189
|
+
instance: z29.string()
|
|
2190
|
+
});
|
|
2191
|
+
var CvmNetworkSchema = z29.object({
|
|
2192
|
+
is_online: z29.boolean(),
|
|
2193
|
+
is_public: z29.boolean().default(true),
|
|
2194
|
+
error: z29.string().nullable(),
|
|
2195
|
+
internal_ip: z29.string().nullable(),
|
|
2196
|
+
latest_handshake: z29.string().nullable(),
|
|
2197
|
+
public_urls: z29.array(CvmNetworkUrlsSchema).nullable()
|
|
1605
2198
|
});
|
|
1606
2199
|
var GetCvmNetworkRequestSchema = CvmIdSchema;
|
|
1607
2200
|
var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmNetworkSchema, async (client, request) => {
|
|
@@ -1610,36 +2203,36 @@ var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmN
|
|
|
1610
2203
|
});
|
|
1611
2204
|
|
|
1612
2205
|
// src/actions/cvms/get_cvm_docker_compose.ts
|
|
1613
|
-
import { z as
|
|
2206
|
+
import { z as z30 } from "zod";
|
|
1614
2207
|
var GetCvmDockerComposeRequestSchema = CvmIdSchema;
|
|
1615
|
-
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(
|
|
2208
|
+
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(z30.string(), async (client, request) => {
|
|
1616
2209
|
const { cvmId } = GetCvmDockerComposeRequestSchema.parse(request);
|
|
1617
2210
|
return await client.get(`/cvms/${cvmId}/docker-compose.yml`);
|
|
1618
2211
|
});
|
|
1619
2212
|
|
|
1620
2213
|
// src/actions/cvms/get_cvm_containers_stats.ts
|
|
1621
|
-
import { z as
|
|
1622
|
-
var ContainerInfoSchema =
|
|
1623
|
-
id:
|
|
1624
|
-
names:
|
|
1625
|
-
image:
|
|
1626
|
-
image_id:
|
|
1627
|
-
command:
|
|
1628
|
-
created:
|
|
1629
|
-
state:
|
|
1630
|
-
status:
|
|
1631
|
-
log_endpoint:
|
|
1632
|
-
});
|
|
1633
|
-
var CvmContainersStatsSchema =
|
|
1634
|
-
is_online:
|
|
1635
|
-
is_public:
|
|
1636
|
-
error:
|
|
1637
|
-
docker_compose_file:
|
|
1638
|
-
manifest_version:
|
|
1639
|
-
version:
|
|
1640
|
-
runner:
|
|
1641
|
-
features:
|
|
1642
|
-
containers:
|
|
2214
|
+
import { z as z31 } from "zod";
|
|
2215
|
+
var ContainerInfoSchema = z31.object({
|
|
2216
|
+
id: z31.string(),
|
|
2217
|
+
names: z31.array(z31.string()),
|
|
2218
|
+
image: z31.string(),
|
|
2219
|
+
image_id: z31.string(),
|
|
2220
|
+
command: z31.string().nullable().optional(),
|
|
2221
|
+
created: z31.number(),
|
|
2222
|
+
state: z31.string(),
|
|
2223
|
+
status: z31.string(),
|
|
2224
|
+
log_endpoint: z31.string().nullable()
|
|
2225
|
+
});
|
|
2226
|
+
var CvmContainersStatsSchema = z31.object({
|
|
2227
|
+
is_online: z31.boolean(),
|
|
2228
|
+
is_public: z31.boolean().default(true),
|
|
2229
|
+
error: z31.string().nullable(),
|
|
2230
|
+
docker_compose_file: z31.string().nullable(),
|
|
2231
|
+
manifest_version: z31.number().nullable(),
|
|
2232
|
+
version: z31.string().nullable(),
|
|
2233
|
+
runner: z31.string().nullable(),
|
|
2234
|
+
features: z31.array(z31.string()).nullable(),
|
|
2235
|
+
containers: z31.array(ContainerInfoSchema).nullable()
|
|
1643
2236
|
});
|
|
1644
2237
|
var GetCvmContainersStatsRequestSchema = CvmIdSchema;
|
|
1645
2238
|
var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = defineAction(CvmContainersStatsSchema, async (client, request) => {
|
|
@@ -1648,62 +2241,62 @@ var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = d
|
|
|
1648
2241
|
});
|
|
1649
2242
|
|
|
1650
2243
|
// src/actions/cvms/get_cvm_attestation.ts
|
|
1651
|
-
import { z as
|
|
1652
|
-
var CertificateSubjectSchema =
|
|
1653
|
-
common_name:
|
|
1654
|
-
organization:
|
|
1655
|
-
country:
|
|
1656
|
-
state:
|
|
1657
|
-
locality:
|
|
1658
|
-
});
|
|
1659
|
-
var CertificateIssuerSchema =
|
|
1660
|
-
common_name:
|
|
1661
|
-
organization:
|
|
1662
|
-
country:
|
|
1663
|
-
});
|
|
1664
|
-
var CertificateSchema =
|
|
2244
|
+
import { z as z32 } from "zod";
|
|
2245
|
+
var CertificateSubjectSchema = z32.object({
|
|
2246
|
+
common_name: z32.string().nullable(),
|
|
2247
|
+
organization: z32.string().nullable(),
|
|
2248
|
+
country: z32.string().nullable(),
|
|
2249
|
+
state: z32.string().nullable(),
|
|
2250
|
+
locality: z32.string().nullable()
|
|
2251
|
+
});
|
|
2252
|
+
var CertificateIssuerSchema = z32.object({
|
|
2253
|
+
common_name: z32.string().nullable(),
|
|
2254
|
+
organization: z32.string().nullable(),
|
|
2255
|
+
country: z32.string().nullable()
|
|
2256
|
+
});
|
|
2257
|
+
var CertificateSchema = z32.object({
|
|
1665
2258
|
subject: CertificateSubjectSchema,
|
|
1666
2259
|
issuer: CertificateIssuerSchema,
|
|
1667
|
-
serial_number:
|
|
1668
|
-
not_before:
|
|
2260
|
+
serial_number: z32.string(),
|
|
2261
|
+
not_before: z32.string(),
|
|
1669
2262
|
// datetime serialized as ISO string
|
|
1670
|
-
not_after:
|
|
2263
|
+
not_after: z32.string(),
|
|
1671
2264
|
// datetime serialized as ISO string
|
|
1672
|
-
version:
|
|
1673
|
-
fingerprint:
|
|
1674
|
-
signature_algorithm:
|
|
1675
|
-
sans:
|
|
1676
|
-
is_ca:
|
|
1677
|
-
position_in_chain:
|
|
1678
|
-
quote:
|
|
1679
|
-
app_id:
|
|
1680
|
-
cert_usage:
|
|
1681
|
-
});
|
|
1682
|
-
var EventLogSchema =
|
|
1683
|
-
imr:
|
|
1684
|
-
event_type:
|
|
1685
|
-
digest:
|
|
1686
|
-
event:
|
|
1687
|
-
event_payload:
|
|
1688
|
-
});
|
|
1689
|
-
var TcbInfoSchema =
|
|
1690
|
-
mrtd:
|
|
1691
|
-
rootfs_hash:
|
|
1692
|
-
rtmr0:
|
|
1693
|
-
rtmr1:
|
|
1694
|
-
rtmr2:
|
|
1695
|
-
rtmr3:
|
|
1696
|
-
event_log:
|
|
1697
|
-
app_compose:
|
|
1698
|
-
});
|
|
1699
|
-
var CvmAttestationSchema =
|
|
1700
|
-
name:
|
|
1701
|
-
is_online:
|
|
1702
|
-
is_public:
|
|
1703
|
-
error:
|
|
1704
|
-
app_certificates:
|
|
2265
|
+
version: z32.string(),
|
|
2266
|
+
fingerprint: z32.string(),
|
|
2267
|
+
signature_algorithm: z32.string(),
|
|
2268
|
+
sans: z32.array(z32.string()).nullable(),
|
|
2269
|
+
is_ca: z32.boolean(),
|
|
2270
|
+
position_in_chain: z32.number().nullable(),
|
|
2271
|
+
quote: z32.string().nullable(),
|
|
2272
|
+
app_id: z32.string().nullable().optional(),
|
|
2273
|
+
cert_usage: z32.string().nullable().optional()
|
|
2274
|
+
});
|
|
2275
|
+
var EventLogSchema = z32.object({
|
|
2276
|
+
imr: z32.number(),
|
|
2277
|
+
event_type: z32.number(),
|
|
2278
|
+
digest: z32.string(),
|
|
2279
|
+
event: z32.string(),
|
|
2280
|
+
event_payload: z32.string()
|
|
2281
|
+
});
|
|
2282
|
+
var TcbInfoSchema = z32.object({
|
|
2283
|
+
mrtd: z32.string(),
|
|
2284
|
+
rootfs_hash: z32.string().nullable().optional(),
|
|
2285
|
+
rtmr0: z32.string(),
|
|
2286
|
+
rtmr1: z32.string(),
|
|
2287
|
+
rtmr2: z32.string(),
|
|
2288
|
+
rtmr3: z32.string(),
|
|
2289
|
+
event_log: z32.array(EventLogSchema),
|
|
2290
|
+
app_compose: z32.string()
|
|
2291
|
+
});
|
|
2292
|
+
var CvmAttestationSchema = z32.object({
|
|
2293
|
+
name: z32.string().nullable(),
|
|
2294
|
+
is_online: z32.boolean(),
|
|
2295
|
+
is_public: z32.boolean().default(true),
|
|
2296
|
+
error: z32.string().nullable(),
|
|
2297
|
+
app_certificates: z32.array(CertificateSchema).nullable(),
|
|
1705
2298
|
tcb_info: TcbInfoSchema.nullable(),
|
|
1706
|
-
compose_file:
|
|
2299
|
+
compose_file: z32.string().nullable()
|
|
1707
2300
|
});
|
|
1708
2301
|
var GetCvmAttestationRequestSchema = CvmIdSchema;
|
|
1709
2302
|
var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAction(CvmAttestationSchema, async (client, request) => {
|
|
@@ -1712,17 +2305,17 @@ var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAct
|
|
|
1712
2305
|
});
|
|
1713
2306
|
|
|
1714
2307
|
// src/actions/cvms/update_cvm_resources.ts
|
|
1715
|
-
import { z as
|
|
2308
|
+
import { z as z33 } from "zod";
|
|
1716
2309
|
var UpdateCvmResourcesRequestSchema = refineCvmId(
|
|
1717
2310
|
CvmIdObjectSchema.extend({
|
|
1718
|
-
vcpu:
|
|
1719
|
-
memory:
|
|
1720
|
-
disk_size:
|
|
1721
|
-
instance_type:
|
|
1722
|
-
allow_restart:
|
|
2311
|
+
vcpu: z33.number().optional(),
|
|
2312
|
+
memory: z33.number().optional(),
|
|
2313
|
+
disk_size: z33.number().optional(),
|
|
2314
|
+
instance_type: z33.string().optional(),
|
|
2315
|
+
allow_restart: z33.boolean().optional()
|
|
1723
2316
|
})
|
|
1724
2317
|
);
|
|
1725
|
-
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(
|
|
2318
|
+
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(z33.void(), async (client, request) => {
|
|
1726
2319
|
const parsed = UpdateCvmResourcesRequestSchema.parse(request);
|
|
1727
2320
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
1728
2321
|
const { ...body } = parsed;
|
|
@@ -1731,14 +2324,14 @@ var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineA
|
|
|
1731
2324
|
});
|
|
1732
2325
|
|
|
1733
2326
|
// src/actions/cvms/update_cvm_visibility.ts
|
|
1734
|
-
import { z as
|
|
2327
|
+
import { z as z34 } from "zod";
|
|
1735
2328
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
1736
2329
|
CvmIdObjectSchema.extend({
|
|
1737
|
-
public_sysinfo:
|
|
1738
|
-
public_logs:
|
|
2330
|
+
public_sysinfo: z34.boolean(),
|
|
2331
|
+
public_logs: z34.boolean()
|
|
1739
2332
|
})
|
|
1740
2333
|
);
|
|
1741
|
-
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(
|
|
2334
|
+
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmDetailV20251028Schema, async (client, request) => {
|
|
1742
2335
|
const parsed = UpdateCvmVisibilityRequestSchema.parse(request);
|
|
1743
2336
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
1744
2337
|
const { public_sysinfo, public_logs } = parsed;
|
|
@@ -1746,21 +2339,21 @@ var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defin
|
|
|
1746
2339
|
});
|
|
1747
2340
|
|
|
1748
2341
|
// src/actions/cvms/get_available_os_images.ts
|
|
1749
|
-
import { z as
|
|
1750
|
-
var OSImageVariantSchema =
|
|
1751
|
-
name:
|
|
1752
|
-
os_image_hash:
|
|
1753
|
-
is_current:
|
|
2342
|
+
import { z as z35 } from "zod";
|
|
2343
|
+
var OSImageVariantSchema = z35.object({
|
|
2344
|
+
name: z35.string(),
|
|
2345
|
+
os_image_hash: z35.string().nullable(),
|
|
2346
|
+
is_current: z35.boolean()
|
|
1754
2347
|
});
|
|
1755
|
-
var AvailableOSImageSchema2 =
|
|
1756
|
-
version:
|
|
1757
|
-
|
|
1758
|
-
|
|
2348
|
+
var AvailableOSImageSchema2 = z35.object({
|
|
2349
|
+
version: z35.union([
|
|
2350
|
+
z35.tuple([z35.number(), z35.number(), z35.number(), z35.number()]),
|
|
2351
|
+
z35.tuple([z35.number(), z35.number(), z35.number()])
|
|
1759
2352
|
]),
|
|
1760
2353
|
prod: OSImageVariantSchema.nullable(),
|
|
1761
2354
|
dev: OSImageVariantSchema.nullable()
|
|
1762
2355
|
});
|
|
1763
|
-
var GetAvailableOSImagesResponseSchema =
|
|
2356
|
+
var GetAvailableOSImagesResponseSchema = z35.array(AvailableOSImageSchema2);
|
|
1764
2357
|
var GetAvailableOSImagesRequestSchema = CvmIdSchema;
|
|
1765
2358
|
var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = defineAction(GetAvailableOSImagesResponseSchema, async (client, request) => {
|
|
1766
2359
|
const { cvmId } = GetAvailableOSImagesRequestSchema.parse(request);
|
|
@@ -1768,13 +2361,13 @@ var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = def
|
|
|
1768
2361
|
});
|
|
1769
2362
|
|
|
1770
2363
|
// src/actions/cvms/update_os_image.ts
|
|
1771
|
-
import { z as
|
|
2364
|
+
import { z as z36 } from "zod";
|
|
1772
2365
|
var UpdateOsImageRequestSchema = refineCvmId(
|
|
1773
2366
|
CvmIdObjectSchema.extend({
|
|
1774
|
-
os_image_name:
|
|
2367
|
+
os_image_name: z36.string().min(1, "OS image name is required")
|
|
1775
2368
|
})
|
|
1776
2369
|
);
|
|
1777
|
-
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(
|
|
2370
|
+
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z36.void(), async (client, request) => {
|
|
1778
2371
|
const parsed = UpdateOsImageRequestSchema.parse(request);
|
|
1779
2372
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
1780
2373
|
const { os_image_name } = parsed;
|
|
@@ -1783,17 +2376,17 @@ var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z29.
|
|
|
1783
2376
|
});
|
|
1784
2377
|
|
|
1785
2378
|
// src/actions/cvms/get_cvm_state.ts
|
|
1786
|
-
import { z as
|
|
1787
|
-
var CvmStateSchema =
|
|
1788
|
-
id:
|
|
1789
|
-
instance_id:
|
|
1790
|
-
name:
|
|
1791
|
-
status:
|
|
1792
|
-
uptime:
|
|
1793
|
-
exited_at:
|
|
1794
|
-
boot_progress:
|
|
1795
|
-
boot_error:
|
|
1796
|
-
shutdown_progress:
|
|
2379
|
+
import { z as z37 } from "zod";
|
|
2380
|
+
var CvmStateSchema = z37.object({
|
|
2381
|
+
id: z37.string().optional(),
|
|
2382
|
+
instance_id: z37.string().optional(),
|
|
2383
|
+
name: z37.string(),
|
|
2384
|
+
status: z37.string(),
|
|
2385
|
+
uptime: z37.string().optional(),
|
|
2386
|
+
exited_at: z37.string().optional(),
|
|
2387
|
+
boot_progress: z37.string().optional(),
|
|
2388
|
+
boot_error: z37.string().optional(),
|
|
2389
|
+
shutdown_progress: z37.string().optional()
|
|
1797
2390
|
});
|
|
1798
2391
|
var GetCvmStateRequestSchema = CvmIdSchema;
|
|
1799
2392
|
var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmStateSchema, async (client, request) => {
|
|
@@ -1831,6 +2424,14 @@ function createClient2(config = {}) {
|
|
|
1831
2424
|
safeProvisionCvmComposeFileUpdate,
|
|
1832
2425
|
commitCvmComposeFileUpdate,
|
|
1833
2426
|
safeCommitCvmComposeFileUpdate,
|
|
2427
|
+
updateCvmEnvs,
|
|
2428
|
+
safeUpdateCvmEnvs,
|
|
2429
|
+
updateDockerCompose,
|
|
2430
|
+
safeUpdateDockerCompose,
|
|
2431
|
+
updatePreLaunchScript,
|
|
2432
|
+
safeUpdatePreLaunchScript,
|
|
2433
|
+
getCvmPreLaunchScript,
|
|
2434
|
+
safeGetCvmPreLaunchScript,
|
|
1834
2435
|
startCvm,
|
|
1835
2436
|
safeStartCvm,
|
|
1836
2437
|
stopCvm,
|
|
@@ -1873,8 +2474,147 @@ function createClient2(config = {}) {
|
|
|
1873
2474
|
return client.extend(allActions);
|
|
1874
2475
|
}
|
|
1875
2476
|
|
|
2477
|
+
// src/types/app_info_v20251028.ts
|
|
2478
|
+
import { z as z38 } from "zod";
|
|
2479
|
+
var CvmBasicInfoV20251028Schema = z38.object({
|
|
2480
|
+
vm_uuid: z38.string().nullable(),
|
|
2481
|
+
app_id: z38.string(),
|
|
2482
|
+
name: z38.string().default(""),
|
|
2483
|
+
status: z38.string(),
|
|
2484
|
+
vcpu: z38.number().int(),
|
|
2485
|
+
memory: z38.number().int(),
|
|
2486
|
+
disk_size: z38.number().int(),
|
|
2487
|
+
teepod_id: z38.number().int(),
|
|
2488
|
+
teepod_name: z38.string(),
|
|
2489
|
+
region_identifier: z38.string().nullable().optional(),
|
|
2490
|
+
kms_type: z38.string().nullable().optional(),
|
|
2491
|
+
instance_type: z38.string().nullable().optional(),
|
|
2492
|
+
listed: z38.boolean().nullable().optional(),
|
|
2493
|
+
base_image: z38.string().nullable().optional(),
|
|
2494
|
+
kms_slug: z38.string().nullable().optional(),
|
|
2495
|
+
kms_id: z38.string().nullable().optional(),
|
|
2496
|
+
instance_id: z38.string().nullable().optional(),
|
|
2497
|
+
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2498
|
+
updated_at: z38.string().nullable().optional()
|
|
2499
|
+
});
|
|
2500
|
+
var DstackAppFullResponseV20251028Schema = z38.object({
|
|
2501
|
+
id: z38.string(),
|
|
2502
|
+
name: z38.string(),
|
|
2503
|
+
app_id: z38.string(),
|
|
2504
|
+
app_provision_type: z38.string().nullable().optional(),
|
|
2505
|
+
app_icon_url: z38.string().nullable().optional(),
|
|
2506
|
+
created_at: z38.string(),
|
|
2507
|
+
kms_type: z38.string(),
|
|
2508
|
+
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2509
|
+
cvms: z38.array(CvmBasicInfoV20251028Schema).default([]),
|
|
2510
|
+
cvm_count: z38.number().int().default(0)
|
|
2511
|
+
});
|
|
2512
|
+
var DstackAppMinimalResponseV20251028Schema = z38.object({
|
|
2513
|
+
id: z38.null().optional(),
|
|
2514
|
+
app_id: z38.string(),
|
|
2515
|
+
name: z38.null().optional(),
|
|
2516
|
+
app_provision_type: z38.null().optional(),
|
|
2517
|
+
app_icon_url: z38.null().optional(),
|
|
2518
|
+
created_at: z38.null().optional(),
|
|
2519
|
+
kms_type: z38.null().optional(),
|
|
2520
|
+
current_cvm: z38.null().optional(),
|
|
2521
|
+
cvms: z38.null().optional(),
|
|
2522
|
+
cvm_count: z38.null().optional()
|
|
2523
|
+
});
|
|
2524
|
+
var DstackAppWithCvmResponseV20251028Schema = z38.union([
|
|
2525
|
+
DstackAppFullResponseV20251028Schema,
|
|
2526
|
+
DstackAppMinimalResponseV20251028Schema
|
|
2527
|
+
]);
|
|
2528
|
+
var DstackAppListResponseV20251028Schema = z38.object({
|
|
2529
|
+
dstack_apps: z38.array(DstackAppWithCvmResponseV20251028Schema),
|
|
2530
|
+
page: z38.number().int(),
|
|
2531
|
+
page_size: z38.number().int(),
|
|
2532
|
+
total: z38.number().int(),
|
|
2533
|
+
total_pages: z38.number().int()
|
|
2534
|
+
});
|
|
2535
|
+
|
|
2536
|
+
// src/types/app_info_v20260121.ts
|
|
2537
|
+
import { z as z39 } from "zod";
|
|
2538
|
+
var DstackAppFullResponseV20260121Schema = z39.object({
|
|
2539
|
+
id: z39.string(),
|
|
2540
|
+
name: z39.string(),
|
|
2541
|
+
app_id: z39.string(),
|
|
2542
|
+
app_provision_type: z39.string().nullable().optional(),
|
|
2543
|
+
app_icon_url: z39.string().nullable().optional(),
|
|
2544
|
+
created_at: z39.string(),
|
|
2545
|
+
kms_type: z39.string(),
|
|
2546
|
+
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
2547
|
+
cvms: z39.array(CvmInfoV20260121Schema).default([]),
|
|
2548
|
+
cvm_count: z39.number().int().default(0)
|
|
2549
|
+
});
|
|
2550
|
+
var DstackAppMinimalResponseV20260121Schema = z39.object({
|
|
2551
|
+
id: z39.null().optional(),
|
|
2552
|
+
app_id: z39.string(),
|
|
2553
|
+
name: z39.null().optional(),
|
|
2554
|
+
app_provision_type: z39.null().optional(),
|
|
2555
|
+
app_icon_url: z39.null().optional(),
|
|
2556
|
+
created_at: z39.null().optional(),
|
|
2557
|
+
kms_type: z39.null().optional(),
|
|
2558
|
+
current_cvm: z39.null().optional(),
|
|
2559
|
+
cvms: z39.null().optional(),
|
|
2560
|
+
cvm_count: z39.null().optional()
|
|
2561
|
+
});
|
|
2562
|
+
var DstackAppWithCvmResponseV20260121Schema = z39.union([
|
|
2563
|
+
DstackAppFullResponseV20260121Schema,
|
|
2564
|
+
DstackAppMinimalResponseV20260121Schema
|
|
2565
|
+
]);
|
|
2566
|
+
var DstackAppListResponseV20260121Schema = z39.object({
|
|
2567
|
+
dstack_apps: z39.array(DstackAppWithCvmResponseV20260121Schema),
|
|
2568
|
+
page: z39.number().int(),
|
|
2569
|
+
page_size: z39.number().int(),
|
|
2570
|
+
total: z39.number().int(),
|
|
2571
|
+
total_pages: z39.number().int()
|
|
2572
|
+
});
|
|
2573
|
+
|
|
2574
|
+
// src/types/app_revision.ts
|
|
2575
|
+
import { z as z40 } from "zod";
|
|
2576
|
+
var CvmRefSchema = z40.object({
|
|
2577
|
+
object_type: z40.literal("cvm"),
|
|
2578
|
+
id: z40.string().nullable().optional(),
|
|
2579
|
+
name: z40.string().nullable().optional(),
|
|
2580
|
+
app_id: z40.string().nullable().optional(),
|
|
2581
|
+
vm_uuid: z40.string().nullable().optional()
|
|
2582
|
+
});
|
|
2583
|
+
var AppRevisionResponseSchema = z40.object({
|
|
2584
|
+
app_id: z40.string(),
|
|
2585
|
+
vm_uuid: z40.string(),
|
|
2586
|
+
compose_hash: z40.string(),
|
|
2587
|
+
created_at: z40.string(),
|
|
2588
|
+
trace_id: z40.string().nullable().optional(),
|
|
2589
|
+
operation_type: z40.string(),
|
|
2590
|
+
triggered_by: UserRefSchema.nullable().optional(),
|
|
2591
|
+
cvm: CvmRefSchema.nullable().optional(),
|
|
2592
|
+
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2593
|
+
});
|
|
2594
|
+
var AppRevisionDetailResponseSchema = z40.object({
|
|
2595
|
+
app_id: z40.string(),
|
|
2596
|
+
vm_uuid: z40.string(),
|
|
2597
|
+
compose_hash: z40.string(),
|
|
2598
|
+
compose_file: z40.union([z40.record(z40.any()), z40.string()]).nullable().optional(),
|
|
2599
|
+
encrypted_env: z40.string(),
|
|
2600
|
+
user_config: z40.string(),
|
|
2601
|
+
created_at: z40.string(),
|
|
2602
|
+
trace_id: z40.string().nullable().optional(),
|
|
2603
|
+
operation_type: z40.string(),
|
|
2604
|
+
triggered_by: UserRefSchema.nullable().optional(),
|
|
2605
|
+
cvm: CvmRefSchema.nullable().optional(),
|
|
2606
|
+
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2607
|
+
});
|
|
2608
|
+
var AppRevisionsResponseSchema = z40.object({
|
|
2609
|
+
revisions: z40.array(AppRevisionResponseSchema),
|
|
2610
|
+
total: z40.number().int(),
|
|
2611
|
+
page: z40.number().int(),
|
|
2612
|
+
page_size: z40.number().int(),
|
|
2613
|
+
total_pages: z40.number().int()
|
|
2614
|
+
});
|
|
2615
|
+
|
|
1876
2616
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
1877
|
-
import { z as
|
|
2617
|
+
import { z as z41 } from "zod";
|
|
1878
2618
|
import {
|
|
1879
2619
|
createPublicClient as createPublicClient2,
|
|
1880
2620
|
createWalletClient as createWalletClient2,
|
|
@@ -2535,25 +3275,25 @@ var kmsAuthAbi = [
|
|
|
2535
3275
|
anonymous: false
|
|
2536
3276
|
}
|
|
2537
3277
|
];
|
|
2538
|
-
var DeployAppAuthRequestBaseSchema =
|
|
3278
|
+
var DeployAppAuthRequestBaseSchema = z41.object({
|
|
2539
3279
|
// Chain configuration (conditionally required)
|
|
2540
|
-
chain:
|
|
2541
|
-
rpcUrl:
|
|
3280
|
+
chain: z41.unknown().optional(),
|
|
3281
|
+
rpcUrl: z41.string().optional(),
|
|
2542
3282
|
// Contract configuration (required)
|
|
2543
|
-
kmsContractAddress:
|
|
3283
|
+
kmsContractAddress: z41.string(),
|
|
2544
3284
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
2545
|
-
privateKey:
|
|
2546
|
-
walletClient:
|
|
3285
|
+
privateKey: z41.string().optional(),
|
|
3286
|
+
walletClient: z41.unknown().optional(),
|
|
2547
3287
|
// Public client (optional, will create default if not provided)
|
|
2548
|
-
publicClient:
|
|
3288
|
+
publicClient: z41.unknown().optional(),
|
|
2549
3289
|
// App configuration (optional)
|
|
2550
|
-
allowAnyDevice:
|
|
2551
|
-
deviceId:
|
|
2552
|
-
composeHash:
|
|
2553
|
-
disableUpgrades:
|
|
3290
|
+
allowAnyDevice: z41.boolean().optional().default(false),
|
|
3291
|
+
deviceId: z41.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3292
|
+
composeHash: z41.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3293
|
+
disableUpgrades: z41.boolean().optional().default(false),
|
|
2554
3294
|
// Validation configuration (optional)
|
|
2555
|
-
skipPrerequisiteChecks:
|
|
2556
|
-
minBalance:
|
|
3295
|
+
skipPrerequisiteChecks: z41.boolean().optional().default(false),
|
|
3296
|
+
minBalance: z41.string().optional()
|
|
2557
3297
|
// ETH amount as string, e.g., "0.01"
|
|
2558
3298
|
}).passthrough();
|
|
2559
3299
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -2581,13 +3321,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
2581
3321
|
path: ["chain"]
|
|
2582
3322
|
}
|
|
2583
3323
|
);
|
|
2584
|
-
var DeployAppAuthSchema =
|
|
2585
|
-
appId:
|
|
2586
|
-
appAuthAddress:
|
|
2587
|
-
deployer:
|
|
2588
|
-
transactionHash:
|
|
2589
|
-
blockNumber:
|
|
2590
|
-
gasUsed:
|
|
3324
|
+
var DeployAppAuthSchema = z41.object({
|
|
3325
|
+
appId: z41.string(),
|
|
3326
|
+
appAuthAddress: z41.string(),
|
|
3327
|
+
deployer: z41.string(),
|
|
3328
|
+
transactionHash: z41.string(),
|
|
3329
|
+
blockNumber: z41.bigint().optional(),
|
|
3330
|
+
gasUsed: z41.bigint().optional()
|
|
2591
3331
|
}).passthrough();
|
|
2592
3332
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
2593
3333
|
try {
|
|
@@ -2833,7 +3573,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
2833
3573
|
}
|
|
2834
3574
|
|
|
2835
3575
|
// src/actions/blockchains/add_compose_hash.ts
|
|
2836
|
-
import { z as
|
|
3576
|
+
import { z as z42 } from "zod";
|
|
2837
3577
|
import {
|
|
2838
3578
|
createPublicClient as createPublicClient3,
|
|
2839
3579
|
createWalletClient as createWalletClient3,
|
|
@@ -2857,29 +3597,29 @@ var appAuthAbi = [
|
|
|
2857
3597
|
anonymous: false
|
|
2858
3598
|
}
|
|
2859
3599
|
];
|
|
2860
|
-
var AddComposeHashRequestSchema =
|
|
3600
|
+
var AddComposeHashRequestSchema = z42.object({
|
|
2861
3601
|
// Chain configuration (conditionally required)
|
|
2862
|
-
chain:
|
|
2863
|
-
rpcUrl:
|
|
2864
|
-
appId:
|
|
2865
|
-
composeHash:
|
|
3602
|
+
chain: z42.unknown().optional(),
|
|
3603
|
+
rpcUrl: z42.string().optional(),
|
|
3604
|
+
appId: z42.string(),
|
|
3605
|
+
composeHash: z42.string(),
|
|
2866
3606
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
2867
|
-
privateKey:
|
|
2868
|
-
walletClient:
|
|
3607
|
+
privateKey: z42.string().optional(),
|
|
3608
|
+
walletClient: z42.unknown().optional(),
|
|
2869
3609
|
// Public client (optional, will create default if not provided)
|
|
2870
|
-
publicClient:
|
|
3610
|
+
publicClient: z42.unknown().optional(),
|
|
2871
3611
|
// Validation configuration (optional)
|
|
2872
|
-
skipPrerequisiteChecks:
|
|
2873
|
-
minBalance:
|
|
3612
|
+
skipPrerequisiteChecks: z42.boolean().optional().default(false),
|
|
3613
|
+
minBalance: z42.string().optional(),
|
|
2874
3614
|
// ETH amount as string, e.g., "0.01"
|
|
2875
3615
|
// Transaction control options
|
|
2876
|
-
timeout:
|
|
2877
|
-
retryOptions:
|
|
2878
|
-
signal:
|
|
3616
|
+
timeout: z42.number().optional().default(12e4),
|
|
3617
|
+
retryOptions: z42.unknown().optional(),
|
|
3618
|
+
signal: z42.unknown().optional(),
|
|
2879
3619
|
// Progress callbacks
|
|
2880
|
-
onTransactionStateChange:
|
|
2881
|
-
onTransactionSubmitted:
|
|
2882
|
-
onTransactionConfirmed:
|
|
3620
|
+
onTransactionStateChange: z42.function().optional(),
|
|
3621
|
+
onTransactionSubmitted: z42.function().optional(),
|
|
3622
|
+
onTransactionConfirmed: z42.function().optional()
|
|
2883
3623
|
}).passthrough().refine(
|
|
2884
3624
|
(data) => {
|
|
2885
3625
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -2903,12 +3643,12 @@ var AddComposeHashRequestSchema = z32.object({
|
|
|
2903
3643
|
path: ["chain"]
|
|
2904
3644
|
}
|
|
2905
3645
|
);
|
|
2906
|
-
var AddComposeHashSchema =
|
|
2907
|
-
composeHash:
|
|
2908
|
-
appId:
|
|
2909
|
-
transactionHash:
|
|
2910
|
-
blockNumber:
|
|
2911
|
-
gasUsed:
|
|
3646
|
+
var AddComposeHashSchema = z42.object({
|
|
3647
|
+
composeHash: z42.string(),
|
|
3648
|
+
appId: z42.string(),
|
|
3649
|
+
transactionHash: z42.string(),
|
|
3650
|
+
blockNumber: z42.bigint().optional(),
|
|
3651
|
+
gasUsed: z42.bigint().optional()
|
|
2912
3652
|
}).passthrough();
|
|
2913
3653
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
2914
3654
|
console.log(receipt.logs);
|
|
@@ -3099,14 +3839,70 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
3099
3839
|
}
|
|
3100
3840
|
}
|
|
3101
3841
|
|
|
3842
|
+
// src/actions/workspaces/get_workspace_nodes.ts
|
|
3843
|
+
import { z as z43 } from "zod";
|
|
3844
|
+
var NodeInfoSchema = z43.object({
|
|
3845
|
+
id: z43.number().nullable(),
|
|
3846
|
+
name: z43.string().nullable(),
|
|
3847
|
+
region: z43.string().nullable(),
|
|
3848
|
+
device_id: z43.string().nullable(),
|
|
3849
|
+
ppid: z43.string().nullable(),
|
|
3850
|
+
status: z43.string().nullable(),
|
|
3851
|
+
version: z43.string().nullable()
|
|
3852
|
+
}).passthrough();
|
|
3853
|
+
var GetWorkspaceNodesSchema = z43.object({
|
|
3854
|
+
items: z43.array(NodeInfoSchema),
|
|
3855
|
+
total: z43.number(),
|
|
3856
|
+
page: z43.number(),
|
|
3857
|
+
page_size: z43.number(),
|
|
3858
|
+
pages: z43.number()
|
|
3859
|
+
}).passthrough();
|
|
3860
|
+
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
3861
|
+
const { teamSlug, page, pageSize } = request;
|
|
3862
|
+
const queryParams = new URLSearchParams();
|
|
3863
|
+
if (page !== void 0) queryParams.append("page", page.toString());
|
|
3864
|
+
if (pageSize !== void 0) queryParams.append("page_size", pageSize.toString());
|
|
3865
|
+
const url = queryParams.toString() ? `/workspaces/${teamSlug}/nodes?${queryParams.toString()}` : `/workspaces/${teamSlug}/nodes`;
|
|
3866
|
+
return await client.get(url);
|
|
3867
|
+
});
|
|
3868
|
+
|
|
3869
|
+
// src/actions/workspaces/get_workspace_quotas.ts
|
|
3870
|
+
import { z as z44 } from "zod";
|
|
3871
|
+
var QuotaMetricSchema = z44.object({
|
|
3872
|
+
limit: z44.number(),
|
|
3873
|
+
remaining: z44.number()
|
|
3874
|
+
}).passthrough();
|
|
3875
|
+
var WorkspaceQuotasSchema = z44.object({
|
|
3876
|
+
vm_slots: QuotaMetricSchema,
|
|
3877
|
+
vcpu: QuotaMetricSchema,
|
|
3878
|
+
memory_mb: QuotaMetricSchema,
|
|
3879
|
+
disk_gb: QuotaMetricSchema
|
|
3880
|
+
}).passthrough();
|
|
3881
|
+
var WorkspaceReservedGpuQuotaSchema = z44.object({
|
|
3882
|
+
gpus: QuotaMetricSchema,
|
|
3883
|
+
in_use: z44.number(),
|
|
3884
|
+
misconfigured: z44.number()
|
|
3885
|
+
}).passthrough();
|
|
3886
|
+
var GetWorkspaceQuotasSchema = z44.object({
|
|
3887
|
+
team_slug: z44.string(),
|
|
3888
|
+
tier: z44.string(),
|
|
3889
|
+
quotas: WorkspaceQuotasSchema,
|
|
3890
|
+
reserved_nodes: QuotaMetricSchema,
|
|
3891
|
+
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
3892
|
+
as_of: z44.string()
|
|
3893
|
+
}).passthrough();
|
|
3894
|
+
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
3895
|
+
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
3896
|
+
});
|
|
3897
|
+
|
|
3102
3898
|
// src/actions/cvms/watch_cvm_state.ts
|
|
3103
|
-
import { z as
|
|
3104
|
-
var WatchCvmStateParamsSchema =
|
|
3105
|
-
target:
|
|
3106
|
-
interval:
|
|
3107
|
-
timeout:
|
|
3108
|
-
maxRetries:
|
|
3109
|
-
retryDelay:
|
|
3899
|
+
import { z as z45 } from "zod";
|
|
3900
|
+
var WatchCvmStateParamsSchema = z45.object({
|
|
3901
|
+
target: z45.string().describe("Target status to wait for (e.g., 'running', 'stopped')"),
|
|
3902
|
+
interval: z45.number().min(5).max(30).default(5).describe("Polling interval in seconds"),
|
|
3903
|
+
timeout: z45.number().min(10).max(600).default(300).describe("Timeout per attempt in seconds"),
|
|
3904
|
+
maxRetries: z45.number().min(0).default(Number.POSITIVE_INFINITY).describe("Maximum number of retry attempts (Infinity for unlimited)"),
|
|
3905
|
+
retryDelay: z45.number().min(0).default(5e3).describe("Delay between retries in milliseconds")
|
|
3110
3906
|
});
|
|
3111
3907
|
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
3112
3908
|
var WatchAbortedError = class extends Error {
|
|
@@ -3293,6 +4089,195 @@ function sleep(ms, signal) {
|
|
|
3293
4089
|
});
|
|
3294
4090
|
}
|
|
3295
4091
|
|
|
4092
|
+
// src/actions/cvms/get_cvm_status_batch.ts
|
|
4093
|
+
import { z as z46 } from "zod";
|
|
4094
|
+
var CvmStatusSchema = z46.object({
|
|
4095
|
+
vm_uuid: z46.string(),
|
|
4096
|
+
status: z46.string(),
|
|
4097
|
+
uptime: z46.string().nullable().optional(),
|
|
4098
|
+
in_progress: z46.boolean(),
|
|
4099
|
+
boot_progress: z46.string().nullable().optional(),
|
|
4100
|
+
boot_error: z46.string().nullable().optional(),
|
|
4101
|
+
operation_type: z46.string().nullable().optional(),
|
|
4102
|
+
operation_started_at: z46.string().nullable().optional(),
|
|
4103
|
+
correlation_id: z46.string().nullable().optional()
|
|
4104
|
+
});
|
|
4105
|
+
var GetCvmStatusBatchResponseSchema = z46.record(z46.string(), CvmStatusSchema);
|
|
4106
|
+
var GetCvmStatusBatchRequestSchema = z46.object({
|
|
4107
|
+
vmUuids: z46.array(z46.string())
|
|
4108
|
+
});
|
|
4109
|
+
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
4110
|
+
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
4111
|
+
return await client.post("/status/batch", { vm_uuids: vmUuids });
|
|
4112
|
+
});
|
|
4113
|
+
|
|
4114
|
+
// src/actions/apps/get_app_list.ts
|
|
4115
|
+
import { z as z47 } from "zod";
|
|
4116
|
+
var GetAppListRequestSchema = z47.object({
|
|
4117
|
+
page: z47.number().int().min(1).optional(),
|
|
4118
|
+
page_size: z47.number().int().min(1).max(100).optional(),
|
|
4119
|
+
search: z47.string().optional(),
|
|
4120
|
+
status: z47.array(z47.string()).optional(),
|
|
4121
|
+
listed: z47.boolean().optional(),
|
|
4122
|
+
base_image: z47.string().optional(),
|
|
4123
|
+
instance_type: z47.string().optional(),
|
|
4124
|
+
kms_slug: z47.string().optional(),
|
|
4125
|
+
kms_type: z47.string().optional(),
|
|
4126
|
+
teepod_name: z47.string().optional(),
|
|
4127
|
+
region: z47.string().optional()
|
|
4128
|
+
}).strict();
|
|
4129
|
+
function getSchemaForVersion4(version) {
|
|
4130
|
+
return version === "2025-10-28" ? DstackAppListResponseV20251028Schema : DstackAppListResponseV20260121Schema;
|
|
4131
|
+
}
|
|
4132
|
+
async function getAppList(client, request) {
|
|
4133
|
+
const validatedRequest = GetAppListRequestSchema.parse(request ?? {});
|
|
4134
|
+
const response = await client.get("/apps", { params: validatedRequest });
|
|
4135
|
+
const schema = getSchemaForVersion4(client.config.version);
|
|
4136
|
+
return schema.parse(response);
|
|
4137
|
+
}
|
|
4138
|
+
async function safeGetAppList(client, request) {
|
|
4139
|
+
try {
|
|
4140
|
+
const data = await getAppList(client, request);
|
|
4141
|
+
return { success: true, data };
|
|
4142
|
+
} catch (error) {
|
|
4143
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4144
|
+
return { success: false, error };
|
|
4145
|
+
}
|
|
4146
|
+
return {
|
|
4147
|
+
success: false,
|
|
4148
|
+
error: {
|
|
4149
|
+
name: "Error",
|
|
4150
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4151
|
+
}
|
|
4152
|
+
};
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
|
|
4156
|
+
// src/actions/apps/get_app_info.ts
|
|
4157
|
+
import { z as z48 } from "zod";
|
|
4158
|
+
var GetAppInfoRequestSchema = z48.object({
|
|
4159
|
+
appId: z48.string().min(1)
|
|
4160
|
+
}).strict();
|
|
4161
|
+
function getSchemaForVersion5(version) {
|
|
4162
|
+
return version === "2025-10-28" ? DstackAppWithCvmResponseV20251028Schema : DstackAppWithCvmResponseV20260121Schema;
|
|
4163
|
+
}
|
|
4164
|
+
async function getAppInfo(client, request) {
|
|
4165
|
+
const { appId } = GetAppInfoRequestSchema.parse(request);
|
|
4166
|
+
const response = await client.get(`/apps/${appId}`);
|
|
4167
|
+
const schema = getSchemaForVersion5(client.config.version);
|
|
4168
|
+
return schema.parse(response);
|
|
4169
|
+
}
|
|
4170
|
+
async function safeGetAppInfo(client, request) {
|
|
4171
|
+
try {
|
|
4172
|
+
const data = await getAppInfo(client, request);
|
|
4173
|
+
return { success: true, data };
|
|
4174
|
+
} catch (error) {
|
|
4175
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4176
|
+
return { success: false, error };
|
|
4177
|
+
}
|
|
4178
|
+
return {
|
|
4179
|
+
success: false,
|
|
4180
|
+
error: {
|
|
4181
|
+
name: "Error",
|
|
4182
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4183
|
+
}
|
|
4184
|
+
};
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
// src/actions/apps/get_app_cvms.ts
|
|
4189
|
+
import { z as z49 } from "zod";
|
|
4190
|
+
var GetAppCvmsRequestSchema = z49.object({
|
|
4191
|
+
appId: z49.string().min(1)
|
|
4192
|
+
}).strict();
|
|
4193
|
+
function getSchemaForVersion6(version) {
|
|
4194
|
+
return version === "2025-10-28" ? z49.array(CvmInfoV20251028Schema) : z49.array(CvmInfoV20260121Schema);
|
|
4195
|
+
}
|
|
4196
|
+
async function getAppCvms(client, request) {
|
|
4197
|
+
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
4198
|
+
const response = await client.get(`/apps/${appId}/cvms`);
|
|
4199
|
+
const schema = getSchemaForVersion6(client.config.version);
|
|
4200
|
+
return schema.parse(response);
|
|
4201
|
+
}
|
|
4202
|
+
async function safeGetAppCvms(client, request) {
|
|
4203
|
+
try {
|
|
4204
|
+
const data = await getAppCvms(client, request);
|
|
4205
|
+
return { success: true, data };
|
|
4206
|
+
} catch (error) {
|
|
4207
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4208
|
+
return { success: false, error };
|
|
4209
|
+
}
|
|
4210
|
+
return {
|
|
4211
|
+
success: false,
|
|
4212
|
+
error: {
|
|
4213
|
+
name: "Error",
|
|
4214
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4215
|
+
}
|
|
4216
|
+
};
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
// src/actions/apps/get_app_revisions.ts
|
|
4221
|
+
import { z as z50 } from "zod";
|
|
4222
|
+
var GetAppRevisionsRequestSchema = z50.object({
|
|
4223
|
+
appId: z50.string().min(1),
|
|
4224
|
+
page: z50.number().int().min(1).optional(),
|
|
4225
|
+
page_size: z50.number().int().min(1).max(1e3).optional()
|
|
4226
|
+
}).strict();
|
|
4227
|
+
async function getAppRevisions(client, request) {
|
|
4228
|
+
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
4229
|
+
const response = await client.get(`/apps/${appId}/revisions`, { params });
|
|
4230
|
+
return AppRevisionsResponseSchema.parse(response);
|
|
4231
|
+
}
|
|
4232
|
+
async function safeGetAppRevisions(client, request) {
|
|
4233
|
+
try {
|
|
4234
|
+
const data = await getAppRevisions(client, request);
|
|
4235
|
+
return { success: true, data };
|
|
4236
|
+
} catch (error) {
|
|
4237
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4238
|
+
return { success: false, error };
|
|
4239
|
+
}
|
|
4240
|
+
return {
|
|
4241
|
+
success: false,
|
|
4242
|
+
error: {
|
|
4243
|
+
name: "Error",
|
|
4244
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4245
|
+
}
|
|
4246
|
+
};
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
// src/actions/apps/get_app_revision_detail.ts
|
|
4251
|
+
import { z as z51 } from "zod";
|
|
4252
|
+
var GetAppRevisionDetailRequestSchema = z51.object({
|
|
4253
|
+
appId: z51.string().min(1),
|
|
4254
|
+
composeHash: z51.string().min(1),
|
|
4255
|
+
rawComposeFile: z51.boolean().optional()
|
|
4256
|
+
}).strict();
|
|
4257
|
+
async function getAppRevisionDetail(client, request) {
|
|
4258
|
+
const { appId, composeHash, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
4259
|
+
const params = rawComposeFile !== void 0 ? { raw_compose_file: rawComposeFile } : void 0;
|
|
4260
|
+
const response = await client.get(`/apps/${appId}/revisions/${composeHash}`, { params });
|
|
4261
|
+
return AppRevisionDetailResponseSchema.parse(response);
|
|
4262
|
+
}
|
|
4263
|
+
async function safeGetAppRevisionDetail(client, request) {
|
|
4264
|
+
try {
|
|
4265
|
+
const data = await getAppRevisionDetail(client, request);
|
|
4266
|
+
return { success: true, data };
|
|
4267
|
+
} catch (error) {
|
|
4268
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4269
|
+
return { success: false, error };
|
|
4270
|
+
}
|
|
4271
|
+
return {
|
|
4272
|
+
success: false,
|
|
4273
|
+
error: {
|
|
4274
|
+
name: "Error",
|
|
4275
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4276
|
+
}
|
|
4277
|
+
};
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
4280
|
+
|
|
3296
4281
|
// src/parse_dotenv.ts
|
|
3297
4282
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
3298
4283
|
function parseEnv(input) {
|
|
@@ -3334,33 +4319,65 @@ export {
|
|
|
3334
4319
|
AddComposeHashSchema,
|
|
3335
4320
|
AllFamiliesResponseSchema,
|
|
3336
4321
|
ApiErrorSchema,
|
|
4322
|
+
AppRevisionDetailResponseSchema,
|
|
4323
|
+
AppRevisionResponseSchema,
|
|
4324
|
+
AppRevisionsResponseSchema,
|
|
3337
4325
|
AuthError,
|
|
4326
|
+
CurrentUserV20260121Schema as AuthResponseSchema,
|
|
3338
4327
|
AvailableNodesSchema,
|
|
4328
|
+
BillingPeriodSchema,
|
|
3339
4329
|
BusinessError,
|
|
3340
4330
|
CommitCvmComposeFileUpdateRequestSchema,
|
|
3341
4331
|
CommitCvmComposeFileUpdateSchema,
|
|
3342
4332
|
CommitCvmProvisionRequestSchema,
|
|
3343
4333
|
CommitCvmProvisionSchema,
|
|
3344
|
-
|
|
4334
|
+
CreditsInfoSchema,
|
|
4335
|
+
CurrentUserV20251028Schema as CurrentUserSchema,
|
|
4336
|
+
CurrentUserV20251028Schema,
|
|
4337
|
+
CurrentUserV20260121Schema,
|
|
3345
4338
|
CvmAttestationSchema,
|
|
4339
|
+
CvmBasicInfoV20251028Schema,
|
|
3346
4340
|
CvmContainersStatsSchema,
|
|
4341
|
+
CvmDetailV20251028Schema,
|
|
4342
|
+
CvmGatewayInfoV20260121Schema,
|
|
3347
4343
|
CvmIdBaseSchema,
|
|
3348
4344
|
CvmIdObjectSchema,
|
|
3349
4345
|
CvmIdSchema,
|
|
3350
|
-
|
|
3351
|
-
|
|
4346
|
+
CvmInfoDetailV20260121Schema,
|
|
4347
|
+
CvmInfoV20251028Schema,
|
|
4348
|
+
CvmInfoV20260121Schema,
|
|
4349
|
+
CvmKmsInfoV20260121Schema,
|
|
3352
4350
|
CvmNetworkSchema,
|
|
3353
|
-
|
|
3354
|
-
|
|
4351
|
+
CvmNetworkUrlsV20251028Schema,
|
|
4352
|
+
CvmNodeInfoV20260121Schema,
|
|
4353
|
+
CvmNodeV20251028Schema,
|
|
4354
|
+
CvmOsInfoV20260121Schema,
|
|
4355
|
+
CvmProgressInfoV20260121Schema,
|
|
4356
|
+
CvmRefSchema,
|
|
4357
|
+
CvmResourceInfoV20260121Schema,
|
|
3355
4358
|
CvmStateSchema,
|
|
4359
|
+
CvmStatusSchema,
|
|
3356
4360
|
CvmSystemInfoSchema,
|
|
3357
4361
|
DeleteCvmRequestSchema,
|
|
3358
4362
|
DeployAppAuthRequestSchema,
|
|
3359
4363
|
DeployAppAuthSchema,
|
|
4364
|
+
DstackAppFullResponseV20251028Schema,
|
|
4365
|
+
DstackAppFullResponseV20260121Schema,
|
|
4366
|
+
DstackAppListResponseV20251028Schema,
|
|
4367
|
+
DstackAppListResponseV20260121Schema,
|
|
4368
|
+
DstackAppMinimalResponseV20251028Schema,
|
|
4369
|
+
DstackAppMinimalResponseV20260121Schema,
|
|
4370
|
+
DstackAppWithCvmResponseV20251028Schema,
|
|
4371
|
+
DstackAppWithCvmResponseV20260121Schema,
|
|
3360
4372
|
FamilyGroupSchema,
|
|
3361
4373
|
FamilyInstanceTypesResponseSchema,
|
|
4374
|
+
GetAppCvmsRequestSchema,
|
|
3362
4375
|
GetAppEnvEncryptPubKeyRequestSchema,
|
|
3363
4376
|
GetAppEnvEncryptPubKeySchema,
|
|
4377
|
+
GetAppInfoRequestSchema,
|
|
4378
|
+
GetAppListRequestSchema,
|
|
4379
|
+
GetAppRevisionDetailRequestSchema,
|
|
4380
|
+
GetAppRevisionsRequestSchema,
|
|
3364
4381
|
GetAvailableOSImagesRequestSchema,
|
|
3365
4382
|
GetAvailableOSImagesResponseSchema,
|
|
3366
4383
|
GetCvmAttestationRequestSchema,
|
|
@@ -3369,29 +4386,39 @@ export {
|
|
|
3369
4386
|
GetCvmDockerComposeRequestSchema,
|
|
3370
4387
|
GetCvmInfoRequestSchema,
|
|
3371
4388
|
GetCvmListRequestSchema,
|
|
3372
|
-
GetCvmListSchema,
|
|
3373
4389
|
GetCvmNetworkRequestSchema,
|
|
4390
|
+
GetCvmPreLaunchScriptRequestSchema,
|
|
3374
4391
|
GetCvmStateRequestSchema,
|
|
3375
4392
|
GetCvmStatsRequestSchema,
|
|
4393
|
+
GetCvmStatusBatchRequestSchema,
|
|
4394
|
+
GetCvmStatusBatchResponseSchema,
|
|
3376
4395
|
GetKmsInfoRequestSchema,
|
|
3377
4396
|
GetKmsListRequestSchema,
|
|
3378
4397
|
GetKmsListSchema,
|
|
4398
|
+
GetWorkspaceNodesSchema,
|
|
4399
|
+
GetWorkspaceQuotasSchema,
|
|
3379
4400
|
InstanceTypeSchema,
|
|
3380
4401
|
KmsInfoSchema,
|
|
4402
|
+
KmsTypeSchema,
|
|
3381
4403
|
ListFamilyInstanceTypesRequestSchema,
|
|
3382
4404
|
ListWorkspacesSchema,
|
|
3383
|
-
|
|
4405
|
+
MachineInfoV20251028Schema,
|
|
4406
|
+
ManagedUserV20251028Schema,
|
|
3384
4407
|
MaxRetriesExceededError,
|
|
3385
4408
|
NetworkError,
|
|
3386
4409
|
NextAppIdsRequestSchema,
|
|
3387
4410
|
NextAppIdsSchema,
|
|
4411
|
+
NodeInfoSchema,
|
|
3388
4412
|
OSImageVariantSchema,
|
|
4413
|
+
PaginatedCvmInfosV20251028Schema,
|
|
4414
|
+
PaginatedCvmInfosV20260121Schema,
|
|
3389
4415
|
PaginationMetadataSchema,
|
|
3390
4416
|
PhalaCloudError,
|
|
3391
4417
|
ProvisionCvmComposeFileUpdateRequestSchema,
|
|
3392
4418
|
ProvisionCvmComposeFileUpdateResultSchema,
|
|
3393
4419
|
ProvisionCvmRequestSchema,
|
|
3394
4420
|
ProvisionCvmSchema,
|
|
4421
|
+
QuotaMetricSchema,
|
|
3395
4422
|
RequestError,
|
|
3396
4423
|
ResourceError,
|
|
3397
4424
|
RestartCvmRequestSchema,
|
|
@@ -3403,15 +4430,27 @@ export {
|
|
|
3403
4430
|
StopCvmRequestSchema,
|
|
3404
4431
|
TransactionError,
|
|
3405
4432
|
UnknownError,
|
|
4433
|
+
UpdateCvmEnvsRequestSchema,
|
|
4434
|
+
UpdateCvmEnvsResultSchema,
|
|
3406
4435
|
UpdateCvmResourcesRequestSchema,
|
|
3407
4436
|
UpdateCvmVisibilityRequestSchema,
|
|
4437
|
+
UpdateDockerComposeRequestSchema,
|
|
4438
|
+
UpdateDockerComposeResultSchema,
|
|
3408
4439
|
UpdateOsImageRequestSchema,
|
|
4440
|
+
UpdatePreLaunchScriptRequestSchema,
|
|
4441
|
+
UpdatePreLaunchScriptResultSchema,
|
|
4442
|
+
UserInfoSchema,
|
|
4443
|
+
UserRefSchema,
|
|
3409
4444
|
VMSchema,
|
|
3410
4445
|
ValidationError,
|
|
3411
|
-
|
|
4446
|
+
VmInfoV20251028Schema,
|
|
3412
4447
|
WalletError,
|
|
3413
4448
|
WatchAbortedError,
|
|
3414
4449
|
WatchCvmStateRequestSchema,
|
|
4450
|
+
WorkspaceInfoSchema,
|
|
4451
|
+
WorkspaceQuotasSchema,
|
|
4452
|
+
WorkspaceRefSchema,
|
|
4453
|
+
WorkspaceReservedGpuQuotaSchema,
|
|
3415
4454
|
WorkspaceResponseSchema,
|
|
3416
4455
|
addComposeHash,
|
|
3417
4456
|
addNetwork,
|
|
@@ -3421,6 +4460,7 @@ export {
|
|
|
3421
4460
|
checkNetworkStatus,
|
|
3422
4461
|
commitCvmComposeFileUpdate,
|
|
3423
4462
|
commitCvmProvision,
|
|
4463
|
+
convertToHostname,
|
|
3424
4464
|
createClient as createBaseClient,
|
|
3425
4465
|
createClient2 as createClient,
|
|
3426
4466
|
createClientsFromBrowser,
|
|
@@ -3441,7 +4481,14 @@ export {
|
|
|
3441
4481
|
formatErrorMessage,
|
|
3442
4482
|
formatStructuredError,
|
|
3443
4483
|
formatValidationErrors,
|
|
4484
|
+
generateDefaultCvmName,
|
|
4485
|
+
generateFallbackHostname,
|
|
4486
|
+
getAppCvms,
|
|
3444
4487
|
getAppEnvEncryptPubKey,
|
|
4488
|
+
getAppInfo,
|
|
4489
|
+
getAppList,
|
|
4490
|
+
getAppRevisionDetail,
|
|
4491
|
+
getAppRevisions,
|
|
3445
4492
|
getAvailableNodes,
|
|
3446
4493
|
getAvailableOsImages,
|
|
3447
4494
|
getComposeHash2 as getComposeHash,
|
|
@@ -3453,13 +4500,18 @@ export {
|
|
|
3453
4500
|
getCvmInfo,
|
|
3454
4501
|
getCvmList,
|
|
3455
4502
|
getCvmNetwork,
|
|
4503
|
+
getCvmPreLaunchScript,
|
|
3456
4504
|
getCvmState,
|
|
3457
4505
|
getCvmStats,
|
|
4506
|
+
getCvmStatusBatch,
|
|
3458
4507
|
getErrorMessage,
|
|
3459
4508
|
getKmsInfo,
|
|
3460
4509
|
getKmsList,
|
|
3461
4510
|
getValidationFields,
|
|
3462
4511
|
getWorkspace,
|
|
4512
|
+
getWorkspaceNodes,
|
|
4513
|
+
getWorkspaceQuotas,
|
|
4514
|
+
isValidHostname,
|
|
3463
4515
|
listAllInstanceTypeFamilies,
|
|
3464
4516
|
listFamilyInstanceTypes,
|
|
3465
4517
|
listWorkspaces,
|
|
@@ -3477,7 +4529,12 @@ export {
|
|
|
3477
4529
|
safeCommitCvmProvision,
|
|
3478
4530
|
safeDeleteCvm,
|
|
3479
4531
|
safeDeployAppAuth,
|
|
4532
|
+
safeGetAppCvms,
|
|
3480
4533
|
safeGetAppEnvEncryptPubKey,
|
|
4534
|
+
safeGetAppInfo,
|
|
4535
|
+
safeGetAppList,
|
|
4536
|
+
safeGetAppRevisionDetail,
|
|
4537
|
+
safeGetAppRevisions,
|
|
3481
4538
|
safeGetAvailableNodes,
|
|
3482
4539
|
safeGetAvailableOsImages,
|
|
3483
4540
|
safeGetCurrentUser,
|
|
@@ -3488,11 +4545,15 @@ export {
|
|
|
3488
4545
|
safeGetCvmInfo,
|
|
3489
4546
|
safeGetCvmList,
|
|
3490
4547
|
safeGetCvmNetwork,
|
|
4548
|
+
safeGetCvmPreLaunchScript,
|
|
3491
4549
|
safeGetCvmState,
|
|
3492
4550
|
safeGetCvmStats,
|
|
4551
|
+
safeGetCvmStatusBatch,
|
|
3493
4552
|
safeGetKmsInfo,
|
|
3494
4553
|
safeGetKmsList,
|
|
3495
4554
|
safeGetWorkspace,
|
|
4555
|
+
safeGetWorkspaceNodes,
|
|
4556
|
+
safeGetWorkspaceQuotas,
|
|
3496
4557
|
safeListAllInstanceTypeFamilies,
|
|
3497
4558
|
safeListFamilyInstanceTypes,
|
|
3498
4559
|
safeListWorkspaces,
|
|
@@ -3503,18 +4564,24 @@ export {
|
|
|
3503
4564
|
safeShutdownCvm,
|
|
3504
4565
|
safeStartCvm,
|
|
3505
4566
|
safeStopCvm,
|
|
4567
|
+
safeUpdateCvmEnvs,
|
|
3506
4568
|
safeUpdateCvmResources,
|
|
3507
4569
|
safeUpdateCvmVisibility,
|
|
4570
|
+
safeUpdateDockerCompose,
|
|
3508
4571
|
safeUpdateOsImage,
|
|
4572
|
+
safeUpdatePreLaunchScript,
|
|
3509
4573
|
safeValidateActionParameters,
|
|
3510
4574
|
shutdownCvm,
|
|
3511
4575
|
sortObject,
|
|
3512
4576
|
startCvm,
|
|
3513
4577
|
stopCvm,
|
|
3514
4578
|
switchToNetwork,
|
|
4579
|
+
updateCvmEnvs,
|
|
3515
4580
|
updateCvmResources,
|
|
3516
4581
|
updateCvmVisibility,
|
|
4582
|
+
updateDockerCompose,
|
|
3517
4583
|
updateOsImage,
|
|
4584
|
+
updatePreLaunchScript,
|
|
3518
4585
|
validateActionParameters,
|
|
3519
4586
|
validateNetworkPrerequisites,
|
|
3520
4587
|
verifyEnvEncryptPublicKey,
|