@phala/cloud 0.2.2 → 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 +1 -0
- package/dist/index.js +185 -97
- package/dist/index.mjs +178 -97
- 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 +96 -0
- package/dist/types/app_revision.d.ts +11 -0
- package/dist/types/cvm_info.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1466,20 +1466,56 @@ async function safeGetCvmList(client, request) {
|
|
|
1466
1466
|
}
|
|
1467
1467
|
|
|
1468
1468
|
// src/actions/cvms/provision_cvm.ts
|
|
1469
|
+
import { z as z13 } from "zod";
|
|
1470
|
+
|
|
1471
|
+
// src/types/app_compose.ts
|
|
1469
1472
|
import { z as z12 } from "zod";
|
|
1470
|
-
var
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
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(),
|
|
1474
1510
|
kms_info: KmsInfoSchema.nullable().optional(),
|
|
1475
|
-
fmspc:
|
|
1476
|
-
device_id:
|
|
1477
|
-
os_image_hash:
|
|
1478
|
-
instance_type:
|
|
1479
|
-
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(),
|
|
1480
1516
|
// Will be transformed to node_id
|
|
1481
|
-
node_id:
|
|
1482
|
-
kms_id:
|
|
1517
|
+
node_id: z13.number().nullable().optional(),
|
|
1518
|
+
kms_id: z13.string().nullable().optional()
|
|
1483
1519
|
}).passthrough().transform((data) => {
|
|
1484
1520
|
if ("teepod_id" in data && data.teepod_id !== void 0) {
|
|
1485
1521
|
const { teepod_id, ...rest } = data;
|
|
@@ -1488,47 +1524,49 @@ var ProvisionCvmSchema = z12.object({
|
|
|
1488
1524
|
return data;
|
|
1489
1525
|
});
|
|
1490
1526
|
var NAME_VALIDATION_MESSAGE = "Name must be 5-63 characters, start with letter, and contain only letters/numbers/hyphens";
|
|
1491
|
-
var ProvisionCvmRequestSchema =
|
|
1492
|
-
node_id:
|
|
1527
|
+
var ProvisionCvmRequestSchema = z13.object({
|
|
1528
|
+
node_id: z13.number().optional(),
|
|
1493
1529
|
// recommended - optional, system auto-selects if not specified
|
|
1494
|
-
teepod_id:
|
|
1530
|
+
teepod_id: z13.number().optional(),
|
|
1495
1531
|
// deprecated, for compatibility
|
|
1496
|
-
region:
|
|
1532
|
+
region: z13.string().optional(),
|
|
1497
1533
|
// optional - region filter for auto-selection
|
|
1498
|
-
name:
|
|
1499
|
-
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(),
|
|
1500
1536
|
// optional, defaults to "tdx.small" when no resource params specified
|
|
1501
|
-
image:
|
|
1502
|
-
vcpu:
|
|
1537
|
+
image: z13.string().optional(),
|
|
1538
|
+
vcpu: z13.number().optional(),
|
|
1503
1539
|
// deprecated, use instance_type instead
|
|
1504
|
-
memory:
|
|
1540
|
+
memory: z13.number().optional(),
|
|
1505
1541
|
// deprecated, use instance_type instead
|
|
1506
|
-
disk_size:
|
|
1507
|
-
compose_file:
|
|
1508
|
-
allowed_envs:
|
|
1509
|
-
pre_launch_script:
|
|
1510
|
-
docker_compose_file:
|
|
1511
|
-
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(""),
|
|
1512
1548
|
// optional with default empty string
|
|
1513
|
-
kms_enabled:
|
|
1514
|
-
public_logs:
|
|
1515
|
-
public_sysinfo:
|
|
1516
|
-
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(),
|
|
1517
1553
|
// recommended
|
|
1518
|
-
tproxy_enabled:
|
|
1554
|
+
tproxy_enabled: z13.boolean().optional()
|
|
1519
1555
|
// deprecated, for compatibility
|
|
1556
|
+
}).superRefine((data, ctx) => {
|
|
1557
|
+
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1520
1558
|
}),
|
|
1521
|
-
listed:
|
|
1522
|
-
kms_id:
|
|
1523
|
-
kms:
|
|
1559
|
+
listed: z13.boolean().optional(),
|
|
1560
|
+
kms_id: z13.string().optional(),
|
|
1561
|
+
kms: z13.enum(["PHALA", "ETHEREUM", "BASE"]).optional(),
|
|
1524
1562
|
// KMS type selection (defaults to PHALA)
|
|
1525
|
-
kms_contract:
|
|
1563
|
+
kms_contract: z13.string().optional(),
|
|
1526
1564
|
// KMS contract address for on-chain KMS
|
|
1527
|
-
env_keys:
|
|
1565
|
+
env_keys: z13.array(z13.string()).optional(),
|
|
1528
1566
|
// Manual nonce specification (Advanced - PHALA KMS only)
|
|
1529
|
-
nonce:
|
|
1567
|
+
nonce: z13.number().optional(),
|
|
1530
1568
|
// User-specified nonce for deterministic app_id generation
|
|
1531
|
-
app_id:
|
|
1569
|
+
app_id: z13.string().optional()
|
|
1532
1570
|
// Expected app_id (must match calculated app_id from nonce)
|
|
1533
1571
|
}).passthrough().transform((data) => {
|
|
1534
1572
|
if (!data.instance_type && !data.vcpu && !data.memory) {
|
|
@@ -1571,66 +1609,49 @@ var { action: provisionCvm, safeAction: safeProvisionCvm } = defineAction(Provis
|
|
|
1571
1609
|
});
|
|
1572
1610
|
|
|
1573
1611
|
// src/actions/cvms/commit_cvm_provision.ts
|
|
1574
|
-
import { z as
|
|
1575
|
-
var CommitCvmProvisionSchema =
|
|
1576
|
-
id:
|
|
1577
|
-
name:
|
|
1578
|
-
status:
|
|
1579
|
-
teepod_id:
|
|
1580
|
-
teepod:
|
|
1581
|
-
id:
|
|
1582
|
-
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()
|
|
1583
1621
|
}).nullable(),
|
|
1584
|
-
user_id:
|
|
1585
|
-
app_id:
|
|
1586
|
-
vm_uuid:
|
|
1587
|
-
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(),
|
|
1588
1626
|
// Deprecated fields - will be removed in next API version
|
|
1589
|
-
app_url:
|
|
1590
|
-
base_image:
|
|
1591
|
-
vcpu:
|
|
1592
|
-
memory:
|
|
1593
|
-
disk_size:
|
|
1594
|
-
manifest_version:
|
|
1595
|
-
version:
|
|
1596
|
-
runner:
|
|
1597
|
-
docker_compose_file:
|
|
1598
|
-
features:
|
|
1599
|
-
created_at:
|
|
1600
|
-
encrypted_env_pubkey:
|
|
1601
|
-
app_auth_contract_address:
|
|
1602
|
-
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()
|
|
1603
1641
|
}).passthrough();
|
|
1604
|
-
var CommitCvmProvisionRequestSchema =
|
|
1605
|
-
encrypted_env:
|
|
1606
|
-
app_id:
|
|
1607
|
-
compose_hash:
|
|
1608
|
-
kms_id:
|
|
1609
|
-
contract_address:
|
|
1610
|
-
deployer_address:
|
|
1611
|
-
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()
|
|
1612
1650
|
}).passthrough();
|
|
1613
1651
|
var { action: commitCvmProvision, safeAction: safeCommitCvmProvision } = defineAction(CommitCvmProvisionSchema, async (client, payload) => {
|
|
1614
1652
|
return await client.post("/cvms", payload);
|
|
1615
1653
|
});
|
|
1616
1654
|
|
|
1617
|
-
// src/types/app_compose.ts
|
|
1618
|
-
import { z as z14 } from "zod";
|
|
1619
|
-
var LooseAppComposeSchema = z14.object({
|
|
1620
|
-
allowed_envs: z14.array(z14.string()).optional(),
|
|
1621
|
-
docker_compose_file: z14.string(),
|
|
1622
|
-
features: z14.array(z14.string()).optional(),
|
|
1623
|
-
name: z14.string().optional(),
|
|
1624
|
-
manifest_version: z14.number().optional(),
|
|
1625
|
-
kms_enabled: z14.boolean().optional(),
|
|
1626
|
-
public_logs: z14.boolean().optional(),
|
|
1627
|
-
public_sysinfo: z14.boolean().optional(),
|
|
1628
|
-
tproxy_enabled: z14.boolean().optional(),
|
|
1629
|
-
pre_launch_script: z14.string().optional(),
|
|
1630
|
-
env_pubkey: z14.string().optional(),
|
|
1631
|
-
salt: z14.string().optional().nullable()
|
|
1632
|
-
}).passthrough();
|
|
1633
|
-
|
|
1634
1655
|
// src/utils/get_compose_hash.ts
|
|
1635
1656
|
import crypto from "crypto";
|
|
1636
1657
|
function sortObject(obj) {
|
|
@@ -2332,14 +2353,19 @@ import { z as z34 } from "zod";
|
|
|
2332
2353
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
2333
2354
|
CvmIdObjectSchema.extend({
|
|
2334
2355
|
public_sysinfo: z34.boolean(),
|
|
2335
|
-
public_logs: z34.boolean()
|
|
2356
|
+
public_logs: z34.boolean(),
|
|
2357
|
+
public_tcbinfo: z34.boolean().optional()
|
|
2336
2358
|
})
|
|
2337
2359
|
);
|
|
2338
2360
|
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmDetailV20251028Schema, async (client, request) => {
|
|
2339
2361
|
const parsed = UpdateCvmVisibilityRequestSchema.parse(request);
|
|
2340
2362
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2341
|
-
const { public_sysinfo, public_logs } = parsed;
|
|
2342
|
-
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
|
+
});
|
|
2343
2369
|
});
|
|
2344
2370
|
|
|
2345
2371
|
// src/actions/cvms/get_available_os_images.ts
|
|
@@ -2501,6 +2527,12 @@ var CvmBasicInfoV20251028Schema = z38.object({
|
|
|
2501
2527
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2502
2528
|
updated_at: z38.string().nullable().optional()
|
|
2503
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
|
+
});
|
|
2504
2536
|
var DstackAppFullResponseV20251028Schema = z38.object({
|
|
2505
2537
|
id: z38.string(),
|
|
2506
2538
|
name: z38.string(),
|
|
@@ -2509,6 +2541,7 @@ var DstackAppFullResponseV20251028Schema = z38.object({
|
|
|
2509
2541
|
app_icon_url: z38.string().nullable().optional(),
|
|
2510
2542
|
created_at: z38.string(),
|
|
2511
2543
|
kms_type: z38.string(),
|
|
2544
|
+
profile: AppProfileSchema.nullable().optional(),
|
|
2512
2545
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2513
2546
|
cvms: z38.array(CvmBasicInfoV20251028Schema).default([]),
|
|
2514
2547
|
cvm_count: z38.number().int().default(0)
|
|
@@ -2547,6 +2580,12 @@ var DstackAppFullResponseV20260121Schema = z39.object({
|
|
|
2547
2580
|
app_icon_url: z39.string().nullable().optional(),
|
|
2548
2581
|
created_at: z39.string(),
|
|
2549
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(),
|
|
2550
2589
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
2551
2590
|
cvms: z39.array(CvmInfoV20260121Schema).default([]),
|
|
2552
2591
|
cvm_count: z39.number().int().default(0)
|
|
@@ -2585,6 +2624,7 @@ var CvmRefSchema = z40.object({
|
|
|
2585
2624
|
vm_uuid: z40.string().nullable().optional()
|
|
2586
2625
|
});
|
|
2587
2626
|
var AppRevisionResponseSchema = z40.object({
|
|
2627
|
+
revision_id: z40.string(),
|
|
2588
2628
|
app_id: z40.string(),
|
|
2589
2629
|
vm_uuid: z40.string(),
|
|
2590
2630
|
compose_hash: z40.string(),
|
|
@@ -2596,6 +2636,7 @@ var AppRevisionResponseSchema = z40.object({
|
|
|
2596
2636
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2597
2637
|
});
|
|
2598
2638
|
var AppRevisionDetailResponseSchema = z40.object({
|
|
2639
|
+
revision_id: z40.string(),
|
|
2599
2640
|
app_id: z40.string(),
|
|
2600
2641
|
vm_uuid: z40.string(),
|
|
2601
2642
|
compose_hash: z40.string(),
|
|
@@ -4120,7 +4161,7 @@ var GetAppListRequestSchema = z47.object({
|
|
|
4120
4161
|
instance_type: z47.string().optional(),
|
|
4121
4162
|
kms_slug: z47.string().optional(),
|
|
4122
4163
|
kms_type: z47.string().optional(),
|
|
4123
|
-
|
|
4164
|
+
node: z47.string().optional(),
|
|
4124
4165
|
region: z47.string().optional()
|
|
4125
4166
|
}).strict();
|
|
4126
4167
|
function getSchemaForVersion4(version) {
|
|
@@ -4248,13 +4289,13 @@ async function safeGetAppRevisions(client, request) {
|
|
|
4248
4289
|
import { z as z51 } from "zod";
|
|
4249
4290
|
var GetAppRevisionDetailRequestSchema = z51.object({
|
|
4250
4291
|
appId: z51.string().min(1),
|
|
4251
|
-
|
|
4292
|
+
revisionId: z51.string().min(1),
|
|
4252
4293
|
rawComposeFile: z51.boolean().optional()
|
|
4253
4294
|
}).strict();
|
|
4254
4295
|
async function getAppRevisionDetail(client, request) {
|
|
4255
|
-
const { appId,
|
|
4296
|
+
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
4256
4297
|
const params = rawComposeFile !== void 0 ? { raw_compose_file: rawComposeFile } : void 0;
|
|
4257
|
-
const response = await client.get(`/apps/${appId}/revisions/${
|
|
4298
|
+
const response = await client.get(`/apps/${appId}/revisions/${revisionId}`, { params });
|
|
4258
4299
|
return AppRevisionDetailResponseSchema.parse(response);
|
|
4259
4300
|
}
|
|
4260
4301
|
async function safeGetAppRevisionDetail(client, request) {
|
|
@@ -4275,6 +4316,39 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
4275
4316
|
}
|
|
4276
4317
|
}
|
|
4277
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
|
+
|
|
4278
4352
|
// src/parse_dotenv.ts
|
|
4279
4353
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4280
4354
|
function parseEnv(input) {
|
|
@@ -4316,6 +4390,8 @@ export {
|
|
|
4316
4390
|
AddComposeHashSchema,
|
|
4317
4391
|
AllFamiliesResponseSchema,
|
|
4318
4392
|
ApiErrorSchema,
|
|
4393
|
+
AppFilterOptionsSchema,
|
|
4394
|
+
AppProfileSchema,
|
|
4319
4395
|
AppRevisionDetailResponseSchema,
|
|
4320
4396
|
AppRevisionResponseSchema,
|
|
4321
4397
|
AppRevisionsResponseSchema,
|
|
@@ -4399,6 +4475,8 @@ export {
|
|
|
4399
4475
|
KmsTypeSchema,
|
|
4400
4476
|
ListFamilyInstanceTypesRequestSchema,
|
|
4401
4477
|
ListWorkspacesSchema,
|
|
4478
|
+
LooseAppComposeSchema,
|
|
4479
|
+
MAX_COMPOSE_PAYLOAD_BYTES,
|
|
4402
4480
|
MachineInfoV20251028Schema,
|
|
4403
4481
|
ManagedUserV20251028Schema,
|
|
4404
4482
|
MaxRetriesExceededError,
|
|
@@ -4483,6 +4561,7 @@ export {
|
|
|
4483
4561
|
generateFallbackHostname,
|
|
4484
4562
|
getAppCvms,
|
|
4485
4563
|
getAppEnvEncryptPubKey,
|
|
4564
|
+
getAppFilterOptions,
|
|
4486
4565
|
getAppInfo,
|
|
4487
4566
|
getAppList,
|
|
4488
4567
|
getAppRevisionDetail,
|
|
@@ -4529,6 +4608,7 @@ export {
|
|
|
4529
4608
|
safeDeployAppAuth,
|
|
4530
4609
|
safeGetAppCvms,
|
|
4531
4610
|
safeGetAppEnvEncryptPubKey,
|
|
4611
|
+
safeGetAppFilterOptions,
|
|
4532
4612
|
safeGetAppInfo,
|
|
4533
4613
|
safeGetAppList,
|
|
4534
4614
|
safeGetAppRevisionDetail,
|
|
@@ -4581,6 +4661,7 @@ export {
|
|
|
4581
4661
|
updateOsImage,
|
|
4582
4662
|
updatePreLaunchScript,
|
|
4583
4663
|
validateActionParameters,
|
|
4664
|
+
validateComposePayloadSize,
|
|
4584
4665
|
validateNetworkPrerequisites,
|
|
4585
4666
|
verifyEnvEncryptPublicKey,
|
|
4586
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>;
|
|
@@ -86,6 +86,23 @@ export declare const CvmBasicInfoV20251028Schema: z.ZodObject<{
|
|
|
86
86
|
kms_id?: string | null | undefined;
|
|
87
87
|
}>;
|
|
88
88
|
export type CvmBasicInfoV20251028 = z.infer<typeof CvmBasicInfoV20251028Schema>;
|
|
89
|
+
export declare const AppProfileSchema: z.ZodObject<{
|
|
90
|
+
display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
avatar_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
+
custom_domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
description?: string | null | undefined;
|
|
96
|
+
display_name?: string | null | undefined;
|
|
97
|
+
avatar_url?: string | null | undefined;
|
|
98
|
+
custom_domain?: string | null | undefined;
|
|
99
|
+
}, {
|
|
100
|
+
description?: string | null | undefined;
|
|
101
|
+
display_name?: string | null | undefined;
|
|
102
|
+
avatar_url?: string | null | undefined;
|
|
103
|
+
custom_domain?: string | null | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
export type AppProfile = z.infer<typeof AppProfileSchema>;
|
|
89
106
|
export declare const DstackAppFullResponseV20251028Schema: z.ZodObject<{
|
|
90
107
|
id: z.ZodString;
|
|
91
108
|
name: z.ZodString;
|
|
@@ -94,6 +111,22 @@ export declare const DstackAppFullResponseV20251028Schema: z.ZodObject<{
|
|
|
94
111
|
app_icon_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
112
|
created_at: z.ZodString;
|
|
96
113
|
kms_type: z.ZodString;
|
|
114
|
+
profile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
115
|
+
display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
|
+
avatar_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
custom_domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
description?: string | null | undefined;
|
|
121
|
+
display_name?: string | null | undefined;
|
|
122
|
+
avatar_url?: string | null | undefined;
|
|
123
|
+
custom_domain?: string | null | undefined;
|
|
124
|
+
}, {
|
|
125
|
+
description?: string | null | undefined;
|
|
126
|
+
display_name?: string | null | undefined;
|
|
127
|
+
avatar_url?: string | null | undefined;
|
|
128
|
+
custom_domain?: string | null | undefined;
|
|
129
|
+
}>>>;
|
|
97
130
|
current_cvm: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
98
131
|
vm_uuid: z.ZodNullable<z.ZodString>;
|
|
99
132
|
app_id: z.ZodString;
|
|
@@ -302,6 +335,12 @@ export declare const DstackAppFullResponseV20251028Schema: z.ZodObject<{
|
|
|
302
335
|
cvm_count: number;
|
|
303
336
|
app_provision_type?: string | null | undefined;
|
|
304
337
|
app_icon_url?: string | null | undefined;
|
|
338
|
+
profile?: {
|
|
339
|
+
description?: string | null | undefined;
|
|
340
|
+
display_name?: string | null | undefined;
|
|
341
|
+
avatar_url?: string | null | undefined;
|
|
342
|
+
custom_domain?: string | null | undefined;
|
|
343
|
+
} | null | undefined;
|
|
305
344
|
current_cvm?: {
|
|
306
345
|
status: string;
|
|
307
346
|
name: string;
|
|
@@ -336,6 +375,12 @@ export declare const DstackAppFullResponseV20251028Schema: z.ZodObject<{
|
|
|
336
375
|
created_at: string;
|
|
337
376
|
app_provision_type?: string | null | undefined;
|
|
338
377
|
app_icon_url?: string | null | undefined;
|
|
378
|
+
profile?: {
|
|
379
|
+
description?: string | null | undefined;
|
|
380
|
+
display_name?: string | null | undefined;
|
|
381
|
+
avatar_url?: string | null | undefined;
|
|
382
|
+
custom_domain?: string | null | undefined;
|
|
383
|
+
} | null | undefined;
|
|
339
384
|
current_cvm?: {
|
|
340
385
|
status: string;
|
|
341
386
|
app_id: string;
|
|
@@ -434,6 +479,22 @@ export declare const DstackAppWithCvmResponseV20251028Schema: z.ZodUnion<[z.ZodO
|
|
|
434
479
|
app_icon_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
435
480
|
created_at: z.ZodString;
|
|
436
481
|
kms_type: z.ZodString;
|
|
482
|
+
profile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
483
|
+
display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
484
|
+
avatar_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
485
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
486
|
+
custom_domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
487
|
+
}, "strip", z.ZodTypeAny, {
|
|
488
|
+
description?: string | null | undefined;
|
|
489
|
+
display_name?: string | null | undefined;
|
|
490
|
+
avatar_url?: string | null | undefined;
|
|
491
|
+
custom_domain?: string | null | undefined;
|
|
492
|
+
}, {
|
|
493
|
+
description?: string | null | undefined;
|
|
494
|
+
display_name?: string | null | undefined;
|
|
495
|
+
avatar_url?: string | null | undefined;
|
|
496
|
+
custom_domain?: string | null | undefined;
|
|
497
|
+
}>>>;
|
|
437
498
|
current_cvm: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
438
499
|
vm_uuid: z.ZodNullable<z.ZodString>;
|
|
439
500
|
app_id: z.ZodString;
|
|
@@ -642,6 +703,12 @@ export declare const DstackAppWithCvmResponseV20251028Schema: z.ZodUnion<[z.ZodO
|
|
|
642
703
|
cvm_count: number;
|
|
643
704
|
app_provision_type?: string | null | undefined;
|
|
644
705
|
app_icon_url?: string | null | undefined;
|
|
706
|
+
profile?: {
|
|
707
|
+
description?: string | null | undefined;
|
|
708
|
+
display_name?: string | null | undefined;
|
|
709
|
+
avatar_url?: string | null | undefined;
|
|
710
|
+
custom_domain?: string | null | undefined;
|
|
711
|
+
} | null | undefined;
|
|
645
712
|
current_cvm?: {
|
|
646
713
|
status: string;
|
|
647
714
|
name: string;
|
|
@@ -676,6 +743,12 @@ export declare const DstackAppWithCvmResponseV20251028Schema: z.ZodUnion<[z.ZodO
|
|
|
676
743
|
created_at: string;
|
|
677
744
|
app_provision_type?: string | null | undefined;
|
|
678
745
|
app_icon_url?: string | null | undefined;
|
|
746
|
+
profile?: {
|
|
747
|
+
description?: string | null | undefined;
|
|
748
|
+
display_name?: string | null | undefined;
|
|
749
|
+
avatar_url?: string | null | undefined;
|
|
750
|
+
custom_domain?: string | null | undefined;
|
|
751
|
+
} | null | undefined;
|
|
679
752
|
current_cvm?: {
|
|
680
753
|
status: string;
|
|
681
754
|
app_id: string;
|
|
@@ -773,6 +846,22 @@ export declare const DstackAppListResponseV20251028Schema: z.ZodObject<{
|
|
|
773
846
|
app_icon_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
774
847
|
created_at: z.ZodString;
|
|
775
848
|
kms_type: z.ZodString;
|
|
849
|
+
profile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
850
|
+
display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
851
|
+
avatar_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
852
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
853
|
+
custom_domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
854
|
+
}, "strip", z.ZodTypeAny, {
|
|
855
|
+
description?: string | null | undefined;
|
|
856
|
+
display_name?: string | null | undefined;
|
|
857
|
+
avatar_url?: string | null | undefined;
|
|
858
|
+
custom_domain?: string | null | undefined;
|
|
859
|
+
}, {
|
|
860
|
+
description?: string | null | undefined;
|
|
861
|
+
display_name?: string | null | undefined;
|
|
862
|
+
avatar_url?: string | null | undefined;
|
|
863
|
+
custom_domain?: string | null | undefined;
|
|
864
|
+
}>>>;
|
|
776
865
|
current_cvm: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
777
866
|
vm_uuid: z.ZodNullable<z.ZodString>;
|
|
778
867
|
app_id: z.ZodString;
|
|
@@ -981,6 +1070,12 @@ export declare const DstackAppListResponseV20251028Schema: z.ZodObject<{
|
|
|
981
1070
|
cvm_count: number;
|
|
982
1071
|
app_provision_type?: string | null | undefined;
|
|
983
1072
|
app_icon_url?: string | null | undefined;
|
|
1073
|
+
profile?: {
|
|
1074
|
+
description?: string | null | undefined;
|
|
1075
|
+
display_name?: string | null | undefined;
|
|
1076
|
+
avatar_url?: string | null | undefined;
|
|
1077
|
+
custom_domain?: string | null | undefined;
|
|
1078
|
+
} | null | undefined;
|
|
984
1079
|
current_cvm?: {
|
|
985
1080
|
status: string;
|
|
986
1081
|
name: string;
|
|
@@ -1015,6 +1110,12 @@ export declare const DstackAppListResponseV20251028Schema: z.ZodObject<{
|
|
|
1015
1110
|
created_at: string;
|
|
1016
1111
|
app_provision_type?: string | null | undefined;
|
|
1017
1112
|
app_icon_url?: string | null | undefined;
|
|
1113
|
+
profile?: {
|
|
1114
|
+
description?: string | null | undefined;
|
|
1115
|
+
display_name?: string | null | undefined;
|
|
1116
|
+
avatar_url?: string | null | undefined;
|
|
1117
|
+
custom_domain?: string | null | undefined;
|
|
1118
|
+
} | null | undefined;
|
|
1018
1119
|
current_cvm?: {
|
|
1019
1120
|
status: string;
|
|
1020
1121
|
app_id: string;
|
|
@@ -1145,6 +1246,12 @@ export declare const DstackAppListResponseV20251028Schema: z.ZodObject<{
|
|
|
1145
1246
|
cvm_count: number;
|
|
1146
1247
|
app_provision_type?: string | null | undefined;
|
|
1147
1248
|
app_icon_url?: string | null | undefined;
|
|
1249
|
+
profile?: {
|
|
1250
|
+
description?: string | null | undefined;
|
|
1251
|
+
display_name?: string | null | undefined;
|
|
1252
|
+
avatar_url?: string | null | undefined;
|
|
1253
|
+
custom_domain?: string | null | undefined;
|
|
1254
|
+
} | null | undefined;
|
|
1148
1255
|
current_cvm?: {
|
|
1149
1256
|
status: string;
|
|
1150
1257
|
name: string;
|
|
@@ -1196,6 +1303,12 @@ export declare const DstackAppListResponseV20251028Schema: z.ZodObject<{
|
|
|
1196
1303
|
created_at: string;
|
|
1197
1304
|
app_provision_type?: string | null | undefined;
|
|
1198
1305
|
app_icon_url?: string | null | undefined;
|
|
1306
|
+
profile?: {
|
|
1307
|
+
description?: string | null | undefined;
|
|
1308
|
+
display_name?: string | null | undefined;
|
|
1309
|
+
avatar_url?: string | null | undefined;
|
|
1310
|
+
custom_domain?: string | null | undefined;
|
|
1311
|
+
} | null | undefined;
|
|
1199
1312
|
current_cvm?: {
|
|
1200
1313
|
status: string;
|
|
1201
1314
|
app_id: string;
|