@voidbase-cloud/voidbase 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  Entries after 0.1.0 are compiled by release-please from the Conventional Commits merged since the previous release
4
4
  (docs/releasing.md); 0.1.0 was written by hand.
5
5
 
6
+ ## [0.2.2](https://github.com/voidbase-cloud/voidbase/compare/v0.2.1...v0.2.2) (2026-09-06)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **migrations:** later pb_migrations see collections created earlier in the same run ([35b0e94](https://github.com/voidbase-cloud/voidbase/commit/35b0e9499c0862de5c5c76d1696c2104cc205b32))
12
+
13
+
14
+ ### Documentation
15
+
16
+ * **surface:** template marketplace in the control plane ([48b09ae](https://github.com/voidbase-cloud/voidbase/commit/48b09ae5d74b760fcdb64c3315b4df7d61e5ab81))
17
+
18
+ ## [0.2.1](https://github.com/voidbase-cloud/voidbase/compare/v0.2.0...v0.2.1) (2026-09-06)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **oauth2:** Cloudflare sign-in without the openid scope ([16d660d](https://github.com/voidbase-cloud/voidbase/commit/16d660de61728b705e1aa385b71b2fdf9397a216))
24
+
6
25
  ## [0.2.0](https://github.com/voidbase-cloud/voidbase/compare/v0.1.0...v0.2.0) (2026-09-06)
7
26
 
8
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidbase-cloud/voidbase",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "PocketBase-compatible backend on Cloudflare Workers (D1, R2, Queues, Durable Objects) via Void, or a single Bun process",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -6,6 +6,8 @@ export interface Embedded { version: string; migrations: Record<string, string>;
6
6
  let cached: Embedded | null | undefined;
7
7
  export async function embedded(): Promise<Embedded | null> {
8
8
  if (cached !== undefined) return cached;
9
+ // the file exists only while scripts/build-exe.ts compiles; consumers typecheck this module without it
10
+ // @ts-ignore
9
11
  try { cached = ((await import("./embedded.generated.json", { with: { type: "json" } })) as { default: Embedded }).default; } catch { cached = null; }
10
12
  return cached;
11
13
  }
@@ -50,6 +50,8 @@ async function runPending(db: D1Database, globals: Record<string, unknown>): Pro
50
50
  throw err;
51
51
  }
52
52
  invalidateCollections();
53
+ // the next migration must see what this one created (PocketBase reloads its collections cache the same way)
54
+ const store = hookStore.getStore(); if (store) { const fresh = await loadCollections(db); store.collections.clear(); for (const [k, v] of fresh) store.collections.set(k, v); }
53
55
  await stmt(db, "INSERT OR IGNORE INTO `_pbMigrations` (file, applied) VALUES (?, ?)", [m.name, Date.now()]).run();
54
56
  done.push(m.name);
55
57
  }
@@ -7,11 +7,14 @@ export interface ProviderContext { name: string; clientId: string; clientSecret:
7
7
  type Raw = Record<string, unknown>;
8
8
 
9
9
  const oidc: ProviderDefaults = { displayName: "OIDC", pkce: true, scopes: ["openid", "email", "profile"] };
10
- // Cloudflare OAuth (developers.cloudflare.com/fundamentals/oauth): plain OIDC on dash.cloudflare.com whose userinfo
11
- // carries only `sub`, so identity comes from the API's GET /user. Resource scopes (API token permission names such
12
- // as workers-platform.write) are added per provider with extra.scopes; extra.apiBase overrides the API for tests.
10
+ // Cloudflare OAuth (developers.cloudflare.com/fundamentals/oauth): OAuth 2.0 on dash.cloudflare.com, not OIDC: `openid`
11
+ // is not a Cloudflare scope and a request carrying it is refused (invalid_scope). Identity comes from the API's GET
12
+ // /user (scope user-details.read); the userinfo endpoint, when it answers, only adds `sub`. Resource scopes (API token
13
+ // permission ids such as workers-scripts.write, plus offline_access for a refresh token) must be registered on the
14
+ // client and are added per provider with extra.scopes; extra.apiBase overrides the API for tests. The client
15
+ // authenticates with HTTP Basic at the token endpoint (the token exchange tries that first).
13
16
  export const CF_API_BASE = "https://api.cloudflare.com/client/v4";
14
- const cloudflare: ProviderDefaults = { displayName: "Cloudflare", pkce: true, scopes: ["openid", "offline_access"], authURL: "https://dash.cloudflare.com/oauth2/auth", tokenURL: "https://dash.cloudflare.com/oauth2/token", userInfoURL: "https://dash.cloudflare.com/oauth2/userinfo" };
17
+ const cloudflare: ProviderDefaults = { displayName: "Cloudflare", pkce: true, scopes: ["user-details.read"], authURL: "https://dash.cloudflare.com/oauth2/auth", tokenURL: "https://dash.cloudflare.com/oauth2/token", userInfoURL: "https://dash.cloudflare.com/oauth2/userinfo" };
15
18
  export const PROVIDER_DEFAULTS: Record<string, ProviderDefaults> = {
16
19
  oidc, oidc2: oidc, oidc3: oidc, cloudflare,
17
20
  apple: { displayName: "Apple", pkce: true, scopes: ["name", "email"], authURL: "https://appleid.apple.com/auth/authorize", tokenURL: "https://appleid.apple.com/auth/token" },
@@ -72,7 +75,9 @@ export async function fetchRawUser(p: ProviderContext, token: Token): Promise<Ra
72
75
  if (!token.id_token) throw new Error("empty id_token");
73
76
  return jwtClaims(String(token.id_token));
74
77
  case "cloudflare": {
75
- const info = p.userInfoURL ? await getJSON(p.userInfoURL, token) : (token.id_token ? jwtClaims(String(token.id_token)) : {});
78
+ let info: Raw = {};
79
+ if (p.userInfoURL) { try { info = await getJSON(p.userInfoURL, token); } catch { /* no openid: identity comes from GET /user */ } }
80
+ else if (token.id_token) info = jwtClaims(String(token.id_token));
76
81
  const base = String(p.extra.apiBase || CF_API_BASE).replace(/\/$/, "");
77
82
  const me = await getJSON(`${base}/user`, token);
78
83
  return { ...info, cf_user: (me.result ?? me) as Raw };
@@ -1,2 +0,0 @@
1
- // src/node/embedded.generated.json exists only while scripts/build-exe.ts compiles the executables
2
- declare module "*embedded.generated.json" { const value: import("./embedded").Embedded; export default value; }