create-svc 0.1.45 → 0.1.47

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-svc",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "description": "Local microservice bootstrap CLI for Cloud Run and Workers services with Neon-backed data.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -127,7 +127,7 @@ describe("buildDeploymentVerificationCommands", () => {
127
127
  command: "sh",
128
128
  args: [
129
129
  "-c",
130
- 'TOKEN="$(service auth token)" && IP="$(dig @1.1.1.1 +short api.launch.anmho.com | head -n 1)" && test -n "$IP" && curl --fail --show-error --silent --resolve "api.launch.anmho.com:443:$IP" -H "Authorization: Bearer $TOKEN" "https://api.launch.anmho.com/v1/admin/waitlist?limit=1"',
130
+ 'TOKEN="$(service auth token)" && (curl --fail --show-error --silent -H "Authorization: Bearer $TOKEN" "https://api.launch.anmho.com/v1/admin/waitlist?limit=1") || for IP in $(dig @1.1.1.1 +short api.launch.anmho.com); do curl --fail --show-error --silent --resolve "api.launch.anmho.com:443:$IP" -H "Authorization: Bearer $TOKEN" "https://api.launch.anmho.com/v1/admin/waitlist?limit=1" && exit 0; done; exit 1',
131
131
  ],
132
132
  });
133
133
  });
@@ -129,15 +129,16 @@ function workersProtectedVerificationCommand(host: string, tokenCommand: string)
129
129
 
130
130
  function workersCurlScript(host: string, path: string, flags: string[] = []) {
131
131
  const url = `https://${host}${path}`;
132
+ const curl = ["curl --fail --show-error --silent", ...flags, `"${url}"`].join(" ");
133
+ const resolvedCurl = ["curl --fail --show-error --silent", `--resolve "${host}:443:$IP"`, ...flags, `"${url}"`].join(" ");
132
134
  return [
133
- `IP="$(dig @1.1.1.1 +short ${host} | head -n 1)"`,
134
- "&&",
135
- 'test -n "$IP"',
136
- "&&",
137
- "curl --fail --show-error --silent",
138
- `--resolve "${host}:443:$IP"`,
139
- ...flags,
140
- `"${url}"`,
135
+ `(${curl})`,
136
+ "||",
137
+ `for IP in $(dig @1.1.1.1 +short ${host}); do`,
138
+ `${resolvedCurl}`,
139
+ "&& exit 0;",
140
+ "done;",
141
+ "exit 1",
141
142
  ].join(" ");
142
143
  }
143
144
 
@@ -320,6 +320,9 @@ test("scaffolds the workers target with wrangler lifecycle commands", async () =
320
320
  expect(wranglerConfig).toContain('binding = "HYPERDRIVE"');
321
321
  expect(wranglerConfig).toContain('AUTH_ENABLED = "true"');
322
322
  expect(wranglerConfig).toContain('AUTH_AUDIENCE = "api://dns-api"');
323
+ const authSource = await Bun.file(join(generatedRoot, "src", "auth.ts")).text();
324
+ expect(authSource).toContain('alg === "EdDSA"');
325
+ expect(authSource).toContain('name: "Ed25519"');
323
326
 
324
327
  const entrypoint = await Bun.file(join(generatedRoot, "src", "index.ts")).text();
325
328
  expect(entrypoint).toContain("/v1/waitlist");
@@ -132,6 +132,12 @@ function importAlgorithm(alg: string, key: JsonWebKey) {
132
132
  verify: { name: "ECDSA", hash: "SHA-256" },
133
133
  } as const;
134
134
  }
135
+ if (alg === "EdDSA" && key.crv === "Ed25519") {
136
+ return {
137
+ import: { name: "Ed25519" },
138
+ verify: { name: "Ed25519" },
139
+ } as const;
140
+ }
135
141
  throw new Error(`unsupported jwt alg: ${alg}`);
136
142
  }
137
143