@phala/cloud 0.2.1-beta.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +32 -118
- 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 +13 -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 +72 -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 +1714 -664
- package/dist/index.mjs +1629 -657
- 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 +29 -11
- 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
974
|
// src/actions/get_available_nodes.ts
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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
|
-
// src/actions/get_available_nodes.ts
|
|
844
|
-
var AvailableOSImageSchema = z4.object({
|
|
845
|
-
name: z4.string(),
|
|
846
|
-
is_dev: z4.boolean(),
|
|
847
|
-
version: z4.union([
|
|
848
|
-
z4.tuple([z4.number(), z4.number(), z4.number()]),
|
|
849
|
-
z4.tuple([z4.number(), z4.number(), z4.number(), z4.number()])
|
|
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,135 +1089,282 @@ 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);
|
|
@@ -1100,6 +1378,8 @@ var CvmIdSchema = CvmIdBaseSchema.transform((data) => {
|
|
|
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
|
}
|
|
@@ -1118,46 +1398,84 @@ var CvmIdSchema = CvmIdBaseSchema.transform((data) => {
|
|
|
1118
1398
|
|
|
1119
1399
|
// src/actions/cvms/get_cvm_info.ts
|
|
1120
1400
|
var GetCvmInfoRequestSchema = CvmIdSchema;
|
|
1121
|
-
|
|
1401
|
+
function getSchemaForVersion2(version) {
|
|
1402
|
+
return version === "2025-10-28" ? CvmDetailV20251028Schema : CvmInfoDetailV20260121Schema;
|
|
1403
|
+
}
|
|
1404
|
+
async function getCvmInfo(client, request) {
|
|
1122
1405
|
const { cvmId } = GetCvmInfoRequestSchema.parse(request);
|
|
1123
|
-
|
|
1124
|
-
|
|
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
|
+
}
|
|
1125
1427
|
|
|
1126
1428
|
// src/actions/cvms/get_cvm_list.ts
|
|
1127
|
-
import { z as
|
|
1128
|
-
var GetCvmListRequestSchema =
|
|
1129
|
-
page:
|
|
1130
|
-
page_size:
|
|
1131
|
-
node_id:
|
|
1132
|
-
teepod_id:
|
|
1133
|
-
user_id:
|
|
1134
|
-
}).strict();
|
|
1135
|
-
var GetCvmListSchema = z9.object({
|
|
1136
|
-
items: z9.array(CvmInfoSchema),
|
|
1137
|
-
total: z9.number(),
|
|
1138
|
-
page: z9.number(),
|
|
1139
|
-
page_size: z9.number(),
|
|
1140
|
-
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()
|
|
1141
1436
|
}).strict();
|
|
1142
|
-
|
|
1437
|
+
function getSchemaForVersion3(version) {
|
|
1438
|
+
return version === "2025-10-28" ? PaginatedCvmInfosV20251028Schema : PaginatedCvmInfosV20260121Schema;
|
|
1439
|
+
}
|
|
1440
|
+
async function getCvmList(client, request) {
|
|
1143
1441
|
const validatedRequest = GetCvmListRequestSchema.parse(request ?? {});
|
|
1144
|
-
|
|
1145
|
-
|
|
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
|
+
}
|
|
1146
1463
|
|
|
1147
1464
|
// src/actions/cvms/provision_cvm.ts
|
|
1148
|
-
import { z as
|
|
1149
|
-
var ProvisionCvmSchema =
|
|
1150
|
-
app_id:
|
|
1151
|
-
app_env_encrypt_pubkey:
|
|
1152
|
-
compose_hash:
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
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(),
|
|
1158
1476
|
// Will be transformed to node_id
|
|
1159
|
-
node_id:
|
|
1160
|
-
kms_id:
|
|
1477
|
+
node_id: z12.number().nullable().optional(),
|
|
1478
|
+
kms_id: z12.string().nullable().optional()
|
|
1161
1479
|
}).passthrough().transform((data) => {
|
|
1162
1480
|
if ("teepod_id" in data && data.teepod_id !== void 0) {
|
|
1163
1481
|
const { teepod_id, ...rest } = data;
|
|
@@ -1165,47 +1483,55 @@ var ProvisionCvmSchema = z10.object({
|
|
|
1165
1483
|
}
|
|
1166
1484
|
return data;
|
|
1167
1485
|
});
|
|
1168
|
-
var
|
|
1169
|
-
|
|
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(),
|
|
1170
1489
|
// recommended - optional, system auto-selects if not specified
|
|
1171
|
-
teepod_id:
|
|
1490
|
+
teepod_id: z12.number().optional(),
|
|
1172
1491
|
// deprecated, for compatibility
|
|
1173
|
-
region:
|
|
1492
|
+
region: z12.string().optional(),
|
|
1174
1493
|
// optional - region filter for auto-selection
|
|
1175
|
-
name:
|
|
1176
|
-
instance_type:
|
|
1177
|
-
// defaults to "tdx.small"
|
|
1178
|
-
image:
|
|
1179
|
-
vcpu:
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
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(""),
|
|
1187
1508
|
// optional with default empty string
|
|
1188
|
-
kms_enabled:
|
|
1189
|
-
public_logs:
|
|
1190
|
-
public_sysinfo:
|
|
1191
|
-
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(),
|
|
1192
1513
|
// recommended
|
|
1193
|
-
tproxy_enabled:
|
|
1514
|
+
tproxy_enabled: z12.boolean().optional()
|
|
1194
1515
|
// deprecated, for compatibility
|
|
1195
1516
|
}),
|
|
1196
|
-
listed:
|
|
1197
|
-
kms_id:
|
|
1198
|
-
kms:
|
|
1517
|
+
listed: z12.boolean().optional(),
|
|
1518
|
+
kms_id: z12.string().optional(),
|
|
1519
|
+
kms: z12.enum(["PHALA", "ETHEREUM", "BASE"]).optional(),
|
|
1199
1520
|
// KMS type selection (defaults to PHALA)
|
|
1200
|
-
kms_contract:
|
|
1521
|
+
kms_contract: z12.string().optional(),
|
|
1201
1522
|
// KMS contract address for on-chain KMS
|
|
1202
|
-
env_keys:
|
|
1523
|
+
env_keys: z12.array(z12.string()).optional(),
|
|
1203
1524
|
// Manual nonce specification (Advanced - PHALA KMS only)
|
|
1204
|
-
nonce:
|
|
1525
|
+
nonce: z12.number().optional(),
|
|
1205
1526
|
// User-specified nonce for deterministic app_id generation
|
|
1206
|
-
app_id:
|
|
1527
|
+
app_id: z12.string().optional()
|
|
1207
1528
|
// Expected app_id (must match calculated app_id from nonce)
|
|
1208
|
-
}).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
|
+
});
|
|
1209
1535
|
function handleGatewayCompatibility(appCompose) {
|
|
1210
1536
|
if (!appCompose.compose_file) {
|
|
1211
1537
|
return appCompose;
|
|
@@ -1241,63 +1567,64 @@ var { action: provisionCvm, safeAction: safeProvisionCvm } = defineAction(Provis
|
|
|
1241
1567
|
});
|
|
1242
1568
|
|
|
1243
1569
|
// src/actions/cvms/commit_cvm_provision.ts
|
|
1244
|
-
import { z as
|
|
1245
|
-
var CommitCvmProvisionSchema =
|
|
1246
|
-
id:
|
|
1247
|
-
name:
|
|
1248
|
-
status:
|
|
1249
|
-
teepod_id:
|
|
1250
|
-
teepod:
|
|
1251
|
-
id:
|
|
1252
|
-
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()
|
|
1253
1579
|
}).nullable(),
|
|
1254
|
-
user_id:
|
|
1255
|
-
app_id:
|
|
1256
|
-
vm_uuid:
|
|
1257
|
-
instance_id:
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
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()
|
|
1272
1599
|
}).passthrough();
|
|
1273
|
-
var CommitCvmProvisionRequestSchema =
|
|
1274
|
-
encrypted_env:
|
|
1275
|
-
app_id:
|
|
1276
|
-
compose_hash:
|
|
1277
|
-
kms_id:
|
|
1278
|
-
contract_address:
|
|
1279
|
-
deployer_address:
|
|
1280
|
-
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()
|
|
1281
1608
|
}).passthrough();
|
|
1282
1609
|
var { action: commitCvmProvision, safeAction: safeCommitCvmProvision } = defineAction(CommitCvmProvisionSchema, async (client, payload) => {
|
|
1283
1610
|
return await client.post("/cvms", payload);
|
|
1284
1611
|
});
|
|
1285
1612
|
|
|
1286
1613
|
// src/types/app_compose.ts
|
|
1287
|
-
import { z as
|
|
1288
|
-
var LooseAppComposeSchema =
|
|
1289
|
-
allowed_envs:
|
|
1290
|
-
docker_compose_file:
|
|
1291
|
-
features:
|
|
1292
|
-
name:
|
|
1293
|
-
manifest_version:
|
|
1294
|
-
kms_enabled:
|
|
1295
|
-
public_logs:
|
|
1296
|
-
public_sysinfo:
|
|
1297
|
-
tproxy_enabled:
|
|
1298
|
-
pre_launch_script:
|
|
1299
|
-
env_pubkey:
|
|
1300
|
-
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()
|
|
1301
1628
|
}).passthrough();
|
|
1302
1629
|
|
|
1303
1630
|
// src/utils/get_compose_hash.ts
|
|
@@ -1360,20 +1687,20 @@ var { action: getCvmComposeFile, safeAction: safeGetCvmComposeFile } = defineAct
|
|
|
1360
1687
|
});
|
|
1361
1688
|
|
|
1362
1689
|
// src/actions/cvms/provision_cvm_compose_file_update.ts
|
|
1363
|
-
import { z as
|
|
1364
|
-
var ProvisionCvmComposeFileUpdateRequestSchema =
|
|
1365
|
-
id:
|
|
1366
|
-
uuid:
|
|
1367
|
-
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(
|
|
1368
1695
|
(val) => !val.startsWith("app_") && val.length === 40,
|
|
1369
1696
|
"app_id should be 40 characters without prefix"
|
|
1370
1697
|
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
1371
|
-
instance_id:
|
|
1698
|
+
instance_id: z15.string().refine(
|
|
1372
1699
|
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
1373
1700
|
"instance_id should be 40 characters without prefix"
|
|
1374
1701
|
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1375
1702
|
app_compose: LooseAppComposeSchema,
|
|
1376
|
-
update_env_vars:
|
|
1703
|
+
update_env_vars: z15.boolean().optional().nullable()
|
|
1377
1704
|
}).refine(
|
|
1378
1705
|
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1379
1706
|
"One of id, uuid, app_id, or instance_id must be provided"
|
|
@@ -1384,10 +1711,10 @@ var ProvisionCvmComposeFileUpdateRequestSchema = z13.object({
|
|
|
1384
1711
|
_raw: data
|
|
1385
1712
|
};
|
|
1386
1713
|
});
|
|
1387
|
-
var ProvisionCvmComposeFileUpdateResultSchema =
|
|
1388
|
-
app_id:
|
|
1389
|
-
device_id:
|
|
1390
|
-
compose_hash:
|
|
1714
|
+
var ProvisionCvmComposeFileUpdateResultSchema = z15.object({
|
|
1715
|
+
app_id: z15.string().nullable(),
|
|
1716
|
+
device_id: z15.string().nullable(),
|
|
1717
|
+
compose_hash: z15.string(),
|
|
1391
1718
|
kms_info: KmsInfoSchema.nullable().optional()
|
|
1392
1719
|
}).passthrough();
|
|
1393
1720
|
var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmComposeFileUpdate } = defineAction(ProvisionCvmComposeFileUpdateResultSchema, async (client, request) => {
|
|
@@ -1399,22 +1726,22 @@ var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmCompose
|
|
|
1399
1726
|
});
|
|
1400
1727
|
|
|
1401
1728
|
// src/actions/cvms/commit_cvm_compose_file_update.ts
|
|
1402
|
-
import { z as
|
|
1403
|
-
var CommitCvmComposeFileUpdateRequestSchema =
|
|
1404
|
-
id:
|
|
1405
|
-
uuid:
|
|
1406
|
-
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(
|
|
1407
1734
|
(val) => !val.startsWith("app_") && val.length === 40,
|
|
1408
1735
|
"app_id should be 40 characters without prefix"
|
|
1409
1736
|
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
1410
|
-
instance_id:
|
|
1737
|
+
instance_id: z16.string().refine(
|
|
1411
1738
|
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
1412
1739
|
"instance_id should be 40 characters without prefix"
|
|
1413
1740
|
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1414
|
-
compose_hash:
|
|
1415
|
-
encrypted_env:
|
|
1416
|
-
env_keys:
|
|
1417
|
-
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()
|
|
1418
1745
|
}).refine(
|
|
1419
1746
|
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1420
1747
|
"One of id, uuid, app_id, or instance_id must be provided"
|
|
@@ -1423,10 +1750,10 @@ var CommitCvmComposeFileUpdateRequestSchema = z14.object({
|
|
|
1423
1750
|
compose_hash: data.compose_hash,
|
|
1424
1751
|
encrypted_env: data.encrypted_env,
|
|
1425
1752
|
env_keys: data.env_keys,
|
|
1426
|
-
update_env_vars:
|
|
1753
|
+
update_env_vars: data.update_env_vars ?? void 0,
|
|
1427
1754
|
_raw: data
|
|
1428
1755
|
}));
|
|
1429
|
-
var CommitCvmComposeFileUpdateSchema =
|
|
1756
|
+
var CommitCvmComposeFileUpdateSchema = z16.any().transform(() => void 0);
|
|
1430
1757
|
var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUpdate } = defineAction(
|
|
1431
1758
|
CommitCvmComposeFileUpdateSchema,
|
|
1432
1759
|
async (client, request) => {
|
|
@@ -1434,36 +1761,27 @@ var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUp
|
|
|
1434
1761
|
return await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
|
|
1435
1762
|
compose_hash: validatedRequest.compose_hash,
|
|
1436
1763
|
encrypted_env: validatedRequest.encrypted_env,
|
|
1437
|
-
env_keys: validatedRequest.env_keys
|
|
1764
|
+
env_keys: validatedRequest.env_keys,
|
|
1765
|
+
update_env_vars: validatedRequest.update_env_vars
|
|
1438
1766
|
});
|
|
1439
1767
|
}
|
|
1440
1768
|
);
|
|
1441
1769
|
|
|
1442
1770
|
// src/actions/cvms/update_cvm_envs.ts
|
|
1443
|
-
import { z as
|
|
1444
|
-
var UpdateCvmEnvsRequestSchema =
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
(
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
"instance_id should be 40 characters without prefix"
|
|
1454
|
-
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1455
|
-
encrypted_env: z15.string().describe("Encrypted environment variables (hex string)"),
|
|
1456
|
-
env_keys: z15.array(z15.string()).optional().describe("List of allowed environment variable keys"),
|
|
1457
|
-
compose_hash: z15.string().optional().describe("Compose hash for verification (Phase 2, required when env_keys changes)"),
|
|
1458
|
-
transaction_hash: z15.string().optional().describe(
|
|
1459
|
-
"On-chain transaction hash for verification (Phase 2, required when env_keys changes)"
|
|
1460
|
-
)
|
|
1461
|
-
}).refine(
|
|
1462
|
-
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1463
|
-
"One of id, uuid, app_id, or instance_id must be provided"
|
|
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
|
+
})
|
|
1464
1781
|
).transform((data) => {
|
|
1782
|
+
const { cvmId } = CvmIdSchema.parse(data);
|
|
1465
1783
|
return {
|
|
1466
|
-
cvmId
|
|
1784
|
+
cvmId,
|
|
1467
1785
|
request: {
|
|
1468
1786
|
encrypted_env: data.encrypted_env,
|
|
1469
1787
|
env_keys: data.env_keys,
|
|
@@ -1473,21 +1791,21 @@ var UpdateCvmEnvsRequestSchema = z15.object({
|
|
|
1473
1791
|
_raw: data
|
|
1474
1792
|
};
|
|
1475
1793
|
});
|
|
1476
|
-
var UpdateCvmEnvsInProgressSchema =
|
|
1477
|
-
status:
|
|
1478
|
-
message:
|
|
1479
|
-
correlation_id:
|
|
1480
|
-
allowed_envs_changed:
|
|
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()
|
|
1481
1799
|
});
|
|
1482
|
-
var UpdateCvmEnvsPreconditionRequiredSchema =
|
|
1483
|
-
status:
|
|
1484
|
-
message:
|
|
1485
|
-
compose_hash:
|
|
1486
|
-
app_id:
|
|
1487
|
-
device_id:
|
|
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(),
|
|
1488
1806
|
kms_info: KmsInfoSchema
|
|
1489
1807
|
});
|
|
1490
|
-
var UpdateCvmEnvsResultSchema =
|
|
1808
|
+
var UpdateCvmEnvsResultSchema = z17.union([
|
|
1491
1809
|
UpdateCvmEnvsInProgressSchema,
|
|
1492
1810
|
UpdateCvmEnvsPreconditionRequiredSchema
|
|
1493
1811
|
]);
|
|
@@ -1500,7 +1818,81 @@ var { action: updateCvmEnvs, safeAction: safeUpdateCvmEnvs } = defineAction(Upda
|
|
|
1500
1818
|
);
|
|
1501
1819
|
return response;
|
|
1502
1820
|
} catch (error) {
|
|
1503
|
-
if (error instanceof PhalaCloudError && error.status ===
|
|
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) {
|
|
1504
1896
|
const detail = error.detail;
|
|
1505
1897
|
if (detail && typeof detail === "object") {
|
|
1506
1898
|
const detailObj = detail;
|
|
@@ -1518,10 +1910,92 @@ var { action: updateCvmEnvs, safeAction: safeUpdateCvmEnvs } = defineAction(Upda
|
|
|
1518
1910
|
}
|
|
1519
1911
|
});
|
|
1520
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
|
+
|
|
1521
1995
|
// src/actions/kms/get_kms_info.ts
|
|
1522
|
-
import { z as
|
|
1523
|
-
var GetKmsInfoRequestSchema =
|
|
1524
|
-
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")
|
|
1525
1999
|
});
|
|
1526
2000
|
var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSchema, async (client, request) => {
|
|
1527
2001
|
const validatedRequest = GetKmsInfoRequestSchema.parse(request);
|
|
@@ -1529,18 +2003,18 @@ var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSch
|
|
|
1529
2003
|
});
|
|
1530
2004
|
|
|
1531
2005
|
// src/actions/kms/get_kms_list.ts
|
|
1532
|
-
import { z as
|
|
1533
|
-
var GetKmsListRequestSchema =
|
|
1534
|
-
page:
|
|
1535
|
-
page_size:
|
|
1536
|
-
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()
|
|
1537
2011
|
}).strict();
|
|
1538
|
-
var GetKmsListSchema =
|
|
1539
|
-
items:
|
|
1540
|
-
total:
|
|
1541
|
-
page:
|
|
1542
|
-
page_size:
|
|
1543
|
-
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()
|
|
1544
2018
|
}).strict();
|
|
1545
2019
|
var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsListSchema, async (client, request) => {
|
|
1546
2020
|
const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
|
|
@@ -1548,17 +2022,17 @@ var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsList
|
|
|
1548
2022
|
});
|
|
1549
2023
|
|
|
1550
2024
|
// src/actions/kms/get_app_env_encrypt_pubkey.ts
|
|
1551
|
-
import { z as
|
|
1552
|
-
var GetAppEnvEncryptPubKeyRequestSchema =
|
|
1553
|
-
kms:
|
|
1554
|
-
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(
|
|
1555
2029
|
(val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
|
|
1556
2030
|
"App ID must be exactly 40 characters or 42 characters with 0x prefix"
|
|
1557
2031
|
)
|
|
1558
2032
|
}).strict();
|
|
1559
|
-
var GetAppEnvEncryptPubKeySchema =
|
|
1560
|
-
public_key:
|
|
1561
|
-
signature:
|
|
2033
|
+
var GetAppEnvEncryptPubKeySchema = z23.object({
|
|
2034
|
+
public_key: z23.string(),
|
|
2035
|
+
signature: z23.string()
|
|
1562
2036
|
}).strict();
|
|
1563
2037
|
var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } = defineAction(GetAppEnvEncryptPubKeySchema, async (client, payload) => {
|
|
1564
2038
|
const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
|
|
@@ -1566,15 +2040,15 @@ var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } =
|
|
|
1566
2040
|
});
|
|
1567
2041
|
|
|
1568
2042
|
// src/actions/kms/next_app_ids.ts
|
|
1569
|
-
import { z as
|
|
1570
|
-
var NextAppIdsRequestSchema =
|
|
1571
|
-
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)
|
|
1572
2046
|
}).strict();
|
|
1573
|
-
var NextAppIdsSchema =
|
|
1574
|
-
app_ids:
|
|
1575
|
-
|
|
1576
|
-
app_id:
|
|
1577
|
-
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)
|
|
1578
2052
|
})
|
|
1579
2053
|
)
|
|
1580
2054
|
}).strict();
|
|
@@ -1585,6 +2059,36 @@ var { action: nextAppIds, safeAction: safeNextAppIds } = defineAction(NextAppIds
|
|
|
1585
2059
|
return await client.get(`/kms/phala/next_app_id?${params.toString()}`);
|
|
1586
2060
|
});
|
|
1587
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
|
+
|
|
1588
2092
|
// src/actions/cvms/start_cvm.ts
|
|
1589
2093
|
var StartCvmRequestSchema = CvmIdSchema;
|
|
1590
2094
|
var { action: startCvm, safeAction: safeStartCvm } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -1610,10 +2114,10 @@ var { action: shutdownCvm, safeAction: safeShutdownCvm } = defineAction(VMSchema
|
|
|
1610
2114
|
});
|
|
1611
2115
|
|
|
1612
2116
|
// src/actions/cvms/restart_cvm.ts
|
|
1613
|
-
import { z as
|
|
2117
|
+
import { z as z26 } from "zod";
|
|
1614
2118
|
var RestartCvmRequestSchema = refineCvmId(
|
|
1615
2119
|
CvmIdObjectSchema.extend({
|
|
1616
|
-
force:
|
|
2120
|
+
force: z26.boolean().optional()
|
|
1617
2121
|
})
|
|
1618
2122
|
);
|
|
1619
2123
|
var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -1624,10 +2128,10 @@ var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema,
|
|
|
1624
2128
|
});
|
|
1625
2129
|
|
|
1626
2130
|
// src/actions/cvms/delete_cvm.ts
|
|
1627
|
-
import { z as
|
|
2131
|
+
import { z as z27 } from "zod";
|
|
1628
2132
|
var DeleteCvmRequestSchema = CvmIdSchema;
|
|
1629
2133
|
var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
1630
|
-
|
|
2134
|
+
z27.void(),
|
|
1631
2135
|
async (client, request) => {
|
|
1632
2136
|
const { cvmId } = DeleteCvmRequestSchema.parse(request);
|
|
1633
2137
|
await client.delete(`/cvms/${cvmId}`);
|
|
@@ -1636,41 +2140,41 @@ var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
|
1636
2140
|
);
|
|
1637
2141
|
|
|
1638
2142
|
// src/actions/cvms/get_cvm_stats.ts
|
|
1639
|
-
import { z as
|
|
1640
|
-
var DiskInfoSchema =
|
|
1641
|
-
name:
|
|
1642
|
-
mount_point:
|
|
1643
|
-
total_size:
|
|
1644
|
-
free_size:
|
|
1645
|
-
});
|
|
1646
|
-
var SystemInfoSchema =
|
|
1647
|
-
os_name:
|
|
1648
|
-
os_version:
|
|
1649
|
-
kernel_version:
|
|
1650
|
-
cpu_model:
|
|
1651
|
-
num_cpus:
|
|
1652
|
-
total_memory:
|
|
1653
|
-
available_memory:
|
|
1654
|
-
used_memory:
|
|
1655
|
-
free_memory:
|
|
1656
|
-
total_swap:
|
|
1657
|
-
used_swap:
|
|
1658
|
-
free_swap:
|
|
1659
|
-
uptime:
|
|
1660
|
-
loadavg_one:
|
|
1661
|
-
loadavg_five:
|
|
1662
|
-
loadavg_fifteen:
|
|
1663
|
-
disks:
|
|
1664
|
-
});
|
|
1665
|
-
var CvmSystemInfoSchema =
|
|
1666
|
-
is_online:
|
|
1667
|
-
is_public:
|
|
1668
|
-
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(),
|
|
1669
2173
|
sysinfo: SystemInfoSchema.nullable(),
|
|
1670
|
-
status:
|
|
1671
|
-
in_progress:
|
|
1672
|
-
boot_progress:
|
|
1673
|
-
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()
|
|
1674
2178
|
});
|
|
1675
2179
|
var GetCvmStatsRequestSchema = CvmIdSchema;
|
|
1676
2180
|
var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSystemInfoSchema, async (client, request) => {
|
|
@@ -1679,18 +2183,18 @@ var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSyste
|
|
|
1679
2183
|
});
|
|
1680
2184
|
|
|
1681
2185
|
// src/actions/cvms/get_cvm_network.ts
|
|
1682
|
-
import { z as
|
|
1683
|
-
var
|
|
1684
|
-
app:
|
|
1685
|
-
instance:
|
|
1686
|
-
});
|
|
1687
|
-
var CvmNetworkSchema =
|
|
1688
|
-
is_online:
|
|
1689
|
-
is_public:
|
|
1690
|
-
error:
|
|
1691
|
-
internal_ip:
|
|
1692
|
-
latest_handshake:
|
|
1693
|
-
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()
|
|
1694
2198
|
});
|
|
1695
2199
|
var GetCvmNetworkRequestSchema = CvmIdSchema;
|
|
1696
2200
|
var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmNetworkSchema, async (client, request) => {
|
|
@@ -1699,36 +2203,36 @@ var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmN
|
|
|
1699
2203
|
});
|
|
1700
2204
|
|
|
1701
2205
|
// src/actions/cvms/get_cvm_docker_compose.ts
|
|
1702
|
-
import { z as
|
|
2206
|
+
import { z as z30 } from "zod";
|
|
1703
2207
|
var GetCvmDockerComposeRequestSchema = CvmIdSchema;
|
|
1704
|
-
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(
|
|
2208
|
+
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(z30.string(), async (client, request) => {
|
|
1705
2209
|
const { cvmId } = GetCvmDockerComposeRequestSchema.parse(request);
|
|
1706
2210
|
return await client.get(`/cvms/${cvmId}/docker-compose.yml`);
|
|
1707
2211
|
});
|
|
1708
2212
|
|
|
1709
2213
|
// src/actions/cvms/get_cvm_containers_stats.ts
|
|
1710
|
-
import { z as
|
|
1711
|
-
var ContainerInfoSchema =
|
|
1712
|
-
id:
|
|
1713
|
-
names:
|
|
1714
|
-
image:
|
|
1715
|
-
image_id:
|
|
1716
|
-
command:
|
|
1717
|
-
created:
|
|
1718
|
-
state:
|
|
1719
|
-
status:
|
|
1720
|
-
log_endpoint:
|
|
1721
|
-
});
|
|
1722
|
-
var CvmContainersStatsSchema =
|
|
1723
|
-
is_online:
|
|
1724
|
-
is_public:
|
|
1725
|
-
error:
|
|
1726
|
-
docker_compose_file:
|
|
1727
|
-
manifest_version:
|
|
1728
|
-
version:
|
|
1729
|
-
runner:
|
|
1730
|
-
features:
|
|
1731
|
-
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()
|
|
1732
2236
|
});
|
|
1733
2237
|
var GetCvmContainersStatsRequestSchema = CvmIdSchema;
|
|
1734
2238
|
var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = defineAction(CvmContainersStatsSchema, async (client, request) => {
|
|
@@ -1737,62 +2241,62 @@ var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = d
|
|
|
1737
2241
|
});
|
|
1738
2242
|
|
|
1739
2243
|
// src/actions/cvms/get_cvm_attestation.ts
|
|
1740
|
-
import { z as
|
|
1741
|
-
var CertificateSubjectSchema =
|
|
1742
|
-
common_name:
|
|
1743
|
-
organization:
|
|
1744
|
-
country:
|
|
1745
|
-
state:
|
|
1746
|
-
locality:
|
|
1747
|
-
});
|
|
1748
|
-
var CertificateIssuerSchema =
|
|
1749
|
-
common_name:
|
|
1750
|
-
organization:
|
|
1751
|
-
country:
|
|
1752
|
-
});
|
|
1753
|
-
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({
|
|
1754
2258
|
subject: CertificateSubjectSchema,
|
|
1755
2259
|
issuer: CertificateIssuerSchema,
|
|
1756
|
-
serial_number:
|
|
1757
|
-
not_before:
|
|
2260
|
+
serial_number: z32.string(),
|
|
2261
|
+
not_before: z32.string(),
|
|
1758
2262
|
// datetime serialized as ISO string
|
|
1759
|
-
not_after:
|
|
2263
|
+
not_after: z32.string(),
|
|
1760
2264
|
// datetime serialized as ISO string
|
|
1761
|
-
version:
|
|
1762
|
-
fingerprint:
|
|
1763
|
-
signature_algorithm:
|
|
1764
|
-
sans:
|
|
1765
|
-
is_ca:
|
|
1766
|
-
position_in_chain:
|
|
1767
|
-
quote:
|
|
1768
|
-
app_id:
|
|
1769
|
-
cert_usage:
|
|
1770
|
-
});
|
|
1771
|
-
var EventLogSchema =
|
|
1772
|
-
imr:
|
|
1773
|
-
event_type:
|
|
1774
|
-
digest:
|
|
1775
|
-
event:
|
|
1776
|
-
event_payload:
|
|
1777
|
-
});
|
|
1778
|
-
var TcbInfoSchema =
|
|
1779
|
-
mrtd:
|
|
1780
|
-
rootfs_hash:
|
|
1781
|
-
rtmr0:
|
|
1782
|
-
rtmr1:
|
|
1783
|
-
rtmr2:
|
|
1784
|
-
rtmr3:
|
|
1785
|
-
event_log:
|
|
1786
|
-
app_compose:
|
|
1787
|
-
});
|
|
1788
|
-
var CvmAttestationSchema =
|
|
1789
|
-
name:
|
|
1790
|
-
is_online:
|
|
1791
|
-
is_public:
|
|
1792
|
-
error:
|
|
1793
|
-
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(),
|
|
1794
2298
|
tcb_info: TcbInfoSchema.nullable(),
|
|
1795
|
-
compose_file:
|
|
2299
|
+
compose_file: z32.string().nullable()
|
|
1796
2300
|
});
|
|
1797
2301
|
var GetCvmAttestationRequestSchema = CvmIdSchema;
|
|
1798
2302
|
var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAction(CvmAttestationSchema, async (client, request) => {
|
|
@@ -1801,17 +2305,17 @@ var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAct
|
|
|
1801
2305
|
});
|
|
1802
2306
|
|
|
1803
2307
|
// src/actions/cvms/update_cvm_resources.ts
|
|
1804
|
-
import { z as
|
|
2308
|
+
import { z as z33 } from "zod";
|
|
1805
2309
|
var UpdateCvmResourcesRequestSchema = refineCvmId(
|
|
1806
2310
|
CvmIdObjectSchema.extend({
|
|
1807
|
-
vcpu:
|
|
1808
|
-
memory:
|
|
1809
|
-
disk_size:
|
|
1810
|
-
instance_type:
|
|
1811
|
-
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()
|
|
1812
2316
|
})
|
|
1813
2317
|
);
|
|
1814
|
-
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(
|
|
2318
|
+
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(z33.void(), async (client, request) => {
|
|
1815
2319
|
const parsed = UpdateCvmResourcesRequestSchema.parse(request);
|
|
1816
2320
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
1817
2321
|
const { ...body } = parsed;
|
|
@@ -1820,14 +2324,14 @@ var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineA
|
|
|
1820
2324
|
});
|
|
1821
2325
|
|
|
1822
2326
|
// src/actions/cvms/update_cvm_visibility.ts
|
|
1823
|
-
import { z as
|
|
2327
|
+
import { z as z34 } from "zod";
|
|
1824
2328
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
1825
2329
|
CvmIdObjectSchema.extend({
|
|
1826
|
-
public_sysinfo:
|
|
1827
|
-
public_logs:
|
|
2330
|
+
public_sysinfo: z34.boolean(),
|
|
2331
|
+
public_logs: z34.boolean()
|
|
1828
2332
|
})
|
|
1829
2333
|
);
|
|
1830
|
-
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(
|
|
2334
|
+
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmDetailV20251028Schema, async (client, request) => {
|
|
1831
2335
|
const parsed = UpdateCvmVisibilityRequestSchema.parse(request);
|
|
1832
2336
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
1833
2337
|
const { public_sysinfo, public_logs } = parsed;
|
|
@@ -1835,21 +2339,21 @@ var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defin
|
|
|
1835
2339
|
});
|
|
1836
2340
|
|
|
1837
2341
|
// src/actions/cvms/get_available_os_images.ts
|
|
1838
|
-
import { z as
|
|
1839
|
-
var OSImageVariantSchema =
|
|
1840
|
-
name:
|
|
1841
|
-
os_image_hash:
|
|
1842
|
-
is_current:
|
|
1843
|
-
});
|
|
1844
|
-
var AvailableOSImageSchema2 =
|
|
1845
|
-
version:
|
|
1846
|
-
|
|
1847
|
-
|
|
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()
|
|
2347
|
+
});
|
|
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()])
|
|
1848
2352
|
]),
|
|
1849
2353
|
prod: OSImageVariantSchema.nullable(),
|
|
1850
2354
|
dev: OSImageVariantSchema.nullable()
|
|
1851
2355
|
});
|
|
1852
|
-
var GetAvailableOSImagesResponseSchema =
|
|
2356
|
+
var GetAvailableOSImagesResponseSchema = z35.array(AvailableOSImageSchema2);
|
|
1853
2357
|
var GetAvailableOSImagesRequestSchema = CvmIdSchema;
|
|
1854
2358
|
var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = defineAction(GetAvailableOSImagesResponseSchema, async (client, request) => {
|
|
1855
2359
|
const { cvmId } = GetAvailableOSImagesRequestSchema.parse(request);
|
|
@@ -1857,13 +2361,13 @@ var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = def
|
|
|
1857
2361
|
});
|
|
1858
2362
|
|
|
1859
2363
|
// src/actions/cvms/update_os_image.ts
|
|
1860
|
-
import { z as
|
|
2364
|
+
import { z as z36 } from "zod";
|
|
1861
2365
|
var UpdateOsImageRequestSchema = refineCvmId(
|
|
1862
2366
|
CvmIdObjectSchema.extend({
|
|
1863
|
-
os_image_name:
|
|
2367
|
+
os_image_name: z36.string().min(1, "OS image name is required")
|
|
1864
2368
|
})
|
|
1865
2369
|
);
|
|
1866
|
-
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(
|
|
2370
|
+
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z36.void(), async (client, request) => {
|
|
1867
2371
|
const parsed = UpdateOsImageRequestSchema.parse(request);
|
|
1868
2372
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
1869
2373
|
const { os_image_name } = parsed;
|
|
@@ -1872,17 +2376,17 @@ var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z30.
|
|
|
1872
2376
|
});
|
|
1873
2377
|
|
|
1874
2378
|
// src/actions/cvms/get_cvm_state.ts
|
|
1875
|
-
import { z as
|
|
1876
|
-
var CvmStateSchema =
|
|
1877
|
-
id:
|
|
1878
|
-
instance_id:
|
|
1879
|
-
name:
|
|
1880
|
-
status:
|
|
1881
|
-
uptime:
|
|
1882
|
-
exited_at:
|
|
1883
|
-
boot_progress:
|
|
1884
|
-
boot_error:
|
|
1885
|
-
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()
|
|
1886
2390
|
});
|
|
1887
2391
|
var GetCvmStateRequestSchema = CvmIdSchema;
|
|
1888
2392
|
var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmStateSchema, async (client, request) => {
|
|
@@ -1922,6 +2426,12 @@ function createClient2(config = {}) {
|
|
|
1922
2426
|
safeCommitCvmComposeFileUpdate,
|
|
1923
2427
|
updateCvmEnvs,
|
|
1924
2428
|
safeUpdateCvmEnvs,
|
|
2429
|
+
updateDockerCompose,
|
|
2430
|
+
safeUpdateDockerCompose,
|
|
2431
|
+
updatePreLaunchScript,
|
|
2432
|
+
safeUpdatePreLaunchScript,
|
|
2433
|
+
getCvmPreLaunchScript,
|
|
2434
|
+
safeGetCvmPreLaunchScript,
|
|
1925
2435
|
startCvm,
|
|
1926
2436
|
safeStartCvm,
|
|
1927
2437
|
stopCvm,
|
|
@@ -1964,8 +2474,147 @@ function createClient2(config = {}) {
|
|
|
1964
2474
|
return client.extend(allActions);
|
|
1965
2475
|
}
|
|
1966
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
|
+
|
|
1967
2616
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
1968
|
-
import { z as
|
|
2617
|
+
import { z as z41 } from "zod";
|
|
1969
2618
|
import {
|
|
1970
2619
|
createPublicClient as createPublicClient2,
|
|
1971
2620
|
createWalletClient as createWalletClient2,
|
|
@@ -2626,25 +3275,25 @@ var kmsAuthAbi = [
|
|
|
2626
3275
|
anonymous: false
|
|
2627
3276
|
}
|
|
2628
3277
|
];
|
|
2629
|
-
var DeployAppAuthRequestBaseSchema =
|
|
3278
|
+
var DeployAppAuthRequestBaseSchema = z41.object({
|
|
2630
3279
|
// Chain configuration (conditionally required)
|
|
2631
|
-
chain:
|
|
2632
|
-
rpcUrl:
|
|
3280
|
+
chain: z41.unknown().optional(),
|
|
3281
|
+
rpcUrl: z41.string().optional(),
|
|
2633
3282
|
// Contract configuration (required)
|
|
2634
|
-
kmsContractAddress:
|
|
3283
|
+
kmsContractAddress: z41.string(),
|
|
2635
3284
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
2636
|
-
privateKey:
|
|
2637
|
-
walletClient:
|
|
3285
|
+
privateKey: z41.string().optional(),
|
|
3286
|
+
walletClient: z41.unknown().optional(),
|
|
2638
3287
|
// Public client (optional, will create default if not provided)
|
|
2639
|
-
publicClient:
|
|
3288
|
+
publicClient: z41.unknown().optional(),
|
|
2640
3289
|
// App configuration (optional)
|
|
2641
|
-
allowAnyDevice:
|
|
2642
|
-
deviceId:
|
|
2643
|
-
composeHash:
|
|
2644
|
-
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),
|
|
2645
3294
|
// Validation configuration (optional)
|
|
2646
|
-
skipPrerequisiteChecks:
|
|
2647
|
-
minBalance:
|
|
3295
|
+
skipPrerequisiteChecks: z41.boolean().optional().default(false),
|
|
3296
|
+
minBalance: z41.string().optional()
|
|
2648
3297
|
// ETH amount as string, e.g., "0.01"
|
|
2649
3298
|
}).passthrough();
|
|
2650
3299
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -2672,13 +3321,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
2672
3321
|
path: ["chain"]
|
|
2673
3322
|
}
|
|
2674
3323
|
);
|
|
2675
|
-
var DeployAppAuthSchema =
|
|
2676
|
-
appId:
|
|
2677
|
-
appAuthAddress:
|
|
2678
|
-
deployer:
|
|
2679
|
-
transactionHash:
|
|
2680
|
-
blockNumber:
|
|
2681
|
-
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()
|
|
2682
3331
|
}).passthrough();
|
|
2683
3332
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
2684
3333
|
try {
|
|
@@ -2924,7 +3573,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
2924
3573
|
}
|
|
2925
3574
|
|
|
2926
3575
|
// src/actions/blockchains/add_compose_hash.ts
|
|
2927
|
-
import { z as
|
|
3576
|
+
import { z as z42 } from "zod";
|
|
2928
3577
|
import {
|
|
2929
3578
|
createPublicClient as createPublicClient3,
|
|
2930
3579
|
createWalletClient as createWalletClient3,
|
|
@@ -2948,29 +3597,29 @@ var appAuthAbi = [
|
|
|
2948
3597
|
anonymous: false
|
|
2949
3598
|
}
|
|
2950
3599
|
];
|
|
2951
|
-
var AddComposeHashRequestSchema =
|
|
3600
|
+
var AddComposeHashRequestSchema = z42.object({
|
|
2952
3601
|
// Chain configuration (conditionally required)
|
|
2953
|
-
chain:
|
|
2954
|
-
rpcUrl:
|
|
2955
|
-
appId:
|
|
2956
|
-
composeHash:
|
|
3602
|
+
chain: z42.unknown().optional(),
|
|
3603
|
+
rpcUrl: z42.string().optional(),
|
|
3604
|
+
appId: z42.string(),
|
|
3605
|
+
composeHash: z42.string(),
|
|
2957
3606
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
2958
|
-
privateKey:
|
|
2959
|
-
walletClient:
|
|
3607
|
+
privateKey: z42.string().optional(),
|
|
3608
|
+
walletClient: z42.unknown().optional(),
|
|
2960
3609
|
// Public client (optional, will create default if not provided)
|
|
2961
|
-
publicClient:
|
|
3610
|
+
publicClient: z42.unknown().optional(),
|
|
2962
3611
|
// Validation configuration (optional)
|
|
2963
|
-
skipPrerequisiteChecks:
|
|
2964
|
-
minBalance:
|
|
3612
|
+
skipPrerequisiteChecks: z42.boolean().optional().default(false),
|
|
3613
|
+
minBalance: z42.string().optional(),
|
|
2965
3614
|
// ETH amount as string, e.g., "0.01"
|
|
2966
3615
|
// Transaction control options
|
|
2967
|
-
timeout:
|
|
2968
|
-
retryOptions:
|
|
2969
|
-
signal:
|
|
3616
|
+
timeout: z42.number().optional().default(12e4),
|
|
3617
|
+
retryOptions: z42.unknown().optional(),
|
|
3618
|
+
signal: z42.unknown().optional(),
|
|
2970
3619
|
// Progress callbacks
|
|
2971
|
-
onTransactionStateChange:
|
|
2972
|
-
onTransactionSubmitted:
|
|
2973
|
-
onTransactionConfirmed:
|
|
3620
|
+
onTransactionStateChange: z42.function().optional(),
|
|
3621
|
+
onTransactionSubmitted: z42.function().optional(),
|
|
3622
|
+
onTransactionConfirmed: z42.function().optional()
|
|
2974
3623
|
}).passthrough().refine(
|
|
2975
3624
|
(data) => {
|
|
2976
3625
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -2994,12 +3643,12 @@ var AddComposeHashRequestSchema = z33.object({
|
|
|
2994
3643
|
path: ["chain"]
|
|
2995
3644
|
}
|
|
2996
3645
|
);
|
|
2997
|
-
var AddComposeHashSchema =
|
|
2998
|
-
composeHash:
|
|
2999
|
-
appId:
|
|
3000
|
-
transactionHash:
|
|
3001
|
-
blockNumber:
|
|
3002
|
-
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()
|
|
3003
3652
|
}).passthrough();
|
|
3004
3653
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
3005
3654
|
console.log(receipt.logs);
|
|
@@ -3190,14 +3839,70 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
3190
3839
|
}
|
|
3191
3840
|
}
|
|
3192
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
|
+
|
|
3193
3898
|
// src/actions/cvms/watch_cvm_state.ts
|
|
3194
|
-
import { z as
|
|
3195
|
-
var WatchCvmStateParamsSchema =
|
|
3196
|
-
target:
|
|
3197
|
-
interval:
|
|
3198
|
-
timeout:
|
|
3199
|
-
maxRetries:
|
|
3200
|
-
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")
|
|
3201
3906
|
});
|
|
3202
3907
|
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
3203
3908
|
var WatchAbortedError = class extends Error {
|
|
@@ -3384,6 +4089,195 @@ function sleep(ms, signal) {
|
|
|
3384
4089
|
});
|
|
3385
4090
|
}
|
|
3386
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
|
+
|
|
3387
4281
|
// src/parse_dotenv.ts
|
|
3388
4282
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
3389
4283
|
function parseEnv(input) {
|
|
@@ -3425,33 +4319,65 @@ export {
|
|
|
3425
4319
|
AddComposeHashSchema,
|
|
3426
4320
|
AllFamiliesResponseSchema,
|
|
3427
4321
|
ApiErrorSchema,
|
|
4322
|
+
AppRevisionDetailResponseSchema,
|
|
4323
|
+
AppRevisionResponseSchema,
|
|
4324
|
+
AppRevisionsResponseSchema,
|
|
3428
4325
|
AuthError,
|
|
4326
|
+
CurrentUserV20260121Schema as AuthResponseSchema,
|
|
3429
4327
|
AvailableNodesSchema,
|
|
4328
|
+
BillingPeriodSchema,
|
|
3430
4329
|
BusinessError,
|
|
3431
4330
|
CommitCvmComposeFileUpdateRequestSchema,
|
|
3432
4331
|
CommitCvmComposeFileUpdateSchema,
|
|
3433
4332
|
CommitCvmProvisionRequestSchema,
|
|
3434
4333
|
CommitCvmProvisionSchema,
|
|
3435
|
-
|
|
4334
|
+
CreditsInfoSchema,
|
|
4335
|
+
CurrentUserV20251028Schema as CurrentUserSchema,
|
|
4336
|
+
CurrentUserV20251028Schema,
|
|
4337
|
+
CurrentUserV20260121Schema,
|
|
3436
4338
|
CvmAttestationSchema,
|
|
4339
|
+
CvmBasicInfoV20251028Schema,
|
|
3437
4340
|
CvmContainersStatsSchema,
|
|
4341
|
+
CvmDetailV20251028Schema,
|
|
4342
|
+
CvmGatewayInfoV20260121Schema,
|
|
3438
4343
|
CvmIdBaseSchema,
|
|
3439
4344
|
CvmIdObjectSchema,
|
|
3440
4345
|
CvmIdSchema,
|
|
3441
|
-
|
|
3442
|
-
|
|
4346
|
+
CvmInfoDetailV20260121Schema,
|
|
4347
|
+
CvmInfoV20251028Schema,
|
|
4348
|
+
CvmInfoV20260121Schema,
|
|
4349
|
+
CvmKmsInfoV20260121Schema,
|
|
3443
4350
|
CvmNetworkSchema,
|
|
3444
|
-
|
|
3445
|
-
|
|
4351
|
+
CvmNetworkUrlsV20251028Schema,
|
|
4352
|
+
CvmNodeInfoV20260121Schema,
|
|
4353
|
+
CvmNodeV20251028Schema,
|
|
4354
|
+
CvmOsInfoV20260121Schema,
|
|
4355
|
+
CvmProgressInfoV20260121Schema,
|
|
4356
|
+
CvmRefSchema,
|
|
4357
|
+
CvmResourceInfoV20260121Schema,
|
|
3446
4358
|
CvmStateSchema,
|
|
4359
|
+
CvmStatusSchema,
|
|
3447
4360
|
CvmSystemInfoSchema,
|
|
3448
4361
|
DeleteCvmRequestSchema,
|
|
3449
4362
|
DeployAppAuthRequestSchema,
|
|
3450
4363
|
DeployAppAuthSchema,
|
|
4364
|
+
DstackAppFullResponseV20251028Schema,
|
|
4365
|
+
DstackAppFullResponseV20260121Schema,
|
|
4366
|
+
DstackAppListResponseV20251028Schema,
|
|
4367
|
+
DstackAppListResponseV20260121Schema,
|
|
4368
|
+
DstackAppMinimalResponseV20251028Schema,
|
|
4369
|
+
DstackAppMinimalResponseV20260121Schema,
|
|
4370
|
+
DstackAppWithCvmResponseV20251028Schema,
|
|
4371
|
+
DstackAppWithCvmResponseV20260121Schema,
|
|
3451
4372
|
FamilyGroupSchema,
|
|
3452
4373
|
FamilyInstanceTypesResponseSchema,
|
|
4374
|
+
GetAppCvmsRequestSchema,
|
|
3453
4375
|
GetAppEnvEncryptPubKeyRequestSchema,
|
|
3454
4376
|
GetAppEnvEncryptPubKeySchema,
|
|
4377
|
+
GetAppInfoRequestSchema,
|
|
4378
|
+
GetAppListRequestSchema,
|
|
4379
|
+
GetAppRevisionDetailRequestSchema,
|
|
4380
|
+
GetAppRevisionsRequestSchema,
|
|
3455
4381
|
GetAvailableOSImagesRequestSchema,
|
|
3456
4382
|
GetAvailableOSImagesResponseSchema,
|
|
3457
4383
|
GetCvmAttestationRequestSchema,
|
|
@@ -3460,29 +4386,39 @@ export {
|
|
|
3460
4386
|
GetCvmDockerComposeRequestSchema,
|
|
3461
4387
|
GetCvmInfoRequestSchema,
|
|
3462
4388
|
GetCvmListRequestSchema,
|
|
3463
|
-
GetCvmListSchema,
|
|
3464
4389
|
GetCvmNetworkRequestSchema,
|
|
4390
|
+
GetCvmPreLaunchScriptRequestSchema,
|
|
3465
4391
|
GetCvmStateRequestSchema,
|
|
3466
4392
|
GetCvmStatsRequestSchema,
|
|
4393
|
+
GetCvmStatusBatchRequestSchema,
|
|
4394
|
+
GetCvmStatusBatchResponseSchema,
|
|
3467
4395
|
GetKmsInfoRequestSchema,
|
|
3468
4396
|
GetKmsListRequestSchema,
|
|
3469
4397
|
GetKmsListSchema,
|
|
4398
|
+
GetWorkspaceNodesSchema,
|
|
4399
|
+
GetWorkspaceQuotasSchema,
|
|
3470
4400
|
InstanceTypeSchema,
|
|
3471
4401
|
KmsInfoSchema,
|
|
4402
|
+
KmsTypeSchema,
|
|
3472
4403
|
ListFamilyInstanceTypesRequestSchema,
|
|
3473
4404
|
ListWorkspacesSchema,
|
|
3474
|
-
|
|
4405
|
+
MachineInfoV20251028Schema,
|
|
4406
|
+
ManagedUserV20251028Schema,
|
|
3475
4407
|
MaxRetriesExceededError,
|
|
3476
4408
|
NetworkError,
|
|
3477
4409
|
NextAppIdsRequestSchema,
|
|
3478
4410
|
NextAppIdsSchema,
|
|
4411
|
+
NodeInfoSchema,
|
|
3479
4412
|
OSImageVariantSchema,
|
|
4413
|
+
PaginatedCvmInfosV20251028Schema,
|
|
4414
|
+
PaginatedCvmInfosV20260121Schema,
|
|
3480
4415
|
PaginationMetadataSchema,
|
|
3481
4416
|
PhalaCloudError,
|
|
3482
4417
|
ProvisionCvmComposeFileUpdateRequestSchema,
|
|
3483
4418
|
ProvisionCvmComposeFileUpdateResultSchema,
|
|
3484
4419
|
ProvisionCvmRequestSchema,
|
|
3485
4420
|
ProvisionCvmSchema,
|
|
4421
|
+
QuotaMetricSchema,
|
|
3486
4422
|
RequestError,
|
|
3487
4423
|
ResourceError,
|
|
3488
4424
|
RestartCvmRequestSchema,
|
|
@@ -3498,13 +4434,23 @@ export {
|
|
|
3498
4434
|
UpdateCvmEnvsResultSchema,
|
|
3499
4435
|
UpdateCvmResourcesRequestSchema,
|
|
3500
4436
|
UpdateCvmVisibilityRequestSchema,
|
|
4437
|
+
UpdateDockerComposeRequestSchema,
|
|
4438
|
+
UpdateDockerComposeResultSchema,
|
|
3501
4439
|
UpdateOsImageRequestSchema,
|
|
4440
|
+
UpdatePreLaunchScriptRequestSchema,
|
|
4441
|
+
UpdatePreLaunchScriptResultSchema,
|
|
4442
|
+
UserInfoSchema,
|
|
4443
|
+
UserRefSchema,
|
|
3502
4444
|
VMSchema,
|
|
3503
4445
|
ValidationError,
|
|
3504
|
-
|
|
4446
|
+
VmInfoV20251028Schema,
|
|
3505
4447
|
WalletError,
|
|
3506
4448
|
WatchAbortedError,
|
|
3507
4449
|
WatchCvmStateRequestSchema,
|
|
4450
|
+
WorkspaceInfoSchema,
|
|
4451
|
+
WorkspaceQuotasSchema,
|
|
4452
|
+
WorkspaceRefSchema,
|
|
4453
|
+
WorkspaceReservedGpuQuotaSchema,
|
|
3508
4454
|
WorkspaceResponseSchema,
|
|
3509
4455
|
addComposeHash,
|
|
3510
4456
|
addNetwork,
|
|
@@ -3514,6 +4460,7 @@ export {
|
|
|
3514
4460
|
checkNetworkStatus,
|
|
3515
4461
|
commitCvmComposeFileUpdate,
|
|
3516
4462
|
commitCvmProvision,
|
|
4463
|
+
convertToHostname,
|
|
3517
4464
|
createClient as createBaseClient,
|
|
3518
4465
|
createClient2 as createClient,
|
|
3519
4466
|
createClientsFromBrowser,
|
|
@@ -3534,7 +4481,14 @@ export {
|
|
|
3534
4481
|
formatErrorMessage,
|
|
3535
4482
|
formatStructuredError,
|
|
3536
4483
|
formatValidationErrors,
|
|
4484
|
+
generateDefaultCvmName,
|
|
4485
|
+
generateFallbackHostname,
|
|
4486
|
+
getAppCvms,
|
|
3537
4487
|
getAppEnvEncryptPubKey,
|
|
4488
|
+
getAppInfo,
|
|
4489
|
+
getAppList,
|
|
4490
|
+
getAppRevisionDetail,
|
|
4491
|
+
getAppRevisions,
|
|
3538
4492
|
getAvailableNodes,
|
|
3539
4493
|
getAvailableOsImages,
|
|
3540
4494
|
getComposeHash2 as getComposeHash,
|
|
@@ -3546,13 +4500,18 @@ export {
|
|
|
3546
4500
|
getCvmInfo,
|
|
3547
4501
|
getCvmList,
|
|
3548
4502
|
getCvmNetwork,
|
|
4503
|
+
getCvmPreLaunchScript,
|
|
3549
4504
|
getCvmState,
|
|
3550
4505
|
getCvmStats,
|
|
4506
|
+
getCvmStatusBatch,
|
|
3551
4507
|
getErrorMessage,
|
|
3552
4508
|
getKmsInfo,
|
|
3553
4509
|
getKmsList,
|
|
3554
4510
|
getValidationFields,
|
|
3555
4511
|
getWorkspace,
|
|
4512
|
+
getWorkspaceNodes,
|
|
4513
|
+
getWorkspaceQuotas,
|
|
4514
|
+
isValidHostname,
|
|
3556
4515
|
listAllInstanceTypeFamilies,
|
|
3557
4516
|
listFamilyInstanceTypes,
|
|
3558
4517
|
listWorkspaces,
|
|
@@ -3570,7 +4529,12 @@ export {
|
|
|
3570
4529
|
safeCommitCvmProvision,
|
|
3571
4530
|
safeDeleteCvm,
|
|
3572
4531
|
safeDeployAppAuth,
|
|
4532
|
+
safeGetAppCvms,
|
|
3573
4533
|
safeGetAppEnvEncryptPubKey,
|
|
4534
|
+
safeGetAppInfo,
|
|
4535
|
+
safeGetAppList,
|
|
4536
|
+
safeGetAppRevisionDetail,
|
|
4537
|
+
safeGetAppRevisions,
|
|
3574
4538
|
safeGetAvailableNodes,
|
|
3575
4539
|
safeGetAvailableOsImages,
|
|
3576
4540
|
safeGetCurrentUser,
|
|
@@ -3581,11 +4545,15 @@ export {
|
|
|
3581
4545
|
safeGetCvmInfo,
|
|
3582
4546
|
safeGetCvmList,
|
|
3583
4547
|
safeGetCvmNetwork,
|
|
4548
|
+
safeGetCvmPreLaunchScript,
|
|
3584
4549
|
safeGetCvmState,
|
|
3585
4550
|
safeGetCvmStats,
|
|
4551
|
+
safeGetCvmStatusBatch,
|
|
3586
4552
|
safeGetKmsInfo,
|
|
3587
4553
|
safeGetKmsList,
|
|
3588
4554
|
safeGetWorkspace,
|
|
4555
|
+
safeGetWorkspaceNodes,
|
|
4556
|
+
safeGetWorkspaceQuotas,
|
|
3589
4557
|
safeListAllInstanceTypeFamilies,
|
|
3590
4558
|
safeListFamilyInstanceTypes,
|
|
3591
4559
|
safeListWorkspaces,
|
|
@@ -3599,7 +4567,9 @@ export {
|
|
|
3599
4567
|
safeUpdateCvmEnvs,
|
|
3600
4568
|
safeUpdateCvmResources,
|
|
3601
4569
|
safeUpdateCvmVisibility,
|
|
4570
|
+
safeUpdateDockerCompose,
|
|
3602
4571
|
safeUpdateOsImage,
|
|
4572
|
+
safeUpdatePreLaunchScript,
|
|
3603
4573
|
safeValidateActionParameters,
|
|
3604
4574
|
shutdownCvm,
|
|
3605
4575
|
sortObject,
|
|
@@ -3609,7 +4579,9 @@ export {
|
|
|
3609
4579
|
updateCvmEnvs,
|
|
3610
4580
|
updateCvmResources,
|
|
3611
4581
|
updateCvmVisibility,
|
|
4582
|
+
updateDockerCompose,
|
|
3612
4583
|
updateOsImage,
|
|
4584
|
+
updatePreLaunchScript,
|
|
3613
4585
|
validateActionParameters,
|
|
3614
4586
|
validateNetworkPrerequisites,
|
|
3615
4587
|
verifyEnvEncryptPublicKey,
|