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/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname } from "path";
|
|
|
4
4
|
|
|
5
5
|
// ../shared/dist/actors.js
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
var ACTOR_TYPES = ["workspace_member", "site_member", "agent", "system"];
|
|
7
|
+
var ACTOR_TYPES = ["workspace_member", "site_member", "agent", "setup_guest", "system"];
|
|
8
8
|
var actorTypeSchema = z.enum(ACTOR_TYPES);
|
|
9
9
|
|
|
10
10
|
// ../shared/dist/analytics-defaults.js
|
|
@@ -1360,7 +1360,7 @@ var siteSetupTaskSchema = z16.object({
|
|
|
1360
1360
|
progress: siteSetupTaskProgressSchema.nullable(),
|
|
1361
1361
|
deployment: setupDeploymentRecordSchema.nullable(),
|
|
1362
1362
|
revalidationGeneration: z16.number().int().positive(),
|
|
1363
|
-
assignment: z16.
|
|
1363
|
+
assignment: z16.enum(["owned", "provisional", "claimed"]),
|
|
1364
1364
|
deadline: z16.string().datetime().nullable(),
|
|
1365
1365
|
userInstructions: z16.object({
|
|
1366
1366
|
text: siteSetupOwnerEditabilityNoteSchema,
|
|
@@ -2034,6 +2034,17 @@ var checkSetupAssetTargetInputSchema = z25.object({
|
|
|
2034
2034
|
intent: z25.enum(["start", "poll"])
|
|
2035
2035
|
}).strict();
|
|
2036
2036
|
|
|
2037
|
+
// ../shared/dist/setup-installation.js
|
|
2038
|
+
import { z as z26 } from "zod";
|
|
2039
|
+
var setupInstallationRequestSchema = z26.object({
|
|
2040
|
+
modules: siteSetupModulesSchema,
|
|
2041
|
+
ownerEditabilityNote: siteSetupOwnerEditabilityNoteSchema,
|
|
2042
|
+
provider: z26.object({
|
|
2043
|
+
projectId: z26.string().min(1).max(200),
|
|
2044
|
+
teamId: z26.string().min(1).max(200)
|
|
2045
|
+
}).strict()
|
|
2046
|
+
}).strict();
|
|
2047
|
+
|
|
2037
2048
|
// ../cli/dist/analytics/static-scan.js
|
|
2038
2049
|
import ts from "typescript";
|
|
2039
2050
|
|
|
@@ -2239,16 +2250,16 @@ function createAnalyticsCliRequestHeaders(config) {
|
|
|
2239
2250
|
}
|
|
2240
2251
|
|
|
2241
2252
|
// ../cli/dist/commands/analytics/public-key.js
|
|
2242
|
-
import { z as
|
|
2243
|
-
var responseSchema =
|
|
2244
|
-
ok:
|
|
2245
|
-
data:
|
|
2246
|
-
rawPublicKey:
|
|
2253
|
+
import { z as z27 } from "zod";
|
|
2254
|
+
var responseSchema = z27.object({
|
|
2255
|
+
ok: z27.literal(true),
|
|
2256
|
+
data: z27.object({
|
|
2257
|
+
rawPublicKey: z27.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/)
|
|
2247
2258
|
})
|
|
2248
2259
|
});
|
|
2249
|
-
var errorResponseSchema =
|
|
2250
|
-
error:
|
|
2251
|
-
code:
|
|
2260
|
+
var errorResponseSchema = z27.object({
|
|
2261
|
+
error: z27.object({
|
|
2262
|
+
code: z27.string().regex(/^[a-z][a-z0-9_.-]+$/u)
|
|
2252
2263
|
})
|
|
2253
2264
|
});
|
|
2254
2265
|
async function analyticsPublicKeyCommand(input) {
|
|
@@ -2270,13 +2281,13 @@ async function analyticsPublicKeyCommand(input) {
|
|
|
2270
2281
|
}
|
|
2271
2282
|
|
|
2272
2283
|
// ../cli/dist/commands/analytics/prepare.js
|
|
2273
|
-
import { z as
|
|
2274
|
-
var resultSchema =
|
|
2275
|
-
ok:
|
|
2276
|
-
data:
|
|
2277
|
-
rawPublicKey:
|
|
2278
|
-
generation:
|
|
2279
|
-
status:
|
|
2284
|
+
import { z as z28 } from "zod";
|
|
2285
|
+
var resultSchema = z28.object({
|
|
2286
|
+
ok: z28.literal(true),
|
|
2287
|
+
data: z28.object({
|
|
2288
|
+
rawPublicKey: z28.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/u),
|
|
2289
|
+
generation: z28.number().int().positive(),
|
|
2290
|
+
status: z28.enum([
|
|
2280
2291
|
"setup_started",
|
|
2281
2292
|
"test_mode",
|
|
2282
2293
|
"active",
|
|
@@ -2286,8 +2297,8 @@ var resultSchema = z27.object({
|
|
|
2286
2297
|
])
|
|
2287
2298
|
}).strict()
|
|
2288
2299
|
}).strict();
|
|
2289
|
-
var errorSchema =
|
|
2290
|
-
error:
|
|
2300
|
+
var errorSchema = z28.object({
|
|
2301
|
+
error: z28.object({ code: z28.string().regex(/^[a-z][a-z0-9_.-]+$/u) })
|
|
2291
2302
|
});
|
|
2292
2303
|
|
|
2293
2304
|
// ../cli/dist/commands/analytics/test.js
|
|
@@ -2482,19 +2493,19 @@ function requireContentExportScope(scopes) {
|
|
|
2482
2493
|
import { access, chmod, open, readFile as readFile5, rename, rm } from "fs/promises";
|
|
2483
2494
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2484
2495
|
import { join as join3 } from "path";
|
|
2485
|
-
import { z as
|
|
2486
|
-
var siteplaneProjectConfigSchema =
|
|
2487
|
-
version:
|
|
2488
|
-
apiBaseUrl:
|
|
2489
|
-
siteId:
|
|
2490
|
-
publicSiteKeyId:
|
|
2491
|
-
publicSiteKey:
|
|
2492
|
-
runId:
|
|
2493
|
-
appDirectory:
|
|
2494
|
-
taskContractVersion:
|
|
2495
|
-
adminProtocolVersion:
|
|
2496
|
+
import { z as z29 } from "zod";
|
|
2497
|
+
var siteplaneProjectConfigSchema = z29.object({
|
|
2498
|
+
version: z29.literal(2),
|
|
2499
|
+
apiBaseUrl: z29.string().url(),
|
|
2500
|
+
siteId: z29.string().uuid(),
|
|
2501
|
+
publicSiteKeyId: z29.string().uuid(),
|
|
2502
|
+
publicSiteKey: z29.string().trim().min(1),
|
|
2503
|
+
runId: z29.string().uuid(),
|
|
2504
|
+
appDirectory: z29.string().min(1),
|
|
2505
|
+
taskContractVersion: z29.literal("siteplane.setup-task.v2"),
|
|
2506
|
+
adminProtocolVersion: z29.literal(2),
|
|
2496
2507
|
packages: siteSetupPackagesSchema,
|
|
2497
|
-
fieldContractHash:
|
|
2508
|
+
fieldContractHash: z29.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2498
2509
|
}).strict();
|
|
2499
2510
|
async function readProjectPackageJson(projectDir) {
|
|
2500
2511
|
return JSON.parse(await readFile5(join3(projectDir, "package.json"), "utf8"));
|
|
@@ -2554,15 +2565,27 @@ import { randomUUID as randomUUID3 } from "crypto";
|
|
|
2554
2565
|
import { chmod as chmod2, lstat, mkdir as mkdir5, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
|
|
2555
2566
|
import { dirname as dirname5, join as join4, relative } from "path";
|
|
2556
2567
|
import { promisify } from "util";
|
|
2557
|
-
import { z as
|
|
2558
|
-
var
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2568
|
+
import { z as z30 } from "zod";
|
|
2569
|
+
var localSetupInstallationSchema = z30.object({
|
|
2570
|
+
key: z30.string().regex(/^[A-Za-z0-9_-]{43}$/u),
|
|
2571
|
+
idempotencyKey: z30.string().uuid(),
|
|
2572
|
+
apiBaseUrl: z30.string().url(),
|
|
2573
|
+
request: setupInstallationRequestSchema,
|
|
2574
|
+
bootstrapAcknowledged: z30.boolean()
|
|
2575
|
+
}).strict();
|
|
2576
|
+
var siteplaneCredentialsSchema = z30.object({
|
|
2577
|
+
accessToken: z30.string().trim().min(1),
|
|
2578
|
+
siteRevalidationSecret: z30.string().trim().min(1),
|
|
2579
|
+
installation: localSetupInstallationSchema.optional(),
|
|
2580
|
+
adminSession: z30.object({
|
|
2581
|
+
secret: z30.string().regex(/^[A-Za-z0-9_-]{43}$/u),
|
|
2582
|
+
generation: z30.string().uuid()
|
|
2564
2583
|
}).strict().optional()
|
|
2565
2584
|
}).strict();
|
|
2585
|
+
var localSetupCredentialsSchema = z30.union([
|
|
2586
|
+
siteplaneCredentialsSchema,
|
|
2587
|
+
z30.object({ installation: localSetupInstallationSchema }).strict()
|
|
2588
|
+
]);
|
|
2566
2589
|
async function assertLocalCredentialsPathSafe(projectDir, options = {}) {
|
|
2567
2590
|
const path = join4(projectDir, ".siteplane/credentials.json");
|
|
2568
2591
|
await assertCredentialFilesystemSafe(projectDir);
|
|
@@ -2598,15 +2621,25 @@ async function assertCredentialFilesystemSafe(projectDir) {
|
|
|
2598
2621
|
}
|
|
2599
2622
|
}
|
|
2600
2623
|
async function writeLocalCredentials(projectDir, credentials, options = {}) {
|
|
2624
|
+
return writeLocalSetupCredentials(projectDir, siteplaneCredentialsSchema.parse(credentials), options);
|
|
2625
|
+
}
|
|
2626
|
+
async function writeLocalSetupCredentials(projectDir, credentials, options = {}) {
|
|
2601
2627
|
const path = await assertLocalCredentialsPathSafe(projectDir, options);
|
|
2602
|
-
const parsed =
|
|
2628
|
+
const parsed = localSetupCredentialsSchema.parse(credentials);
|
|
2603
2629
|
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
2604
2630
|
await writeCredentialsAtomically(path, parsed);
|
|
2605
2631
|
return path;
|
|
2606
2632
|
}
|
|
2607
2633
|
async function readLocalCredentials(projectDir) {
|
|
2634
|
+
const credentials = await readLocalSetupCredentials(projectDir);
|
|
2635
|
+
if (!("accessToken" in credentials)) {
|
|
2636
|
+
throw new Error("setup_exchange_pending: Run siteplane setup start to finish the stored installation exchange.");
|
|
2637
|
+
}
|
|
2638
|
+
return credentials;
|
|
2639
|
+
}
|
|
2640
|
+
async function readLocalSetupCredentials(projectDir) {
|
|
2608
2641
|
await assertCredentialFilesystemSafe(projectDir);
|
|
2609
|
-
return
|
|
2642
|
+
return localSetupCredentialsSchema.parse(JSON.parse(await readFile6(join4(projectDir, ".siteplane/credentials.json"), "utf8")));
|
|
2610
2643
|
}
|
|
2611
2644
|
async function writeCredentialsAtomically(path, credentials) {
|
|
2612
2645
|
const temporaryPath = `${path}.${randomUUID3()}.tmp`;
|
|
@@ -2643,7 +2676,7 @@ async function gitPathMatches(projectDir, path, command) {
|
|
|
2643
2676
|
// ../cli/dist/commands/init.js
|
|
2644
2677
|
import { access as access3 } from "fs/promises";
|
|
2645
2678
|
import { join as join7, relative as relative3 } from "path";
|
|
2646
|
-
import { z as
|
|
2679
|
+
import { z as z33 } from "zod";
|
|
2647
2680
|
|
|
2648
2681
|
// ../cli/dist/commands/setup-preflight.js
|
|
2649
2682
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -2655,11 +2688,11 @@ import { parse as parseYaml } from "yaml";
|
|
|
2655
2688
|
import { createRequire } from "module";
|
|
2656
2689
|
import { readFile as readFile7 } from "fs/promises";
|
|
2657
2690
|
import { join as join5 } from "path";
|
|
2658
|
-
import { z as
|
|
2659
|
-
var packageSchema =
|
|
2660
|
-
name:
|
|
2661
|
-
version:
|
|
2662
|
-
peerDependencies:
|
|
2691
|
+
import { z as z31 } from "zod";
|
|
2692
|
+
var packageSchema = z31.object({
|
|
2693
|
+
name: z31.string().optional(),
|
|
2694
|
+
version: z31.string(),
|
|
2695
|
+
peerDependencies: z31.record(z31.string(), z31.string()).optional()
|
|
2663
2696
|
});
|
|
2664
2697
|
async function readInstalledPackage(projectDir, name2) {
|
|
2665
2698
|
const require2 = createRequire(join5(projectDir, "package.json"));
|
|
@@ -2677,7 +2710,7 @@ async function readInstalledPackage(projectDir, name2) {
|
|
|
2677
2710
|
// ../cli/dist/commands/setup-preflight.js
|
|
2678
2711
|
import { access as access2, readFile as readFile8, realpath, readdir, readlink } from "fs/promises";
|
|
2679
2712
|
import { dirname as dirname6, join as join6, relative as relative2, resolve, sep } from "path";
|
|
2680
|
-
import { z as
|
|
2713
|
+
import { z as z32 } from "zod";
|
|
2681
2714
|
|
|
2682
2715
|
// ../cli/dist/commands/setup-process.js
|
|
2683
2716
|
import { spawn } from "child_process";
|
|
@@ -2778,29 +2811,29 @@ async function setupVercelApi(cwd, endpoint, body, method, options) {
|
|
|
2778
2811
|
}
|
|
2779
2812
|
|
|
2780
2813
|
// ../cli/dist/commands/setup-preflight.js
|
|
2781
|
-
var manifestSchema =
|
|
2782
|
-
packageManager:
|
|
2783
|
-
engines:
|
|
2784
|
-
dependencies:
|
|
2785
|
-
devDependencies:
|
|
2786
|
-
scripts:
|
|
2787
|
-
workspaces:
|
|
2788
|
-
});
|
|
2789
|
-
var vercelProjectSchema =
|
|
2790
|
-
id:
|
|
2791
|
-
accountId:
|
|
2792
|
-
name:
|
|
2793
|
-
nodeVersion:
|
|
2794
|
-
rootDirectory:
|
|
2795
|
-
framework:
|
|
2796
|
-
installCommand:
|
|
2797
|
-
buildCommand:
|
|
2798
|
-
link:
|
|
2799
|
-
type:
|
|
2800
|
-
repo:
|
|
2801
|
-
repoId:
|
|
2802
|
-
org:
|
|
2803
|
-
productionBranch:
|
|
2814
|
+
var manifestSchema = z32.object({
|
|
2815
|
+
packageManager: z32.string().optional(),
|
|
2816
|
+
engines: z32.object({ node: z32.string().optional() }).optional(),
|
|
2817
|
+
dependencies: z32.record(z32.string(), z32.string()).optional(),
|
|
2818
|
+
devDependencies: z32.record(z32.string(), z32.string()).optional(),
|
|
2819
|
+
scripts: z32.record(z32.string(), z32.string()).optional(),
|
|
2820
|
+
workspaces: z32.unknown().optional()
|
|
2821
|
+
});
|
|
2822
|
+
var vercelProjectSchema = z32.object({
|
|
2823
|
+
id: z32.string(),
|
|
2824
|
+
accountId: z32.string(),
|
|
2825
|
+
name: z32.string(),
|
|
2826
|
+
nodeVersion: z32.string().nullable().optional(),
|
|
2827
|
+
rootDirectory: z32.string().nullable().optional(),
|
|
2828
|
+
framework: z32.string().nullable().optional(),
|
|
2829
|
+
installCommand: z32.string().nullable().optional(),
|
|
2830
|
+
buildCommand: z32.string().nullable().optional(),
|
|
2831
|
+
link: z32.object({
|
|
2832
|
+
type: z32.string(),
|
|
2833
|
+
repo: z32.string().optional(),
|
|
2834
|
+
repoId: z32.union([z32.string(), z32.number()]).optional(),
|
|
2835
|
+
org: z32.string().optional(),
|
|
2836
|
+
productionBranch: z32.string().optional()
|
|
2804
2837
|
}).nullable().optional()
|
|
2805
2838
|
});
|
|
2806
2839
|
var exists = async (path) => access2(path).then(() => true, () => false);
|
|
@@ -2857,9 +2890,9 @@ async function inspectSetupLocalProject(projectDir) {
|
|
|
2857
2890
|
const rootManifest = manifestSchema.parse(JSON.parse(await readFile8(join6(lockfileRoot, "package.json"), "utf8")));
|
|
2858
2891
|
if (lockfileRoot !== projectDirectory) {
|
|
2859
2892
|
const workspaceFile = join6(lockfileRoot, "pnpm-workspace.yaml");
|
|
2860
|
-
const workspace = lockName === "pnpm-lock.yaml" && await exists(workspaceFile) ?
|
|
2861
|
-
|
|
2862
|
-
|
|
2893
|
+
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([
|
|
2894
|
+
z32.array(z32.string()),
|
|
2895
|
+
z32.object({ packages: z32.array(z32.string()) }).transform((value) => value.packages)
|
|
2863
2896
|
]).parse(rootManifest.workspaces);
|
|
2864
2897
|
const selected = relative2(lockfileRoot, projectDirectory).split(sep).join("/");
|
|
2865
2898
|
if (!workspace.some((pattern) => !pattern.startsWith("!") && minimatch(selected, pattern)) || workspace.some((pattern) => pattern.startsWith("!") && minimatch(selected, pattern.slice(1))))
|
|
@@ -2873,11 +2906,11 @@ async function inspectSetupLocalProject(projectDir) {
|
|
|
2873
2906
|
break;
|
|
2874
2907
|
}
|
|
2875
2908
|
const lockText = await readFile8(join6(lockfileRoot, lockName), "utf8");
|
|
2876
|
-
const npmLock = lockName === "package-lock.json" ?
|
|
2877
|
-
lockfileVersion:
|
|
2878
|
-
packages:
|
|
2879
|
-
version:
|
|
2880
|
-
peerDependencies:
|
|
2909
|
+
const npmLock = lockName === "package-lock.json" ? z32.object({
|
|
2910
|
+
lockfileVersion: z32.number(),
|
|
2911
|
+
packages: z32.record(z32.string(), z32.object({
|
|
2912
|
+
version: z32.string().optional(),
|
|
2913
|
+
peerDependencies: z32.record(z32.string(), z32.string()).optional()
|
|
2881
2914
|
})).optional()
|
|
2882
2915
|
}).parse(JSON.parse(lockText)) : null;
|
|
2883
2916
|
async function version2(name3) {
|
|
@@ -3017,9 +3050,9 @@ async function setupPreflightCommand(input) {
|
|
|
3017
3050
|
linkDirectory = dirname6(linkDirectory);
|
|
3018
3051
|
if (!await exists(join6(linkDirectory, ".vercel/project.json")))
|
|
3019
3052
|
fail("vercel_project_not_linked", "Link this application to its intended Vercel project before setup; Siteplane will not guess a target.");
|
|
3020
|
-
const linked =
|
|
3021
|
-
projectId:
|
|
3022
|
-
orgId:
|
|
3053
|
+
const linked = z32.object({
|
|
3054
|
+
projectId: z32.string().regex(/^prj_[A-Za-z0-9]+$/u),
|
|
3055
|
+
orgId: z32.string().regex(/^(?:team|user)_[A-Za-z0-9]+$/u)
|
|
3023
3056
|
}).parse(JSON.parse(await readFile8(join6(linkDirectory, ".vercel/project.json"), "utf8")));
|
|
3024
3057
|
const project = vercelProjectSchema.parse(await setupVercelApi(linkDirectory, `/v9/projects/${linked.projectId}?teamId=${linked.orgId}`));
|
|
3025
3058
|
if (project.id !== linked.projectId || project.accountId !== linked.orgId)
|
|
@@ -3033,11 +3066,11 @@ async function setupPreflightCommand(input) {
|
|
|
3033
3066
|
fail("vercel_production_branch_conflict", "The local branch differs from the bound Vercel Production branch.");
|
|
3034
3067
|
if (project.link?.repo && project.link.org && !local.git.remote?.replace(/\.git$/u, "").endsWith(`${project.link.org}/${project.link.repo}`))
|
|
3035
3068
|
fail("vercel_git_conflict", "The local origin repository differs from the Vercel Git connection.");
|
|
3036
|
-
const env =
|
|
3037
|
-
envs:
|
|
3038
|
-
key:
|
|
3039
|
-
value:
|
|
3040
|
-
target:
|
|
3069
|
+
const env = z32.object({
|
|
3070
|
+
envs: z32.array(z32.object({
|
|
3071
|
+
key: z32.string(),
|
|
3072
|
+
value: z32.string().optional(),
|
|
3073
|
+
target: z32.array(z32.string()).optional()
|
|
3041
3074
|
}))
|
|
3042
3075
|
}).parse(await setupVercelApi(linkDirectory, `/v10/projects/${linked.projectId}/env?teamId=${linked.orgId}`));
|
|
3043
3076
|
const corepack = env.envs.some((item) => item.key === "ENABLE_EXPERIMENTAL_COREPACK" && item.value === "1" && item.target?.includes("production"));
|
|
@@ -3127,26 +3160,26 @@ async function initCommand(input) {
|
|
|
3127
3160
|
]
|
|
3128
3161
|
};
|
|
3129
3162
|
}
|
|
3130
|
-
var siteSetupBootstrapDataSchema =
|
|
3131
|
-
credentialPurpose:
|
|
3132
|
-
apiBaseUrl:
|
|
3133
|
-
siteId:
|
|
3134
|
-
publicSiteKeyId:
|
|
3135
|
-
publicSiteKey:
|
|
3136
|
-
accessToken:
|
|
3137
|
-
siteRevalidationSecret:
|
|
3138
|
-
runId:
|
|
3163
|
+
var siteSetupBootstrapDataSchema = z33.object({
|
|
3164
|
+
credentialPurpose: z33.literal("site_setup"),
|
|
3165
|
+
apiBaseUrl: z33.string().url(),
|
|
3166
|
+
siteId: z33.string().uuid(),
|
|
3167
|
+
publicSiteKeyId: z33.string().uuid(),
|
|
3168
|
+
publicSiteKey: z33.string().trim().min(1),
|
|
3169
|
+
accessToken: z33.string().trim().min(1),
|
|
3170
|
+
siteRevalidationSecret: z33.string().regex(/^[A-Za-z0-9_-]{43}$/u),
|
|
3171
|
+
runId: z33.string().uuid(),
|
|
3139
3172
|
packages: siteSetupPackagesSchema
|
|
3140
3173
|
}).strict();
|
|
3141
|
-
var featureBootstrapDataSchema =
|
|
3142
|
-
credentialPurpose:
|
|
3143
|
-
apiBaseUrl:
|
|
3144
|
-
siteId:
|
|
3145
|
-
accessToken:
|
|
3174
|
+
var featureBootstrapDataSchema = z33.object({
|
|
3175
|
+
credentialPurpose: z33.enum(["analytics", "booking"]),
|
|
3176
|
+
apiBaseUrl: z33.string().url(),
|
|
3177
|
+
siteId: z33.string().uuid(),
|
|
3178
|
+
accessToken: z33.string().trim().min(1)
|
|
3146
3179
|
}).strict();
|
|
3147
|
-
var bootstrapResponseSchema =
|
|
3148
|
-
ok:
|
|
3149
|
-
data:
|
|
3180
|
+
var bootstrapResponseSchema = z33.object({
|
|
3181
|
+
ok: z33.literal(true),
|
|
3182
|
+
data: z33.discriminatedUnion("credentialPurpose", [
|
|
3150
3183
|
siteSetupBootstrapDataSchema,
|
|
3151
3184
|
featureBootstrapDataSchema
|
|
3152
3185
|
])
|
|
@@ -3183,15 +3216,16 @@ async function acknowledgeBootstrapResponse(input) {
|
|
|
3183
3216
|
throw new Error("Siteplane setup acknowledgement failed.");
|
|
3184
3217
|
}
|
|
3185
3218
|
}
|
|
3186
|
-
async function persistSiteSetupBootstrap(input, bootstrap, appDirectory) {
|
|
3219
|
+
async function persistSiteSetupBootstrap(input, bootstrap, appDirectory, installation) {
|
|
3187
3220
|
const previous = await access3(join7(input.projectDir, "siteplane.config.json")).then(() => readProjectConfig(input.projectDir), () => null);
|
|
3188
3221
|
if (previous && (previous.siteId !== bootstrap.siteId || previous.runId !== bootstrap.runId || previous.publicSiteKeyId !== bootstrap.publicSiteKeyId || previous.publicSiteKey !== bootstrap.publicSiteKey))
|
|
3189
3222
|
throw new Error("The grant does not match this local Siteplane run. Preserve this directory and choose the correct owner connection.");
|
|
3190
|
-
const previousCredentials = previous ? await access3(join7(input.projectDir, ".siteplane/credentials.json")).then(() =>
|
|
3223
|
+
const previousCredentials = previous ? await access3(join7(input.projectDir, ".siteplane/credentials.json")).then(() => readLocalSetupCredentials(input.projectDir), () => null) : null;
|
|
3191
3224
|
const credentialsPath = await writeLocalCredentials(input.projectDir, {
|
|
3192
|
-
...previousCredentials
|
|
3225
|
+
...previousCredentials && "adminSession" in previousCredentials && previousCredentials.adminSession ? { adminSession: previousCredentials.adminSession } : {},
|
|
3193
3226
|
accessToken: bootstrap.accessToken,
|
|
3194
|
-
siteRevalidationSecret: bootstrap.siteRevalidationSecret
|
|
3227
|
+
siteRevalidationSecret: bootstrap.siteRevalidationSecret,
|
|
3228
|
+
...installation ?? previousCredentials?.installation ? { installation: installation ?? previousCredentials?.installation } : {}
|
|
3195
3229
|
}, {
|
|
3196
3230
|
...input.isIgnoredFile ? { isIgnoredFile: input.isIgnoredFile } : {},
|
|
3197
3231
|
...input.isTrackedFile ? { isTrackedFile: input.isTrackedFile } : {}
|
|
@@ -3304,7 +3338,7 @@ async function collectSourceFiles(directory) {
|
|
|
3304
3338
|
import { execFile as execFile2 } from "child_process";
|
|
3305
3339
|
import { readFile as readFile9 } from "fs/promises";
|
|
3306
3340
|
import { promisify as promisify2 } from "util";
|
|
3307
|
-
import { z as
|
|
3341
|
+
import { z as z34 } from "zod";
|
|
3308
3342
|
|
|
3309
3343
|
// ../cli/dist/scan/next-source-scan.js
|
|
3310
3344
|
import ts2 from "typescript";
|
|
@@ -3314,32 +3348,32 @@ var editableComponentNames = new Set(["Image", "Text", "LongText", "Link"].map((
|
|
|
3314
3348
|
|
|
3315
3349
|
// ../cli/dist/commands/site-setup.js
|
|
3316
3350
|
var execFileAsync2 = promisify2(execFile2);
|
|
3317
|
-
var safeErrorSchema =
|
|
3318
|
-
code:
|
|
3319
|
-
message:
|
|
3351
|
+
var safeErrorSchema = z34.object({
|
|
3352
|
+
code: z34.string().trim().min(1),
|
|
3353
|
+
message: z34.string().trim().min(1)
|
|
3320
3354
|
}).passthrough();
|
|
3321
|
-
var errorResponseSchema2 =
|
|
3322
|
-
var contextDataSchema =
|
|
3355
|
+
var errorResponseSchema2 = z34.object({ ok: z34.literal(false), error: safeErrorSchema }).passthrough();
|
|
3356
|
+
var contextDataSchema = z34.object({
|
|
3323
3357
|
task: siteSetupTaskSchema.refine((task) => task.run !== null)
|
|
3324
3358
|
}).strict();
|
|
3325
|
-
var contextResponseSchema =
|
|
3326
|
-
var applyDataSchema =
|
|
3327
|
-
status:
|
|
3328
|
-
runId:
|
|
3329
|
-
contractVersionId:
|
|
3330
|
-
fieldContractHash:
|
|
3331
|
-
editorDefinitionHash:
|
|
3332
|
-
fieldCount:
|
|
3333
|
-
routeCount:
|
|
3359
|
+
var contextResponseSchema = z34.object({ ok: z34.literal(true), data: contextDataSchema }).strict();
|
|
3360
|
+
var applyDataSchema = z34.object({
|
|
3361
|
+
status: z34.enum(["applied", "ready_for_review"]),
|
|
3362
|
+
runId: z34.string().uuid().optional(),
|
|
3363
|
+
contractVersionId: z34.string().uuid().optional(),
|
|
3364
|
+
fieldContractHash: z34.string().regex(/^sha256:[0-9a-f]{64}$/u),
|
|
3365
|
+
editorDefinitionHash: z34.string().regex(/^sha256:[0-9a-f]{64}$/u).optional(),
|
|
3366
|
+
fieldCount: z34.number().int().nonnegative().optional(),
|
|
3367
|
+
routeCount: z34.number().int().nonnegative().optional()
|
|
3334
3368
|
}).strict();
|
|
3335
|
-
var applyResponseSchema =
|
|
3336
|
-
var verifyDataSchema =
|
|
3337
|
-
status:
|
|
3338
|
-
runId:
|
|
3339
|
-
deploymentOrigin:
|
|
3340
|
-
deploymentRevision:
|
|
3369
|
+
var applyResponseSchema = z34.object({ ok: z34.literal(true), data: applyDataSchema }).strict();
|
|
3370
|
+
var verifyDataSchema = z34.object({
|
|
3371
|
+
status: z34.literal("ready_for_review"),
|
|
3372
|
+
runId: z34.string().uuid().optional(),
|
|
3373
|
+
deploymentOrigin: z34.string().url().optional(),
|
|
3374
|
+
deploymentRevision: z34.string().optional()
|
|
3341
3375
|
}).strict();
|
|
3342
|
-
var verifyResponseSchema =
|
|
3376
|
+
var verifyResponseSchema = z34.object({ ok: z34.literal(true), data: verifyDataSchema }).strict();
|
|
3343
3377
|
async function siteSetupContextCommand(input) {
|
|
3344
3378
|
const response = await postSiteSetup(input, "context", {});
|
|
3345
3379
|
const parsed = contextResponseSchema.safeParse(response.payload);
|
|
@@ -3432,42 +3466,52 @@ async function readGitRevision(projectDir) {
|
|
|
3432
3466
|
return revision;
|
|
3433
3467
|
}
|
|
3434
3468
|
|
|
3469
|
+
// ../cli/dist/commands/setup-start.js
|
|
3470
|
+
import { randomBytes, randomUUID as randomUUID4 } from "crypto";
|
|
3471
|
+
import { access as access4 } from "fs/promises";
|
|
3472
|
+
import { join as join9, relative as relative5 } from "path";
|
|
3473
|
+
import { z as z35 } from "zod";
|
|
3474
|
+
var bootstrapResponseSchema2 = z35.object({
|
|
3475
|
+
ok: z35.literal(true),
|
|
3476
|
+
data: siteSetupBootstrapDataSchema
|
|
3477
|
+
}).strict();
|
|
3478
|
+
|
|
3435
3479
|
// ../cli/dist/commands/setup-prepare.js
|
|
3436
|
-
import { access as
|
|
3437
|
-
import { randomUUID as
|
|
3438
|
-
import { dirname as dirname7, join as
|
|
3480
|
+
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";
|
|
3481
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
3482
|
+
import { dirname as dirname7, join as join10, relative as relative6, sep as sep2 } from "path";
|
|
3439
3483
|
import ts3 from "typescript";
|
|
3440
3484
|
|
|
3441
3485
|
// ../cli/dist/commands/setup-lock.js
|
|
3442
|
-
import { randomUUID as
|
|
3486
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
3443
3487
|
import { lstat as lstat3, mkdir as mkdir7, open as open4, readFile as readFile11, rm as rm4, rmdir } from "fs/promises";
|
|
3444
3488
|
import { resolve as resolve2 } from "path";
|
|
3445
|
-
import { z as
|
|
3446
|
-
var ownerSchema =
|
|
3489
|
+
import { z as z36 } from "zod";
|
|
3490
|
+
var ownerSchema = z36.object({ pid: z36.number().int().positive(), nonce: z36.string().uuid() }).strict();
|
|
3447
3491
|
|
|
3448
3492
|
// ../cli/dist/config/build-provenance.js
|
|
3449
3493
|
import { createHash as createHash3 } from "crypto";
|
|
3450
3494
|
import { execFile as execFile3 } from "child_process";
|
|
3451
3495
|
import { lstat as lstat4, readFile as readFile12, writeFile as writeFile5, mkdir as mkdir8 } from "fs/promises";
|
|
3452
|
-
import { dirname as dirname8, isAbsolute as isAbsolute2, join as
|
|
3496
|
+
import { dirname as dirname8, isAbsolute as isAbsolute2, join as join11, relative as relative7, resolve as resolve3, sep as sep3 } from "path";
|
|
3453
3497
|
import { isDeepStrictEqual, promisify as promisify3 } from "util";
|
|
3454
|
-
import { z as
|
|
3498
|
+
import { z as z37 } from "zod";
|
|
3455
3499
|
var execute = promisify3(execFile3);
|
|
3456
3500
|
var name = ".siteplane/build-source.json";
|
|
3457
|
-
var oid =
|
|
3458
|
-
var entrySchema =
|
|
3459
|
-
path:
|
|
3460
|
-
mode:
|
|
3501
|
+
var oid = z37.string().regex(/^[0-9a-f]{40}$/u);
|
|
3502
|
+
var entrySchema = z37.object({
|
|
3503
|
+
path: z37.string().min(1).max(4096),
|
|
3504
|
+
mode: z37.enum(["100644", "100755", "120000"]),
|
|
3461
3505
|
oid
|
|
3462
3506
|
}).strict();
|
|
3463
|
-
var schema =
|
|
3464
|
-
version:
|
|
3507
|
+
var schema = z37.object({
|
|
3508
|
+
version: z37.literal(2),
|
|
3465
3509
|
revision: oid,
|
|
3466
|
-
commit:
|
|
3467
|
-
entries:
|
|
3468
|
-
providerConfigurations:
|
|
3469
|
-
path:
|
|
3470
|
-
source:
|
|
3510
|
+
commit: z37.string().min(1).max(1048576),
|
|
3511
|
+
entries: z37.array(entrySchema).min(1).max(1e5),
|
|
3512
|
+
providerConfigurations: z37.array(z37.object({
|
|
3513
|
+
path: z37.string().max(4096).regex(/(?:^|\/)vercel\.json$/u),
|
|
3514
|
+
source: z37.string().max(1048576)
|
|
3471
3515
|
}).strict()).max(1e3)
|
|
3472
3516
|
}).strict();
|
|
3473
3517
|
async function writeBuildProvenance(checkout, revision) {
|
|
@@ -3489,15 +3533,15 @@ async function writeBuildProvenance(checkout, revision) {
|
|
|
3489
3533
|
if (entry.mode !== "120000")
|
|
3490
3534
|
continue;
|
|
3491
3535
|
const { readlink: readlink2 } = await import("fs/promises");
|
|
3492
|
-
const path =
|
|
3536
|
+
const path = join11(checkout, entry.path);
|
|
3493
3537
|
const target2 = resolve3(dirname8(path), await readlink2(path));
|
|
3494
|
-
const bound =
|
|
3538
|
+
const bound = relative7(checkout, target2);
|
|
3495
3539
|
if (bound.startsWith("..") || isAbsolute2(bound))
|
|
3496
3540
|
throw new Error("A tracked symbolic link escapes the committed upload; resolve that source boundary before deployment.");
|
|
3497
3541
|
}
|
|
3498
3542
|
const providerConfigurations = await Promise.all(entries.filter((entry) => /(?:^|\/)vercel\.json$/u.test(entry.path)).map(async (entry) => ({
|
|
3499
3543
|
path: entry.path,
|
|
3500
|
-
source: await readFile12(
|
|
3544
|
+
source: await readFile12(join11(checkout, entry.path), "utf8")
|
|
3501
3545
|
})));
|
|
3502
3546
|
const record = schema.parse({
|
|
3503
3547
|
version: 2,
|
|
@@ -3506,48 +3550,48 @@ async function writeBuildProvenance(checkout, revision) {
|
|
|
3506
3550
|
entries,
|
|
3507
3551
|
providerConfigurations
|
|
3508
3552
|
});
|
|
3509
|
-
const target =
|
|
3553
|
+
const target = join11(checkout, name);
|
|
3510
3554
|
await mkdir8(dirname8(target), { recursive: true, mode: 448 });
|
|
3511
3555
|
await writeFile5(target, JSON.stringify(record), { flag: "wx", mode: 384 });
|
|
3512
3556
|
}
|
|
3513
3557
|
|
|
3514
3558
|
// ../cli/dist/commands/setup-deploy.js
|
|
3515
|
-
import { createHash as createHash4, randomBytes, randomUUID as
|
|
3516
|
-
import { access as
|
|
3559
|
+
import { createHash as createHash4, randomBytes as randomBytes2, randomUUID as randomUUID7 } from "crypto";
|
|
3560
|
+
import { access as access6, mkdir as mkdir9, mkdtemp, rm as rm5, writeFile as writeFile6 } from "fs/promises";
|
|
3517
3561
|
import { tmpdir } from "os";
|
|
3518
|
-
import { join as
|
|
3519
|
-
import { z as
|
|
3520
|
-
var envSchema =
|
|
3521
|
-
id:
|
|
3522
|
-
key:
|
|
3523
|
-
target:
|
|
3524
|
-
type:
|
|
3525
|
-
comment:
|
|
3526
|
-
updatedAt:
|
|
3527
|
-
});
|
|
3528
|
-
var deploymentSchema =
|
|
3529
|
-
id:
|
|
3530
|
-
projectId:
|
|
3531
|
-
ownerId:
|
|
3532
|
-
target:
|
|
3533
|
-
readyState:
|
|
3534
|
-
createdAt:
|
|
3535
|
-
url:
|
|
3536
|
-
meta:
|
|
3537
|
-
gitSource:
|
|
3538
|
-
});
|
|
3539
|
-
var buildProofSchema =
|
|
3540
|
-
node:
|
|
3541
|
-
packageManager:
|
|
3542
|
-
packageManagerVersion:
|
|
3543
|
-
lockfileHash:
|
|
3544
|
-
revision:
|
|
3545
|
-
fieldContractHash:
|
|
3546
|
-
siteplane:
|
|
3547
|
-
runtimeNext:
|
|
3548
|
-
analytics:
|
|
3549
|
-
next:
|
|
3550
|
-
react:
|
|
3562
|
+
import { join as join12 } from "path";
|
|
3563
|
+
import { z as z38 } from "zod";
|
|
3564
|
+
var envSchema = z38.object({
|
|
3565
|
+
id: z38.string(),
|
|
3566
|
+
key: z38.string(),
|
|
3567
|
+
target: z38.array(z38.string()),
|
|
3568
|
+
type: z38.string(),
|
|
3569
|
+
comment: z38.string().optional(),
|
|
3570
|
+
updatedAt: z38.number().optional()
|
|
3571
|
+
});
|
|
3572
|
+
var deploymentSchema = z38.object({
|
|
3573
|
+
id: z38.string(),
|
|
3574
|
+
projectId: z38.string(),
|
|
3575
|
+
ownerId: z38.string().optional(),
|
|
3576
|
+
target: z38.string().nullable(),
|
|
3577
|
+
readyState: z38.string(),
|
|
3578
|
+
createdAt: z38.number(),
|
|
3579
|
+
url: z38.string(),
|
|
3580
|
+
meta: z38.record(z38.string(), z38.unknown()).optional(),
|
|
3581
|
+
gitSource: z38.object({ sha: z38.string().optional() }).nullable().optional()
|
|
3582
|
+
});
|
|
3583
|
+
var buildProofSchema = z38.object({
|
|
3584
|
+
node: z38.string(),
|
|
3585
|
+
packageManager: z38.enum(["npm", "pnpm"]),
|
|
3586
|
+
packageManagerVersion: z38.string(),
|
|
3587
|
+
lockfileHash: z38.string(),
|
|
3588
|
+
revision: z38.string(),
|
|
3589
|
+
fieldContractHash: z38.string(),
|
|
3590
|
+
siteplane: z38.string(),
|
|
3591
|
+
runtimeNext: z38.string(),
|
|
3592
|
+
analytics: z38.string().optional(),
|
|
3593
|
+
next: z38.string(),
|
|
3594
|
+
react: z38.string()
|
|
3551
3595
|
}).strict();
|
|
3552
3596
|
var defaults = {
|
|
3553
3597
|
preflight: setupPreflightCommand,
|