@phala/cloud 0.2.8 → 0.2.9
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/dist/actions/apps/create_app_instance.d.ts +196 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/index.js +94 -70
- package/dist/index.mjs +91 -70
- package/package.json +1 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Create a new instance under an existing app
|
|
4
|
+
*
|
|
5
|
+
* Deploy a new CVM instance under an existing app, optionally with a new
|
|
6
|
+
* Docker Compose file. For on-chain KMS apps, this uses a two-phase flow:
|
|
7
|
+
* the first request returns HTTP 465 with a commit token; after registering
|
|
8
|
+
* the compose hash on-chain, the second request commits with the token and
|
|
9
|
+
* transaction hash.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { createClient, createAppInstance } from '@phala/cloud'
|
|
14
|
+
*
|
|
15
|
+
* const client = createClient();
|
|
16
|
+
*
|
|
17
|
+
* // Create instance with existing compose
|
|
18
|
+
* const instance = await createAppInstance(client, {
|
|
19
|
+
* appId: '50b0e827cc6c53f4010b57e588a18c5ef9388cc1',
|
|
20
|
+
* node_id: 5,
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Create instance with new Docker Compose
|
|
24
|
+
* const instance2 = await createAppInstance(client, {
|
|
25
|
+
* appId: '50b0e827cc6c53f4010b57e588a18c5ef9388cc1',
|
|
26
|
+
* docker_compose_file: 'services:\n app:\n image: nginx',
|
|
27
|
+
* node_id: 5,
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* ## Safe Version
|
|
32
|
+
*
|
|
33
|
+
* Use `safeCreateAppInstance` for error handling without exceptions:
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const result = await safeCreateAppInstance(client, { appId: 'my-app-id' });
|
|
37
|
+
* if (result.success) {
|
|
38
|
+
* console.log('Instance created:', result.data.vm_uuid);
|
|
39
|
+
* } else {
|
|
40
|
+
* console.error('Failed:', result.error.message);
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const CreateAppInstanceRequestSchema: z.ZodObject<{
|
|
45
|
+
appId: z.ZodString;
|
|
46
|
+
node_id: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
docker_compose_file: z.ZodOptional<z.ZodString>;
|
|
48
|
+
pre_launch_script: z.ZodOptional<z.ZodString>;
|
|
49
|
+
encrypted_env: z.ZodOptional<z.ZodString>;
|
|
50
|
+
compose_hash: z.ZodOptional<z.ZodString>;
|
|
51
|
+
token: z.ZodOptional<z.ZodString>;
|
|
52
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, "strict", z.ZodTypeAny, {
|
|
54
|
+
appId: string;
|
|
55
|
+
compose_hash?: string | undefined;
|
|
56
|
+
node_id?: number | undefined;
|
|
57
|
+
docker_compose_file?: string | undefined;
|
|
58
|
+
pre_launch_script?: string | undefined;
|
|
59
|
+
encrypted_env?: string | undefined;
|
|
60
|
+
transaction_hash?: string | undefined;
|
|
61
|
+
token?: string | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
appId: string;
|
|
64
|
+
compose_hash?: string | undefined;
|
|
65
|
+
node_id?: number | undefined;
|
|
66
|
+
docker_compose_file?: string | undefined;
|
|
67
|
+
pre_launch_script?: string | undefined;
|
|
68
|
+
encrypted_env?: string | undefined;
|
|
69
|
+
transaction_hash?: string | undefined;
|
|
70
|
+
token?: string | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type CreateAppInstanceRequest = z.infer<typeof CreateAppInstanceRequestSchema>;
|
|
73
|
+
declare const createAppInstance: {
|
|
74
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
75
|
+
appId: string;
|
|
76
|
+
compose_hash?: string | undefined;
|
|
77
|
+
node_id?: number | undefined;
|
|
78
|
+
docker_compose_file?: string | undefined;
|
|
79
|
+
pre_launch_script?: string | undefined;
|
|
80
|
+
encrypted_env?: string | undefined;
|
|
81
|
+
transaction_hash?: string | undefined;
|
|
82
|
+
token?: string | undefined;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
status: string;
|
|
85
|
+
name: string;
|
|
86
|
+
id: number;
|
|
87
|
+
app_id: string;
|
|
88
|
+
instance_id: string | null;
|
|
89
|
+
vcpu: number;
|
|
90
|
+
memory: number;
|
|
91
|
+
disk_size: number;
|
|
92
|
+
teepod_id: number;
|
|
93
|
+
vm_uuid: string | null;
|
|
94
|
+
encrypted_env_pubkey: string | null;
|
|
95
|
+
created_at: string;
|
|
96
|
+
version?: string | null | undefined;
|
|
97
|
+
app_url?: string | null | undefined;
|
|
98
|
+
teepod?: {
|
|
99
|
+
name: string;
|
|
100
|
+
id: number;
|
|
101
|
+
region_identifier?: string | null | undefined;
|
|
102
|
+
} | null | undefined;
|
|
103
|
+
base_image?: string | null | undefined;
|
|
104
|
+
user_id?: number | null | undefined;
|
|
105
|
+
docker_compose_file?: string | null | undefined;
|
|
106
|
+
features?: string[] | null | undefined;
|
|
107
|
+
manifest_version?: number | null | undefined;
|
|
108
|
+
runner?: string | null | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
111
|
+
appId: string;
|
|
112
|
+
compose_hash?: string | undefined;
|
|
113
|
+
node_id?: number | undefined;
|
|
114
|
+
docker_compose_file?: string | undefined;
|
|
115
|
+
pre_launch_script?: string | undefined;
|
|
116
|
+
encrypted_env?: string | undefined;
|
|
117
|
+
transaction_hash?: string | undefined;
|
|
118
|
+
token?: string | undefined;
|
|
119
|
+
}, parameters: {
|
|
120
|
+
schema: T;
|
|
121
|
+
}): Promise<z.TypeOf<T>>;
|
|
122
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
123
|
+
appId: string;
|
|
124
|
+
compose_hash?: string | undefined;
|
|
125
|
+
node_id?: number | undefined;
|
|
126
|
+
docker_compose_file?: string | undefined;
|
|
127
|
+
pre_launch_script?: string | undefined;
|
|
128
|
+
encrypted_env?: string | undefined;
|
|
129
|
+
transaction_hash?: string | undefined;
|
|
130
|
+
token?: string | undefined;
|
|
131
|
+
}, parameters: {
|
|
132
|
+
schema: false;
|
|
133
|
+
}): Promise<unknown>;
|
|
134
|
+
}, safeCreateAppInstance: {
|
|
135
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
136
|
+
appId: string;
|
|
137
|
+
compose_hash?: string | undefined;
|
|
138
|
+
node_id?: number | undefined;
|
|
139
|
+
docker_compose_file?: string | undefined;
|
|
140
|
+
pre_launch_script?: string | undefined;
|
|
141
|
+
encrypted_env?: string | undefined;
|
|
142
|
+
transaction_hash?: string | undefined;
|
|
143
|
+
token?: string | undefined;
|
|
144
|
+
}): Promise<import("../..").SafeResult<{
|
|
145
|
+
status: string;
|
|
146
|
+
name: string;
|
|
147
|
+
id: number;
|
|
148
|
+
app_id: string;
|
|
149
|
+
instance_id: string | null;
|
|
150
|
+
vcpu: number;
|
|
151
|
+
memory: number;
|
|
152
|
+
disk_size: number;
|
|
153
|
+
teepod_id: number;
|
|
154
|
+
vm_uuid: string | null;
|
|
155
|
+
encrypted_env_pubkey: string | null;
|
|
156
|
+
created_at: string;
|
|
157
|
+
version?: string | null | undefined;
|
|
158
|
+
app_url?: string | null | undefined;
|
|
159
|
+
teepod?: {
|
|
160
|
+
name: string;
|
|
161
|
+
id: number;
|
|
162
|
+
region_identifier?: string | null | undefined;
|
|
163
|
+
} | null | undefined;
|
|
164
|
+
base_image?: string | null | undefined;
|
|
165
|
+
user_id?: number | null | undefined;
|
|
166
|
+
docker_compose_file?: string | null | undefined;
|
|
167
|
+
features?: string[] | null | undefined;
|
|
168
|
+
manifest_version?: number | null | undefined;
|
|
169
|
+
runner?: string | null | undefined;
|
|
170
|
+
}>>;
|
|
171
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
172
|
+
appId: string;
|
|
173
|
+
compose_hash?: string | undefined;
|
|
174
|
+
node_id?: number | undefined;
|
|
175
|
+
docker_compose_file?: string | undefined;
|
|
176
|
+
pre_launch_script?: string | undefined;
|
|
177
|
+
encrypted_env?: string | undefined;
|
|
178
|
+
transaction_hash?: string | undefined;
|
|
179
|
+
token?: string | undefined;
|
|
180
|
+
}, parameters: {
|
|
181
|
+
schema: T;
|
|
182
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
183
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
184
|
+
appId: string;
|
|
185
|
+
compose_hash?: string | undefined;
|
|
186
|
+
node_id?: number | undefined;
|
|
187
|
+
docker_compose_file?: string | undefined;
|
|
188
|
+
pre_launch_script?: string | undefined;
|
|
189
|
+
encrypted_env?: string | undefined;
|
|
190
|
+
transaction_hash?: string | undefined;
|
|
191
|
+
token?: string | undefined;
|
|
192
|
+
}, parameters: {
|
|
193
|
+
schema: false;
|
|
194
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
195
|
+
};
|
|
196
|
+
export { createAppInstance, safeCreateAppInstance };
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export { checkAppCvmsIsAllowed, safeCheckAppCvmsIsAllowed, AppCvmsBatchIsAllowed
|
|
|
66
66
|
export { getAppList, safeGetAppList, GetAppListRequestSchema, type GetAppListRequest, } from "./apps/get_app_list";
|
|
67
67
|
export { getAppInfo, safeGetAppInfo, GetAppInfoRequestSchema, type GetAppInfoRequest, } from "./apps/get_app_info";
|
|
68
68
|
export { getAppCvms, safeGetAppCvms, GetAppCvmsRequestSchema, type GetAppCvmsRequest, } from "./apps/get_app_cvms";
|
|
69
|
+
export { createAppInstance, safeCreateAppInstance, CreateAppInstanceRequestSchema, type CreateAppInstanceRequest, } from "./apps/create_app_instance";
|
|
69
70
|
export { getAppDeviceAllowlist, safeGetAppDeviceAllowlist, GetAppDeviceAllowlistRequestSchema, type GetAppDeviceAllowlistRequest, type DeviceAllowlistResponse, type DeviceAllowlistItem, } from "./apps/get_app_device_allowlist";
|
|
70
71
|
export { getAppRevisions, safeGetAppRevisions, GetAppRevisionsRequestSchema, type GetAppRevisionsRequest, } from "./apps/get_app_revisions";
|
|
71
72
|
export { getAppRevisionDetail, safeGetAppRevisionDetail, GetAppRevisionDetailRequestSchema, type GetAppRevisionDetailRequest, } from "./apps/get_app_revision_detail";
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ __export(index_exports, {
|
|
|
59
59
|
CommitCvmProvisionSchema: () => CommitCvmProvisionSchema,
|
|
60
60
|
CommitCvmUpdateRequestSchema: () => CommitCvmUpdateRequestSchema,
|
|
61
61
|
ConfirmCvmPatchRequestSchema: () => ConfirmCvmPatchRequestSchema,
|
|
62
|
+
CreateAppInstanceRequestSchema: () => CreateAppInstanceRequestSchema,
|
|
62
63
|
CreateSshKeyRequestSchema: () => CreateSshKeyRequestSchema,
|
|
63
64
|
CreditsInfoSchema: () => CreditsInfoSchema,
|
|
64
65
|
CurrentUserSchema: () => CurrentUserV20251028Schema,
|
|
@@ -234,6 +235,7 @@ __export(index_exports, {
|
|
|
234
235
|
commitCvmUpdate: () => commitCvmUpdate,
|
|
235
236
|
confirmCvmPatch: () => confirmCvmPatch,
|
|
236
237
|
convertToHostname: () => convertToHostname,
|
|
238
|
+
createAppInstance: () => createAppInstance,
|
|
237
239
|
createBaseClient: () => createClient,
|
|
238
240
|
createClient: () => createClient2,
|
|
239
241
|
createClientsFromBrowser: () => createClientsFromBrowser,
|
|
@@ -328,6 +330,7 @@ __export(index_exports, {
|
|
|
328
330
|
safeCommitCvmProvision: () => safeCommitCvmProvision,
|
|
329
331
|
safeCommitCvmUpdate: () => safeCommitCvmUpdate,
|
|
330
332
|
safeConfirmCvmPatch: () => safeConfirmCvmPatch,
|
|
333
|
+
safeCreateAppInstance: () => safeCreateAppInstance,
|
|
331
334
|
safeCreateSshKey: () => safeCreateSshKey,
|
|
332
335
|
safeDeleteCvm: () => safeDeleteCvm,
|
|
333
336
|
safeDeleteSshKey: () => safeDeleteSshKey,
|
|
@@ -6067,24 +6070,42 @@ async function safeGetAppCvms(client, request) {
|
|
|
6067
6070
|
}
|
|
6068
6071
|
}
|
|
6069
6072
|
|
|
6070
|
-
// src/actions/apps/
|
|
6073
|
+
// src/actions/apps/create_app_instance.ts
|
|
6071
6074
|
var import_zod71 = require("zod");
|
|
6072
|
-
var
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
});
|
|
6086
|
-
|
|
6087
|
-
|
|
6075
|
+
var CreateAppInstanceRequestSchema = import_zod71.z.object({
|
|
6076
|
+
appId: import_zod71.z.string().min(1),
|
|
6077
|
+
node_id: import_zod71.z.number().optional(),
|
|
6078
|
+
docker_compose_file: import_zod71.z.string().optional(),
|
|
6079
|
+
pre_launch_script: import_zod71.z.string().optional(),
|
|
6080
|
+
encrypted_env: import_zod71.z.string().optional(),
|
|
6081
|
+
compose_hash: import_zod71.z.string().optional(),
|
|
6082
|
+
token: import_zod71.z.string().optional(),
|
|
6083
|
+
transaction_hash: import_zod71.z.string().optional()
|
|
6084
|
+
}).strict();
|
|
6085
|
+
var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAction(VMSchema, async (client, request) => {
|
|
6086
|
+
const parsed = CreateAppInstanceRequestSchema.parse(request);
|
|
6087
|
+
const { appId, ...body } = parsed;
|
|
6088
|
+
return await client.post(`/apps/${appId}/instances`, body);
|
|
6089
|
+
});
|
|
6090
|
+
|
|
6091
|
+
// src/actions/apps/get_app_device_allowlist.ts
|
|
6092
|
+
var import_zod72 = require("zod");
|
|
6093
|
+
var DeviceAllowlistItemSchema = import_zod72.z.object({
|
|
6094
|
+
device_id: import_zod72.z.string(),
|
|
6095
|
+
node_name: import_zod72.z.string().nullable(),
|
|
6096
|
+
cvm_ids: import_zod72.z.array(import_zod72.z.number()),
|
|
6097
|
+
allowed_onchain: import_zod72.z.boolean(),
|
|
6098
|
+
status: import_zod72.z.string()
|
|
6099
|
+
});
|
|
6100
|
+
var DeviceAllowlistResponseSchema = import_zod72.z.object({
|
|
6101
|
+
is_onchain_kms: import_zod72.z.boolean(),
|
|
6102
|
+
allow_any_device: import_zod72.z.boolean().nullable().optional(),
|
|
6103
|
+
chain_id: import_zod72.z.number().nullable().optional(),
|
|
6104
|
+
app_contract_address: import_zod72.z.string().nullable().optional(),
|
|
6105
|
+
devices: import_zod72.z.array(DeviceAllowlistItemSchema).optional().default([])
|
|
6106
|
+
});
|
|
6107
|
+
var GetAppDeviceAllowlistRequestSchema = import_zod72.z.object({
|
|
6108
|
+
appId: import_zod72.z.string().min(1)
|
|
6088
6109
|
}).strict();
|
|
6089
6110
|
async function getAppDeviceAllowlist(client, request) {
|
|
6090
6111
|
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
@@ -6110,11 +6131,11 @@ async function safeGetAppDeviceAllowlist(client, request) {
|
|
|
6110
6131
|
}
|
|
6111
6132
|
|
|
6112
6133
|
// src/actions/apps/get_app_revisions.ts
|
|
6113
|
-
var
|
|
6114
|
-
var GetAppRevisionsRequestSchema =
|
|
6115
|
-
appId:
|
|
6116
|
-
page:
|
|
6117
|
-
page_size:
|
|
6134
|
+
var import_zod73 = require("zod");
|
|
6135
|
+
var GetAppRevisionsRequestSchema = import_zod73.z.object({
|
|
6136
|
+
appId: import_zod73.z.string().min(1),
|
|
6137
|
+
page: import_zod73.z.number().int().min(1).optional(),
|
|
6138
|
+
page_size: import_zod73.z.number().int().min(1).max(1e3).optional()
|
|
6118
6139
|
}).strict();
|
|
6119
6140
|
async function getAppRevisions(client, request) {
|
|
6120
6141
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -6140,11 +6161,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
6140
6161
|
}
|
|
6141
6162
|
|
|
6142
6163
|
// src/actions/apps/get_app_revision_detail.ts
|
|
6143
|
-
var
|
|
6144
|
-
var GetAppRevisionDetailRequestSchema =
|
|
6145
|
-
appId:
|
|
6146
|
-
revisionId:
|
|
6147
|
-
rawComposeFile:
|
|
6164
|
+
var import_zod74 = require("zod");
|
|
6165
|
+
var GetAppRevisionDetailRequestSchema = import_zod74.z.object({
|
|
6166
|
+
appId: import_zod74.z.string().min(1),
|
|
6167
|
+
revisionId: import_zod74.z.string().min(1),
|
|
6168
|
+
rawComposeFile: import_zod74.z.boolean().optional()
|
|
6148
6169
|
}).strict();
|
|
6149
6170
|
async function getAppRevisionDetail(client, request) {
|
|
6150
6171
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -6171,15 +6192,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
6171
6192
|
}
|
|
6172
6193
|
|
|
6173
6194
|
// src/actions/apps/get_app_filter_options.ts
|
|
6174
|
-
var
|
|
6175
|
-
var AppFilterOptionsSchema =
|
|
6176
|
-
statuses:
|
|
6177
|
-
image_versions:
|
|
6178
|
-
instance_types:
|
|
6179
|
-
kms_slugs:
|
|
6180
|
-
kms_types:
|
|
6181
|
-
regions:
|
|
6182
|
-
nodes:
|
|
6195
|
+
var import_zod75 = require("zod");
|
|
6196
|
+
var AppFilterOptionsSchema = import_zod75.z.object({
|
|
6197
|
+
statuses: import_zod75.z.array(import_zod75.z.string()),
|
|
6198
|
+
image_versions: import_zod75.z.array(import_zod75.z.string()),
|
|
6199
|
+
instance_types: import_zod75.z.array(import_zod75.z.string()),
|
|
6200
|
+
kms_slugs: import_zod75.z.array(import_zod75.z.string()),
|
|
6201
|
+
kms_types: import_zod75.z.array(import_zod75.z.string()),
|
|
6202
|
+
regions: import_zod75.z.array(import_zod75.z.string()),
|
|
6203
|
+
nodes: import_zod75.z.array(import_zod75.z.string())
|
|
6183
6204
|
});
|
|
6184
6205
|
async function getAppFilterOptions(client) {
|
|
6185
6206
|
const response = await client.get("/apps/filter-options");
|
|
@@ -6204,47 +6225,47 @@ async function safeGetAppFilterOptions(client) {
|
|
|
6204
6225
|
}
|
|
6205
6226
|
|
|
6206
6227
|
// src/actions/apps/get_app_attestation.ts
|
|
6207
|
-
var
|
|
6208
|
-
var KmsInfoSchema2 =
|
|
6209
|
-
contract_address:
|
|
6210
|
-
chain_id:
|
|
6211
|
-
version:
|
|
6212
|
-
url:
|
|
6213
|
-
gateway_app_id:
|
|
6214
|
-
gateway_app_url:
|
|
6215
|
-
kms_type:
|
|
6216
|
-
});
|
|
6217
|
-
var GuestAgentInfoSchema =
|
|
6218
|
-
app_id:
|
|
6219
|
-
instance_id:
|
|
6220
|
-
app_name:
|
|
6221
|
-
device_id:
|
|
6228
|
+
var import_zod76 = require("zod");
|
|
6229
|
+
var KmsInfoSchema2 = import_zod76.z.object({
|
|
6230
|
+
contract_address: import_zod76.z.string(),
|
|
6231
|
+
chain_id: import_zod76.z.string().nullable(),
|
|
6232
|
+
version: import_zod76.z.string(),
|
|
6233
|
+
url: import_zod76.z.string(),
|
|
6234
|
+
gateway_app_id: import_zod76.z.string().nullable(),
|
|
6235
|
+
gateway_app_url: import_zod76.z.string(),
|
|
6236
|
+
kms_type: import_zod76.z.string()
|
|
6237
|
+
});
|
|
6238
|
+
var GuestAgentInfoSchema = import_zod76.z.object({
|
|
6239
|
+
app_id: import_zod76.z.string().optional(),
|
|
6240
|
+
instance_id: import_zod76.z.string().optional(),
|
|
6241
|
+
app_name: import_zod76.z.string().optional(),
|
|
6242
|
+
device_id: import_zod76.z.string().optional()
|
|
6222
6243
|
}).passthrough().nullable();
|
|
6223
|
-
var AppAttestationInstanceSchema =
|
|
6224
|
-
vm_uuid:
|
|
6225
|
-
name:
|
|
6226
|
-
instance_id:
|
|
6227
|
-
status:
|
|
6228
|
-
image_version:
|
|
6229
|
-
quote:
|
|
6230
|
-
ppid:
|
|
6231
|
-
device_id:
|
|
6244
|
+
var AppAttestationInstanceSchema = import_zod76.z.object({
|
|
6245
|
+
vm_uuid: import_zod76.z.string().nullable().optional(),
|
|
6246
|
+
name: import_zod76.z.string().optional(),
|
|
6247
|
+
instance_id: import_zod76.z.string().nullable().optional(),
|
|
6248
|
+
status: import_zod76.z.string().optional(),
|
|
6249
|
+
image_version: import_zod76.z.string().nullable().optional(),
|
|
6250
|
+
quote: import_zod76.z.string().nullable().optional(),
|
|
6251
|
+
ppid: import_zod76.z.string().optional(),
|
|
6252
|
+
device_id: import_zod76.z.string().optional(),
|
|
6232
6253
|
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
6233
|
-
app_certificates:
|
|
6234
|
-
compose_file:
|
|
6235
|
-
error:
|
|
6254
|
+
app_certificates: import_zod76.z.array(CertificateSchema).nullable().optional(),
|
|
6255
|
+
compose_file: import_zod76.z.string().nullable().optional(),
|
|
6256
|
+
error: import_zod76.z.string().nullable().optional()
|
|
6236
6257
|
});
|
|
6237
|
-
var AppAttestationResponseSchema =
|
|
6238
|
-
app_id:
|
|
6239
|
-
contract_address:
|
|
6258
|
+
var AppAttestationResponseSchema = import_zod76.z.object({
|
|
6259
|
+
app_id: import_zod76.z.string(),
|
|
6260
|
+
contract_address: import_zod76.z.string(),
|
|
6240
6261
|
kms_info: KmsInfoSchema2,
|
|
6241
|
-
instances:
|
|
6262
|
+
instances: import_zod76.z.array(AppAttestationInstanceSchema),
|
|
6242
6263
|
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
6243
6264
|
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
6244
|
-
qemu_version:
|
|
6265
|
+
qemu_version: import_zod76.z.string().nullable()
|
|
6245
6266
|
});
|
|
6246
|
-
var GetAppAttestationRequestSchema =
|
|
6247
|
-
appId:
|
|
6267
|
+
var GetAppAttestationRequestSchema = import_zod76.z.object({
|
|
6268
|
+
appId: import_zod76.z.string().min(1)
|
|
6248
6269
|
}).strict();
|
|
6249
6270
|
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
6250
6271
|
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
@@ -6317,6 +6338,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
6317
6338
|
CommitCvmProvisionSchema,
|
|
6318
6339
|
CommitCvmUpdateRequestSchema,
|
|
6319
6340
|
ConfirmCvmPatchRequestSchema,
|
|
6341
|
+
CreateAppInstanceRequestSchema,
|
|
6320
6342
|
CreateSshKeyRequestSchema,
|
|
6321
6343
|
CreditsInfoSchema,
|
|
6322
6344
|
CurrentUserSchema,
|
|
@@ -6492,6 +6514,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
6492
6514
|
commitCvmUpdate,
|
|
6493
6515
|
confirmCvmPatch,
|
|
6494
6516
|
convertToHostname,
|
|
6517
|
+
createAppInstance,
|
|
6495
6518
|
createBaseClient,
|
|
6496
6519
|
createClient,
|
|
6497
6520
|
createClientsFromBrowser,
|
|
@@ -6586,6 +6609,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
6586
6609
|
safeCommitCvmProvision,
|
|
6587
6610
|
safeCommitCvmUpdate,
|
|
6588
6611
|
safeConfirmCvmPatch,
|
|
6612
|
+
safeCreateAppInstance,
|
|
6589
6613
|
safeCreateSshKey,
|
|
6590
6614
|
safeDeleteCvm,
|
|
6591
6615
|
safeDeleteSshKey,
|
package/dist/index.mjs
CHANGED
|
@@ -5684,24 +5684,42 @@ async function safeGetAppCvms(client, request) {
|
|
|
5684
5684
|
}
|
|
5685
5685
|
}
|
|
5686
5686
|
|
|
5687
|
-
// src/actions/apps/
|
|
5687
|
+
// src/actions/apps/create_app_instance.ts
|
|
5688
5688
|
import { z as z71 } from "zod";
|
|
5689
|
-
var
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
});
|
|
5703
|
-
|
|
5704
|
-
|
|
5689
|
+
var CreateAppInstanceRequestSchema = z71.object({
|
|
5690
|
+
appId: z71.string().min(1),
|
|
5691
|
+
node_id: z71.number().optional(),
|
|
5692
|
+
docker_compose_file: z71.string().optional(),
|
|
5693
|
+
pre_launch_script: z71.string().optional(),
|
|
5694
|
+
encrypted_env: z71.string().optional(),
|
|
5695
|
+
compose_hash: z71.string().optional(),
|
|
5696
|
+
token: z71.string().optional(),
|
|
5697
|
+
transaction_hash: z71.string().optional()
|
|
5698
|
+
}).strict();
|
|
5699
|
+
var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAction(VMSchema, async (client, request) => {
|
|
5700
|
+
const parsed = CreateAppInstanceRequestSchema.parse(request);
|
|
5701
|
+
const { appId, ...body } = parsed;
|
|
5702
|
+
return await client.post(`/apps/${appId}/instances`, body);
|
|
5703
|
+
});
|
|
5704
|
+
|
|
5705
|
+
// src/actions/apps/get_app_device_allowlist.ts
|
|
5706
|
+
import { z as z72 } from "zod";
|
|
5707
|
+
var DeviceAllowlistItemSchema = z72.object({
|
|
5708
|
+
device_id: z72.string(),
|
|
5709
|
+
node_name: z72.string().nullable(),
|
|
5710
|
+
cvm_ids: z72.array(z72.number()),
|
|
5711
|
+
allowed_onchain: z72.boolean(),
|
|
5712
|
+
status: z72.string()
|
|
5713
|
+
});
|
|
5714
|
+
var DeviceAllowlistResponseSchema = z72.object({
|
|
5715
|
+
is_onchain_kms: z72.boolean(),
|
|
5716
|
+
allow_any_device: z72.boolean().nullable().optional(),
|
|
5717
|
+
chain_id: z72.number().nullable().optional(),
|
|
5718
|
+
app_contract_address: z72.string().nullable().optional(),
|
|
5719
|
+
devices: z72.array(DeviceAllowlistItemSchema).optional().default([])
|
|
5720
|
+
});
|
|
5721
|
+
var GetAppDeviceAllowlistRequestSchema = z72.object({
|
|
5722
|
+
appId: z72.string().min(1)
|
|
5705
5723
|
}).strict();
|
|
5706
5724
|
async function getAppDeviceAllowlist(client, request) {
|
|
5707
5725
|
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
@@ -5727,11 +5745,11 @@ async function safeGetAppDeviceAllowlist(client, request) {
|
|
|
5727
5745
|
}
|
|
5728
5746
|
|
|
5729
5747
|
// src/actions/apps/get_app_revisions.ts
|
|
5730
|
-
import { z as
|
|
5731
|
-
var GetAppRevisionsRequestSchema =
|
|
5732
|
-
appId:
|
|
5733
|
-
page:
|
|
5734
|
-
page_size:
|
|
5748
|
+
import { z as z73 } from "zod";
|
|
5749
|
+
var GetAppRevisionsRequestSchema = z73.object({
|
|
5750
|
+
appId: z73.string().min(1),
|
|
5751
|
+
page: z73.number().int().min(1).optional(),
|
|
5752
|
+
page_size: z73.number().int().min(1).max(1e3).optional()
|
|
5735
5753
|
}).strict();
|
|
5736
5754
|
async function getAppRevisions(client, request) {
|
|
5737
5755
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -5757,11 +5775,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
5757
5775
|
}
|
|
5758
5776
|
|
|
5759
5777
|
// src/actions/apps/get_app_revision_detail.ts
|
|
5760
|
-
import { z as
|
|
5761
|
-
var GetAppRevisionDetailRequestSchema =
|
|
5762
|
-
appId:
|
|
5763
|
-
revisionId:
|
|
5764
|
-
rawComposeFile:
|
|
5778
|
+
import { z as z74 } from "zod";
|
|
5779
|
+
var GetAppRevisionDetailRequestSchema = z74.object({
|
|
5780
|
+
appId: z74.string().min(1),
|
|
5781
|
+
revisionId: z74.string().min(1),
|
|
5782
|
+
rawComposeFile: z74.boolean().optional()
|
|
5765
5783
|
}).strict();
|
|
5766
5784
|
async function getAppRevisionDetail(client, request) {
|
|
5767
5785
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -5788,15 +5806,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
5788
5806
|
}
|
|
5789
5807
|
|
|
5790
5808
|
// src/actions/apps/get_app_filter_options.ts
|
|
5791
|
-
import { z as
|
|
5792
|
-
var AppFilterOptionsSchema =
|
|
5793
|
-
statuses:
|
|
5794
|
-
image_versions:
|
|
5795
|
-
instance_types:
|
|
5796
|
-
kms_slugs:
|
|
5797
|
-
kms_types:
|
|
5798
|
-
regions:
|
|
5799
|
-
nodes:
|
|
5809
|
+
import { z as z75 } from "zod";
|
|
5810
|
+
var AppFilterOptionsSchema = z75.object({
|
|
5811
|
+
statuses: z75.array(z75.string()),
|
|
5812
|
+
image_versions: z75.array(z75.string()),
|
|
5813
|
+
instance_types: z75.array(z75.string()),
|
|
5814
|
+
kms_slugs: z75.array(z75.string()),
|
|
5815
|
+
kms_types: z75.array(z75.string()),
|
|
5816
|
+
regions: z75.array(z75.string()),
|
|
5817
|
+
nodes: z75.array(z75.string())
|
|
5800
5818
|
});
|
|
5801
5819
|
async function getAppFilterOptions(client) {
|
|
5802
5820
|
const response = await client.get("/apps/filter-options");
|
|
@@ -5821,47 +5839,47 @@ async function safeGetAppFilterOptions(client) {
|
|
|
5821
5839
|
}
|
|
5822
5840
|
|
|
5823
5841
|
// src/actions/apps/get_app_attestation.ts
|
|
5824
|
-
import { z as
|
|
5825
|
-
var KmsInfoSchema2 =
|
|
5826
|
-
contract_address:
|
|
5827
|
-
chain_id:
|
|
5828
|
-
version:
|
|
5829
|
-
url:
|
|
5830
|
-
gateway_app_id:
|
|
5831
|
-
gateway_app_url:
|
|
5832
|
-
kms_type:
|
|
5833
|
-
});
|
|
5834
|
-
var GuestAgentInfoSchema =
|
|
5835
|
-
app_id:
|
|
5836
|
-
instance_id:
|
|
5837
|
-
app_name:
|
|
5838
|
-
device_id:
|
|
5842
|
+
import { z as z76 } from "zod";
|
|
5843
|
+
var KmsInfoSchema2 = z76.object({
|
|
5844
|
+
contract_address: z76.string(),
|
|
5845
|
+
chain_id: z76.string().nullable(),
|
|
5846
|
+
version: z76.string(),
|
|
5847
|
+
url: z76.string(),
|
|
5848
|
+
gateway_app_id: z76.string().nullable(),
|
|
5849
|
+
gateway_app_url: z76.string(),
|
|
5850
|
+
kms_type: z76.string()
|
|
5851
|
+
});
|
|
5852
|
+
var GuestAgentInfoSchema = z76.object({
|
|
5853
|
+
app_id: z76.string().optional(),
|
|
5854
|
+
instance_id: z76.string().optional(),
|
|
5855
|
+
app_name: z76.string().optional(),
|
|
5856
|
+
device_id: z76.string().optional()
|
|
5839
5857
|
}).passthrough().nullable();
|
|
5840
|
-
var AppAttestationInstanceSchema =
|
|
5841
|
-
vm_uuid:
|
|
5842
|
-
name:
|
|
5843
|
-
instance_id:
|
|
5844
|
-
status:
|
|
5845
|
-
image_version:
|
|
5846
|
-
quote:
|
|
5847
|
-
ppid:
|
|
5848
|
-
device_id:
|
|
5858
|
+
var AppAttestationInstanceSchema = z76.object({
|
|
5859
|
+
vm_uuid: z76.string().nullable().optional(),
|
|
5860
|
+
name: z76.string().optional(),
|
|
5861
|
+
instance_id: z76.string().nullable().optional(),
|
|
5862
|
+
status: z76.string().optional(),
|
|
5863
|
+
image_version: z76.string().nullable().optional(),
|
|
5864
|
+
quote: z76.string().nullable().optional(),
|
|
5865
|
+
ppid: z76.string().optional(),
|
|
5866
|
+
device_id: z76.string().optional(),
|
|
5849
5867
|
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
5850
|
-
app_certificates:
|
|
5851
|
-
compose_file:
|
|
5852
|
-
error:
|
|
5868
|
+
app_certificates: z76.array(CertificateSchema).nullable().optional(),
|
|
5869
|
+
compose_file: z76.string().nullable().optional(),
|
|
5870
|
+
error: z76.string().nullable().optional()
|
|
5853
5871
|
});
|
|
5854
|
-
var AppAttestationResponseSchema =
|
|
5855
|
-
app_id:
|
|
5856
|
-
contract_address:
|
|
5872
|
+
var AppAttestationResponseSchema = z76.object({
|
|
5873
|
+
app_id: z76.string(),
|
|
5874
|
+
contract_address: z76.string(),
|
|
5857
5875
|
kms_info: KmsInfoSchema2,
|
|
5858
|
-
instances:
|
|
5876
|
+
instances: z76.array(AppAttestationInstanceSchema),
|
|
5859
5877
|
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
5860
5878
|
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
5861
|
-
qemu_version:
|
|
5879
|
+
qemu_version: z76.string().nullable()
|
|
5862
5880
|
});
|
|
5863
|
-
var GetAppAttestationRequestSchema =
|
|
5864
|
-
appId:
|
|
5881
|
+
var GetAppAttestationRequestSchema = z76.object({
|
|
5882
|
+
appId: z76.string().min(1)
|
|
5865
5883
|
}).strict();
|
|
5866
5884
|
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
5867
5885
|
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
@@ -5935,6 +5953,7 @@ export {
|
|
|
5935
5953
|
CommitCvmProvisionSchema,
|
|
5936
5954
|
CommitCvmUpdateRequestSchema,
|
|
5937
5955
|
ConfirmCvmPatchRequestSchema,
|
|
5956
|
+
CreateAppInstanceRequestSchema,
|
|
5938
5957
|
CreateSshKeyRequestSchema,
|
|
5939
5958
|
CreditsInfoSchema,
|
|
5940
5959
|
CurrentUserV20251028Schema as CurrentUserSchema,
|
|
@@ -6110,6 +6129,7 @@ export {
|
|
|
6110
6129
|
commitCvmUpdate,
|
|
6111
6130
|
confirmCvmPatch,
|
|
6112
6131
|
convertToHostname,
|
|
6132
|
+
createAppInstance,
|
|
6113
6133
|
createClient as createBaseClient,
|
|
6114
6134
|
createClient2 as createClient,
|
|
6115
6135
|
createClientsFromBrowser,
|
|
@@ -6204,6 +6224,7 @@ export {
|
|
|
6204
6224
|
safeCommitCvmProvision,
|
|
6205
6225
|
safeCommitCvmUpdate,
|
|
6206
6226
|
safeConfirmCvmPatch,
|
|
6227
|
+
safeCreateAppInstance,
|
|
6207
6228
|
safeCreateSshKey,
|
|
6208
6229
|
safeDeleteCvm,
|
|
6209
6230
|
safeDeleteSshKey,
|