@phala/cloud 0.2.8 → 0.2.10
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/check_app_cvms_is_allowed.d.ts +315 -5
- package/dist/actions/apps/check_app_is_allowed.d.ts +2 -2
- package/dist/actions/apps/create_app_instance.d.ts +205 -0
- package/dist/actions/apps/get_app_attestation.d.ts +50 -0
- package/dist/actions/apps/get_app_device_allowlist.d.ts +274 -5
- package/dist/actions/apps/get_app_filter_options.d.ts +2 -2
- package/dist/actions/cvms/check_cvm_is_allowed.d.ts +133 -3
- package/dist/actions/cvms/commit_cvm_provision.d.ts +425 -148
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +328 -0
- package/dist/actions/cvms/get_prelaunch_script_upgrade_status.d.ts +93 -0
- package/dist/actions/cvms/provision_cvm.d.ts +243 -225
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +216 -0
- package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +123 -5
- package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +236 -7
- package/dist/actions/cvms/replicate_cvm.d.ts +4 -4
- package/dist/actions/cvms/restart_cvm.d.ts +4 -4
- package/dist/actions/cvms/shutdown_cvm.d.ts +4 -4
- package/dist/actions/cvms/start_cvm.d.ts +4 -4
- package/dist/actions/cvms/stop_cvm.d.ts +4 -4
- package/dist/actions/cvms/update_cvm_visibility.d.ts +2 -2
- package/dist/actions/cvms/upgrade_prelaunch_script.d.ts +319 -0
- package/dist/actions/get_cvm_create_resources.d.ts +2412 -0
- package/dist/actions/index.d.ts +4 -0
- package/dist/actions/workspaces/get_workspace.d.ts +2 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +18 -0
- package/dist/client.d.ts +5 -2
- package/dist/create-client.d.ts +48 -0
- package/dist/index.js +1648 -1208
- package/dist/index.mjs +1613 -1206
- package/dist/types/app_compose.d.ts +125 -0
- package/dist/types/app_info_v20251028.d.ts +8 -131
- package/dist/types/app_info_v20260121.d.ts +4500 -168
- package/dist/types/client.d.ts +2 -2
- package/dist/types/cvm_info.d.ts +533 -7
- package/dist/types/cvm_info_v20251028.d.ts +18 -18
- package/dist/types/cvm_info_v20260121.d.ts +1640 -89
- package/dist/types/version-mappings.d.ts +8 -8
- package/dist/utils/errors.d.ts +8 -1
- package/package.json +2 -2
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Upgrade a CVM's pre-launch script to the latest official version.
|
|
4
|
+
*
|
|
5
|
+
* Replaces the CVM's current pre-launch script with the latest official
|
|
6
|
+
* version maintained by Phala and triggers the standard update workflow.
|
|
7
|
+
* The official script content is held server-side; clients only need to
|
|
8
|
+
* call this endpoint with the CVM ID.
|
|
9
|
+
*
|
|
10
|
+
* For contract-owned KMS (ETHEREUM/BASE), the first call returns
|
|
11
|
+
* `precondition_required` with a compose hash to register on-chain. After
|
|
12
|
+
* registration, retry with `compose_hash` and `transaction_hash`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { createClient, upgradePreLaunchScript } from '@phala/cloud'
|
|
17
|
+
*
|
|
18
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
19
|
+
*
|
|
20
|
+
* // Phase 1: kick off the upgrade
|
|
21
|
+
* const result = await upgradePreLaunchScript(client, { id: 'cvm-123' })
|
|
22
|
+
*
|
|
23
|
+
* if (result.status === 'precondition_required') {
|
|
24
|
+
* // Register compose hash on-chain, then retry with the headers
|
|
25
|
+
* const txHash = await registerComposeHashOnChain(result.compose_hash, result.kms_info)
|
|
26
|
+
* await upgradePreLaunchScript(client, {
|
|
27
|
+
* id: 'cvm-123',
|
|
28
|
+
* compose_hash: result.compose_hash,
|
|
29
|
+
* transaction_hash: txHash,
|
|
30
|
+
* })
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const UpgradePreLaunchScriptRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
35
|
+
id: z.ZodOptional<z.ZodString>;
|
|
36
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
37
|
+
app_id: z.ZodOptional<z.ZodString>;
|
|
38
|
+
instance_id: z.ZodOptional<z.ZodString>;
|
|
39
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
40
|
+
} & {
|
|
41
|
+
compose_hash: z.ZodOptional<z.ZodString>;
|
|
42
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
name?: string | undefined;
|
|
45
|
+
id?: string | undefined;
|
|
46
|
+
app_id?: string | undefined;
|
|
47
|
+
instance_id?: string | undefined;
|
|
48
|
+
compose_hash?: string | undefined;
|
|
49
|
+
uuid?: string | undefined;
|
|
50
|
+
transaction_hash?: string | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
name?: string | undefined;
|
|
53
|
+
id?: string | undefined;
|
|
54
|
+
app_id?: string | undefined;
|
|
55
|
+
instance_id?: string | undefined;
|
|
56
|
+
compose_hash?: string | undefined;
|
|
57
|
+
uuid?: string | undefined;
|
|
58
|
+
transaction_hash?: string | undefined;
|
|
59
|
+
}>, any, any>, {
|
|
60
|
+
cvmId: any;
|
|
61
|
+
request: {
|
|
62
|
+
compose_hash: any;
|
|
63
|
+
transaction_hash: any;
|
|
64
|
+
};
|
|
65
|
+
_raw: any;
|
|
66
|
+
}, any>;
|
|
67
|
+
declare const UpgradePreLaunchScriptInProgressSchema: z.ZodObject<{
|
|
68
|
+
status: z.ZodLiteral<"in_progress">;
|
|
69
|
+
message: z.ZodString;
|
|
70
|
+
correlation_id: z.ZodString;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
status: "in_progress";
|
|
73
|
+
message: string;
|
|
74
|
+
correlation_id: string;
|
|
75
|
+
}, {
|
|
76
|
+
status: "in_progress";
|
|
77
|
+
message: string;
|
|
78
|
+
correlation_id: string;
|
|
79
|
+
}>;
|
|
80
|
+
declare const UpgradePreLaunchScriptPreconditionRequiredSchema: z.ZodObject<{
|
|
81
|
+
status: z.ZodLiteral<"precondition_required">;
|
|
82
|
+
message: z.ZodString;
|
|
83
|
+
compose_hash: z.ZodString;
|
|
84
|
+
app_id: z.ZodString;
|
|
85
|
+
device_id: z.ZodString;
|
|
86
|
+
kms_info: z.ZodEffects<z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
89
|
+
url: z.ZodString;
|
|
90
|
+
version: z.ZodString;
|
|
91
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
92
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
93
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
94
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
97
|
+
url: z.ZodString;
|
|
98
|
+
version: z.ZodString;
|
|
99
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
100
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
101
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
102
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
103
|
+
id: z.ZodString;
|
|
104
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
105
|
+
url: z.ZodString;
|
|
106
|
+
version: z.ZodString;
|
|
107
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
108
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
109
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
110
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
113
|
+
url: z.ZodString;
|
|
114
|
+
version: z.ZodString;
|
|
115
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
116
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
117
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
118
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
121
|
+
url: z.ZodString;
|
|
122
|
+
version: z.ZodString;
|
|
123
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
124
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
125
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
126
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
status: "precondition_required";
|
|
129
|
+
message: string;
|
|
130
|
+
app_id: string;
|
|
131
|
+
kms_info: {
|
|
132
|
+
version: string;
|
|
133
|
+
id: string;
|
|
134
|
+
slug: string | null;
|
|
135
|
+
url: string;
|
|
136
|
+
chain_id: number | null;
|
|
137
|
+
kms_contract_address: `0x${string}`;
|
|
138
|
+
gateway_app_id: `0x${string}`;
|
|
139
|
+
} & {
|
|
140
|
+
[k: string]: unknown;
|
|
141
|
+
};
|
|
142
|
+
device_id: string;
|
|
143
|
+
compose_hash: string;
|
|
144
|
+
}, {
|
|
145
|
+
status: "precondition_required";
|
|
146
|
+
message: string;
|
|
147
|
+
app_id: string;
|
|
148
|
+
kms_info: {
|
|
149
|
+
version: string;
|
|
150
|
+
id: string;
|
|
151
|
+
slug: string | null;
|
|
152
|
+
url: string;
|
|
153
|
+
chain_id: number | null;
|
|
154
|
+
kms_contract_address: string | null;
|
|
155
|
+
gateway_app_id: string | null;
|
|
156
|
+
} & {
|
|
157
|
+
[k: string]: unknown;
|
|
158
|
+
};
|
|
159
|
+
device_id: string;
|
|
160
|
+
compose_hash: string;
|
|
161
|
+
}>;
|
|
162
|
+
export declare const UpgradePreLaunchScriptResultSchema: z.ZodUnion<[z.ZodObject<{
|
|
163
|
+
status: z.ZodLiteral<"in_progress">;
|
|
164
|
+
message: z.ZodString;
|
|
165
|
+
correlation_id: z.ZodString;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
status: "in_progress";
|
|
168
|
+
message: string;
|
|
169
|
+
correlation_id: string;
|
|
170
|
+
}, {
|
|
171
|
+
status: "in_progress";
|
|
172
|
+
message: string;
|
|
173
|
+
correlation_id: string;
|
|
174
|
+
}>, z.ZodObject<{
|
|
175
|
+
status: z.ZodLiteral<"precondition_required">;
|
|
176
|
+
message: z.ZodString;
|
|
177
|
+
compose_hash: z.ZodString;
|
|
178
|
+
app_id: z.ZodString;
|
|
179
|
+
device_id: z.ZodString;
|
|
180
|
+
kms_info: z.ZodEffects<z.ZodObject<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
183
|
+
url: z.ZodString;
|
|
184
|
+
version: z.ZodString;
|
|
185
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
186
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
187
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
188
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
191
|
+
url: z.ZodString;
|
|
192
|
+
version: z.ZodString;
|
|
193
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
194
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
195
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
196
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
199
|
+
url: z.ZodString;
|
|
200
|
+
version: z.ZodString;
|
|
201
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
202
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
203
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
204
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
205
|
+
id: z.ZodString;
|
|
206
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
207
|
+
url: z.ZodString;
|
|
208
|
+
version: z.ZodString;
|
|
209
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
210
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
211
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
212
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
215
|
+
url: z.ZodString;
|
|
216
|
+
version: z.ZodString;
|
|
217
|
+
chain_id: z.ZodNullable<z.ZodNumber>;
|
|
218
|
+
kms_contract_address: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
219
|
+
gateway_app_id: z.ZodEffects<z.ZodNullable<z.ZodString>, `0x${string}`, string | null>;
|
|
220
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
status: "precondition_required";
|
|
223
|
+
message: string;
|
|
224
|
+
app_id: string;
|
|
225
|
+
kms_info: {
|
|
226
|
+
version: string;
|
|
227
|
+
id: string;
|
|
228
|
+
slug: string | null;
|
|
229
|
+
url: string;
|
|
230
|
+
chain_id: number | null;
|
|
231
|
+
kms_contract_address: `0x${string}`;
|
|
232
|
+
gateway_app_id: `0x${string}`;
|
|
233
|
+
} & {
|
|
234
|
+
[k: string]: unknown;
|
|
235
|
+
};
|
|
236
|
+
device_id: string;
|
|
237
|
+
compose_hash: string;
|
|
238
|
+
}, {
|
|
239
|
+
status: "precondition_required";
|
|
240
|
+
message: string;
|
|
241
|
+
app_id: string;
|
|
242
|
+
kms_info: {
|
|
243
|
+
version: string;
|
|
244
|
+
id: string;
|
|
245
|
+
slug: string | null;
|
|
246
|
+
url: string;
|
|
247
|
+
chain_id: number | null;
|
|
248
|
+
kms_contract_address: string | null;
|
|
249
|
+
gateway_app_id: string | null;
|
|
250
|
+
} & {
|
|
251
|
+
[k: string]: unknown;
|
|
252
|
+
};
|
|
253
|
+
device_id: string;
|
|
254
|
+
compose_hash: string;
|
|
255
|
+
}>]>;
|
|
256
|
+
export type UpgradePreLaunchScriptRequest = z.input<typeof UpgradePreLaunchScriptRequestSchema>;
|
|
257
|
+
export type UpgradePreLaunchScriptResult = z.infer<typeof UpgradePreLaunchScriptResultSchema>;
|
|
258
|
+
export type UpgradePreLaunchScriptInProgress = z.infer<typeof UpgradePreLaunchScriptInProgressSchema>;
|
|
259
|
+
export type UpgradePreLaunchScriptPreconditionRequired = z.infer<typeof UpgradePreLaunchScriptPreconditionRequiredSchema>;
|
|
260
|
+
declare const upgradePreLaunchScript: {
|
|
261
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: any): Promise<{
|
|
262
|
+
status: "in_progress";
|
|
263
|
+
message: string;
|
|
264
|
+
correlation_id: string;
|
|
265
|
+
} | {
|
|
266
|
+
status: "precondition_required";
|
|
267
|
+
message: string;
|
|
268
|
+
app_id: string;
|
|
269
|
+
kms_info: {
|
|
270
|
+
version: string;
|
|
271
|
+
id: string;
|
|
272
|
+
slug: string | null;
|
|
273
|
+
url: string;
|
|
274
|
+
chain_id: number | null;
|
|
275
|
+
kms_contract_address: `0x${string}`;
|
|
276
|
+
gateway_app_id: `0x${string}`;
|
|
277
|
+
} & {
|
|
278
|
+
[k: string]: unknown;
|
|
279
|
+
};
|
|
280
|
+
device_id: string;
|
|
281
|
+
compose_hash: string;
|
|
282
|
+
}>;
|
|
283
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: any, parameters?: {
|
|
284
|
+
schema: T;
|
|
285
|
+
} | undefined): Promise<z.TypeOf<T>>;
|
|
286
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: any, parameters?: {
|
|
287
|
+
schema: false;
|
|
288
|
+
} | undefined): Promise<unknown>;
|
|
289
|
+
}, safeUpgradePreLaunchScript: {
|
|
290
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: any): Promise<import("../..").SafeResult<{
|
|
291
|
+
status: "in_progress";
|
|
292
|
+
message: string;
|
|
293
|
+
correlation_id: string;
|
|
294
|
+
} | {
|
|
295
|
+
status: "precondition_required";
|
|
296
|
+
message: string;
|
|
297
|
+
app_id: string;
|
|
298
|
+
kms_info: {
|
|
299
|
+
version: string;
|
|
300
|
+
id: string;
|
|
301
|
+
slug: string | null;
|
|
302
|
+
url: string;
|
|
303
|
+
chain_id: number | null;
|
|
304
|
+
kms_contract_address: `0x${string}`;
|
|
305
|
+
gateway_app_id: `0x${string}`;
|
|
306
|
+
} & {
|
|
307
|
+
[k: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
device_id: string;
|
|
310
|
+
compose_hash: string;
|
|
311
|
+
}>>;
|
|
312
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: any, parameters?: {
|
|
313
|
+
schema: T;
|
|
314
|
+
} | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
315
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: any, parameters?: {
|
|
316
|
+
schema: false;
|
|
317
|
+
} | undefined): Promise<import("../..").SafeResult<unknown>>;
|
|
318
|
+
};
|
|
319
|
+
export { upgradePreLaunchScript, safeUpgradePreLaunchScript };
|