@palbase/backend 17.3.0 → 18.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.
- package/dist/bin/palbase-backend.cjs +1848 -0
- package/dist/bin/palbase-backend.cjs.map +1 -0
- package/dist/bin/palbase-backend.d.cts +1 -0
- package/dist/bin/palbase-backend.d.ts +1 -0
- package/dist/bin/palbase-backend.js +168 -0
- package/dist/bin/palbase-backend.js.map +1 -0
- package/dist/chunk-7D4SUZUM.js +38 -0
- package/dist/chunk-7D4SUZUM.js.map +1 -0
- package/dist/chunk-N32VDWKH.js +172 -0
- package/dist/chunk-N32VDWKH.js.map +1 -0
- package/dist/chunk-POYAFBLF.js +189 -0
- package/dist/chunk-POYAFBLF.js.map +1 -0
- package/dist/chunk-QMVK4X3V.js +200 -0
- package/dist/chunk-QMVK4X3V.js.map +1 -0
- package/dist/chunk-SSGAMC26.js +342 -0
- package/dist/chunk-SSGAMC26.js.map +1 -0
- package/dist/chunk-VYH4U7ZQ.js +1138 -0
- package/dist/chunk-VYH4U7ZQ.js.map +1 -0
- package/dist/{chunk-IBIME7N2.js → chunk-W5ODXPY3.js} +2 -321
- package/dist/chunk-W5ODXPY3.js.map +1 -0
- package/dist/chunk-YL4C5NRY.js +90 -0
- package/dist/chunk-YL4C5NRY.js.map +1 -0
- package/dist/db/env.cjs.map +1 -1
- package/dist/db/env.d.cts +21 -1
- package/dist/db/env.d.ts +21 -1
- package/dist/db/index.cjs +15 -0
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +2 -1
- package/dist/db/index.d.ts +2 -1
- package/dist/db/index.js +9 -6
- package/dist/{index-J1tnAnFj.d.ts → endpoint-B0LpZixz.d.cts} +124 -667
- package/dist/{index-D6mRh4yq.d.cts → endpoint-B0LpZixz.d.ts} +124 -667
- package/dist/engine/index.cjs +1797 -0
- package/dist/engine/index.cjs.map +1 -0
- package/dist/engine/index.d.cts +7 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.js +43 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/index-B46CGNvx.d.cts +839 -0
- package/dist/index-BGSCWlUa.d.cts +674 -0
- package/dist/index-DZDUMth5.d.ts +839 -0
- package/dist/index-g-EzitI-.d.ts +674 -0
- package/dist/index.cjs +1046 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +290 -532
- package/dist/index.d.ts +290 -532
- package/dist/index.js +999 -509
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +6464 -0
- package/dist/openapi/index.cjs.map +1 -0
- package/dist/openapi/index.d.cts +170 -0
- package/dist/openapi/index.d.ts +170 -0
- package/dist/openapi/index.js +6248 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/registry-3BLYv4si.d.ts +338 -0
- package/dist/registry-Cw0YEYCg.d.cts +338 -0
- package/dist/test/index.js +2 -0
- package/dist/test/index.js.map +1 -1
- package/docs/database.md +16 -3
- package/docs/llms-full.txt +16 -3
- package/package.json +43 -13
- package/stager/package.json +4 -0
- package/stager/return_types.js +338 -0
- package/stager/stage.js +78 -0
- package/stager/throw_analysis.js +726 -0
- package/template/AGENTS.md +261 -0
- package/template/config/secrets.ts +24 -0
- package/template/controllers/health.controller.ts +30 -0
- package/template/db/schema.ts +35 -0
- package/template/package.json +18 -0
- package/template/tsconfig.json +30 -0
- package/LICENSE +0 -21
- package/dist/chunk-IBIME7N2.js.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tables, TableTypes } from './db/env.js';
|
|
2
1
|
import { ZodSchema, z } from 'zod';
|
|
3
2
|
|
|
4
3
|
/** Supported HTTP methods for endpoints. */
|
|
@@ -216,7 +215,7 @@ interface TxWireOp {
|
|
|
216
215
|
lock?: "update";
|
|
217
216
|
guard?: TxWireGuard;
|
|
218
217
|
}
|
|
219
|
-
/** The
|
|
218
|
+
/** The plan the engine executes on the request's own transaction. */
|
|
220
219
|
interface TxPlanBody {
|
|
221
220
|
ops: TxWireOp[];
|
|
222
221
|
}
|
|
@@ -225,7 +224,7 @@ interface TxPlanOpResult {
|
|
|
225
224
|
rows: Record<string, unknown>[];
|
|
226
225
|
rows_affected: number;
|
|
227
226
|
}
|
|
228
|
-
/**
|
|
227
|
+
/** One result per op, in plan order. */
|
|
229
228
|
interface TxPlanResponse {
|
|
230
229
|
results: TxPlanOpResult[];
|
|
231
230
|
}
|
|
@@ -430,11 +429,31 @@ declare function dec(by: number): TxColumnExpr;
|
|
|
430
429
|
* (e.g. `new Conflict("locked", "title_locked", { retryAfter: 30 })`). It rides
|
|
431
430
|
* through to the iOS typed enum's associated value.
|
|
432
431
|
*/
|
|
432
|
+
/**
|
|
433
|
+
* The brand that identifies an HttpError ACROSS SDK instances.
|
|
434
|
+
*
|
|
435
|
+
* A process legitimately holds more than one copy of this SDK — the runtime
|
|
436
|
+
* loads the engine from its own node_modules while the tenant's bundle carries
|
|
437
|
+
* an inlined copy, which is why the controller registry and the error registry
|
|
438
|
+
* are both anchored on `Symbol.for`. The one place that did not follow the
|
|
439
|
+
* pattern was the engine's catch: `err instanceof HttpError` compares CLASS
|
|
440
|
+
* IDENTITY, so a `throw new NotFound()` from the bundle's copy did not match
|
|
441
|
+
* the engine's copy and every typed error in every deployed backend degraded to
|
|
442
|
+
* `500 internal_error`. Measured through the edge on a real deploy: a route
|
|
443
|
+
* throwing `NotFound` answered 500 while the runtime's own log printed the
|
|
444
|
+
* error object with `status: 404` right beside it.
|
|
445
|
+
*
|
|
446
|
+
* `Symbol.for` puts this in the cross-realm registry, so every copy of the SDK
|
|
447
|
+
* agrees on it by VALUE rather than by identity.
|
|
448
|
+
*/
|
|
449
|
+
declare const HTTP_ERROR_BRAND: unique symbol;
|
|
433
450
|
declare class HttpError extends Error {
|
|
434
451
|
readonly status: number;
|
|
435
452
|
readonly error: string;
|
|
436
453
|
readonly errorDescription: string;
|
|
437
454
|
readonly data?: unknown;
|
|
455
|
+
/** See {@link HTTP_ERROR_BRAND} — how the engine recognises this across SDK copies. */
|
|
456
|
+
readonly [HTTP_ERROR_BRAND] = true;
|
|
438
457
|
constructor(status: number, error: string, errorDescription: string, data?: unknown);
|
|
439
458
|
/**
|
|
440
459
|
* Serialize to the standard Palbase error response format.
|
|
@@ -685,14 +704,28 @@ interface PalbaseBatchSetOverridesResult {
|
|
|
685
704
|
}
|
|
686
705
|
/** File object returned by storage operations. */
|
|
687
706
|
interface PalbaseFileObject {
|
|
707
|
+
/** The object's path inside its bucket. `name` is the same value. */
|
|
708
|
+
path: string;
|
|
688
709
|
name: string;
|
|
689
|
-
id: string;
|
|
690
710
|
bucket: string;
|
|
691
|
-
createdAt: string;
|
|
692
|
-
updatedAt: string;
|
|
693
711
|
size: number;
|
|
694
712
|
contentType: string;
|
|
695
|
-
|
|
713
|
+
/** SHA-256 of the stored bytes, computed as they were written. */
|
|
714
|
+
checksum: string;
|
|
715
|
+
/** Present for images: the decoded dimensions of the ORIGINAL. */
|
|
716
|
+
width?: number;
|
|
717
|
+
height?: number;
|
|
718
|
+
/**
|
|
719
|
+
* A ThumbHash — a few dozen bytes that render as a blurred preview while the
|
|
720
|
+
* real image loads, with no second request to fetch it.
|
|
721
|
+
*/
|
|
722
|
+
thumbhash?: string;
|
|
723
|
+
/**
|
|
724
|
+
* Declared rendition name → the URL that serves it. Produced at upload from
|
|
725
|
+
* what `config/storage.ts` declared, so this is a lookup rather than a
|
|
726
|
+
* transform anyone pays for per request.
|
|
727
|
+
*/
|
|
728
|
+
variants: Record<string, string>;
|
|
696
729
|
}
|
|
697
730
|
/** Storage signed URL response. */
|
|
698
731
|
interface PalbaseSignedUrlResponse {
|
|
@@ -1367,10 +1400,33 @@ interface PalbaseBucketClient {
|
|
|
1367
1400
|
upload(path: string, file: Blob | ArrayBuffer | ReadableStream, options?: PalbaseUploadOptions): Promise<PalbaseResult<PalbaseFileObject>>;
|
|
1368
1401
|
/** Download a file as a Blob. */
|
|
1369
1402
|
download(path: string): Promise<PalbaseResult<Blob>>;
|
|
1370
|
-
/**
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1403
|
+
/**
|
|
1404
|
+
* The public URL for an object, or for one of its declared renditions.
|
|
1405
|
+
*
|
|
1406
|
+
* `variant` names a rendition from `config/storage.ts` — NOT arbitrary
|
|
1407
|
+
* dimensions. Renditions are produced at upload and served as immutable
|
|
1408
|
+
* objects, so a URL here costs nothing to serve and caches forever; an
|
|
1409
|
+
* arbitrary size would be a transform on the request path, one public URL
|
|
1410
|
+
* away from a CPU amplification attack.
|
|
1411
|
+
*
|
|
1412
|
+
* Asking for a variant the bucket does not declare is an error rather than a
|
|
1413
|
+
* silent fall back to the original: an app that requested a 200px thumbnail
|
|
1414
|
+
* and quietly received a 5 MB photograph works, looks right, and is found
|
|
1415
|
+
* months later on a bandwidth bill.
|
|
1416
|
+
*/
|
|
1417
|
+
getPublicUrl(path: string, options?: {
|
|
1418
|
+
variant?: string;
|
|
1419
|
+
}): string;
|
|
1420
|
+
/**
|
|
1421
|
+
* A time-limited URL for a private object.
|
|
1422
|
+
*
|
|
1423
|
+
* The duration is NAMED (`{ expiresIn: "1h" }`) rather than a bare number,
|
|
1424
|
+
* because "3600" reads as seconds to whoever wrote it and as minutes to
|
|
1425
|
+
* whoever maintains it. Same human spelling `fileSizeLimit` takes.
|
|
1426
|
+
*/
|
|
1427
|
+
createSignedUrl(path: string, options: {
|
|
1428
|
+
expiresIn: string;
|
|
1429
|
+
}): Promise<PalbaseResult<PalbaseSignedUrlResponse>>;
|
|
1374
1430
|
/** List objects in the bucket (optionally filtered by prefix). */
|
|
1375
1431
|
list(prefix?: string, options?: PalbaseListOptions): Promise<PalbaseResult<PalbaseFileObject[]>>;
|
|
1376
1432
|
/** Delete one or more objects. */
|
|
@@ -1448,6 +1504,21 @@ interface PalbaseFlagsClient {
|
|
|
1448
1504
|
getVariant(flagName: string, context?: PalbaseFlagContext): Promise<PalbaseResult<PalbaseFlagVariant>>;
|
|
1449
1505
|
/** Get all flags for the project. */
|
|
1450
1506
|
getAll(context?: PalbaseFlagContext): Promise<PalbaseResult<PalbaseFlag[]>>;
|
|
1507
|
+
/**
|
|
1508
|
+
* Resolve a flag's value, with an optional fallback.
|
|
1509
|
+
*
|
|
1510
|
+
* `get(key)` · `get(key, default)` · `get(key, ctx)` · `get(key, default, ctx)`.
|
|
1511
|
+
* The default is substituted when the flag is absent AND when the flags
|
|
1512
|
+
* service is unreachable — a product that hides a feature because a lookup
|
|
1513
|
+
* timed out is behaving correctly.
|
|
1514
|
+
*
|
|
1515
|
+
* Declared here as of 2026-08-15. The client has always had it and its tests
|
|
1516
|
+
* have always covered it, but the interface did not: `Flags.get("x")` was a
|
|
1517
|
+
* type error in a handler and worked at runtime. That is the same gap as
|
|
1518
|
+
* `Documents.doc(...)` — declared and never implemented — seen from the other
|
|
1519
|
+
* side, and moving the implementation into this package is what surfaced it.
|
|
1520
|
+
*/
|
|
1521
|
+
get(flagName: string, defaultOrContext?: PalbaseFlagValue | PalbaseFlagContext, maybeContext?: PalbaseFlagContext): Promise<PalbaseResult<PalbaseFlagValue>>;
|
|
1451
1522
|
/**
|
|
1452
1523
|
* Set (or replace) a single feature-flag override for the CURRENT REQUEST
|
|
1453
1524
|
* USER. No userId argument — the override is bound to the signed-in user the
|
|
@@ -1745,7 +1816,8 @@ interface DBOps {
|
|
|
1745
1816
|
/** Database client interface injected into endpoint context. */
|
|
1746
1817
|
interface DBClient extends DBOps {
|
|
1747
1818
|
/**
|
|
1748
|
-
* Run a whole transaction
|
|
1819
|
+
* Run a whole transaction as ONE plan, executed on the request's own
|
|
1820
|
+
* transaction inside a savepoint.
|
|
1749
1821
|
*
|
|
1750
1822
|
* The low-level seam behind `Database.transaction(plan)`: the SDK builds the
|
|
1751
1823
|
* plan, this sends it, and the broker executes every operation inside a single
|
|
@@ -1782,6 +1854,22 @@ interface Logger {
|
|
|
1782
1854
|
* value (objects, arrays, numbers, booleans, strings) round-trips. `get<T>`
|
|
1783
1855
|
* therefore returns `T | null` rather than `string | null`.
|
|
1784
1856
|
*/
|
|
1857
|
+
/**
|
|
1858
|
+
* The tenant's secrets, as a controller sees them.
|
|
1859
|
+
*
|
|
1860
|
+
* `get` answers null for a name this tenant has not set — including every name
|
|
1861
|
+
* the STACK holds, which is not an accident of storage but the shape of the
|
|
1862
|
+
* surface: the runtime is handed a tenant client, and there is no route that
|
|
1863
|
+
* returns a platform secret's value at all. Tenant code cannot read the keys
|
|
1864
|
+
* the stack signs with, by mistake or on purpose.
|
|
1865
|
+
*
|
|
1866
|
+
* Reads are cheap. The value is held in the process and dropped when the deploy
|
|
1867
|
+
* pointer reports a new secrets generation, so a rotated secret arrives without
|
|
1868
|
+
* a restart and a hot path pays a map lookup.
|
|
1869
|
+
*/
|
|
1870
|
+
interface SecretsService {
|
|
1871
|
+
get(name: string): Promise<string | null>;
|
|
1872
|
+
}
|
|
1785
1873
|
interface CacheClient {
|
|
1786
1874
|
/** Read a value. Returns `null` on a cache miss. */
|
|
1787
1875
|
get<T = unknown>(key: string): Promise<T | null>;
|
|
@@ -1826,6 +1914,11 @@ interface PalbaseQuerySnapshot<T = Record<string, unknown>> {
|
|
|
1826
1914
|
docs: PalbaseDocumentSnapshot<T>[];
|
|
1827
1915
|
empty: boolean;
|
|
1828
1916
|
size: number;
|
|
1917
|
+
/** Firestore-shaped change list. Every document of a one-shot read is "added". */
|
|
1918
|
+
docChanges(): Array<{
|
|
1919
|
+
type: "added";
|
|
1920
|
+
doc: PalbaseDocumentSnapshot<T>;
|
|
1921
|
+
}>;
|
|
1829
1922
|
}
|
|
1830
1923
|
/** Comparison operators supported by docs.where(). */
|
|
1831
1924
|
type PalbaseWhereOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "array-contains";
|
|
@@ -1836,6 +1929,8 @@ interface PalbaseDocumentRef<T = Record<string, unknown>> {
|
|
|
1836
1929
|
get(): Promise<PalbaseResult<PalbaseDocumentSnapshot<T>>>;
|
|
1837
1930
|
update(data: Partial<T>): Promise<PalbaseResult<void>>;
|
|
1838
1931
|
delete(): Promise<PalbaseResult<void>>;
|
|
1932
|
+
/** A subcollection of this document — `rooms/1` → `rooms/1/messages`. */
|
|
1933
|
+
collection<C extends Record<string, unknown> = Record<string, unknown>>(name: string): PalbaseCollectionRef<C>;
|
|
1839
1934
|
}
|
|
1840
1935
|
/** Collection reference exposed by Documents.collection(...). */
|
|
1841
1936
|
interface PalbaseCollectionRef<T = Record<string, unknown>> {
|
|
@@ -1849,8 +1944,22 @@ interface PalbaseCollectionRef<T = Record<string, unknown>> {
|
|
|
1849
1944
|
}
|
|
1850
1945
|
/** Docs client surface available on the Documents singleton. */
|
|
1851
1946
|
interface PalbaseDocsClient {
|
|
1852
|
-
collection<T = Record<string, unknown>>(path: string): PalbaseCollectionRef<T>;
|
|
1853
|
-
doc<T = Record<string, unknown>>(path: string): PalbaseDocumentRef<T>;
|
|
1947
|
+
collection<T extends Record<string, unknown> = Record<string, unknown>>(path: string): PalbaseCollectionRef<T>;
|
|
1948
|
+
doc<T extends Record<string, unknown> = Record<string, unknown>>(path: string): PalbaseDocumentRef<T>;
|
|
1949
|
+
/**
|
|
1950
|
+
* Apply up to 500 writes in one call.
|
|
1951
|
+
*
|
|
1952
|
+
* Declared here because the client has always offered it: an interface that
|
|
1953
|
+
* described less than the implementation is how `Documents.doc(...)` came to
|
|
1954
|
+
* be declared and never implemented — the gap this whole move exists to close.
|
|
1955
|
+
*/
|
|
1956
|
+
batch(operations: Array<{
|
|
1957
|
+
op: "set" | "update" | "delete";
|
|
1958
|
+
ref: {
|
|
1959
|
+
path: string;
|
|
1960
|
+
};
|
|
1961
|
+
data?: unknown;
|
|
1962
|
+
}>): Promise<PalbaseResult<void>>;
|
|
1854
1963
|
}
|
|
1855
1964
|
/** Calling-client metadata, derived from request headers.
|
|
1856
1965
|
*
|
|
@@ -2002,656 +2111,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
|
|
|
2002
2111
|
*/
|
|
2003
2112
|
type AuthSpec = boolean | Partial<AuthConfig>;
|
|
2004
2113
|
|
|
2005
|
-
|
|
2006
|
-
type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
|
2007
|
-
/**
|
|
2008
|
-
* The ON DELETE actions permitted on a foreign key to the built-in auth users
|
|
2009
|
-
* (`auth.users`). Both let a user's rows be removed (`cascade`) or detached
|
|
2010
|
-
* (`set null`) when the account is erased; `restrict` / `no action` would BLOCK
|
|
2011
|
-
* erasure and are therefore excluded. This is the CLIENT-SIDE mirror of the
|
|
2012
|
-
* server's auth-FK deletion policy — the server (validateAuthUserFK) is the real
|
|
2013
|
-
* boundary, this narrows the type so the common mistake is caught at compile time.
|
|
2014
|
-
*/
|
|
2015
|
-
type AuthUserOnDelete = Extract<OnDeleteAction, 'cascade' | 'set null'>;
|
|
2016
|
-
/** Column type identifiers. */
|
|
2017
|
-
type ColumnType = 'uuid' | 'text' | 'integer' | 'bigint' | 'numeric' | 'boolean' | 'timestamp' | 'jsonb' | 'enum';
|
|
2018
|
-
/** Base column definition shared by all column types. */
|
|
2019
|
-
interface ColumnDef {
|
|
2020
|
-
type: ColumnType;
|
|
2021
|
-
nullable: boolean;
|
|
2022
|
-
primaryKey: boolean;
|
|
2023
|
-
defaultValue?: unknown;
|
|
2024
|
-
defaultRandom?: boolean;
|
|
2025
|
-
defaultNow?: boolean;
|
|
2026
|
-
references?: {
|
|
2027
|
-
table: string;
|
|
2028
|
-
column: string;
|
|
2029
|
-
};
|
|
2030
|
-
onDeleteAction?: OnDeleteAction;
|
|
2031
|
-
enumName?: string;
|
|
2032
|
-
enumValues?: string[];
|
|
2033
|
-
unique?: boolean;
|
|
2034
|
-
}
|
|
2035
|
-
declare const __colKind: unique symbol;
|
|
2036
|
-
declare const __colNullable: unique symbol;
|
|
2037
|
-
declare const __colHasDefault: unique symbol;
|
|
2038
|
-
declare const __colEnumValues: unique symbol;
|
|
2039
|
-
declare const __colPayload: unique symbol;
|
|
2040
|
-
/**
|
|
2041
|
-
* Fluent column builder with phantom type params:
|
|
2042
|
-
* K — ColumnType literal (e.g. "text", "integer")
|
|
2043
|
-
* N — boolean: true when nullable() has been called last (false = NOT NULL)
|
|
2044
|
-
* D — boolean: true when a default has been set
|
|
2045
|
-
* E — enum value union (never for non-enum columns)
|
|
2046
|
-
* P — jsonb payload shape (unknown unless jsonb<T>() supplied one)
|
|
2047
|
-
*
|
|
2048
|
-
* All five params have defaults so bare `ColumnBuilder` (no args) still
|
|
2049
|
-
* satisfies `Record<string, ColumnBuilder>` in schema.ts without modification.
|
|
2050
|
-
*
|
|
2051
|
-
* The five `declare readonly` brand fields carry the phantom types into the
|
|
2052
|
-
* structural shape so that conditional types like ColValue<C> can discriminate
|
|
2053
|
-
* on K without requiring runtime values on those fields.
|
|
2054
|
-
*/
|
|
2055
|
-
declare class ColumnBuilder<K extends ColumnType = ColumnType, N extends boolean = boolean, D extends boolean = boolean, E = unknown, P = unknown> {
|
|
2056
|
-
readonly [__colKind]: K;
|
|
2057
|
-
readonly [__colNullable]: N;
|
|
2058
|
-
readonly [__colHasDefault]: D;
|
|
2059
|
-
readonly [__colEnumValues]: E;
|
|
2060
|
-
readonly [__colPayload]: P;
|
|
2061
|
-
readonly _def: ColumnDef;
|
|
2062
|
-
constructor(type: K, existingDef?: ColumnDef);
|
|
2063
|
-
/** Mark this column as the primary key. */
|
|
2064
|
-
primaryKey(): ColumnBuilder<K, N, D, E, P>;
|
|
2065
|
-
/** Mark this column as NOT NULL (default). */
|
|
2066
|
-
notNull(): ColumnBuilder<K, false, D, E, P>;
|
|
2067
|
-
/** Allow NULL values. */
|
|
2068
|
-
nullable(): ColumnBuilder<K, true, D, E, P>;
|
|
2069
|
-
/** Set a default value. */
|
|
2070
|
-
default(value: unknown): ColumnBuilder<K, N, true, E, P>;
|
|
2071
|
-
/** UUID: generate a random default (gen_random_uuid()). */
|
|
2072
|
-
defaultRandom(): ColumnBuilder<K, N, true, E, P>;
|
|
2073
|
-
/** Timestamp: default to now(). */
|
|
2074
|
-
defaultNow(): ColumnBuilder<K, N, true, E, P>;
|
|
2075
|
-
/** Add a foreign key reference. */
|
|
2076
|
-
references(table: string, column: string): ColumnBuilder<K, N, D, E, P>;
|
|
2077
|
-
/**
|
|
2078
|
-
* Add a real DB-level foreign key to the built-in auth users
|
|
2079
|
-
* (`REFERENCES auth.users(id)`), so a column like `user_id` gets true
|
|
2080
|
-
* database cascade/integrity instead of app-layer-only. Sugar for
|
|
2081
|
-
* `.references("auth.users", "id")`.
|
|
2082
|
-
*
|
|
2083
|
-
* `auth.users` lives in the SAME tenant database (palauth-owned), so this is
|
|
2084
|
-
* a genuine cross-schema integrity constraint scoped to THIS tenant's users.
|
|
2085
|
-
* The referenced `auth.users.id` is `text` (palauth ids are `usr_<uuid>`), so
|
|
2086
|
-
* the referencing column must be `text()` too.
|
|
2087
|
-
*
|
|
2088
|
-
* ON DELETE is REQUIRED here and may only be `cascade` or `set null`: an
|
|
2089
|
-
* account-erasure request must never be blocked by a lingering FK, so
|
|
2090
|
-
* `restrict` / `no action` are not accepted (they don't type-check). Example:
|
|
2091
|
-
* `text().notNull().referencesAuthUser("cascade")`, or
|
|
2092
|
-
* `text().nullable().referencesAuthUser("set null")`. The server
|
|
2093
|
-
* (validateAuthUserFK) enforces this — and the remaining rules the type can't
|
|
2094
|
-
* express (referencing column is text, `set null` needs a nullable column) —
|
|
2095
|
-
* as the real boundary; this signature is the compile-time DX mirror.
|
|
2096
|
-
*/
|
|
2097
|
-
referencesAuthUser(onDelete: AuthUserOnDelete): ColumnBuilder<K, N, D, E, P>;
|
|
2098
|
-
/**
|
|
2099
|
-
* Add a real DB-level foreign key to the canonical, server-minted installation
|
|
2100
|
-
* anchor (`REFERENCES auth.installations(id)`) — the app-scoped verified-device
|
|
2101
|
-
* root (`ins_...`). Sugar for `.references("auth.installations", "id")`.
|
|
2102
|
-
*
|
|
2103
|
-
* An installation is an APP INSTALL, not a user: this FK is NOT user ownership.
|
|
2104
|
-
* A user-owned row STILL needs its own `.referencesAuthUser(...)` FK so account
|
|
2105
|
-
* erasure removes it — an installation reference alone does not tie a row to a
|
|
2106
|
-
* user's deletion. Use this only for install-scoped state (device prefs, push
|
|
2107
|
-
* routing, …), alongside a separate auth-user FK where the row is user-owned.
|
|
2108
|
-
*
|
|
2109
|
-
* `auth.installations` lives in the SAME tenant DB (palauth-owned); its `id` is
|
|
2110
|
-
* `text` (`ins_<uuid>`), so the referencing column must be `text()` too. ON
|
|
2111
|
-
* DELETE is REQUIRED and may only be `cascade` or `set null` (same allowed set
|
|
2112
|
-
* as an auth-user FK): an installation revoke / orphan cleanup must never be
|
|
2113
|
-
* blocked by a lingering FK. The server (validateAuthAnchorFK) is the real
|
|
2114
|
-
* boundary; this signature is the compile-time DX mirror.
|
|
2115
|
-
*/
|
|
2116
|
-
referencesInstallation(onDelete: AuthUserOnDelete): ColumnBuilder<K, N, D, E, P>;
|
|
2117
|
-
/** Set the ON DELETE action for a foreign key reference. */
|
|
2118
|
-
onDelete(action: OnDeleteAction): ColumnBuilder<K, N, D, E, P>;
|
|
2119
|
-
/** Add a single-column UNIQUE constraint. */
|
|
2120
|
-
unique(): ColumnBuilder<K, N, D, E, P>;
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* Extracts the TypeScript value type for a column, respecting nullability.
|
|
2124
|
-
* - "uuid" | "text" | "timestamp" | "bigint" | "numeric" → string (or string | null when N = true)
|
|
2125
|
-
* Note: bigint/numeric surface as string — JS number loses precision past 2^53,
|
|
2126
|
-
* and pgx/PostgREST serialize int8/numeric as strings. App code uses
|
|
2127
|
-
* BigInt(row.amount) for bigint, or a decimal lib for numeric.
|
|
2128
|
-
* - "integer" → number
|
|
2129
|
-
* - "boolean" → boolean
|
|
2130
|
-
* - "jsonb" → P (the dev-supplied payload shape from jsonb<T>(), else unknown)
|
|
2131
|
-
* - "enum" → E (the union of literal values)
|
|
2132
|
-
*/
|
|
2133
|
-
type ColValue<C> = C extends ColumnBuilder<'uuid' | 'text' | 'timestamp' | 'bigint' | 'numeric', infer N, infer _D, infer _E, infer _P> ? N extends true ? string | null : string : C extends ColumnBuilder<'integer', infer N, infer _D, infer _E, infer _P> ? N extends true ? number | null : number : C extends ColumnBuilder<'boolean', infer N, infer _D, infer _E, infer _P> ? N extends true ? boolean | null : boolean : C extends ColumnBuilder<'jsonb', infer N, infer _D, infer _E, infer P> ? N extends true ? P | null : P : C extends ColumnBuilder<'enum', infer N, infer _D, infer E, infer _P> ? N extends true ? E | null : E : never;
|
|
2134
|
-
/**
|
|
2135
|
-
* True when a column is optional on INSERT:
|
|
2136
|
-
* - nullable columns (N = true) — the DB allows NULL so the field may be omitted
|
|
2137
|
-
* - columns with a default (D = true) — the DB fills in the value when absent
|
|
2138
|
-
*/
|
|
2139
|
-
type ColIsOptionalOnInsert<C> = C extends ColumnBuilder<infer _K, true, infer _D, infer _E> ? true : C extends ColumnBuilder<infer _K, infer _N, true, infer _E> ? true : false;
|
|
2140
|
-
/** Create a UUID column. */
|
|
2141
|
-
declare function uuid(): ColumnBuilder<'uuid', false, false, never>;
|
|
2142
|
-
/** Create a TEXT column. */
|
|
2143
|
-
declare function text(): ColumnBuilder<'text', false, false, never>;
|
|
2144
|
-
/** Create an INTEGER column. Emits int4 (max ~2.1B). */
|
|
2145
|
-
declare function integer(): ColumnBuilder<'integer', false, false, never>;
|
|
2146
|
-
/**
|
|
2147
|
-
* Create a BIGINT column (Postgres int8, max ~9.2×10^18).
|
|
2148
|
-
* Surfaces as `string` in row/insert types — JS number loses precision past 2^53
|
|
2149
|
-
* and pgx/PostgREST serialize int8 as a JSON string. Use BigInt(row.column) in app code.
|
|
2150
|
-
*/
|
|
2151
|
-
declare function bigint(): ColumnBuilder<'bigint', false, false, never>;
|
|
2152
|
-
/**
|
|
2153
|
-
* Create a NUMERIC column (Postgres `numeric`/`decimal`, arbitrary precision).
|
|
2154
|
-
* For exact fractional values (money with cents as a decimal, rates, weights)
|
|
2155
|
-
* where int4/int8 don't fit. Surfaces as `string` in row/insert types — JS
|
|
2156
|
-
* number can't hold arbitrary-precision decimals without rounding, and
|
|
2157
|
-
* pgx/PostgREST serialize numeric as a JSON string. Parse with a decimal lib
|
|
2158
|
-
* (or BigInt for scaled integers) in app code.
|
|
2159
|
-
*/
|
|
2160
|
-
declare function numeric(): ColumnBuilder<'numeric', false, false, never>;
|
|
2161
|
-
/** Create a BOOLEAN column. */
|
|
2162
|
-
declare function boolean(): ColumnBuilder<'boolean', false, false, never>;
|
|
2163
|
-
/** Create a TIMESTAMP column. */
|
|
2164
|
-
declare function timestamp(): ColumnBuilder<'timestamp', false, false, never>;
|
|
2165
|
-
/**
|
|
2166
|
-
* Create a JSONB column. Pass a payload type to make the generated row/insert
|
|
2167
|
-
* type concrete instead of `unknown`:
|
|
2168
|
-
*
|
|
2169
|
-
* tags: jsonb<string[]>() // row.tags: string[]
|
|
2170
|
-
* meta: jsonb<{ tier: string }>() // row.meta: { tier: string }
|
|
2171
|
-
* raw: jsonb() // row.raw: unknown (back-compat)
|
|
2172
|
-
*
|
|
2173
|
-
* The runtime accepts a plain JS object/array directly (no JSON.stringify); the
|
|
2174
|
-
* generic only refines the TYPE the env codegen emits.
|
|
2175
|
-
*/
|
|
2176
|
-
declare function jsonb<T = unknown>(): ColumnBuilder<'jsonb', false, false, never, T>;
|
|
2177
|
-
/**
|
|
2178
|
-
* Create an ENUM column.
|
|
2179
|
-
* @param name The PostgreSQL enum type name (used in DDL).
|
|
2180
|
-
* @param values A readonly tuple of valid string values — kept `const` so the
|
|
2181
|
-
* union `V[number]` is as narrow as possible.
|
|
2182
|
-
*/
|
|
2183
|
-
declare function enumType<const V extends readonly string[]>(name: string, values: V): ColumnBuilder<'enum', false, false, V[number]>;
|
|
2184
|
-
|
|
2185
|
-
/**
|
|
2186
|
-
* policy.ts — the RLS policy authoring DSL.
|
|
2187
|
-
*
|
|
2188
|
-
* `policy(name)` returns a fluent builder that mirrors the `ColumnBuilder`
|
|
2189
|
-
* style in columns.ts: each chainable method mutates the underlying
|
|
2190
|
-
* definition and returns the builder so calls compose. The terminal value is
|
|
2191
|
-
* a plain {@link PolicyDef} — the exact JSON shape the runtime's
|
|
2192
|
-
* `schema_extract.js` reads off the bundled module and the Go side parses into
|
|
2193
|
-
* `PolicyJSON` (CONTRACT-POLICY).
|
|
2194
|
-
*
|
|
2195
|
-
* @example
|
|
2196
|
-
* import { policy } from "@palbase/backend";
|
|
2197
|
-
*
|
|
2198
|
-
* policy("owner_select")
|
|
2199
|
-
* .for("select")
|
|
2200
|
-
* .to("authenticated")
|
|
2201
|
-
* .using("owner = (select auth.uid())");
|
|
2202
|
-
*/
|
|
2203
|
-
/** The SQL command a policy applies to. `"all"` covers SELECT/INSERT/UPDATE/DELETE. */
|
|
2204
|
-
type PolicyCommand = "all" | "select" | "insert" | "update" | "delete";
|
|
2205
|
-
/** Whether a policy is permissive (OR-combined, the default) or restrictive
|
|
2206
|
-
* (AND-combined). Mirrors Postgres `CREATE POLICY ... AS PERMISSIVE|RESTRICTIVE`. */
|
|
2207
|
-
type PolicyMode = "permissive" | "restrictive";
|
|
2208
|
-
/**
|
|
2209
|
-
* The compiled, serializable policy definition — the EXACT shape consumed by
|
|
2210
|
-
* `schema_extract.js` → Go `PolicyJSON` (CONTRACT-POLICY).
|
|
2211
|
-
*
|
|
2212
|
-
* - `roles`: the DB roles this policy applies to (`TO` clause). An empty array
|
|
2213
|
-
* means the policy applies to PUBLIC (all roles) — the Postgres default.
|
|
2214
|
-
* - `using`: the `USING (...)` row-visibility expression, or `null` when none.
|
|
2215
|
-
* - `withCheck`: the `WITH CHECK (...)` write-validation expression, or `null`.
|
|
2216
|
-
* - `permissive`: `true` for `AS PERMISSIVE` (default), `false` for restrictive.
|
|
2217
|
-
*/
|
|
2218
|
-
interface PolicyDef {
|
|
2219
|
-
name: string;
|
|
2220
|
-
command: PolicyCommand;
|
|
2221
|
-
roles: string[];
|
|
2222
|
-
using: string | null;
|
|
2223
|
-
withCheck: string | null;
|
|
2224
|
-
permissive: boolean;
|
|
2225
|
-
}
|
|
2226
|
-
/**
|
|
2227
|
-
* Fluent RLS policy builder.
|
|
2228
|
-
*
|
|
2229
|
-
* Defaults (documented, applied at construction):
|
|
2230
|
-
* - `command`: `"all"` — applies to every SQL command unless `.for(...)` narrows it.
|
|
2231
|
-
* - `roles`: `["authenticated"]` — the common case is "rule applies to signed-in
|
|
2232
|
-
* users". Call `.to(...)` to override; pass `.to()` with no roles (or never
|
|
2233
|
-
* call it after a reset) to target PUBLIC.
|
|
2234
|
-
* - `using` / `withCheck`: `null` — no row filter / write check until set.
|
|
2235
|
-
* - `permissive`: `true` — `AS PERMISSIVE` (policies OR together).
|
|
2236
|
-
*
|
|
2237
|
-
* Each method mutates `_def` in place and returns `this`, so the chain is a
|
|
2238
|
-
* single builder instance (no per-call allocation, like a tagged-template
|
|
2239
|
-
* compile target). The terminal `PolicyDef` is read directly off `_def` by
|
|
2240
|
-
* `schema_extract.js`.
|
|
2241
|
-
*/
|
|
2242
|
-
declare class PolicyBuilder {
|
|
2243
|
-
readonly _def: PolicyDef;
|
|
2244
|
-
constructor(name: string);
|
|
2245
|
-
/** Restrict the policy to a single SQL command (default `"all"`). */
|
|
2246
|
-
for(command: PolicyCommand): this;
|
|
2247
|
-
/**
|
|
2248
|
-
* Set the DB roles the policy applies to (the `TO` clause), replacing any
|
|
2249
|
-
* previously-set roles. Call with no arguments to target PUBLIC (all roles).
|
|
2250
|
-
*
|
|
2251
|
-
* @example
|
|
2252
|
-
* policy("p").to("authenticated")
|
|
2253
|
-
* policy("p").to("authenticated", "service_role")
|
|
2254
|
-
* policy("p").to() // PUBLIC
|
|
2255
|
-
*/
|
|
2256
|
-
to(...roles: string[]): this;
|
|
2257
|
-
/** Set the `USING (...)` row-visibility expression (raw SQL). */
|
|
2258
|
-
using(sqlExpr: string): this;
|
|
2259
|
-
/** Set the `WITH CHECK (...)` write-validation expression (raw SQL). */
|
|
2260
|
-
withCheck(sqlExpr: string): this;
|
|
2261
|
-
/** Set the policy mode: `"permissive"` (default, OR-combined) or
|
|
2262
|
-
* `"restrictive"` (AND-combined). */
|
|
2263
|
-
as(mode: PolicyMode): this;
|
|
2264
|
-
}
|
|
2265
|
-
/**
|
|
2266
|
-
* Start authoring an RLS policy. Returns a {@link PolicyBuilder}; the resulting
|
|
2267
|
-
* `PolicyBuilder` is accepted directly in a table's `policies: [...]` array
|
|
2268
|
-
* (its `_def` is read at schema-extract time).
|
|
2269
|
-
*
|
|
2270
|
-
* @param name The policy name. Palbase reconciliation keys policies by
|
|
2271
|
-
* `(table, name)`, so names must be unique per table.
|
|
2272
|
-
*/
|
|
2273
|
-
declare function policy(name: string): PolicyBuilder;
|
|
2274
|
-
|
|
2275
|
-
/**
|
|
2276
|
-
* Postgres extensions a Palbase project can enable from its schema.
|
|
2277
|
-
*
|
|
2278
|
-
* Extensions are config-as-code: declare them in `defineSchema({ extensions })`
|
|
2279
|
-
* and the deploy installs them (CREATE EXTENSION … SCHEMA extensions) using the
|
|
2280
|
-
* deploy path's privileged connection. They are NOT toggled live from Studio —
|
|
2281
|
-
* CREATE EXTENSION requires a superuser role that only the deploy path holds.
|
|
2282
|
-
*
|
|
2283
|
-
* The list is an allowlist (a string-literal union) so editors autocomplete the
|
|
2284
|
-
* supported names and a typo fails typecheck. It is intentionally extensible:
|
|
2285
|
-
* add a name here (+ confirm the base image ships it) to support more.
|
|
2286
|
-
*/
|
|
2287
|
-
declare const PALBASE_EXTENSIONS: readonly ["vector", "pg_trgm", "unaccent", "citext", "postgis", "cube", "earthdistance", "hstore", "ltree", "btree_gist", "pg_cron", "pgcrypto", "uuid-ossp"];
|
|
2288
|
-
/** A Postgres extension supported by Palbase (allowlist union). */
|
|
2289
|
-
type PalbaseExtension = (typeof PALBASE_EXTENSIONS)[number];
|
|
2290
|
-
/**
|
|
2291
|
-
* Extensions that depend on another extension. The deploy installs
|
|
2292
|
-
* dependencies first; declaring `earthdistance` without `cube` still works
|
|
2293
|
-
* because the deploy resolves the order, but listing both is clearer.
|
|
2294
|
-
*/
|
|
2295
|
-
declare const EXTENSION_DEPENDENCIES: Partial<Record<PalbaseExtension, PalbaseExtension[]>>;
|
|
2296
|
-
/** Runtime guard: is `name` a supported Palbase extension? */
|
|
2297
|
-
declare function isPalbaseExtension(name: string): name is PalbaseExtension;
|
|
2298
|
-
|
|
2299
|
-
/**
|
|
2300
|
-
* A named raw-SQL DDL object declared in db/schema.ts for anything the typed DSL
|
|
2301
|
-
* cannot express (EXCLUDE, CHECK, partial/expression indexes, triggers, views).
|
|
2302
|
-
* The deploy emits `up` verbatim on the privileged DDL connection — same trust
|
|
2303
|
-
* posture as policy().using(). Tracked by NAME (not by diffing the body), so a
|
|
2304
|
-
* changed body needs a new name or an explicit drop+add.
|
|
2305
|
-
*/
|
|
2306
|
-
interface RawConstraintDef {
|
|
2307
|
-
name: string;
|
|
2308
|
-
up: string;
|
|
2309
|
-
down?: string;
|
|
2310
|
-
}
|
|
2311
|
-
declare function raw(name: string, up: string, opts?: {
|
|
2312
|
-
down?: string;
|
|
2313
|
-
}): RawConstraintDef;
|
|
2314
|
-
|
|
2315
|
-
/**
|
|
2316
|
-
* A map of column builders keyed by column name — the value you write under
|
|
2317
|
-
* the `columns` key of `defineSchema({ tables: { <name>: { columns } } })`.
|
|
2318
|
-
*
|
|
2319
|
-
* The default `Record<string, ColumnBuilder>` keeps bare references compiling
|
|
2320
|
-
* without a type argument.
|
|
2321
|
-
*/
|
|
2322
|
-
type ColumnMap = Record<string, ColumnBuilder>;
|
|
2323
|
-
/**
|
|
2324
|
-
* The author-facing value written under each table key:
|
|
2325
|
-
* `{ columns, rls?, policies? }`.
|
|
2326
|
-
*
|
|
2327
|
-
* - `columns`: the column map (required).
|
|
2328
|
-
* - `rls`: enable + FORCE row-level security on this table. **Defaults to
|
|
2329
|
-
* `true`**, and is forced on when `policies` is non-empty. A table with RLS
|
|
2330
|
-
* and no policies is deny-all, which is the starting state: nothing reads it
|
|
2331
|
-
* until a policy says who may. Set `rls: false` only for a genuinely public
|
|
2332
|
-
* table — it is an explicit opt-out that a reviewer can grep for, not
|
|
2333
|
-
* something you get by forgetting.
|
|
2334
|
-
* - `policies`: the RLS policies for this table, authored with `policy(name)`.
|
|
2335
|
-
* Each entry may be a {@link PolicyBuilder} (the normal `policy(...)` chain)
|
|
2336
|
-
* or a raw {@link PolicyDef} object.
|
|
2337
|
-
*
|
|
2338
|
-
* The `C` type parameter preserves the precise per-column phantom types so the
|
|
2339
|
-
* typed `Database.tables.*` surface keeps inferring insert/row shapes.
|
|
2340
|
-
*/
|
|
2341
|
-
interface TableInput<C extends ColumnMap = ColumnMap> {
|
|
2342
|
-
columns: C;
|
|
2343
|
-
rls?: boolean;
|
|
2344
|
-
policies?: (PolicyBuilder | PolicyDef)[];
|
|
2345
|
-
/** Composite/named primary key (ordered column names). Omit for single-column inline .primaryKey(). */
|
|
2346
|
-
primaryKey?: string[];
|
|
2347
|
-
/** Named multi-column UNIQUE constraints. */
|
|
2348
|
-
unique?: {
|
|
2349
|
-
name: string;
|
|
2350
|
-
columns: string[];
|
|
2351
|
-
}[];
|
|
2352
|
-
/** Named raw-SQL DDL objects (EXCLUDE, triggers, views) that the typed DSL cannot express. */
|
|
2353
|
-
raw?: RawConstraintDef[];
|
|
2354
|
-
/**
|
|
2355
|
-
* Named first-class CHECK constraints. Diffed by NAME with a BODY compare:
|
|
2356
|
-
* a changed `expr` (after pg normalization) recreates the constraint
|
|
2357
|
-
* (DROP + ADD). `expr` is trusted SQL emitted verbatim (like policy USING),
|
|
2358
|
-
* `name` is identifier-validated.
|
|
2359
|
-
*/
|
|
2360
|
-
checks?: {
|
|
2361
|
-
name: string;
|
|
2362
|
-
expr: string;
|
|
2363
|
-
}[];
|
|
2364
|
-
/**
|
|
2365
|
-
* Plain (non-unique) btree indexes over an ordered column list, emitted as
|
|
2366
|
-
* standalone `CREATE INDEX [IF NOT EXISTS] name ON table (col1, col2)`
|
|
2367
|
-
* statements (NOT a table clause — a separate migration statement category).
|
|
2368
|
-
* Structural compare by NAME (no expression normalization). `name` and each
|
|
2369
|
-
* column are identifier-validated by the Go differ.
|
|
2370
|
-
*
|
|
2371
|
-
* Scope: columns-only plain btree. Partial (`where`) and expression indexes
|
|
2372
|
-
* are a deliberate follow-up — modelling them needs the same raw-SQL
|
|
2373
|
-
* normalization round-trip CHECK uses (Task 10), so they are NOT in this
|
|
2374
|
-
* type yet to avoid a half-working partial-index path.
|
|
2375
|
-
*/
|
|
2376
|
-
indexes?: {
|
|
2377
|
-
name: string;
|
|
2378
|
-
columns: string[];
|
|
2379
|
-
}[];
|
|
2380
|
-
}
|
|
2381
|
-
/**
|
|
2382
|
-
* A table definition — the runtime value the Go runtime's `schema_extract.js`
|
|
2383
|
-
* reads. It keys tables by `tableDef.name`, reads `tableDef.columns` for the
|
|
2384
|
-
* column DDL, and `tableDef.rls` + `tableDef.policies` for RLS.
|
|
2385
|
-
*
|
|
2386
|
-
* `defineSchema` derives `name` from the object key, so authors never repeat
|
|
2387
|
-
* the table name. `rls`/`policies` are always present after normalization
|
|
2388
|
-
* (defaulted to `true`/`[]`).
|
|
2389
|
-
*
|
|
2390
|
-
* The `C` type parameter preserves the precise per-column phantom types so that
|
|
2391
|
-
* downstream mapped types (InsertShape, RowShape) can discriminate on them.
|
|
2392
|
-
*/
|
|
2393
|
-
interface TableDef<C extends ColumnMap = ColumnMap> {
|
|
2394
|
-
name: string;
|
|
2395
|
-
columns: C;
|
|
2396
|
-
rls: boolean;
|
|
2397
|
-
policies: PolicyDef[];
|
|
2398
|
-
primaryKey?: string[];
|
|
2399
|
-
unique?: {
|
|
2400
|
-
name: string;
|
|
2401
|
-
columns: string[];
|
|
2402
|
-
}[];
|
|
2403
|
-
/** Named raw-SQL DDL objects emitted verbatim on deploy. Tracked by name. */
|
|
2404
|
-
raw?: RawConstraintDef[];
|
|
2405
|
-
/** Named first-class CHECK constraints. Diffed by name + (normalized) body. */
|
|
2406
|
-
checks?: {
|
|
2407
|
-
name: string;
|
|
2408
|
-
expr: string;
|
|
2409
|
-
}[];
|
|
2410
|
-
/** Plain btree indexes (columns-only), emitted as standalone CREATE INDEX. Diffed by name. */
|
|
2411
|
-
indexes?: {
|
|
2412
|
-
name: string;
|
|
2413
|
-
columns: string[];
|
|
2414
|
-
}[];
|
|
2415
|
-
}
|
|
2416
|
-
/**
|
|
2417
|
-
* A schema definition containing multiple tables, keyed by table name.
|
|
2418
|
-
*
|
|
2419
|
-
* The `T` type parameter preserves the exact `TableDef<...>` type for each
|
|
2420
|
-
* table so that `SchemaDef["tables"]["rooms"]` resolves to the precise
|
|
2421
|
-
* `TableDef<{ id: ColumnBuilder<'uuid', false, true, never>; ... }>`.
|
|
2422
|
-
*/
|
|
2423
|
-
interface SchemaDef<T extends Record<string, TableDef> = Record<string, TableDef>> {
|
|
2424
|
-
tables: T;
|
|
2425
|
-
/** Postgres extensions to install on deploy. Normalized to `[]` when absent. */
|
|
2426
|
-
extensions: PalbaseExtension[];
|
|
2427
|
-
}
|
|
2428
|
-
/** The author-facing input to `defineSchema` — a `tables` map whose keys are
|
|
2429
|
-
* the table names and whose values are `{ columns, rls?, policies? }`, plus an
|
|
2430
|
-
* optional `extensions` allowlist. */
|
|
2431
|
-
interface SchemaInput<T extends Record<string, TableInput> = Record<string, TableInput>> {
|
|
2432
|
-
tables: T;
|
|
2433
|
-
/**
|
|
2434
|
-
* Postgres extensions to enable for this project, e.g. `["vector"]`.
|
|
2435
|
-
* Config-as-code: installed by the deploy (CREATE EXTENSION … SCHEMA
|
|
2436
|
-
* extensions) with the privileged deploy connection. The type is an
|
|
2437
|
-
* allowlist union, so unsupported names fail typecheck.
|
|
2438
|
-
*/
|
|
2439
|
-
extensions?: PalbaseExtension[];
|
|
2440
|
-
}
|
|
2441
|
-
/** Map the author's `{ tables: { <name>: { columns } } }` input to the
|
|
2442
|
-
* `{ tables: { <name>: TableDef<columns> } }` runtime/type shape, threading the
|
|
2443
|
-
* per-table column map `T[K]["columns"]` so column-level inference survives. */
|
|
2444
|
-
type TablesFromInput<T extends Record<string, TableInput>> = {
|
|
2445
|
-
[K in keyof T]: TableDef<T[K]["columns"]>;
|
|
2446
|
-
};
|
|
2447
|
-
/**
|
|
2448
|
-
* Define a schema. The table NAME comes from the object key. Each table value
|
|
2449
|
-
* is `{ columns, rls?, policies? }`:
|
|
2450
|
-
*
|
|
2451
|
-
* export default defineSchema({
|
|
2452
|
-
* tables: {
|
|
2453
|
-
* todos: {
|
|
2454
|
-
* columns: {
|
|
2455
|
-
* id: uuid().primaryKey().defaultRandom(),
|
|
2456
|
-
* owner: text().notNull(),
|
|
2457
|
-
* title: text().notNull(),
|
|
2458
|
-
* },
|
|
2459
|
-
* rls: true,
|
|
2460
|
-
* policies: [
|
|
2461
|
-
* policy("owner_all").for("all").to("authenticated")
|
|
2462
|
-
* .using("owner = (select auth.uid())")
|
|
2463
|
-
* .withCheck("owner = (select auth.uid())"),
|
|
2464
|
-
* ],
|
|
2465
|
-
* },
|
|
2466
|
-
* },
|
|
2467
|
-
* });
|
|
2468
|
-
*
|
|
2469
|
-
* The returned value is
|
|
2470
|
-
* `{ tables: { todos: { name, columns, rls, policies } } }` — the exact shape
|
|
2471
|
-
* the runtime schema extractor parses. Per-column phantom types are preserved
|
|
2472
|
-
* so `Database.tables.todos.insert({...})` stays typed.
|
|
2473
|
-
*
|
|
2474
|
-
* RLS normalization: `rls` defaults to **`true`**, `policies` to `[]`. A table
|
|
2475
|
-
* that declares neither is therefore deny-all — nothing reads it until a policy
|
|
2476
|
-
* says who may, which is the safe starting point rather than a bug. Declare
|
|
2477
|
-
* `rls: false` for a genuinely public table; that is an explicit, greppable
|
|
2478
|
-
* statement of intent instead of an omission. When `policies` is non-empty,
|
|
2479
|
-
* `rls` is forced on (ENABLE + FORCE) regardless of the declared flag — a table
|
|
2480
|
-
* with policies must have RLS enabled or the policies would be inert.
|
|
2481
|
-
*/
|
|
2482
|
-
declare function defineSchema<T extends Record<string, TableInput>>(input: SchemaInput<T>): SchemaDef<TablesFromInput<T>>;
|
|
2483
|
-
|
|
2484
|
-
/**
|
|
2485
|
-
* typed-db.ts — Task 2: TypedDB schema-derived insert/row shapes.
|
|
2486
|
-
*
|
|
2487
|
-
* Derives INSERT and full-row TypeScript types from a `defineSchema()` result
|
|
2488
|
-
* and wraps the untyped runtime `DBClient` with a typed facade.
|
|
2489
|
-
*
|
|
2490
|
-
* No value-any. No `as unknown as X`. The two narrow `as` casts in
|
|
2491
|
-
* `makeTypedTable` are safe because:
|
|
2492
|
-
* - `data as Record<string, unknown>`: InsertShape<T> maps string keys to
|
|
2493
|
-
* typed values; all value types are subsets of `unknown`, so the cast is
|
|
2494
|
-
* structurally sound.
|
|
2495
|
-
* - `result as RowShape<T>`: The runtime DBClient returns `Record<string,
|
|
2496
|
-
* unknown>` which is the erased form of the typed row; we're narrowing back
|
|
2497
|
-
* to the precise shape that the schema declared.
|
|
2498
|
-
* Both casts are narrowing only (not widening) and correctness is guaranteed
|
|
2499
|
-
* by the schema the caller provides.
|
|
2500
|
-
*/
|
|
2501
|
-
|
|
2502
|
-
/** Keys of C whose columns are required on INSERT (not nullable, no default). */
|
|
2503
|
-
type RequiredKeys<C> = {
|
|
2504
|
-
[K in keyof C]: ColIsOptionalOnInsert<C[K]> extends true ? never : K;
|
|
2505
|
-
}[keyof C];
|
|
2506
|
-
/** Keys of C whose columns are optional on INSERT (nullable or has a default). */
|
|
2507
|
-
type OptionalKeys<C> = {
|
|
2508
|
-
[K in keyof C]: ColIsOptionalOnInsert<C[K]> extends true ? K : never;
|
|
2509
|
-
}[keyof C];
|
|
2510
|
-
/**
|
|
2511
|
-
* The TypeScript type for an INSERT payload for table `T`.
|
|
2512
|
-
* - Required: columns that are NOT NULL and have no DB-level default.
|
|
2513
|
-
* - Optional: columns that are nullable or carry a default.
|
|
2514
|
-
*
|
|
2515
|
-
* When all columns are optional, `RequiredKeys<C>` resolves to `never` and
|
|
2516
|
-
* the first part becomes `{}`, which is a neutral element for `&`.
|
|
2517
|
-
*/
|
|
2518
|
-
type InsertShape<T extends TableDef> = {
|
|
2519
|
-
[K in RequiredKeys<T["columns"]>]: ColValue<T["columns"][K]>;
|
|
2520
|
-
} & {
|
|
2521
|
-
[K in OptionalKeys<T["columns"]>]?: ColValue<T["columns"][K]>;
|
|
2522
|
-
};
|
|
2523
|
-
/**
|
|
2524
|
-
* The TypeScript type for a full row returned by the DB for table `T`.
|
|
2525
|
-
* Every column is present; nullable columns resolve to `T | null`.
|
|
2526
|
-
*/
|
|
2527
|
-
type RowShape<T extends TableDef> = {
|
|
2528
|
-
[K in keyof T["columns"]]: ColValue<T["columns"][K]>;
|
|
2529
|
-
};
|
|
2530
|
-
/** A typed table accessor that mirrors the runtime DBClient surface. */
|
|
2531
|
-
interface TypedTable<T extends TableDef> {
|
|
2532
|
-
insert(data: InsertShape<T>): Promise<RowShape<T>>;
|
|
2533
|
-
/** Update the row by id; resolves to the updated row, or `null` if no row
|
|
2534
|
-
* matched (absent or RLS-hidden) — an idempotent outcome, mirroring
|
|
2535
|
-
* `findById`. The runtime returns a null row rather than throwing. */
|
|
2536
|
-
update(id: string, data: Partial<InsertShape<T>>): Promise<RowShape<T> | null>;
|
|
2537
|
-
delete(id: string): Promise<void>;
|
|
2538
|
-
findById(id: string): Promise<RowShape<T> | null>;
|
|
2539
|
-
findMany(query?: Partial<RowShape<T>>): Promise<RowShape<T>[]>;
|
|
2540
|
-
}
|
|
2541
|
-
/** A typed DB facade covering all tables declared in schema `S`. */
|
|
2542
|
-
interface TypedDB<S extends SchemaDef> {
|
|
2543
|
-
tables: {
|
|
2544
|
-
[K in keyof S["tables"]]: TypedTable<S["tables"][K]>;
|
|
2545
|
-
};
|
|
2546
|
-
/** Run a transaction plan. See {@link EnvTypedDatabase.transaction}. */
|
|
2547
|
-
transaction<T>(fn: (tx: TypedTx<S>) => T extends Promise<unknown> ? never : T): Promise<Materialized<T>>;
|
|
2548
|
-
}
|
|
2549
|
-
/** The plan-building handle a `TypedDB<S>` transaction callback receives: the
|
|
2550
|
-
* schema's tables, expressed as plan operations rather than awaited calls. */
|
|
2551
|
-
type TypedTx<S extends SchemaDef> = TxPlanHandle<{
|
|
2552
|
-
[K in keyof S["tables"]]: TxTable<RowShape<S["tables"][K]>, InsertShape<S["tables"][K]>>;
|
|
2553
|
-
}>;
|
|
2554
|
-
/**
|
|
2555
|
-
* Wraps a raw `DBClient` with the type-safe `TypedDB<S>` facade derived from
|
|
2556
|
-
* the provided schema. No behavior change for the direct ops — all calls
|
|
2557
|
-
* delegate to `raw` with the table name as a plain string.
|
|
2558
|
-
*
|
|
2559
|
-
* `transaction` does NOT delegate to a per-op client: the callback describes a
|
|
2560
|
-
* plan against a fresh {@link TxPlanBuilder}, and the whole plan travels in one
|
|
2561
|
-
* `raw.txPlan` call. The schema is used only for its table NAMES; the values
|
|
2562
|
-
* are typed by `S` at compile time and are plain strings at run time.
|
|
2563
|
-
*
|
|
2564
|
-
* The `as` casts are single structural narrowings from a dynamically-built
|
|
2565
|
-
* object to the precise mapped type (TS cannot infer the mapped-type result
|
|
2566
|
-
* through `Object.keys` iteration) — see the module-level doc comment.
|
|
2567
|
-
*/
|
|
2568
|
-
declare function makeTypedDB<S extends SchemaDef>(schema: S, raw: DBClient): TypedDB<S>;
|
|
2569
|
-
/** A typed table accessor derived from one env `Tables` entry's flat shapes. */
|
|
2570
|
-
interface EnvTypedTable<T extends TableTypes> {
|
|
2571
|
-
insert(data: T["insert"]): Promise<T["row"]>;
|
|
2572
|
-
/** Update the row by id; resolves to the updated row, or `null` if no row
|
|
2573
|
-
* matched (absent or RLS-hidden) — an idempotent outcome, mirroring
|
|
2574
|
-
* `findById`. The runtime returns a null row rather than throwing. */
|
|
2575
|
-
update(id: string, data: Partial<T["insert"]>): Promise<T["row"] | null>;
|
|
2576
|
-
delete(id: string): Promise<void>;
|
|
2577
|
-
findById(id: string): Promise<T["row"] | null>;
|
|
2578
|
-
findMany(query?: Partial<T["row"]>): Promise<T["row"][]>;
|
|
2579
|
-
}
|
|
2580
|
-
/** The `tables` map exposed on `Database`/`tx`, keyed by the env `Tables`
|
|
2581
|
-
* interface. When no schema is declared `Tables` is empty, so `tables` is an
|
|
2582
|
-
* empty object — accessing `.tables.foo` is then a compile error (no member). */
|
|
2583
|
-
type EnvTables = {
|
|
2584
|
-
[K in keyof Tables]: EnvTypedTable<Tables[K]>;
|
|
2585
|
-
};
|
|
2586
|
-
/** The project's tables as PLAN operations, keyed by the env `Tables`
|
|
2587
|
-
* interface. The transaction twin of {@link EnvTables}. */
|
|
2588
|
-
type TxTables = {
|
|
2589
|
-
[K in keyof Tables]: TxTable<Tables[K]["row"], Tables[K]["insert"]>;
|
|
2590
|
-
};
|
|
2591
|
-
/**
|
|
2592
|
-
* The handle a `Database.transaction(…)` callback receives.
|
|
2593
|
-
*
|
|
2594
|
-
* Tables only — no `query`, no `findById`, no `asService`. A read whose value
|
|
2595
|
-
* the plan does not write belongs outside the transaction, where it costs one
|
|
2596
|
-
* round trip and is an ordinary value you can branch on.
|
|
2597
|
-
*/
|
|
2598
|
-
type TxPlan = TxPlanHandle<TxTables>;
|
|
2599
|
-
/**
|
|
2600
|
-
* The RLS-bypass sibling returned by `Database.asService()`. Same typed surface
|
|
2601
|
-
* as {@link EnvTypedDatabase} — `tables`, the raw string ops, and a typed
|
|
2602
|
-
* `transaction` — but it does NOT re-expose `asService` (no double-bypass).
|
|
2603
|
-
* Every op it performs runs as the `service_role` (BYPASSRLS).
|
|
2604
|
-
*/
|
|
2605
|
-
interface EnvServiceDatabase extends Omit<DBClient, "txPlan" | "asService"> {
|
|
2606
|
-
tables: EnvTables;
|
|
2607
|
-
transaction<T>(fn: (tx: TxPlan) => T extends Promise<unknown> ? never : T): Promise<Materialized<T>>;
|
|
2608
|
-
}
|
|
2609
|
-
/**
|
|
2610
|
-
* The typed-by-default Database surface: the raw string-keyed `DBClient` ops
|
|
2611
|
-
* PLUS a `tables` map typed against the project's generated `palbase-env.d.ts`,
|
|
2612
|
-
* a `transaction` that runs a whole plan in one request, and `asService()` for
|
|
2613
|
-
* the explicit RLS-bypass sibling.
|
|
2614
|
-
*
|
|
2615
|
-
* The low-level `txPlan` op is deliberately NOT re-exposed here: `transaction`
|
|
2616
|
-
* is the surface, and a hand-built plan would bypass the ref/guard machinery
|
|
2617
|
-
* that makes one safe to write.
|
|
2618
|
-
*/
|
|
2619
|
-
interface EnvTypedDatabase extends Omit<DBClient, "txPlan" | "asService"> {
|
|
2620
|
-
tables: EnvTables;
|
|
2621
|
-
/**
|
|
2622
|
-
* Run a transaction. The callback DESCRIBES the operations; the whole
|
|
2623
|
-
* description travels in one request and the broker runs it inside a single
|
|
2624
|
-
* transaction — committing when it finishes, rolling back on any failure.
|
|
2625
|
-
*
|
|
2626
|
-
* The callback is SYNCHRONOUS: nothing has run when it returns, so there is
|
|
2627
|
-
* nothing to await. `async` on it and `await` inside it are compile errors.
|
|
2628
|
-
* Values a later operation needs are {@link Ref}s, written straight into the
|
|
2629
|
-
* next operation; values the CALLER needs are returned and substituted before
|
|
2630
|
-
* this promise resolves.
|
|
2631
|
-
*
|
|
2632
|
-
* @example
|
|
2633
|
-
* const { statementId } = await Database.transaction((tx) => {
|
|
2634
|
-
* const st = tx.tables.statements
|
|
2635
|
-
* .insert({ household_id: hid, file_sha256: sha, status: "reviewing" })
|
|
2636
|
-
* .expectOne(new Internal("statement insert failed"));
|
|
2637
|
-
*
|
|
2638
|
-
* tx.tables.statement_lines.insertMany(
|
|
2639
|
-
* lines.map((l) => ({ statement_id: st.id, category: resolveCategory(l) })),
|
|
2640
|
-
* );
|
|
2641
|
-
*
|
|
2642
|
-
* return { statementId: st.id };
|
|
2643
|
-
* });
|
|
2644
|
-
*/
|
|
2645
|
-
transaction<T>(fn: (tx: TxPlan) => T extends Promise<unknown> ? never : T): Promise<Materialized<T>>;
|
|
2646
|
-
/**
|
|
2647
|
-
* Return a sibling that bypasses RLS by running as the `service_role`. Use
|
|
2648
|
-
* sparingly and explicitly — the default `Database.*` path is RLS-enforced.
|
|
2649
|
-
*
|
|
2650
|
-
* @example
|
|
2651
|
-
* const all = await Database.asService().tables.todos.findMany({});
|
|
2652
|
-
* const rows = await Database.asService().query("SELECT * FROM todos");
|
|
2653
|
-
*/
|
|
2654
|
-
asService(): EnvServiceDatabase;
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
export { type PalbaseBindDeviceParams as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type EnvTypedDatabase as E, type FileContext as F, PalError as G, HttpError as H, type InsertShape as I, type PalbaseAnalyticsClient as J, type PalbaseAnalyticsManagementNamespace as K, type Logger as L, type Materialized as M, NotFound as N, type OnDeleteAction as O, type PalbaseDocsClient as P, type PalbaseAnalyticsProperties as Q, type RateLimitConfig as R, type SchemaDef 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, type PalbaseBatchSetOverridesResult as _, type PalbaseFlagsClient as a, type PalbaseSignedUrlResponse as a$, type PalbaseBucketClient as a0, type PalbaseClearAllOverridesResult as a1, type PalbaseClearOverrideResult as a2, type PalbaseCohortQueryInput as a3, type PalbaseCohortResult as a4, type PalbaseCollectionRef as a5, type PalbaseCountQueryInput as a6, type PalbaseCountResult as a7, type PalbaseCreateLinkParams as a8, type PalbaseDeviceInfo as a9, type PalbaseInboxSendResponse as aA, type PalbaseInitialLink as aB, type PalbaseInvokeOptions as aC, type PalbaseLink as aD, type PalbaseLinkAnalytics as aE, type PalbaseLinkDetails as aF, type PalbaseLinksClient as aG, type PalbaseListLinksOptions as aH, type PalbaseListLinksResult as aI, type PalbaseListOptions as aJ, type PalbaseMatchParams as aK, type PalbaseMultiChannelResponse as aL, type PalbaseOverviewResult as aM, type PalbasePreferences as aN, type PalbasePreferencesClient as aO, type PalbasePushClient as aP, type PalbasePushSendParams as aQ, type PalbasePushSendResponse as aR, type PalbaseQrCodeOptions as aS, type PalbaseQuerySnapshot as aT, type PalbaseRegisterDeviceParams as aU, type PalbaseResult as aV, type PalbaseRetentionQueryInput as aW, type PalbaseRetentionResult as aX, type PalbaseSession as aY, type PalbaseSetOverrideResult as aZ, type PalbaseSetOverridesResult as a_, type PalbaseDeviceTokenView as aa, type PalbaseDocumentRef as ab, type PalbaseDocumentSnapshot as ac, type PalbaseEmailClient as ad, type PalbaseEmailSendParams as ae, type PalbaseEmailSendResponse as af, type PalbaseEventNamesResult as ag, type PalbaseEventsQueryInput as ah, type PalbaseEventsResult as ai, type PalbaseExtension as aj, type PalbaseFileObject as ak, type PalbaseFlag as al, type PalbaseFlagContext as am, type PalbaseFlagSource as an, type PalbaseFlagValue as ao, type PalbaseFlagVariant as ap, type PalbaseFlagsServiceClient as aq, type PalbaseFunctionsClient as ar, type PalbaseFunnelQueryInput as as, type PalbaseFunnelResult as at, type PalbaseIdentifyTraits as au, type PalbaseInboxClient as av, type PalbaseInboxListOptions as aw, type PalbaseInboxListResult as ax, type PalbaseInboxMessage as ay, type PalbaseInboxSendParams as az, type PalbaseNotificationsClient as b, jsonb as b$, type PalbaseSmsClient as b0, type PalbaseSmsSendParams as b1, type PalbaseSmsSendResponse as b2, type PalbaseTransformOptions as b3, type PalbaseUpdateLinkParams as b4, type PalbaseUploadOptions as b5, type PalbaseUser as b6, type PalbaseUserDetailResult as b7, type PalbaseUsersQueryInput as b8, type PalbaseUsersResult as b9, type TxRows as bA, type TxSelectOptions as bB, type TxSetShape as bC, type TxSetValue as bD, type TxTable as bE, type TxTables as bF, type TxWhere as bG, type TxWireExpr as bH, type TxWireGuard as bI, type TxWireOp as bJ, type TxWireRef as bK, type TxWireValue as bL, type TypedDB as bM, type TypedTable as bN, type TypedTx as bO, Unauthorized as bP, type User as bQ, type VerifiedDevice as bR, bigint as bS, boolean as bT, dec as bU, defineMiddleware as bV, defineSchema as bW, enumType as bX, inc as bY, integer as bZ, isPalbaseExtension as b_, type PalbaseVerifyRequestSignatureParams as ba, type PalbaseWhereOperator as bb, PolicyBuilder as bc, type PolicyCommand as bd, type PolicyDef as be, type PolicyMode as bf, type RawConstraintDef as bg, type Ref as bh, type RowShape as bi, type SchemaInput as bj, type TableDef as bk, type TableInput as bl, TooManyRequests as bm, type TxColumnExpr as bn, type TxInsertShape as bo, type TxInsertValue as bp, type TxNow as bq, type TxPlan as br, type TxPlanBody as bs, TxPlanError as bt, type TxPlanHandle as bu, type TxPlanOpResult as bv, type TxPlanRejection as bw, type TxPlanResponse as bx, TxRefError as by, type TxRow as bz, type PalbaseRealtimeClient as c, makeTypedDB as c0, now as c1, numeric as c2, policy as c3, raw as c4, text as c5, timestamp as c6, uuid as c7, type PalbaseStorageClient as d, type AuthConfig as e, type ClientInfo as f, ColumnBuilder as g, type ColumnDef as h, type ColumnMap as i, type ColumnType as j, Conflict as k, type DBOps as l, EXTENSION_DEPENDENCIES as m, type EnvServiceDatabase as n, type EnvTables as o, type EnvTypedTable as p, type ErrorDef as q, type ErrorMap as r, type ErrorThrowers as s, Forbidden as t, type HttpMethod as u, type Middleware as v, type MiddlewareContext as w, type MiddlewareHandler as x, PALBASE_EXTENSIONS as y, type PBRequest as z };
|
|
2114
|
+
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 PalbaseAttestiOSParams as G, HttpError as H, type PalbaseAttestiOSResult as I, type PalbaseAuthClient as J, type PalbaseBatchOverrideOperation as K, type Logger as L, type Materialized as M, NotFound as N, type PalbaseBatchSetOverridesResult as O, type PalbaseDocsClient as P, type PalbaseBindDeviceParams as Q, type RateLimitConfig as R, type SecretsService as S, type TxPlanBody as T, type PalbaseClearAllOverridesResult as U, type PalbaseClearOverrideResult as V, type PalbaseCohortQueryInput as W, type PalbaseCohortResult as X, type PalbaseCollectionRef as Y, type PalbaseCountQueryInput as Z, type PalbaseCountResult as _, type PalbaseFlagsClient as a, type PalbaseVerifyRequestSignatureParams 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 PalbasePushClient as aF, type PalbasePushSendParams as aG, type PalbasePushSendResponse as aH, type PalbaseQrCodeOptions as aI, type PalbaseQuerySnapshot as aJ, type PalbaseRegisterDeviceParams as aK, type PalbaseRetentionQueryInput as aL, type PalbaseRetentionResult as aM, type PalbaseSession as aN, type PalbaseSetOverrideResult as aO, type PalbaseSetOverridesResult as aP, type PalbaseSignedUrlResponse as aQ, type PalbaseSmsClient as aR, type PalbaseSmsSendParams as aS, type PalbaseSmsSendResponse as aT, type PalbaseTransformOptions as aU, type PalbaseUpdateLinkParams as aV, type PalbaseUploadOptions as aW, type PalbaseUser as aX, type PalbaseUserDetailResult as aY, type PalbaseUsersQueryInput as aZ, type PalbaseUsersResult 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 PalbaseNotificationsClient as b, type PalbaseWhereOperator as b0, type Ref as b1, TooManyRequests as b2, type TxColumnExpr as b3, type TxInsertShape as b4, type TxInsertValue as b5, type TxNow as b6, TxPlanError as b7, type TxPlanHandle as b8, type TxPlanOpResult as b9, type TxPlanRejection as ba, TxRefError as bb, type TxRow as bc, type TxRows as bd, type TxSelectOptions as be, type TxSetShape as bf, type TxSetValue as bg, type TxTable as bh, type TxWhere as bi, type TxWireExpr as bj, type TxWireGuard as bk, type TxWireOp as bl, type TxWireRef as bm, type TxWireValue as bn, Unauthorized as bo, type User as bp, type VerifiedDevice as bq, dec as br, defineMiddleware as bs, inc as bt, now as bu, type PalbaseRealtimeClient as c, type PalbaseStorageClient as d, type PalbaseBucketClient as e, type TxPlanResponse as f, type PalbaseResult as g, type AuthConfig as h, type ClientInfo as i, Conflict as j, type DBOps as k, type ErrorMap as l, type ErrorThrowers as m, Forbidden as n, type HttpMethod as o, type Middleware as p, type MiddlewareContext as q, type MiddlewareHandler as r, type PBRequest as s, PalError as t, type PalbaseAnalyticsClient as u, type PalbaseAnalyticsManagementNamespace as v, type PalbaseAnalyticsProperties as w, type PalbaseAnalyticsQueryNamespace as x, type PalbaseAttestAndroidParams as y, type PalbaseAttestAndroidResult as z };
|