siteplane 0.1.49 → 0.1.50
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/README.md +19 -0
- package/dist/bin/siteplane.js +474 -290
- package/dist/index.js +231 -187
- package/dist/next.js +225 -185
- package/package.json +1 -1
package/dist/next.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { execFile as execFile4 } from "child_process";
|
|
3
3
|
import { createHash as createHash5 } from "crypto";
|
|
4
4
|
import { readFile as readFile13 } from "fs/promises";
|
|
5
|
-
import { dirname as dirname9, join as
|
|
5
|
+
import { dirname as dirname9, join as join13, resolve as resolve4 } from "path";
|
|
6
6
|
import { promisify as promisify4 } from "util";
|
|
7
7
|
|
|
8
8
|
// ../cli/dist/analytics/manifest.js
|
|
@@ -11,7 +11,7 @@ import { dirname } from "path";
|
|
|
11
11
|
|
|
12
12
|
// ../shared/dist/actors.js
|
|
13
13
|
import { z } from "zod";
|
|
14
|
-
var ACTOR_TYPES = ["workspace_member", "site_member", "agent", "system"];
|
|
14
|
+
var ACTOR_TYPES = ["workspace_member", "site_member", "agent", "setup_guest", "system"];
|
|
15
15
|
var actorTypeSchema = z.enum(ACTOR_TYPES);
|
|
16
16
|
|
|
17
17
|
// ../shared/dist/analytics-defaults.js
|
|
@@ -1563,7 +1563,7 @@ var siteSetupTaskSchema = z16.object({
|
|
|
1563
1563
|
progress: siteSetupTaskProgressSchema.nullable(),
|
|
1564
1564
|
deployment: setupDeploymentRecordSchema.nullable(),
|
|
1565
1565
|
revalidationGeneration: z16.number().int().positive(),
|
|
1566
|
-
assignment: z16.
|
|
1566
|
+
assignment: z16.enum(["owned", "provisional", "claimed"]),
|
|
1567
1567
|
deadline: z16.string().datetime().nullable(),
|
|
1568
1568
|
userInstructions: z16.object({
|
|
1569
1569
|
text: siteSetupOwnerEditabilityNoteSchema,
|
|
@@ -2237,6 +2237,17 @@ var checkSetupAssetTargetInputSchema = z25.object({
|
|
|
2237
2237
|
intent: z25.enum(["start", "poll"])
|
|
2238
2238
|
}).strict();
|
|
2239
2239
|
|
|
2240
|
+
// ../shared/dist/setup-installation.js
|
|
2241
|
+
import { z as z26 } from "zod";
|
|
2242
|
+
var setupInstallationRequestSchema = z26.object({
|
|
2243
|
+
modules: siteSetupModulesSchema,
|
|
2244
|
+
ownerEditabilityNote: siteSetupOwnerEditabilityNoteSchema,
|
|
2245
|
+
provider: z26.object({
|
|
2246
|
+
projectId: z26.string().min(1).max(200),
|
|
2247
|
+
teamId: z26.string().min(1).max(200)
|
|
2248
|
+
}).strict()
|
|
2249
|
+
}).strict();
|
|
2250
|
+
|
|
2240
2251
|
// ../cli/dist/analytics/static-scan.js
|
|
2241
2252
|
import ts from "typescript";
|
|
2242
2253
|
|
|
@@ -2289,16 +2300,16 @@ function createAnalyticsCliRequestHeaders(config) {
|
|
|
2289
2300
|
}
|
|
2290
2301
|
|
|
2291
2302
|
// ../cli/dist/commands/analytics/public-key.js
|
|
2292
|
-
import { z as
|
|
2293
|
-
var responseSchema =
|
|
2294
|
-
ok:
|
|
2295
|
-
data:
|
|
2296
|
-
rawPublicKey:
|
|
2303
|
+
import { z as z27 } from "zod";
|
|
2304
|
+
var responseSchema = z27.object({
|
|
2305
|
+
ok: z27.literal(true),
|
|
2306
|
+
data: z27.object({
|
|
2307
|
+
rawPublicKey: z27.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/)
|
|
2297
2308
|
})
|
|
2298
2309
|
});
|
|
2299
|
-
var errorResponseSchema =
|
|
2300
|
-
error:
|
|
2301
|
-
code:
|
|
2310
|
+
var errorResponseSchema = z27.object({
|
|
2311
|
+
error: z27.object({
|
|
2312
|
+
code: z27.string().regex(/^[a-z][a-z0-9_.-]+$/u)
|
|
2302
2313
|
})
|
|
2303
2314
|
});
|
|
2304
2315
|
async function analyticsPublicKeyCommand(input) {
|
|
@@ -2320,13 +2331,13 @@ async function analyticsPublicKeyCommand(input) {
|
|
|
2320
2331
|
}
|
|
2321
2332
|
|
|
2322
2333
|
// ../cli/dist/commands/analytics/prepare.js
|
|
2323
|
-
import { z as
|
|
2324
|
-
var resultSchema =
|
|
2325
|
-
ok:
|
|
2326
|
-
data:
|
|
2327
|
-
rawPublicKey:
|
|
2328
|
-
generation:
|
|
2329
|
-
status:
|
|
2334
|
+
import { z as z28 } from "zod";
|
|
2335
|
+
var resultSchema = z28.object({
|
|
2336
|
+
ok: z28.literal(true),
|
|
2337
|
+
data: z28.object({
|
|
2338
|
+
rawPublicKey: z28.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/u),
|
|
2339
|
+
generation: z28.number().int().positive(),
|
|
2340
|
+
status: z28.enum([
|
|
2330
2341
|
"setup_started",
|
|
2331
2342
|
"test_mode",
|
|
2332
2343
|
"active",
|
|
@@ -2336,8 +2347,8 @@ var resultSchema = z27.object({
|
|
|
2336
2347
|
])
|
|
2337
2348
|
}).strict()
|
|
2338
2349
|
}).strict();
|
|
2339
|
-
var errorSchema =
|
|
2340
|
-
error:
|
|
2350
|
+
var errorSchema = z28.object({
|
|
2351
|
+
error: z28.object({ code: z28.string().regex(/^[a-z][a-z0-9_.-]+$/u) })
|
|
2341
2352
|
});
|
|
2342
2353
|
|
|
2343
2354
|
// ../cli/dist/commands/analytics/test.js
|
|
@@ -2370,19 +2381,19 @@ ${bookingRulesTemplate}`;
|
|
|
2370
2381
|
import { access, chmod, open, readFile as readFile5, rename, rm } from "fs/promises";
|
|
2371
2382
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2372
2383
|
import { join as join3 } from "path";
|
|
2373
|
-
import { z as
|
|
2374
|
-
var siteplaneProjectConfigSchema =
|
|
2375
|
-
version:
|
|
2376
|
-
apiBaseUrl:
|
|
2377
|
-
siteId:
|
|
2378
|
-
publicSiteKeyId:
|
|
2379
|
-
publicSiteKey:
|
|
2380
|
-
runId:
|
|
2381
|
-
appDirectory:
|
|
2382
|
-
taskContractVersion:
|
|
2383
|
-
adminProtocolVersion:
|
|
2384
|
+
import { z as z29 } from "zod";
|
|
2385
|
+
var siteplaneProjectConfigSchema = z29.object({
|
|
2386
|
+
version: z29.literal(2),
|
|
2387
|
+
apiBaseUrl: z29.string().url(),
|
|
2388
|
+
siteId: z29.string().uuid(),
|
|
2389
|
+
publicSiteKeyId: z29.string().uuid(),
|
|
2390
|
+
publicSiteKey: z29.string().trim().min(1),
|
|
2391
|
+
runId: z29.string().uuid(),
|
|
2392
|
+
appDirectory: z29.string().min(1),
|
|
2393
|
+
taskContractVersion: z29.literal("siteplane.setup-task.v2"),
|
|
2394
|
+
adminProtocolVersion: z29.literal(2),
|
|
2384
2395
|
packages: siteSetupPackagesSchema,
|
|
2385
|
-
fieldContractHash:
|
|
2396
|
+
fieldContractHash: z29.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2386
2397
|
}).strict();
|
|
2387
2398
|
async function readProjectConfig(projectDir) {
|
|
2388
2399
|
return siteplaneProjectConfigSchema.parse(JSON.parse(await readFile5(join3(projectDir, "siteplane.config.json"), "utf8")));
|
|
@@ -2394,15 +2405,27 @@ import { randomUUID as randomUUID3 } from "crypto";
|
|
|
2394
2405
|
import { chmod as chmod2, lstat, mkdir as mkdir5, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
|
|
2395
2406
|
import { dirname as dirname5, join as join4, relative } from "path";
|
|
2396
2407
|
import { promisify } from "util";
|
|
2397
|
-
import { z as
|
|
2398
|
-
var
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2408
|
+
import { z as z30 } from "zod";
|
|
2409
|
+
var localSetupInstallationSchema = z30.object({
|
|
2410
|
+
key: z30.string().regex(/^[A-Za-z0-9_-]{43}$/u),
|
|
2411
|
+
idempotencyKey: z30.string().uuid(),
|
|
2412
|
+
apiBaseUrl: z30.string().url(),
|
|
2413
|
+
request: setupInstallationRequestSchema,
|
|
2414
|
+
bootstrapAcknowledged: z30.boolean()
|
|
2415
|
+
}).strict();
|
|
2416
|
+
var siteplaneCredentialsSchema = z30.object({
|
|
2417
|
+
accessToken: z30.string().trim().min(1),
|
|
2418
|
+
siteRevalidationSecret: z30.string().trim().min(1),
|
|
2419
|
+
installation: localSetupInstallationSchema.optional(),
|
|
2420
|
+
adminSession: z30.object({
|
|
2421
|
+
secret: z30.string().regex(/^[A-Za-z0-9_-]{43}$/u),
|
|
2422
|
+
generation: z30.string().uuid()
|
|
2404
2423
|
}).strict().optional()
|
|
2405
2424
|
}).strict();
|
|
2425
|
+
var localSetupCredentialsSchema = z30.union([
|
|
2426
|
+
siteplaneCredentialsSchema,
|
|
2427
|
+
z30.object({ installation: localSetupInstallationSchema }).strict()
|
|
2428
|
+
]);
|
|
2406
2429
|
async function assertLocalCredentialsPathSafe(projectDir, options = {}) {
|
|
2407
2430
|
const path = join4(projectDir, ".siteplane/credentials.json");
|
|
2408
2431
|
await assertCredentialFilesystemSafe(projectDir);
|
|
@@ -2438,8 +2461,15 @@ async function assertCredentialFilesystemSafe(projectDir) {
|
|
|
2438
2461
|
}
|
|
2439
2462
|
}
|
|
2440
2463
|
async function readLocalCredentials(projectDir) {
|
|
2464
|
+
const credentials = await readLocalSetupCredentials(projectDir);
|
|
2465
|
+
if (!("accessToken" in credentials)) {
|
|
2466
|
+
throw new Error("setup_exchange_pending: Run siteplane setup start to finish the stored installation exchange.");
|
|
2467
|
+
}
|
|
2468
|
+
return credentials;
|
|
2469
|
+
}
|
|
2470
|
+
async function readLocalSetupCredentials(projectDir) {
|
|
2441
2471
|
await assertCredentialFilesystemSafe(projectDir);
|
|
2442
|
-
return
|
|
2472
|
+
return localSetupCredentialsSchema.parse(JSON.parse(await readFile6(join4(projectDir, ".siteplane/credentials.json"), "utf8")));
|
|
2443
2473
|
}
|
|
2444
2474
|
var execFileAsync = promisify(execFile);
|
|
2445
2475
|
async function gitPathMatches(projectDir, path, command) {
|
|
@@ -2455,7 +2485,7 @@ async function gitPathMatches(projectDir, path, command) {
|
|
|
2455
2485
|
// ../cli/dist/commands/init.js
|
|
2456
2486
|
import { access as access3 } from "fs/promises";
|
|
2457
2487
|
import { join as join7, relative as relative3 } from "path";
|
|
2458
|
-
import { z as
|
|
2488
|
+
import { z as z33 } from "zod";
|
|
2459
2489
|
|
|
2460
2490
|
// ../cli/dist/commands/setup-preflight.js
|
|
2461
2491
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -2467,11 +2497,11 @@ import { parse as parseYaml } from "yaml";
|
|
|
2467
2497
|
import { createRequire } from "module";
|
|
2468
2498
|
import { readFile as readFile7 } from "fs/promises";
|
|
2469
2499
|
import { join as join5 } from "path";
|
|
2470
|
-
import { z as
|
|
2471
|
-
var packageSchema =
|
|
2472
|
-
name:
|
|
2473
|
-
version:
|
|
2474
|
-
peerDependencies:
|
|
2500
|
+
import { z as z31 } from "zod";
|
|
2501
|
+
var packageSchema = z31.object({
|
|
2502
|
+
name: z31.string().optional(),
|
|
2503
|
+
version: z31.string(),
|
|
2504
|
+
peerDependencies: z31.record(z31.string(), z31.string()).optional()
|
|
2475
2505
|
});
|
|
2476
2506
|
async function readInstalledPackage(projectDir, name2) {
|
|
2477
2507
|
const require2 = createRequire(join5(projectDir, "package.json"));
|
|
@@ -2489,7 +2519,7 @@ async function readInstalledPackage(projectDir, name2) {
|
|
|
2489
2519
|
// ../cli/dist/commands/setup-preflight.js
|
|
2490
2520
|
import { access as access2, readFile as readFile8, realpath, readdir, readlink } from "fs/promises";
|
|
2491
2521
|
import { dirname as dirname6, join as join6, relative as relative2, resolve, sep } from "path";
|
|
2492
|
-
import { z as
|
|
2522
|
+
import { z as z32 } from "zod";
|
|
2493
2523
|
|
|
2494
2524
|
// ../cli/dist/commands/setup-process.js
|
|
2495
2525
|
import { spawn } from "child_process";
|
|
@@ -2590,29 +2620,29 @@ async function setupVercelApi(cwd, endpoint, body, method, options) {
|
|
|
2590
2620
|
}
|
|
2591
2621
|
|
|
2592
2622
|
// ../cli/dist/commands/setup-preflight.js
|
|
2593
|
-
var manifestSchema =
|
|
2594
|
-
packageManager:
|
|
2595
|
-
engines:
|
|
2596
|
-
dependencies:
|
|
2597
|
-
devDependencies:
|
|
2598
|
-
scripts:
|
|
2599
|
-
workspaces:
|
|
2623
|
+
var manifestSchema = z32.object({
|
|
2624
|
+
packageManager: z32.string().optional(),
|
|
2625
|
+
engines: z32.object({ node: z32.string().optional() }).optional(),
|
|
2626
|
+
dependencies: z32.record(z32.string(), z32.string()).optional(),
|
|
2627
|
+
devDependencies: z32.record(z32.string(), z32.string()).optional(),
|
|
2628
|
+
scripts: z32.record(z32.string(), z32.string()).optional(),
|
|
2629
|
+
workspaces: z32.unknown().optional()
|
|
2600
2630
|
});
|
|
2601
|
-
var vercelProjectSchema =
|
|
2602
|
-
id:
|
|
2603
|
-
accountId:
|
|
2604
|
-
name:
|
|
2605
|
-
nodeVersion:
|
|
2606
|
-
rootDirectory:
|
|
2607
|
-
framework:
|
|
2608
|
-
installCommand:
|
|
2609
|
-
buildCommand:
|
|
2610
|
-
link:
|
|
2611
|
-
type:
|
|
2612
|
-
repo:
|
|
2613
|
-
repoId:
|
|
2614
|
-
org:
|
|
2615
|
-
productionBranch:
|
|
2631
|
+
var vercelProjectSchema = z32.object({
|
|
2632
|
+
id: z32.string(),
|
|
2633
|
+
accountId: z32.string(),
|
|
2634
|
+
name: z32.string(),
|
|
2635
|
+
nodeVersion: z32.string().nullable().optional(),
|
|
2636
|
+
rootDirectory: z32.string().nullable().optional(),
|
|
2637
|
+
framework: z32.string().nullable().optional(),
|
|
2638
|
+
installCommand: z32.string().nullable().optional(),
|
|
2639
|
+
buildCommand: z32.string().nullable().optional(),
|
|
2640
|
+
link: z32.object({
|
|
2641
|
+
type: z32.string(),
|
|
2642
|
+
repo: z32.string().optional(),
|
|
2643
|
+
repoId: z32.union([z32.string(), z32.number()]).optional(),
|
|
2644
|
+
org: z32.string().optional(),
|
|
2645
|
+
productionBranch: z32.string().optional()
|
|
2616
2646
|
}).nullable().optional()
|
|
2617
2647
|
});
|
|
2618
2648
|
var exists = async (path) => access2(path).then(() => true, () => false);
|
|
@@ -2669,9 +2699,9 @@ async function inspectSetupLocalProject(projectDir) {
|
|
|
2669
2699
|
const rootManifest = manifestSchema.parse(JSON.parse(await readFile8(join6(lockfileRoot, "package.json"), "utf8")));
|
|
2670
2700
|
if (lockfileRoot !== projectDirectory) {
|
|
2671
2701
|
const workspaceFile = join6(lockfileRoot, "pnpm-workspace.yaml");
|
|
2672
|
-
const workspace = lockName === "pnpm-lock.yaml" && await exists(workspaceFile) ?
|
|
2673
|
-
|
|
2674
|
-
|
|
2702
|
+
const workspace = lockName === "pnpm-lock.yaml" && await exists(workspaceFile) ? z32.object({ packages: z32.array(z32.string()) }).parse(parseYaml(await readFile8(workspaceFile, "utf8"))).packages : z32.union([
|
|
2703
|
+
z32.array(z32.string()),
|
|
2704
|
+
z32.object({ packages: z32.array(z32.string()) }).transform((value) => value.packages)
|
|
2675
2705
|
]).parse(rootManifest.workspaces);
|
|
2676
2706
|
const selected = relative2(lockfileRoot, projectDirectory).split(sep).join("/");
|
|
2677
2707
|
if (!workspace.some((pattern) => !pattern.startsWith("!") && minimatch(selected, pattern)) || workspace.some((pattern) => pattern.startsWith("!") && minimatch(selected, pattern.slice(1))))
|
|
@@ -2685,11 +2715,11 @@ async function inspectSetupLocalProject(projectDir) {
|
|
|
2685
2715
|
break;
|
|
2686
2716
|
}
|
|
2687
2717
|
const lockText = await readFile8(join6(lockfileRoot, lockName), "utf8");
|
|
2688
|
-
const npmLock = lockName === "package-lock.json" ?
|
|
2689
|
-
lockfileVersion:
|
|
2690
|
-
packages:
|
|
2691
|
-
version:
|
|
2692
|
-
peerDependencies:
|
|
2718
|
+
const npmLock = lockName === "package-lock.json" ? z32.object({
|
|
2719
|
+
lockfileVersion: z32.number(),
|
|
2720
|
+
packages: z32.record(z32.string(), z32.object({
|
|
2721
|
+
version: z32.string().optional(),
|
|
2722
|
+
peerDependencies: z32.record(z32.string(), z32.string()).optional()
|
|
2693
2723
|
})).optional()
|
|
2694
2724
|
}).parse(JSON.parse(lockText)) : null;
|
|
2695
2725
|
async function version2(name3) {
|
|
@@ -2829,9 +2859,9 @@ async function setupPreflightCommand(input) {
|
|
|
2829
2859
|
linkDirectory = dirname6(linkDirectory);
|
|
2830
2860
|
if (!await exists(join6(linkDirectory, ".vercel/project.json")))
|
|
2831
2861
|
fail("vercel_project_not_linked", "Link this application to its intended Vercel project before setup; Siteplane will not guess a target.");
|
|
2832
|
-
const linked =
|
|
2833
|
-
projectId:
|
|
2834
|
-
orgId:
|
|
2862
|
+
const linked = z32.object({
|
|
2863
|
+
projectId: z32.string().regex(/^prj_[A-Za-z0-9]+$/u),
|
|
2864
|
+
orgId: z32.string().regex(/^(?:team|user)_[A-Za-z0-9]+$/u)
|
|
2835
2865
|
}).parse(JSON.parse(await readFile8(join6(linkDirectory, ".vercel/project.json"), "utf8")));
|
|
2836
2866
|
const project = vercelProjectSchema.parse(await setupVercelApi(linkDirectory, `/v9/projects/${linked.projectId}?teamId=${linked.orgId}`));
|
|
2837
2867
|
if (project.id !== linked.projectId || project.accountId !== linked.orgId)
|
|
@@ -2845,11 +2875,11 @@ async function setupPreflightCommand(input) {
|
|
|
2845
2875
|
fail("vercel_production_branch_conflict", "The local branch differs from the bound Vercel Production branch.");
|
|
2846
2876
|
if (project.link?.repo && project.link.org && !local.git.remote?.replace(/\.git$/u, "").endsWith(`${project.link.org}/${project.link.repo}`))
|
|
2847
2877
|
fail("vercel_git_conflict", "The local origin repository differs from the Vercel Git connection.");
|
|
2848
|
-
const env =
|
|
2849
|
-
envs:
|
|
2850
|
-
key:
|
|
2851
|
-
value:
|
|
2852
|
-
target:
|
|
2878
|
+
const env = z32.object({
|
|
2879
|
+
envs: z32.array(z32.object({
|
|
2880
|
+
key: z32.string(),
|
|
2881
|
+
value: z32.string().optional(),
|
|
2882
|
+
target: z32.array(z32.string()).optional()
|
|
2853
2883
|
}))
|
|
2854
2884
|
}).parse(await setupVercelApi(linkDirectory, `/v10/projects/${linked.projectId}/env?teamId=${linked.orgId}`));
|
|
2855
2885
|
const corepack = env.envs.some((item) => item.key === "ENABLE_EXPERIMENTAL_COREPACK" && item.value === "1" && item.target?.includes("production"));
|
|
@@ -2911,26 +2941,26 @@ function safeGitRemote(value) {
|
|
|
2911
2941
|
}
|
|
2912
2942
|
|
|
2913
2943
|
// ../cli/dist/commands/init.js
|
|
2914
|
-
var siteSetupBootstrapDataSchema =
|
|
2915
|
-
credentialPurpose:
|
|
2916
|
-
apiBaseUrl:
|
|
2917
|
-
siteId:
|
|
2918
|
-
publicSiteKeyId:
|
|
2919
|
-
publicSiteKey:
|
|
2920
|
-
accessToken:
|
|
2921
|
-
siteRevalidationSecret:
|
|
2922
|
-
runId:
|
|
2944
|
+
var siteSetupBootstrapDataSchema = z33.object({
|
|
2945
|
+
credentialPurpose: z33.literal("site_setup"),
|
|
2946
|
+
apiBaseUrl: z33.string().url(),
|
|
2947
|
+
siteId: z33.string().uuid(),
|
|
2948
|
+
publicSiteKeyId: z33.string().uuid(),
|
|
2949
|
+
publicSiteKey: z33.string().trim().min(1),
|
|
2950
|
+
accessToken: z33.string().trim().min(1),
|
|
2951
|
+
siteRevalidationSecret: z33.string().regex(/^[A-Za-z0-9_-]{43}$/u),
|
|
2952
|
+
runId: z33.string().uuid(),
|
|
2923
2953
|
packages: siteSetupPackagesSchema
|
|
2924
2954
|
}).strict();
|
|
2925
|
-
var featureBootstrapDataSchema =
|
|
2926
|
-
credentialPurpose:
|
|
2927
|
-
apiBaseUrl:
|
|
2928
|
-
siteId:
|
|
2929
|
-
accessToken:
|
|
2955
|
+
var featureBootstrapDataSchema = z33.object({
|
|
2956
|
+
credentialPurpose: z33.enum(["analytics", "booking"]),
|
|
2957
|
+
apiBaseUrl: z33.string().url(),
|
|
2958
|
+
siteId: z33.string().uuid(),
|
|
2959
|
+
accessToken: z33.string().trim().min(1)
|
|
2930
2960
|
}).strict();
|
|
2931
|
-
var bootstrapResponseSchema =
|
|
2932
|
-
ok:
|
|
2933
|
-
data:
|
|
2961
|
+
var bootstrapResponseSchema = z33.object({
|
|
2962
|
+
ok: z33.literal(true),
|
|
2963
|
+
data: z33.discriminatedUnion("credentialPurpose", [
|
|
2934
2964
|
siteSetupBootstrapDataSchema,
|
|
2935
2965
|
featureBootstrapDataSchema
|
|
2936
2966
|
])
|
|
@@ -2981,7 +3011,7 @@ async function collectSourceFiles(directory) {
|
|
|
2981
3011
|
import { execFile as execFile2 } from "child_process";
|
|
2982
3012
|
import { readFile as readFile9 } from "fs/promises";
|
|
2983
3013
|
import { promisify as promisify2 } from "util";
|
|
2984
|
-
import { z as
|
|
3014
|
+
import { z as z34 } from "zod";
|
|
2985
3015
|
|
|
2986
3016
|
// ../cli/dist/scan/next-source-scan.js
|
|
2987
3017
|
import ts2 from "typescript";
|
|
@@ -3678,32 +3708,32 @@ function isPositionalFieldReference(value) {
|
|
|
3678
3708
|
|
|
3679
3709
|
// ../cli/dist/commands/site-setup.js
|
|
3680
3710
|
var execFileAsync2 = promisify2(execFile2);
|
|
3681
|
-
var safeErrorSchema =
|
|
3682
|
-
code:
|
|
3683
|
-
message:
|
|
3711
|
+
var safeErrorSchema = z34.object({
|
|
3712
|
+
code: z34.string().trim().min(1),
|
|
3713
|
+
message: z34.string().trim().min(1)
|
|
3684
3714
|
}).passthrough();
|
|
3685
|
-
var errorResponseSchema2 =
|
|
3686
|
-
var contextDataSchema =
|
|
3715
|
+
var errorResponseSchema2 = z34.object({ ok: z34.literal(false), error: safeErrorSchema }).passthrough();
|
|
3716
|
+
var contextDataSchema = z34.object({
|
|
3687
3717
|
task: siteSetupTaskSchema.refine((task) => task.run !== null)
|
|
3688
3718
|
}).strict();
|
|
3689
|
-
var contextResponseSchema =
|
|
3690
|
-
var applyDataSchema =
|
|
3691
|
-
status:
|
|
3692
|
-
runId:
|
|
3693
|
-
contractVersionId:
|
|
3694
|
-
fieldContractHash:
|
|
3695
|
-
editorDefinitionHash:
|
|
3696
|
-
fieldCount:
|
|
3697
|
-
routeCount:
|
|
3719
|
+
var contextResponseSchema = z34.object({ ok: z34.literal(true), data: contextDataSchema }).strict();
|
|
3720
|
+
var applyDataSchema = z34.object({
|
|
3721
|
+
status: z34.enum(["applied", "ready_for_review"]),
|
|
3722
|
+
runId: z34.string().uuid().optional(),
|
|
3723
|
+
contractVersionId: z34.string().uuid().optional(),
|
|
3724
|
+
fieldContractHash: z34.string().regex(/^sha256:[0-9a-f]{64}$/u),
|
|
3725
|
+
editorDefinitionHash: z34.string().regex(/^sha256:[0-9a-f]{64}$/u).optional(),
|
|
3726
|
+
fieldCount: z34.number().int().nonnegative().optional(),
|
|
3727
|
+
routeCount: z34.number().int().nonnegative().optional()
|
|
3698
3728
|
}).strict();
|
|
3699
|
-
var applyResponseSchema =
|
|
3700
|
-
var verifyDataSchema =
|
|
3701
|
-
status:
|
|
3702
|
-
runId:
|
|
3703
|
-
deploymentOrigin:
|
|
3704
|
-
deploymentRevision:
|
|
3729
|
+
var applyResponseSchema = z34.object({ ok: z34.literal(true), data: applyDataSchema }).strict();
|
|
3730
|
+
var verifyDataSchema = z34.object({
|
|
3731
|
+
status: z34.literal("ready_for_review"),
|
|
3732
|
+
runId: z34.string().uuid().optional(),
|
|
3733
|
+
deploymentOrigin: z34.string().url().optional(),
|
|
3734
|
+
deploymentRevision: z34.string().optional()
|
|
3705
3735
|
}).strict();
|
|
3706
|
-
var verifyResponseSchema =
|
|
3736
|
+
var verifyResponseSchema = z34.object({ ok: z34.literal(true), data: verifyDataSchema }).strict();
|
|
3707
3737
|
async function siteSetupContextCommand(input) {
|
|
3708
3738
|
const response = await postSiteSetup(input, "context", {});
|
|
3709
3739
|
const parsed = contextResponseSchema.safeParse(response.payload);
|
|
@@ -3796,42 +3826,52 @@ async function readGitRevision(projectDir) {
|
|
|
3796
3826
|
return revision;
|
|
3797
3827
|
}
|
|
3798
3828
|
|
|
3829
|
+
// ../cli/dist/commands/setup-start.js
|
|
3830
|
+
import { randomBytes, randomUUID as randomUUID4 } from "crypto";
|
|
3831
|
+
import { access as access4 } from "fs/promises";
|
|
3832
|
+
import { join as join9, relative as relative5 } from "path";
|
|
3833
|
+
import { z as z35 } from "zod";
|
|
3834
|
+
var bootstrapResponseSchema2 = z35.object({
|
|
3835
|
+
ok: z35.literal(true),
|
|
3836
|
+
data: siteSetupBootstrapDataSchema
|
|
3837
|
+
}).strict();
|
|
3838
|
+
|
|
3799
3839
|
// ../cli/dist/commands/setup-prepare.js
|
|
3800
|
-
import { access as
|
|
3801
|
-
import { randomUUID as
|
|
3802
|
-
import { dirname as dirname7, join as
|
|
3840
|
+
import { access as access5, lstat as lstat2, mkdir as mkdir6, open as open3, readFile as readFile10, rename as rename3, rm as rm3 } from "fs/promises";
|
|
3841
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
3842
|
+
import { dirname as dirname7, join as join10, relative as relative6, sep as sep2 } from "path";
|
|
3803
3843
|
import ts3 from "typescript";
|
|
3804
3844
|
|
|
3805
3845
|
// ../cli/dist/commands/setup-lock.js
|
|
3806
|
-
import { randomUUID as
|
|
3846
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
3807
3847
|
import { lstat as lstat3, mkdir as mkdir7, open as open4, readFile as readFile11, rm as rm4, rmdir } from "fs/promises";
|
|
3808
3848
|
import { resolve as resolve2 } from "path";
|
|
3809
|
-
import { z as
|
|
3810
|
-
var ownerSchema =
|
|
3849
|
+
import { z as z36 } from "zod";
|
|
3850
|
+
var ownerSchema = z36.object({ pid: z36.number().int().positive(), nonce: z36.string().uuid() }).strict();
|
|
3811
3851
|
|
|
3812
3852
|
// ../cli/dist/config/build-provenance.js
|
|
3813
3853
|
import { createHash as createHash3 } from "crypto";
|
|
3814
3854
|
import { execFile as execFile3 } from "child_process";
|
|
3815
3855
|
import { lstat as lstat4, readFile as readFile12, writeFile as writeFile5, mkdir as mkdir8 } from "fs/promises";
|
|
3816
|
-
import { dirname as dirname8, isAbsolute as isAbsolute2, join as
|
|
3856
|
+
import { dirname as dirname8, isAbsolute as isAbsolute2, join as join11, relative as relative7, resolve as resolve3, sep as sep3 } from "path";
|
|
3817
3857
|
import { isDeepStrictEqual, promisify as promisify3 } from "util";
|
|
3818
|
-
import { z as
|
|
3858
|
+
import { z as z37 } from "zod";
|
|
3819
3859
|
var execute = promisify3(execFile3);
|
|
3820
3860
|
var name = ".siteplane/build-source.json";
|
|
3821
|
-
var oid =
|
|
3822
|
-
var entrySchema =
|
|
3823
|
-
path:
|
|
3824
|
-
mode:
|
|
3861
|
+
var oid = z37.string().regex(/^[0-9a-f]{40}$/u);
|
|
3862
|
+
var entrySchema = z37.object({
|
|
3863
|
+
path: z37.string().min(1).max(4096),
|
|
3864
|
+
mode: z37.enum(["100644", "100755", "120000"]),
|
|
3825
3865
|
oid
|
|
3826
3866
|
}).strict();
|
|
3827
|
-
var schema =
|
|
3828
|
-
version:
|
|
3867
|
+
var schema = z37.object({
|
|
3868
|
+
version: z37.literal(2),
|
|
3829
3869
|
revision: oid,
|
|
3830
|
-
commit:
|
|
3831
|
-
entries:
|
|
3832
|
-
providerConfigurations:
|
|
3833
|
-
path:
|
|
3834
|
-
source:
|
|
3870
|
+
commit: z37.string().min(1).max(1048576),
|
|
3871
|
+
entries: z37.array(entrySchema).min(1).max(1e5),
|
|
3872
|
+
providerConfigurations: z37.array(z37.object({
|
|
3873
|
+
path: z37.string().max(4096).regex(/(?:^|\/)vercel\.json$/u),
|
|
3874
|
+
source: z37.string().max(1048576)
|
|
3835
3875
|
}).strict()).max(1e3)
|
|
3836
3876
|
}).strict();
|
|
3837
3877
|
var gitHash = (type, content) => createHash3("sha1").update(`${type} ${content.length}\0`).update(content).digest("hex");
|
|
@@ -3854,15 +3894,15 @@ async function writeBuildProvenance(checkout, revision) {
|
|
|
3854
3894
|
if (entry.mode !== "120000")
|
|
3855
3895
|
continue;
|
|
3856
3896
|
const { readlink: readlink2 } = await import("fs/promises");
|
|
3857
|
-
const path =
|
|
3897
|
+
const path = join11(checkout, entry.path);
|
|
3858
3898
|
const target2 = resolve3(dirname8(path), await readlink2(path));
|
|
3859
|
-
const bound =
|
|
3899
|
+
const bound = relative7(checkout, target2);
|
|
3860
3900
|
if (bound.startsWith("..") || isAbsolute2(bound))
|
|
3861
3901
|
throw new Error("A tracked symbolic link escapes the committed upload; resolve that source boundary before deployment.");
|
|
3862
3902
|
}
|
|
3863
3903
|
const providerConfigurations = await Promise.all(entries.filter((entry) => /(?:^|\/)vercel\.json$/u.test(entry.path)).map(async (entry) => ({
|
|
3864
3904
|
path: entry.path,
|
|
3865
|
-
source: await readFile12(
|
|
3905
|
+
source: await readFile12(join11(checkout, entry.path), "utf8")
|
|
3866
3906
|
})));
|
|
3867
3907
|
const record = schema.parse({
|
|
3868
3908
|
version: 2,
|
|
@@ -3871,7 +3911,7 @@ async function writeBuildProvenance(checkout, revision) {
|
|
|
3871
3911
|
entries,
|
|
3872
3912
|
providerConfigurations
|
|
3873
3913
|
});
|
|
3874
|
-
const target =
|
|
3914
|
+
const target = join11(checkout, name);
|
|
3875
3915
|
await mkdir8(dirname8(target), { recursive: true, mode: 448 });
|
|
3876
3916
|
await writeFile5(target, JSON.stringify(record), { flag: "wx", mode: 384 });
|
|
3877
3917
|
}
|
|
@@ -3879,7 +3919,7 @@ async function readBuildProvenance(projectDirectory) {
|
|
|
3879
3919
|
let root = resolve3(projectDirectory);
|
|
3880
3920
|
let raw = null;
|
|
3881
3921
|
for (; ; ) {
|
|
3882
|
-
raw = await readFile12(
|
|
3922
|
+
raw = await readFile12(join11(root, name), "utf8").catch((error) => {
|
|
3883
3923
|
if (error.code === "ENOENT")
|
|
3884
3924
|
return null;
|
|
3885
3925
|
throw error;
|
|
@@ -3908,11 +3948,11 @@ async function readBuildProvenance(projectDirectory) {
|
|
|
3908
3948
|
}
|
|
3909
3949
|
if (record.entries.some((entry) => /(?:^|\/)vercel\.json$/u.test(entry.path) && !configurations.has(entry.path)))
|
|
3910
3950
|
throw new Error("The committed provider configuration is missing from the build provenance.");
|
|
3911
|
-
const appRelative =
|
|
3951
|
+
const appRelative = relative7(root, projectDirectory).split(sep3).join("/");
|
|
3912
3952
|
if (!bound.has(appRelative ? `${appRelative}/package.json` : "package.json"))
|
|
3913
3953
|
throw new Error("The selected app is not part of the committed upload.");
|
|
3914
3954
|
for (const entry of record.entries) {
|
|
3915
|
-
const path =
|
|
3955
|
+
const path = join11(root, entry.path);
|
|
3916
3956
|
const stat = await lstat4(path).catch((error) => {
|
|
3917
3957
|
if (error.code === "ENOENT")
|
|
3918
3958
|
return null;
|
|
@@ -3931,7 +3971,7 @@ async function readBuildProvenance(projectDirectory) {
|
|
|
3931
3971
|
const original = configurations.get(entry.path);
|
|
3932
3972
|
if (contents && original && entry.mode !== "120000") {
|
|
3933
3973
|
try {
|
|
3934
|
-
const object =
|
|
3974
|
+
const object = z37.record(z37.string(), z37.unknown());
|
|
3935
3975
|
const actual = object.parse(JSON.parse(contents.toString("utf8")));
|
|
3936
3976
|
const expected = object.parse(JSON.parse(original));
|
|
3937
3977
|
if (!Object.hasOwn(expected, "version") && actual.version === 2)
|
|
@@ -3981,42 +4021,42 @@ function treeHash(entries) {
|
|
|
3981
4021
|
}
|
|
3982
4022
|
|
|
3983
4023
|
// ../cli/dist/commands/setup-deploy.js
|
|
3984
|
-
import { createHash as createHash4, randomBytes, randomUUID as
|
|
3985
|
-
import { access as
|
|
4024
|
+
import { createHash as createHash4, randomBytes as randomBytes2, randomUUID as randomUUID7 } from "crypto";
|
|
4025
|
+
import { access as access6, mkdir as mkdir9, mkdtemp, rm as rm5, writeFile as writeFile6 } from "fs/promises";
|
|
3986
4026
|
import { tmpdir } from "os";
|
|
3987
|
-
import { join as
|
|
3988
|
-
import { z as
|
|
3989
|
-
var envSchema =
|
|
3990
|
-
id:
|
|
3991
|
-
key:
|
|
3992
|
-
target:
|
|
3993
|
-
type:
|
|
3994
|
-
comment:
|
|
3995
|
-
updatedAt:
|
|
4027
|
+
import { join as join12 } from "path";
|
|
4028
|
+
import { z as z38 } from "zod";
|
|
4029
|
+
var envSchema = z38.object({
|
|
4030
|
+
id: z38.string(),
|
|
4031
|
+
key: z38.string(),
|
|
4032
|
+
target: z38.array(z38.string()),
|
|
4033
|
+
type: z38.string(),
|
|
4034
|
+
comment: z38.string().optional(),
|
|
4035
|
+
updatedAt: z38.number().optional()
|
|
3996
4036
|
});
|
|
3997
|
-
var deploymentSchema =
|
|
3998
|
-
id:
|
|
3999
|
-
projectId:
|
|
4000
|
-
ownerId:
|
|
4001
|
-
target:
|
|
4002
|
-
readyState:
|
|
4003
|
-
createdAt:
|
|
4004
|
-
url:
|
|
4005
|
-
meta:
|
|
4006
|
-
gitSource:
|
|
4037
|
+
var deploymentSchema = z38.object({
|
|
4038
|
+
id: z38.string(),
|
|
4039
|
+
projectId: z38.string(),
|
|
4040
|
+
ownerId: z38.string().optional(),
|
|
4041
|
+
target: z38.string().nullable(),
|
|
4042
|
+
readyState: z38.string(),
|
|
4043
|
+
createdAt: z38.number(),
|
|
4044
|
+
url: z38.string(),
|
|
4045
|
+
meta: z38.record(z38.string(), z38.unknown()).optional(),
|
|
4046
|
+
gitSource: z38.object({ sha: z38.string().optional() }).nullable().optional()
|
|
4007
4047
|
});
|
|
4008
|
-
var buildProofSchema =
|
|
4009
|
-
node:
|
|
4010
|
-
packageManager:
|
|
4011
|
-
packageManagerVersion:
|
|
4012
|
-
lockfileHash:
|
|
4013
|
-
revision:
|
|
4014
|
-
fieldContractHash:
|
|
4015
|
-
siteplane:
|
|
4016
|
-
runtimeNext:
|
|
4017
|
-
analytics:
|
|
4018
|
-
next:
|
|
4019
|
-
react:
|
|
4048
|
+
var buildProofSchema = z38.object({
|
|
4049
|
+
node: z38.string(),
|
|
4050
|
+
packageManager: z38.enum(["npm", "pnpm"]),
|
|
4051
|
+
packageManagerVersion: z38.string(),
|
|
4052
|
+
lockfileHash: z38.string(),
|
|
4053
|
+
revision: z38.string(),
|
|
4054
|
+
fieldContractHash: z38.string(),
|
|
4055
|
+
siteplane: z38.string(),
|
|
4056
|
+
runtimeNext: z38.string(),
|
|
4057
|
+
analytics: z38.string().optional(),
|
|
4058
|
+
next: z38.string(),
|
|
4059
|
+
react: z38.string()
|
|
4020
4060
|
}).strict();
|
|
4021
4061
|
var defaults = {
|
|
4022
4062
|
preflight: setupPreflightCommand,
|
|
@@ -4276,7 +4316,7 @@ async function emitBuildProof(projectDir, packages, revision, fieldContractHash)
|
|
|
4276
4316
|
let lock = null;
|
|
4277
4317
|
while (true) {
|
|
4278
4318
|
lock = await readFile13(
|
|
4279
|
-
|
|
4319
|
+
join13(
|
|
4280
4320
|
directory,
|
|
4281
4321
|
packageManager === "npm" ? "package-lock.json" : "pnpm-lock.yaml"
|
|
4282
4322
|
),
|