@palbase/backend 39.1.4 → 39.1.5

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/MIGRATION.md ADDED
@@ -0,0 +1,363 @@
1
+ # 33.0.0 — `Flags.$asService()` TİPTE de var (yayınlanmış bir kusurun düzeltmesi)
2
+
3
+ 32.0.0'da `Flags.$asService()` YAZILDI ama TÜKETİCİYE ULAŞMIYORDU: ambient
4
+ singleton ham istemcinin tipiyle (`PalbaseFlagsClient`) anote edilmişti ve o
5
+ annotation, `Object.assign`'ın kattığı `$asService`'i public tipten SİLİYORDU.
6
+
7
+ TS2551: Property '$asService' does not exist on type 'PalbaseFlagsClient'.
8
+ Did you mean 'asService'?
9
+
10
+ Derlenen tek yol (`asService()`) ise tasarım gereği FIRLATIYOR — yani
11
+ kullanıcılar arası flag yazma 32.0.0'da tamamen kapalıydı. Singleton artık
12
+ kendi tipini taşıyor (`PalbaseFlagsAmbient`), tıpkı `Database`'in
13
+ `EnvTypedDatabase` taşıması gibi. Kod değişikliği gerekmiyor; 33.0.0'a yükselin.
14
+
15
+ # 32.0.0 — kolon codec'leri ve `$` sözünün tutulması: göç notu
16
+
17
+ ## 1. `.transform<T>()` artık REDDEDİLİYOR — `.asNumber()` / `.asDecimal()` kullanın
18
+
19
+ ```ts
20
+ // ÖNCE — derleniyordu, ama üretilen tip YALAN SÖYLÜYORDU
21
+ amount: numeric().transform<number>({ fromDb: Number, toDb: String })
22
+
23
+ // SONRA
24
+ amount: numeric().asNumber()
25
+ ```
26
+
27
+ **Neden kaldırıldı:** `transform`'un hedef tipi (`<number>`) bir TİP
28
+ PARAMETRESİDİR ve çalışma zamanında YOKTUR. `palbase-env.d.ts`'i üreten adım
29
+ şemanın çalışma zamanı nesnesini okuyor, yani o tipi hiç öğrenemiyordu:
30
+ `bigint`/`numeric` koşulsuz `string` basılıyor, motor ise `fromDb`'yi uygulayıp
31
+ `number` döndürüyordu. Tip, çalışma zamanının yaptığının TERSİNİ söylüyordu — ve
32
+ sessizce. Bu, yanlış bir tipten daha kötüdür, çünkü görünmez.
33
+
34
+ Codec TİPLENMEK yerine ADLANDIRILIR: ad `_def`'e düşer, çalışma zamanı
35
+ nesnesiyle üretece ulaşır, ve hem dönüşüm hem yayılan TypeScript tipi ondan
36
+ türer. Tek bildirim, tek gerçek.
37
+
38
+ | Bildirilen | Üretilen tip | Çalışma zamanı |
39
+ |---|---|---|
40
+ | `numeric()` / `bigint()` | `string` | dokunulmaz |
41
+ | `.asNumber()` | `number` | `Number(v)` ↔ `String(v)` |
42
+ | `.asDecimal()` | `string` | `String(v)` (açıkça BİLDİRİLMİŞ) |
43
+
44
+ Yalnız `bigint()` ve `numeric()` üzerinde; başka bir kolon tipinde çağrılırsa
45
+ adıyla reddedilir. `.asNumber()` 2^53'ün üstünde hassasiyet kaybeder — o aralık
46
+ için `.asDecimal()`.
47
+
48
+ `palbase build` codec'siz bir `.transform<T>()` görürse tabloyu ve kolonu
49
+ adlandırarak reddeder; sessizce `string` basmaz.
50
+
51
+ ## 2. `Flags.asService()` → `Flags.$asService()`
52
+
53
+ ```ts
54
+ // ÖNCE
55
+ await Flags.asService().setOverrideForUser("u_9", "checkout", true);
56
+ // SONRA
57
+ await Flags.$asService().setOverrideForUser("u_9", "checkout", true);
58
+ ```
59
+
60
+ Sistem üyeleri `$` önekli (27.0.0 §3) ve `Database` bunu zaten yapıyordu;
61
+ `Flags`'in JSDoc'u "exactly like `Database.$asService()`" diye söz veriyordu ama
62
+ söz tutulmamıştı. Eski ad SESSİZCE çalışmaz: çağrılınca yeni adı söyleyerek
63
+ fırlatır.
64
+
65
+ Ham `PalbaseFlagsClient.asService()` DEĞİŞMEDİ — o bir iç seam ve singleton ona
66
+ forward eder.
67
+
68
+ ## 3. `fakeDatabase().db` artık TİPLİ yüzey — ham istemci `raw`'da
69
+
70
+ ```ts
71
+ // ÖNCE — db, çıplak DBClient'tı
72
+ const { db } = fakeDatabase();
73
+ await db.insert("todos", { id, title });
74
+
75
+ // SONRA — db, yazarın gerçekte kullandığı yüzey
76
+ const { db, raw } = fakeDatabase();
77
+ await db.$insert("todos", { id, title }); // ham op'lar `$` önekli
78
+ await db.public.todos.findMany({ where: … }); // tipli şema yüzeyi
79
+ ```
80
+
81
+ `db` artık üretimdeki `Database`'i kuran AYNI fonksiyonla kuruluyor, yani
82
+ sahtenin yüzeyi gerçeğinden ayrışamaz. Doğrudan `db.insert(...)` yazan çağrılar
83
+ `db.$insert(...)` olur.
84
+
85
+ **DAVRANIŞ da değişti:** eşleşmeyen bir `update` artık **`null`** döndürüyor —
86
+ motorun her zaman döndürdüğü şey. Sahte eskiden uydurma bir satır
87
+ (`{ id, ...applied }`) veriyor ve onu `updated()`'a da yazıyordu. Dönüşünü
88
+ kullanan bir tüketici testi artık `null` üzerinde `TypeError` alır; bildirilen
89
+ tip zaten `| null` olduğu için derleyici uyarmaz, o yüzden burada yazıyor.
90
+
91
+ Aynı sınıftan ikinci bir düzeltme: `updateMany(…, { returning: false })` artık
92
+ **sayı** döndürüyor (motor gibi), dizi değil. `const n = await updateMany(…,
93
+ { returning: false }); if (n === 0) throw` guard'ı sahtede HİÇ çalışmıyordu.
94
+ Ve `updateMany` yazdığını artık `updated()`'a kaydediyor.
95
+
96
+ **Ambient runtime'a `raw` verilir, `db` DEĞİL:**
97
+
98
+ ```ts
99
+ withServices({ Database: fake.raw }, () => …)
100
+ ```
101
+
102
+ `RuntimeServices.Database` ham istemcidir — ambient `Database` singleton'ı onu
103
+ SARAN şeydir. `db` verilirse yüzey iki kez sarılır ve her `$op` ıskalar.
104
+
105
+ ## 4. Değişken tablo adıyla `tx.public[t]` derlenmiyor (değişiklik değil, BELGE)
106
+
107
+ Bu bir 31.0.0 kırıcısı değil; hiç çalışmamış bir yüzeyin artık YAZILI olması.
108
+
109
+ ```
110
+ error TS2590: Expression produces a union type that is too complex to represent.
111
+ ```
112
+
113
+ **Ölçüldü:** yedi tabloya kadar temiz, **sekiz tabloda düşüyor** (12, 20, 26, 40
114
+ tabloda da). Sınırı belirleyen tablo sayısı ile tabloların birbirinden FARKLI
115
+ relation ad kümesi taşıması; **kolon sayısı ETKİLEMİYOR** (8 tablo × 2 kolon
116
+ düşüyor, 4 tablo × 200 kolon temiz), yani "kolonlarını azalt" bir çare değildir.
117
+
118
+ Sebep TypeScript'in kendi karmaşıklık tavanı: değişken bir anahtar, derleyiciyi
119
+ her tablonun `where` parametresini kesiştirmeye zorluyor.
120
+
121
+ **Çare:** tablo adını literal yazın —
122
+
123
+ ```ts
124
+ await Database.$transaction((tx) => [tx.public.payments.deleteWhere({ id })]);
125
+ ```
126
+
127
+ — ya da ad gerçekten çalışma zamanında belirleniyorsa ham op'ları kullanın
128
+ (`Database.$query`, `Database.$deleteMany`). Aynı sınırı Kysely v0.28'de
129
+ kaldırdı, Drizzle'da hiç olmadı.
130
+
131
+ # 25.1.0 → 27.x — modül + DI: GERİYE DÖNÜK göç notu
132
+
133
+ **26.0.0 npm'e HİÇ YAYINLANMADI.** Registry 25.1.0'dan sonra doğrudan 27.0.0'ı
134
+ gösterir. 26.0.0 git'te kesildi ama yayınlanmadığı için İÇERİĞİ 27.0.0 ile
135
+ birlikte indi — yani 25.1.0'dan yükselen bir proje TEK yükseltmede İKİ major'ın
136
+ kırıcılarını aldı, ve bunlardan biri hiç belgelenmemişti. Bu bölüm o eksiği
137
+ kapatıyor. Aşağıdakiler 27.0.0'ın veri erişim değişikliklerine EK'tir.
138
+
139
+ ## A. `controllers/` + `services/` → `modules/<alan>/`
140
+
141
+ Keşif artık dizin adından değil MODÜL bildiriminden. Her alan kendi klasöründe
142
+ bir `*.module.ts` taşır:
143
+
144
+ ```ts
145
+ @Module({
146
+ controllers: [NotesController as Token],
147
+ providers: [NoteService as Token, DbNoteRepo as Token],
148
+ exports: [], // bu modülün DIŞARIYA açtığı sınıflar
149
+ imports: [], // bu modülün ERİŞEBİLECEĞİ modüller
150
+ })
151
+ export class NotesModule {}
152
+ ```
153
+
154
+ Dört liste dört ayrı soruyu cevaplar: neyi SAHİPLENİYOR (`providers`), hangi
155
+ giriş noktalarını (`controllers`), kendi sınıflarından hangisine BAŞKASI
156
+ erişebilir (`exports`), kimin export'una BU erişebilir (`imports`).
157
+
158
+ **Hiçbir yerde listelenmemiş bir sınıf YOKTUR:** build onu adıyla reddeder ve
159
+ sınıf rota tablosuna, dispatcher'a ya da OpenAPI belgesine hiç ulaşmaz.
160
+
161
+ Kök modül YOKTUR ve mount edilecek bir yer de yoktur — sağlık probu bile
162
+ `modules/health/`, diğerleri gibi bir alan. Kuralın istisnası olmaması, "alan
163
+ eklemek" ile "klasör eklemek"i aynı şey yapan şeydir.
164
+
165
+ Bağımlılıklar KURUCUDAN gelir (`emitDecoratorMetadata` şart). Testte ikame
166
+ `isolated().with(Token, sahte)` ile yapılır.
167
+
168
+ > `tsconfig.json`'ın `include`'unu da kontrol edin: `controllers/`,
169
+ > `services/`, `models/` diye SAYAN bir liste `modules/` düzeninde HİÇBİR ŞEYLE
170
+ > eşleşmez, `tsc --noEmit` sıfır dosya derler ve **0 ile çıkar** — sessiz bir
171
+ > yeşil. Şablon artık tek bir `"**/*.ts"` kullanıyor.
172
+
173
+ ## B. `@Job` ve `@Webhook` artık `name` İSTİYOR — ve varsayılanı YOK
174
+
175
+ ```ts
176
+ @Job({ name: "nightly-rollup", schedule: "0 3 * * *" })
177
+ @Webhook({ name: "stripe-payments", secret: { env: "STRIPE_WEBHOOK_SECRET" } })
178
+ ```
179
+
180
+ > ⚠️ **DOSYASINI YENİDEN ADLANDIRAN BİR PROJE, CANLI WEBHOOK URL'İNİ SESSİZCE
181
+ > KAYBEDİYORDU.** Kimlik dosyanın YERİNDEN geldiği sürece
182
+ > `stripe.webhook.ts` → `payments.webhook.ts` yeniden adlandırması,
183
+ > gönderenin yapılandırdığı `/webhooks/stripe`'ı çözülemez hâle getiriyordu ve
184
+ > hiçbir şey bunu söylemiyordu. Aynı şey job'lar için de geçerliydi: dosya adı
185
+ > değişince scheduler BAŞKA bir job başlatıyordu.
186
+
187
+ Bu yüzden `name` zorunlu ve VARSAYILANSIZ: bir varsayılan, kimlik için İKİNCİ
188
+ bir kaynak olurdu. Eksik ya da boş `name` açılışta adıyla fırlatır. Şekil:
189
+ küçük harf, rakam ve tire (bir URL'e ve bir log satırına ulaşıyor).
190
+
191
+ **Yükselirken:** her `@Job`/`@Webhook`'a bugünkü DOSYA ADINDAN türeyen adı
192
+ yazın — böylece scheduler satırı ve webhook URL'i DEĞİŞMEZ. Adı sonradan
193
+ değiştirmek isterseniz bu, göndereni yeniden yapılandırmayı gerektiren ayrı bir
194
+ karardır.
195
+
196
+ # 27.0.0 — veri erişim yüzeyi: göç notu
197
+
198
+ Bu sürüm **yedi kırıcı değişiklik** taşıyor. Hepsi aynı sebepten: aynı iş için iki
199
+ uyumsuz kapı vardı (`Database.tables.x.findMany()` ve `Database.query()`),
200
+ aralarında geçiş yoktu, ve yetmediğinde geliştirici her şeyi bırakıp ham SQL'e
201
+ geçiyordu — orada tipi de RLS yardımını da kaybederek.
202
+
203
+ **Codemod yok, ve bu bilinçli.** Yedisi de DERLEME hatası veriyor: kırılma
204
+ sessiz değil, `tsc` size tam olarak nerede olduğunu söylüyor. Bir codemod'un
205
+ sessizce yanlış dönüştürdüğü bir çağrı, elle düzeltilen bir hatadan pahalıdır.
206
+
207
+ `deploy/fixture` bu notun uygulanabilir olduğunun kanıtı: 41 derleme hatasıyla
208
+ başladı, sıfırla bitti, ve tek satır susturma (`as never`) kalmadı.
209
+
210
+ ---
211
+
212
+ ## 1. `Database.tables.x` → `Database.public.x`
213
+
214
+ ```diff
215
+ - await Database.tables.todos.findMany(...)
216
+ + await Database.public.todos.findMany(...)
217
+ ```
218
+
219
+ `tables` ara katmanı kalktı. Şema adı artık YOLUN kendisi.
220
+
221
+ ## 2. `Database.schema("billing").tables.x` → `Database.billing.x`
222
+
223
+ ```diff
224
+ - await Database.schema("billing").tables.invoices.findMany(...)
225
+ + await Database.billing.invoices.findMany(...)
226
+ ```
227
+
228
+ Bildirilmemiş bir şema adı artık derleme hatası — eskiden çalışma zamanında
229
+ bulunuyordu.
230
+
231
+ ## 3. Sistem üyeleri `$` önekli
232
+
233
+ ```diff
234
+ - await Database.query("select 1")
235
+ - await Database.transaction(tx => ...)
236
+ - Database.asService()
237
+ + await Database.$query("select 1")
238
+ + await Database.$transaction(tx => ...)
239
+ + Database.$asService()
240
+ ```
241
+
242
+ **Neden:** `transactions` adlı bir tablo fintech'te neredeyse kaçınılmaz ve
243
+ `transaction` bir sistem üyesiydi. `$` öneki çakışmayı MATEMATİKSEL olarak
244
+ imkânsız kılıyor: şema doğrulayıcısı bir tablo adının `$` ile başlamasına izin
245
+ vermiyor.
246
+
247
+ Etkilenen üyeler: `$query`, `$transaction`, `$asService`, `$insert`, `$put`,
248
+ `$update`, `$delete`, `$findById`, `$findMany`, `$updateMany`, `$deleteMany`,
249
+ `$count`, `$search`, `$similar`, `$recommend`, `$facets`, `$supersede`,
250
+ `$attempt`, `$claim`, `$lockRows`, `$advisoryXactLock`.
251
+
252
+ ## 4. `$query` generic'siz `unknown[]` döndürür
253
+
254
+ ```diff
255
+ - const rows = await Database.$query("select count(*)::int as n from todos");
256
+ - rows[0].n // derleniyordu, doğrulanmıyordu
257
+ + const rows = await Database.$query<{ n: number }>("select count(*)::int as n from todos");
258
+ + rows[0].n // şekli SİZ söylediniz
259
+ ```
260
+
261
+ **Neden:** eski `Row[]` dönüşü BİLİNMEYENİ biliniyormuş gibi sunuyordu.
262
+ TypeScript bir SQL string'ini okuyamaz; `rows[0].n` derleniyordu ama `n` diye bir
263
+ alan olduğunu kimse doğrulamamıştı.
264
+
265
+ ## 5. `findMany(where, opts)` → `findMany({ where, ...opts })`
266
+
267
+ ```diff
268
+ - await Database.public.todos.findMany({ done: false }, { limit: 10 })
269
+ + await Database.public.todos.findMany({ where: { done: false }, limit: 10 })
270
+ ```
271
+
272
+ **Neden:** iki argümanlı biçimde `findMany({ limit: 10 })` yazmak sessizce
273
+ "limit adlı kolonu 10'a eşit satırlar" demekti. Tek obje bu belirsizliği
274
+ kaldırıyor. Aynı değişiklik `updateMany`, `deleteMany`, `count` için de geçerli.
275
+
276
+ ## 6. `upsert(data, { onConflict })` → `put({ data, onConflict })` — ya da `claim()`
277
+
278
+ ```diff
279
+ - await Database.public.settings.upsert({ user_id, theme }, { onConflict: ["user_id"] })
280
+ + await Database.public.settings.put({ data: { user_id, theme }, onConflict: ["user_id"] })
281
+ ```
282
+
283
+ **Ve idempotency istiyorsanız `put` DEĞİL `claim`:**
284
+
285
+ ```ts
286
+ const { inserted, row } = await Database.public.payments.claim(
287
+ { idem_key: req.headers["idempotency-key"] },
288
+ { amount, user_id },
289
+ );
290
+ if (!inserted) return row; // aynı istek ikinci kez geldi
291
+ ```
292
+
293
+ **Neden:** `upsert` tek isim altında iki niyet taşıyordu ve ikincisi için
294
+ ÖLÇÜLMÜŞ biçimde yanlıştı — `ON CONFLICT DO UPDATE` ikinci çağrının verisiyle
295
+ birincininkini EZİYOR (canlıda ölçüldü: 10.00 → 999.00).
296
+
297
+ `tx.tables.x.upsert()` de `put()` oldu; aynı iş için transaction içinde ve
298
+ dışında iki farklı yazım kalmasın diye.
299
+
300
+ ## 7. `indexes: [{name, columns}]` → `indexes: (c) => [index(name).on(...)]`
301
+
302
+ ```diff
303
+ - indexes: [{ name: "orders_status_idx", columns: ["status"] }]
304
+ + indexes: (c) => [index("orders_status_idx").on(c.col("status"))]
305
+ ```
306
+
307
+ **Ve aynı biçim `policies` için de:**
308
+
309
+ ```diff
310
+ - policies: [policy("own").using("owner = auth.uid()")]
311
+ + policies: (p) => [policy("own").using(p.col("owner").eq(p.auth.uid()))]
312
+ ```
313
+
314
+ **Neden:** kolon adları artık DERLEMEDE doğrulanıyor. Bir RLS politikasında
315
+ yanlış kolon adı yetki hatasıdır ve eskiden ancak deploy sırasında
316
+ `CREATE POLICY` çalışırken görülüyordu.
317
+
318
+ Callback olmasının sebebi teknik: index ve politika tablo tanımının İÇİNDE
319
+ bildiriliyor, yani `orders.status` yazmak mümkün değil — `orders` bağlaması o
320
+ noktada henüz kurulmamış oluyor. Kolon bağlamı callback'ten geliyor.
321
+
322
+ Ham string kaçış kapağı KALDI: `policy("x").using("<sql>")` çalışmaya devam
323
+ ediyor, ama orada kolon doğrulaması yok ve hata deploy anında geliyor.
324
+
325
+ ---
326
+
327
+ ## Yeni yüzey — kırıcı olmayanlar
328
+
329
+ Bunlar için bir şey yapmanız gerekmiyor; kademeler ham SQL'e düşmeden yukarı
330
+ çıkmanız için var.
331
+
332
+ | Ne | Ne zaman |
333
+ |---|---|
334
+ | `col("x")` | kolon-kolon karşılaştırma: `{ total: { gt: col("amount_paid") } }` |
335
+ | `increment(n)` / `decrement(n)` | sayaç: tek statement, lost update yok |
336
+ | `sqlFragment` | tipli filtre yetmediğinde — `select`/`orderBy`/`limit`/RLS çalışmaya devam eder |
337
+ | `select: [...]` | projeksiyon: dönüş tipi `Pick<Row, K>`'ye daralır |
338
+ | `OR` / `AND` / `NOT` | boolean bileşim |
339
+ | `contains` / `startsWith` / `isNull` | metin ve null operatörleri |
340
+ | `claim(unique, extra)` | idempotency anahtarı |
341
+ | `$lockRows(table, ids)` | deterministik kilit sırası — deadlock önler |
342
+ | `$advisoryXactLock(key)` | satırı olmayan iş için ad kilidi |
343
+ | `$transaction(fn, { retry })` | serileştirme hatasında yeniden dener |
344
+ | `appendOnly: true` | tabloda `update`/`delete`/`put`/`supersede` üyeleri TİPTE YOK, motor onları adıyla reddediyor, veritabanında REVOKE + RESTRICTIVE policy + BEFORE UPDATE/DELETE trigger |
345
+ | `counter()` | kolonun `increment()` ile güncellendiğini bildirir; plan HOT çakışmasını uyarır |
346
+ | `existsIn(table, row => …)` | üyelik tabanlı kiracılık — korelasyonlu EXISTS |
347
+ | `numeric().transform<T>()` | para tipini bir kez şemada tanımlayın |
348
+
349
+ ## Otomatik olan şeyler
350
+
351
+ Bunları siz istemeden sistem yapıyor; plan çıktısı hepsini gerekçesiyle gösterir.
352
+
353
+ - **FK kolonlarına index** — Postgres foreign key'i otomatik indekslemez ve bedeli
354
+ her JOIN'de, her `ON DELETE CASCADE`'de ödenir. `references(..., { index: false })`
355
+ ile kapatılır.
356
+ - **Politika filtre kolonuna index** — kiracı bunu kendi bulamaz: yazdığı sorgu
357
+ `WHERE status='open'`, yavaşlığın sebebi hiç yazmadığı `tenant_id` predikatı.
358
+ - **`auth.uid()` → `(SELECT auth.uid())`** — satır başına değil statement başına
359
+ bir kez. Ölçüldü: politikada satır-başına çalışan bir fonksiyonla
360
+ 71.958 ms → 10 ms.
361
+ - **`TO <rol>`** — her politikada, roller boşsa `TO PUBLIC`.
362
+ - **`CREATE INDEX CONCURRENTLY`** — var olan tabloya index eklemek yazmaları
363
+ bloklamaz; migration transaction'ının dışında koşar.
package/README.md CHANGED
@@ -1,23 +1,69 @@
1
1
  # @palbase/backend
2
2
 
3
- The backend SDK for Palbase. Write file-based TypeScript endpoints, schema,
4
- workers, jobs, hooks, and webhooks that run in the Palbase managed runtime.
3
+ The backend SDK for Palbase. Write TypeScript class controllers, services, and
4
+ schema that run in the Palbase managed runtime as a typed HTTP API — a
5
+ `@Module` says what exists, who owns it, and what it may reach; a class no
6
+ module lists does not exist.
5
7
 
6
8
  ```ts
7
- import { defineEndpoint, z, Database } from "@palbase/backend";
8
-
9
- export default defineEndpoint({
10
- method: "POST",
11
- input: z.object({ title: z.string() }),
12
- output: z.object({ id: z.string() }),
13
- handler: async (req) => Database.insert("todos", { title: req.input.title }),
14
- });
9
+ // modules/notes/dto/create.ts the request/response schemas, as a value + a type.
10
+ import { z } from "@palbase/backend";
11
+ export const CreateNoteBody = z.object({ body: z.string().min(1) });
12
+ export type CreateNoteBody = z.infer<typeof CreateNoteBody>;
13
+ export const NoteSchema = z.object({ id: z.string(), body: z.string() });
14
+ export type NoteSchema = z.infer<typeof NoteSchema>;
15
+ ```
16
+
17
+ ```ts
18
+ // modules/notes/note.service.ts — @Injectable() classes. The real work.
19
+ import { Database, Injectable } from "@palbase/backend";
20
+ import { NoteSchema } from "./dto/create";
21
+
22
+ @Injectable()
23
+ export class NoteService {
24
+ create(userId: string, body: string): Promise<NoteSchema> {
25
+ return Database.public.notes.insert({ user_id: userId, body });
26
+ }
27
+ }
28
+ ```
29
+
30
+ ```ts
31
+ // modules/notes/notes.controller.ts — @Controller class, no `Database` import.
32
+ import { Body, Controller, Post, User } from "@palbase/backend";
33
+ import type { UserT } from "@palbase/backend";
34
+ import { CreateNoteBody, NoteSchema } from "./dto/create";
35
+ import { NoteService } from "./note.service";
36
+
37
+ @Controller("/notes")
38
+ export class NotesController {
39
+ constructor(private readonly notes: NoteService) {}
40
+
41
+ @Post("")
42
+ create(@Body(CreateNoteBody) body: CreateNoteBody, @User() user: UserT): Promise<NoteSchema> {
43
+ return this.notes.create(user.id, body.body);
44
+ }
45
+ }
46
+ ```
47
+
48
+ ```ts
49
+ // modules/notes/notes.module.ts — lists them. Nothing is wired by hand.
50
+ import { Module, type Token } from "@palbase/backend";
51
+ import { NotesController } from "./notes.controller";
52
+ import { NoteService } from "./note.service";
53
+
54
+ @Module({
55
+ controllers: [NotesController as Token],
56
+ providers: [NoteService as Token],
57
+ })
58
+ export class NotesModule {}
15
59
  ```
16
60
 
17
61
  ## Documentation
18
62
 
19
63
  Start with [`docs/README.md`](./docs/README.md). For AI coding tools, a single
20
64
  concatenated corpus is generated at [`docs/llms-full.txt`](./docs/llms-full.txt).
65
+ See [`MIGRATION.md`](./MIGRATION.md) for breaking-change notes between major
66
+ versions.
21
67
 
22
68
  ## License
23
69
 
@@ -1,4 +1,4 @@
1
- export { o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, E as EnvServiceDatabase, V as EnvTypedDatabase, af as InsertManyOptions, ag as InsertShape, al as Materialized, as as OnDeleteAction, au as PALBASE_EXTENSIONS, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, b5 as PalbaseExtension, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cd as PolicyMode, cg as RawConstraintDef, f as RawPageOptions, ci as Ref, ck as RowShape, S as SchemaDef, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cO as TxTable, cP as TxTables, cQ as TxWhere, cW as TypedDB, cX as TypedTable, cY as TypedTx, c$ as UniqueWhere, d9 as bigint, da as boolean, de as dec, dh as defineSchema, di as defineTable, dj as enumType, dp as inc, ds as installationRef, dt as integer, du as isPalbaseExtension, dw as jsonb, dx as makeTypedDB, dy as now, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector } from '../index-pK2At5Yc.cjs';
1
+ export { o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, E as EnvServiceDatabase, V as EnvTypedDatabase, af as InsertManyOptions, ag as InsertShape, al as Materialized, as as OnDeleteAction, au as PALBASE_EXTENSIONS, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, b5 as PalbaseExtension, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cd as PolicyMode, cg as RawConstraintDef, f as RawPageOptions, ci as Ref, ck as RowShape, S as SchemaDef, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cO as TxTable, cP as TxTables, cQ as TxWhere, cW as TypedDB, cX as TypedTable, cY as TypedTx, c$ as UniqueWhere, d9 as bigint, da as boolean, de as dec, dh as defineSchema, di as defineTable, dj as enumType, dp as inc, ds as installationRef, dt as integer, du as isPalbaseExtension, dw as jsonb, dx as makeTypedDB, dy as now, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector } from '../index-CCY1h_J2.cjs';
2
2
  import 'zod';
3
3
  import './env.cjs';
4
4
  import '../stack.cjs';
@@ -1,4 +1,4 @@
1
- export { o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, E as EnvServiceDatabase, V as EnvTypedDatabase, af as InsertManyOptions, ag as InsertShape, al as Materialized, as as OnDeleteAction, au as PALBASE_EXTENSIONS, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, b5 as PalbaseExtension, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cd as PolicyMode, cg as RawConstraintDef, f as RawPageOptions, ci as Ref, ck as RowShape, S as SchemaDef, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cO as TxTable, cP as TxTables, cQ as TxWhere, cW as TypedDB, cX as TypedTable, cY as TypedTx, c$ as UniqueWhere, d9 as bigint, da as boolean, de as dec, dh as defineSchema, di as defineTable, dj as enumType, dp as inc, ds as installationRef, dt as integer, du as isPalbaseExtension, dw as jsonb, dx as makeTypedDB, dy as now, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector } from '../index-eN4KzGa5.js';
1
+ export { o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, E as EnvServiceDatabase, V as EnvTypedDatabase, af as InsertManyOptions, ag as InsertShape, al as Materialized, as as OnDeleteAction, au as PALBASE_EXTENSIONS, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, b5 as PalbaseExtension, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cd as PolicyMode, cg as RawConstraintDef, f as RawPageOptions, ci as Ref, ck as RowShape, S as SchemaDef, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cO as TxTable, cP as TxTables, cQ as TxWhere, cW as TypedDB, cX as TypedTable, cY as TypedTx, c$ as UniqueWhere, d9 as bigint, da as boolean, de as dec, dh as defineSchema, di as defineTable, dj as enumType, dp as inc, ds as installationRef, dt as integer, du as isPalbaseExtension, dw as jsonb, dx as makeTypedDB, dy as now, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector } from '../index-fLaf0PN2.js';
2
2
  import 'zod';
3
3
  import './env.js';
4
4
  import '../stack.js';
@@ -1,8 +1,8 @@
1
- import '../index-pK2At5Yc.cjs';
2
- export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-Brhp8cxj.cjs';
1
+ import '../index-CCY1h_J2.cjs';
2
+ export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-Db5QHdTa.cjs';
3
3
  import 'zod';
4
4
  import '../db/env.cjs';
5
5
  import '../stack.cjs';
6
6
  import 'node:async_hooks';
7
7
  import '../module-Dl1KFVtc.cjs';
8
- import '../registry-9dNeVN5d.cjs';
8
+ import '../registry-CH6HRR6T.cjs';
@@ -1,8 +1,8 @@
1
- import '../index-eN4KzGa5.js';
2
- export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-Dlu2b9-f.js';
1
+ import '../index-fLaf0PN2.js';
2
+ export { A as App, g as AuthVerifier, B as BootRefused, h as COMMAND_EXECUTOR_DDL, j as CreateAppOptions, D as DECLARATION_REFUSAL, a as DeclarationRefused, E as EgressPolicy, k as EngineConfig, M as ModuleClients, R as RateLimiter, l as RequestDatabase, m as RouteEntry, n as RuntimeHooks, S as ScrubResult, o as SqlDriver, p as SqlTx, q as buildRouteTable, r as createApp, s as createLazyTransaction, t as createOps, u as createRequestDatabase, v as effectiveAuth, w as hostAllowed, x as installCommandExecutor, y as installEgressFence, i as isDeclarationRefused, z as loadConfig, F as makeMemoryCache, G as matchRoute, H as quoteIdent, I as scrubSecrets, J as setCursorKey, K as withQueryCancellation, L as withTables } from '../index-QWN1Ncrv.js';
3
3
  import 'zod';
4
4
  import '../db/env.js';
5
5
  import '../stack.js';
6
6
  import 'node:async_hooks';
7
7
  import '../module-Dl1KFVtc.js';
8
- import '../registry-B8ddZiMY.js';
8
+ import '../registry-C7tCRyPm.js';
@@ -2238,9 +2238,9 @@ interface PalbaseEmailSendParams {
2238
2238
  templateSlug?: string;
2239
2239
  /**
2240
2240
  * Which locale of `templateSlug` to render — a BCP47 short tag ("tr").
2241
- * Falls back to "en" when the slug has no row for it. Declaring a locale in
2242
- * config/notifications.ts is only half the feature: without this the extra
2243
- * rows exist and are unreachable.
2241
+ * Falls back to "en" when the slug has no row for it. Declaring a locale
2242
+ * with `palbase notifications templates set` is only half the feature:
2243
+ * without this the extra rows exist and are unreachable.
2244
2244
  */
2245
2245
  locale?: string;
2246
2246
  variables?: Record<string, unknown>;
@@ -1,6 +1,6 @@
1
- import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, f as RawPageOptions, P as Page, g as TxPlanBody, C as CommandOptions, h as TxPlanResponse, A as AuthSpec, i as CacheClient, b as RuntimeServices, _ as __runWithRuntime, j as __requestALS } from './index-pK2At5Yc.cjs';
1
+ import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, f as RawPageOptions, P as Page, g as TxPlanBody, C as CommandOptions, h as TxPlanResponse, A as AuthSpec, i as CacheClient, b as RuntimeServices, _ as __runWithRuntime, j as __requestALS } from './index-CCY1h_J2.cjs';
2
2
  import { T as Token } from './module-Dl1KFVtc.cjs';
3
- import { R as RouteMeta } from './registry-9dNeVN5d.cjs';
3
+ import { R as RouteMeta } from './registry-CH6HRR6T.cjs';
4
4
 
5
5
  interface AdmissionLease {
6
6
  queueMs: number;
@@ -1,6 +1,6 @@
1
- import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, f as RawPageOptions, P as Page, g as TxPlanBody, C as CommandOptions, h as TxPlanResponse, A as AuthSpec, i as CacheClient, b as RuntimeServices, _ as __runWithRuntime, j as __requestALS } from './index-eN4KzGa5.js';
1
+ import { c as DatabaseDiagnosticsOptions, d as DatabaseDiagnostics, a as DBClient, T as TransactionIsolation, e as DBOps, f as RawPageOptions, P as Page, g as TxPlanBody, C as CommandOptions, h as TxPlanResponse, A as AuthSpec, i as CacheClient, b as RuntimeServices, _ as __runWithRuntime, j as __requestALS } from './index-fLaf0PN2.js';
2
2
  import { T as Token } from './module-Dl1KFVtc.js';
3
- import { R as RouteMeta } from './registry-B8ddZiMY.js';
3
+ import { R as RouteMeta } from './registry-C7tCRyPm.js';
4
4
 
5
5
  interface AdmissionLease {
6
6
  queueMs: number;
@@ -2238,9 +2238,9 @@ interface PalbaseEmailSendParams {
2238
2238
  templateSlug?: string;
2239
2239
  /**
2240
2240
  * Which locale of `templateSlug` to render — a BCP47 short tag ("tr").
2241
- * Falls back to "en" when the slug has no row for it. Declaring a locale in
2242
- * config/notifications.ts is only half the feature: without this the extra
2243
- * rows exist and are unreachable.
2241
+ * Falls back to "en" when the slug has no row for it. Declaring a locale
2242
+ * with `palbase notifications templates set` is only half the feature:
2243
+ * without this the extra rows exist and are unreachable.
2244
2244
  */
2245
2245
  locale?: string;
2246
2246
  variables?: Record<string, unknown>;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { k as PalbaseResult, l as PolicyExpr, S as SchemaDef, A as AuthSpec, H as HttpError } from './index-pK2At5Yc.cjs';
2
- export { m as AggregateInput, n as AggregateResult, o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, r as Auth, s as AuthConfig, B as BackfillDef, t as BadRequest, u as Cache, i as CacheClient, v as CheckDef, w as ClientInfo, x as ColRef, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, I as Conflict, a as DBClient, e as DBOps, J as Database, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, L as DeadlockDetected, M as Documents, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, Q as EnvSchemas, E as EnvServiceDatabase, U as EnvTables, V as EnvTypedDatabase, W as EnvTypedTable, X as ErrorDef, Y as ErrorMap, Z as ErrorThrowers, $ as FileContext, a0 as FindManyOpts, a1 as FkAction, a2 as FkMatch, a3 as Flags, a4 as Forbidden, a5 as ForeignKeyBuilder, a6 as ForeignKeyDef, a7 as FreezeBuilder, a8 as FreezeDef, a9 as GuardBuilder, aa as GuardDef, ab as GuardEvent, ac as HttpMethod, ad as IndexBuilder, ae as IndexDef, af as InsertManyOptions, ag as InsertShape, ah as InsertValues, ai as LifecycleHook, aj as Log, ak as Logger, al as Materialized, am as Middleware, an as MiddlewareContext, ao as MiddlewareHandler, ap as MutateInput, aq as NotFound, ar as Notifications, as as OnDeleteAction, at as OrderBySpec, au as PALBASE_EXTENSIONS, av as PBRequest, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, az as PalError, aA as PalbaseAnalyticsClient, aB as PalbaseAnalyticsManagementNamespace, aC as PalbaseAnalyticsProperties, aD as PalbaseAnalyticsQueryNamespace, aE as PalbaseAttestAndroidParams, aF as PalbaseAttestAndroidResult, aG as PalbaseAttestiOSParams, aH as PalbaseAttestiOSResult, aI as PalbaseAuthAdminClient, aJ as PalbaseAuthClient, aK as PalbaseBatchOverrideOperation, aL as PalbaseBatchSetOverridesResult, aM as PalbaseBindDeviceParams, aN as PalbaseBucketClient, aO as PalbaseClearAllOverridesResult, aP as PalbaseClearOverrideResult, aQ as PalbaseCohortQueryInput, aR as PalbaseCohortResult, aS as PalbaseCollectionRef, aT as PalbaseCountQueryInput, aU as PalbaseCountResult, aV as PalbaseCreateLinkParams, aW as PalbaseDeviceInfo, aX as PalbaseDeviceTokenView, aY as PalbaseDocsClient, aZ as PalbaseDocumentRef, a_ as PalbaseDocumentSnapshot, a$ as PalbaseEmailClient, b0 as PalbaseEmailSendParams, b1 as PalbaseEmailSendResponse, b2 as PalbaseEventNamesResult, b3 as PalbaseEventsQueryInput, b4 as PalbaseEventsResult, b5 as PalbaseExtension, b6 as PalbaseFileObject, b7 as PalbaseFlag, b8 as PalbaseFlagContext, b9 as PalbaseFlagSource, ba as PalbaseFlagValue, bb as PalbaseFlagVariant, bc as PalbaseFlagsClient, bd as PalbaseFlagsServiceClient, be as PalbaseFunctionsClient, bf as PalbaseFunnelQueryInput, bg as PalbaseFunnelResult, bh as PalbaseIdentifyTraits, bi as PalbaseInboxClient, bj as PalbaseInboxListOptions, bk as PalbaseInboxListResult, bl as PalbaseInboxMessage, bm as PalbaseInboxSendParams, bn as PalbaseInboxSendResponse, bo as PalbaseInitialLink, bp as PalbaseInvokeOptions, bq as PalbaseLink, br as PalbaseLinkAnalytics, bs as PalbaseLinkDetails, bt as PalbaseLinksClient, bu as PalbaseListLinksOptions, bv as PalbaseListLinksResult, bw as PalbaseListOptions, bx as PalbaseMatchParams, by as PalbaseMultiChannelResponse, bz as PalbaseNotificationChannel, bA as PalbaseNotificationsClient, bB as PalbaseOverviewResult, bC as PalbasePreferences, bD as PalbasePreferencesClient, bE as PalbasePushClient, bF as PalbasePushSendParams, bG as PalbasePushSendResponse, bH as PalbaseQrCodeOptions, bI as PalbaseQuerySnapshot, bJ as PalbaseRealtimeClient, bK as PalbaseRegisterDeviceParams, bL as PalbaseRetentionQueryInput, bM as PalbaseRetentionResult, bN as PalbaseSession, bO as PalbaseSetOverrideResult, bP as PalbaseSetOverridesResult, bQ as PalbaseSignedUrlResponse, bR as PalbaseSmsClient, bS as PalbaseSmsSendParams, bT as PalbaseSmsSendResponse, bU as PalbaseStorageClient, bV as PalbaseTransformOptions, bW as PalbaseUpdateLinkParams, bX as PalbaseUploadOptions, bY as PalbaseUser, bZ as PalbaseUserDetailResult, b_ as PalbaseUsersQueryInput, b$ as PalbaseUsersResult, c0 as PalbaseVerifyRequestSignatureParams, c1 as PalbaseWhatsAppClient, c2 as PalbaseWhatsAppEvent, c3 as PalbaseWhatsAppSendParams, c4 as PalbaseWhatsAppSendResponse, c5 as PalbaseWhatsAppTemplate, c6 as PalbaseWhereOperator, c7 as PolicyBinOp, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cb as PolicyExprCtx, cc as PolicyExprRef, cd as PolicyMode, ce as PolicyOperand, cf as QueryInput, R as RateLimitConfig, cg as RawConstraintDef, f as RawPageOptions, ch as Realtime, ci as Ref, cj as RequestStore, ck as RowShape, b as RuntimeServices, cl as Secrets, cm as SecretsService, cn as SerializationFailure, co as SetShape, cp as SetValue, cq as ShutdownRunner, cr as SqlFragment, cs as Storage, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, cx as TableRef, cy as TooManyRequests, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cB as TxInsertValue, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cN as TxSetValue, cO as TxTable, cP as TxTables, cQ as TxWhere, cR as TxWireExpr, cS as TxWireGuard, cT as TxWireOp, cU as TxWireRef, cV as TxWireValue, cW as TypedDB, cX as TypedTable, cY as TypedTx, cZ as Unauthorized, c_ as UniqueViolation, c$ as UniqueWhere, d0 as UserT, d1 as VerifiedDevice, d2 as WhereFilter, d3 as WhereOp, d4 as __getRuntime, j as __requestALS, d5 as __resetLifecycleHooks, d6 as __runStartHooks, _ as __runWithRuntime, d7 as __setRuntime, d8 as backfill, d9 as bigint, da as boolean, db as can, dc as check, dd as col, de as dec, df as decrement, dg as defineMiddleware, dh as defineSchema, di as defineTable, dj as enumType, dk as exprCtx, dl as foreignKey, dm as freeze, dn as guard, dp as inc, dq as increment, dr as index, ds as installationRef, dt as integer, du as isPalbaseExtension, dv as isRetryable, dw as jsonb, dx as makeTypedDB, dy as now, dz as numeric, dA as onShutdown, dB as onStart, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dG as sqlFragment, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector, dM as withRetry } from './index-pK2At5Yc.cjs';
3
- import { M as ModuleClients, C as Container } from './index-Brhp8cxj.cjs';
4
- export { D as DECLARATION_REFUSAL, a as DeclarationRefused, b as DiError, c as DiKind, d as ModulePressure, e as assertNoOrphanEntryPoints, f as buildContainer, i as isDeclarationRefused } from './index-Brhp8cxj.cjs';
1
+ import { k as PalbaseResult, l as PolicyExpr, S as SchemaDef, A as AuthSpec, H as HttpError } from './index-CCY1h_J2.cjs';
2
+ export { m as AggregateInput, n as AggregateResult, o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, r as Auth, s as AuthConfig, B as BackfillDef, t as BadRequest, u as Cache, i as CacheClient, v as CheckDef, w as ClientInfo, x as ColRef, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, I as Conflict, a as DBClient, e as DBOps, J as Database, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, L as DeadlockDetected, M as Documents, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, Q as EnvSchemas, E as EnvServiceDatabase, U as EnvTables, V as EnvTypedDatabase, W as EnvTypedTable, X as ErrorDef, Y as ErrorMap, Z as ErrorThrowers, $ as FileContext, a0 as FindManyOpts, a1 as FkAction, a2 as FkMatch, a3 as Flags, a4 as Forbidden, a5 as ForeignKeyBuilder, a6 as ForeignKeyDef, a7 as FreezeBuilder, a8 as FreezeDef, a9 as GuardBuilder, aa as GuardDef, ab as GuardEvent, ac as HttpMethod, ad as IndexBuilder, ae as IndexDef, af as InsertManyOptions, ag as InsertShape, ah as InsertValues, ai as LifecycleHook, aj as Log, ak as Logger, al as Materialized, am as Middleware, an as MiddlewareContext, ao as MiddlewareHandler, ap as MutateInput, aq as NotFound, ar as Notifications, as as OnDeleteAction, at as OrderBySpec, au as PALBASE_EXTENSIONS, av as PBRequest, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, az as PalError, aA as PalbaseAnalyticsClient, aB as PalbaseAnalyticsManagementNamespace, aC as PalbaseAnalyticsProperties, aD as PalbaseAnalyticsQueryNamespace, aE as PalbaseAttestAndroidParams, aF as PalbaseAttestAndroidResult, aG as PalbaseAttestiOSParams, aH as PalbaseAttestiOSResult, aI as PalbaseAuthAdminClient, aJ as PalbaseAuthClient, aK as PalbaseBatchOverrideOperation, aL as PalbaseBatchSetOverridesResult, aM as PalbaseBindDeviceParams, aN as PalbaseBucketClient, aO as PalbaseClearAllOverridesResult, aP as PalbaseClearOverrideResult, aQ as PalbaseCohortQueryInput, aR as PalbaseCohortResult, aS as PalbaseCollectionRef, aT as PalbaseCountQueryInput, aU as PalbaseCountResult, aV as PalbaseCreateLinkParams, aW as PalbaseDeviceInfo, aX as PalbaseDeviceTokenView, aY as PalbaseDocsClient, aZ as PalbaseDocumentRef, a_ as PalbaseDocumentSnapshot, a$ as PalbaseEmailClient, b0 as PalbaseEmailSendParams, b1 as PalbaseEmailSendResponse, b2 as PalbaseEventNamesResult, b3 as PalbaseEventsQueryInput, b4 as PalbaseEventsResult, b5 as PalbaseExtension, b6 as PalbaseFileObject, b7 as PalbaseFlag, b8 as PalbaseFlagContext, b9 as PalbaseFlagSource, ba as PalbaseFlagValue, bb as PalbaseFlagVariant, bc as PalbaseFlagsClient, bd as PalbaseFlagsServiceClient, be as PalbaseFunctionsClient, bf as PalbaseFunnelQueryInput, bg as PalbaseFunnelResult, bh as PalbaseIdentifyTraits, bi as PalbaseInboxClient, bj as PalbaseInboxListOptions, bk as PalbaseInboxListResult, bl as PalbaseInboxMessage, bm as PalbaseInboxSendParams, bn as PalbaseInboxSendResponse, bo as PalbaseInitialLink, bp as PalbaseInvokeOptions, bq as PalbaseLink, br as PalbaseLinkAnalytics, bs as PalbaseLinkDetails, bt as PalbaseLinksClient, bu as PalbaseListLinksOptions, bv as PalbaseListLinksResult, bw as PalbaseListOptions, bx as PalbaseMatchParams, by as PalbaseMultiChannelResponse, bz as PalbaseNotificationChannel, bA as PalbaseNotificationsClient, bB as PalbaseOverviewResult, bC as PalbasePreferences, bD as PalbasePreferencesClient, bE as PalbasePushClient, bF as PalbasePushSendParams, bG as PalbasePushSendResponse, bH as PalbaseQrCodeOptions, bI as PalbaseQuerySnapshot, bJ as PalbaseRealtimeClient, bK as PalbaseRegisterDeviceParams, bL as PalbaseRetentionQueryInput, bM as PalbaseRetentionResult, bN as PalbaseSession, bO as PalbaseSetOverrideResult, bP as PalbaseSetOverridesResult, bQ as PalbaseSignedUrlResponse, bR as PalbaseSmsClient, bS as PalbaseSmsSendParams, bT as PalbaseSmsSendResponse, bU as PalbaseStorageClient, bV as PalbaseTransformOptions, bW as PalbaseUpdateLinkParams, bX as PalbaseUploadOptions, bY as PalbaseUser, bZ as PalbaseUserDetailResult, b_ as PalbaseUsersQueryInput, b$ as PalbaseUsersResult, c0 as PalbaseVerifyRequestSignatureParams, c1 as PalbaseWhatsAppClient, c2 as PalbaseWhatsAppEvent, c3 as PalbaseWhatsAppSendParams, c4 as PalbaseWhatsAppSendResponse, c5 as PalbaseWhatsAppTemplate, c6 as PalbaseWhereOperator, c7 as PolicyBinOp, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cb as PolicyExprCtx, cc as PolicyExprRef, cd as PolicyMode, ce as PolicyOperand, cf as QueryInput, R as RateLimitConfig, cg as RawConstraintDef, f as RawPageOptions, ch as Realtime, ci as Ref, cj as RequestStore, ck as RowShape, b as RuntimeServices, cl as Secrets, cm as SecretsService, cn as SerializationFailure, co as SetShape, cp as SetValue, cq as ShutdownRunner, cr as SqlFragment, cs as Storage, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, cx as TableRef, cy as TooManyRequests, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cB as TxInsertValue, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cN as TxSetValue, cO as TxTable, cP as TxTables, cQ as TxWhere, cR as TxWireExpr, cS as TxWireGuard, cT as TxWireOp, cU as TxWireRef, cV as TxWireValue, cW as TypedDB, cX as TypedTable, cY as TypedTx, cZ as Unauthorized, c_ as UniqueViolation, c$ as UniqueWhere, d0 as UserT, d1 as VerifiedDevice, d2 as WhereFilter, d3 as WhereOp, d4 as __getRuntime, j as __requestALS, d5 as __resetLifecycleHooks, d6 as __runStartHooks, _ as __runWithRuntime, d7 as __setRuntime, d8 as backfill, d9 as bigint, da as boolean, db as can, dc as check, dd as col, de as dec, df as decrement, dg as defineMiddleware, dh as defineSchema, di as defineTable, dj as enumType, dk as exprCtx, dl as foreignKey, dm as freeze, dn as guard, dp as inc, dq as increment, dr as index, ds as installationRef, dt as integer, du as isPalbaseExtension, dv as isRetryable, dw as jsonb, dx as makeTypedDB, dy as now, dz as numeric, dA as onShutdown, dB as onStart, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dG as sqlFragment, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector, dM as withRetry } from './index-CCY1h_J2.cjs';
3
+ import { M as ModuleClients, C as Container } from './index-Db5QHdTa.cjs';
4
+ export { D as DECLARATION_REFUSAL, a as DeclarationRefused, b as DiError, c as DiKind, d as ModulePressure, e as assertNoOrphanEntryPoints, f as buildContainer, i as isDeclarationRefused } from './index-Db5QHdTa.cjs';
5
5
  export { TableTypes, Tables } from './db/env.cjs';
6
6
  export { PalbaseBucketName, PalbaseFlagKey, PalbaseSecretName } from './stack.cjs';
7
- import { a as RouteOptions } from './registry-9dNeVN5d.cjs';
8
- export { H as HttpMethodUpper, b as ParamKind, P as ParamMeta, R as RouteMeta, c as Signal, d as Sse, S as SseConfig, e as SseOut, f as SseWriter, T as ThrowDescriptor, g as Upload, U as UploadConfig, h as UploadedObject, i as getRoutes, r as recordThrows } from './registry-9dNeVN5d.cjs';
7
+ import { a as RouteOptions } from './registry-CH6HRR6T.cjs';
8
+ export { H as HttpMethodUpper, b as ParamKind, P as ParamMeta, R as RouteMeta, c as Signal, d as Sse, S as SseConfig, e as SseOut, f as SseWriter, T as ThrowDescriptor, g as Upload, U as UploadConfig, h as UploadedObject, i as getRoutes, r as recordThrows } from './registry-CH6HRR6T.cjs';
9
9
  import { ZodTypeAny, z } from 'zod';
10
10
  export { z } from 'zod';
11
11
  import { T as Token } from './module-Dl1KFVtc.cjs';
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { k as PalbaseResult, l as PolicyExpr, S as SchemaDef, A as AuthSpec, H as HttpError } from './index-eN4KzGa5.js';
2
- export { m as AggregateInput, n as AggregateResult, o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, r as Auth, s as AuthConfig, B as BackfillDef, t as BadRequest, u as Cache, i as CacheClient, v as CheckDef, w as ClientInfo, x as ColRef, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, I as Conflict, a as DBClient, e as DBOps, J as Database, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, L as DeadlockDetected, M as Documents, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, Q as EnvSchemas, E as EnvServiceDatabase, U as EnvTables, V as EnvTypedDatabase, W as EnvTypedTable, X as ErrorDef, Y as ErrorMap, Z as ErrorThrowers, $ as FileContext, a0 as FindManyOpts, a1 as FkAction, a2 as FkMatch, a3 as Flags, a4 as Forbidden, a5 as ForeignKeyBuilder, a6 as ForeignKeyDef, a7 as FreezeBuilder, a8 as FreezeDef, a9 as GuardBuilder, aa as GuardDef, ab as GuardEvent, ac as HttpMethod, ad as IndexBuilder, ae as IndexDef, af as InsertManyOptions, ag as InsertShape, ah as InsertValues, ai as LifecycleHook, aj as Log, ak as Logger, al as Materialized, am as Middleware, an as MiddlewareContext, ao as MiddlewareHandler, ap as MutateInput, aq as NotFound, ar as Notifications, as as OnDeleteAction, at as OrderBySpec, au as PALBASE_EXTENSIONS, av as PBRequest, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, az as PalError, aA as PalbaseAnalyticsClient, aB as PalbaseAnalyticsManagementNamespace, aC as PalbaseAnalyticsProperties, aD as PalbaseAnalyticsQueryNamespace, aE as PalbaseAttestAndroidParams, aF as PalbaseAttestAndroidResult, aG as PalbaseAttestiOSParams, aH as PalbaseAttestiOSResult, aI as PalbaseAuthAdminClient, aJ as PalbaseAuthClient, aK as PalbaseBatchOverrideOperation, aL as PalbaseBatchSetOverridesResult, aM as PalbaseBindDeviceParams, aN as PalbaseBucketClient, aO as PalbaseClearAllOverridesResult, aP as PalbaseClearOverrideResult, aQ as PalbaseCohortQueryInput, aR as PalbaseCohortResult, aS as PalbaseCollectionRef, aT as PalbaseCountQueryInput, aU as PalbaseCountResult, aV as PalbaseCreateLinkParams, aW as PalbaseDeviceInfo, aX as PalbaseDeviceTokenView, aY as PalbaseDocsClient, aZ as PalbaseDocumentRef, a_ as PalbaseDocumentSnapshot, a$ as PalbaseEmailClient, b0 as PalbaseEmailSendParams, b1 as PalbaseEmailSendResponse, b2 as PalbaseEventNamesResult, b3 as PalbaseEventsQueryInput, b4 as PalbaseEventsResult, b5 as PalbaseExtension, b6 as PalbaseFileObject, b7 as PalbaseFlag, b8 as PalbaseFlagContext, b9 as PalbaseFlagSource, ba as PalbaseFlagValue, bb as PalbaseFlagVariant, bc as PalbaseFlagsClient, bd as PalbaseFlagsServiceClient, be as PalbaseFunctionsClient, bf as PalbaseFunnelQueryInput, bg as PalbaseFunnelResult, bh as PalbaseIdentifyTraits, bi as PalbaseInboxClient, bj as PalbaseInboxListOptions, bk as PalbaseInboxListResult, bl as PalbaseInboxMessage, bm as PalbaseInboxSendParams, bn as PalbaseInboxSendResponse, bo as PalbaseInitialLink, bp as PalbaseInvokeOptions, bq as PalbaseLink, br as PalbaseLinkAnalytics, bs as PalbaseLinkDetails, bt as PalbaseLinksClient, bu as PalbaseListLinksOptions, bv as PalbaseListLinksResult, bw as PalbaseListOptions, bx as PalbaseMatchParams, by as PalbaseMultiChannelResponse, bz as PalbaseNotificationChannel, bA as PalbaseNotificationsClient, bB as PalbaseOverviewResult, bC as PalbasePreferences, bD as PalbasePreferencesClient, bE as PalbasePushClient, bF as PalbasePushSendParams, bG as PalbasePushSendResponse, bH as PalbaseQrCodeOptions, bI as PalbaseQuerySnapshot, bJ as PalbaseRealtimeClient, bK as PalbaseRegisterDeviceParams, bL as PalbaseRetentionQueryInput, bM as PalbaseRetentionResult, bN as PalbaseSession, bO as PalbaseSetOverrideResult, bP as PalbaseSetOverridesResult, bQ as PalbaseSignedUrlResponse, bR as PalbaseSmsClient, bS as PalbaseSmsSendParams, bT as PalbaseSmsSendResponse, bU as PalbaseStorageClient, bV as PalbaseTransformOptions, bW as PalbaseUpdateLinkParams, bX as PalbaseUploadOptions, bY as PalbaseUser, bZ as PalbaseUserDetailResult, b_ as PalbaseUsersQueryInput, b$ as PalbaseUsersResult, c0 as PalbaseVerifyRequestSignatureParams, c1 as PalbaseWhatsAppClient, c2 as PalbaseWhatsAppEvent, c3 as PalbaseWhatsAppSendParams, c4 as PalbaseWhatsAppSendResponse, c5 as PalbaseWhatsAppTemplate, c6 as PalbaseWhereOperator, c7 as PolicyBinOp, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cb as PolicyExprCtx, cc as PolicyExprRef, cd as PolicyMode, ce as PolicyOperand, cf as QueryInput, R as RateLimitConfig, cg as RawConstraintDef, f as RawPageOptions, ch as Realtime, ci as Ref, cj as RequestStore, ck as RowShape, b as RuntimeServices, cl as Secrets, cm as SecretsService, cn as SerializationFailure, co as SetShape, cp as SetValue, cq as ShutdownRunner, cr as SqlFragment, cs as Storage, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, cx as TableRef, cy as TooManyRequests, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cB as TxInsertValue, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cN as TxSetValue, cO as TxTable, cP as TxTables, cQ as TxWhere, cR as TxWireExpr, cS as TxWireGuard, cT as TxWireOp, cU as TxWireRef, cV as TxWireValue, cW as TypedDB, cX as TypedTable, cY as TypedTx, cZ as Unauthorized, c_ as UniqueViolation, c$ as UniqueWhere, d0 as UserT, d1 as VerifiedDevice, d2 as WhereFilter, d3 as WhereOp, d4 as __getRuntime, j as __requestALS, d5 as __resetLifecycleHooks, d6 as __runStartHooks, _ as __runWithRuntime, d7 as __setRuntime, d8 as backfill, d9 as bigint, da as boolean, db as can, dc as check, dd as col, de as dec, df as decrement, dg as defineMiddleware, dh as defineSchema, di as defineTable, dj as enumType, dk as exprCtx, dl as foreignKey, dm as freeze, dn as guard, dp as inc, dq as increment, dr as index, ds as installationRef, dt as integer, du as isPalbaseExtension, dv as isRetryable, dw as jsonb, dx as makeTypedDB, dy as now, dz as numeric, dA as onShutdown, dB as onStart, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dG as sqlFragment, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector, dM as withRetry } from './index-eN4KzGa5.js';
3
- import { M as ModuleClients, C as Container } from './index-Dlu2b9-f.js';
4
- export { D as DECLARATION_REFUSAL, a as DeclarationRefused, b as DiError, c as DiKind, d as ModulePressure, e as assertNoOrphanEntryPoints, f as buildContainer, i as isDeclarationRefused } from './index-Dlu2b9-f.js';
1
+ import { k as PalbaseResult, l as PolicyExpr, S as SchemaDef, A as AuthSpec, H as HttpError } from './index-fLaf0PN2.js';
2
+ export { m as AggregateInput, n as AggregateResult, o as AnyColumn, p as AtomicDatabase, q as AtomicOptions, r as Auth, s as AuthConfig, B as BackfillDef, t as BadRequest, u as Cache, i as CacheClient, v as CheckDef, w as ClientInfo, x as ColRef, y as ColumnBuilder, z as ColumnDef, F as ColumnMap, G as ColumnType, C as CommandOptions, I as Conflict, a as DBClient, e as DBOps, J as Database, D as DatabaseBudget, d as DatabaseDiagnostics, c as DatabaseDiagnosticsOptions, K as DatabaseQueryEvent, L as DeadlockDetected, M as Documents, N as EXTENSION_DEPENDENCIES, O as EmbeddingModelRef, Q as EnvSchemas, E as EnvServiceDatabase, U as EnvTables, V as EnvTypedDatabase, W as EnvTypedTable, X as ErrorDef, Y as ErrorMap, Z as ErrorThrowers, $ as FileContext, a0 as FindManyOpts, a1 as FkAction, a2 as FkMatch, a3 as Flags, a4 as Forbidden, a5 as ForeignKeyBuilder, a6 as ForeignKeyDef, a7 as FreezeBuilder, a8 as FreezeDef, a9 as GuardBuilder, aa as GuardDef, ab as GuardEvent, ac as HttpMethod, ad as IndexBuilder, ae as IndexDef, af as InsertManyOptions, ag as InsertShape, ah as InsertValues, ai as LifecycleHook, aj as Log, ak as Logger, al as Materialized, am as Middleware, an as MiddlewareContext, ao as MiddlewareHandler, ap as MutateInput, aq as NotFound, ar as Notifications, as as OnDeleteAction, at as OrderBySpec, au as PALBASE_EXTENSIONS, av as PBRequest, P as Page, aw as PageInfo, ax as PageInput, ay as PageNavigation, az as PalError, aA as PalbaseAnalyticsClient, aB as PalbaseAnalyticsManagementNamespace, aC as PalbaseAnalyticsProperties, aD as PalbaseAnalyticsQueryNamespace, aE as PalbaseAttestAndroidParams, aF as PalbaseAttestAndroidResult, aG as PalbaseAttestiOSParams, aH as PalbaseAttestiOSResult, aI as PalbaseAuthAdminClient, aJ as PalbaseAuthClient, aK as PalbaseBatchOverrideOperation, aL as PalbaseBatchSetOverridesResult, aM as PalbaseBindDeviceParams, aN as PalbaseBucketClient, aO as PalbaseClearAllOverridesResult, aP as PalbaseClearOverrideResult, aQ as PalbaseCohortQueryInput, aR as PalbaseCohortResult, aS as PalbaseCollectionRef, aT as PalbaseCountQueryInput, aU as PalbaseCountResult, aV as PalbaseCreateLinkParams, aW as PalbaseDeviceInfo, aX as PalbaseDeviceTokenView, aY as PalbaseDocsClient, aZ as PalbaseDocumentRef, a_ as PalbaseDocumentSnapshot, a$ as PalbaseEmailClient, b0 as PalbaseEmailSendParams, b1 as PalbaseEmailSendResponse, b2 as PalbaseEventNamesResult, b3 as PalbaseEventsQueryInput, b4 as PalbaseEventsResult, b5 as PalbaseExtension, b6 as PalbaseFileObject, b7 as PalbaseFlag, b8 as PalbaseFlagContext, b9 as PalbaseFlagSource, ba as PalbaseFlagValue, bb as PalbaseFlagVariant, bc as PalbaseFlagsClient, bd as PalbaseFlagsServiceClient, be as PalbaseFunctionsClient, bf as PalbaseFunnelQueryInput, bg as PalbaseFunnelResult, bh as PalbaseIdentifyTraits, bi as PalbaseInboxClient, bj as PalbaseInboxListOptions, bk as PalbaseInboxListResult, bl as PalbaseInboxMessage, bm as PalbaseInboxSendParams, bn as PalbaseInboxSendResponse, bo as PalbaseInitialLink, bp as PalbaseInvokeOptions, bq as PalbaseLink, br as PalbaseLinkAnalytics, bs as PalbaseLinkDetails, bt as PalbaseLinksClient, bu as PalbaseListLinksOptions, bv as PalbaseListLinksResult, bw as PalbaseListOptions, bx as PalbaseMatchParams, by as PalbaseMultiChannelResponse, bz as PalbaseNotificationChannel, bA as PalbaseNotificationsClient, bB as PalbaseOverviewResult, bC as PalbasePreferences, bD as PalbasePreferencesClient, bE as PalbasePushClient, bF as PalbasePushSendParams, bG as PalbasePushSendResponse, bH as PalbaseQrCodeOptions, bI as PalbaseQuerySnapshot, bJ as PalbaseRealtimeClient, bK as PalbaseRegisterDeviceParams, bL as PalbaseRetentionQueryInput, bM as PalbaseRetentionResult, bN as PalbaseSession, bO as PalbaseSetOverrideResult, bP as PalbaseSetOverridesResult, bQ as PalbaseSignedUrlResponse, bR as PalbaseSmsClient, bS as PalbaseSmsSendParams, bT as PalbaseSmsSendResponse, bU as PalbaseStorageClient, bV as PalbaseTransformOptions, bW as PalbaseUpdateLinkParams, bX as PalbaseUploadOptions, bY as PalbaseUser, bZ as PalbaseUserDetailResult, b_ as PalbaseUsersQueryInput, b$ as PalbaseUsersResult, c0 as PalbaseVerifyRequestSignatureParams, c1 as PalbaseWhatsAppClient, c2 as PalbaseWhatsAppEvent, c3 as PalbaseWhatsAppSendParams, c4 as PalbaseWhatsAppSendResponse, c5 as PalbaseWhatsAppTemplate, c6 as PalbaseWhereOperator, c7 as PolicyBinOp, c8 as PolicyBuilder, c9 as PolicyCommand, ca as PolicyDef, cb as PolicyExprCtx, cc as PolicyExprRef, cd as PolicyMode, ce as PolicyOperand, cf as QueryInput, R as RateLimitConfig, cg as RawConstraintDef, f as RawPageOptions, ch as Realtime, ci as Ref, cj as RequestStore, ck as RowShape, b as RuntimeServices, cl as Secrets, cm as SecretsService, cn as SerializationFailure, co as SetShape, cp as SetValue, cq as ShutdownRunner, cr as SqlFragment, cs as Storage, ct as TABLE_META, cu as TableDef, cv as TableHandle, cw as TableInput, cx as TableRef, cy as TooManyRequests, T as TransactionIsolation, cz as TxColumnExpr, cA as TxInsertShape, cB as TxInsertValue, cC as TxNow, cD as TxPlan, g as TxPlanBody, cE as TxPlanError, cF as TxPlanHandle, cG as TxPlanOpResult, cH as TxPlanRejection, h as TxPlanResponse, cI as TxRefError, cJ as TxRow, cK as TxRows, cL as TxSelectOptions, cM as TxSetShape, cN as TxSetValue, cO as TxTable, cP as TxTables, cQ as TxWhere, cR as TxWireExpr, cS as TxWireGuard, cT as TxWireOp, cU as TxWireRef, cV as TxWireValue, cW as TypedDB, cX as TypedTable, cY as TypedTx, cZ as Unauthorized, c_ as UniqueViolation, c$ as UniqueWhere, d0 as UserT, d1 as VerifiedDevice, d2 as WhereFilter, d3 as WhereOp, d4 as __getRuntime, j as __requestALS, d5 as __resetLifecycleHooks, d6 as __runStartHooks, _ as __runWithRuntime, d7 as __setRuntime, d8 as backfill, d9 as bigint, da as boolean, db as can, dc as check, dd as col, de as dec, df as decrement, dg as defineMiddleware, dh as defineSchema, di as defineTable, dj as enumType, dk as exprCtx, dl as foreignKey, dm as freeze, dn as guard, dp as inc, dq as increment, dr as index, ds as installationRef, dt as integer, du as isPalbaseExtension, dv as isRetryable, dw as jsonb, dx as makeTypedDB, dy as now, dz as numeric, dA as onShutdown, dB as onStart, dC as openai, dD as ownedByUser, dE as policy, dF as raw, dG as sqlFragment, dH as text, dI as timestamp, dJ as userRef, dK as uuid, dL as vector, dM as withRetry } from './index-fLaf0PN2.js';
3
+ import { M as ModuleClients, C as Container } from './index-QWN1Ncrv.js';
4
+ export { D as DECLARATION_REFUSAL, a as DeclarationRefused, b as DiError, c as DiKind, d as ModulePressure, e as assertNoOrphanEntryPoints, f as buildContainer, i as isDeclarationRefused } from './index-QWN1Ncrv.js';
5
5
  export { TableTypes, Tables } from './db/env.js';
6
6
  export { PalbaseBucketName, PalbaseFlagKey, PalbaseSecretName } from './stack.js';
7
- import { a as RouteOptions } from './registry-B8ddZiMY.js';
8
- export { H as HttpMethodUpper, b as ParamKind, P as ParamMeta, R as RouteMeta, c as Signal, d as Sse, S as SseConfig, e as SseOut, f as SseWriter, T as ThrowDescriptor, g as Upload, U as UploadConfig, h as UploadedObject, i as getRoutes, r as recordThrows } from './registry-B8ddZiMY.js';
7
+ import { a as RouteOptions } from './registry-C7tCRyPm.js';
8
+ export { H as HttpMethodUpper, b as ParamKind, P as ParamMeta, R as RouteMeta, c as Signal, d as Sse, S as SseConfig, e as SseOut, f as SseWriter, T as ThrowDescriptor, g as Upload, U as UploadConfig, h as UploadedObject, i as getRoutes, r as recordThrows } from './registry-C7tCRyPm.js';
9
9
  import { ZodTypeAny, z } from 'zod';
10
10
  export { z } from 'zod';
11
11
  import { T as Token } from './module-Dl1KFVtc.js';
@@ -1,7 +1,7 @@
1
1
  import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
2
2
  import { ZodTypeAny } from 'zod';
3
- import { A as AuthSpec, R as RateLimitConfig } from '../index-pK2At5Yc.cjs';
4
- import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-9dNeVN5d.cjs';
3
+ import { A as AuthSpec, R as RateLimitConfig } from '../index-CCY1h_J2.cjs';
4
+ import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-CH6HRR6T.cjs';
5
5
  import '../db/env.cjs';
6
6
  import '../stack.cjs';
7
7
  import 'node:async_hooks';
@@ -1,7 +1,7 @@
1
1
  import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
2
2
  import { ZodTypeAny } from 'zod';
3
- import { A as AuthSpec, R as RateLimitConfig } from '../index-eN4KzGa5.js';
4
- import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-B8ddZiMY.js';
3
+ import { A as AuthSpec, R as RateLimitConfig } from '../index-fLaf0PN2.js';
4
+ import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-C7tCRyPm.js';
5
5
  import '../db/env.js';
6
6
  import '../stack.js';
7
7
  import 'node:async_hooks';
@@ -1,4 +1,4 @@
1
- import { D as DatabaseBudget, A as AuthSpec, R as RateLimitConfig } from './index-eN4KzGa5.js';
1
+ import { D as DatabaseBudget, A as AuthSpec, R as RateLimitConfig } from './index-fLaf0PN2.js';
2
2
  import { ZodTypeAny } from 'zod';
3
3
  import { PalbaseBucketName } from './stack.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { D as DatabaseBudget, A as AuthSpec, R as RateLimitConfig } from './index-pK2At5Yc.cjs';
1
+ import { D as DatabaseBudget, A as AuthSpec, R as RateLimitConfig } from './index-CCY1h_J2.cjs';
2
2
  import { ZodTypeAny } from 'zod';
3
3
  import { PalbaseBucketName } from './stack.cjs';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { T as Token } from '../module-Dl1KFVtc.cjs';
2
- import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-pK2At5Yc.cjs';
2
+ import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-CCY1h_J2.cjs';
3
3
  import 'zod';
4
4
  import '../db/env.cjs';
5
5
  import '../stack.cjs';
@@ -1,5 +1,5 @@
1
1
  import { T as Token } from '../module-Dl1KFVtc.js';
2
- import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-eN4KzGa5.js';
2
+ import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-fLaf0PN2.js';
3
3
  import 'zod';
4
4
  import '../db/env.js';
5
5
  import '../stack.js';
package/docs/auth.md CHANGED
@@ -252,9 +252,10 @@ caller's permissions — pushed over realtime the moment a role changes.
252
252
  ## Email verification
253
253
 
254
254
  The platform handles verification end to end. **You do not configure a sender**,
255
- and `config/notifications.ts` is unrelated that file declares providers for
256
- **your app's own** notifications. Auth email goes out through Palbase's own
257
- notification tenant, not yours.
255
+ and `palbase notifications providers` / `palbase notifications templates` are
256
+ unrelated those manage providers and templates for **your app's own**
257
+ notifications. Auth email goes out through Palbase's own notification tenant,
258
+ not yours.
258
259
 
259
260
  What happens on `POST /auth/signup`:
260
261
 
@@ -1071,9 +1071,10 @@ caller's permissions — pushed over realtime the moment a role changes.
1071
1071
  ## Email verification
1072
1072
 
1073
1073
  The platform handles verification end to end. **You do not configure a sender**,
1074
- and `config/notifications.ts` is unrelated that file declares providers for
1075
- **your app's own** notifications. Auth email goes out through Palbase's own
1076
- notification tenant, not yours.
1074
+ and `palbase notifications providers` / `palbase notifications templates` are
1075
+ unrelated those manage providers and templates for **your app's own**
1076
+ notifications. Auth email goes out through Palbase's own notification tenant,
1077
+ not yours.
1077
1078
 
1078
1079
  What happens on `POST /auth/signup`:
1079
1080
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palbase/backend",
3
- "version": "39.1.4",
3
+ "version": "39.1.5",
4
4
  "description": "Palbase Backend SDK — class controllers (@Controller/@Get/@Post + @Body/@QueryParams/@Param), error classes, schema DSL",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -92,7 +92,8 @@
92
92
  "dist",
93
93
  "docs",
94
94
  "stager",
95
- "template"
95
+ "template",
96
+ "MIGRATION.md"
96
97
  ],
97
98
  "dependencies": {
98
99
  "@asteasolutions/zod-to-openapi": "^7.3.4",
@@ -16,7 +16,7 @@ import { Controller, Get, Post, Body, Param, User, z, Database, NotFound } from
16
16
  > field would arrive `undefined`, and the build says so by name.
17
17
 
18
18
  **The full reference** — every decorator, every platform service, every schema
19
- helper — is at <https://app.dev.palbase.studio/llms.txt> (`/llms-full.txt` for
19
+ helper — is at <https://palbase.studio/llms.txt> (`/llms-full.txt` for
20
20
  agents). This file does not repeat it; it says what the code should LOOK like.
21
21
 
22
22
  ## The layers
@@ -1,75 +0,0 @@
1
- # Fake pagination and claim: verification sources
2
-
3
- Verified 2026-09-06. Scope: repair the two existing in-memory fake contracts,
4
- using the repository's existing runtime and test runner. No new dependency or
5
- public API is introduced.
6
-
7
- | ID | Existing tool | Stakes | Tier | Status | Evidence |
8
- | --- | --- | --- | --- | --- | --- |
9
- | UD-001 | Bun 1.3.9 for independent consumer probes | 1 | quick | verified | `bun --version`; published-package and built-package probe executions |
10
- | UD-002 | Vitest 3.2.4 for SDK regressions | 1 | quick | verified | `backend/package.json`, runtime version output, Context7 CLI documentation |
11
-
12
- CLAIM: Bun supports direct TypeScript execution and reports test/runtime failures
13
- with a nonzero exit status. SOURCE:
14
- https://github.com/oven-sh/bun/blob/main/docs/test/runtime-behavior.mdx
15
- VERIFIED: 2026-09-06 via Context7 and actual Bun 1.3.9 probe exits 1/0.
16
- TIER: quick. Current docs are not an assertion that their latest Bun version is
17
- the installed version; the installed runtime was measured separately.
18
-
19
- CLAIM: Vitest's file arguments select test paths; `run` performs a single run.
20
- SOURCE: https://github.com/vitest-dev/vitest/blob/v3.2.4/docs/guide/cli.md
21
- VERIFIED: 2026-09-06 via Context7 and focused red/green executions.
22
- TIER: quick.
23
-
24
- CLAIM: `--no-file-parallelism` runs test files without file concurrency.
25
- SOURCE: https://github.com/vitest-dev/vitest/blob/v3.2.4/docs/guide/debugging.md
26
- VERIFIED: 2026-09-06 via Context7 and installed
27
- `pnpm --filter @palbase/backend exec vitest --help --fileParallelism`.
28
- TIER: quick. This flag changes scheduling, preserving test assertions, selected
29
- files, type checking, and timeouts.
30
-
31
- The SDK contracts were checked against local primary sources:
32
-
33
- - `docs/database.md:179`: `now()` works in `claim` and other insert operations.
34
- - `docs/database.md:355`: offset requires limit.
35
- - `src/engine/db.ts:1403`: nonnegative integer limit validation.
36
- - `src/engine/db.ts:1417`: nonnegative integer offset validation and limit requirement.
37
- - `src/engine/db.ts:2362`: claim merges unique/extra and compiles insert expressions.
38
- - `src/__tests__/helpers/mock-db.ts:277`: existing insert-expression resolver.
39
-
40
- Runtime evidence separating the hypotheses is in `verification.md`.
41
-
42
- ## Publication follow-up
43
-
44
- The user requested publication after the source fix was verified. Publication
45
- uses the repository's existing Changesets workflow; stakes 3, standard tier.
46
- Context7 was attempted twice but its transport was unavailable, so the official
47
- Changesets CLI documentation was read directly and checked against the local
48
- workflow and a successful live run.
49
-
50
- | ID | Existing approach | Stakes | Tier | Status | Evidence |
51
- | --- | --- | --- | --- | --- | --- |
52
- | UD-003 | Changesets version commit followed by the main release workflow | 3 | standard | verified | `.github/workflows/release.yml`, `package.json`, official CLI docs and run 34035374818 |
53
-
54
- CLAIM: `changeset version` updates package versions/changelogs, and `publish`
55
- publishes package versions absent from npm. SOURCE:
56
- https://github.com/changesets/changesets/blob/main/docs/command-line-options.md
57
- VERIFIED: 2026-09-06 via official documentation, installed CLI 2.30.0, and the
58
- repository's `ci:version`/`ci:publish` scripts. TIER: standard.
59
-
60
- CLAIM: This repository versions locally, pushes to main, verifies matching core
61
- images first, then publishes npm and advances latest/next. SOURCE:
62
- https://github.com/palgroup/palbase-ts/blob/e9765e8460bbe9c4a20641f805a5e682f0097174/.github/workflows/release.yml
63
- and https://github.com/palgroup/palbase-ts/actions/runs/34035374818
64
- VERIFIED: 2026-09-06 via the workflow source and GitHub run state. TIER: standard.
65
-
66
- Registry evidence: `latest` and `next` both resolve to 36.0.1; querying 36.0.2
67
- returned E404 before versioning. Only the backend package is selected for a
68
- patch release, with the existing image-before-npm order preserved.
69
-
70
- Publication preflight observation: `ci:version` initially failed in the GitHub
71
- changelog adapter because the local fix commit was not yet on GitHub. The commit
72
- API returned HTTP 422 for `bfd6060` and resolved the existing base commit, ruling
73
- out an authentication failure. Publishing the fix commit to a temporary branch
74
- made the same `ci:version` command succeed without changing tooling or workflow.
75
- Only backend package version/changelog and the consumed changeset changed.
@@ -1,145 +0,0 @@
1
- # Backend fake defects: proof, fix, proof
2
-
3
- Date: 2026-09-06. Runtime: Bun 1.3.9, macOS arm64.
4
- Published baseline: `@palbase/backend@36.0.0` from npm, unchanged.
5
- Source baseline: nested `palbase-ts` repository, commit `295958d`, package 36.0.1.
6
- The source checkout still contained both reported defects.
7
-
8
- ## Reproduction
9
-
10
- The supplied `scripts/reproduce-sdk-bugs.ts` was absent from this workspace.
11
- `backend/scripts/reproduce-sdk-bugs.ts` reconstructs the two supplied independent
12
- contracts with public package imports and no application fixtures or credentials.
13
- An identical copy was run in a scratch consumer of the published npm tarball.
14
-
15
- Published baseline commands:
16
-
17
- ```sh
18
- npm pack @palbase/backend@36.0.0 --ignore-scripts --pack-destination /tmp/palbase-sdk-fake-proof.CaHHuo --json
19
- # Scratch package depends on that unchanged tarball.
20
- bun install --ignore-scripts
21
- bun reproduce-sdk-bugs.ts
22
- ```
23
-
24
- Observed before any source fix:
25
-
26
- ```text
27
- FAIL findMany honors offset before limit
28
- actual: [{ id: 'a' }], expected: [{ id: 'b' }]
29
- FAIL claim evaluates now() in returned and stored rows
30
- actual typeof created_at: 'object', expected: 'string'
31
- 0 passed, 2 failed
32
- exit 1
33
- ```
34
-
35
- The raw claim's returned AND stored rows carried `Symbol(palbase.tx.expr)`.
36
- Tarball SHA-1 from npm pack: `0c665f63e2a9b98f5f736df050d17038305a5399`.
37
-
38
- ## Hypotheses and runtime discrimination
39
-
40
- Pagination hypotheses: ignored offset, lost typed forwarding, wrong ordering.
41
- With deliberately unsorted `c,a,b` seeds, raw calls at offsets 0, 1, 2 and 3
42
- all returned `a`. Sorting therefore ran, and bypassing the typed wrapper still
43
- failed. The source pagination step used `slice(0, limit)` and its local option
44
- type omitted offset.
45
-
46
- Claim hypotheses: skipped insert-expression evaluation, incompatible expression
47
- marker, accidental materialization during reading. Passing the SAME `now()`
48
- object to insert and claim returned a timestamp from insert, while claim stored
49
- that original expression object by identity. A later read also returned the
50
- expression, excluding a return-only formatting error.
51
-
52
- Observed paths, cross-checked against the source:
53
-
54
- - Public `/test` export → `src/test/fake-db.ts:65` → shared
55
- `src/__tests__/helpers/mock-db.ts` operation implementation.
56
- - Typed `fake.db.public.<table>.findMany` → `src/runtime.ts:498` → the same
57
- raw operation, with offset forwarded.
58
- - Typed claim → `src/runtime.ts:531` → raw claim.
59
- - The helper is bundled into the shipped `/test` entry by `tsup.config.ts`;
60
- its `__tests__` directory name does not make it an unused test-only copy.
61
-
62
- ## Source regression proof and changes
63
-
64
- Command before and after the implementation change, from `backend`:
65
-
66
- ```sh
67
- pnpm test src/test/fake-db.test.ts src/test/fake-db-parity.test.ts
68
- ```
69
-
70
- | Tree | Result | Exit |
71
- | --- | --- | --- |
72
- | Original existing focused suite | 37 passed | 0 |
73
- | New regressions, original implementation | 12 failed, 38 passed | 1 |
74
- | Same tests, fixed implementation | 50 passed, no type errors | 0 |
75
-
76
- The repair applies offset after filtering/ordering and before projection, and
77
- uses the engine's existing limit/offset validation contract. Claim reuses the
78
- insert-expression resolver and write-value guards before storing a new row.
79
- Existing-row claims still return the original row without recording a new write.
80
-
81
- Coverage includes raw and typed calls, filter/sort/projection ordering, distinct
82
- pages, omitted/zero offset, an empty tail, zero limit, invalid pagination,
83
- timestamp validity in returned/stored/tracked rows, repeated claims, and refusal
84
- of invalid insert values without side effects. Explicit `id` lookup/deletion
85
- semantics are unaffected.
86
-
87
- ## Built package and review
88
-
89
- Fresh build: `pnpm -w turbo run build --filter=@palbase/backend` → exit 0,
90
- backend cache miss, ESM/CJS/declarations generated.
91
-
92
- From `backend`, against the built public package entry points:
93
-
94
- ```text
95
- $ bun scripts/reproduce-sdk-bugs.ts
96
- PASS findMany honors offset before limit
97
- PASS claim evaluates now() in returned and stored rows
98
- 2 passed, 0 failed
99
- exit 0
100
- ```
101
-
102
- `pnpm typecheck` → exit 0.
103
- `pnpm check:api` → exit 0; 424 exports and 421 signatures unchanged.
104
- Independent reviewer: no actionable findings; separate source probe and
105
- 42-test fake suite both passed.
106
-
107
- ## Full-suite environment findings
108
-
109
- The first shared-workspace `pnpm test` exited 1: 6 failed / 1900 passed tests,
110
- 3 collection failures and 3 worker RPC errors. It included ignored generated
111
- Bun consumer tests under `bench/database-dx/generated/...`, which Vitest cannot
112
- load (`bun:test`), plus five timeouts under concurrent load.
113
-
114
- The sixth failure was an existing probabilistic cursor-test assertion:
115
- `src/engine/cursor.test.ts:15` replaces character 10 with `x`, even when it
116
- already is `x`. An independent loop observed this at attempt 82: the
117
- "changed" token equalled the original, and decoding correctly accepted it.
118
- Neither this test nor cursor implementation is changed by this fix.
119
-
120
- Final suite verification uses a detached temporary checkout at the same commit,
121
- with identical fix/test/probe files and the existing installed dependencies.
122
- File scheduling is serial; no assertions, timeouts or test selections are changed.
123
- The copied implementation, regression tests, and independent probe were checked
124
- byte-for-byte against the working files with `cmp` (all exit 0).
125
-
126
- Final command, from the isolated checkout's `backend` directory:
127
-
128
- ```text
129
- $ pnpm test --no-file-parallelism
130
- Test Files 128 passed (128)
131
- Tests 1906 passed (1906)
132
- Type Errors no errors
133
- Duration 38.41s
134
- exit 0
135
- ```
136
-
137
- The isolated checkout was also freshly built (backend cache miss, exit 0), and
138
- `bun scripts/reproduce-sdk-bugs.ts` there returned 2 passed / 0 failed, exit 0.
139
- The shared workspace's generated Bun tests are not tracked SDK test files; their
140
- absence in this checkout accounts for the three fewer collected files.
141
-
142
- Full raw command logs are retained in `/tmp/palbase-sdk-fake-proof.CaHHuo`.
143
- This initial verification covered source and local build artifacts, with no live
144
- PostgreSQL run. The user subsequently requested publication as backend 36.0.2;
145
- its registry installation is checked with the same independent contract probes.