@palbase/backend 6.0.0 → 8.0.0

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.
@@ -110,6 +110,7 @@ var Flags = Object.assign(
110
110
  }
111
111
  }
112
112
  );
113
+ var Realtime = makeServiceProxy("Realtime");
113
114
 
114
115
  export {
115
116
  __requestALS,
@@ -123,6 +124,7 @@ export {
123
124
  Queue,
124
125
  Log,
125
126
  Notifications,
126
- Flags
127
+ Flags,
128
+ Realtime
127
129
  };
128
- //# sourceMappingURL=chunk-HAVXYTDJ.js.map
130
+ //# sourceMappingURL=chunk-SWT2QR5F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime.ts"],"sourcesContent":["/**\n * runtime.ts — request-scoped service singletons.\n *\n * The backend SDK no longer threads a `ctx` god-object through every handler.\n * Instead, controller methods import PascalCase service singletons directly:\n *\n * import { Controller, Post, Body, Database } from \"@palbase/backend\";\n *\n * \\@Controller(\"/todos\")\n * export default class TodosController {\n * \\@Post(\"\") create(\\@Body(CreateTodoBody) body: CreateTodoBody): unknown {\n * return Database.insert(\"todos\", { title: body.title });\n * }\n * }\n *\n * The singletons are thin Proxies. Every property access forwards to the live\n * client for the CURRENT request scope, resolved through {@link __getRuntime}.\n *\n * # Request-scope resolution (persistent app-server)\n *\n * The runtime is a long-running Node process that serves many concurrent\n * requests on one event loop (NOT a fresh subprocess per request). A single\n * module-global slot would let one in-flight request's services bleed into\n * another's. So the services are carried in an {@link AsyncLocalStorage} store\n * ({@link __requestALS}) that the runtime sets per request with\n * {@link __runWithRuntime}; every async continuation of that request reads its\n * own store. `__getRuntime` reads the ALS store first; the module-global slot\n * (set by {@link __setRuntime}) is only a fallback for callers that run OUTSIDE\n * an ALS scope (dev-server, unit tests, the legacy single-shot path). Because\n * each `br-<ref>` pod is single-tenant, there is no cross-tenant leakage; the\n * ALS store is what prevents cross-REQUEST leakage within the shared process.\n *\n * The seam that makes `import { Database } from \"@palbase/backend\"` resolve to\n * the runtime-injected client: `@palbase/backend` is marked esbuild-EXTERNAL\n * when the tenant bundle is built, and the package is installed globally in the\n * pod (NODE_PATH=/usr/local/lib/node_modules). So worker.js's\n * `require('@palbase/backend')` and the bundle's `import` resolve to ONE shared\n * module instance — the ALS store and `__setRuntime` slot on that instance are\n * visible to the singletons the bundle imported.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n\nimport type {\n DBClient,\n DBOps,\n TxClient,\n CacheClient,\n QueueClient,\n Logger,\n PalbaseDocsClient,\n} from \"./endpoint.js\";\nimport type {\n PalbaseStorageClient,\n PalbaseNotificationsClient,\n PalbaseFlagsClient,\n PalbaseFlagsServiceClient,\n PalbaseFlagContext,\n PalbaseFlagVariant,\n PalbaseFlag,\n PalbaseFlagValue,\n PalbaseSetOverrideResult,\n PalbaseRealtimeClient,\n} from \"./clients.js\";\nimport type { PalbaseResult } from \"./endpoint.js\";\nimport type {\n EnvTypedDatabase,\n EnvServiceDatabase,\n EnvTypedTx,\n EnvTables,\n} from \"./db/typed-db.js\";\n\n/** The set of live clients the runtime injects per request scope.\n *\n * Realtime is BROADCAST-ONLY here (a stateless handler can push an event but\n * cannot hold a subscription socket — `subscribe()` lives on the client SDK).\n *\n * EXCLUDED on purpose: Functions, CMS, Links, Analytics, Auth. They are not\n * exposed as backend handler singletons (auth lives on the client SDK; the rest\n * are out of scope for backend endpoints). */\nexport interface RuntimeServices {\n Database: DBClient;\n Documents: PalbaseDocsClient;\n Storage: PalbaseStorageClient;\n Cache: CacheClient;\n Queue: QueueClient;\n Log: Logger;\n Notifications: PalbaseNotificationsClient;\n Flags: PalbaseFlagsClient;\n Realtime: PalbaseRealtimeClient;\n}\n\n/**\n * Per-request store. The persistent runtime runs each request inside\n * {@link __runWithRuntime}, so every async continuation of that request reads\n * its OWN `runtime` (and any other request-scoped fields the runtime adds).\n *\n * Exported with a `__` prefix so the runtime (worker.js) shares the SAME ALS\n * instance across the one module instance — two ALS instances would silently\n * not see each other's stores. NOT part of the public author-facing API.\n */\nexport const __requestALS = new AsyncLocalStorage<{ runtime: RuntimeServices }>();\n\n/** Process-global fallback slot. Used only OUTSIDE an ALS scope (dev-server,\n * unit tests, legacy single-shot worker). Inside the persistent server every\n * request runs in {@link __requestALS}, which takes precedence. */\nlet runtime: RuntimeServices | null = null;\n\n/** Install the live clients in the process-global fallback slot.\n *\n * Persistent-server requests should use {@link __runWithRuntime} instead; this\n * remains for dev-server / tests / the legacy single-shot path that run without\n * an ALS scope. NOT part of the public author-facing API. */\nexport function __setRuntime(services: RuntimeServices): void {\n runtime = services;\n}\n\n/** Run `fn` with `services` bound as the request-scoped runtime.\n *\n * The persistent worker calls this once per request so concurrent requests\n * never share a services slot. NOT part of the public author-facing API. */\nexport function __runWithRuntime<T>(services: RuntimeServices, fn: () => T): T {\n return __requestALS.run({ runtime: services }, fn);\n}\n\n/** Read the live clients, throwing if accessed outside a request scope.\n *\n * Resolves the ALS store first (persistent server, per-request), then the\n * process-global fallback (dev-server / tests). NOT part of the public\n * author-facing API — used by the runtime and the singleton Proxies. */\nexport function __getRuntime(): RuntimeServices {\n const scoped = __requestALS.getStore();\n if (scoped) return scoped.runtime;\n if (runtime === null) {\n throw new Error(\n \"Palbase services accessed outside a request scope. The Database/Documents/… \" +\n \"singletons are only available inside an endpoint handler (or after the \" +\n \"runtime has called __runWithRuntime / __setRuntime).\",\n );\n }\n return runtime;\n}\n\n/**\n * Build a Proxy singleton that forwards every property access to the live\n * client named `key` on the current runtime.\n *\n * The single `as RuntimeServices[K]` is the only contained cast in the surface:\n * `Reflect.get` on a typed object returns `unknown` for a `string | symbol`\n * key, but `prop` is constrained to keys of the client interface at the call\n * sites (the exported singletons are typed below), so the forward is sound.\n */\nfunction makeServiceProxy<K extends keyof RuntimeServices>(key: K): RuntimeServices[K] {\n const handler: ProxyHandler<RuntimeServices[K]> = {\n get(_target, prop, receiver) {\n const client = __getRuntime()[key];\n const value = Reflect.get(client as object, prop, receiver) as unknown;\n // Bind methods to their owning client so `this` stays correct when the\n // author destructures or calls `Database.query(...)`.\n return typeof value === \"function\" ? value.bind(client) : value;\n },\n };\n // The Proxy target is irrelevant (all access goes through `get`); the cast\n // names the surface type the singleton presents to authors.\n return new Proxy({} as RuntimeServices[K], handler);\n}\n\n/**\n * Build the `.tables` accessor for an op-bearing client (the top-level\n * `Database` or a transaction-scoped `tx`). Each `tables.<name>` access\n * returns a small object that forwards the five CRUD ops to the underlying\n * client using `name` as the string table identifier. The shapes are typed\n * against the generated `palbase-env.d.ts` (`EnvTables`); at runtime they are\n * plain string-keyed calls, so no schema value is needed here.\n *\n * Returns `EnvTables` — TS cannot infer the mapped type through the Proxy, so\n * a single structural narrowing names the surface (the proxy returns a\n * correctly-shaped accessor for whatever string member is read).\n */\nfunction makeTablesAccessor(ops: () => TxClient): EnvTables {\n const tablesProxy = new Proxy(\n {},\n {\n get(_t, prop: string | symbol) {\n if (typeof prop !== \"string\") return undefined;\n const name = prop;\n return {\n insert: (data: Record<string, unknown>) => ops().insert(name, data),\n update: (id: string, data: Record<string, unknown>) => ops().update(name, id, data),\n delete: (id: string) => ops().delete(name, id),\n findById: (id: string) => ops().findById(name, id),\n findMany: (query?: Record<string, unknown>) => ops().findMany(name, query),\n };\n },\n },\n );\n return tablesProxy as EnvTables;\n}\n\n/** The raw string-keyed `DBClient` for the current request scope. */\nconst rawDatabase: DBClient = makeServiceProxy(\"Database\");\n\n/**\n * Wrap a raw `DBClient` into the typed `{ ...ops, tables, transaction }`\n * surface. The five string ops forward straight through; `tables` is the\n * env-typed accessor; `transaction` yields typed tables. Reused for both the\n * default (RLS-enforced) `Database` and the `asService()` sibling — each is\n * fed its own raw client (the default proxy vs `rawDatabase.asService()`).\n *\n * The `satisfies` pins the op surface so a missing/renamed op is a compile\n * error; the assembled object carries `tables`/`transaction` alongside.\n */\nfunction makeTypedSurface(raw: Omit<DBClient, \"asService\">): EnvServiceDatabase {\n const ops = {\n query: (sql: string, params?: unknown[]) => raw.query(sql, params),\n insert: (table: string, data: Record<string, unknown>) => raw.insert(table, data),\n update: (table: string, id: string, data: Record<string, unknown>) =>\n raw.update(table, id, data),\n delete: (table: string, id: string) => raw.delete(table, id),\n findById: (table: string, id: string) => raw.findById(table, id),\n findMany: (table: string, query?: Record<string, unknown>) => raw.findMany(table, query),\n } satisfies DBOps;\n return Object.assign(ops, {\n tables: makeTablesAccessor(() => raw),\n transaction<T>(fn: (tx: EnvTypedTx) => Promise<T>): Promise<T> {\n return raw.transaction((rawTx) => fn({ tables: makeTablesAccessor(() => rawTx) }));\n },\n });\n}\n\n/**\n * The project's own Postgres (pgx, schema `env_<envId>`).\n *\n * Typed by default: `Database.tables.<name>.insert({...})` is typed against\n * the project's generated `palbase-env.d.ts` with NO import and NO generic.\n * The raw string ops (`query`/`insert`/`update`/`delete`/`findById`/`findMany`)\n * are also available for dynamic table names and read-only SQL.\n *\n * RLS is enforced by default (the runtime runs each op as `authenticated` with\n * the verified user's claims). To bypass RLS, call `Database.asService()` —\n * explicit and greppable — which runs as the `service_role` (BYPASSRLS).\n *\n * @example\n * import { Database } from \"@palbase/backend\";\n *\n * const todo = await Database.tables.todos.insert({ title: req.input.title });\n * todo.id; // string ✓\n * const rows = await Database.query(\"SELECT id FROM todos WHERE done = $1\", [false]);\n * const all = await Database.asService().tables.todos.findMany({}); // RLS bypass\n */\nexport const Database: EnvTypedDatabase = Object.assign(makeTypedSurface(rawDatabase), {\n /**\n * Lazily resolve the runtime's service-role sibling on each call. We do NOT\n * cache it: `rawDatabase.asService()` reads the CURRENT request scope through\n * the runtime proxy, and the per-request runtime injects a service client\n * bound to that request's identity headers — caching would leak one request's\n * sibling into another concurrent request.\n */\n asService(): EnvServiceDatabase {\n return makeTypedSurface(rawDatabase.asService());\n },\n});\n\n/** Firestore-like document client (PalDocs). */\nexport const Documents: PalbaseDocsClient = makeServiceProxy(\"Documents\");\n\n/** Object storage client (buckets, signed URLs). */\nexport const Storage: PalbaseStorageClient = makeServiceProxy(\"Storage\");\n\n/** JSON-typed cache (get/set/incr/getOrSet). */\nexport const Cache: CacheClient = makeServiceProxy(\"Cache\");\n\n/** Background job queue. */\nexport const Queue: QueueClient = makeServiceProxy(\"Queue\");\n\n/** Structured logger. */\nexport const Log: Logger = makeServiceProxy(\"Log\");\n\n/** Push / email / SMS / in-app notifications. */\nexport const Notifications: PalbaseNotificationsClient = makeServiceProxy(\"Notifications\");\n\n/**\n * The raw runtime Flags client for the current request scope. Carries the\n * default-surface reads + `setOverride` AND the runtime's `asService()` sibling\n * (the br-pod's `buildFlagsClient` returns both). The default `Flags` singleton\n * below forwards reads + `setOverride` through here; `Flags.asService()`\n * forwards to this client's own `asService()`.\n */\nconst rawFlags: PalbaseFlagsClient = makeServiceProxy(\"Flags\");\n\n/**\n * Feature flags.\n *\n * Mirrors the `Database` / `Database.asService()` model. The default surface is\n * RLS-equivalent for flags: reads resolve against the CURRENT request user and\n * `Flags.setOverride(key, value)` writes an override for that same signed-in\n * user (no userId argument, no admin power). Cross-user admin writes\n * (`setOverrideForUser`, …) live behind `Flags.asService()` — explicit and\n * greppable, just like `Database.asService()`.\n *\n * @example\n * import { Flags } from \"@palbase/backend\";\n *\n * if (await Flags.isEnabled(\"new_checkout\")) { ... } // current user\n * await Flags.setOverride(\"new_checkout\", true); // current user\n * await Flags.asService().setOverrideForUser(\"u_9\", \"x\", true); // cross-user\n */\nexport const Flags: PalbaseFlagsClient = Object.assign(\n {\n isEnabled(\n flagName: string,\n context?: PalbaseFlagContext,\n ): Promise<PalbaseResult<boolean>> {\n return rawFlags.isEnabled(flagName, context);\n },\n getVariant(\n flagName: string,\n context?: PalbaseFlagContext,\n ): Promise<PalbaseResult<PalbaseFlagVariant>> {\n return rawFlags.getVariant(flagName, context);\n },\n getAll(context?: PalbaseFlagContext): Promise<PalbaseResult<PalbaseFlag[]>> {\n return rawFlags.getAll(context);\n },\n setOverride(\n key: string,\n value: PalbaseFlagValue,\n ): Promise<PalbaseResult<PalbaseSetOverrideResult>> {\n return rawFlags.setOverride(key, value);\n },\n },\n {\n /**\n * Lazily resolve the runtime's cross-user sibling on each call. We do NOT\n * cache it: `rawFlags.asService()` reads the CURRENT request scope through\n * the runtime proxy, so caching would leak one request's sibling into\n * another concurrent request. Mirrors `Database.asService()`.\n */\n asService(): PalbaseFlagsServiceClient {\n return rawFlags.asService();\n },\n },\n);\n\n/**\n * The Realtime broadcast singleton for the current request scope. Backend-side\n * Realtime is BROADCAST-ONLY (a stateless handler can push but not subscribe —\n * `subscribe()` lives on the client SDK's `pb.realtime`). Fire-and-forget:\n * `broadcast` resolves once accepted (or with an `error`), never blocking the\n * handler on subscribers.\n *\n * @example\n * import { Realtime } from \"@palbase/backend\";\n *\n * await Realtime.broadcast(\"room:42\", \"message\", { text, from: user.id });\n */\nexport const Realtime: PalbaseRealtimeClient = makeServiceProxy(\"Realtime\");\n"],"mappings":"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","names":[]}
@@ -1,4 +1,4 @@
1
- export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-DvhjkX6F.cjs';
1
+ export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-B-FNCK84.cjs';
2
2
  import './env.cjs';
3
- import '../endpoint-CfdiQbVC.cjs';
3
+ import '../endpoint-cDQyI6jH.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-BVnIdFpa.js';
1
+ export { C as ColumnBuilder, a as ColumnDef, b as ColumnMap, c as ColumnType, d as EXTENSION_DEPENDENCIES, e as EnvServiceDatabase, E as EnvTypedDatabase, I as InsertShape, O as OnDeleteAction, P as PALBASE_EXTENSIONS, i as PalbaseExtension, j as PolicyBuilder, k as PolicyCommand, l as PolicyDef, m as PolicyMode, R as RowShape, S as SchemaDef, n as SchemaInput, T as TableDef, o as TableInput, p as TypedDB, q as TypedTable, r as TypedTx, s as boolean, t as defineSchema, u as enumType, v as integer, w as isPalbaseExtension, x as jsonb, y as makeTypedDB, z as policy, A as text, B as timestamp, D as uuid } from '../index-BfnIO5G-.js';
2
2
  import './env.js';
3
- import '../endpoint-CfdiQbVC.js';
3
+ import '../endpoint-cDQyI6jH.js';
4
4
  import 'zod';
@@ -97,9 +97,15 @@ declare class PalError extends HttpError {
97
97
  declare abstract class NamedHttpError extends HttpError {
98
98
  protected constructor(status: number, defaultCode: string, name: string, message?: string, code?: string, data?: unknown);
99
99
  }
100
- /** 400 — the request was malformed or failed validation. */
100
+ /**
101
+ * 400 — the request was malformed or failed validation. Carries a fixed typed
102
+ * payload: `new BadRequest({ fields: [{ field: "email", message: "invalid" }] })`.
103
+ * The shape is declared once in the SDK so codegen surfaces `error.data.fields`
104
+ * typed on the client.
105
+ */
101
106
  declare class BadRequest extends NamedHttpError {
102
- constructor(message?: string, code?: string, data?: unknown);
107
+ readonly data: BadRequestData;
108
+ constructor(data: BadRequestData, message?: string);
103
109
  }
104
110
  /** 401 — the caller is not authenticated. */
105
111
  declare class Unauthorized extends NamedHttpError {
@@ -117,9 +123,32 @@ declare class NotFound extends NamedHttpError {
117
123
  declare class Conflict extends NamedHttpError {
118
124
  constructor(message?: string, code?: string, data?: unknown);
119
125
  }
120
- /** 429 the caller has exceeded the rate limit. */
126
+ /** A single field-level validation failure carried by {@link BadRequest}. */
127
+ interface FieldError {
128
+ /** The offending field's name (dotted path for nested fields). */
129
+ field: string;
130
+ /** Human-readable reason the field failed. */
131
+ message: string;
132
+ }
133
+ /** The fixed, typed payload {@link BadRequest} ships. */
134
+ interface BadRequestData {
135
+ /** The fields that failed validation. */
136
+ fields: FieldError[];
137
+ }
138
+ /** The fixed, typed payload {@link TooManyRequests} ships. */
139
+ interface TooManyRequestsData {
140
+ /** Seconds the caller should wait before retrying. */
141
+ retryAfter: number;
142
+ }
143
+ /**
144
+ * 429 — the caller has exceeded the rate limit. Carries a fixed typed payload:
145
+ * `new TooManyRequests({ retryAfter: 30 })`. The shape is declared once in the
146
+ * SDK (error-registry pre-seed) so codegen surfaces `error.data.retryAfter`
147
+ * typed on the client — no per-project definition needed.
148
+ */
121
149
  declare class TooManyRequests extends NamedHttpError {
122
- constructor(message?: string, code?: string, data?: unknown);
150
+ readonly data: TooManyRequestsData;
151
+ constructor(data: TooManyRequestsData, message?: string);
123
152
  }
124
153
 
125
154
  /**
@@ -324,12 +353,6 @@ interface PalbaseListOptions {
324
353
  order: "asc" | "desc";
325
354
  };
326
355
  }
327
- /** Realtime message shape for server-side publish. */
328
- interface PalbaseRealtimeMessage {
329
- type: "broadcast" | "presence" | "postgres_changes";
330
- event?: string;
331
- payload?: Record<string, unknown>;
332
- }
333
356
  /** Edge-function invoke options. */
334
357
  interface PalbaseInvokeOptions {
335
358
  body?: unknown;
@@ -964,39 +987,6 @@ interface PalbaseStorageClient {
964
987
  /** Get a bucket-scoped client for file operations. */
965
988
  bucket(name: string): PalbaseBucketClient;
966
989
  }
967
- /**
968
- * Channel reference for server-side realtime publish.
969
- * Omits browser subscription patterns (on(), presenceState()) and
970
- * internal test helpers (_injectWebSocket). All send operations are
971
- * synchronous — they throw if the channel is not subscribed.
972
- */
973
- interface PalbaseRealtimeChannel {
974
- /** The channel name. */
975
- readonly name: string;
976
- /** Send a message to all channel subscribers. */
977
- send(message: PalbaseRealtimeMessage): void;
978
- /** Track server presence state. */
979
- track(state: Record<string, unknown>): void;
980
- /** Remove server presence state. */
981
- untrack(): void;
982
- /** Subscribe (connect WebSocket). Returns `this` for chaining. */
983
- subscribe(): PalbaseRealtimeChannel;
984
- /** Unsubscribe (close WebSocket). */
985
- unsubscribe(): void;
986
- }
987
- /**
988
- * Realtime client available on `ctx.realtime`.
989
- * Server-side usage: get a channel, call send() to publish broadcasts.
990
- * Omits browser subscription patterns (onSnapshot, subscribe listeners).
991
- */
992
- interface PalbaseRealtimeClient {
993
- /** Get (or create) a named channel. */
994
- channel(name: string): PalbaseRealtimeChannel;
995
- /** Remove a channel and close its WebSocket. */
996
- removeChannel(name: string): void;
997
- /** Remove all channels and close all WebSockets. */
998
- removeAllChannels(): void;
999
- }
1000
990
  /**
1001
991
  * Functions client available on `ctx.functions`.
1002
992
  * Invoke edge functions from a backend endpoint.
@@ -1080,6 +1070,41 @@ interface PalbaseFlagsClient {
1080
1070
  */
1081
1071
  asService(): PalbaseFlagsServiceClient;
1082
1072
  }
1073
+ /**
1074
+ * Realtime broadcast surface (backend handler → subscribed clients).
1075
+ *
1076
+ * Backend-side this is BROADCAST-ONLY: a handler pushes an event to a channel
1077
+ * and every client subscribed to that channel (via the client SDK's
1078
+ * `pb.realtime.channel(...).on(...)`) receives it. There is no `subscribe()` on
1079
+ * the backend — a stateless request handler can't hold a socket; it fires an
1080
+ * HTTP broadcast and returns. Delivery is fire-and-forget: `broadcast` resolves
1081
+ * once the broadcast is accepted (or with an `error` if it could not be sent),
1082
+ * but it never blocks the handler waiting on subscribers.
1083
+ *
1084
+ * Channel naming is app-defined and arbitrary (e.g. `"room:42"`, `"orders"`).
1085
+ * The Palbase-managed `flags:<ref>` channels are internal — author channels for
1086
+ * your own features.
1087
+ *
1088
+ * @example
1089
+ * // Notify everyone in a chat room that a message landed:
1090
+ * await Realtime.broadcast("room:42", "message", { text, from: user.id });
1091
+ */
1092
+ interface PalbaseRealtimeClient {
1093
+ /**
1094
+ * Broadcast `event` with `payload` to everyone subscribed to `channel`.
1095
+ *
1096
+ * Fire-and-forget: resolves `{ data: undefined, error: null }` when the
1097
+ * broadcast was accepted, or `{ data: null, error }` when it could not be
1098
+ * sent (e.g. realtime not provisioned). A failed broadcast never throws and
1099
+ * never fails the handler.
1100
+ *
1101
+ * @param channel App-defined channel name (e.g. `"room:42"`). Do NOT prefix
1102
+ * with `"realtime:"` — that prefix is internal to the transport.
1103
+ * @param event Event name subscribers filter on (e.g. `"message"`).
1104
+ * @param payload JSON-serializable event body.
1105
+ */
1106
+ broadcast(channel: string, event: string, payload?: Record<string, unknown>): Promise<PalbaseResult<void>>;
1107
+ }
1083
1108
  /**
1084
1109
  * Push sub-client surface (server-only: fan-out to users / topics).
1085
1110
  */
@@ -1573,4 +1598,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
1573
1598
  */
1574
1599
  type AuthSpec = boolean | Partial<AuthConfig>;
1575
1600
 
1576
- export { type PalbaseCreateLinkParams as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchSetOverridesResult as G, HttpError as H, type PalbaseBindDeviceParams as I, type PalbaseBucketClient as J, type PalbaseClearAllOverridesResult as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearOverrideResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseCmsClient as S, type PalbaseCmsFindOneOptions as T, type User as U, type PalbaseCmsFindOptions as V, type PalbaseCohortQueryInput as W, type PalbaseCohortResult as X, type PalbaseCollectionRef as Y, type PalbaseCountQueryInput as Z, type PalbaseCountResult as _, type PalbaseModuleClients as a, type PalbaseUploadOptions as a$, type PalbaseDeviceInfo as a0, type PalbaseDeviceTokenView as a1, type PalbaseDocumentRef as a2, type PalbaseDocumentSnapshot as a3, type PalbaseEmailClient as a4, type PalbaseEmailSendParams as a5, type PalbaseEmailSendResponse as a6, type PalbaseEventNamesResult as a7, type PalbaseEventsQueryInput as a8, type PalbaseEventsResult as a9, type PalbaseMatchParams as aA, type PalbaseMultiChannelResponse as aB, type PalbaseOverviewResult as aC, type PalbasePreferences as aD, type PalbasePreferencesClient as aE, type PalbasePublicUrlResponse as aF, type PalbasePushClient as aG, type PalbasePushSendParams as aH, type PalbasePushSendResponse as aI, type PalbaseQrCodeOptions as aJ, type PalbaseQuerySnapshot as aK, type PalbaseRealtimeChannel as aL, type PalbaseRealtimeClient as aM, type PalbaseRealtimeMessage as aN, type PalbaseRegisterDeviceParams as aO, type PalbaseResult as aP, type PalbaseRetentionQueryInput as aQ, type PalbaseRetentionResult as aR, type PalbaseSession as aS, type PalbaseSetOverrideResult as aT, type PalbaseSetOverridesResult as aU, type PalbaseSignedUrlResponse as aV, type PalbaseSmsClient as aW, type PalbaseSmsSendParams as aX, type PalbaseSmsSendResponse as aY, type PalbaseTransformOptions as aZ, type PalbaseUpdateLinkParams as a_, type PalbaseFileObject as aa, type PalbaseFlag as ab, type PalbaseFlagContext as ac, type PalbaseFlagSource as ad, type PalbaseFlagValue as ae, type PalbaseFlagVariant as af, type PalbaseFlagsServiceClient as ag, type PalbaseFunctionsClient as ah, type PalbaseFunnelQueryInput as ai, type PalbaseFunnelResult as aj, type PalbaseIdentifyTraits as ak, type PalbaseInboxClient as al, type PalbaseInboxListOptions as am, type PalbaseInboxListResult as an, type PalbaseInboxMessage as ao, type PalbaseInboxSendParams as ap, type PalbaseInboxSendResponse as aq, type PalbaseInitialLink as ar, type PalbaseInvokeOptions as as, type PalbaseLink as at, type PalbaseLinkAnalytics as au, type PalbaseLinkDetails as av, type PalbaseLinksClient as aw, type PalbaseListLinksOptions as ax, type PalbaseListLinksResult as ay, type PalbaseListOptions as az, type PalbaseDocsClient as b, type PalbaseUser as b0, type PalbaseUserDetailResult as b1, type PalbaseUsersQueryInput as b2, type PalbaseUsersResult as b3, type PalbaseVerifyRequestSignatureParams as b4, type PalbaseWhereOperator as b5, TooManyRequests as b6, type TxClient as b7, Unauthorized as b8, defineMiddleware as b9, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseStorageClient as e, type AuthConfig as f, type ClientInfo as g, Conflict as h, type DBOps as i, type ErrorMap as j, type ErrorThrowers as k, Forbidden as l, type HttpMethod as m, type MiddlewareContext as n, type MiddlewareHandler as o, PalError as p, type PalbaseAnalyticsClient as q, type PalbaseAnalyticsManagementNamespace as r, type PalbaseAnalyticsProperties as s, type PalbaseAnalyticsQueryNamespace as t, type PalbaseAttestAndroidParams as u, type PalbaseAttestAndroidResult as v, type PalbaseAttestiOSParams as w, type PalbaseAttestiOSResult as x, type PalbaseAuthClient as y, type PalbaseBatchOverrideOperation as z };
1601
+ export { type PalbaseCountResult as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchOverrideOperation as G, HttpError as H, type PalbaseBatchSetOverridesResult as I, type PalbaseBindDeviceParams as J, type PalbaseBucketClient as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearAllOverridesResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCmsClient as T, type User as U, type PalbaseCmsFindOneOptions as V, type PalbaseCmsFindOptions as W, type PalbaseCohortQueryInput as X, type PalbaseCohortResult as Y, type PalbaseCollectionRef as Z, type PalbaseCountQueryInput as _, type PalbaseModuleClients as a, type PalbaseUserDetailResult as a$, type PalbaseCreateLinkParams as a0, type PalbaseDeviceInfo as a1, type PalbaseDeviceTokenView as a2, type PalbaseDocumentRef as a3, type PalbaseDocumentSnapshot as a4, type PalbaseEmailClient as a5, type PalbaseEmailSendParams as a6, type PalbaseEmailSendResponse as a7, type PalbaseEventNamesResult as a8, type PalbaseEventsQueryInput as a9, type PalbaseListOptions as aA, type PalbaseMatchParams as aB, type PalbaseMultiChannelResponse as aC, type PalbaseOverviewResult as aD, type PalbasePreferences as aE, type PalbasePreferencesClient as aF, type PalbasePublicUrlResponse as aG, type PalbasePushClient as aH, type PalbasePushSendParams as aI, type PalbasePushSendResponse as aJ, type PalbaseQrCodeOptions as aK, type PalbaseQuerySnapshot as aL, type PalbaseRegisterDeviceParams as aM, type PalbaseResult as aN, type PalbaseRetentionQueryInput as aO, type PalbaseRetentionResult as aP, type PalbaseSession as aQ, type PalbaseSetOverrideResult as aR, type PalbaseSetOverridesResult as aS, type PalbaseSignedUrlResponse as aT, type PalbaseSmsClient as aU, type PalbaseSmsSendParams as aV, type PalbaseSmsSendResponse as aW, type PalbaseTransformOptions as aX, type PalbaseUpdateLinkParams as aY, type PalbaseUploadOptions as aZ, type PalbaseUser as a_, type PalbaseEventsResult as aa, type PalbaseFileObject as ab, type PalbaseFlag as ac, type PalbaseFlagContext as ad, type PalbaseFlagSource as ae, type PalbaseFlagValue as af, type PalbaseFlagVariant as ag, type PalbaseFlagsServiceClient as ah, type PalbaseFunctionsClient as ai, type PalbaseFunnelQueryInput as aj, type PalbaseFunnelResult as ak, type PalbaseIdentifyTraits as al, type PalbaseInboxClient as am, type PalbaseInboxListOptions as an, type PalbaseInboxListResult as ao, type PalbaseInboxMessage as ap, type PalbaseInboxSendParams as aq, type PalbaseInboxSendResponse as ar, type PalbaseInitialLink as as, type PalbaseInvokeOptions as at, type PalbaseLink as au, type PalbaseLinkAnalytics as av, type PalbaseLinkDetails as aw, type PalbaseLinksClient as ax, type PalbaseListLinksOptions as ay, type PalbaseListLinksResult as az, type PalbaseDocsClient as b, type PalbaseUsersQueryInput as b0, type PalbaseUsersResult as b1, type PalbaseVerifyRequestSignatureParams as b2, type PalbaseWhereOperator as b3, TooManyRequests as b4, type TxClient as b5, Unauthorized as b6, defineMiddleware as b7, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type MiddlewareContext as o, type MiddlewareHandler as p, PalError as q, type PalbaseAnalyticsClient as r, type PalbaseAnalyticsManagementNamespace as s, type PalbaseAnalyticsProperties as t, type PalbaseAnalyticsQueryNamespace as u, type PalbaseAttestAndroidParams as v, type PalbaseAttestAndroidResult as w, type PalbaseAttestiOSParams as x, type PalbaseAttestiOSResult as y, type PalbaseAuthClient as z };
@@ -97,9 +97,15 @@ declare class PalError extends HttpError {
97
97
  declare abstract class NamedHttpError extends HttpError {
98
98
  protected constructor(status: number, defaultCode: string, name: string, message?: string, code?: string, data?: unknown);
99
99
  }
100
- /** 400 — the request was malformed or failed validation. */
100
+ /**
101
+ * 400 — the request was malformed or failed validation. Carries a fixed typed
102
+ * payload: `new BadRequest({ fields: [{ field: "email", message: "invalid" }] })`.
103
+ * The shape is declared once in the SDK so codegen surfaces `error.data.fields`
104
+ * typed on the client.
105
+ */
101
106
  declare class BadRequest extends NamedHttpError {
102
- constructor(message?: string, code?: string, data?: unknown);
107
+ readonly data: BadRequestData;
108
+ constructor(data: BadRequestData, message?: string);
103
109
  }
104
110
  /** 401 — the caller is not authenticated. */
105
111
  declare class Unauthorized extends NamedHttpError {
@@ -117,9 +123,32 @@ declare class NotFound extends NamedHttpError {
117
123
  declare class Conflict extends NamedHttpError {
118
124
  constructor(message?: string, code?: string, data?: unknown);
119
125
  }
120
- /** 429 the caller has exceeded the rate limit. */
126
+ /** A single field-level validation failure carried by {@link BadRequest}. */
127
+ interface FieldError {
128
+ /** The offending field's name (dotted path for nested fields). */
129
+ field: string;
130
+ /** Human-readable reason the field failed. */
131
+ message: string;
132
+ }
133
+ /** The fixed, typed payload {@link BadRequest} ships. */
134
+ interface BadRequestData {
135
+ /** The fields that failed validation. */
136
+ fields: FieldError[];
137
+ }
138
+ /** The fixed, typed payload {@link TooManyRequests} ships. */
139
+ interface TooManyRequestsData {
140
+ /** Seconds the caller should wait before retrying. */
141
+ retryAfter: number;
142
+ }
143
+ /**
144
+ * 429 — the caller has exceeded the rate limit. Carries a fixed typed payload:
145
+ * `new TooManyRequests({ retryAfter: 30 })`. The shape is declared once in the
146
+ * SDK (error-registry pre-seed) so codegen surfaces `error.data.retryAfter`
147
+ * typed on the client — no per-project definition needed.
148
+ */
121
149
  declare class TooManyRequests extends NamedHttpError {
122
- constructor(message?: string, code?: string, data?: unknown);
150
+ readonly data: TooManyRequestsData;
151
+ constructor(data: TooManyRequestsData, message?: string);
123
152
  }
124
153
 
125
154
  /**
@@ -324,12 +353,6 @@ interface PalbaseListOptions {
324
353
  order: "asc" | "desc";
325
354
  };
326
355
  }
327
- /** Realtime message shape for server-side publish. */
328
- interface PalbaseRealtimeMessage {
329
- type: "broadcast" | "presence" | "postgres_changes";
330
- event?: string;
331
- payload?: Record<string, unknown>;
332
- }
333
356
  /** Edge-function invoke options. */
334
357
  interface PalbaseInvokeOptions {
335
358
  body?: unknown;
@@ -964,39 +987,6 @@ interface PalbaseStorageClient {
964
987
  /** Get a bucket-scoped client for file operations. */
965
988
  bucket(name: string): PalbaseBucketClient;
966
989
  }
967
- /**
968
- * Channel reference for server-side realtime publish.
969
- * Omits browser subscription patterns (on(), presenceState()) and
970
- * internal test helpers (_injectWebSocket). All send operations are
971
- * synchronous — they throw if the channel is not subscribed.
972
- */
973
- interface PalbaseRealtimeChannel {
974
- /** The channel name. */
975
- readonly name: string;
976
- /** Send a message to all channel subscribers. */
977
- send(message: PalbaseRealtimeMessage): void;
978
- /** Track server presence state. */
979
- track(state: Record<string, unknown>): void;
980
- /** Remove server presence state. */
981
- untrack(): void;
982
- /** Subscribe (connect WebSocket). Returns `this` for chaining. */
983
- subscribe(): PalbaseRealtimeChannel;
984
- /** Unsubscribe (close WebSocket). */
985
- unsubscribe(): void;
986
- }
987
- /**
988
- * Realtime client available on `ctx.realtime`.
989
- * Server-side usage: get a channel, call send() to publish broadcasts.
990
- * Omits browser subscription patterns (onSnapshot, subscribe listeners).
991
- */
992
- interface PalbaseRealtimeClient {
993
- /** Get (or create) a named channel. */
994
- channel(name: string): PalbaseRealtimeChannel;
995
- /** Remove a channel and close its WebSocket. */
996
- removeChannel(name: string): void;
997
- /** Remove all channels and close all WebSockets. */
998
- removeAllChannels(): void;
999
- }
1000
990
  /**
1001
991
  * Functions client available on `ctx.functions`.
1002
992
  * Invoke edge functions from a backend endpoint.
@@ -1080,6 +1070,41 @@ interface PalbaseFlagsClient {
1080
1070
  */
1081
1071
  asService(): PalbaseFlagsServiceClient;
1082
1072
  }
1073
+ /**
1074
+ * Realtime broadcast surface (backend handler → subscribed clients).
1075
+ *
1076
+ * Backend-side this is BROADCAST-ONLY: a handler pushes an event to a channel
1077
+ * and every client subscribed to that channel (via the client SDK's
1078
+ * `pb.realtime.channel(...).on(...)`) receives it. There is no `subscribe()` on
1079
+ * the backend — a stateless request handler can't hold a socket; it fires an
1080
+ * HTTP broadcast and returns. Delivery is fire-and-forget: `broadcast` resolves
1081
+ * once the broadcast is accepted (or with an `error` if it could not be sent),
1082
+ * but it never blocks the handler waiting on subscribers.
1083
+ *
1084
+ * Channel naming is app-defined and arbitrary (e.g. `"room:42"`, `"orders"`).
1085
+ * The Palbase-managed `flags:<ref>` channels are internal — author channels for
1086
+ * your own features.
1087
+ *
1088
+ * @example
1089
+ * // Notify everyone in a chat room that a message landed:
1090
+ * await Realtime.broadcast("room:42", "message", { text, from: user.id });
1091
+ */
1092
+ interface PalbaseRealtimeClient {
1093
+ /**
1094
+ * Broadcast `event` with `payload` to everyone subscribed to `channel`.
1095
+ *
1096
+ * Fire-and-forget: resolves `{ data: undefined, error: null }` when the
1097
+ * broadcast was accepted, or `{ data: null, error }` when it could not be
1098
+ * sent (e.g. realtime not provisioned). A failed broadcast never throws and
1099
+ * never fails the handler.
1100
+ *
1101
+ * @param channel App-defined channel name (e.g. `"room:42"`). Do NOT prefix
1102
+ * with `"realtime:"` — that prefix is internal to the transport.
1103
+ * @param event Event name subscribers filter on (e.g. `"message"`).
1104
+ * @param payload JSON-serializable event body.
1105
+ */
1106
+ broadcast(channel: string, event: string, payload?: Record<string, unknown>): Promise<PalbaseResult<void>>;
1107
+ }
1083
1108
  /**
1084
1109
  * Push sub-client surface (server-only: fan-out to users / topics).
1085
1110
  */
@@ -1573,4 +1598,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
1573
1598
  */
1574
1599
  type AuthSpec = boolean | Partial<AuthConfig>;
1575
1600
 
1576
- export { type PalbaseCreateLinkParams as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchSetOverridesResult as G, HttpError as H, type PalbaseBindDeviceParams as I, type PalbaseBucketClient as J, type PalbaseClearAllOverridesResult as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearOverrideResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseCmsClient as S, type PalbaseCmsFindOneOptions as T, type User as U, type PalbaseCmsFindOptions as V, type PalbaseCohortQueryInput as W, type PalbaseCohortResult as X, type PalbaseCollectionRef as Y, type PalbaseCountQueryInput as Z, type PalbaseCountResult as _, type PalbaseModuleClients as a, type PalbaseUploadOptions as a$, type PalbaseDeviceInfo as a0, type PalbaseDeviceTokenView as a1, type PalbaseDocumentRef as a2, type PalbaseDocumentSnapshot as a3, type PalbaseEmailClient as a4, type PalbaseEmailSendParams as a5, type PalbaseEmailSendResponse as a6, type PalbaseEventNamesResult as a7, type PalbaseEventsQueryInput as a8, type PalbaseEventsResult as a9, type PalbaseMatchParams as aA, type PalbaseMultiChannelResponse as aB, type PalbaseOverviewResult as aC, type PalbasePreferences as aD, type PalbasePreferencesClient as aE, type PalbasePublicUrlResponse as aF, type PalbasePushClient as aG, type PalbasePushSendParams as aH, type PalbasePushSendResponse as aI, type PalbaseQrCodeOptions as aJ, type PalbaseQuerySnapshot as aK, type PalbaseRealtimeChannel as aL, type PalbaseRealtimeClient as aM, type PalbaseRealtimeMessage as aN, type PalbaseRegisterDeviceParams as aO, type PalbaseResult as aP, type PalbaseRetentionQueryInput as aQ, type PalbaseRetentionResult as aR, type PalbaseSession as aS, type PalbaseSetOverrideResult as aT, type PalbaseSetOverridesResult as aU, type PalbaseSignedUrlResponse as aV, type PalbaseSmsClient as aW, type PalbaseSmsSendParams as aX, type PalbaseSmsSendResponse as aY, type PalbaseTransformOptions as aZ, type PalbaseUpdateLinkParams as a_, type PalbaseFileObject as aa, type PalbaseFlag as ab, type PalbaseFlagContext as ac, type PalbaseFlagSource as ad, type PalbaseFlagValue as ae, type PalbaseFlagVariant as af, type PalbaseFlagsServiceClient as ag, type PalbaseFunctionsClient as ah, type PalbaseFunnelQueryInput as ai, type PalbaseFunnelResult as aj, type PalbaseIdentifyTraits as ak, type PalbaseInboxClient as al, type PalbaseInboxListOptions as am, type PalbaseInboxListResult as an, type PalbaseInboxMessage as ao, type PalbaseInboxSendParams as ap, type PalbaseInboxSendResponse as aq, type PalbaseInitialLink as ar, type PalbaseInvokeOptions as as, type PalbaseLink as at, type PalbaseLinkAnalytics as au, type PalbaseLinkDetails as av, type PalbaseLinksClient as aw, type PalbaseListLinksOptions as ax, type PalbaseListLinksResult as ay, type PalbaseListOptions as az, type PalbaseDocsClient as b, type PalbaseUser as b0, type PalbaseUserDetailResult as b1, type PalbaseUsersQueryInput as b2, type PalbaseUsersResult as b3, type PalbaseVerifyRequestSignatureParams as b4, type PalbaseWhereOperator as b5, TooManyRequests as b6, type TxClient as b7, Unauthorized as b8, defineMiddleware as b9, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseStorageClient as e, type AuthConfig as f, type ClientInfo as g, Conflict as h, type DBOps as i, type ErrorMap as j, type ErrorThrowers as k, Forbidden as l, type HttpMethod as m, type MiddlewareContext as n, type MiddlewareHandler as o, PalError as p, type PalbaseAnalyticsClient as q, type PalbaseAnalyticsManagementNamespace as r, type PalbaseAnalyticsProperties as s, type PalbaseAnalyticsQueryNamespace as t, type PalbaseAttestAndroidParams as u, type PalbaseAttestAndroidResult as v, type PalbaseAttestiOSParams as w, type PalbaseAttestiOSResult as x, type PalbaseAuthClient as y, type PalbaseBatchOverrideOperation as z };
1601
+ export { type PalbaseCountResult as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type ErrorDef as E, type FileContext as F, type PalbaseBatchOverrideOperation as G, HttpError as H, type PalbaseBatchSetOverridesResult as I, type PalbaseBindDeviceParams as J, type PalbaseBucketClient as K, type Logger as L, type Middleware as M, NotFound as N, type PalbaseClearAllOverridesResult as O, type PBRequest as P, type QueueClient as Q, type RateLimitConfig as R, type PalbaseClearOverrideResult as S, type PalbaseCmsClient as T, type User as U, type PalbaseCmsFindOneOptions as V, type PalbaseCmsFindOptions as W, type PalbaseCohortQueryInput as X, type PalbaseCohortResult as Y, type PalbaseCollectionRef as Z, type PalbaseCountQueryInput as _, type PalbaseModuleClients as a, type PalbaseUserDetailResult as a$, type PalbaseCreateLinkParams as a0, type PalbaseDeviceInfo as a1, type PalbaseDeviceTokenView as a2, type PalbaseDocumentRef as a3, type PalbaseDocumentSnapshot as a4, type PalbaseEmailClient as a5, type PalbaseEmailSendParams as a6, type PalbaseEmailSendResponse as a7, type PalbaseEventNamesResult as a8, type PalbaseEventsQueryInput as a9, type PalbaseListOptions as aA, type PalbaseMatchParams as aB, type PalbaseMultiChannelResponse as aC, type PalbaseOverviewResult as aD, type PalbasePreferences as aE, type PalbasePreferencesClient as aF, type PalbasePublicUrlResponse as aG, type PalbasePushClient as aH, type PalbasePushSendParams as aI, type PalbasePushSendResponse as aJ, type PalbaseQrCodeOptions as aK, type PalbaseQuerySnapshot as aL, type PalbaseRegisterDeviceParams as aM, type PalbaseResult as aN, type PalbaseRetentionQueryInput as aO, type PalbaseRetentionResult as aP, type PalbaseSession as aQ, type PalbaseSetOverrideResult as aR, type PalbaseSetOverridesResult as aS, type PalbaseSignedUrlResponse as aT, type PalbaseSmsClient as aU, type PalbaseSmsSendParams as aV, type PalbaseSmsSendResponse as aW, type PalbaseTransformOptions as aX, type PalbaseUpdateLinkParams as aY, type PalbaseUploadOptions as aZ, type PalbaseUser as a_, type PalbaseEventsResult as aa, type PalbaseFileObject as ab, type PalbaseFlag as ac, type PalbaseFlagContext as ad, type PalbaseFlagSource as ae, type PalbaseFlagValue as af, type PalbaseFlagVariant as ag, type PalbaseFlagsServiceClient as ah, type PalbaseFunctionsClient as ai, type PalbaseFunnelQueryInput as aj, type PalbaseFunnelResult as ak, type PalbaseIdentifyTraits as al, type PalbaseInboxClient as am, type PalbaseInboxListOptions as an, type PalbaseInboxListResult as ao, type PalbaseInboxMessage as ap, type PalbaseInboxSendParams as aq, type PalbaseInboxSendResponse as ar, type PalbaseInitialLink as as, type PalbaseInvokeOptions as at, type PalbaseLink as au, type PalbaseLinkAnalytics as av, type PalbaseLinkDetails as aw, type PalbaseLinksClient as ax, type PalbaseListLinksOptions as ay, type PalbaseListLinksResult as az, type PalbaseDocsClient as b, type PalbaseUsersQueryInput as b0, type PalbaseUsersResult as b1, type PalbaseVerifyRequestSignatureParams as b2, type PalbaseWhereOperator as b3, TooManyRequests as b4, type TxClient as b5, Unauthorized as b6, defineMiddleware as b7, type PalbaseFlagsClient as c, type PalbaseNotificationsClient as d, type PalbaseRealtimeClient as e, type PalbaseStorageClient as f, type AuthConfig as g, type ClientInfo as h, Conflict as i, type DBOps as j, type ErrorMap as k, type ErrorThrowers as l, Forbidden as m, type HttpMethod as n, type MiddlewareContext as o, type MiddlewareHandler as p, PalError as q, type PalbaseAnalyticsClient as r, type PalbaseAnalyticsManagementNamespace as s, type PalbaseAnalyticsProperties as t, type PalbaseAnalyticsQueryNamespace as u, type PalbaseAttestAndroidParams as v, type PalbaseAttestAndroidResult as w, type PalbaseAttestiOSParams as x, type PalbaseAttestiOSResult as y, type PalbaseAuthClient as z };
@@ -1,5 +1,5 @@
1
1
  import { Tables, TableTypes } from './db/env.cjs';
2
- import { D as DBClient } from './endpoint-CfdiQbVC.cjs';
2
+ import { D as DBClient } from './endpoint-cDQyI6jH.cjs';
3
3
 
4
4
  /** On delete action for foreign key references. */
5
5
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
@@ -1,5 +1,5 @@
1
1
  import { Tables, TableTypes } from './db/env.js';
2
- import { D as DBClient } from './endpoint-CfdiQbVC.js';
2
+ import { D as DBClient } from './endpoint-cDQyI6jH.js';
3
3
 
4
4
  /** On delete action for foreign key references. */
5
5
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';