@palbase/backend 33.0.0 → 33.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 (53) hide show
  1. package/dist/bin/palbase-backend.cjs.map +1 -1
  2. package/dist/bin/palbase-backend.js +4 -4
  3. package/dist/{chunk-DCDHAKF3.js → chunk-IKDONZ5D.js} +4 -4
  4. package/dist/{chunk-C4ZA5AT2.js → chunk-SI4KGEM3.js} +1 -1
  5. package/dist/{chunk-C4ZA5AT2.js.map → chunk-SI4KGEM3.js.map} +1 -1
  6. package/dist/{chunk-QMFOL2K6.js → chunk-TVCCR6SO.js} +2 -2
  7. package/dist/{chunk-N54QZER3.js → chunk-WWUG2QXF.js} +2 -2
  8. package/dist/{chunk-GOPZPM2A.js → chunk-YIQ4RS4F.js} +2 -2
  9. package/dist/db/index.cjs.map +1 -1
  10. package/dist/db/index.d.cts +1 -1
  11. package/dist/db/index.d.ts +1 -1
  12. package/dist/db/index.js +2 -2
  13. package/dist/engine/index.cjs.map +1 -1
  14. package/dist/engine/index.d.cts +3 -3
  15. package/dist/engine/index.d.ts +3 -3
  16. package/dist/engine/index.js +4 -4
  17. package/dist/{index-Bi74dcOu.d.ts → index-D-3duy8Y.d.ts} +2 -2
  18. package/dist/{index-BWgnGj68.d.cts → index-DB_nW-AV.d.cts} +19 -10
  19. package/dist/{index-g6iQyYci.d.cts → index-DLveQoOf.d.cts} +2 -2
  20. package/dist/{index-Dg10RnZO.d.ts → index-DMZG3kpo.d.ts} +19 -10
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +6 -6
  23. package/dist/index.d.ts +6 -6
  24. package/dist/index.js +4 -4
  25. package/dist/openapi/index.d.cts +2 -2
  26. package/dist/openapi/index.d.ts +2 -2
  27. package/dist/{registry-6VT5RPeO.d.cts → registry-DSTThhKf.d.cts} +1 -1
  28. package/dist/{registry-B-sxJJN0.d.ts → registry-JjF5lcj4.d.ts} +1 -1
  29. package/dist/test/index.cjs +1120 -4
  30. package/dist/test/index.cjs.map +1 -1
  31. package/dist/test/index.d.cts +1 -1
  32. package/dist/test/index.d.ts +1 -1
  33. package/dist/test/index.js +1121 -5
  34. package/dist/test/index.js.map +1 -1
  35. package/docs/README.md +123 -79
  36. package/docs/auth.md +11 -7
  37. package/docs/background.md +16 -7
  38. package/docs/database.md +22 -18
  39. package/docs/endpoints.md +26 -20
  40. package/docs/errors.md +2 -3
  41. package/docs/events.md +63 -29
  42. package/docs/getting-started.md +8 -7
  43. package/docs/llms-full.txt +399 -232
  44. package/docs/migrations.md +6 -5
  45. package/docs/routing.md +34 -11
  46. package/docs/schema.md +61 -36
  47. package/docs/services.md +30 -13
  48. package/package.json +2 -1
  49. package/stack-images.json +24 -0
  50. /package/dist/{chunk-DCDHAKF3.js.map → chunk-IKDONZ5D.js.map} +0 -0
  51. /package/dist/{chunk-QMFOL2K6.js.map → chunk-TVCCR6SO.js.map} +0 -0
  52. /package/dist/{chunk-N54QZER3.js.map → chunk-WWUG2QXF.js.map} +0 -0
  53. /package/dist/{chunk-GOPZPM2A.js.map → chunk-YIQ4RS4F.js.map} +0 -0
@@ -1,8 +1,8 @@
1
- import '../index-BWgnGj68.cjs';
2
- export { A as App, g as AuthVerifier, B as BootRefused, h as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, j as EngineConfig, M as ModuleClients, R as RateLimiter, k as RequestDatabase, l as RouteEntry, m as RuntimeHooks, S as ScrubResult, n as SqlDriver, o as SqlTx, p as buildRouteTable, q as createApp, r as createLazyTransaction, s as createOps, t as createRequestDatabase, u as effectiveAuth, v as hostAllowed, w as installEgressFence, i as isDeclarationRefused, x as loadConfig, y as makeMemoryCache, z as matchRoute, F as quoteIdent, G as scrubSecrets, H as withTables } from '../index-g6iQyYci.cjs';
1
+ import '../index-DB_nW-AV.cjs';
2
+ export { A as App, g as AuthVerifier, B as BootRefused, h as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, j as EngineConfig, M as ModuleClients, R as RateLimiter, k as RequestDatabase, l as RouteEntry, m as RuntimeHooks, S as ScrubResult, n as SqlDriver, o as SqlTx, p as buildRouteTable, q as createApp, r as createLazyTransaction, s as createOps, t as createRequestDatabase, u as effectiveAuth, v as hostAllowed, w as installEgressFence, i as isDeclarationRefused, x as loadConfig, y as makeMemoryCache, z as matchRoute, F as quoteIdent, G as scrubSecrets, H as withTables } from '../index-DLveQoOf.cjs';
3
3
  import '../db/env.cjs';
4
4
  import '../stack.cjs';
5
5
  import 'zod';
6
6
  import 'node:async_hooks';
7
7
  import '../module-Dl1KFVtc.cjs';
8
- import '../registry-6VT5RPeO.cjs';
8
+ import '../registry-DSTThhKf.cjs';
@@ -1,8 +1,8 @@
1
- import '../index-Dg10RnZO.js';
2
- export { A as App, g as AuthVerifier, B as BootRefused, h as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, j as EngineConfig, M as ModuleClients, R as RateLimiter, k as RequestDatabase, l as RouteEntry, m as RuntimeHooks, S as ScrubResult, n as SqlDriver, o as SqlTx, p as buildRouteTable, q as createApp, r as createLazyTransaction, s as createOps, t as createRequestDatabase, u as effectiveAuth, v as hostAllowed, w as installEgressFence, i as isDeclarationRefused, x as loadConfig, y as makeMemoryCache, z as matchRoute, F as quoteIdent, G as scrubSecrets, H as withTables } from '../index-Bi74dcOu.js';
1
+ import '../index-DMZG3kpo.js';
2
+ export { A as App, g as AuthVerifier, B as BootRefused, h as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, j as EngineConfig, M as ModuleClients, R as RateLimiter, k as RequestDatabase, l as RouteEntry, m as RuntimeHooks, S as ScrubResult, n as SqlDriver, o as SqlTx, p as buildRouteTable, q as createApp, r as createLazyTransaction, s as createOps, t as createRequestDatabase, u as effectiveAuth, v as hostAllowed, w as installEgressFence, i as isDeclarationRefused, x as loadConfig, y as makeMemoryCache, z as matchRoute, F as quoteIdent, G as scrubSecrets, H as withTables } from '../index-D-3duy8Y.js';
3
3
  import '../db/env.js';
4
4
  import '../stack.js';
5
5
  import 'zod';
6
6
  import 'node:async_hooks';
7
7
  import '../module-Dl1KFVtc.js';
8
- import '../registry-B-sxJJN0.js';
8
+ import '../registry-JjF5lcj4.js';
@@ -16,15 +16,15 @@ import {
16
16
  quoteIdent,
17
17
  scrubSecrets,
18
18
  withTables
19
- } from "../chunk-DCDHAKF3.js";
19
+ } from "../chunk-IKDONZ5D.js";
20
20
  import {
21
21
  DECLARATION_REFUSAL,
22
22
  DeclarationRefused,
23
23
  isDeclarationRefused
24
- } from "../chunk-N54QZER3.js";
25
- import "../chunk-QMFOL2K6.js";
24
+ } from "../chunk-WWUG2QXF.js";
25
+ import "../chunk-TVCCR6SO.js";
26
26
  import "../chunk-XOX6RFPZ.js";
27
- import "../chunk-C4ZA5AT2.js";
27
+ import "../chunk-SI4KGEM3.js";
28
28
  import "../chunk-BRLJOXWS.js";
29
29
  import "../chunk-KATPXCJ5.js";
30
30
  export {
@@ -1,6 +1,6 @@
1
- import { D as DBClient, b as DBOps, T as TxPlanBody, c as TxPlanResponse, A as AuthSpec, C as CacheClient, a as RuntimeServices, _ as __runWithRuntime, d as __requestALS } from './index-Dg10RnZO.js';
1
+ import { D as DBClient, b as DBOps, T as TxPlanBody, c as TxPlanResponse, A as AuthSpec, C as CacheClient, a as RuntimeServices, _ as __runWithRuntime, d as __requestALS } from './index-DMZG3kpo.js';
2
2
  import { T as Token } from './module-Dl1KFVtc.js';
3
- import { R as RouteMeta } from './registry-B-sxJJN0.js';
3
+ import { R as RouteMeta } from './registry-JjF5lcj4.js';
4
4
 
5
5
  /**
6
6
  * engine/config.ts — settings from the environment, and the gate that refuses
@@ -2257,7 +2257,7 @@ interface PalbaseFunctionsClient {
2257
2257
  invoke<T = unknown>(fnName: string, options?: PalbaseInvokeOptions): Promise<PalbaseResult<T>>;
2258
2258
  }
2259
2259
  /**
2260
- * Cross-user admin write surface, reached via `Flags.asService()`.
2260
+ * Cross-user admin write surface, reached via `Flags.$asService()`.
2261
2261
  *
2262
2262
  * These five methods set/clear overrides for an ARBITRARY user (named
2263
2263
  * explicitly), so they bypass the current-request-user scope that `Flags.*`
@@ -2265,10 +2265,10 @@ interface PalbaseFunctionsClient {
2265
2265
  * `Database` / `Database.$asService()` split: the privileged, cross-user path
2266
2266
  * is moved OFF the default surface so it is greppable and intentional — a
2267
2267
  * handler that calls `Flags.setOverrideForUser(...)` on the default surface is
2268
- * a compile error and must reach for `Flags.asService()` first.
2268
+ * a compile error and must reach for `Flags.$asService()` first.
2269
2269
  *
2270
2270
  * @example
2271
- * await Flags.asService().setOverrideForUser("user_123", "new_checkout", true);
2271
+ * await Flags.$asService().setOverrideForUser("user_123", "new_checkout", true);
2272
2272
  */
2273
2273
  interface PalbaseFlagsServiceClient {
2274
2274
  /**
@@ -2331,7 +2331,7 @@ interface PalbaseFlagsClient {
2331
2331
  * user until cleared.
2332
2332
  *
2333
2333
  * Errors when there is no signed-in user (an anonymous request); reach for
2334
- * `Flags.asService().setOverrideForUser(userId, key, value)` to write a flag
2334
+ * `Flags.$asService().setOverrideForUser(userId, key, value)` to write a flag
2335
2335
  * for an arbitrary (cross-user) target.
2336
2336
  *
2337
2337
  * @example
@@ -2341,8 +2341,12 @@ interface PalbaseFlagsClient {
2341
2341
  /**
2342
2342
  * Return the cross-user admin write surface ({@link PalbaseFlagsServiceClient}).
2343
2343
  * Use sparingly and explicitly — the default `Flags.setOverride(...)` path is
2344
- * bound to the current request user; `asService()` is how you write a flag
2345
- * override for an ARBITRARY user. Mirrors `Database.$asService()`.
2344
+ * bound to the current request user; this is how you write a flag override for
2345
+ * an ARBITRARY user. Mirrors `Database.$asService()`.
2346
+ *
2347
+ * NOT the name a handler writes: the ambient `Flags` singleton OMITS this
2348
+ * member and exposes `$asService()` instead — `Flags.asService()` still
2349
+ * type-checks there and THROWS, naming its replacement (H1).
2346
2350
  */
2347
2351
  asService(): PalbaseFlagsServiceClient;
2348
2352
  }
@@ -4035,12 +4039,17 @@ type EnvServiceDatabase = EnvSchemaSurface & {
4035
4039
  }): Promise<Materialized<T>>;
4036
4040
  };
4037
4041
  /**
4038
- * The typed-by-default Database surface: the raw string-keyed `DBClient` ops
4039
- * PLUS a `tables` map typed against the project's generated `palbase-env.d.ts`,
4040
- * a `transaction` that runs a whole plan in one request, and `asService()` for
4042
+ * The typed-by-default Database surface: the `$`-prefixed string-keyed
4043
+ * `DBClient` ops PLUS one property per schema — `public` and every schema the
4044
+ * project declares typed against the generated `palbase-env.d.ts`, a
4045
+ * `$transaction` that runs a whole plan in one request, and `$asService()` for
4041
4046
  * the explicit RLS-bypass sibling.
4042
4047
  *
4043
- * The low-level `txPlan` op is deliberately NOT re-exposed here: `transaction`
4048
+ * NOT `tables`: that intermediate layer was removed (FR-001) and this sentence
4049
+ * outlived it by two majors, teaching a spelling that is TS2339. Pinned in
4050
+ * `src/database-ambient.test-d.ts`.
4051
+ *
4052
+ * The low-level `txPlan` op is deliberately NOT re-exposed here: `$transaction`
4044
4053
  * is the surface, and a hand-built plan would bypass the ref/guard machinery
4045
4054
  * that makes one safe to write.
4046
4055
  */
@@ -1,6 +1,6 @@
1
- import { D as DBClient, b as DBOps, T as TxPlanBody, c as TxPlanResponse, A as AuthSpec, C as CacheClient, a as RuntimeServices, _ as __runWithRuntime, d as __requestALS } from './index-BWgnGj68.cjs';
1
+ import { D as DBClient, b as DBOps, T as TxPlanBody, c as TxPlanResponse, A as AuthSpec, C as CacheClient, a as RuntimeServices, _ as __runWithRuntime, d as __requestALS } from './index-DB_nW-AV.cjs';
2
2
  import { T as Token } from './module-Dl1KFVtc.cjs';
3
- import { R as RouteMeta } from './registry-6VT5RPeO.cjs';
3
+ import { R as RouteMeta } from './registry-DSTThhKf.cjs';
4
4
 
5
5
  /**
6
6
  * engine/config.ts — settings from the environment, and the gate that refuses
@@ -2257,7 +2257,7 @@ interface PalbaseFunctionsClient {
2257
2257
  invoke<T = unknown>(fnName: string, options?: PalbaseInvokeOptions): Promise<PalbaseResult<T>>;
2258
2258
  }
2259
2259
  /**
2260
- * Cross-user admin write surface, reached via `Flags.asService()`.
2260
+ * Cross-user admin write surface, reached via `Flags.$asService()`.
2261
2261
  *
2262
2262
  * These five methods set/clear overrides for an ARBITRARY user (named
2263
2263
  * explicitly), so they bypass the current-request-user scope that `Flags.*`
@@ -2265,10 +2265,10 @@ interface PalbaseFunctionsClient {
2265
2265
  * `Database` / `Database.$asService()` split: the privileged, cross-user path
2266
2266
  * is moved OFF the default surface so it is greppable and intentional — a
2267
2267
  * handler that calls `Flags.setOverrideForUser(...)` on the default surface is
2268
- * a compile error and must reach for `Flags.asService()` first.
2268
+ * a compile error and must reach for `Flags.$asService()` first.
2269
2269
  *
2270
2270
  * @example
2271
- * await Flags.asService().setOverrideForUser("user_123", "new_checkout", true);
2271
+ * await Flags.$asService().setOverrideForUser("user_123", "new_checkout", true);
2272
2272
  */
2273
2273
  interface PalbaseFlagsServiceClient {
2274
2274
  /**
@@ -2331,7 +2331,7 @@ interface PalbaseFlagsClient {
2331
2331
  * user until cleared.
2332
2332
  *
2333
2333
  * Errors when there is no signed-in user (an anonymous request); reach for
2334
- * `Flags.asService().setOverrideForUser(userId, key, value)` to write a flag
2334
+ * `Flags.$asService().setOverrideForUser(userId, key, value)` to write a flag
2335
2335
  * for an arbitrary (cross-user) target.
2336
2336
  *
2337
2337
  * @example
@@ -2341,8 +2341,12 @@ interface PalbaseFlagsClient {
2341
2341
  /**
2342
2342
  * Return the cross-user admin write surface ({@link PalbaseFlagsServiceClient}).
2343
2343
  * Use sparingly and explicitly — the default `Flags.setOverride(...)` path is
2344
- * bound to the current request user; `asService()` is how you write a flag
2345
- * override for an ARBITRARY user. Mirrors `Database.$asService()`.
2344
+ * bound to the current request user; this is how you write a flag override for
2345
+ * an ARBITRARY user. Mirrors `Database.$asService()`.
2346
+ *
2347
+ * NOT the name a handler writes: the ambient `Flags` singleton OMITS this
2348
+ * member and exposes `$asService()` instead — `Flags.asService()` still
2349
+ * type-checks there and THROWS, naming its replacement (H1).
2346
2350
  */
2347
2351
  asService(): PalbaseFlagsServiceClient;
2348
2352
  }
@@ -4035,12 +4039,17 @@ type EnvServiceDatabase = EnvSchemaSurface & {
4035
4039
  }): Promise<Materialized<T>>;
4036
4040
  };
4037
4041
  /**
4038
- * The typed-by-default Database surface: the raw string-keyed `DBClient` ops
4039
- * PLUS a `tables` map typed against the project's generated `palbase-env.d.ts`,
4040
- * a `transaction` that runs a whole plan in one request, and `asService()` for
4042
+ * The typed-by-default Database surface: the `$`-prefixed string-keyed
4043
+ * `DBClient` ops PLUS one property per schema — `public` and every schema the
4044
+ * project declares typed against the generated `palbase-env.d.ts`, a
4045
+ * `$transaction` that runs a whole plan in one request, and `$asService()` for
4041
4046
  * the explicit RLS-bypass sibling.
4042
4047
  *
4043
- * The low-level `txPlan` op is deliberately NOT re-exposed here: `transaction`
4048
+ * NOT `tables`: that intermediate layer was removed (FR-001) and this sentence
4049
+ * outlived it by two majors, teaching a spelling that is TS2339. Pinned in
4050
+ * `src/database-ambient.test-d.ts`.
4051
+ *
4052
+ * The low-level `txPlan` op is deliberately NOT re-exposed here: `$transaction`
4044
4053
  * is the surface, and a hand-built plan would bypass the ref/guard machinery
4045
4054
  * that makes one safe to write.
4046
4055
  */