@capxul/sandbox 2.0.0 → 2.0.1

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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/dist/main.mjs +35 -23
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -15,16 +15,16 @@ npx @capxul/sandbox faucet send
15
15
  vp run --filter @capxul/sandbox dev -- --help
16
16
  ```
17
17
 
18
- `key create` uses the Little Sandpiper public staging quickstart endpoint and
18
+ `key create` uses the Railway public staging Site endpoint and
19
19
  needs no operator secret. `APP_ENV` does not retarget this public command; use
20
20
  the returned key only with the staging tuple.
21
21
  `faucet send` invokes the canonical Convex deployment and requires operator
22
22
  access in the process environment: inside the infrastructure repository, run
23
23
  it through the one env entry point
24
- (`vp exec bash scripts/capxul-env.sh npx @capxul/sandbox faucet send`); outside
25
- it, supply the deploy key directly
26
- (`CONVEX_DEPLOY_KEY=… npx @capxul/sandbox faucet send`). Never print or commit
27
- those values.
24
+ (`APP_ENV=staging vp exec bash scripts/capxul-env.sh npx @capxul/sandbox faucet
25
+ send`); outside it, supply the self-hosted admin key directly
26
+ (`CONVEX_SELF_HOSTED_ADMIN_KEY=… npx @capxul/sandbox faucet send`). Never print
27
+ or commit that value.
28
28
 
29
29
  ## Verify in the repository
30
30
 
package/dist/main.mjs CHANGED
@@ -13,6 +13,7 @@ var deployment_topology_default = {
13
13
  "development": {
14
14
  "appEnv": "development",
15
15
  "productRole": "development",
16
+ "substrate": "convex-cloud",
16
17
  "convexProject": "capxul-platform-dev",
17
18
  "deployment": "dev:incredible-possum-990",
18
19
  "deploymentReference": "dev/aaron-griffith",
@@ -31,16 +32,17 @@ var deployment_topology_default = {
31
32
  "staging": {
32
33
  "appEnv": "staging",
33
34
  "productRole": "staging",
34
- "convexProject": "capxul-platform-effect",
35
- "deployment": "prod:little-sandpiper-974",
35
+ "substrate": "self-hosted-railway",
36
+ "convexProject": "adorable-illumination",
37
+ "deployment": "self-hosted:railway",
36
38
  "deploymentReference": "production",
37
- "name": "little-sandpiper-974",
38
- "convexType": "prod",
39
- "convexUrl": "https://little-sandpiper-974.convex.cloud",
40
- "convexSiteUrl": "https://little-sandpiper-974.convex.site",
39
+ "name": "convex-backend-production-f220",
40
+ "convexType": "self-hosted",
41
+ "convexUrl": "https://convex-backend-production-f220.up.railway.app",
42
+ "convexSiteUrl": "https://convex-site-production-29eb.up.railway.app",
41
43
  "chainId": 84532,
42
44
  "expectedFingerprints": {
43
- "applicationId": "4e2989ea295fc269",
45
+ "applicationId": "3d006cc2d0190eab",
44
46
  "openfortPublishableKey": "aab42edbcdc683e7",
45
47
  "shieldPublishableKey": "a323489c9a8d8da2"
46
48
  },
@@ -65,22 +67,24 @@ function resolveDeploymentTier(appEnv) {
65
67
  }
66
68
  function assertDeploymentTuple(appEnv, values) {
67
69
  const tier = resolveDeploymentTier(appEnv);
70
+ const selfHosted = tier.substrate === "self-hosted-railway";
68
71
  const expected = {
69
- CONVEX_DEPLOYMENT: tier.deployment,
70
72
  CONVEX_URL: tier.convexUrl,
71
- CONVEX_SITE_URL: tier.convexSiteUrl
73
+ CONVEX_SITE_URL: tier.convexSiteUrl,
74
+ ...selfHosted ? { CONVEX_SELF_HOSTED_URL: tier.convexUrl } : { CONVEX_DEPLOYMENT: tier.deployment }
72
75
  };
73
76
  const mismatches = Object.entries(expected).flatMap(([name, expectedValue]) => {
74
77
  const actual = values[name]?.trim();
75
78
  return actual === expectedValue ? [] : [`${name}: expected '${expectedValue}', received '${actual ?? "<missing>"}'`];
76
79
  });
77
80
  const deployKey = values.CONVEX_DEPLOY_KEY?.trim();
78
- if (deployKey !== void 0 && deployKey.length > 0) {
81
+ if (!selfHosted && deployKey !== void 0 && deployKey.length > 0) {
79
82
  const separatorIndex = deployKey.indexOf("|");
80
83
  const candidateDeployment = separatorIndex > 0 && deployKey.slice(separatorIndex + 1).trim().length > 0 ? deployKey.slice(0, separatorIndex) : "";
81
84
  const keyDeployment = /^(?:dev|prod):[a-z0-9-]+$/u.test(candidateDeployment) ? candidateDeployment : void 0;
82
85
  if (keyDeployment !== tier.deployment) mismatches.push(`CONVEX_DEPLOY_KEY: expected a key bound to '${tier.deployment}', received a key for '${keyDeployment ?? "<invalid>"}'`);
83
86
  }
87
+ if (selfHosted && (values.CONVEX_SELF_HOSTED_ADMIN_KEY?.trim().length ?? 0) === 0) mismatches.push("CONVEX_SELF_HOSTED_ADMIN_KEY: required for self-hosted staging");
84
88
  for (const optionalUrlName of ["CAPXUL_E2E_BOOTSTRAP_URL", "CAPXUL_E2E_BOOTSTRAP_BASE_URL"]) {
85
89
  const raw = values[optionalUrlName]?.trim();
86
90
  if (raw === void 0 || raw.length === 0) continue;
@@ -125,6 +129,7 @@ if (process.argv[1] !== void 0 && path.basename(process.argv[1]) === "deployment
125
129
  resolve(resolve(fileURLToPath(new URL("..", import.meta.url))), "..", "..");
126
130
  const standingStaging = resolveDeploymentTier("staging");
127
131
  const CANONICAL_QUICKSTART_DEPLOYMENT = {
132
+ substrate: standingStaging.substrate,
128
133
  deployment: standingStaging.deployment,
129
134
  convexUrl: standingStaging.convexUrl,
130
135
  convexSiteUrl: standingStaging.convexSiteUrl
@@ -164,40 +169,47 @@ const PLATFORM_ENV_NAMES = [
164
169
  "WINDIR",
165
170
  "windir"
166
171
  ];
167
- function convexArgsForDeployment(args, deployment, hasDeployKey) {
172
+ function convexArgsForTarget(args, target, hasDeployKey) {
173
+ if (target.substrate === "self-hosted-railway") return [...args];
168
174
  if (hasDeployKey) return [...args];
169
175
  if (args[0] === "run") return [
170
176
  "run",
171
177
  "--deployment",
172
- deployment,
178
+ target.deployment,
173
179
  ...args.slice(1)
174
180
  ];
175
181
  return [
176
182
  ...args,
177
183
  "--deployment",
178
- deployment
184
+ target.deployment
179
185
  ];
180
186
  }
181
- function convexChildEnv(deployment, sourceEnv) {
187
+ function convexChildEnv(target, sourceEnv) {
182
188
  const env = {
183
189
  CI: "true",
184
- CONVEX_DEPLOYMENT: deployment,
185
190
  HOME: homedir(),
186
191
  PATH: process.env.PATH ?? "",
187
192
  TMPDIR: process.env.TMPDIR ?? tmpdir()
188
193
  };
189
- const deployKey = sourceEnv.CONVEX_DEPLOY_KEY?.trim();
190
- if (deployKey !== void 0 && deployKey.length > 0) env.CONVEX_DEPLOY_KEY = deployKey;
194
+ if (target.substrate === "self-hosted-railway") {
195
+ env.CONVEX_SELF_HOSTED_URL = target.convexUrl;
196
+ const adminKey = sourceEnv.CONVEX_SELF_HOSTED_ADMIN_KEY?.trim();
197
+ if (adminKey !== void 0 && adminKey.length > 0) env.CONVEX_SELF_HOSTED_ADMIN_KEY = adminKey;
198
+ } else {
199
+ env.CONVEX_DEPLOYMENT = target.deployment;
200
+ const deployKey = sourceEnv.CONVEX_DEPLOY_KEY?.trim();
201
+ if (deployKey !== void 0 && deployKey.length > 0) env.CONVEX_DEPLOY_KEY = deployKey;
202
+ }
191
203
  for (const name of PLATFORM_ENV_NAMES) {
192
204
  const value = process.env[name];
193
205
  if (value !== void 0 && value.length > 0) env[name] = value;
194
206
  }
195
207
  return env;
196
208
  }
197
- function createConvexPathRunner({ deployment, env: sourceEnv = process.env, spawn = spawnSync }) {
209
+ function createConvexPathRunner({ target, env: sourceEnv = process.env, spawn = spawnSync }) {
198
210
  return (_deploymentEnvFile, args) => {
199
- const childEnv = convexChildEnv(deployment, sourceEnv);
200
- const result = spawn("convex", convexArgsForDeployment(args, deployment, childEnv.CONVEX_DEPLOY_KEY !== void 0), {
211
+ const childEnv = convexChildEnv(target, sourceEnv);
212
+ const result = spawn("convex", convexArgsForTarget(args, target, childEnv.CONVEX_DEPLOY_KEY !== void 0), {
201
213
  cwd: packageRoot,
202
214
  env: childEnv,
203
215
  encoding: "utf8",
@@ -257,7 +269,7 @@ function errorMessage(error) {
257
269
  }
258
270
  function canonicalConvexRunner(env = process.env) {
259
271
  return createConvexPathRunner({
260
- deployment: CANONICAL_QUICKSTART_DEPLOYMENT.deployment,
272
+ target: CANONICAL_QUICKSTART_DEPLOYMENT,
261
273
  env
262
274
  });
263
275
  }
@@ -372,7 +384,7 @@ async function runFaucetSend() {
372
384
  return 0;
373
385
  } catch (error) {
374
386
  s.stop("Faucet send failed");
375
- const hint = process.env.CONVEX_DEPLOY_KEY === void 0 ? "\nHint: CONVEX_DEPLOY_KEY is not set — the faucet needs operator access to the canonical deployment. Supply it (CONVEX_DEPLOY_KEY=… npx @capxul/sandbox faucet send) or, inside the infrastructure repo, run through scripts/capxul-env.sh." : "";
387
+ const hint = process.env.CONVEX_SELF_HOSTED_ADMIN_KEY === void 0 ? "\nHint: CONVEX_SELF_HOSTED_ADMIN_KEY is not set — the faucet needs operator access to Railway staging. Supply it directly or, inside the infrastructure repo, run `APP_ENV=staging vp exec bash scripts/capxul-env.sh npx @capxul/sandbox faucet send`." : "";
376
388
  cancel(errorMessage(error) + hint);
377
389
  return 1;
378
390
  }
@@ -506,7 +518,7 @@ async function runKeyCreate() {
506
518
  return 0;
507
519
  }
508
520
  const origin = normalizeHttpOrigin(originPrompt);
509
- const baseUrl = process.env.CAPXUL_QUICKSTART_URL ?? "https://little-sandpiper-974.convex.site";
521
+ const baseUrl = process.env.CAPXUL_QUICKSTART_URL ?? "https://convex-site-production-29eb.up.railway.app";
510
522
  const envPath = resolve(process.cwd(), ".env.local");
511
523
  const s = spinner();
512
524
  s.start("Requesting a sandbox publishable key");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sandbox",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "description": "Capxul sandbox CLI for canonical quickstart keys and testnet faucet funds.",
6
6
  "keywords": [