@phala/cloud 0.2.1 → 0.2.3
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/get_app_filter_options.d.ts +42 -0
- package/dist/actions/apps/get_app_list.d.ts +4 -4
- package/dist/actions/apps/get_app_revision_detail.d.ts +6 -6
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +66 -14
- package/dist/actions/cvms/get_cvm_containers_stats.d.ts +4 -4
- package/dist/actions/cvms/provision_cvm.d.ts +110 -10
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +66 -40
- package/dist/actions/cvms/restart_cvm.d.ts +2 -2
- package/dist/actions/cvms/shutdown_cvm.d.ts +2 -2
- package/dist/actions/cvms/start_cvm.d.ts +2 -2
- package/dist/actions/cvms/stop_cvm.d.ts +2 -2
- package/dist/actions/cvms/update_cvm_visibility.d.ts +3 -0
- package/dist/actions/index.d.ts +2 -1
- package/dist/actions/workspaces/get_workspace.d.ts +2 -0
- package/dist/actions/workspaces/get_workspace_nodes.d.ts +192 -145
- package/dist/actions/workspaces/list_workspaces.d.ts +18 -0
- package/dist/index.js +197 -110
- package/dist/index.mjs +189 -110
- package/dist/types/app_compose.d.ts +34 -1
- package/dist/types/app_info_v20251028.d.ts +113 -0
- package/dist/types/app_info_v20260121.d.ts +188 -0
- package/dist/types/app_revision.d.ts +11 -0
- package/dist/types/client.d.ts +1 -1
- package/dist/types/cvm_info.d.ts +2 -2
- package/dist/types/cvm_info_v20260121.d.ts +70 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -365,7 +365,7 @@ var Client = class _Client {
|
|
|
365
365
|
constructor(config = {}) {
|
|
366
366
|
this.emitter = mitt();
|
|
367
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.
|
|
368
|
+
const resolvedBaseURL = config.baseURL || process?.env?.PHALA_CLOUD_API_PREFIX || "https://cloud-api.phala.com/api/v1";
|
|
369
369
|
const version = config.version && SUPPORTED_API_VERSIONS.includes(config.version) ? config.version : DEFAULT_API_VERSION;
|
|
370
370
|
this.config = {
|
|
371
371
|
...config,
|
|
@@ -1065,6 +1065,7 @@ var WorkspaceResponseSchema = z7.object({
|
|
|
1065
1065
|
slug: z7.string().nullable(),
|
|
1066
1066
|
tier: z7.string(),
|
|
1067
1067
|
role: z7.string(),
|
|
1068
|
+
is_default: z7.boolean(),
|
|
1068
1069
|
created_at: z7.string()
|
|
1069
1070
|
}).passthrough();
|
|
1070
1071
|
var PaginationMetadataSchema = z7.object({
|
|
@@ -1237,7 +1238,9 @@ var CvmGatewayInfoV20260121Schema = z9.object({
|
|
|
1237
1238
|
base_domain: z9.string().nullable().optional(),
|
|
1238
1239
|
cname: z9.string().nullable().optional()
|
|
1239
1240
|
});
|
|
1240
|
-
var
|
|
1241
|
+
var NodeRefSchema = z9.object({
|
|
1242
|
+
object_type: z9.literal("node"),
|
|
1243
|
+
id: z9.number().int().nullable().optional(),
|
|
1241
1244
|
name: z9.string().nullable().optional(),
|
|
1242
1245
|
region: z9.string().nullable().optional(),
|
|
1243
1246
|
device_id: z9.string().nullable().optional(),
|
|
@@ -1245,6 +1248,7 @@ var CvmNodeInfoV20260121Schema = z9.object({
|
|
|
1245
1248
|
status: z9.string().nullable().optional(),
|
|
1246
1249
|
version: z9.string().nullable().optional()
|
|
1247
1250
|
});
|
|
1251
|
+
var CvmNodeInfoV20260121Schema = NodeRefSchema;
|
|
1248
1252
|
var CvmInfoV20260121Schema = z9.object({
|
|
1249
1253
|
id: z9.string(),
|
|
1250
1254
|
// hashed CvmId
|
|
@@ -1252,7 +1256,7 @@ var CvmInfoV20260121Schema = z9.object({
|
|
|
1252
1256
|
app_id: z9.string().nullable().optional(),
|
|
1253
1257
|
vm_uuid: z9.string().nullable().optional(),
|
|
1254
1258
|
resource: CvmResourceInfoV20260121Schema,
|
|
1255
|
-
node_info:
|
|
1259
|
+
node_info: NodeRefSchema.nullable().optional(),
|
|
1256
1260
|
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
1257
1261
|
kms_type: KmsTypeSchema.nullable().optional(),
|
|
1258
1262
|
kms_info: CvmKmsInfoV20260121Schema.nullable().optional(),
|
|
@@ -1462,20 +1466,56 @@ async function safeGetCvmList(client, request) {
|
|
|
1462
1466
|
}
|
|
1463
1467
|
|
|
1464
1468
|
// src/actions/cvms/provision_cvm.ts
|
|
1469
|
+
import { z as z13 } from "zod";
|
|
1470
|
+
|
|
1471
|
+
// src/types/app_compose.ts
|
|
1465
1472
|
import { z as z12 } from "zod";
|
|
1466
|
-
var
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1473
|
+
var MAX_COMPOSE_PAYLOAD_BYTES = 200 * 1024;
|
|
1474
|
+
function validateComposePayloadSize(dockerComposeFile, preLaunchScript, ctx) {
|
|
1475
|
+
const encoder = new TextEncoder();
|
|
1476
|
+
const composeSize = dockerComposeFile ? encoder.encode(dockerComposeFile).byteLength : 0;
|
|
1477
|
+
const scriptSize = preLaunchScript ? encoder.encode(preLaunchScript).byteLength : 0;
|
|
1478
|
+
const totalSize = composeSize + scriptSize;
|
|
1479
|
+
if (totalSize > MAX_COMPOSE_PAYLOAD_BYTES) {
|
|
1480
|
+
const maxKB = MAX_COMPOSE_PAYLOAD_BYTES / 1024;
|
|
1481
|
+
const currentKB = Math.ceil(totalSize / 1024);
|
|
1482
|
+
ctx.addIssue({
|
|
1483
|
+
code: z12.ZodIssueCode.custom,
|
|
1484
|
+
message: `Combined size of docker_compose_file and pre_launch_script must not exceed ${maxKB}KB (current: ${currentKB}KB)`
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
var LooseAppComposeSchema = z12.object({
|
|
1489
|
+
allowed_envs: z12.array(z12.string()).optional(),
|
|
1490
|
+
docker_compose_file: z12.string(),
|
|
1491
|
+
features: z12.array(z12.string()).optional(),
|
|
1492
|
+
name: z12.string().optional(),
|
|
1493
|
+
manifest_version: z12.number().optional(),
|
|
1494
|
+
kms_enabled: z12.boolean().optional(),
|
|
1495
|
+
public_logs: z12.boolean().optional(),
|
|
1496
|
+
public_sysinfo: z12.boolean().optional(),
|
|
1497
|
+
tproxy_enabled: z12.boolean().optional(),
|
|
1498
|
+
pre_launch_script: z12.string().optional(),
|
|
1499
|
+
env_pubkey: z12.string().optional(),
|
|
1500
|
+
salt: z12.string().optional().nullable()
|
|
1501
|
+
}).passthrough().superRefine((data, ctx) => {
|
|
1502
|
+
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
// src/actions/cvms/provision_cvm.ts
|
|
1506
|
+
var ProvisionCvmSchema = z13.object({
|
|
1507
|
+
app_id: z13.string().nullable().optional(),
|
|
1508
|
+
app_env_encrypt_pubkey: z13.string().nullable().optional(),
|
|
1509
|
+
compose_hash: z13.string(),
|
|
1470
1510
|
kms_info: KmsInfoSchema.nullable().optional(),
|
|
1471
|
-
fmspc:
|
|
1472
|
-
device_id:
|
|
1473
|
-
os_image_hash:
|
|
1474
|
-
instance_type:
|
|
1475
|
-
teepod_id:
|
|
1511
|
+
fmspc: z13.string().nullable().optional(),
|
|
1512
|
+
device_id: z13.string().nullable().optional(),
|
|
1513
|
+
os_image_hash: z13.string().nullable().optional(),
|
|
1514
|
+
instance_type: z13.string().nullable().optional(),
|
|
1515
|
+
teepod_id: z13.number().nullable().optional(),
|
|
1476
1516
|
// Will be transformed to node_id
|
|
1477
|
-
node_id:
|
|
1478
|
-
kms_id:
|
|
1517
|
+
node_id: z13.number().nullable().optional(),
|
|
1518
|
+
kms_id: z13.string().nullable().optional()
|
|
1479
1519
|
}).passthrough().transform((data) => {
|
|
1480
1520
|
if ("teepod_id" in data && data.teepod_id !== void 0) {
|
|
1481
1521
|
const { teepod_id, ...rest } = data;
|
|
@@ -1484,47 +1524,49 @@ var ProvisionCvmSchema = z12.object({
|
|
|
1484
1524
|
return data;
|
|
1485
1525
|
});
|
|
1486
1526
|
var NAME_VALIDATION_MESSAGE = "Name must be 5-63 characters, start with letter, and contain only letters/numbers/hyphens";
|
|
1487
|
-
var ProvisionCvmRequestSchema =
|
|
1488
|
-
node_id:
|
|
1527
|
+
var ProvisionCvmRequestSchema = z13.object({
|
|
1528
|
+
node_id: z13.number().optional(),
|
|
1489
1529
|
// recommended - optional, system auto-selects if not specified
|
|
1490
|
-
teepod_id:
|
|
1530
|
+
teepod_id: z13.number().optional(),
|
|
1491
1531
|
// deprecated, for compatibility
|
|
1492
|
-
region:
|
|
1532
|
+
region: z13.string().optional(),
|
|
1493
1533
|
// optional - region filter for auto-selection
|
|
1494
|
-
name:
|
|
1495
|
-
instance_type:
|
|
1534
|
+
name: z13.string().min(5, NAME_VALIDATION_MESSAGE).max(63, NAME_VALIDATION_MESSAGE).refine((val) => isValidHostname(val), NAME_VALIDATION_MESSAGE),
|
|
1535
|
+
instance_type: z13.string().optional(),
|
|
1496
1536
|
// optional, defaults to "tdx.small" when no resource params specified
|
|
1497
|
-
image:
|
|
1498
|
-
vcpu:
|
|
1537
|
+
image: z13.string().optional(),
|
|
1538
|
+
vcpu: z13.number().optional(),
|
|
1499
1539
|
// deprecated, use instance_type instead
|
|
1500
|
-
memory:
|
|
1540
|
+
memory: z13.number().optional(),
|
|
1501
1541
|
// deprecated, use instance_type instead
|
|
1502
|
-
disk_size:
|
|
1503
|
-
compose_file:
|
|
1504
|
-
allowed_envs:
|
|
1505
|
-
pre_launch_script:
|
|
1506
|
-
docker_compose_file:
|
|
1507
|
-
name:
|
|
1542
|
+
disk_size: z13.number().optional(),
|
|
1543
|
+
compose_file: z13.object({
|
|
1544
|
+
allowed_envs: z13.array(z13.string()).optional(),
|
|
1545
|
+
pre_launch_script: z13.string().optional(),
|
|
1546
|
+
docker_compose_file: z13.string().optional(),
|
|
1547
|
+
name: z13.string().optional().default(""),
|
|
1508
1548
|
// optional with default empty string
|
|
1509
|
-
kms_enabled:
|
|
1510
|
-
public_logs:
|
|
1511
|
-
public_sysinfo:
|
|
1512
|
-
gateway_enabled:
|
|
1549
|
+
kms_enabled: z13.boolean().optional(),
|
|
1550
|
+
public_logs: z13.boolean().optional(),
|
|
1551
|
+
public_sysinfo: z13.boolean().optional(),
|
|
1552
|
+
gateway_enabled: z13.boolean().optional(),
|
|
1513
1553
|
// recommended
|
|
1514
|
-
tproxy_enabled:
|
|
1554
|
+
tproxy_enabled: z13.boolean().optional()
|
|
1515
1555
|
// deprecated, for compatibility
|
|
1556
|
+
}).superRefine((data, ctx) => {
|
|
1557
|
+
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1516
1558
|
}),
|
|
1517
|
-
listed:
|
|
1518
|
-
kms_id:
|
|
1519
|
-
kms:
|
|
1559
|
+
listed: z13.boolean().optional(),
|
|
1560
|
+
kms_id: z13.string().optional(),
|
|
1561
|
+
kms: z13.enum(["PHALA", "ETHEREUM", "BASE"]).optional(),
|
|
1520
1562
|
// KMS type selection (defaults to PHALA)
|
|
1521
|
-
kms_contract:
|
|
1563
|
+
kms_contract: z13.string().optional(),
|
|
1522
1564
|
// KMS contract address for on-chain KMS
|
|
1523
|
-
env_keys:
|
|
1565
|
+
env_keys: z13.array(z13.string()).optional(),
|
|
1524
1566
|
// Manual nonce specification (Advanced - PHALA KMS only)
|
|
1525
|
-
nonce:
|
|
1567
|
+
nonce: z13.number().optional(),
|
|
1526
1568
|
// User-specified nonce for deterministic app_id generation
|
|
1527
|
-
app_id:
|
|
1569
|
+
app_id: z13.string().optional()
|
|
1528
1570
|
// Expected app_id (must match calculated app_id from nonce)
|
|
1529
1571
|
}).passthrough().transform((data) => {
|
|
1530
1572
|
if (!data.instance_type && !data.vcpu && !data.memory) {
|
|
@@ -1567,66 +1609,49 @@ var { action: provisionCvm, safeAction: safeProvisionCvm } = defineAction(Provis
|
|
|
1567
1609
|
});
|
|
1568
1610
|
|
|
1569
1611
|
// src/actions/cvms/commit_cvm_provision.ts
|
|
1570
|
-
import { z as
|
|
1571
|
-
var CommitCvmProvisionSchema =
|
|
1572
|
-
id:
|
|
1573
|
-
name:
|
|
1574
|
-
status:
|
|
1575
|
-
teepod_id:
|
|
1576
|
-
teepod:
|
|
1577
|
-
id:
|
|
1578
|
-
name:
|
|
1612
|
+
import { z as z14 } from "zod";
|
|
1613
|
+
var CommitCvmProvisionSchema = z14.object({
|
|
1614
|
+
id: z14.number(),
|
|
1615
|
+
name: z14.string(),
|
|
1616
|
+
status: z14.string(),
|
|
1617
|
+
teepod_id: z14.number(),
|
|
1618
|
+
teepod: z14.object({
|
|
1619
|
+
id: z14.number(),
|
|
1620
|
+
name: z14.string()
|
|
1579
1621
|
}).nullable(),
|
|
1580
|
-
user_id:
|
|
1581
|
-
app_id:
|
|
1582
|
-
vm_uuid:
|
|
1583
|
-
instance_id:
|
|
1622
|
+
user_id: z14.number().nullable(),
|
|
1623
|
+
app_id: z14.string().nullable(),
|
|
1624
|
+
vm_uuid: z14.string().nullable(),
|
|
1625
|
+
instance_id: z14.string().nullable(),
|
|
1584
1626
|
// Deprecated fields - will be removed in next API version
|
|
1585
|
-
app_url:
|
|
1586
|
-
base_image:
|
|
1587
|
-
vcpu:
|
|
1588
|
-
memory:
|
|
1589
|
-
disk_size:
|
|
1590
|
-
manifest_version:
|
|
1591
|
-
version:
|
|
1592
|
-
runner:
|
|
1593
|
-
docker_compose_file:
|
|
1594
|
-
features:
|
|
1595
|
-
created_at:
|
|
1596
|
-
encrypted_env_pubkey:
|
|
1597
|
-
app_auth_contract_address:
|
|
1598
|
-
deployer_address:
|
|
1627
|
+
app_url: z14.string().nullable().default(null),
|
|
1628
|
+
base_image: z14.string().nullable(),
|
|
1629
|
+
vcpu: z14.number(),
|
|
1630
|
+
memory: z14.number(),
|
|
1631
|
+
disk_size: z14.number(),
|
|
1632
|
+
manifest_version: z14.number().nullable().default(2),
|
|
1633
|
+
version: z14.string().nullable().default("1.0.0"),
|
|
1634
|
+
runner: z14.string().nullable().default("docker-compose"),
|
|
1635
|
+
docker_compose_file: z14.string().nullable(),
|
|
1636
|
+
features: z14.array(z14.string()).nullable().default(["kms", "tproxy-net"]),
|
|
1637
|
+
created_at: z14.string(),
|
|
1638
|
+
encrypted_env_pubkey: z14.string().nullable().optional(),
|
|
1639
|
+
app_auth_contract_address: z14.string().nullable().optional(),
|
|
1640
|
+
deployer_address: z14.string().nullable().optional()
|
|
1599
1641
|
}).passthrough();
|
|
1600
|
-
var CommitCvmProvisionRequestSchema =
|
|
1601
|
-
encrypted_env:
|
|
1602
|
-
app_id:
|
|
1603
|
-
compose_hash:
|
|
1604
|
-
kms_id:
|
|
1605
|
-
contract_address:
|
|
1606
|
-
deployer_address:
|
|
1607
|
-
env_keys:
|
|
1642
|
+
var CommitCvmProvisionRequestSchema = z14.object({
|
|
1643
|
+
encrypted_env: z14.string().optional().nullable(),
|
|
1644
|
+
app_id: z14.string(),
|
|
1645
|
+
compose_hash: z14.string(),
|
|
1646
|
+
kms_id: z14.string().optional(),
|
|
1647
|
+
contract_address: z14.string().optional(),
|
|
1648
|
+
deployer_address: z14.string().optional(),
|
|
1649
|
+
env_keys: z14.array(z14.string()).optional().nullable()
|
|
1608
1650
|
}).passthrough();
|
|
1609
1651
|
var { action: commitCvmProvision, safeAction: safeCommitCvmProvision } = defineAction(CommitCvmProvisionSchema, async (client, payload) => {
|
|
1610
1652
|
return await client.post("/cvms", payload);
|
|
1611
1653
|
});
|
|
1612
1654
|
|
|
1613
|
-
// src/types/app_compose.ts
|
|
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()
|
|
1628
|
-
}).passthrough();
|
|
1629
|
-
|
|
1630
1655
|
// src/utils/get_compose_hash.ts
|
|
1631
1656
|
import crypto from "crypto";
|
|
1632
1657
|
function sortObject(obj) {
|
|
@@ -2328,14 +2353,19 @@ import { z as z34 } from "zod";
|
|
|
2328
2353
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
2329
2354
|
CvmIdObjectSchema.extend({
|
|
2330
2355
|
public_sysinfo: z34.boolean(),
|
|
2331
|
-
public_logs: z34.boolean()
|
|
2356
|
+
public_logs: z34.boolean(),
|
|
2357
|
+
public_tcbinfo: z34.boolean().optional()
|
|
2332
2358
|
})
|
|
2333
2359
|
);
|
|
2334
2360
|
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmDetailV20251028Schema, async (client, request) => {
|
|
2335
2361
|
const parsed = UpdateCvmVisibilityRequestSchema.parse(request);
|
|
2336
2362
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2337
|
-
const { public_sysinfo, public_logs } = parsed;
|
|
2338
|
-
return await client.patch(`/cvms/${cvmId}/visibility`, {
|
|
2363
|
+
const { public_sysinfo, public_logs, public_tcbinfo } = parsed;
|
|
2364
|
+
return await client.patch(`/cvms/${cvmId}/visibility`, {
|
|
2365
|
+
public_sysinfo,
|
|
2366
|
+
public_logs,
|
|
2367
|
+
public_tcbinfo
|
|
2368
|
+
});
|
|
2339
2369
|
});
|
|
2340
2370
|
|
|
2341
2371
|
// src/actions/cvms/get_available_os_images.ts
|
|
@@ -2497,6 +2527,12 @@ var CvmBasicInfoV20251028Schema = z38.object({
|
|
|
2497
2527
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2498
2528
|
updated_at: z38.string().nullable().optional()
|
|
2499
2529
|
});
|
|
2530
|
+
var AppProfileSchema = z38.object({
|
|
2531
|
+
display_name: z38.string().nullable().optional(),
|
|
2532
|
+
avatar_url: z38.string().nullable().optional(),
|
|
2533
|
+
description: z38.string().nullable().optional(),
|
|
2534
|
+
custom_domain: z38.string().nullable().optional()
|
|
2535
|
+
});
|
|
2500
2536
|
var DstackAppFullResponseV20251028Schema = z38.object({
|
|
2501
2537
|
id: z38.string(),
|
|
2502
2538
|
name: z38.string(),
|
|
@@ -2505,6 +2541,7 @@ var DstackAppFullResponseV20251028Schema = z38.object({
|
|
|
2505
2541
|
app_icon_url: z38.string().nullable().optional(),
|
|
2506
2542
|
created_at: z38.string(),
|
|
2507
2543
|
kms_type: z38.string(),
|
|
2544
|
+
profile: AppProfileSchema.nullable().optional(),
|
|
2508
2545
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2509
2546
|
cvms: z38.array(CvmBasicInfoV20251028Schema).default([]),
|
|
2510
2547
|
cvm_count: z38.number().int().default(0)
|
|
@@ -2543,6 +2580,12 @@ var DstackAppFullResponseV20260121Schema = z39.object({
|
|
|
2543
2580
|
app_icon_url: z39.string().nullable().optional(),
|
|
2544
2581
|
created_at: z39.string(),
|
|
2545
2582
|
kms_type: z39.string(),
|
|
2583
|
+
profile: z39.object({
|
|
2584
|
+
display_name: z39.string().nullable().optional(),
|
|
2585
|
+
avatar_url: z39.string().nullable().optional(),
|
|
2586
|
+
description: z39.string().nullable().optional(),
|
|
2587
|
+
custom_domain: z39.string().nullable().optional()
|
|
2588
|
+
}).nullable().optional(),
|
|
2546
2589
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
2547
2590
|
cvms: z39.array(CvmInfoV20260121Schema).default([]),
|
|
2548
2591
|
cvm_count: z39.number().int().default(0)
|
|
@@ -2581,6 +2624,7 @@ var CvmRefSchema = z40.object({
|
|
|
2581
2624
|
vm_uuid: z40.string().nullable().optional()
|
|
2582
2625
|
});
|
|
2583
2626
|
var AppRevisionResponseSchema = z40.object({
|
|
2627
|
+
revision_id: z40.string(),
|
|
2584
2628
|
app_id: z40.string(),
|
|
2585
2629
|
vm_uuid: z40.string(),
|
|
2586
2630
|
compose_hash: z40.string(),
|
|
@@ -2592,6 +2636,7 @@ var AppRevisionResponseSchema = z40.object({
|
|
|
2592
2636
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2593
2637
|
});
|
|
2594
2638
|
var AppRevisionDetailResponseSchema = z40.object({
|
|
2639
|
+
revision_id: z40.string(),
|
|
2595
2640
|
app_id: z40.string(),
|
|
2596
2641
|
vm_uuid: z40.string(),
|
|
2597
2642
|
compose_hash: z40.string(),
|
|
@@ -3841,17 +3886,10 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
3841
3886
|
|
|
3842
3887
|
// src/actions/workspaces/get_workspace_nodes.ts
|
|
3843
3888
|
import { z as z43 } from "zod";
|
|
3844
|
-
var
|
|
3845
|
-
|
|
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();
|
|
3889
|
+
var NodeRefSchema2 = NodeRefSchema;
|
|
3890
|
+
var NodeInfoSchema = NodeRefSchema2;
|
|
3853
3891
|
var GetWorkspaceNodesSchema = z43.object({
|
|
3854
|
-
items: z43.array(
|
|
3892
|
+
items: z43.array(NodeRefSchema2),
|
|
3855
3893
|
total: z43.number(),
|
|
3856
3894
|
page: z43.number(),
|
|
3857
3895
|
page_size: z43.number(),
|
|
@@ -4123,7 +4161,7 @@ var GetAppListRequestSchema = z47.object({
|
|
|
4123
4161
|
instance_type: z47.string().optional(),
|
|
4124
4162
|
kms_slug: z47.string().optional(),
|
|
4125
4163
|
kms_type: z47.string().optional(),
|
|
4126
|
-
|
|
4164
|
+
node: z47.string().optional(),
|
|
4127
4165
|
region: z47.string().optional()
|
|
4128
4166
|
}).strict();
|
|
4129
4167
|
function getSchemaForVersion4(version) {
|
|
@@ -4251,13 +4289,13 @@ async function safeGetAppRevisions(client, request) {
|
|
|
4251
4289
|
import { z as z51 } from "zod";
|
|
4252
4290
|
var GetAppRevisionDetailRequestSchema = z51.object({
|
|
4253
4291
|
appId: z51.string().min(1),
|
|
4254
|
-
|
|
4292
|
+
revisionId: z51.string().min(1),
|
|
4255
4293
|
rawComposeFile: z51.boolean().optional()
|
|
4256
4294
|
}).strict();
|
|
4257
4295
|
async function getAppRevisionDetail(client, request) {
|
|
4258
|
-
const { appId,
|
|
4296
|
+
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
4259
4297
|
const params = rawComposeFile !== void 0 ? { raw_compose_file: rawComposeFile } : void 0;
|
|
4260
|
-
const response = await client.get(`/apps/${appId}/revisions/${
|
|
4298
|
+
const response = await client.get(`/apps/${appId}/revisions/${revisionId}`, { params });
|
|
4261
4299
|
return AppRevisionDetailResponseSchema.parse(response);
|
|
4262
4300
|
}
|
|
4263
4301
|
async function safeGetAppRevisionDetail(client, request) {
|
|
@@ -4278,6 +4316,39 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
4278
4316
|
}
|
|
4279
4317
|
}
|
|
4280
4318
|
|
|
4319
|
+
// src/actions/apps/get_app_filter_options.ts
|
|
4320
|
+
import { z as z52 } from "zod";
|
|
4321
|
+
var AppFilterOptionsSchema = z52.object({
|
|
4322
|
+
statuses: z52.array(z52.string()),
|
|
4323
|
+
image_versions: z52.array(z52.string()),
|
|
4324
|
+
instance_types: z52.array(z52.string()),
|
|
4325
|
+
kms_slugs: z52.array(z52.string()),
|
|
4326
|
+
kms_types: z52.array(z52.string()),
|
|
4327
|
+
regions: z52.array(z52.string()),
|
|
4328
|
+
nodes: z52.array(z52.string())
|
|
4329
|
+
});
|
|
4330
|
+
async function getAppFilterOptions(client) {
|
|
4331
|
+
const response = await client.get("/apps/filter-options");
|
|
4332
|
+
return AppFilterOptionsSchema.parse(response);
|
|
4333
|
+
}
|
|
4334
|
+
async function safeGetAppFilterOptions(client) {
|
|
4335
|
+
try {
|
|
4336
|
+
const data = await getAppFilterOptions(client);
|
|
4337
|
+
return { success: true, data };
|
|
4338
|
+
} catch (error) {
|
|
4339
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4340
|
+
return { success: false, error };
|
|
4341
|
+
}
|
|
4342
|
+
return {
|
|
4343
|
+
success: false,
|
|
4344
|
+
error: {
|
|
4345
|
+
name: "Error",
|
|
4346
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4347
|
+
}
|
|
4348
|
+
};
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4281
4352
|
// src/parse_dotenv.ts
|
|
4282
4353
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4283
4354
|
function parseEnv(input) {
|
|
@@ -4319,6 +4390,8 @@ export {
|
|
|
4319
4390
|
AddComposeHashSchema,
|
|
4320
4391
|
AllFamiliesResponseSchema,
|
|
4321
4392
|
ApiErrorSchema,
|
|
4393
|
+
AppFilterOptionsSchema,
|
|
4394
|
+
AppProfileSchema,
|
|
4322
4395
|
AppRevisionDetailResponseSchema,
|
|
4323
4396
|
AppRevisionResponseSchema,
|
|
4324
4397
|
AppRevisionsResponseSchema,
|
|
@@ -4402,6 +4475,8 @@ export {
|
|
|
4402
4475
|
KmsTypeSchema,
|
|
4403
4476
|
ListFamilyInstanceTypesRequestSchema,
|
|
4404
4477
|
ListWorkspacesSchema,
|
|
4478
|
+
LooseAppComposeSchema,
|
|
4479
|
+
MAX_COMPOSE_PAYLOAD_BYTES,
|
|
4405
4480
|
MachineInfoV20251028Schema,
|
|
4406
4481
|
ManagedUserV20251028Schema,
|
|
4407
4482
|
MaxRetriesExceededError,
|
|
@@ -4409,6 +4484,7 @@ export {
|
|
|
4409
4484
|
NextAppIdsRequestSchema,
|
|
4410
4485
|
NextAppIdsSchema,
|
|
4411
4486
|
NodeInfoSchema,
|
|
4487
|
+
NodeRefSchema,
|
|
4412
4488
|
OSImageVariantSchema,
|
|
4413
4489
|
PaginatedCvmInfosV20251028Schema,
|
|
4414
4490
|
PaginatedCvmInfosV20260121Schema,
|
|
@@ -4485,6 +4561,7 @@ export {
|
|
|
4485
4561
|
generateFallbackHostname,
|
|
4486
4562
|
getAppCvms,
|
|
4487
4563
|
getAppEnvEncryptPubKey,
|
|
4564
|
+
getAppFilterOptions,
|
|
4488
4565
|
getAppInfo,
|
|
4489
4566
|
getAppList,
|
|
4490
4567
|
getAppRevisionDetail,
|
|
@@ -4531,6 +4608,7 @@ export {
|
|
|
4531
4608
|
safeDeployAppAuth,
|
|
4532
4609
|
safeGetAppCvms,
|
|
4533
4610
|
safeGetAppEnvEncryptPubKey,
|
|
4611
|
+
safeGetAppFilterOptions,
|
|
4534
4612
|
safeGetAppInfo,
|
|
4535
4613
|
safeGetAppList,
|
|
4536
4614
|
safeGetAppRevisionDetail,
|
|
@@ -4583,6 +4661,7 @@ export {
|
|
|
4583
4661
|
updateOsImage,
|
|
4584
4662
|
updatePreLaunchScript,
|
|
4585
4663
|
validateActionParameters,
|
|
4664
|
+
validateComposePayloadSize,
|
|
4586
4665
|
validateNetworkPrerequisites,
|
|
4587
4666
|
verifyEnvEncryptPublicKey,
|
|
4588
4667
|
waitForTransactionReceipt,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
/** Maximum combined byte size of docker_compose_file + pre_launch_script (200KB) */
|
|
3
|
+
export declare const MAX_COMPOSE_PAYLOAD_BYTES: number;
|
|
4
|
+
/**
|
|
5
|
+
* Validate that combined byte size of docker_compose_file and pre_launch_script
|
|
6
|
+
* does not exceed MAX_COMPOSE_PAYLOAD_BYTES.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateComposePayloadSize(dockerComposeFile: string | undefined, preLaunchScript: string | undefined, ctx: z.RefinementCtx): void;
|
|
9
|
+
export declare const LooseAppComposeSchema: z.ZodEffects<z.ZodObject<{
|
|
3
10
|
allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4
11
|
docker_compose_file: z.ZodString;
|
|
5
12
|
features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -38,5 +45,31 @@ export declare const LooseAppComposeSchema: z.ZodObject<{
|
|
|
38
45
|
pre_launch_script: z.ZodOptional<z.ZodString>;
|
|
39
46
|
env_pubkey: z.ZodOptional<z.ZodString>;
|
|
40
47
|
salt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
48
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
49
|
+
allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
50
|
+
docker_compose_file: z.ZodString;
|
|
51
|
+
features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
52
|
+
name: z.ZodOptional<z.ZodString>;
|
|
53
|
+
manifest_version: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
kms_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
public_logs: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
public_sysinfo: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
pre_launch_script: z.ZodOptional<z.ZodString>;
|
|
59
|
+
env_pubkey: z.ZodOptional<z.ZodString>;
|
|
60
|
+
salt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
61
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
62
|
+
allowed_envs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
63
|
+
docker_compose_file: z.ZodString;
|
|
64
|
+
features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
65
|
+
name: z.ZodOptional<z.ZodString>;
|
|
66
|
+
manifest_version: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
kms_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
public_logs: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
public_sysinfo: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
tproxy_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
pre_launch_script: z.ZodOptional<z.ZodString>;
|
|
72
|
+
env_pubkey: z.ZodOptional<z.ZodString>;
|
|
73
|
+
salt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
41
74
|
}, z.ZodTypeAny, "passthrough">>;
|
|
42
75
|
export type LooseAppCompose = z.infer<typeof LooseAppComposeSchema>;
|