@palbase/backend 25.0.1 → 25.0.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.
Files changed (36) hide show
  1. package/dist/{chunk-HBOJLP2Z.js → chunk-7JSEN7UR.js} +2 -1
  2. package/dist/chunk-7JSEN7UR.js.map +1 -0
  3. package/dist/db/index.cjs.map +1 -1
  4. package/dist/db/index.d.cts +2 -2
  5. package/dist/db/index.d.ts +2 -2
  6. package/dist/db/index.js +1 -1
  7. package/dist/{endpoint-DMwJjEHQ.d.ts → endpoint-CTEHhb7A.d.ts} +19 -8
  8. package/dist/{endpoint-BSGw1pTu.d.cts → endpoint-DYHMo6cC.d.cts} +19 -8
  9. package/dist/engine/index.d.cts +4 -4
  10. package/dist/engine/index.d.ts +4 -4
  11. package/dist/{index-B8v6hVyU.d.ts → index-CUomTA3e.d.ts} +3 -3
  12. package/dist/{index-B4CcpqLb.d.ts → index-CW21M9Z3.d.ts} +1 -1
  13. package/dist/{index-VsjBQ4Kw.d.cts → index-ClpDeSos.d.cts} +3 -3
  14. package/dist/{index-DmVyY6N7.d.cts → index-CmBK76nx.d.cts} +1 -1
  15. package/dist/index.cjs +5 -2
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +9 -8
  18. package/dist/index.d.ts +9 -8
  19. package/dist/index.js +5 -3
  20. package/dist/index.js.map +1 -1
  21. package/dist/openapi/index.d.cts +2 -2
  22. package/dist/openapi/index.d.ts +2 -2
  23. package/dist/{registry-CgJvDYUW.d.cts → registry-CC0WBQq6.d.cts} +1 -1
  24. package/dist/{registry-B8pld3fj.d.ts → registry-dZZ5JKYg.d.ts} +1 -1
  25. package/dist/test/index.d.cts +1 -1
  26. package/dist/test/index.d.ts +1 -1
  27. package/docs/README.md +9 -8
  28. package/docs/database.md +2 -2
  29. package/docs/endpoints.md +6 -5
  30. package/docs/getting-started.md +1 -1
  31. package/docs/llms-full.txt +38 -33
  32. package/docs/migrations.md +16 -14
  33. package/docs/schema.md +2 -2
  34. package/docs/services.md +2 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-HBOJLP2Z.js.map +0 -1
@@ -1,5 +1,5 @@
1
- export { A as AnyColumn, C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EmbeddingModelRef, g as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, j as PalbaseExtension, k as PolicyBuilder, l as PolicyCommand, m as PolicyDef, n as PolicyMode, R as RawConstraintDef, o as RowShape, S as SchemaDef, T as TABLE_META, p as TableDef, q as TableHandle, r as TableInput, s as TxPlan, t as TxTables, u as TypedDB, v as TypedTable, w as TypedTx, x as bigint, y as boolean, z as defineSchema, B as defineTable, D as enumType, F as installationRef, G as integer, H as isPalbaseExtension, J as jsonb, K as makeTypedDB, M as openai, N as ownedByUser, Q as policy, U as raw, V as text, W as timestamp, X as userRef, Y as uuid, Z as vector } from '../index-DmVyY6N7.cjs';
2
- export { M as Materialized, b1 as Ref, b3 as TxColumnExpr, b4 as TxInsertShape, b6 as TxNow, T as TxPlanBody, b7 as TxPlanError, b8 as TxPlanHandle, b9 as TxPlanOpResult, ba as TxPlanRejection, g as TxPlanResponse, bb as TxRefError, bc as TxRow, bd as TxRows, be as TxSelectOptions, bf as TxSetShape, bh as TxTable, bi as TxWhere, bs as dec, bu as inc, bv as now } from '../endpoint-BSGw1pTu.cjs';
1
+ export { A as AnyColumn, C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EmbeddingModelRef, g as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, j as PalbaseExtension, k as PolicyBuilder, l as PolicyCommand, m as PolicyDef, n as PolicyMode, R as RawConstraintDef, o as RowShape, S as SchemaDef, T as TABLE_META, p as TableDef, q as TableHandle, r as TableInput, s as TxPlan, t as TxTables, u as TypedDB, v as TypedTable, w as TypedTx, x as bigint, y as boolean, z as defineSchema, B as defineTable, D as enumType, F as installationRef, G as integer, H as isPalbaseExtension, J as jsonb, K as makeTypedDB, M as openai, N as ownedByUser, Q as policy, U as raw, V as text, W as timestamp, X as userRef, Y as uuid, Z as vector } from '../index-CmBK76nx.cjs';
2
+ export { M as Materialized, b1 as Ref, b3 as TxColumnExpr, b4 as TxInsertShape, b6 as TxNow, T as TxPlanBody, b7 as TxPlanError, b8 as TxPlanHandle, b9 as TxPlanOpResult, ba as TxPlanRejection, g as TxPlanResponse, bb as TxRefError, bc as TxRow, bd as TxRows, be as TxSelectOptions, bf as TxSetShape, bh as TxTable, bi as TxWhere, bs as dec, bu as inc, bv as now } from '../endpoint-DYHMo6cC.cjs';
3
3
  import './env.cjs';
4
4
  import '../stack.cjs';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
- export { A as AnyColumn, C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EmbeddingModelRef, g as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, j as PalbaseExtension, k as PolicyBuilder, l as PolicyCommand, m as PolicyDef, n as PolicyMode, R as RawConstraintDef, o as RowShape, S as SchemaDef, T as TABLE_META, p as TableDef, q as TableHandle, r as TableInput, s as TxPlan, t as TxTables, u as TypedDB, v as TypedTable, w as TypedTx, x as bigint, y as boolean, z as defineSchema, B as defineTable, D as enumType, F as installationRef, G as integer, H as isPalbaseExtension, J as jsonb, K as makeTypedDB, M as openai, N as ownedByUser, Q as policy, U as raw, V as text, W as timestamp, X as userRef, Y as uuid, Z as vector } from '../index-B4CcpqLb.js';
2
- export { M as Materialized, b1 as Ref, b3 as TxColumnExpr, b4 as TxInsertShape, b6 as TxNow, T as TxPlanBody, b7 as TxPlanError, b8 as TxPlanHandle, b9 as TxPlanOpResult, ba as TxPlanRejection, g as TxPlanResponse, bb as TxRefError, bc as TxRow, bd as TxRows, be as TxSelectOptions, bf as TxSetShape, bh as TxTable, bi as TxWhere, bs as dec, bu as inc, bv as now } from '../endpoint-DMwJjEHQ.js';
1
+ export { A as AnyColumn, C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EmbeddingModelRef, g as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, j as PalbaseExtension, k as PolicyBuilder, l as PolicyCommand, m as PolicyDef, n as PolicyMode, R as RawConstraintDef, o as RowShape, S as SchemaDef, T as TABLE_META, p as TableDef, q as TableHandle, r as TableInput, s as TxPlan, t as TxTables, u as TypedDB, v as TypedTable, w as TypedTx, x as bigint, y as boolean, z as defineSchema, B as defineTable, D as enumType, F as installationRef, G as integer, H as isPalbaseExtension, J as jsonb, K as makeTypedDB, M as openai, N as ownedByUser, Q as policy, U as raw, V as text, W as timestamp, X as userRef, Y as uuid, Z as vector } from '../index-CW21M9Z3.js';
2
+ export { M as Materialized, b1 as Ref, b3 as TxColumnExpr, b4 as TxInsertShape, b6 as TxNow, T as TxPlanBody, b7 as TxPlanError, b8 as TxPlanHandle, b9 as TxPlanOpResult, ba as TxPlanRejection, g as TxPlanResponse, bb as TxRefError, bc as TxRow, bd as TxRows, be as TxSelectOptions, bf as TxSetShape, bh as TxTable, bi as TxWhere, bs as dec, bu as inc, bv as now } from '../endpoint-CTEHhb7A.js';
3
3
  import './env.js';
4
4
  import '../stack.js';
5
5
  import 'zod';
package/dist/db/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  userRef,
23
23
  uuid,
24
24
  vector
25
- } from "../chunk-HBOJLP2Z.js";
25
+ } from "../chunk-7JSEN7UR.js";
26
26
  import {
27
27
  TxPlanError,
28
28
  TxRefError,
@@ -77,17 +77,28 @@ interface MiddlewareContext extends PalbaseModuleClients {
77
77
  /** Middleware function signature — receives context and next function. */
78
78
  type MiddlewareHandler = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
79
79
  /**
80
- * Define a middleware function for use in the middleware/ directory or
81
- * as endpoint-specific middleware.
80
+ * REMOVED IN BEHAVIOUR, KEPT IN NAME.
82
81
  *
83
- * Middleware runs before the handler. Call `next()` to pass control
84
- * to the next middleware or handler. If `next()` is not called, the
85
- * handler will not execute.
82
+ * There is no middleware pipeline in this runtime. No bundler reads a
83
+ * `middleware/` directory, the engine never calls a handler defined here, and
84
+ * measured on 2026-08-31 this function had no caller anywhere in the runtime or
85
+ * the CLI. It returned its argument unchanged, so code written against it
86
+ * compiled, deployed, and then never ran — with nothing reporting that.
86
87
  *
87
- * Errors thrown in middleware are caught by the pipeline and returned
88
- * as error responses.
88
+ * A silent shell is the worst version of a retired feature: it lets a user (or a
89
+ * coding assistant, which is how this surfaced) ship a request logger, an auth
90
+ * check or a rate limiter that simply does not exist in production. So the call
91
+ * refuses, and says where the work belongs.
92
+ *
93
+ * The SYMBOL survives because removing a published export costs a major and
94
+ * 25.0.1 had just shipped. Deleting it is a proposal for the next one; the types
95
+ * below stay either way, so a file that only annotates with them still compiles.
96
+ *
97
+ * This is the shape the SDK already uses for a retired surface: `@Query(schema)`
98
+ * on a parameter throws at decoration time with a message naming its
99
+ * replacement.
89
100
  */
90
- declare function defineMiddleware(fn: MiddlewareHandler): MiddlewareHandler;
101
+ declare function defineMiddleware(_fn: MiddlewareHandler): never;
91
102
 
92
103
  /**
93
104
  * tx-plan.ts — `Database.transaction()` as a PLAN, not a pinned session.
@@ -77,17 +77,28 @@ interface MiddlewareContext extends PalbaseModuleClients {
77
77
  /** Middleware function signature — receives context and next function. */
78
78
  type MiddlewareHandler = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
79
79
  /**
80
- * Define a middleware function for use in the middleware/ directory or
81
- * as endpoint-specific middleware.
80
+ * REMOVED IN BEHAVIOUR, KEPT IN NAME.
82
81
  *
83
- * Middleware runs before the handler. Call `next()` to pass control
84
- * to the next middleware or handler. If `next()` is not called, the
85
- * handler will not execute.
82
+ * There is no middleware pipeline in this runtime. No bundler reads a
83
+ * `middleware/` directory, the engine never calls a handler defined here, and
84
+ * measured on 2026-08-31 this function had no caller anywhere in the runtime or
85
+ * the CLI. It returned its argument unchanged, so code written against it
86
+ * compiled, deployed, and then never ran — with nothing reporting that.
86
87
  *
87
- * Errors thrown in middleware are caught by the pipeline and returned
88
- * as error responses.
88
+ * A silent shell is the worst version of a retired feature: it lets a user (or a
89
+ * coding assistant, which is how this surfaced) ship a request logger, an auth
90
+ * check or a rate limiter that simply does not exist in production. So the call
91
+ * refuses, and says where the work belongs.
92
+ *
93
+ * The SYMBOL survives because removing a published export costs a major and
94
+ * 25.0.1 had just shipped. Deleting it is a proposal for the next one; the types
95
+ * below stay either way, so a file that only annotates with them still compiles.
96
+ *
97
+ * This is the shape the SDK already uses for a retired surface: `@Query(schema)`
98
+ * on a parameter throws at decoration time with a message naming its
99
+ * replacement.
89
100
  */
90
- declare function defineMiddleware(fn: MiddlewareHandler): MiddlewareHandler;
101
+ declare function defineMiddleware(_fn: MiddlewareHandler): never;
91
102
 
92
103
  /**
93
104
  * tx-plan.ts — `Database.transaction()` as a PLAN, not a pinned session.
@@ -1,8 +1,8 @@
1
- export { A as App, m as AuthVerifier, B as BootRefused, n as CreateAppOptions, E as EgressPolicy, p as EngineConfig, M as ModuleClients, q as RateLimiter, r as RequestDatabase, s as RouteEntry, t as RuntimeHooks, u as ScrubResult, v as SqlDriver, w as SqlTx, x as buildRouteTable, y as createApp, z as createLazyTransaction, G as createOps, H as createRequestDatabase, I as effectiveAuth, J as hostAllowed, K as installEgressFence, O as loadConfig, P as makeMemoryCache, Q as matchRoute, T as quoteIdent, U as scrubSecrets, V as withTables } from '../index-VsjBQ4Kw.cjs';
2
- import '../endpoint-BSGw1pTu.cjs';
1
+ export { A as App, m as AuthVerifier, B as BootRefused, n as CreateAppOptions, E as EgressPolicy, p as EngineConfig, M as ModuleClients, q as RateLimiter, r as RequestDatabase, s as RouteEntry, t as RuntimeHooks, u as ScrubResult, v as SqlDriver, w as SqlTx, x as buildRouteTable, y as createApp, z as createLazyTransaction, G as createOps, H as createRequestDatabase, I as effectiveAuth, J as hostAllowed, K as installEgressFence, O as loadConfig, P as makeMemoryCache, Q as matchRoute, T as quoteIdent, U as scrubSecrets, V as withTables } from '../index-ClpDeSos.cjs';
2
+ import '../endpoint-DYHMo6cC.cjs';
3
3
  import '../stack.cjs';
4
4
  import 'node:async_hooks';
5
- import '../index-DmVyY6N7.cjs';
5
+ import '../index-CmBK76nx.cjs';
6
6
  import '../db/env.cjs';
7
- import '../registry-CgJvDYUW.cjs';
7
+ import '../registry-CC0WBQq6.cjs';
8
8
  import 'zod';
@@ -1,8 +1,8 @@
1
- export { A as App, m as AuthVerifier, B as BootRefused, n as CreateAppOptions, E as EgressPolicy, p as EngineConfig, M as ModuleClients, q as RateLimiter, r as RequestDatabase, s as RouteEntry, t as RuntimeHooks, u as ScrubResult, v as SqlDriver, w as SqlTx, x as buildRouteTable, y as createApp, z as createLazyTransaction, G as createOps, H as createRequestDatabase, I as effectiveAuth, J as hostAllowed, K as installEgressFence, O as loadConfig, P as makeMemoryCache, Q as matchRoute, T as quoteIdent, U as scrubSecrets, V as withTables } from '../index-B8v6hVyU.js';
2
- import '../endpoint-DMwJjEHQ.js';
1
+ export { A as App, m as AuthVerifier, B as BootRefused, n as CreateAppOptions, E as EgressPolicy, p as EngineConfig, M as ModuleClients, q as RateLimiter, r as RequestDatabase, s as RouteEntry, t as RuntimeHooks, u as ScrubResult, v as SqlDriver, w as SqlTx, x as buildRouteTable, y as createApp, z as createLazyTransaction, G as createOps, H as createRequestDatabase, I as effectiveAuth, J as hostAllowed, K as installEgressFence, O as loadConfig, P as makeMemoryCache, Q as matchRoute, T as quoteIdent, U as scrubSecrets, V as withTables } from '../index-CUomTA3e.js';
2
+ import '../endpoint-CTEHhb7A.js';
3
3
  import '../stack.js';
4
4
  import 'node:async_hooks';
5
- import '../index-B4CcpqLb.js';
5
+ import '../index-CW21M9Z3.js';
6
6
  import '../db/env.js';
7
- import '../registry-B8pld3fj.js';
7
+ import '../registry-dZZ5JKYg.js';
8
8
  import 'zod';
@@ -1,8 +1,8 @@
1
1
  import { Buckets, BucketTypes } from './stack.js';
2
2
  import { AsyncLocalStorage } from 'node:async_hooks';
3
- import { C as CacheClient, P as PalbaseDocsClient, a as PalbaseFlagsClient, L as Logger, b as PalbaseNotificationsClient, c as PalbaseRealtimeClient, D as DBClient, S as SecretsService, d as PalbaseStorageClient, e as PalbaseBucketClient, f as DBOps, T as TxPlanBody, g as TxPlanResponse, A as AuthSpec } from './endpoint-DMwJjEHQ.js';
4
- import { E as EnvTypedDatabase } from './index-B4CcpqLb.js';
5
- import { R as RouteMeta } from './registry-B8pld3fj.js';
3
+ import { C as CacheClient, P as PalbaseDocsClient, a as PalbaseFlagsClient, L as Logger, b as PalbaseNotificationsClient, c as PalbaseRealtimeClient, D as DBClient, S as SecretsService, d as PalbaseStorageClient, e as PalbaseBucketClient, f as DBOps, T as TxPlanBody, g as TxPlanResponse, A as AuthSpec } from './endpoint-CTEHhb7A.js';
4
+ import { E as EnvTypedDatabase } from './index-CW21M9Z3.js';
5
+ import { R as RouteMeta } from './registry-dZZ5JKYg.js';
6
6
 
7
7
  /**
8
8
  * runtime.ts — request-scoped service singletons.
@@ -1,5 +1,5 @@
1
1
  import { Tables, TableTypes, Schemas } from './db/env.js';
2
- import { D as DBClient, b8 as TxPlanHandle, bh as TxTable, M as Materialized } from './endpoint-DMwJjEHQ.js';
2
+ import { D as DBClient, b8 as TxPlanHandle, bh as TxTable, M as Materialized } from './endpoint-CTEHhb7A.js';
3
3
 
4
4
  /** On delete action for foreign key references. */
5
5
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
@@ -1,8 +1,8 @@
1
1
  import { Buckets, BucketTypes } from './stack.cjs';
2
2
  import { AsyncLocalStorage } from 'node:async_hooks';
3
- import { C as CacheClient, P as PalbaseDocsClient, a as PalbaseFlagsClient, L as Logger, b as PalbaseNotificationsClient, c as PalbaseRealtimeClient, D as DBClient, S as SecretsService, d as PalbaseStorageClient, e as PalbaseBucketClient, f as DBOps, T as TxPlanBody, g as TxPlanResponse, A as AuthSpec } from './endpoint-BSGw1pTu.cjs';
4
- import { E as EnvTypedDatabase } from './index-DmVyY6N7.cjs';
5
- import { R as RouteMeta } from './registry-CgJvDYUW.cjs';
3
+ import { C as CacheClient, P as PalbaseDocsClient, a as PalbaseFlagsClient, L as Logger, b as PalbaseNotificationsClient, c as PalbaseRealtimeClient, D as DBClient, S as SecretsService, d as PalbaseStorageClient, e as PalbaseBucketClient, f as DBOps, T as TxPlanBody, g as TxPlanResponse, A as AuthSpec } from './endpoint-DYHMo6cC.cjs';
4
+ import { E as EnvTypedDatabase } from './index-CmBK76nx.cjs';
5
+ import { R as RouteMeta } from './registry-CC0WBQq6.cjs';
6
6
 
7
7
  /**
8
8
  * runtime.ts — request-scoped service singletons.
@@ -1,5 +1,5 @@
1
1
  import { Tables, TableTypes, Schemas } from './db/env.cjs';
2
- import { D as DBClient, b8 as TxPlanHandle, bh as TxTable, M as Materialized } from './endpoint-BSGw1pTu.cjs';
2
+ import { D as DBClient, b8 as TxPlanHandle, bh as TxTable, M as Materialized } from './endpoint-DYHMo6cC.cjs';
3
3
 
4
4
  /** On delete action for foreign key references. */
5
5
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
package/dist/index.cjs CHANGED
@@ -1703,6 +1703,7 @@ function columnToJSON(column) {
1703
1703
  if (def.defaultNow === true) out.defaultNow = true;
1704
1704
  if (def.renamedFrom !== void 0) out.renamedFrom = def.renamedFrom;
1705
1705
  if (def.ignored === true) out.ignored = true;
1706
+ if (def.owns === true) out.owns = true;
1706
1707
  if (def.references !== void 0) {
1707
1708
  out.references = { table: def.references.table, column: def.references.column };
1708
1709
  }
@@ -3312,8 +3313,10 @@ function Req() {
3312
3313
  }
3313
3314
 
3314
3315
  // src/middleware.ts
3315
- function defineMiddleware(fn) {
3316
- return fn;
3316
+ function defineMiddleware(_fn) {
3317
+ throw new Error(
3318
+ "defineMiddleware() is not wired to anything: no bundler reads a `middleware/` directory and the engine has no middleware pipeline, so a handler defined here deploys and never runs. Put cross-cutting work in a service the controllers call, and use route options for auth (`@Controller(path, { auth })`) and rate limits (`@Get(path, { rateLimit })`)."
3319
+ );
3317
3320
  }
3318
3321
 
3319
3322
  // src/errors.ts