siteplane 0.1.38 → 0.1.40

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.
@@ -2921,6 +2921,7 @@ async function bookingTestCommand(input) {
2921
2921
  }
2922
2922
 
2923
2923
  // ../cli/dist/commands/connect.js
2924
+ import { spawn } from "child_process";
2924
2925
  import { randomBytes } from "crypto";
2925
2926
  import { z as z27 } from "zod";
2926
2927
 
@@ -3196,7 +3197,8 @@ var claimResponseSchema = z27.object({
3196
3197
  ok: z27.literal(true),
3197
3198
  data: z27.object({
3198
3199
  pairingId: z27.string().uuid(),
3199
- status: z27.literal("approval_required")
3200
+ status: z27.literal("approval_required"),
3201
+ approvalUrl: z27.string().url()
3200
3202
  }).passthrough()
3201
3203
  }).strict();
3202
3204
  var waitingResponseSchema = z27.object({
@@ -3236,6 +3238,16 @@ async function connectCommand(input) {
3236
3238
  if (!claimResponse.ok || !claim.success) {
3237
3239
  throw new Error(readErrorMessage2(claimPayload) ?? "Siteplane pairing failed.");
3238
3240
  }
3241
+ let browserOpened = false;
3242
+ try {
3243
+ await (input.openBrowser ?? openInDefaultBrowser)(claim.data.data.approvalUrl);
3244
+ browserOpened = true;
3245
+ } catch {
3246
+ }
3247
+ input.onApprovalRequired?.({
3248
+ approvalUrl: claim.data.data.approvalUrl,
3249
+ browserOpened
3250
+ });
3239
3251
  const wait = input.wait ?? ((milliseconds) => new Promise((resolve2) => setTimeout(resolve2, milliseconds)));
3240
3252
  let bootstrap = null;
3241
3253
  for (; ; ) {
@@ -3289,6 +3301,18 @@ async function connectCommand(input) {
3289
3301
  ]
3290
3302
  };
3291
3303
  }
3304
+ async function openInDefaultBrowser(url) {
3305
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32.exe" : "xdg-open";
3306
+ const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url] : [url];
3307
+ await new Promise((resolve2, reject) => {
3308
+ const child = spawn(command, args, { detached: true, stdio: "ignore" });
3309
+ child.once("error", reject);
3310
+ child.once("spawn", () => {
3311
+ child.unref();
3312
+ resolve2();
3313
+ });
3314
+ });
3315
+ }
3292
3316
  function createHeaders(input) {
3293
3317
  return new Headers({
3294
3318
  "content-type": "application/json",
@@ -4120,6 +4144,17 @@ async function siteSetupApplyCommand(input) {
4120
4144
  return parsed.data.data;
4121
4145
  }
4122
4146
  async function siteSetupVerifyCommand(input) {
4147
+ const resolveSourceFiles = input.resolveSourceFiles ?? resolveScanFilePaths;
4148
+ const readSourceFile = input.readSourceFile ?? ((path) => readFile7(path, "utf8"));
4149
+ const paths = await resolveSourceFiles([], { projectDir: input.projectDir });
4150
+ const sources = await Promise.all(paths.map(readSourceFile));
4151
+ if (!sources.some(hasMountedFieldRuntimeBridge)) {
4152
+ return {
4153
+ status: "action_required",
4154
+ code: "missing_field_runtime_bridge",
4155
+ message: "Mount FieldRuntimeBridge from @siteplane/runtime-next/client before deployment verification."
4156
+ };
4157
+ }
4123
4158
  const deploymentRevision = await (input.readRevision ?? readGitRevision)(input.projectDir);
4124
4159
  const response = await postSiteSetup(input, "verify", {
4125
4160
  deploymentUrl: input.deploymentUrl,
@@ -4132,6 +4167,9 @@ async function siteSetupVerifyCommand(input) {
4132
4167
  }
4133
4168
  return actionRequired(response.payload, "Siteplane deployment verification failed.");
4134
4169
  }
4170
+ function hasMountedFieldRuntimeBridge(source) {
4171
+ return /from\s+["']@siteplane\/runtime-next(?:\/client)?["']/u.test(source) && /<FieldRuntimeBridge(?:\s|\/|>)/u.test(source);
4172
+ }
4135
4173
  async function postSiteSetup(input, operation, body) {
4136
4174
  const [config, credentials] = await Promise.all([
4137
4175
  readProjectConfig(input.projectDir),
@@ -4192,6 +4230,12 @@ async function runSiteplaneCli(args, dependencies = createDefaultDependencies())
4192
4230
  projectDir: dependencies.cwd(),
4193
4231
  pairingCode,
4194
4232
  apiBaseUrl,
4233
+ onApprovalRequired: ({ approvalUrl, browserOpened }) => {
4234
+ dependencies.stdout(
4235
+ browserOpened ? "Opened Siteplane in your browser. Approve the connection there:" : "Could not open a browser automatically. Approve the connection here:"
4236
+ );
4237
+ dependencies.stdout(approvalUrl);
4238
+ },
4195
4239
  ...readOptionalVercelAutomationBypassSecret(dependencies.env)
4196
4240
  });
4197
4241
  dependencies.stdout(`Wrote ${result.configPath}`);
package/dist/index.js CHANGED
@@ -1990,6 +1990,7 @@ async function bookingTestCommand(input) {
1990
1990
  }
1991
1991
 
1992
1992
  // ../cli/dist/commands/connect.js
1993
+ import { spawn } from "child_process";
1993
1994
  import { randomBytes } from "crypto";
1994
1995
  import { z as z27 } from "zod";
1995
1996
 
@@ -2265,7 +2266,8 @@ var claimResponseSchema = z27.object({
2265
2266
  ok: z27.literal(true),
2266
2267
  data: z27.object({
2267
2268
  pairingId: z27.string().uuid(),
2268
- status: z27.literal("approval_required")
2269
+ status: z27.literal("approval_required"),
2270
+ approvalUrl: z27.string().url()
2269
2271
  }).passthrough()
2270
2272
  }).strict();
2271
2273
  var waitingResponseSchema = z27.object({
package/dist/next.js CHANGED
@@ -1898,6 +1898,7 @@ alwaysApply: true
1898
1898
  ${bookingRulesTemplate}`;
1899
1899
 
1900
1900
  // ../cli/dist/commands/connect.js
1901
+ import { spawn } from "child_process";
1901
1902
  import { randomBytes } from "crypto";
1902
1903
  import { z as z27 } from "zod";
1903
1904
 
@@ -1962,7 +1963,8 @@ var claimResponseSchema = z27.object({
1962
1963
  ok: z27.literal(true),
1963
1964
  data: z27.object({
1964
1965
  pairingId: z27.string().uuid(),
1965
- status: z27.literal("approval_required")
1966
+ status: z27.literal("approval_required"),
1967
+ approvalUrl: z27.string().url()
1966
1968
  }).passthrough()
1967
1969
  }).strict();
1968
1970
  var waitingResponseSchema = z27.object({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "siteplane",
3
3
  "private": false,
4
- "version": "0.1.38",
4
+ "version": "0.1.40",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "publishConfig": {