siteplane 0.1.37 → 0.1.38
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/bin/siteplane.js +82 -74
- package/dist/index.js +78 -74
- package/dist/next.js +23 -23
- package/package.json +1 -1
package/dist/bin/siteplane.js
CHANGED
|
@@ -2924,54 +2924,44 @@ async function bookingTestCommand(input) {
|
|
|
2924
2924
|
import { randomBytes } from "crypto";
|
|
2925
2925
|
import { z as z27 } from "zod";
|
|
2926
2926
|
|
|
2927
|
-
// ../cli/dist/config/
|
|
2928
|
-
import {
|
|
2927
|
+
// ../cli/dist/config/credentials.js
|
|
2928
|
+
import { execFile } from "child_process";
|
|
2929
2929
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2930
|
-
import {
|
|
2930
|
+
import { chmod, mkdir as mkdir5, open, readFile as readFile5, rename, rm } from "fs/promises";
|
|
2931
|
+
import { dirname as dirname5, join as join3, relative } from "path";
|
|
2932
|
+
import { promisify } from "util";
|
|
2931
2933
|
import { z as z24 } from "zod";
|
|
2932
|
-
var
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
siteId: z24.string().uuid(),
|
|
2936
|
-
publicSiteKeyId: z24.string().uuid(),
|
|
2937
|
-
publicSiteKey: z24.string().trim().min(1),
|
|
2938
|
-
fieldContractHash: z24.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2934
|
+
var siteplaneCredentialsSchema = z24.object({
|
|
2935
|
+
accessToken: z24.string().trim().min(1),
|
|
2936
|
+
siteRevalidationSecret: z24.string().trim().min(1)
|
|
2939
2937
|
}).strict();
|
|
2940
|
-
async function
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
return true;
|
|
2938
|
+
async function assertLocalCredentialsPathSafe(projectDir, options = {}) {
|
|
2939
|
+
const path = join3(projectDir, ".siteplane/credentials.json");
|
|
2940
|
+
const isTrackedFile = options.isTrackedFile ?? ((targetPath) => gitPathMatches(projectDir, targetPath, "ls-files"));
|
|
2941
|
+
const isIgnoredFile = options.isIgnoredFile ?? ((targetPath) => gitPathMatches(projectDir, targetPath, "check-ignore"));
|
|
2942
|
+
if (await isTrackedFile(path)) {
|
|
2943
|
+
throw new Error("Refusing to write Siteplane credentials into a tracked file.");
|
|
2947
2944
|
}
|
|
2948
|
-
|
|
2949
|
-
"
|
|
2950
|
-
"next.config.mjs",
|
|
2951
|
-
"next.config.ts"
|
|
2952
|
-
]) {
|
|
2953
|
-
try {
|
|
2954
|
-
await access(join3(projectDir, fileName));
|
|
2955
|
-
return true;
|
|
2956
|
-
} catch {
|
|
2957
|
-
}
|
|
2945
|
+
if (!await isIgnoredFile(path)) {
|
|
2946
|
+
throw new Error("Add .siteplane/credentials.json to .gitignore before running Siteplane connect.");
|
|
2958
2947
|
}
|
|
2959
|
-
return
|
|
2948
|
+
return path;
|
|
2960
2949
|
}
|
|
2961
|
-
async function
|
|
2962
|
-
const path =
|
|
2963
|
-
const parsed =
|
|
2964
|
-
await
|
|
2950
|
+
async function writeLocalCredentials(projectDir, credentials, options = {}) {
|
|
2951
|
+
const path = await assertLocalCredentialsPathSafe(projectDir, options);
|
|
2952
|
+
const parsed = siteplaneCredentialsSchema.parse(credentials);
|
|
2953
|
+
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
2954
|
+
await writeCredentialsAtomically(path, parsed);
|
|
2965
2955
|
return path;
|
|
2966
2956
|
}
|
|
2967
|
-
async function
|
|
2968
|
-
return
|
|
2957
|
+
async function readLocalCredentials(projectDir) {
|
|
2958
|
+
return siteplaneCredentialsSchema.parse(JSON.parse(await readFile5(join3(projectDir, ".siteplane/credentials.json"), "utf8")));
|
|
2969
2959
|
}
|
|
2970
|
-
async function
|
|
2960
|
+
async function writeCredentialsAtomically(path, credentials) {
|
|
2971
2961
|
const temporaryPath = `${path}.${randomUUID2()}.tmp`;
|
|
2972
|
-
const file = await open(temporaryPath, "wx",
|
|
2962
|
+
const file = await open(temporaryPath, "wx", 384);
|
|
2973
2963
|
try {
|
|
2974
|
-
await file.writeFile(`${JSON.stringify(
|
|
2964
|
+
await file.writeFile(`${JSON.stringify(credentials, null, 2)}
|
|
2975
2965
|
`, "utf8");
|
|
2976
2966
|
await file.sync();
|
|
2977
2967
|
} catch (error) {
|
|
@@ -2982,47 +2972,71 @@ async function writeJsonAtomically(path, value, mode) {
|
|
|
2982
2972
|
await file.close();
|
|
2983
2973
|
try {
|
|
2984
2974
|
await rename(temporaryPath, path);
|
|
2985
|
-
await chmod(path,
|
|
2975
|
+
await chmod(path, 384);
|
|
2986
2976
|
} catch (error) {
|
|
2987
2977
|
await rm(temporaryPath, { force: true });
|
|
2988
2978
|
throw error;
|
|
2989
2979
|
}
|
|
2990
2980
|
}
|
|
2981
|
+
var execFileAsync = promisify(execFile);
|
|
2982
|
+
async function gitPathMatches(projectDir, path, command) {
|
|
2983
|
+
const args = command === "check-ignore" ? ["check-ignore", "--quiet", relative(projectDir, path)] : ["ls-files", "--error-unmatch", relative(projectDir, path)];
|
|
2984
|
+
try {
|
|
2985
|
+
await execFileAsync("git", args, { cwd: projectDir });
|
|
2986
|
+
return true;
|
|
2987
|
+
} catch {
|
|
2988
|
+
return false;
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
2991
|
|
|
2992
|
-
// ../cli/dist/config/
|
|
2993
|
-
import {
|
|
2992
|
+
// ../cli/dist/config/project-config.js
|
|
2993
|
+
import { access, chmod as chmod2, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
|
|
2994
2994
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
2995
|
-
import {
|
|
2996
|
-
import { dirname as dirname5, join as join4, relative } from "path";
|
|
2997
|
-
import { promisify } from "util";
|
|
2995
|
+
import { join as join4 } from "path";
|
|
2998
2996
|
import { z as z25 } from "zod";
|
|
2999
|
-
var
|
|
3000
|
-
|
|
3001
|
-
|
|
2997
|
+
var siteplaneProjectConfigSchema = z25.object({
|
|
2998
|
+
version: z25.literal(1),
|
|
2999
|
+
apiBaseUrl: z25.string().url(),
|
|
3000
|
+
siteId: z25.string().uuid(),
|
|
3001
|
+
publicSiteKeyId: z25.string().uuid(),
|
|
3002
|
+
publicSiteKey: z25.string().trim().min(1),
|
|
3003
|
+
fieldContractHash: z25.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
3002
3004
|
}).strict();
|
|
3003
|
-
async function
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3005
|
+
async function readProjectPackageJson(projectDir) {
|
|
3006
|
+
return JSON.parse(await readFile6(join4(projectDir, "package.json"), "utf8"));
|
|
3007
|
+
}
|
|
3008
|
+
async function detectNextProject(projectDir) {
|
|
3009
|
+
const packageJson = await readProjectPackageJson(projectDir).catch(() => null);
|
|
3010
|
+
if (packageJson?.dependencies?.next || packageJson?.devDependencies?.next) {
|
|
3011
|
+
return true;
|
|
3009
3012
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3013
|
+
for (const fileName of [
|
|
3014
|
+
"next.config.js",
|
|
3015
|
+
"next.config.mjs",
|
|
3016
|
+
"next.config.ts"
|
|
3017
|
+
]) {
|
|
3018
|
+
try {
|
|
3019
|
+
await access(join4(projectDir, fileName));
|
|
3020
|
+
return true;
|
|
3021
|
+
} catch {
|
|
3022
|
+
}
|
|
3012
3023
|
}
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3024
|
+
return false;
|
|
3025
|
+
}
|
|
3026
|
+
async function writeProjectConfig(projectDir, config) {
|
|
3027
|
+
const path = join4(projectDir, "siteplane.config.json");
|
|
3028
|
+
const parsed = siteplaneProjectConfigSchema.parse(config);
|
|
3029
|
+
await writeJsonAtomically(path, parsed, 420);
|
|
3016
3030
|
return path;
|
|
3017
3031
|
}
|
|
3018
|
-
async function
|
|
3019
|
-
return
|
|
3032
|
+
async function readProjectConfig(projectDir) {
|
|
3033
|
+
return siteplaneProjectConfigSchema.parse(JSON.parse(await readFile6(join4(projectDir, "siteplane.config.json"), "utf8")));
|
|
3020
3034
|
}
|
|
3021
|
-
async function
|
|
3035
|
+
async function writeJsonAtomically(path, value, mode) {
|
|
3022
3036
|
const temporaryPath = `${path}.${randomUUID3()}.tmp`;
|
|
3023
|
-
const file = await open2(temporaryPath, "wx",
|
|
3037
|
+
const file = await open2(temporaryPath, "wx", mode);
|
|
3024
3038
|
try {
|
|
3025
|
-
await file.writeFile(`${JSON.stringify(
|
|
3039
|
+
await file.writeFile(`${JSON.stringify(value, null, 2)}
|
|
3026
3040
|
`, "utf8");
|
|
3027
3041
|
await file.sync();
|
|
3028
3042
|
} catch (error) {
|
|
@@ -3033,22 +3047,12 @@ async function writeCredentialsAtomically(path, credentials) {
|
|
|
3033
3047
|
await file.close();
|
|
3034
3048
|
try {
|
|
3035
3049
|
await rename2(temporaryPath, path);
|
|
3036
|
-
await chmod2(path,
|
|
3050
|
+
await chmod2(path, mode);
|
|
3037
3051
|
} catch (error) {
|
|
3038
3052
|
await rm2(temporaryPath, { force: true });
|
|
3039
3053
|
throw error;
|
|
3040
3054
|
}
|
|
3041
3055
|
}
|
|
3042
|
-
var execFileAsync = promisify(execFile);
|
|
3043
|
-
async function gitPathMatches(projectDir, path, command) {
|
|
3044
|
-
const args = command === "check-ignore" ? ["check-ignore", "--quiet", relative(projectDir, path)] : ["ls-files", "--error-unmatch", relative(projectDir, path)];
|
|
3045
|
-
try {
|
|
3046
|
-
await execFileAsync("git", args, { cwd: projectDir });
|
|
3047
|
-
return true;
|
|
3048
|
-
} catch {
|
|
3049
|
-
return false;
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
3056
|
|
|
3053
3057
|
// ../cli/dist/commands/init.js
|
|
3054
3058
|
import { join as join5 } from "path";
|
|
@@ -3207,6 +3211,10 @@ async function connectCommand(input) {
|
|
|
3207
3211
|
if (!await detectNextProject(input.projectDir)) {
|
|
3208
3212
|
throw new Error("Siteplane connect currently supports Next.js projects.");
|
|
3209
3213
|
}
|
|
3214
|
+
await assertLocalCredentialsPathSafe(input.projectDir, {
|
|
3215
|
+
...input.isIgnoredFile ? { isIgnoredFile: input.isIgnoredFile } : {},
|
|
3216
|
+
...input.isTrackedFile ? { isTrackedFile: input.isTrackedFile } : {}
|
|
3217
|
+
});
|
|
3210
3218
|
const fetcher = input.fetcher ?? fetch;
|
|
3211
3219
|
const pollSecret = randomBytes(32).toString("base64url");
|
|
3212
3220
|
const envelopeKey = randomBytes(32).toString("base64url");
|
|
@@ -4021,7 +4029,7 @@ var safeErrorSchema = z28.object({
|
|
|
4021
4029
|
}).passthrough();
|
|
4022
4030
|
var errorResponseSchema2 = z28.object({ ok: z28.literal(false), error: safeErrorSchema }).passthrough();
|
|
4023
4031
|
var contextDataSchema = z28.object({
|
|
4024
|
-
site: z28.object({ siteId: z28.string().uuid(),
|
|
4032
|
+
site: z28.object({ siteId: z28.string().uuid(), portalPath: z28.string() }),
|
|
4025
4033
|
run: z28.object({
|
|
4026
4034
|
runId: z28.string().uuid(),
|
|
4027
4035
|
mode: z28.enum(["initial", "update"]),
|
package/dist/index.js
CHANGED
|
@@ -1993,54 +1993,44 @@ async function bookingTestCommand(input) {
|
|
|
1993
1993
|
import { randomBytes } from "crypto";
|
|
1994
1994
|
import { z as z27 } from "zod";
|
|
1995
1995
|
|
|
1996
|
-
// ../cli/dist/config/
|
|
1997
|
-
import {
|
|
1996
|
+
// ../cli/dist/config/credentials.js
|
|
1997
|
+
import { execFile } from "child_process";
|
|
1998
1998
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1999
|
-
import {
|
|
1999
|
+
import { chmod, mkdir as mkdir5, open, readFile as readFile5, rename, rm } from "fs/promises";
|
|
2000
|
+
import { dirname as dirname5, join as join3, relative } from "path";
|
|
2001
|
+
import { promisify } from "util";
|
|
2000
2002
|
import { z as z24 } from "zod";
|
|
2001
|
-
var
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
siteId: z24.string().uuid(),
|
|
2005
|
-
publicSiteKeyId: z24.string().uuid(),
|
|
2006
|
-
publicSiteKey: z24.string().trim().min(1),
|
|
2007
|
-
fieldContractHash: z24.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2003
|
+
var siteplaneCredentialsSchema = z24.object({
|
|
2004
|
+
accessToken: z24.string().trim().min(1),
|
|
2005
|
+
siteRevalidationSecret: z24.string().trim().min(1)
|
|
2008
2006
|
}).strict();
|
|
2009
|
-
async function
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
return true;
|
|
2007
|
+
async function assertLocalCredentialsPathSafe(projectDir, options = {}) {
|
|
2008
|
+
const path = join3(projectDir, ".siteplane/credentials.json");
|
|
2009
|
+
const isTrackedFile = options.isTrackedFile ?? ((targetPath) => gitPathMatches(projectDir, targetPath, "ls-files"));
|
|
2010
|
+
const isIgnoredFile = options.isIgnoredFile ?? ((targetPath) => gitPathMatches(projectDir, targetPath, "check-ignore"));
|
|
2011
|
+
if (await isTrackedFile(path)) {
|
|
2012
|
+
throw new Error("Refusing to write Siteplane credentials into a tracked file.");
|
|
2016
2013
|
}
|
|
2017
|
-
|
|
2018
|
-
"
|
|
2019
|
-
"next.config.mjs",
|
|
2020
|
-
"next.config.ts"
|
|
2021
|
-
]) {
|
|
2022
|
-
try {
|
|
2023
|
-
await access(join3(projectDir, fileName));
|
|
2024
|
-
return true;
|
|
2025
|
-
} catch {
|
|
2026
|
-
}
|
|
2014
|
+
if (!await isIgnoredFile(path)) {
|
|
2015
|
+
throw new Error("Add .siteplane/credentials.json to .gitignore before running Siteplane connect.");
|
|
2027
2016
|
}
|
|
2028
|
-
return
|
|
2017
|
+
return path;
|
|
2029
2018
|
}
|
|
2030
|
-
async function
|
|
2031
|
-
const path =
|
|
2032
|
-
const parsed =
|
|
2033
|
-
await
|
|
2019
|
+
async function writeLocalCredentials(projectDir, credentials, options = {}) {
|
|
2020
|
+
const path = await assertLocalCredentialsPathSafe(projectDir, options);
|
|
2021
|
+
const parsed = siteplaneCredentialsSchema.parse(credentials);
|
|
2022
|
+
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
2023
|
+
await writeCredentialsAtomically(path, parsed);
|
|
2034
2024
|
return path;
|
|
2035
2025
|
}
|
|
2036
|
-
async function
|
|
2037
|
-
return
|
|
2026
|
+
async function readLocalCredentials(projectDir) {
|
|
2027
|
+
return siteplaneCredentialsSchema.parse(JSON.parse(await readFile5(join3(projectDir, ".siteplane/credentials.json"), "utf8")));
|
|
2038
2028
|
}
|
|
2039
|
-
async function
|
|
2029
|
+
async function writeCredentialsAtomically(path, credentials) {
|
|
2040
2030
|
const temporaryPath = `${path}.${randomUUID2()}.tmp`;
|
|
2041
|
-
const file = await open(temporaryPath, "wx",
|
|
2031
|
+
const file = await open(temporaryPath, "wx", 384);
|
|
2042
2032
|
try {
|
|
2043
|
-
await file.writeFile(`${JSON.stringify(
|
|
2033
|
+
await file.writeFile(`${JSON.stringify(credentials, null, 2)}
|
|
2044
2034
|
`, "utf8");
|
|
2045
2035
|
await file.sync();
|
|
2046
2036
|
} catch (error) {
|
|
@@ -2051,47 +2041,71 @@ async function writeJsonAtomically(path, value, mode) {
|
|
|
2051
2041
|
await file.close();
|
|
2052
2042
|
try {
|
|
2053
2043
|
await rename(temporaryPath, path);
|
|
2054
|
-
await chmod(path,
|
|
2044
|
+
await chmod(path, 384);
|
|
2055
2045
|
} catch (error) {
|
|
2056
2046
|
await rm(temporaryPath, { force: true });
|
|
2057
2047
|
throw error;
|
|
2058
2048
|
}
|
|
2059
2049
|
}
|
|
2050
|
+
var execFileAsync = promisify(execFile);
|
|
2051
|
+
async function gitPathMatches(projectDir, path, command) {
|
|
2052
|
+
const args = command === "check-ignore" ? ["check-ignore", "--quiet", relative(projectDir, path)] : ["ls-files", "--error-unmatch", relative(projectDir, path)];
|
|
2053
|
+
try {
|
|
2054
|
+
await execFileAsync("git", args, { cwd: projectDir });
|
|
2055
|
+
return true;
|
|
2056
|
+
} catch {
|
|
2057
|
+
return false;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
2060
|
|
|
2061
|
-
// ../cli/dist/config/
|
|
2062
|
-
import {
|
|
2061
|
+
// ../cli/dist/config/project-config.js
|
|
2062
|
+
import { access, chmod as chmod2, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
|
|
2063
2063
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
2064
|
-
import {
|
|
2065
|
-
import { dirname as dirname5, join as join4, relative } from "path";
|
|
2066
|
-
import { promisify } from "util";
|
|
2064
|
+
import { join as join4 } from "path";
|
|
2067
2065
|
import { z as z25 } from "zod";
|
|
2068
|
-
var
|
|
2069
|
-
|
|
2070
|
-
|
|
2066
|
+
var siteplaneProjectConfigSchema = z25.object({
|
|
2067
|
+
version: z25.literal(1),
|
|
2068
|
+
apiBaseUrl: z25.string().url(),
|
|
2069
|
+
siteId: z25.string().uuid(),
|
|
2070
|
+
publicSiteKeyId: z25.string().uuid(),
|
|
2071
|
+
publicSiteKey: z25.string().trim().min(1),
|
|
2072
|
+
fieldContractHash: z25.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
2071
2073
|
}).strict();
|
|
2072
|
-
async function
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2074
|
+
async function readProjectPackageJson(projectDir) {
|
|
2075
|
+
return JSON.parse(await readFile6(join4(projectDir, "package.json"), "utf8"));
|
|
2076
|
+
}
|
|
2077
|
+
async function detectNextProject(projectDir) {
|
|
2078
|
+
const packageJson = await readProjectPackageJson(projectDir).catch(() => null);
|
|
2079
|
+
if (packageJson?.dependencies?.next || packageJson?.devDependencies?.next) {
|
|
2080
|
+
return true;
|
|
2078
2081
|
}
|
|
2079
|
-
|
|
2080
|
-
|
|
2082
|
+
for (const fileName of [
|
|
2083
|
+
"next.config.js",
|
|
2084
|
+
"next.config.mjs",
|
|
2085
|
+
"next.config.ts"
|
|
2086
|
+
]) {
|
|
2087
|
+
try {
|
|
2088
|
+
await access(join4(projectDir, fileName));
|
|
2089
|
+
return true;
|
|
2090
|
+
} catch {
|
|
2091
|
+
}
|
|
2081
2092
|
}
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2093
|
+
return false;
|
|
2094
|
+
}
|
|
2095
|
+
async function writeProjectConfig(projectDir, config) {
|
|
2096
|
+
const path = join4(projectDir, "siteplane.config.json");
|
|
2097
|
+
const parsed = siteplaneProjectConfigSchema.parse(config);
|
|
2098
|
+
await writeJsonAtomically(path, parsed, 420);
|
|
2085
2099
|
return path;
|
|
2086
2100
|
}
|
|
2087
|
-
async function
|
|
2088
|
-
return
|
|
2101
|
+
async function readProjectConfig(projectDir) {
|
|
2102
|
+
return siteplaneProjectConfigSchema.parse(JSON.parse(await readFile6(join4(projectDir, "siteplane.config.json"), "utf8")));
|
|
2089
2103
|
}
|
|
2090
|
-
async function
|
|
2104
|
+
async function writeJsonAtomically(path, value, mode) {
|
|
2091
2105
|
const temporaryPath = `${path}.${randomUUID3()}.tmp`;
|
|
2092
|
-
const file = await open2(temporaryPath, "wx",
|
|
2106
|
+
const file = await open2(temporaryPath, "wx", mode);
|
|
2093
2107
|
try {
|
|
2094
|
-
await file.writeFile(`${JSON.stringify(
|
|
2108
|
+
await file.writeFile(`${JSON.stringify(value, null, 2)}
|
|
2095
2109
|
`, "utf8");
|
|
2096
2110
|
await file.sync();
|
|
2097
2111
|
} catch (error) {
|
|
@@ -2102,22 +2116,12 @@ async function writeCredentialsAtomically(path, credentials) {
|
|
|
2102
2116
|
await file.close();
|
|
2103
2117
|
try {
|
|
2104
2118
|
await rename2(temporaryPath, path);
|
|
2105
|
-
await chmod2(path,
|
|
2119
|
+
await chmod2(path, mode);
|
|
2106
2120
|
} catch (error) {
|
|
2107
2121
|
await rm2(temporaryPath, { force: true });
|
|
2108
2122
|
throw error;
|
|
2109
2123
|
}
|
|
2110
2124
|
}
|
|
2111
|
-
var execFileAsync = promisify(execFile);
|
|
2112
|
-
async function gitPathMatches(projectDir, path, command) {
|
|
2113
|
-
const args = command === "check-ignore" ? ["check-ignore", "--quiet", relative(projectDir, path)] : ["ls-files", "--error-unmatch", relative(projectDir, path)];
|
|
2114
|
-
try {
|
|
2115
|
-
await execFileAsync("git", args, { cwd: projectDir });
|
|
2116
|
-
return true;
|
|
2117
|
-
} catch {
|
|
2118
|
-
return false;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
2125
|
|
|
2122
2126
|
// ../cli/dist/commands/init.js
|
|
2123
2127
|
import { join as join5 } from "path";
|
|
@@ -2318,7 +2322,7 @@ var safeErrorSchema = z28.object({
|
|
|
2318
2322
|
}).passthrough();
|
|
2319
2323
|
var errorResponseSchema2 = z28.object({ ok: z28.literal(false), error: safeErrorSchema }).passthrough();
|
|
2320
2324
|
var contextDataSchema = z28.object({
|
|
2321
|
-
site: z28.object({ siteId: z28.string().uuid(),
|
|
2325
|
+
site: z28.object({ siteId: z28.string().uuid(), portalPath: z28.string() }),
|
|
2322
2326
|
run: z28.object({
|
|
2323
2327
|
runId: z28.string().uuid(),
|
|
2324
2328
|
mode: z28.enum(["initial", "update"]),
|
package/dist/next.js
CHANGED
|
@@ -1901,35 +1901,35 @@ ${bookingRulesTemplate}`;
|
|
|
1901
1901
|
import { randomBytes } from "crypto";
|
|
1902
1902
|
import { z as z27 } from "zod";
|
|
1903
1903
|
|
|
1904
|
-
// ../cli/dist/config/
|
|
1905
|
-
import {
|
|
1904
|
+
// ../cli/dist/config/credentials.js
|
|
1905
|
+
import { execFile } from "child_process";
|
|
1906
1906
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1907
|
-
import {
|
|
1907
|
+
import { chmod, mkdir as mkdir5, open, readFile as readFile5, rename, rm } from "fs/promises";
|
|
1908
|
+
import { dirname as dirname5, join as join3, relative } from "path";
|
|
1909
|
+
import { promisify } from "util";
|
|
1908
1910
|
import { z as z24 } from "zod";
|
|
1909
|
-
var
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
siteId: z24.string().uuid(),
|
|
1913
|
-
publicSiteKeyId: z24.string().uuid(),
|
|
1914
|
-
publicSiteKey: z24.string().trim().min(1),
|
|
1915
|
-
fieldContractHash: z24.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
1911
|
+
var siteplaneCredentialsSchema = z24.object({
|
|
1912
|
+
accessToken: z24.string().trim().min(1),
|
|
1913
|
+
siteRevalidationSecret: z24.string().trim().min(1)
|
|
1916
1914
|
}).strict();
|
|
1917
|
-
|
|
1918
|
-
return siteplaneProjectConfigSchema.parse(JSON.parse(await readFile5(join3(projectDir, "siteplane.config.json"), "utf8")));
|
|
1919
|
-
}
|
|
1915
|
+
var execFileAsync = promisify(execFile);
|
|
1920
1916
|
|
|
1921
|
-
// ../cli/dist/config/
|
|
1922
|
-
import {
|
|
1917
|
+
// ../cli/dist/config/project-config.js
|
|
1918
|
+
import { access, chmod as chmod2, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
|
|
1923
1919
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
1924
|
-
import {
|
|
1925
|
-
import { dirname as dirname5, join as join4, relative } from "path";
|
|
1926
|
-
import { promisify } from "util";
|
|
1920
|
+
import { join as join4 } from "path";
|
|
1927
1921
|
import { z as z25 } from "zod";
|
|
1928
|
-
var
|
|
1929
|
-
|
|
1930
|
-
|
|
1922
|
+
var siteplaneProjectConfigSchema = z25.object({
|
|
1923
|
+
version: z25.literal(1),
|
|
1924
|
+
apiBaseUrl: z25.string().url(),
|
|
1925
|
+
siteId: z25.string().uuid(),
|
|
1926
|
+
publicSiteKeyId: z25.string().uuid(),
|
|
1927
|
+
publicSiteKey: z25.string().trim().min(1),
|
|
1928
|
+
fieldContractHash: z25.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
|
|
1931
1929
|
}).strict();
|
|
1932
|
-
|
|
1930
|
+
async function readProjectConfig(projectDir) {
|
|
1931
|
+
return siteplaneProjectConfigSchema.parse(JSON.parse(await readFile6(join4(projectDir, "siteplane.config.json"), "utf8")));
|
|
1932
|
+
}
|
|
1933
1933
|
|
|
1934
1934
|
// ../cli/dist/commands/init.js
|
|
1935
1935
|
import { join as join5 } from "path";
|
|
@@ -2692,7 +2692,7 @@ var safeErrorSchema = z28.object({
|
|
|
2692
2692
|
}).passthrough();
|
|
2693
2693
|
var errorResponseSchema2 = z28.object({ ok: z28.literal(false), error: safeErrorSchema }).passthrough();
|
|
2694
2694
|
var contextDataSchema = z28.object({
|
|
2695
|
-
site: z28.object({ siteId: z28.string().uuid(),
|
|
2695
|
+
site: z28.object({ siteId: z28.string().uuid(), portalPath: z28.string() }),
|
|
2696
2696
|
run: z28.object({
|
|
2697
2697
|
runId: z28.string().uuid(),
|
|
2698
2698
|
mode: z28.enum(["initial", "update"]),
|