siteplane 0.1.39 → 0.1.41
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 +15 -0
- package/dist/bin/siteplane.js +237 -300
- package/dist/index.js +204 -159
- package/dist/next.js +127 -82
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1014,11 +1014,48 @@ var CONTINUE_SITE_SETUP_LOCATOR_HINT_MAX_BYTES = 512;
|
|
|
1014
1014
|
var CONTINUE_SITE_SETUP_REQUESTED_LABEL_MAX_BYTES = 120;
|
|
1015
1015
|
var CONTINUE_SITE_SETUP_REQUESTED_SECTION_MAX_BYTES = 120;
|
|
1016
1016
|
var CONTINUE_SITE_SETUP_REQUESTED_SUBSECTION_MAX_BYTES = 120;
|
|
1017
|
+
var SITE_SETUP_OWNER_EDITABILITY_NOTE_MAX_LENGTH = 2e3;
|
|
1018
|
+
var SITE_SETUP_OWNER_EDITABILITY_NOTE_MAX_BYTES = 8e3;
|
|
1017
1019
|
var CONTINUE_SITE_SETUP_ITEMS_MAX_BYTES = 32 * 1024;
|
|
1018
1020
|
var CONTINUE_SITE_SETUP_HTTP_BODY_MAX_BYTES = 64 * 1024;
|
|
1019
1021
|
var siteSetupRunStatusSchema = z14.enum(SITE_SETUP_RUN_STATUSES);
|
|
1020
1022
|
var siteSetupRunModeSchema = z14.enum(SITE_SETUP_RUN_MODES);
|
|
1021
1023
|
var siteSetupErrorCodeSchema = z14.enum(SITE_SETUP_ERROR_CODES);
|
|
1024
|
+
var siteSetupTaskSchema = z14.object({
|
|
1025
|
+
contractVersion: z14.literal("siteplane.setup-task.v1"),
|
|
1026
|
+
workflow: z14.enum(["initial_setup", "structure_update"]),
|
|
1027
|
+
goal: z14.string().min(1),
|
|
1028
|
+
modules: z14.tuple([z14.literal("visual_editor")]),
|
|
1029
|
+
packages: z14.object({
|
|
1030
|
+
siteplane: z14.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u),
|
|
1031
|
+
runtimeNext: z14.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
1032
|
+
}).strict(),
|
|
1033
|
+
communication: z14.object({
|
|
1034
|
+
beforeSourceChanges: z14.string().min(1),
|
|
1035
|
+
updates: z14.array(z14.string().min(1)).min(1),
|
|
1036
|
+
blocker: z14.string().min(1)
|
|
1037
|
+
}).strict(),
|
|
1038
|
+
discovery: z14.object({
|
|
1039
|
+
inspectPublicRoutes: z14.boolean(),
|
|
1040
|
+
contentKinds: z14.array(z14.enum(["text", "longText", "link", "image"])).min(1),
|
|
1041
|
+
rules: z14.array(z14.string().min(1)).min(1)
|
|
1042
|
+
}).strict(),
|
|
1043
|
+
steps: z14.array(z14.object({
|
|
1044
|
+
id: z14.enum([
|
|
1045
|
+
"inspect_repository",
|
|
1046
|
+
"install_packages",
|
|
1047
|
+
"instrument_fields",
|
|
1048
|
+
"apply_contract",
|
|
1049
|
+
"deploy_production",
|
|
1050
|
+
"verify_deployment"
|
|
1051
|
+
]),
|
|
1052
|
+
instruction: z14.string().min(1)
|
|
1053
|
+
}).strict()).length(6),
|
|
1054
|
+
completion: z14.object({
|
|
1055
|
+
verifiedStatus: z14.literal("ready_for_review"),
|
|
1056
|
+
instruction: z14.string().min(1)
|
|
1057
|
+
}).strict()
|
|
1058
|
+
}).strict();
|
|
1022
1059
|
var editorFieldSchema = z14.object({
|
|
1023
1060
|
fieldId: fieldIdSchema,
|
|
1024
1061
|
label: z14.string().trim().min(1),
|
|
@@ -1103,6 +1140,7 @@ var editorDefinitionV1Schema = z14.object({
|
|
|
1103
1140
|
}
|
|
1104
1141
|
});
|
|
1105
1142
|
var forbiddenControlOrBidi = /[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u;
|
|
1143
|
+
var forbiddenOwnerNoteControlOrBidi = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u;
|
|
1106
1144
|
var unsafeLocator = /<\/?[a-z][^>]*>|\b(?:javascript|data:text\/html)\s*:|\bon[a-z]+\s*=/iu;
|
|
1107
1145
|
var renderedPathSchema = z14.string().trim().transform((value) => value !== "/" ? value.replace(/\/+$/u, "") : value).superRefine((value, context) => {
|
|
1108
1146
|
if (!value.startsWith("/") || value === "$global" || value.includes("?") || value.includes("#")) {
|
|
@@ -1155,6 +1193,20 @@ var setupCorrectionItemsSchema = z14.array(setupCorrectionItemSchema).max(CONTIN
|
|
|
1155
1193
|
});
|
|
1156
1194
|
}
|
|
1157
1195
|
});
|
|
1196
|
+
var siteSetupOwnerEditabilityNoteSchema = z14.string().trim().max(SITE_SETUP_OWNER_EDITABILITY_NOTE_MAX_LENGTH).superRefine((value, context) => {
|
|
1197
|
+
if (utf8Bytes(value) > SITE_SETUP_OWNER_EDITABILITY_NOTE_MAX_BYTES) {
|
|
1198
|
+
context.addIssue({
|
|
1199
|
+
code: "custom",
|
|
1200
|
+
message: `ownerEditabilityNote exceeds ${SITE_SETUP_OWNER_EDITABILITY_NOTE_MAX_BYTES} UTF-8 bytes.`
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
if (forbiddenOwnerNoteControlOrBidi.test(value)) {
|
|
1204
|
+
context.addIssue({
|
|
1205
|
+
code: "custom",
|
|
1206
|
+
message: "ownerEditabilityNote contains a forbidden control or bidi character."
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1158
1210
|
var canonicalHashSchema = z14.string().regex(/^sha256:[0-9a-f]{64}$/iu);
|
|
1159
1211
|
var deploymentRevisionSchema = normalizedSafeTextSchema(256, "deploymentRevision");
|
|
1160
1212
|
var continueSiteSetupInputSchema = z14.object({
|
|
@@ -1162,7 +1214,15 @@ var continueSiteSetupInputSchema = z14.object({
|
|
|
1162
1214
|
runId: z14.string().uuid(),
|
|
1163
1215
|
expectedFieldContractHash: canonicalHashSchema,
|
|
1164
1216
|
expectedDeploymentRevision: deploymentRevisionSchema,
|
|
1165
|
-
correctionItems: setupCorrectionItemsSchema
|
|
1217
|
+
correctionItems: setupCorrectionItemsSchema,
|
|
1218
|
+
ownerEditabilityNote: siteSetupOwnerEditabilityNoteSchema.optional()
|
|
1219
|
+
}).strict();
|
|
1220
|
+
var saveSiteSetupOwnerNoteInputSchema = z14.object({
|
|
1221
|
+
siteId: z14.string().uuid(),
|
|
1222
|
+
runId: z14.string().uuid(),
|
|
1223
|
+
expectedFieldContractHash: canonicalHashSchema,
|
|
1224
|
+
expectedDeploymentRevision: deploymentRevisionSchema,
|
|
1225
|
+
ownerEditabilityNote: siteSetupOwnerEditabilityNoteSchema
|
|
1166
1226
|
}).strict();
|
|
1167
1227
|
var siteSetupContextInputSchema = z14.object({}).strict();
|
|
1168
1228
|
var siteSetupApplyInputSchema = z14.object({
|
|
@@ -1327,6 +1387,7 @@ var FIELD_BRIDGE_MESSAGE_TYPES = [
|
|
|
1327
1387
|
"siteplane:field-bridge:preview-ack",
|
|
1328
1388
|
"siteplane:field-bridge:set-visual-control-state",
|
|
1329
1389
|
"siteplane:field-bridge:missing-content",
|
|
1390
|
+
"siteplane:field-bridge:preview-scrolled",
|
|
1330
1391
|
"siteplane:field-bridge:error"
|
|
1331
1392
|
];
|
|
1332
1393
|
var canonicalFieldContractHashSchema = z15.string().regex(/^sha256:[0-9a-f]{64}$/u);
|
|
@@ -1457,6 +1518,10 @@ var fieldBridgeMissingContentMessageSchema = fieldBridgeBaseSchema.extend({
|
|
|
1457
1518
|
suggestedSection: bridgeSectionSchema.optional()
|
|
1458
1519
|
}).strict()
|
|
1459
1520
|
});
|
|
1521
|
+
var fieldBridgePreviewScrolledMessageSchema = fieldBridgeBaseSchema.extend({
|
|
1522
|
+
type: z15.literal("siteplane:field-bridge:preview-scrolled"),
|
|
1523
|
+
payload: z15.object({ renderedPath: realRenderedPathSchema }).strict()
|
|
1524
|
+
});
|
|
1460
1525
|
var fieldBridgeErrorMessageSchema = fieldBridgeBaseSchema.extend({
|
|
1461
1526
|
type: z15.literal("siteplane:field-bridge:error"),
|
|
1462
1527
|
payload: z15.object({
|
|
@@ -1476,6 +1541,7 @@ var fieldBridgeMessageSchema = z15.discriminatedUnion("type", [
|
|
|
1476
1541
|
fieldBridgePreviewAckMessageSchema,
|
|
1477
1542
|
fieldBridgeSetVisualControlStateMessageSchema,
|
|
1478
1543
|
fieldBridgeMissingContentMessageSchema,
|
|
1544
|
+
fieldBridgePreviewScrolledMessageSchema,
|
|
1479
1545
|
fieldBridgeErrorMessageSchema
|
|
1480
1546
|
]);
|
|
1481
1547
|
|
|
@@ -1989,49 +2055,75 @@ async function bookingTestCommand(input) {
|
|
|
1989
2055
|
});
|
|
1990
2056
|
}
|
|
1991
2057
|
|
|
1992
|
-
// ../cli/dist/commands/
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
2058
|
+
// ../cli/dist/commands/export.js
|
|
2059
|
+
async function exportCommand(input) {
|
|
2060
|
+
requireContentExportScope(input.tokenScopes);
|
|
2061
|
+
const values = await input.readPublishedValues();
|
|
2062
|
+
if (input.format === "prompt") {
|
|
2063
|
+
return {
|
|
2064
|
+
kind: "prompt",
|
|
2065
|
+
output: Object.entries(values).map(([fieldId, value]) => `${fieldId}: ${JSON.stringify(value)}`).join("\n")
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
return {
|
|
2069
|
+
kind: "json",
|
|
2070
|
+
values
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
function requireContentExportScope(scopes) {
|
|
2074
|
+
if (!scopes?.includes("content:export")) {
|
|
2075
|
+
throw new Error("A Project Connection with content:export is required.");
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
1996
2078
|
|
|
1997
|
-
// ../cli/dist/config/
|
|
1998
|
-
import {
|
|
2079
|
+
// ../cli/dist/config/project-config.js
|
|
2080
|
+
import { access, chmod, open, readFile as readFile5, rename, rm } from "fs/promises";
|
|
1999
2081
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2000
|
-
import {
|
|
2001
|
-
import { dirname as dirname5, join as join3, relative } from "path";
|
|
2002
|
-
import { promisify } from "util";
|
|
2082
|
+
import { join as join3 } from "path";
|
|
2003
2083
|
import { z as z24 } from "zod";
|
|
2004
|
-
var
|
|
2005
|
-
|
|
2006
|
-
|
|
2084
|
+
var siteplaneProjectConfigSchema = z24.object({
|
|
2085
|
+
version: z24.literal(1),
|
|
2086
|
+
apiBaseUrl: z24.string().url(),
|
|
2087
|
+
siteId: z24.string().uuid(),
|
|
2088
|
+
publicSiteKeyId: z24.string().uuid(),
|
|
2089
|
+
publicSiteKey: z24.string().trim().min(1),
|
|
2090
|
+
fieldContractHash: z24.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2007
2091
|
}).strict();
|
|
2008
|
-
async function
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2092
|
+
async function readProjectPackageJson(projectDir) {
|
|
2093
|
+
return JSON.parse(await readFile5(join3(projectDir, "package.json"), "utf8"));
|
|
2094
|
+
}
|
|
2095
|
+
async function detectNextProject(projectDir) {
|
|
2096
|
+
const packageJson = await readProjectPackageJson(projectDir).catch(() => null);
|
|
2097
|
+
if (packageJson?.dependencies?.next || packageJson?.devDependencies?.next) {
|
|
2098
|
+
return true;
|
|
2014
2099
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2100
|
+
for (const fileName of [
|
|
2101
|
+
"next.config.js",
|
|
2102
|
+
"next.config.mjs",
|
|
2103
|
+
"next.config.ts"
|
|
2104
|
+
]) {
|
|
2105
|
+
try {
|
|
2106
|
+
await access(join3(projectDir, fileName));
|
|
2107
|
+
return true;
|
|
2108
|
+
} catch {
|
|
2109
|
+
}
|
|
2017
2110
|
}
|
|
2018
|
-
return
|
|
2111
|
+
return false;
|
|
2019
2112
|
}
|
|
2020
|
-
async function
|
|
2021
|
-
const path =
|
|
2022
|
-
const parsed =
|
|
2023
|
-
await
|
|
2024
|
-
await writeCredentialsAtomically(path, parsed);
|
|
2113
|
+
async function writeProjectConfig(projectDir, config) {
|
|
2114
|
+
const path = join3(projectDir, "siteplane.config.json");
|
|
2115
|
+
const parsed = siteplaneProjectConfigSchema.parse(config);
|
|
2116
|
+
await writeJsonAtomically(path, parsed, 420);
|
|
2025
2117
|
return path;
|
|
2026
2118
|
}
|
|
2027
|
-
async function
|
|
2028
|
-
return
|
|
2119
|
+
async function readProjectConfig(projectDir) {
|
|
2120
|
+
return siteplaneProjectConfigSchema.parse(JSON.parse(await readFile5(join3(projectDir, "siteplane.config.json"), "utf8")));
|
|
2029
2121
|
}
|
|
2030
|
-
async function
|
|
2122
|
+
async function writeJsonAtomically(path, value, mode) {
|
|
2031
2123
|
const temporaryPath = `${path}.${randomUUID2()}.tmp`;
|
|
2032
|
-
const file = await open(temporaryPath, "wx",
|
|
2124
|
+
const file = await open(temporaryPath, "wx", mode);
|
|
2033
2125
|
try {
|
|
2034
|
-
await file.writeFile(`${JSON.stringify(
|
|
2126
|
+
await file.writeFile(`${JSON.stringify(value, null, 2)}
|
|
2035
2127
|
`, "utf8");
|
|
2036
2128
|
await file.sync();
|
|
2037
2129
|
} catch (error) {
|
|
@@ -2042,71 +2134,51 @@ async function writeCredentialsAtomically(path, credentials) {
|
|
|
2042
2134
|
await file.close();
|
|
2043
2135
|
try {
|
|
2044
2136
|
await rename(temporaryPath, path);
|
|
2045
|
-
await chmod(path,
|
|
2137
|
+
await chmod(path, mode);
|
|
2046
2138
|
} catch (error) {
|
|
2047
2139
|
await rm(temporaryPath, { force: true });
|
|
2048
2140
|
throw error;
|
|
2049
2141
|
}
|
|
2050
2142
|
}
|
|
2051
|
-
var execFileAsync = promisify(execFile);
|
|
2052
|
-
async function gitPathMatches(projectDir, path, command) {
|
|
2053
|
-
const args = command === "check-ignore" ? ["check-ignore", "--quiet", relative(projectDir, path)] : ["ls-files", "--error-unmatch", relative(projectDir, path)];
|
|
2054
|
-
try {
|
|
2055
|
-
await execFileAsync("git", args, { cwd: projectDir });
|
|
2056
|
-
return true;
|
|
2057
|
-
} catch {
|
|
2058
|
-
return false;
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
2143
|
|
|
2062
|
-
// ../cli/dist/config/
|
|
2063
|
-
import {
|
|
2144
|
+
// ../cli/dist/config/credentials.js
|
|
2145
|
+
import { execFile } from "child_process";
|
|
2064
2146
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
2065
|
-
import {
|
|
2147
|
+
import { chmod as chmod2, mkdir as mkdir5, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
|
|
2148
|
+
import { dirname as dirname5, join as join4, relative } from "path";
|
|
2149
|
+
import { promisify } from "util";
|
|
2066
2150
|
import { z as z25 } from "zod";
|
|
2067
|
-
var
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
siteId: z25.string().uuid(),
|
|
2071
|
-
publicSiteKeyId: z25.string().uuid(),
|
|
2072
|
-
publicSiteKey: z25.string().trim().min(1),
|
|
2073
|
-
fieldContractHash: z25.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2151
|
+
var siteplaneCredentialsSchema = z25.object({
|
|
2152
|
+
accessToken: z25.string().trim().min(1),
|
|
2153
|
+
siteRevalidationSecret: z25.string().trim().min(1)
|
|
2074
2154
|
}).strict();
|
|
2075
|
-
async function
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
return true;
|
|
2155
|
+
async function assertLocalCredentialsPathSafe(projectDir, options = {}) {
|
|
2156
|
+
const path = join4(projectDir, ".siteplane/credentials.json");
|
|
2157
|
+
const isTrackedFile = options.isTrackedFile ?? ((targetPath) => gitPathMatches(projectDir, targetPath, "ls-files"));
|
|
2158
|
+
const isIgnoredFile = options.isIgnoredFile ?? ((targetPath) => gitPathMatches(projectDir, targetPath, "check-ignore"));
|
|
2159
|
+
if (await isTrackedFile(path)) {
|
|
2160
|
+
throw new Error("Refusing to write Siteplane credentials into a tracked file.");
|
|
2082
2161
|
}
|
|
2083
|
-
|
|
2084
|
-
"
|
|
2085
|
-
"next.config.mjs",
|
|
2086
|
-
"next.config.ts"
|
|
2087
|
-
]) {
|
|
2088
|
-
try {
|
|
2089
|
-
await access(join4(projectDir, fileName));
|
|
2090
|
-
return true;
|
|
2091
|
-
} catch {
|
|
2092
|
-
}
|
|
2162
|
+
if (!await isIgnoredFile(path)) {
|
|
2163
|
+
throw new Error("Add .siteplane/credentials.json to .gitignore before running Siteplane init.");
|
|
2093
2164
|
}
|
|
2094
|
-
return
|
|
2165
|
+
return path;
|
|
2095
2166
|
}
|
|
2096
|
-
async function
|
|
2097
|
-
const path =
|
|
2098
|
-
const parsed =
|
|
2099
|
-
await
|
|
2167
|
+
async function writeLocalCredentials(projectDir, credentials, options = {}) {
|
|
2168
|
+
const path = await assertLocalCredentialsPathSafe(projectDir, options);
|
|
2169
|
+
const parsed = siteplaneCredentialsSchema.parse(credentials);
|
|
2170
|
+
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
2171
|
+
await writeCredentialsAtomically(path, parsed);
|
|
2100
2172
|
return path;
|
|
2101
2173
|
}
|
|
2102
|
-
async function
|
|
2103
|
-
return
|
|
2174
|
+
async function readLocalCredentials(projectDir) {
|
|
2175
|
+
return siteplaneCredentialsSchema.parse(JSON.parse(await readFile6(join4(projectDir, ".siteplane/credentials.json"), "utf8")));
|
|
2104
2176
|
}
|
|
2105
|
-
async function
|
|
2177
|
+
async function writeCredentialsAtomically(path, credentials) {
|
|
2106
2178
|
const temporaryPath = `${path}.${randomUUID3()}.tmp`;
|
|
2107
|
-
const file = await open2(temporaryPath, "wx",
|
|
2179
|
+
const file = await open2(temporaryPath, "wx", 384);
|
|
2108
2180
|
try {
|
|
2109
|
-
await file.writeFile(`${JSON.stringify(
|
|
2181
|
+
await file.writeFile(`${JSON.stringify(credentials, null, 2)}
|
|
2110
2182
|
`, "utf8");
|
|
2111
2183
|
await file.sync();
|
|
2112
2184
|
} catch (error) {
|
|
@@ -2117,12 +2189,22 @@ async function writeJsonAtomically(path, value, mode) {
|
|
|
2117
2189
|
await file.close();
|
|
2118
2190
|
try {
|
|
2119
2191
|
await rename2(temporaryPath, path);
|
|
2120
|
-
await chmod2(path,
|
|
2192
|
+
await chmod2(path, 384);
|
|
2121
2193
|
} catch (error) {
|
|
2122
2194
|
await rm2(temporaryPath, { force: true });
|
|
2123
2195
|
throw error;
|
|
2124
2196
|
}
|
|
2125
2197
|
}
|
|
2198
|
+
var execFileAsync = promisify(execFile);
|
|
2199
|
+
async function gitPathMatches(projectDir, path, command) {
|
|
2200
|
+
const args = command === "check-ignore" ? ["check-ignore", "--quiet", relative(projectDir, path)] : ["ls-files", "--error-unmatch", relative(projectDir, path)];
|
|
2201
|
+
try {
|
|
2202
|
+
await execFileAsync("git", args, { cwd: projectDir });
|
|
2203
|
+
return true;
|
|
2204
|
+
} catch {
|
|
2205
|
+
return false;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2126
2208
|
|
|
2127
2209
|
// ../cli/dist/commands/init.js
|
|
2128
2210
|
import { join as join5 } from "path";
|
|
@@ -2140,9 +2222,9 @@ async function initCommand(input) {
|
|
|
2140
2222
|
return {
|
|
2141
2223
|
...paths,
|
|
2142
2224
|
nextSteps: [
|
|
2143
|
-
"npx siteplane setup context",
|
|
2144
|
-
"
|
|
2145
|
-
"
|
|
2225
|
+
"Run npx siteplane setup context and read the returned task.",
|
|
2226
|
+
"Before source changes, briefly tell the user what Siteplane requested and what you will do.",
|
|
2227
|
+
"Follow the returned steps through setup verify and stop only at ready_for_review or action_required."
|
|
2146
2228
|
]
|
|
2147
2229
|
};
|
|
2148
2230
|
}
|
|
@@ -2261,45 +2343,6 @@ function readErrorMessage(payload) {
|
|
|
2261
2343
|
return null;
|
|
2262
2344
|
}
|
|
2263
2345
|
|
|
2264
|
-
// ../cli/dist/commands/connect.js
|
|
2265
|
-
var claimResponseSchema = z27.object({
|
|
2266
|
-
ok: z27.literal(true),
|
|
2267
|
-
data: z27.object({
|
|
2268
|
-
pairingId: z27.string().uuid(),
|
|
2269
|
-
status: z27.literal("approval_required"),
|
|
2270
|
-
approvalUrl: z27.string().url()
|
|
2271
|
-
}).passthrough()
|
|
2272
|
-
}).strict();
|
|
2273
|
-
var waitingResponseSchema = z27.object({
|
|
2274
|
-
ok: z27.literal(true),
|
|
2275
|
-
data: z27.object({ status: z27.literal("approval_required") }).strict()
|
|
2276
|
-
}).strict();
|
|
2277
|
-
var bootstrapResponseSchema2 = z27.object({
|
|
2278
|
-
ok: z27.literal(true),
|
|
2279
|
-
data: siteSetupBootstrapDataSchema
|
|
2280
|
-
}).strict();
|
|
2281
|
-
|
|
2282
|
-
// ../cli/dist/commands/export.js
|
|
2283
|
-
async function exportCommand(input) {
|
|
2284
|
-
requireContentExportScope(input.tokenScopes);
|
|
2285
|
-
const values = await input.readPublishedValues();
|
|
2286
|
-
if (input.format === "prompt") {
|
|
2287
|
-
return {
|
|
2288
|
-
kind: "prompt",
|
|
2289
|
-
output: Object.entries(values).map(([fieldId, value]) => `${fieldId}: ${JSON.stringify(value)}`).join("\n")
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
return {
|
|
2293
|
-
kind: "json",
|
|
2294
|
-
values
|
|
2295
|
-
};
|
|
2296
|
-
}
|
|
2297
|
-
function requireContentExportScope(scopes) {
|
|
2298
|
-
if (!scopes?.includes("content:export")) {
|
|
2299
|
-
throw new Error("A Project Connection with content:export is required.");
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
2346
|
// ../cli/dist/commands/scan.js
|
|
2304
2347
|
import { readdir } from "fs/promises";
|
|
2305
2348
|
import { extname, join as join6 } from "path";
|
|
@@ -2308,7 +2351,7 @@ import { extname, join as join6 } from "path";
|
|
|
2308
2351
|
import { execFile as execFile2 } from "child_process";
|
|
2309
2352
|
import { readFile as readFile7 } from "fs/promises";
|
|
2310
2353
|
import { promisify as promisify2 } from "util";
|
|
2311
|
-
import { z as
|
|
2354
|
+
import { z as z27 } from "zod";
|
|
2312
2355
|
|
|
2313
2356
|
// ../cli/dist/scan/next-source-scan.js
|
|
2314
2357
|
import ts2 from "typescript";
|
|
@@ -2318,52 +2361,54 @@ var editableComponentNames = new Set(["Image", "Text", "LongText", "Link"].map((
|
|
|
2318
2361
|
|
|
2319
2362
|
// ../cli/dist/commands/site-setup.js
|
|
2320
2363
|
var execFileAsync2 = promisify2(execFile2);
|
|
2321
|
-
var safeErrorSchema =
|
|
2322
|
-
code:
|
|
2323
|
-
message:
|
|
2364
|
+
var safeErrorSchema = z27.object({
|
|
2365
|
+
code: z27.string().trim().min(1),
|
|
2366
|
+
message: z27.string().trim().min(1)
|
|
2324
2367
|
}).passthrough();
|
|
2325
|
-
var errorResponseSchema2 =
|
|
2326
|
-
var contextDataSchema =
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2368
|
+
var errorResponseSchema2 = z27.object({ ok: z27.literal(false), error: safeErrorSchema }).passthrough();
|
|
2369
|
+
var contextDataSchema = z27.object({
|
|
2370
|
+
task: siteSetupTaskSchema,
|
|
2371
|
+
site: z27.object({ siteId: z27.string().uuid(), portalPath: z27.string() }),
|
|
2372
|
+
run: z27.object({
|
|
2373
|
+
runId: z27.string().uuid(),
|
|
2374
|
+
mode: z27.enum(["initial", "update"]),
|
|
2375
|
+
status: z27.enum([
|
|
2332
2376
|
"waiting_for_agent",
|
|
2333
2377
|
"working",
|
|
2334
2378
|
"action_required",
|
|
2335
2379
|
"ready_for_review"
|
|
2336
2380
|
]),
|
|
2337
|
-
fieldContractHash:
|
|
2338
|
-
deploymentOrigin:
|
|
2339
|
-
deploymentRevision:
|
|
2340
|
-
errorCode:
|
|
2341
|
-
errorMessage:
|
|
2381
|
+
fieldContractHash: z27.string().nullable(),
|
|
2382
|
+
deploymentOrigin: z27.string().nullable(),
|
|
2383
|
+
deploymentRevision: z27.string().nullable(),
|
|
2384
|
+
errorCode: z27.string().nullable(),
|
|
2385
|
+
errorMessage: z27.string().nullable()
|
|
2342
2386
|
}),
|
|
2343
|
-
structureHandoff:
|
|
2344
|
-
pendingFields:
|
|
2387
|
+
structureHandoff: z27.object({
|
|
2388
|
+
pendingFields: z27.array(setupCorrectionItemSchema).max(50),
|
|
2389
|
+
ownerEditabilityNote: siteSetupOwnerEditabilityNoteSchema
|
|
2345
2390
|
}).strict().nullable(),
|
|
2346
|
-
allowedTasks:
|
|
2347
|
-
requiredEnvironmentNames:
|
|
2391
|
+
allowedTasks: z27.array(z27.string()),
|
|
2392
|
+
requiredEnvironmentNames: z27.array(z27.string())
|
|
2348
2393
|
}).strict();
|
|
2349
|
-
var contextResponseSchema =
|
|
2350
|
-
var applyDataSchema =
|
|
2351
|
-
status:
|
|
2352
|
-
runId:
|
|
2353
|
-
contractVersionId:
|
|
2354
|
-
fieldContractHash:
|
|
2355
|
-
editorDefinitionHash:
|
|
2356
|
-
fieldCount:
|
|
2357
|
-
routeCount:
|
|
2394
|
+
var contextResponseSchema = z27.object({ ok: z27.literal(true), data: contextDataSchema }).strict();
|
|
2395
|
+
var applyDataSchema = z27.object({
|
|
2396
|
+
status: z27.enum(["applied", "ready_for_review"]),
|
|
2397
|
+
runId: z27.string().uuid().optional(),
|
|
2398
|
+
contractVersionId: z27.string().uuid().optional(),
|
|
2399
|
+
fieldContractHash: z27.string().regex(/^sha256:[0-9a-f]{64}$/u),
|
|
2400
|
+
editorDefinitionHash: z27.string().regex(/^sha256:[0-9a-f]{64}$/u).optional(),
|
|
2401
|
+
fieldCount: z27.number().int().nonnegative().optional(),
|
|
2402
|
+
routeCount: z27.number().int().nonnegative().optional()
|
|
2358
2403
|
}).strict();
|
|
2359
|
-
var applyResponseSchema =
|
|
2360
|
-
var verifyDataSchema =
|
|
2361
|
-
status:
|
|
2362
|
-
runId:
|
|
2363
|
-
deploymentOrigin:
|
|
2364
|
-
deploymentRevision:
|
|
2404
|
+
var applyResponseSchema = z27.object({ ok: z27.literal(true), data: applyDataSchema }).strict();
|
|
2405
|
+
var verifyDataSchema = z27.object({
|
|
2406
|
+
status: z27.literal("ready_for_review"),
|
|
2407
|
+
runId: z27.string().uuid().optional(),
|
|
2408
|
+
deploymentOrigin: z27.string().url().optional(),
|
|
2409
|
+
deploymentRevision: z27.string().optional()
|
|
2365
2410
|
}).strict();
|
|
2366
|
-
var verifyResponseSchema =
|
|
2411
|
+
var verifyResponseSchema = z27.object({ ok: z27.literal(true), data: verifyDataSchema }).strict();
|
|
2367
2412
|
export {
|
|
2368
2413
|
bookingCheckCommand,
|
|
2369
2414
|
bookingInitCommand,
|