@palbase/backend 33.0.2 → 34.1.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.
Files changed (84) hide show
  1. package/dist/bin/palbase-backend.cjs +2273 -358
  2. package/dist/bin/palbase-backend.cjs.map +1 -1
  3. package/dist/bin/palbase-backend.js +9 -7
  4. package/dist/bin/palbase-backend.js.map +1 -1
  5. package/dist/{chunk-YIQ4RS4F.js → chunk-5UGPXKMJ.js} +331 -5
  6. package/dist/chunk-5UGPXKMJ.js.map +1 -0
  7. package/dist/chunk-GHNC2UHS.js +20 -0
  8. package/dist/chunk-GHNC2UHS.js.map +1 -0
  9. package/dist/{chunk-AAT5G7KY.js → chunk-JJW3L62T.js} +2 -2
  10. package/dist/chunk-JJW3L62T.js.map +1 -0
  11. package/dist/{chunk-SI4KGEM3.js → chunk-P7MGSAFT.js} +102 -96
  12. package/dist/chunk-P7MGSAFT.js.map +1 -0
  13. package/dist/{chunk-XOX6RFPZ.js → chunk-PRH45NZU.js} +46 -3
  14. package/dist/chunk-PRH45NZU.js.map +1 -0
  15. package/dist/{chunk-26GH54D2.js → chunk-RZLY4BOY.js} +5 -3
  16. package/dist/{chunk-26GH54D2.js.map → chunk-RZLY4BOY.js.map} +1 -1
  17. package/dist/{chunk-KATPXCJ5.js → chunk-UMESJJRS.js} +19 -40
  18. package/dist/chunk-UMESJJRS.js.map +1 -0
  19. package/dist/chunk-VXPNPVAG.js +40 -0
  20. package/dist/chunk-VXPNPVAG.js.map +1 -0
  21. package/dist/{chunk-WWUG2QXF.js → chunk-X2UYIXDS.js} +59 -4
  22. package/dist/chunk-X2UYIXDS.js.map +1 -0
  23. package/dist/{chunk-C6COAB3E.js → chunk-XZPDPYVY.js} +1905 -195
  24. package/dist/chunk-XZPDPYVY.js.map +1 -0
  25. package/dist/{chunk-TVCCR6SO.js → chunk-YO5GYM73.js} +58 -9
  26. package/dist/chunk-YO5GYM73.js.map +1 -0
  27. package/dist/db/env.cjs.map +1 -1
  28. package/dist/db/env.d.cts +2 -0
  29. package/dist/db/env.d.ts +2 -0
  30. package/dist/db/index.cjs +285 -2
  31. package/dist/db/index.cjs.map +1 -1
  32. package/dist/db/index.d.cts +46 -3
  33. package/dist/db/index.d.ts +46 -3
  34. package/dist/db/index.js +14 -5
  35. package/dist/{index-DMZG3kpo.d.ts → endpoint-BXPdsTA5.d.ts} +370 -58
  36. package/dist/{index-DB_nW-AV.d.cts → endpoint-DqhUP7RT.d.cts} +370 -58
  37. package/dist/engine/index.cjs +2279 -356
  38. package/dist/engine/index.cjs.map +1 -1
  39. package/dist/engine/index.d.cts +5 -5
  40. package/dist/engine/index.d.ts +5 -5
  41. package/dist/engine/index.js +17 -7
  42. package/dist/{index-DLveQoOf.d.cts → index-Co0Hj_aO.d.cts} +108 -50
  43. package/dist/{index-D-3duy8Y.d.ts → index-MhCL7ll4.d.ts} +108 -50
  44. package/dist/index.cjs +806 -386
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +7 -6
  47. package/dist/index.d.ts +7 -6
  48. package/dist/index.js +27 -15
  49. package/dist/index.js.map +1 -1
  50. package/dist/openapi/index.cjs +7 -0
  51. package/dist/openapi/index.cjs.map +1 -1
  52. package/dist/openapi/index.d.cts +3 -3
  53. package/dist/openapi/index.d.ts +3 -3
  54. package/dist/openapi/index.js +4 -3
  55. package/dist/openapi/index.js.map +1 -1
  56. package/dist/{registry-DSTThhKf.d.cts → registry-BkIVHPzB.d.cts} +3 -1
  57. package/dist/{registry-JjF5lcj4.d.ts → registry-CvGLR5j1.d.ts} +3 -1
  58. package/dist/test/index.cjs +103 -66
  59. package/dist/test/index.cjs.map +1 -1
  60. package/dist/test/index.d.cts +3 -3
  61. package/dist/test/index.d.ts +3 -3
  62. package/dist/test/index.js +33 -7
  63. package/dist/test/index.js.map +1 -1
  64. package/docs/README.md +1 -1
  65. package/docs/auth.md +58 -0
  66. package/docs/database.md +308 -0
  67. package/docs/examples/check-query-contracts.ts +5 -0
  68. package/docs/examples/database-dx.contract.json +65 -0
  69. package/docs/examples/database-dx.ts +63 -0
  70. package/docs/examples/money-transfer.ts +73 -0
  71. package/docs/llms-full.txt +382 -1
  72. package/docs/schema.md +15 -0
  73. package/package.json +1 -2
  74. package/template/db/public.ts +12 -0
  75. package/template/package.json +1 -1
  76. package/dist/chunk-AAT5G7KY.js.map +0 -1
  77. package/dist/chunk-C6COAB3E.js.map +0 -1
  78. package/dist/chunk-KATPXCJ5.js.map +0 -1
  79. package/dist/chunk-SI4KGEM3.js.map +0 -1
  80. package/dist/chunk-TVCCR6SO.js.map +0 -1
  81. package/dist/chunk-WWUG2QXF.js.map +0 -1
  82. package/dist/chunk-XOX6RFPZ.js.map +0 -1
  83. package/dist/chunk-YIQ4RS4F.js.map +0 -1
  84. package/stack-images.json +0 -24
@@ -1,8 +1,112 @@
1
- import { Schemas, Tables, TableTypes } from './db/env.cjs';
2
- import { ZodSchema, z } from 'zod';
1
+ import { z, ZodSchema } from 'zod';
3
2
  import { PalbaseFlagKey, Buckets, BucketTypes, PalbaseSecretName } from './stack.cjs';
3
+ import { Schemas, Tables, TableTypes } from './db/env.cjs';
4
4
  import { AsyncLocalStorage } from 'node:async_hooks';
5
5
 
6
+ interface CommandOptions {
7
+ /** auto uses the sequential plan when a command cannot be compiled or the
8
+ * executor is not installed. compiled refuses fallback; sequential opts out. */
9
+ mode?: "auto" | "compiled" | "sequential";
10
+ }
11
+
12
+ interface InsertManyOptions<Key extends string = string> {
13
+ onConflict?: readonly Key[];
14
+ /** Defaults to ignore when onConflict is supplied. */
15
+ action?: "ignore" | "update";
16
+ /** false returns the affected row count and skips row serialization. */
17
+ returning?: boolean;
18
+ }
19
+
20
+ /** Forward and backward requests are exclusive. Omit the size for 50 rows. */
21
+ type PageNavigation = {
22
+ first?: number;
23
+ after?: string;
24
+ last?: never;
25
+ before?: never;
26
+ } | {
27
+ last?: number;
28
+ before?: string;
29
+ first?: never;
30
+ after?: never;
31
+ };
32
+ interface PageInfo {
33
+ startCursor: string | null;
34
+ endCursor: string | null;
35
+ hasNextPage: boolean;
36
+ hasPreviousPage: boolean;
37
+ }
38
+ interface Page<Row> {
39
+ rows: Row[];
40
+ pageInfo: PageInfo;
41
+ }
42
+ /** The raw transport surface. Typed tables restrict column and relation names. */
43
+ type RawPageOptions = PageNavigation & {
44
+ orderBy?: {
45
+ column: string;
46
+ direction?: "asc" | "desc";
47
+ nulls?: "first" | "last";
48
+ } | readonly {
49
+ column: string;
50
+ direction?: "asc" | "desc";
51
+ nulls?: "first" | "last";
52
+ }[];
53
+ select?: readonly string[];
54
+ with?: Record<string, unknown>;
55
+ };
56
+
57
+ interface DatabaseBudget {
58
+ /** Application statements, including failed statements and retry attempts. */
59
+ maxQueries?: number;
60
+ /** Root rows returned across application statements. Nested relation rows are included in bytes. */
61
+ maxRows?: number;
62
+ /** Estimated JSON result bytes; this is not PostgreSQL protocol traffic. */
63
+ maxBytes?: number;
64
+ }
65
+ interface DatabaseQueryEvent {
66
+ ordinal: number;
67
+ fingerprint: string;
68
+ name?: string;
69
+ sql?: string;
70
+ source?: string;
71
+ durationMs: number;
72
+ rows: number;
73
+ bytes: number;
74
+ errorCode?: string;
75
+ }
76
+ interface DatabaseDiagnostics {
77
+ endpoint?: string;
78
+ requestId?: string;
79
+ outcome: "active" | "committed" | "failed";
80
+ elapsedMs: number;
81
+ queries: number;
82
+ rows: number;
83
+ bytes: number;
84
+ queueMs: number;
85
+ /** Time until the driver's transaction callback starts; includes wire BEGIN. */
86
+ poolMs: number;
87
+ setupMs: number;
88
+ /** Driver wait including PostgreSQL execution/locks and network time. */
89
+ sqlMs: number;
90
+ commitMs: number;
91
+ rollbackMs: number;
92
+ commits: number;
93
+ commitFailures: number;
94
+ rollbackRequests: number;
95
+ retries: number;
96
+ /** Bounded to the first 200 completed statements. Totals include every statement. */
97
+ statements: readonly DatabaseQueryEvent[];
98
+ }
99
+ interface DatabaseDiagnosticsOptions extends DatabaseBudget {
100
+ endpoint?: string;
101
+ requestId?: string;
102
+ /** Opt-in because a stack capture costs work on every statement. */
103
+ captureSource?: boolean;
104
+ /** SQL parameters are never recorded. Raw SQL text can contain inline literals. */
105
+ includeSql?: boolean;
106
+ onQuery?: (event: DatabaseQueryEvent) => void | Promise<void>;
107
+ onComplete?: (diagnostics: DatabaseDiagnostics) => void | Promise<void>;
108
+ }
109
+
6
110
  /** Supported HTTP methods for endpoints. */
7
111
  type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
8
112
  /**
@@ -58,6 +162,11 @@ interface User {
58
162
  /**
59
163
  * The caller's APPLICATION roles, as assigned in `auth.user_roles`.
60
164
  *
165
+ * A snapshot for display, NOT the authority: read `can` on rows and
166
+ * `pb.auth.permissions` in clients. `can` is for the interface; it cannot be
167
+ * used for an authorization decision; it may be incomplete; the server
168
+ * decides again on every request.
169
+ *
61
170
  * Not to be confused with {@link User.role}, which is the DATABASE role RLS
62
171
  * reads and is the literal string "authenticated" for every signed-in user.
63
172
  * These are the names a stack declares (`palbase roles`) and an operator
@@ -144,6 +253,13 @@ type MiddlewareHandler = (ctx: MiddlewareContext, next: () => Promise<void>) =>
144
253
  */
145
254
  declare function defineMiddleware(_fn: MiddlewareHandler): never;
146
255
 
256
+ /** A union of exact keys, not a partial row that could match many records. */
257
+ type UniqueWhere<Row, Keys> = Keys extends readonly (infer Key extends readonly string[])[] ? Key extends unknown ? {
258
+ [K in Extract<Key[number], keyof Row>]-?: NonNullable<Row[K]>;
259
+ } & {
260
+ [K in Exclude<keyof Row, Key[number]>]?: never;
261
+ } : never : never;
262
+
147
263
  /** On delete action for foreign key references. */
148
264
  type OnDeleteAction = 'cascade' | 'set null' | 'restrict' | 'no action';
149
265
  /**
@@ -886,6 +1002,34 @@ declare class PolicyBuilder {
886
1002
  * `(table, name)`, so names must be unique per table.
887
1003
  */
888
1004
  declare function policy(name: string): PolicyBuilder;
1005
+ /**
1006
+ * `can` alanının YANIT şeması (FR-004, D-14).
1007
+ *
1008
+ * Bir satırın `can`'i, tablonun adlandırılmış UPDATE policy'lerinden o satır ve
1009
+ * çağıran için `true` dönenlerin adıdır (engine `canColumns`). Yanıt şemaları
1010
+ * elle yazılan zod olduğu için (`dto/*.ts`) bu alan OpenAPI'ye ancak buradan
1011
+ * girer: `z.object({ …, can: can(transfers) })`. Enum değerleri policy
1012
+ * TANIMINDAN gelir — elle yazılan policy adı yoktur; iki codegen (`emitter.ts`
1013
+ * enum→union, swiftgen enum→`case`) tipli sabitleri buradan üretir.
1014
+ *
1015
+ * SÖZLEŞME (FR-005): `can` ARAYÜZ içindir; yetki kararı için kullanılamaz;
1016
+ * eksik olabilir (render edilemeyen policy düşer); sunucu her istekte yeniden
1017
+ * karar verir. Ham string policy'de kolon adlarını NİTELİKSİZ yazın — motor
1018
+ * ifadeyi `t` alias'ı altında seçer, `transfers.status` orada çözülmez; yorum
1019
+ * (`--`, `/*`) ve `auth.has_permission(...)`'ın `(select …)` sarmalı olmadan
1020
+ * çağrılması da o policy'yi `can`'den düşürür (warn ile). Yalnız `.for("update")`
1021
+ * policy'leri `can`'e girer; `.for("all")` UPDATE'i yönetir ama yankılanmaz.
1022
+ * `(select …)` sarmalayıcısını motor bir METİN kapısıyla arar (tırnaklı/boşluklu
1023
+ * yazımların sonlu olmayan kümesini DOĞRULAMAZ): bir çağrının satır başına
1024
+ * koşup koşmadığının ölçümü EXPLAIN ANALYZE'dır ve demo koşusunda (T016)
1025
+ * alınır — yavaş bir `can` yanlış değildir, kapı yalnız yaygın yanlışı yakalar.
1026
+ * `can` adı rezervedir: `can` kolonu olan tabloda yankı yok (bu fonksiyon fırlatır),
1027
+ * `can` adlı ilişki (`can` tablosu, `can_id` FK, `as`/`reverseAs: "can"`) ise
1028
+ * `defineTable`'da reddedilir.
1029
+ * AS RESTRICTIVE policy'ler Postgres'te olduğu gibi her izinli policy'ye AND'lenir;
1030
+ * `TO <rol>` listesi oturum rolüyle kapılanır.
1031
+ */
1032
+ declare function can<C extends ColumnMap>(table: TableDef<C>): z.ZodArray<z.ZodEnum<[string, ...string[]]>>;
889
1033
 
890
1034
  /**
891
1035
  * Postgres extensions a Palbase project can enable from its schema.
@@ -1128,6 +1272,25 @@ interface TableInput<C extends ColumnMap = ColumnMap> {
1128
1272
  * ```
1129
1273
  */
1130
1274
  policies?: (p: PolicyExprCtx<Extract<keyof C, string>>) => (PolicyBuilder | PolicyDef)[];
1275
+ /**
1276
+ * KOŞAN SÜRÜMÜN "BU TABLOYU ARTIK OKUMUYORUM" SÖZÜ — düşürmenin ilk yarısı.
1277
+ *
1278
+ * `ColumnDef.ignored`'ın tablo karşılığı ve aynı sebeple var: şema rayı, koşan
1279
+ * sürümün hâlâ BEYAN ettiği bir şeyi düşürmeyi reddeder — sıfır satırlı bir
1280
+ * tablo için bile, çünkü koşan sürümün bir SELECT'i ona dokunuyor olabilir.
1281
+ *
1282
+ * ONSUZ TABLO HİÇ DÜŞMÜYORDU (ölçüldü, canlı push 06.09.2026): rayın tavsiyesi
1283
+ * *"beyandan çıkar ve bir kez deploy et"*ti, ama beyandan çıkarmak düşürmeyi
1284
+ * ÜRETEN şeyin ta kendisi — o deploy'da da koşan sürüm tabloyu beyan ediyor
1285
+ * olur ve aynı red gelir. Kolonun çıkış yolu vardı, tablonun yoktu.
1286
+ *
1287
+ * İşaretlemek hiçbir DDL üretmez; ilk deploy'u BEDAVA yapan şey bu.
1288
+ *
1289
+ * ```ts
1290
+ * const cloud_images = defineTable("cloud_images", { ignored: true, columns: { … } });
1291
+ * ```
1292
+ */
1293
+ ignored?: boolean;
1131
1294
  /** Composite/named primary key (ordered column names). Omit for single-column inline .primaryKey(). */
1132
1295
  primaryKey?: string[];
1133
1296
  /** Named multi-column UNIQUE constraints. */
@@ -1188,6 +1351,8 @@ interface TableDef<C extends ColumnMap = ColumnMap> {
1188
1351
  name: string;
1189
1352
  columns: C;
1190
1353
  rls: boolean;
1354
+ /** Koşan sürümün "bu tabloyu okumuyorum" sözü — bkz. TableInput.ignored. */
1355
+ ignored?: boolean;
1191
1356
  policies: PolicyDef[];
1192
1357
  primaryKey?: string[];
1193
1358
  unique?: {
@@ -2938,23 +3103,95 @@ declare const Flags: PalbaseFlagsAmbient;
2938
3103
  */
2939
3104
  declare const Realtime: PalbaseRealtimeClient;
2940
3105
 
2941
- /**
2942
- * typed-db.ts Task 2: TypedDB schema-derived insert/row shapes.
2943
- *
2944
- * Derives INSERT and full-row TypeScript types from a `defineSchema()` result
2945
- * and wraps the untyped runtime `DBClient` with a typed facade.
2946
- *
2947
- * No value-any. No `as unknown as X`. The two narrow `as` casts in
2948
- * `makeTypedTable` are safe because:
2949
- * - `data as Record<string, unknown>`: InsertShape<T> maps string keys to
2950
- * typed values; all value types are subsets of `unknown`, so the cast is
2951
- * structurally sound.
2952
- * - `result as RowShape<T>`: The runtime DBClient returns `Record<string,
2953
- * unknown>` which is the erased form of the typed row; we're narrowing back
2954
- * to the precise shape that the schema declared.
2955
- * Both casts are narrowing only (not widening) and correctness is guaranteed
2956
- * by the schema the caller provides.
2957
- */
3106
+ /** Limits apply per engine process. PostgreSQL locks remain the authority when
3107
+ * several replicas write the same rows. Size the total budget across replicas. */
3108
+ interface WorkloadOptions {
3109
+ concurrency: number;
3110
+ queueLimit: number;
3111
+ tenantConcurrency?: number;
3112
+ tenantQueueLimit?: number;
3113
+ queueTimeoutMs?: number;
3114
+ /** Read from authenticated claims; defaults to tenant_id, then sub, then one
3115
+ * shared anonymous bucket. A request body never chooses the tenant budget. */
3116
+ tenantClaim?: string;
3117
+ }
3118
+ interface DatabaseWorkload {
3119
+ readonly name: string;
3120
+ readonly concurrency: number;
3121
+ readonly queueLimit: number;
3122
+ readonly tenantConcurrency: number;
3123
+ readonly tenantQueueLimit: number;
3124
+ readonly queueTimeoutMs: number;
3125
+ readonly tenantClaim: string;
3126
+ }
3127
+ /** Declare once at module scope and reuse on $atomic calls. Keys, queue limits
3128
+ * and tenant budgets affect admission, not SQL permissions or isolation. */
3129
+ declare function defineWorkload(name: string, options: WorkloadOptions): DatabaseWorkload;
3130
+
3131
+ /** A PostgreSQL isolation level supported by the explicit root transaction. */
3132
+ type TransactionIsolation = "read committed" | "repeatable read" | "serializable";
3133
+ interface AtomicOptions {
3134
+ /** Each retry opens a fresh transaction and reruns the complete callback.
3135
+ * Defaults to zero. Keep external effects outside it; persist an outbox instead. */
3136
+ retry?: number;
3137
+ isolation?: TransactionIsolation;
3138
+ readOnly?: boolean;
3139
+ /** Maximum wait for a PostgreSQL lock. Defaults to 5000 ms. */
3140
+ lockTimeoutMs?: number;
3141
+ /** PostgreSQL statement timeout; applies to every statement in this scope. */
3142
+ statementTimeoutMs?: number;
3143
+ /** Total work deadline including queueing and retries. Active Bun queries are
3144
+ * cancelled; rollback settles before release. An in-flight COMMIT is awaited. */
3145
+ timeoutMs?: number;
3146
+ signal?: AbortSignal;
3147
+ workload?: DatabaseWorkload;
3148
+ /** Resource names shared within a workload. Include a tenant prefix if the
3149
+ * resource ID itself is only unique inside a tenant. Requires workload. */
3150
+ conflictKeys?: readonly string[];
3151
+ }
3152
+
3153
+ /** Storage metadata that affects the declared response; defaults and unrelated
3154
+ * columns do not change an explicitly projected query's contract. */
3155
+ interface QueryColumnContract {
3156
+ type: string;
3157
+ nullable: boolean;
3158
+ codec?: string;
3159
+ enumValues?: readonly string[];
3160
+ dimensions?: number;
3161
+ }
3162
+ interface PreparedRead {
3163
+ name: string;
3164
+ table: string;
3165
+ columns: Record<string, QueryColumnContract>;
3166
+ where: Record<string, unknown>;
3167
+ options: {
3168
+ select: string[];
3169
+ orderBy?: {
3170
+ column: string;
3171
+ direction?: "asc" | "desc";
3172
+ nulls?: "first" | "last";
3173
+ } | {
3174
+ column: string;
3175
+ direction?: "asc" | "desc";
3176
+ nulls?: "first" | "last";
3177
+ }[];
3178
+ limit?: number;
3179
+ };
3180
+ }
3181
+ interface CompiledRead {
3182
+ sql: string;
3183
+ params: unknown[];
3184
+ }
3185
+ interface QueryDatabase {
3186
+ readQuery(query: PreparedRead): Promise<Record<string, unknown>[]>;
3187
+ compileQuery(query: PreparedRead): CompiledRead;
3188
+ explainQuery(query: PreparedRead): Promise<unknown[]>;
3189
+ }
3190
+ interface EnvQueryDatabase {
3191
+ $readQuery: QueryDatabase["readQuery"];
3192
+ $compileQuery: QueryDatabase["compileQuery"];
3193
+ $explainQuery: QueryDatabase["explainQuery"];
3194
+ }
2958
3195
 
2959
3196
  /** Keys of C whose columns are required on INSERT (not nullable, no default). */
2960
3197
  type RequiredKeys<C> = {
@@ -2986,12 +3223,22 @@ type RowShape<T extends TableDef> = {
2986
3223
  };
2987
3224
  /** A typed table accessor that mirrors the runtime DBClient surface. */
2988
3225
  interface TypedTable<T extends TableDef> {
3226
+ /** Runtime validates the key against the installed schema. Generated env tables
3227
+ * also check the complete unique/composite key at compile time. */
3228
+ findUnique<K extends keyof RowShape<T> = keyof RowShape<T>>(q: {
3229
+ where: Partial<RowShape<T>>;
3230
+ select?: readonly K[];
3231
+ }): Promise<Pick<RowShape<T>, K> | null>;
3232
+ page<K extends keyof RowShape<T> = keyof RowShape<T>>(q?: PageInput<RowShape<T>, K>): Promise<Page<Pick<RowShape<T>, K>>>;
2989
3233
  insert(data: InsertValues<InsertShape<T>>): Promise<RowShape<T>>;
2990
3234
  /** Çok satır, TEK statement. Satırların anahtar kümesi aynı olmalı. */
2991
- insertMany(rows: readonly InsertValues<InsertShape<T>>[], opts?: {
2992
- onConflict: readonly string[];
2993
- action?: "ignore" | "update";
3235
+ insertMany(rows: readonly InsertValues<InsertShape<T>>[], opts: InsertManyOptions & {
3236
+ returning: false;
3237
+ }): Promise<number>;
3238
+ insertMany(rows: readonly InsertValues<InsertShape<T>>[], opts?: InsertManyOptions & {
3239
+ returning?: true;
2994
3240
  }): Promise<RowShape<T>[]>;
3241
+ insertMany(rows: readonly InsertValues<InsertShape<T>>[], opts?: InsertManyOptions): Promise<RowShape<T>[] | number>;
2995
3242
  put(q: {
2996
3243
  data: InsertShape<T>;
2997
3244
  onConflict: readonly string[];
@@ -3058,7 +3305,9 @@ interface TypedTable<T extends TableDef> {
3058
3305
  }): Promise<number>;
3059
3306
  }
3060
3307
  /** A typed DB facade covering all tables declared in schema `S`. */
3061
- interface TypedDB<S extends SchemaDef> {
3308
+ interface TypedDB<S extends SchemaDef> extends QueryDatabase {
3309
+ diagnostics: DBOps["diagnostics"];
3310
+ command<T>(fn: (tx: TypedTx<S>) => T extends Promise<unknown> ? never : T, options?: CommandOptions): Promise<Materialized<T>>;
3062
3311
  tables: {
3063
3312
  [K in keyof S["tables"]]: TypedTable<S["tables"][K]>;
3064
3313
  };
@@ -3095,7 +3344,7 @@ type TypedTx<S extends SchemaDef> = TxPlanHandle<{
3095
3344
  * object to the precise mapped type (TS cannot infer the mapped-type result
3096
3345
  * through `Object.keys` iteration) — see the module-level doc comment.
3097
3346
  */
3098
- declare function makeTypedDB<S extends SchemaDef>(schema: S, raw: DBClient): TypedDB<S>;
3347
+ declare function makeTypedDB<S extends SchemaDef>(schema: S, raw: AtomicClient): TypedDB<S>;
3099
3348
  /** Bir where değeri: düz eşitlik YA DA operatör nesnesi (FR-016). */
3100
3349
  /**
3101
3350
  * Metin operatörleri YALNIZ metin kolonlarında görünür (FR-005).
@@ -3240,10 +3489,9 @@ type SqlFragment = {
3240
3489
  /**
3241
3490
  * Retryable bir hatada işlemi yeniden dener (FR-037).
3242
3491
  *
3243
- * D-016: retry'SIZ bir izolasyon yükseltmesi sunmak defect'tir kullanıcıya
3244
- * çalışmayan bir düğme vermektir. `SerializationFailure`'ın metni
3245
- * *"{ retry: n } verebilirsiniz"* diyor; bu fonksiyon o düğmenin gerçekten
3246
- * çalışan yarısı.
3492
+ * `fn` must open and settle a NEW transaction on each invocation. Repeating
3493
+ * a savepoint retains the old snapshot and cannot retry a failed COMMIT.
3494
+ * Database.$atomic owns that boundary for ordinary application code.
3247
3495
  *
3248
3496
  * VARSAYILAN SIFIR. Sessiz bir varsayılan retry, idempotent OLMAYAN bir işlemi
3249
3497
  * çağıranın haberi olmadan iki kez çalıştırırdı — bir para transferini iki kez.
@@ -3283,7 +3531,12 @@ type TextOps<V> = V extends string ? {
3283
3531
  icontains?: string;
3284
3532
  startsWith?: string;
3285
3533
  endsWith?: string;
3286
- } : Record<never, never>;
3534
+ } : {
3535
+ contains?: never;
3536
+ icontains?: never;
3537
+ startsWith?: never;
3538
+ endsWith?: never;
3539
+ };
3287
3540
  /** Operatör gövdesi, kolon-referans tipi DIŞARIDAN verilmiş hâliyle.
3288
3541
  *
3289
3542
  * `C` bir parametre, çünkü `ColRefOf<Row, V>` aksi hâlde altı operatör
@@ -3469,16 +3722,17 @@ type HasBranch<Row, Rels> = [unknown] extends [Rels] ? never : [keyof Rels] exte
3469
3722
  * `true` bütün kolonları, bir nesne ise `select`/`where`/`orderBy`/`limit` ile
3470
3723
  * daraltılmış hâlini getiriyor. Tek sorgu: LATERAL + `json_agg`.
3471
3724
  */
3472
- type WithOpts<To> = {
3725
+ type WithOpts<To, D extends HasDepth> = {
3473
3726
  select?: readonly Extract<keyof RelatedRow<To>, string>[];
3474
3727
  where?: WhereFilter<RelatedRow<To>>;
3475
3728
  orderBy?: OrderBySpec<RelatedRow<To>> | readonly OrderBySpec<RelatedRow<To>>[];
3476
3729
  limit?: number;
3730
+ with?: D extends 1 ? never : [keyof RelatedRels<To>] extends [never] ? never : WithInput<RelatedRels<To>, HasDec[D]>;
3477
3731
  };
3478
- type WithInput<Rels> = {
3732
+ type WithInput<Rels, D extends HasDepth = 3> = {
3479
3733
  [R in keyof Rels]?: Rels[R] extends {
3480
3734
  to: infer To;
3481
- } ? true | WithOpts<To> : never;
3735
+ } ? true | WithOpts<To, D> : never;
3482
3736
  };
3483
3737
  /** Bir `with` dalının DÖNÜŞ tipi — `many` dizi, `one` tekil ya da null. */
3484
3738
  type WithRowOf<Rels, R extends keyof Rels, Q> = Rels[R] extends {
@@ -3486,7 +3740,9 @@ type WithRowOf<Rels, R extends keyof Rels, Q> = Rels[R] extends {
3486
3740
  kind: infer K;
3487
3741
  } ? (Q extends {
3488
3742
  select: readonly (infer C extends keyof RelatedRow<To>)[];
3489
- } ? Pick<RelatedRow<To>, C> : RelatedRow<To>) extends infer Row ? [K] extends ["many"] ? Row[] : Row | null : never : never;
3743
+ } ? Pick<RelatedRow<To>, C> : RelatedRow<To>) & (Q extends {
3744
+ with: infer W;
3745
+ } ? WithResult<RelatedRels<To>, W> : unknown) extends infer Row ? [K] extends ["many"] ? Row[] : Row | null : never : never;
3490
3746
  /**
3491
3747
  * `with` istenmediğinde `unknown` — kesişimde YOK OLSUN diye.
3492
3748
  *
@@ -3544,6 +3800,9 @@ type QueryInput<Row, K extends keyof Row = keyof Row, Rels = unknown> = {
3544
3800
  */
3545
3801
  select?: readonly K[];
3546
3802
  } & FindManyOpts<Row>;
3803
+ type PageInput<Row, K extends keyof Row = keyof Row, Rels = unknown> = Omit<QueryInput<Row, keyof Row, Rels>, "limit" | "offset" | "select"> & {
3804
+ select?: readonly K[];
3805
+ } & PageNavigation;
3547
3806
  /** Bir yazmanın TEK parametresi: neyi (`where`) neye çevirdiğin (`set`). */
3548
3807
  type MutateInput<Row, Insert, Rels = unknown> = {
3549
3808
  where: WhereFilter<Row> | SqlFragment | HasBranch<Row, Rels>;
@@ -3727,6 +3986,16 @@ type AggregateResult<Q, Row> = Q extends {
3727
3986
  } & AggBody<Q, Row>)[] : AggBody<Q, Row>;
3728
3987
  /** Temel tablo erişimcisi — search'süz beş op. */
3729
3988
  interface EnvTypedTableBase<T extends TableTypes> {
3989
+ findUnique<K extends keyof T["row"] = keyof T["row"], W extends WithInput<RelsOf<T>> = Record<never, never>>(q: {
3990
+ where: UniqueWhere<T["row"], T["uniqueKeys"]>;
3991
+ select?: readonly K[];
3992
+ with?: QueryInput<T["row"], keyof T["row"], RelsOf<T>>["with"] & W;
3993
+ }): Promise<(Pick<T["row"], K> & WithResult<RelsOf<T>, W>) | null>;
3994
+ /** Index-backed pagination. The engine appends the declared primary key to
3995
+ * orderBy, encrypts cursor values and validates the query and caller scope. */
3996
+ page<K extends keyof T["row"] = keyof T["row"], W extends WithInput<RelsOf<T>> = Record<never, never>>(q?: PageInput<T["row"], K, RelsOf<T>> & {
3997
+ with?: W;
3998
+ }): Promise<Page<Pick<T["row"], K> & WithResult<RelsOf<T>, W>>>;
3730
3999
  insert(data: InsertValues<T["insert"]>): Promise<T["row"]>;
3731
4000
  /**
3732
4001
  * Çok satırı TEK statement'la ekle (tek gidiş-dönüş).
@@ -3743,14 +4012,13 @@ interface EnvTypedTableBase<T extends TableTypes> {
3743
4012
  *
3744
4013
  * Boş dizi boş sonuç döner — hata değil: "eklenecek bir şey yoktu".
3745
4014
  */
3746
- insertMany(rows: readonly InsertValues<T["insert"]>[], opts?: {
3747
- /** Çakışmanın ARANDIĞI kolonlar — benzersiz bir kısıt ya da index taşımalı. */
3748
- onConflict: readonly Extract<keyof T["row"], string>[];
3749
- /** `"ignore"` (VARSAYILAN, plan yoluyla aynı) çakışanı atlar ve o satır
3750
- * SONUÇTA DÖNMEZ — Postgres yalnız yazdıklarını döndürür; `"update"`
3751
- * üzerine yazar. */
3752
- action?: "ignore" | "update";
4015
+ insertMany(rows: readonly InsertValues<T["insert"]>[], opts: InsertManyOptions<Extract<keyof T["row"], string>> & {
4016
+ returning: false;
4017
+ }): Promise<number>;
4018
+ insertMany(rows: readonly InsertValues<T["insert"]>[], opts?: InsertManyOptions<Extract<keyof T["row"], string>> & {
4019
+ returning?: true;
3753
4020
  }): Promise<T["row"][]>;
4021
+ insertMany(rows: readonly InsertValues<T["insert"]>[], opts?: InsertManyOptions<Extract<keyof T["row"], string>>): Promise<T["row"][] | number>;
3754
4022
  /**
3755
4023
  * Bir idempotency anahtarını sahiplen (FR-033).
3756
4024
  *
@@ -4007,13 +4275,22 @@ type TxPlan = TxPlanHandle<TxTables> & TxSchemaSurface;
4007
4275
  * Every op it performs runs as the `service_role` (BYPASSRLS).
4008
4276
  */
4009
4277
  type EnvServiceDatabase = EnvSchemaSurface & {
4278
+ /** Commits independently of the request. All decision reads and writes belong
4279
+ * inside this callback; each retry includes a new BEGIN and COMMIT. */
4280
+ $atomic<T>(fn: (tx: AtomicDatabase) => Promise<T>, options?: AtomicOptions): Promise<T>;
4010
4281
  /** Ham SQL. Generic verilmezse `unknown[]` döner (FR-021). */
4011
4282
  $query: DBClient["query"];
4012
4283
  $insert: DBClient["insert"];
4013
4284
  $update: DBClient["update"];
4014
4285
  $delete: DBClient["delete"];
4015
4286
  $findById: DBClient["findById"];
4287
+ $findUnique: DBClient["findUnique"];
4288
+ $readQuery: DBClient["readQuery"];
4289
+ $diagnostics: DBClient["diagnostics"];
4290
+ $compileQuery: DBClient["compileQuery"];
4291
+ $explainQuery: DBClient["explainQuery"];
4016
4292
  $findMany: DBClient["findMany"];
4293
+ $page: DBClient["page"];
4017
4294
  $put: DBClient["put"];
4018
4295
  $updateMany: DBClient["updateMany"];
4019
4296
  $deleteMany: DBClient["deleteMany"];
@@ -4027,12 +4304,12 @@ type EnvServiceDatabase = EnvSchemaSurface & {
4027
4304
  $lockRows: DBClient["lockRows"];
4028
4305
  $advisoryXactLock: DBClient["advisoryXactLock"];
4029
4306
  $attempt: DBClient["attempt"];
4307
+ $command<T>(fn: (tx: TxPlan) => T extends Promise<unknown> ? never : T, options?: CommandOptions): Promise<Materialized<T>>;
4030
4308
  /** Bkz. {@link EnvTypedDatabase.$transaction}. */
4031
4309
  /**
4032
- * `opts.retry` verilirse, `SerializationFailure` / `DeadlockDetected`
4033
- * alındığında plan BAŞTAN kurulup yeniden çalıştırılır (FR-037).
4034
- * Varsayılan 0 sessiz bir retry, idempotent olmayan bir işlemi çağıranın
4035
- * haberi olmadan iki kez çalıştırırdı.
4310
+ * A plan is a savepoint in the current transaction. Nonzero `retry` is
4311
+ * refused; use $atomic for whole-transaction retry, including decision reads
4312
+ * and COMMIT. The default plan keeps request-scoped commit/rollback behavior.
4036
4313
  */
4037
4314
  $transaction<T>(fn: (tx: TxPlan) => T extends Promise<unknown> ? never : T, opts?: {
4038
4315
  retry?: number;
@@ -4072,13 +4349,22 @@ type EnvSchemaSurface = {
4072
4349
  * await Database.$transaction((tx) => { … });
4073
4350
  */
4074
4351
  type EnvTypedDatabase = EnvSchemaSurface & {
4352
+ /** Commits independently of the request. A later handler failure does not
4353
+ * undo this scope. The callback cannot switch RLS identity or nest a root. */
4354
+ $atomic<T>(fn: (tx: AtomicDatabase) => Promise<T>, options?: AtomicOptions): Promise<T>;
4075
4355
  /** Ham SQL. Generic verilmezse `unknown[]` döner (FR-021). */
4076
4356
  $query: DBClient["query"];
4077
4357
  $insert: DBClient["insert"];
4078
4358
  $update: DBClient["update"];
4079
4359
  $delete: DBClient["delete"];
4080
4360
  $findById: DBClient["findById"];
4361
+ $findUnique: DBClient["findUnique"];
4362
+ $readQuery: DBClient["readQuery"];
4363
+ $diagnostics: DBClient["diagnostics"];
4364
+ $compileQuery: DBClient["compileQuery"];
4365
+ $explainQuery: DBClient["explainQuery"];
4081
4366
  $findMany: DBClient["findMany"];
4367
+ $page: DBClient["page"];
4082
4368
  $put: DBClient["put"];
4083
4369
  $updateMany: DBClient["updateMany"];
4084
4370
  $deleteMany: DBClient["deleteMany"];
@@ -4092,6 +4378,7 @@ type EnvTypedDatabase = EnvSchemaSurface & {
4092
4378
  $lockRows: DBClient["lockRows"];
4093
4379
  $advisoryXactLock: DBClient["advisoryXactLock"];
4094
4380
  $attempt: DBClient["attempt"];
4381
+ $command<T>(fn: (tx: TxPlan) => T extends Promise<unknown> ? never : T, options?: CommandOptions): Promise<Materialized<T>>;
4095
4382
  /** RLS'i bypass eden kardeş yüzey. Kendisi `$asService` TAŞIMAZ — çift bypass yok. */
4096
4383
  $asService(): EnvServiceDatabase;
4097
4384
  /**
@@ -4100,15 +4387,16 @@ type EnvTypedDatabase = EnvSchemaSurface & {
4100
4387
  * Callback SENKRONDUR: döndüğünde hiçbir şey çalışmamıştır.
4101
4388
  */
4102
4389
  /**
4103
- * `opts.retry` verilirse, `SerializationFailure` / `DeadlockDetected`
4104
- * alındığında plan BAŞTAN kurulup yeniden çalıştırılır (FR-037).
4105
- * Varsayılan 0 sessiz bir retry, idempotent olmayan bir işlemi çağıranın
4106
- * haberi olmadan iki kez çalıştırırdı.
4390
+ * A plan is a savepoint in the current transaction. Nonzero `retry` is
4391
+ * refused; use $atomic for whole-transaction retry, including decision reads
4392
+ * and COMMIT. The default plan keeps request-scoped commit/rollback behavior.
4107
4393
  */
4108
4394
  $transaction<T>(fn: (tx: TxPlan) => T extends Promise<unknown> ? never : T, opts?: {
4109
4395
  retry?: number;
4110
4396
  }): Promise<Materialized<T>>;
4111
4397
  };
4398
+ /** The same typed table/query surface on one active physical transaction. */
4399
+ type AtomicDatabase = Omit<EnvServiceDatabase, "$atomic">;
4112
4400
 
4113
4401
  /**
4114
4402
  * tx-plan.ts — `Database.$transaction()` as a PLAN, not a pinned session.
@@ -4768,7 +5056,16 @@ interface RateLimitConfig {
4768
5056
  }
4769
5057
  /** The six raw string-keyed DB operations shared by `DBClient` and the
4770
5058
  * transaction-scoped client. */
4771
- interface DBOps {
5059
+ interface DBOps extends QueryDatabase {
5060
+ /** Null when diagnostics/budgets are disabled. Binding values are never included. */
5061
+ diagnostics(): DatabaseDiagnostics | null;
5062
+ /** Match exactly one declared primary/unique key; null never denotes a unique value. */
5063
+ findUnique(table: string, where: Record<string, unknown>, opts?: {
5064
+ select?: readonly string[];
5065
+ with?: Record<string, unknown>;
5066
+ }): Promise<Record<string, unknown> | null>;
5067
+ /** Keyset pagination with opaque, lossless cursors and a unique ordering. */
5068
+ page(table: string, query?: Record<string, unknown>, opts?: RawPageOptions): Promise<Page<Record<string, unknown>>>;
4772
5069
  /**
4773
5070
  * Run SQL on the REQUEST'S OWN transaction.
4774
5071
  *
@@ -4814,10 +5111,13 @@ interface DBOps {
4814
5111
  count?: boolean;
4815
5112
  groupBy?: readonly string[];
4816
5113
  }): Promise<Record<string, unknown> | Record<string, unknown>[]>;
4817
- insertMany(table: string, rows: readonly Record<string, unknown>[], opts?: {
4818
- onConflict: readonly string[];
4819
- action?: "ignore" | "update";
5114
+ insertMany(table: string, rows: readonly Record<string, unknown>[], opts: InsertManyOptions & {
5115
+ returning: false;
5116
+ }): Promise<number>;
5117
+ insertMany(table: string, rows: readonly Record<string, unknown>[], opts?: InsertManyOptions & {
5118
+ returning?: true;
4820
5119
  }): Promise<Record<string, unknown>[]>;
5120
+ insertMany(table: string, rows: readonly Record<string, unknown>[], opts?: InsertManyOptions): Promise<Record<string, unknown>[] | number>;
4821
5121
  /**
4822
5122
  * Insert the row, or update it when it collides on `onConflict` — one
4823
5123
  * statement, so two concurrent callers cannot both lose.
@@ -4945,7 +5245,14 @@ interface DBOps {
4945
5245
  orderBy?: {
4946
5246
  column: string;
4947
5247
  direction?: "asc" | "desc";
4948
- };
5248
+ nulls?: "first" | "last";
5249
+ } | {
5250
+ column: string;
5251
+ direction?: "asc" | "desc";
5252
+ nulls?: "first" | "last";
5253
+ }[];
5254
+ select?: string[];
5255
+ with?: Record<string, unknown>;
4949
5256
  limit?: number;
4950
5257
  offset?: number;
4951
5258
  }): Promise<Record<string, unknown>[]>;
@@ -4995,15 +5302,18 @@ interface DBOps {
4995
5302
  }
4996
5303
  /** Database client interface injected into endpoint context. */
4997
5304
  interface DBClient extends DBOps {
5305
+ /** Execute a compilable plan on PostgreSQL, with an explicit fallback policy. */
5306
+ command(plan: TxPlanBody, options?: CommandOptions): Promise<TxPlanResponse>;
5307
+ /** An independent physical transaction. Resolves after COMMIT, and retries the
5308
+ * complete callback on a fresh transaction. One identity for its entire scope. */
5309
+ atomic<T>(fn: (tx: AtomicClient) => Promise<T>, options?: AtomicOptions): Promise<T>;
4998
5310
  /**
4999
5311
  * Run a whole transaction as ONE plan, executed on the request's own
5000
5312
  * transaction inside a savepoint.
5001
5313
  *
5002
5314
  * The low-level seam behind `Database.$transaction(plan)`: the SDK builds the
5003
- * plan, this sends it, and the broker executes every operation inside a single
5004
- * transaction that commits or rolls back before the response is written.
5005
- * Nothing pins a Postgres backend across round trips, because there is only
5006
- * one round trip.
5315
+ * plan and the local engine executes it on this transaction. A single API
5316
+ * call can issue several SQL statements; it does not promise one DB round trip.
5007
5317
  *
5008
5318
  * On failure the runtime must reject with an error carrying the broker's
5009
5319
  * envelope fields — see {@link TxPlanRejection}. `slot` in particular is what
@@ -5028,6 +5338,8 @@ interface DBClient extends DBOps {
5028
5338
  */
5029
5339
  asService(): Omit<DBClient, "asService">;
5030
5340
  }
5341
+ /** An active root-transaction handle cannot switch identities or nest another root. */
5342
+ type AtomicClient = Omit<DBClient, "asService" | "atomic">;
5031
5343
  /** Logger interface injected into endpoint context. */
5032
5344
  interface Logger {
5033
5345
  info(message: string, ...args: unknown[]): void;
@@ -5319,4 +5631,4 @@ type Middleware = (ctx: MiddlewareContext, next: () => Promise<void>) => Promise
5319
5631
  */
5320
5632
  type AuthSpec = boolean | Partial<AuthConfig>;
5321
5633
 
5322
- export { type Materialized as $, type AuthSpec as A, BadRequest as B, type CacheClient as C, type DBClient as D, type EnvServiceDatabase as E, type EnvTypedTable as F, type ErrorDef as G, HttpError as H, type ErrorMap as I, type ErrorThrowers as J, type FileContext as K, type FindManyOpts as L, Flags as M, Forbidden as N, type HttpMethod as O, type PalbaseResult as P, IndexBuilder as Q, type RateLimitConfig as R, type SchemaDef as S, type TxPlanBody as T, type IndexDef as U, type InsertShape as V, type InsertValues as W, type LifecycleHook as X, Log as Y, type Logger as Z, __runWithRuntime as _, type RuntimeServices as a, type PalbaseInitialLink as a$, type Middleware as a0, type MiddlewareContext as a1, type MiddlewareHandler as a2, type MutateInput as a3, NotFound as a4, Notifications as a5, type OnDeleteAction as a6, type OrderBySpec as a7, PALBASE_EXTENSIONS as a8, type PBRequest as a9, type PalbaseDocumentRef as aA, type PalbaseDocumentSnapshot as aB, type PalbaseEmailClient as aC, type PalbaseEmailSendParams as aD, type PalbaseEmailSendResponse as aE, type PalbaseEventNamesResult as aF, type PalbaseEventsQueryInput as aG, type PalbaseEventsResult as aH, type PalbaseExtension as aI, type PalbaseFileObject as aJ, type PalbaseFlag as aK, type PalbaseFlagContext as aL, type PalbaseFlagSource as aM, type PalbaseFlagValue as aN, type PalbaseFlagVariant as aO, type PalbaseFlagsClient 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 PalbaseInboxSendResponse as a_, PalError as aa, type PalbaseAnalyticsClient as ab, type PalbaseAnalyticsManagementNamespace as ac, type PalbaseAnalyticsProperties as ad, type PalbaseAnalyticsQueryNamespace as ae, type PalbaseAttestAndroidParams as af, type PalbaseAttestAndroidResult as ag, type PalbaseAttestiOSParams as ah, type PalbaseAttestiOSResult as ai, type PalbaseAuthAdminClient as aj, type PalbaseAuthClient as ak, type PalbaseBatchOverrideOperation as al, type PalbaseBatchSetOverridesResult as am, type PalbaseBindDeviceParams as an, type PalbaseBucketClient as ao, type PalbaseClearAllOverridesResult as ap, type PalbaseClearOverrideResult as aq, type PalbaseCohortQueryInput as ar, type PalbaseCohortResult as as, type PalbaseCollectionRef as at, type PalbaseCountQueryInput as au, type PalbaseCountResult as av, type PalbaseCreateLinkParams as aw, type PalbaseDeviceInfo as ax, type PalbaseDeviceTokenView as ay, type PalbaseDocsClient as az, type DBOps as b, type TableDef as b$, type PalbaseInvokeOptions as b0, type PalbaseLink as b1, type PalbaseLinkAnalytics as b2, type PalbaseLinkDetails as b3, type PalbaseLinksClient as b4, type PalbaseListLinksOptions as b5, type PalbaseListLinksResult as b6, type PalbaseListOptions as b7, type PalbaseMatchParams as b8, type PalbaseMultiChannelResponse as b9, type PalbaseUsersQueryInput as bA, type PalbaseUsersResult as bB, type PalbaseVerifyRequestSignatureParams as bC, type PalbaseWhereOperator as bD, type PolicyBinOp as bE, PolicyBuilder as bF, type PolicyCommand as bG, type PolicyDef as bH, type PolicyExprCtx as bI, PolicyExprRef as bJ, type PolicyMode as bK, type PolicyOperand as bL, type QueryInput as bM, type RawConstraintDef as bN, Realtime as bO, type Ref as bP, type RequestStore as bQ, type RowShape as bR, Secrets as bS, type SecretsService as bT, SerializationFailure as bU, type SetShape as bV, type SetValue as bW, type ShutdownRunner as bX, type SqlFragment as bY, Storage as bZ, TABLE_META as b_, type PalbaseNotificationsClient as ba, type PalbaseOverviewResult as bb, type PalbasePreferences as bc, type PalbasePreferencesClient as bd, type PalbasePushClient as be, type PalbasePushSendParams as bf, type PalbasePushSendResponse as bg, type PalbaseQrCodeOptions as bh, type PalbaseQuerySnapshot as bi, type PalbaseRealtimeClient as bj, type PalbaseRegisterDeviceParams as bk, type PalbaseRetentionQueryInput as bl, type PalbaseRetentionResult as bm, type PalbaseSession as bn, type PalbaseSetOverrideResult as bo, type PalbaseSetOverridesResult as bp, type PalbaseSignedUrlResponse as bq, type PalbaseSmsClient as br, type PalbaseSmsSendParams as bs, type PalbaseSmsSendResponse as bt, type PalbaseStorageClient as bu, type PalbaseTransformOptions as bv, type PalbaseUpdateLinkParams as bw, type PalbaseUploadOptions as bx, type PalbaseUser as by, type PalbaseUserDetailResult as bz, type TxPlanResponse as c, ownedByUser as c$, type TableHandle as c0, type TableInput as c1, TooManyRequests as c2, type TxColumnExpr as c3, type TxInsertShape as c4, type TxInsertValue as c5, type TxNow as c6, type TxPlan as c7, TxPlanError as c8, type TxPlanHandle as c9, __resetLifecycleHooks as cA, __runStartHooks as cB, __setRuntime as cC, bigint as cD, boolean as cE, col as cF, dec as cG, decrement as cH, defineMiddleware as cI, defineSchema as cJ, defineTable as cK, enumType as cL, exprCtx as cM, inc as cN, increment as cO, index as cP, installationRef as cQ, integer as cR, isPalbaseExtension as cS, isRetryable as cT, jsonb as cU, makeTypedDB as cV, now as cW, numeric as cX, onShutdown as cY, onStart as cZ, openai as c_, type TxPlanOpResult as ca, type TxPlanRejection as cb, TxRefError as cc, type TxRow as cd, type TxRows as ce, type TxSelectOptions as cf, type TxSetShape as cg, type TxSetValue as ch, type TxTable as ci, type TxTables as cj, type TxWhere as ck, type TxWireExpr as cl, type TxWireGuard as cm, type TxWireOp as cn, type TxWireRef as co, type TxWireValue as cp, type TypedDB as cq, type TypedTable as cr, type TypedTx as cs, Unauthorized as ct, UniqueViolation as cu, type User as cv, type VerifiedDevice as cw, type WhereFilter as cx, type WhereOp as cy, __getRuntime as cz, __requestALS as d, policy as d0, raw as d1, sqlFragment as d2, text as d3, timestamp as d4, userRef as d5, uuid as d6, vector as d7, withRetry as d8, type PolicyExpr as e, type AggregateInput as f, type AggregateResult as g, type AnyColumn as h, Auth as i, type AuthConfig as j, Cache as k, type ClientInfo as l, type ColRef as m, ColumnBuilder as n, type ColumnDef as o, type ColumnMap as p, type ColumnType as q, Conflict as r, Database as s, DeadlockDetected as t, Documents as u, EXTENSION_DEPENDENCIES as v, type EmbeddingModelRef as w, type EnvSchemas as x, type EnvTables as y, type EnvTypedDatabase as z };
5634
+ export { type ErrorMap as $, type AuthSpec as A, BadRequest as B, type CompiledRead as C, type DatabaseBudget as D, type EnvServiceDatabase as E, type ColumnMap as F, type ColumnType as G, HttpError as H, Conflict as I, Database as J, type DatabaseQueryEvent as K, type DatabaseWorkload as L, DeadlockDetected as M, Documents as N, EXTENSION_DEPENDENCIES as O, type PreparedRead as P, type EmbeddingModelRef as Q, type RateLimitConfig as R, type SchemaDef as S, type TransactionIsolation as T, type EnvQueryDatabase as U, type EnvSchemas as V, type EnvTables as W, type EnvTypedDatabase as X, type EnvTypedTable as Y, type ErrorDef as Z, __runWithRuntime as _, type DBClient as a, type PalbaseFileObject as a$, type ErrorThrowers as a0, type FileContext as a1, type FindManyOpts as a2, Flags as a3, Forbidden as a4, type HttpMethod as a5, IndexBuilder as a6, type IndexDef as a7, type InsertManyOptions as a8, type InsertShape as a9, type PalbaseAttestiOSResult as aA, type PalbaseAuthAdminClient as aB, type PalbaseAuthClient as aC, type PalbaseBatchOverrideOperation as aD, type PalbaseBatchSetOverridesResult as aE, type PalbaseBindDeviceParams as aF, type PalbaseBucketClient as aG, type PalbaseClearAllOverridesResult as aH, type PalbaseClearOverrideResult as aI, type PalbaseCohortQueryInput as aJ, type PalbaseCohortResult as aK, type PalbaseCollectionRef as aL, type PalbaseCountQueryInput as aM, type PalbaseCountResult as aN, type PalbaseCreateLinkParams as aO, type PalbaseDeviceInfo as aP, type PalbaseDeviceTokenView as aQ, type PalbaseDocsClient as aR, type PalbaseDocumentRef as aS, type PalbaseDocumentSnapshot as aT, type PalbaseEmailClient as aU, type PalbaseEmailSendParams as aV, type PalbaseEmailSendResponse as aW, type PalbaseEventNamesResult as aX, type PalbaseEventsQueryInput as aY, type PalbaseEventsResult as aZ, type PalbaseExtension as a_, type InsertValues as aa, type LifecycleHook as ab, Log as ac, type Logger as ad, type Materialized as ae, type Middleware as af, type MiddlewareContext as ag, type MiddlewareHandler as ah, type MutateInput as ai, NotFound as aj, Notifications as ak, type OnDeleteAction as al, type OrderBySpec as am, PALBASE_EXTENSIONS as an, type PBRequest as ao, type PageInfo as ap, type PageInput as aq, type PageNavigation as ar, PalError as as, type PalbaseAnalyticsClient as at, type PalbaseAnalyticsManagementNamespace as au, type PalbaseAnalyticsProperties as av, type PalbaseAnalyticsQueryNamespace as aw, type PalbaseAttestAndroidParams as ax, type PalbaseAttestAndroidResult as ay, type PalbaseAttestiOSParams as az, type RuntimeServices as b, PolicyExprRef as b$, type PalbaseFlag as b0, type PalbaseFlagContext as b1, type PalbaseFlagSource as b2, type PalbaseFlagValue as b3, type PalbaseFlagVariant as b4, type PalbaseFlagsClient as b5, type PalbaseFlagsServiceClient as b6, type PalbaseFunctionsClient as b7, type PalbaseFunnelQueryInput as b8, type PalbaseFunnelResult as b9, type PalbaseQuerySnapshot as bA, type PalbaseRealtimeClient as bB, type PalbaseRegisterDeviceParams as bC, type PalbaseRetentionQueryInput as bD, type PalbaseRetentionResult as bE, type PalbaseSession as bF, type PalbaseSetOverrideResult as bG, type PalbaseSetOverridesResult as bH, type PalbaseSignedUrlResponse as bI, type PalbaseSmsClient as bJ, type PalbaseSmsSendParams as bK, type PalbaseSmsSendResponse as bL, type PalbaseStorageClient as bM, type PalbaseTransformOptions as bN, type PalbaseUpdateLinkParams as bO, type PalbaseUploadOptions as bP, type PalbaseUser as bQ, type PalbaseUserDetailResult as bR, type PalbaseUsersQueryInput as bS, type PalbaseUsersResult as bT, type PalbaseVerifyRequestSignatureParams as bU, type PalbaseWhereOperator as bV, type PolicyBinOp as bW, PolicyBuilder as bX, type PolicyCommand as bY, type PolicyDef as bZ, type PolicyExprCtx as b_, type PalbaseIdentifyTraits as ba, type PalbaseInboxClient as bb, type PalbaseInboxListOptions as bc, type PalbaseInboxListResult as bd, type PalbaseInboxMessage as be, type PalbaseInboxSendParams as bf, type PalbaseInboxSendResponse as bg, type PalbaseInitialLink as bh, type PalbaseInvokeOptions as bi, type PalbaseLink as bj, type PalbaseLinkAnalytics as bk, type PalbaseLinkDetails as bl, type PalbaseLinksClient as bm, type PalbaseListLinksOptions as bn, type PalbaseListLinksResult as bo, type PalbaseListOptions as bp, type PalbaseMatchParams as bq, type PalbaseMultiChannelResponse as br, type PalbaseNotificationsClient as bs, type PalbaseOverviewResult as bt, type PalbasePreferences as bu, type PalbasePreferencesClient as bv, type PalbasePushClient as bw, type PalbasePushSendParams as bx, type PalbasePushSendResponse as by, type PalbaseQrCodeOptions as bz, type DatabaseDiagnosticsOptions as c, can as c$, type PolicyMode as c0, type PolicyOperand as c1, type QueryColumnContract as c2, type QueryDatabase as c3, type QueryInput as c4, type RawConstraintDef as c5, Realtime as c6, type Ref as c7, type RequestStore as c8, type RowShape as c9, type TxSetShape as cA, type TxSetValue as cB, type TxTable as cC, type TxTables as cD, type TxWhere as cE, type TxWireExpr as cF, type TxWireGuard as cG, type TxWireOp as cH, type TxWireRef as cI, type TxWireValue as cJ, type TypedDB as cK, type TypedTable as cL, type TypedTx as cM, Unauthorized as cN, UniqueViolation as cO, type UniqueWhere as cP, type User as cQ, type VerifiedDevice as cR, type WhereFilter as cS, type WhereOp as cT, type WorkloadOptions as cU, __getRuntime as cV, __resetLifecycleHooks as cW, __runStartHooks as cX, __setRuntime as cY, bigint as cZ, boolean as c_, Secrets as ca, type SecretsService as cb, SerializationFailure as cc, type SetShape as cd, type SetValue as ce, type ShutdownRunner as cf, type SqlFragment as cg, Storage as ch, TABLE_META as ci, type TableDef as cj, type TableHandle as ck, type TableInput as cl, TooManyRequests as cm, type TxColumnExpr as cn, type TxInsertShape as co, type TxInsertValue as cp, type TxNow as cq, type TxPlan as cr, TxPlanError as cs, type TxPlanHandle as ct, type TxPlanOpResult as cu, type TxPlanRejection as cv, TxRefError as cw, type TxRow as cx, type TxRows as cy, type TxSelectOptions as cz, type DatabaseDiagnostics as d, col as d0, dec as d1, decrement as d2, defineMiddleware as d3, defineSchema as d4, defineTable as d5, defineWorkload as d6, enumType as d7, exprCtx as d8, inc as d9, increment as da, index as db, installationRef as dc, integer as dd, isPalbaseExtension as de, isRetryable as df, jsonb as dg, makeTypedDB as dh, now as di, numeric as dj, onShutdown as dk, onStart as dl, openai as dm, ownedByUser as dn, policy as dp, raw as dq, sqlFragment as dr, text as ds, timestamp as dt, userRef as du, uuid as dv, vector as dw, withRetry as dx, type ColValue as dy, type DBOps as e, type RawPageOptions as f, type Page as g, type TxPlanBody as h, type CommandOptions as i, type TxPlanResponse as j, type CacheClient as k, __requestALS as l, type PalbaseResult as m, type PolicyExpr as n, type AggregateInput as o, type AggregateResult as p, type AnyColumn as q, type AtomicDatabase as r, type AtomicOptions as s, Auth as t, type AuthConfig as u, Cache as v, type ClientInfo as w, type ColRef as x, ColumnBuilder as y, type ColumnDef as z };