gemi 0.60.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/Agent.d.ts +533 -25
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/Agent.test-d.d.ts +2 -0
- package/dist/ai/Agent.test-d.d.ts.map +1 -0
- package/dist/ai/AgentController.d.ts +275 -6
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +255 -0
- package/dist/ai/AgentProvider.d.ts.map +1 -0
- package/dist/ai/Schema.d.ts +125 -0
- package/dist/ai/Schema.d.ts.map +1 -0
- package/dist/ai/Schema.test-d.d.ts +2 -0
- package/dist/ai/Schema.test-d.d.ts.map +1 -0
- package/dist/ai/client/index.d.ts +24 -0
- package/dist/ai/client/index.d.ts.map +1 -0
- package/dist/ai/client/index.js +1053 -0
- package/dist/ai/client/index.js.map +1 -0
- package/dist/ai/client/reducer.d.ts +127 -0
- package/dist/ai/client/reducer.d.ts.map +1 -0
- package/dist/ai/client/reducer.test-d.d.ts +2 -0
- package/dist/ai/client/reducer.test-d.d.ts.map +1 -0
- package/dist/ai/client/sse.d.ts +54 -0
- package/dist/ai/client/sse.d.ts.map +1 -0
- package/dist/ai/example.d.ts +129 -0
- package/dist/ai/example.d.ts.map +1 -0
- package/dist/ai/index.d.ts +35 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +20 -0
- package/dist/ai/index.js.map +23 -0
- package/dist/ai/live/harness.d.ts +137 -0
- package/dist/ai/live/harness.d.ts.map +1 -0
- package/dist/ai/providers/call.d.ts +42 -0
- package/dist/ai/providers/call.d.ts.map +1 -0
- package/dist/ai/providers/capabilities.d.ts +50 -0
- package/dist/ai/providers/capabilities.d.ts.map +1 -0
- package/dist/ai/providers/errors.d.ts +37 -0
- package/dist/ai/providers/errors.d.ts.map +1 -0
- package/dist/ai/providers/fakeProvider.d.ts +35 -0
- package/dist/ai/providers/fakeProvider.d.ts.map +1 -0
- package/dist/ai/providers/http.d.ts +46 -0
- package/dist/ai/providers/http.d.ts.map +1 -0
- package/dist/ai/providers/request.d.ts +69 -0
- package/dist/ai/providers/request.d.ts.map +1 -0
- package/dist/ai/providers/stream.d.ts +42 -0
- package/dist/ai/providers/stream.d.ts.map +1 -0
- package/dist/ai/signing.d.ts +195 -0
- package/dist/ai/signing.d.ts.map +1 -0
- package/dist/ai/store/LiveRuns.d.ts +142 -0
- package/dist/ai/store/LiveRuns.d.ts.map +1 -0
- package/dist/ai/store/MemoryAgentStore.d.ts +61 -0
- package/dist/ai/store/MemoryAgentStore.d.ts.map +1 -0
- package/dist/ai/store/index.d.ts +4 -0
- package/dist/ai/store/index.d.ts.map +1 -0
- package/dist/ai/store/sse.d.ts +58 -0
- package/dist/ai/store/sse.d.ts.map +1 -0
- package/dist/ai/store/stubAgentRun.d.ts +56 -0
- package/dist/ai/store/stubAgentRun.d.ts.map +1 -0
- package/dist/ai/types.d.ts +443 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/useChat.d.ts +253 -7
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/chunk-1aqzcgfr.js +5 -0
- package/dist/chunk-1aqzcgfr.js.map +10 -0
- package/dist/{chunk-get4mkx8.js → chunk-1b7e9rj7.js} +2 -2
- package/dist/{chunk-get4mkx8.js.map → chunk-1b7e9rj7.js.map} +1 -1
- package/dist/{chunk-j06g4sqc.js → chunk-528n3vgy.js} +2 -2
- package/dist/{chunk-j06g4sqc.js.map → chunk-528n3vgy.js.map} +1 -1
- package/dist/{chunk-2khdxyjb.js → chunk-57a0nqfj.js} +1 -1
- package/dist/chunk-57a0nqfj.js.map +10 -0
- package/dist/chunk-5fj71djg.js +6 -0
- package/dist/{chunk-y3zz410b.js.map → chunk-5fj71djg.js.map} +2 -2
- package/dist/{chunk-c40n5r4v.js → chunk-5mhcwnyd.js} +2 -2
- package/dist/{chunk-c40n5r4v.js.map → chunk-5mhcwnyd.js.map} +1 -1
- package/dist/{chunk-gwchvzdp.js → chunk-71pk1mxx.js} +2 -2
- package/dist/{chunk-gwchvzdp.js.map → chunk-71pk1mxx.js.map} +1 -1
- package/dist/{chunk-spbgpndn.js → chunk-7t1hjs9f.js} +2 -2
- package/dist/{chunk-spbgpndn.js.map → chunk-7t1hjs9f.js.map} +1 -1
- package/dist/{chunk-9gsdcjt7.js → chunk-7xvaace2.js} +3 -3
- package/dist/{chunk-9gsdcjt7.js.map → chunk-7xvaace2.js.map} +1 -1
- package/dist/{chunk-fxy42w6n.js → chunk-8ag0da2s.js} +2 -2
- package/dist/{chunk-fxy42w6n.js.map → chunk-8ag0da2s.js.map} +1 -1
- package/dist/chunk-8r8epsef.js +5 -0
- package/dist/chunk-8r8epsef.js.map +11 -0
- package/dist/{chunk-0fm6jh9b.js → chunk-9nmvm20t.js} +2 -2
- package/dist/{chunk-0fm6jh9b.js.map → chunk-9nmvm20t.js.map} +1 -1
- package/dist/chunk-9penj44g.js +5 -0
- package/dist/{chunk-khf9xda6.js.map → chunk-9penj44g.js.map} +2 -2
- package/dist/{chunk-98a3k7bp.js → chunk-9xpa7dpy.js} +2 -2
- package/dist/{chunk-98a3k7bp.js.map → chunk-9xpa7dpy.js.map} +1 -1
- package/dist/{chunk-qva4841r.js → chunk-a1exbqcq.js} +3 -3
- package/dist/{chunk-qva4841r.js.map → chunk-a1exbqcq.js.map} +1 -1
- package/dist/{chunk-cw9y6k15.js → chunk-bb19bwg6.js} +2 -2
- package/dist/{chunk-cw9y6k15.js.map → chunk-bb19bwg6.js.map} +1 -1
- package/dist/{chunk-3gvjn3q4.js → chunk-cf7bvd12.js} +1 -1
- package/dist/{chunk-rkbv3df7.js → chunk-djp2xeqe.js} +2 -2
- package/dist/{chunk-rkbv3df7.js.map → chunk-djp2xeqe.js.map} +1 -1
- package/dist/chunk-ds44bqr9.js +4 -0
- package/dist/{chunk-4mcyyh1v.js.map → chunk-ds44bqr9.js.map} +4 -9
- package/dist/{chunk-wzvs3sym.js → chunk-exndjhza.js} +3 -3
- package/dist/{chunk-wzvs3sym.js.map → chunk-exndjhza.js.map} +1 -1
- package/dist/{chunk-f6dd4gd8.js → chunk-f233yzxf.js} +2 -2
- package/dist/{chunk-f6dd4gd8.js.map → chunk-f233yzxf.js.map} +1 -1
- package/dist/chunk-fz5g2z6h.js +4 -0
- package/dist/{chunk-fbvvqf9b.js.map → chunk-fz5g2z6h.js.map} +2 -2
- package/dist/{chunk-vj9538yn.js → chunk-gcszdwcb.js} +2 -2
- package/dist/{chunk-vj9538yn.js.map → chunk-gcszdwcb.js.map} +1 -1
- package/dist/{chunk-dgasxgsm.js → chunk-hk06nhxh.js} +4 -4
- package/dist/{chunk-dgasxgsm.js.map → chunk-hk06nhxh.js.map} +5 -5
- package/dist/{chunk-pkjq9833.js → chunk-htesx7ym.js} +4 -4
- package/dist/{chunk-pkjq9833.js.map → chunk-htesx7ym.js.map} +1 -1
- package/dist/{chunk-stq96kya.js → chunk-k2sjvt0c.js} +2 -2
- package/dist/{chunk-stq96kya.js.map → chunk-k2sjvt0c.js.map} +1 -1
- package/dist/{chunk-x8beq9c4.js → chunk-k4a2gzyc.js} +2 -2
- package/dist/{chunk-x8beq9c4.js.map → chunk-k4a2gzyc.js.map} +1 -1
- package/dist/{chunk-zhbrkpb3.js → chunk-k75phgj4.js} +4 -4
- package/dist/{chunk-zhbrkpb3.js.map → chunk-k75phgj4.js.map} +1 -1
- package/dist/{chunk-23h0dmx2.js → chunk-kac5vmvn.js} +2 -2
- package/dist/{chunk-23h0dmx2.js.map → chunk-kac5vmvn.js.map} +1 -1
- package/dist/{chunk-y64j80v9.js → chunk-m0tp7zjp.js} +2 -2
- package/dist/{chunk-y64j80v9.js.map → chunk-m0tp7zjp.js.map} +1 -1
- package/dist/{chunk-06j6rsew.js → chunk-m45j7p1y.js} +2 -2
- package/dist/{chunk-06j6rsew.js.map → chunk-m45j7p1y.js.map} +1 -1
- package/dist/chunk-mca9wsvs.js +5 -0
- package/dist/{chunk-z2tcxwyr.js.map → chunk-mca9wsvs.js.map} +3 -4
- package/dist/{chunk-tey1xayb.js → chunk-ms13evzp.js} +2 -2
- package/dist/{chunk-tey1xayb.js.map → chunk-ms13evzp.js.map} +1 -1
- package/dist/{chunk-bn1v4sfs.js → chunk-r962ae93.js} +2 -2
- package/dist/{chunk-bn1v4sfs.js.map → chunk-r962ae93.js.map} +1 -1
- package/dist/chunk-snb68dgr.js +4 -0
- package/dist/{chunk-hwhw98hc.js.map → chunk-snb68dgr.js.map} +1 -1
- package/dist/chunk-sz051605.js +5 -0
- package/dist/chunk-sz051605.js.map +14 -0
- package/dist/{chunk-2cwcfwg3.js → chunk-tr3cbx8k.js} +2 -2
- package/dist/{chunk-2cwcfwg3.js.map → chunk-tr3cbx8k.js.map} +2 -2
- package/dist/{chunk-zqsfanvk.js → chunk-wpb1xpdp.js} +2 -2
- package/dist/{chunk-zqsfanvk.js.map → chunk-wpb1xpdp.js.map} +1 -1
- package/dist/{chunk-z1e55w67.js → chunk-ybqss0jy.js} +2 -2
- package/dist/{chunk-z1e55w67.js.map → chunk-ybqss0jy.js.map} +1 -1
- package/dist/{chunk-cejf873g.js → chunk-yk5wqmyh.js} +2 -2
- package/dist/{chunk-cejf873g.js.map → chunk-yk5wqmyh.js.map} +1 -1
- package/dist/{chunk-8kj3zrm9.js → chunk-ywntv8yw.js} +4 -4
- package/dist/{chunk-8kj3zrm9.js.map → chunk-ywntv8yw.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-ByU4BQdL.js → ThemeProvider-BZ2SsSZ3.js} +60 -39
- package/dist/chunks/ThemeProvider-BZ2SsSZ3.js.map +1 -0
- package/dist/chunks/useParams-BN3XXfmG.js +20 -0
- package/dist/chunks/useParams-BN3XXfmG.js.map +1 -0
- package/dist/client/index.js +3 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/useDictionary.d.ts.map +1 -1
- package/dist/database/index.js +1 -1
- package/dist/facades/Storage.d.ts +6 -2
- package/dist/facades/Storage.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/http/ApiRouter.d.ts +30 -2
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/defineDictionary.d.ts +7 -4
- package/dist/i18n/defineDictionary.d.ts.map +1 -1
- package/dist/i18n/dictionaryRegistry.d.ts +38 -14
- package/dist/i18n/dictionaryRegistry.d.ts.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +2 -2
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +2 -2
- package/dist/server/index.js +1 -1
- package/dist/services/file-storage/drivers/AzureBlobDriver.d.ts +3 -2
- package/dist/services/file-storage/drivers/AzureBlobDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +2 -2
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +2 -2
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/S3Driver.d.ts +2 -2
- package/dist/services/file-storage/drivers/S3Driver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/types.d.ts +9 -1
- package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +6 -6
- package/dist/services/index.js.map +4 -4
- package/dist/testing/index.js +2 -1
- package/dist/testing/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-2khdxyjb.js.map +0 -10
- package/dist/chunk-4mcyyh1v.js +0 -4
- package/dist/chunk-fbvvqf9b.js +0 -4
- package/dist/chunk-hwhw98hc.js +0 -4
- package/dist/chunk-khf9xda6.js +0 -5
- package/dist/chunk-q0y0j3ne.js +0 -5
- package/dist/chunk-q0y0j3ne.js.map +0 -11
- package/dist/chunk-y3zz410b.js +0 -6
- package/dist/chunk-z2tcxwyr.js +0 -5
- package/dist/chunks/ThemeProvider-ByU4BQdL.js.map +0 -1
- /package/dist/{chunk-3gvjn3q4.js.map → chunk-cf7bvd12.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../client/useDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAItE,KAAK,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,QAAQ,CACtD;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7C,CAAC,MAAM,CAAC,CAAC,CACX,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACnD,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAChB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,CAAC,SAAS,sBAAsB,EAClE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../client/useDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAE,MAAM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@@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sa as b}from"../chunk-
|
|
2
|
+
import{sa as b}from"../chunk-cf7bvd12.js";import"../chunk-ys904esh.js";import{cd as e,dd as o,ed as r,fd as n,gd as a,hd as t,id as i,jd as s,kd as C,ld as f,md as D,nd as c,od as p}from"../chunk-ybqss0jy.js";import"../chunk-f233yzxf.js";import"../chunk-3296fwss.js";import"../chunk-4dan69s4.js";export{n as isSqlite,a as isMysqlFamily,r as inferDialect,c as defineDatabaseConfig,p as databaseConfigDefaults,e as UnknownDatabaseUrlError,i as UnknownConnectionError,s as ReservedConnectionNameError,o as MissingDatabaseUrlError,b as DatabaseServiceProvider,D as DatabaseManager,t as DEFAULT_CONNECTION,C as CrossConnectionTransactionError,f as Connection};
|
|
3
3
|
|
|
4
4
|
//# debugId=3C1C2C0EC07E090564756E2164756E21
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type sharp from "sharp";
|
|
2
2
|
import type { Prettify } from "../utils/type";
|
|
3
3
|
import type { ByteRange } from "../http/range";
|
|
4
|
-
import type { PutFileParams, ReadFileParams, ReadResult } from "../services/file-storage/drivers/types";
|
|
4
|
+
import type { PutFileOptions, PutFileParams, ReadFileParams, ReadResult } from "../services/file-storage/drivers/types";
|
|
5
5
|
import { FilesystemManager } from "../services/file-storage/FilesystemManager";
|
|
6
6
|
import { Facade } from "./Facade";
|
|
7
7
|
type Metadata = Prettify<sharp.Metadata>;
|
|
8
8
|
export declare class Storage extends Facade {
|
|
9
9
|
static getFacadeAccessor(): typeof FilesystemManager;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Stores a file and returns its object name. Pass `{ signal }` to cancel the
|
|
12
|
+
* upload, e.g. with the incoming request's signal or `AbortSignal.timeout()`.
|
|
13
|
+
*/
|
|
14
|
+
static put(params: PutFileParams | Blob, options?: PutFileOptions): Promise<string>;
|
|
11
15
|
static metadata(obj: Blob | File): Promise<Partial<Metadata>>;
|
|
12
16
|
static fetch(params: ReadFileParams | string): Promise<Response>;
|
|
13
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../facades/Storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,KAAK,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEzC,qBAAa,OAAQ,SAAQ,MAAM;IACjC,MAAM,CAAC,iBAAiB;
|
|
1
|
+
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../facades/Storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,KAAK,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEzC,qBAAa,OAAQ,SAAQ,MAAM;IACjC,MAAM,CAAC,iBAAiB;IAIxB;;;OAGG;WACU,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,OAAO,GAAE,cAAmB;WAI9D,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;WAatD,KAAK,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM;IAIlD;;;;;;;;OAQG;WACU,IAAI,CACf,MAAM,EAAE,cAAc,GAAG,MAAM,EAC/B,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;KAAO,GACzC,OAAO,CAAC,UAAU,CAAC;IAgBtB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM;IAG1B,MAAM,CAAC,MAAM;CACd"}
|
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dc as h,Ec as i,Fc as j,Gc as k,Ic as l,Jc as m,Kc as n,Lc as o,Mc as p,Vb as b,Xb as c,Yb as d,Zb as e,dc as f,pc as g}from"../chunk-
|
|
2
|
+
import{Dc as h,Ec as i,Fc as j,Gc as k,Ic as l,Jc as m,Kc as n,Lc as o,Mc as p,Vb as b,Xb as c,Yb as d,Zb as e,dc as f,pc as g}from"../chunk-hk06nhxh.js";import"../chunk-djp2xeqe.js";import"../chunk-ybqss0jy.js";import"../chunk-8r8epsef.js";import{de as a}from"../chunk-ds44bqr9.js";import"../chunk-1aqzcgfr.js";import"../chunk-f233yzxf.js";import"../chunk-sz051605.js";import"../chunk-mca9wsvs.js";import"../chunk-3296fwss.js";import"../chunk-x6y1z4cq.js";import"../chunk-tds3xq6b.js";import"../chunk-j23cengk.js";import"../chunk-hxb1eg2z.js";import"../chunk-4dan69s4.js";export{i as Url,f as Storage,l as Redis,a as Redirect,m as RateLimiter,h as Query,j as Meta,g as Log,e as Lang,n as Features,b as Facade,p as DB,k as Cookie,o as ConnectionQueries,c as Broadcast,d as Auth};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=053983E795F13BD264756E2164756E21
|
package/dist/http/ApiRouter.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RemoveGroupPrefix } from "../client/types";
|
|
2
|
+
import type { AgentController, AgentRoute, AgentRouteRPC } from "../ai/AgentController";
|
|
2
3
|
import type { KeyAndValue, KeyAndValueToObject } from "../internal/type-utils";
|
|
3
4
|
import { Controller, ResourceController, type ControllerMethods } from "./Controller";
|
|
4
5
|
import { HttpRequest } from "./HttpRequest";
|
|
@@ -77,7 +78,7 @@ export type RouteHandlers = Partial<{
|
|
|
77
78
|
delete: RouteHandler<"DELETE", any, any, any>;
|
|
78
79
|
put: RouteHandler<"PUT", any, any, any>;
|
|
79
80
|
}>;
|
|
80
|
-
export type ApiRoutes = Record<string, RouteHandler<any, any, any, any> | FileHandler | StreamHandler | ProxyHandler | RouteHandlers | typeof ApiRouter | ResourceRoutes<any>>;
|
|
81
|
+
export type ApiRoutes = Record<string, RouteHandler<any, any, any, any> | FileHandler | StreamHandler | ProxyHandler | RouteHandlers | typeof ApiRouter | ResourceRoutes<any> | AgentRoute<any>>;
|
|
81
82
|
export type ResourceRoutes<T extends new () => ResourceController> = {
|
|
82
83
|
first: {
|
|
83
84
|
get: ParseRouteHandler<T, TestControllerMethod<T, "list">, "GET">;
|
|
@@ -117,6 +118,33 @@ export declare class ApiRouter {
|
|
|
117
118
|
delete<Input, Output, Params>(handler: CallbackHandler<Input, Output, Params>): RouteHandler<"DELETE", Input, Output, Params>;
|
|
118
119
|
delete<T extends new () => Controller, K extends ControllerMethods<T>>(handler: T, methodName: K): ParseRouteHandler<T, K, "DELETE">;
|
|
119
120
|
resource<T extends new () => ResourceController>(Controller: T): ResourceRoute<T>;
|
|
121
|
+
/**
|
|
122
|
+
* Mounts an agent controller under one path, the way `resource()` mounts a
|
|
123
|
+
* resource controller: one call, four routes, all of them this controller's.
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* "/chat": this.agent(ChatController).middleware({ stream: "auth" }),
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* POST /chat → stream every client turn
|
|
130
|
+
* POST /chat/attach → attach reattach to a run in progress
|
|
131
|
+
* POST /chat/stop → stop explicit cancel
|
|
132
|
+
* POST /chat/files → upload attachments
|
|
133
|
+
*
|
|
134
|
+
* One mounted path is what gives the client one key to name — `useChat("/chat")`
|
|
135
|
+
* — and the sub-routes deliberately do not appear in `CreateRPC` as keys of
|
|
136
|
+
* their own: they are transport for the hook, not endpoints an app calls.
|
|
137
|
+
*
|
|
138
|
+
* The enclosing router's `middlewares` guard all four, exactly as they guard
|
|
139
|
+
* a sibling `this.post(...)` or `this.resource(...)`, and `.middleware()`
|
|
140
|
+
* adds to them per method. That parity is the whole point: a developer who
|
|
141
|
+
* writes `middlewares = ["auth"]` on the router has guarded the model
|
|
142
|
+
* endpoint, and does not have to know that an agent is flattened as a nested
|
|
143
|
+
* router to have got it right. The four names exist so each route can *also*
|
|
144
|
+
* be guarded on its own — `upload` and `stream` are not equally cheap, and
|
|
145
|
+
* `attach` is a read.
|
|
146
|
+
*/
|
|
147
|
+
agent<T extends new () => AgentController<any>>(Controller: T): AgentRoute<T>;
|
|
120
148
|
file<Input, Output, Params>(handler: CallbackHandler<Input, Output, Params>): FileHandler;
|
|
121
149
|
file<T extends new () => Controller, K extends ControllerMethods<T>>(handler: T, methodName: K): FileHandler;
|
|
122
150
|
/**
|
|
@@ -142,7 +170,7 @@ type RouterInstanceParser<T extends new () => ApiRouter, Prefix extends string>
|
|
|
142
170
|
type ParsePrefixAndKey<P extends PropertyKey, K extends PropertyKey, U extends string = `${P & string}${K & string}`> = U extends "//" ? "/" : U extends `${infer T1}//${infer T2}` ? `${RemoveGroupPrefix<T1>}/${RemoveGroupPrefix<T2>}` : U extends `${infer T1}/${infer T2}/` ? `${RemoveGroupPrefix<T1>}/${RemoveGroupPrefix<T2>}` : RemoveGroupPrefix<U>;
|
|
143
171
|
type RemoveTrailingId<T> = T extends `${infer Head}/:${infer Tail}` ? Tail extends `${string}/:${string}` ? `${Head}/:${RemoveTrailingId<Tail>}` : Head extends `/:${string}` ? "X" : `${Head}` : T;
|
|
144
172
|
type ResourceRoutesParser<T extends ResourceRoutes<new () => ResourceController>, U extends PropertyKey> = RouteHandlersParser<T["first"], RemoveTrailingId<U & string>> | RouteHandlersParser<T["second"], `${U & string}`>;
|
|
145
|
-
type RouteParser<T extends ApiRoutes, Prefix extends PropertyKey = "", K extends keyof T = keyof T> = K extends any ? T[K] extends ResourceRoutes<any> ? ResourceRoutesParser<T[K], ParsePrefixAndKey<Prefix, K>> : T[K] extends RouteHandler<any, any, any, any> ? RouteHandlerParser<T[K], ParsePrefixAndKey<Prefix, K>> : T[K] extends new () => ApiRouter ? RouterInstanceParser<T[K], ParsePrefixAndKey<Prefix, K>> : T[K] extends RouteHandlers ? RouteHandlersParser<T[K], `${Prefix & string}${K extends "/" ? "" : K & string}`> : never : never;
|
|
173
|
+
type RouteParser<T extends ApiRoutes, Prefix extends PropertyKey = "", K extends keyof T = keyof T> = K extends any ? T[K] extends AgentRoute<infer C> ? KeyAndValue<ParsePrefixAndKey<Prefix, K>, AgentRouteRPC<C>> : T[K] extends ResourceRoutes<any> ? ResourceRoutesParser<T[K], ParsePrefixAndKey<Prefix, K>> : T[K] extends RouteHandler<any, any, any, any> ? RouteHandlerParser<T[K], ParsePrefixAndKey<Prefix, K>> : T[K] extends new () => ApiRouter ? RouterInstanceParser<T[K], ParsePrefixAndKey<Prefix, K>> : T[K] extends RouteHandlers ? RouteHandlersParser<T[K], `${Prefix & string}${K extends "/" ? "" : K & string}`> : never : never;
|
|
146
174
|
export type CreateRPC<T extends ApiRouter, Prefix extends PropertyKey = ""> = KeyAndValueToObject<RouteParser<T["routes"], Prefix>>;
|
|
147
175
|
export {};
|
|
148
176
|
//# sourceMappingURL=ApiRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRouter.d.ts","sourceRoot":"","sources":["../../http/ApiRouter.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http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$d as
|
|
2
|
+
import{$d as r,Vd as l,Wd as m,Xd as n,Yd as o,Zd as p,_d as q,ae as s,be as t,ee as u,fe as v,ge as w,he as x,ie as y,je as z,pe as A,qe as B,re as C,te as D,ue as E,ve as F,we as G,xe as H,ye as I}from"../chunk-ds44bqr9.js";import"../chunk-1aqzcgfr.js";import"../chunk-f233yzxf.js";import{$e as b,_e as a,af as c,bf as d,cf as e,df as f,ef as g,ff as h,hf as i,if as j,jf as k}from"../chunk-sz051605.js";import"../chunk-mca9wsvs.js";import"../chunk-3296fwss.js";import"../chunk-tds3xq6b.js";import"../chunk-j23cengk.js";import"../chunk-4dan69s4.js";export{e as toRangeHeaderValue,l as toMiddlewareList,d as resolveRange,c as parseRangeHeader,f as parseContentRange,z as middlewareConfigDefaults,x as getCookies,h as formatUnsatisfiedContentRange,g as formatContentRange,y as defineMiddlewareConfig,m as createUnsatisfiableResponse,n as createStreamResponse,u as createFileResponse,F as clientIp,v as ViewRouter,j as ValidationError,b as ResourceController,i as RequestBreakerError,E as RateLimitMiddleware,D as RateLimitExceededError,q as RangeNotSatisfiableError,H as PoliciesServiceProvider,I as Policies,w as Middleware,p as InsufficientPermissionsError,k as HttpRequest,r as FileNotFoundError,C as CorsMiddleware,a as Controller,B as CacheMiddleware,G as CSRFMiddleware,o as AuthorizationError,A as AuthenticationMiddleware,s as AuthenticationError,t as ApiRouter};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=564E221C5364E3DC64756E2164756E21
|
package/dist/http/index.js.map
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DictionaryTranslations, type LocaleStrings } from "./dictionaryShape";
|
|
2
|
+
import { type RenderThenable } from "./dictionaryRegistry";
|
|
2
3
|
declare const brand: unique symbol;
|
|
3
4
|
export interface DictionaryHandle<T extends DictionaryTranslations = DictionaryTranslations> {
|
|
4
5
|
readonly id: string;
|
|
@@ -11,11 +12,13 @@ export interface DictionaryHandle<T extends DictionaryTranslations = DictionaryT
|
|
|
11
12
|
*/
|
|
12
13
|
load(locale: string): LocaleStrings | Promise<LocaleStrings>;
|
|
13
14
|
/**
|
|
14
|
-
* `load`, but
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* `load`, but as the exact thing React's `use()` wants: never rejecting, so
|
|
16
|
+
* a failed locale chunk degrades the component to rendering keys instead of
|
|
17
|
+
* unmounting it into an error boundary; and always a thenable, even when the
|
|
18
|
+
* strings are already in memory, so the caller's `use()` is never
|
|
19
|
+
* conditional. `loadDictionaryForRender` has the whole reasoning.
|
|
17
20
|
*/
|
|
18
|
-
loadForRender(locale: string):
|
|
21
|
+
loadForRender(locale: string): RenderThenable;
|
|
19
22
|
get(locale: string): LocaleStrings | undefined;
|
|
20
23
|
/** Type-only: carries the literal's shape through to `useDictionary`. */
|
|
21
24
|
readonly [brand]?: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineDictionary.d.ts","sourceRoot":"","sources":["../../i18n/defineDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"defineDictionary.d.ts","sourceRoot":"","sources":["../../i18n/defineDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAC;AAEnC,MAAM,WAAW,gBAAgB,CAC/B,CAAC,SAAS,sBAAsB,GAAG,sBAAsB;IAEzD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7D;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IAC/C,yEAAyE;IACzE,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,CAAC,SAAS,sBAAsB,EACrE,YAAY,EAAE,CAAC,EACf,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAAC,CAAC,CAAC,CAKrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,CAAC,CAAC,SAAS,sBAAsB,GAAG,sBAAsB,EAE/D,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC,GACjE,gBAAgB,CAAC,CAAC,CAAC,CAWrB"}
|
|
@@ -15,6 +15,16 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { LocaleStrings } from "./dictionaryShape";
|
|
17
17
|
export type { LocaleStrings };
|
|
18
|
+
/**
|
|
19
|
+
* A dictionary's strings as the render path sees them: always a promise, so
|
|
20
|
+
* the caller's `use()` is never conditional, and pre-tagged fulfilled when the
|
|
21
|
+
* strings are already in hand so that promise costs nothing. See
|
|
22
|
+
* `loadDictionaryForRender` and `resolvedThenable`.
|
|
23
|
+
*/
|
|
24
|
+
export type RenderThenable = Promise<LocaleStrings> & {
|
|
25
|
+
/** Set when the load failed and this settled on no strings instead. */
|
|
26
|
+
degraded?: boolean;
|
|
27
|
+
};
|
|
18
28
|
export interface RegisteredDictionary {
|
|
19
29
|
id: string;
|
|
20
30
|
/** Locales this dictionary declares. Empty when it is not known up front. */
|
|
@@ -32,23 +42,37 @@ export declare function getResolved(id: string, locale: string): LocaleStrings |
|
|
|
32
42
|
*/
|
|
33
43
|
export declare function loadDictionary(id: string, locale: string): LocaleStrings | Promise<LocaleStrings>;
|
|
34
44
|
/**
|
|
35
|
-
* The same load, but as
|
|
45
|
+
* The same load, but as the exact thing React's `use()` wants.
|
|
46
|
+
*
|
|
47
|
+
* Three properties, each of which has cost a bug:
|
|
48
|
+
*
|
|
49
|
+
* **It never rejects.** A rejecting promise passed to `use()` rethrows during
|
|
50
|
+
* render, which unmounts the whole route into its error boundary — or, before
|
|
51
|
+
* the shell is ready, fails the server render outright. A missing locale chunk
|
|
52
|
+
* is a routine event (a browser holding stale HTML after a rolling deploy
|
|
53
|
+
* requests a hashed filename that no longer exists), and the deprecated
|
|
54
|
+
* `useTranslator` degraded every i18n failure to rendering the raw key. This
|
|
55
|
+
* keeps that behaviour: the thenable resolves to no strings, and the per-key
|
|
56
|
+
* lookup in `useDictionary` then logs and falls back to the key.
|
|
36
57
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* (a
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
58
|
+
* **It is always a thenable**, even when the strings are already resolved and
|
|
59
|
+
* could be returned raw. Returning them raw is what made #494: the caller's
|
|
60
|
+
* `use()` becomes conditional, and a component whose first pass suspended in
|
|
61
|
+
* `use()` on a cold chunk gets *replayed* by React once that chunk lands
|
|
62
|
+
* mid-yield. React only restores the mount hook dispatcher from inside `use()`
|
|
63
|
+
* itself, so a replay that skips `use()` runs the rest of the component under
|
|
64
|
+
* the update dispatcher against an empty hook list, and the next `useState`
|
|
65
|
+
* throws "Update hook called on initial render". A thenable pre-tagged
|
|
66
|
+
* `fulfilled` costs nothing — React reads it synchronously, no suspend, no
|
|
67
|
+
* microtask hop — and keeps `use()` on every path.
|
|
45
68
|
*
|
|
46
|
-
*
|
|
47
|
-
* a
|
|
48
|
-
*
|
|
49
|
-
*
|
|
69
|
+
* **There is exactly one per (dictionary, locale).** React tracks the thenable
|
|
70
|
+
* a component suspended on by position, and a later pass arriving at the same
|
|
71
|
+
* position with a different object gets "A component was suspended by an
|
|
72
|
+
* uncached promise" — and, for a promise that has not settled, would suspend
|
|
73
|
+
* forever on a fresh one every render.
|
|
50
74
|
*/
|
|
51
|
-
export declare function loadDictionaryForRender(id: string, locale: string):
|
|
75
|
+
export declare function loadDictionaryForRender(id: string, locale: string): RenderThenable;
|
|
52
76
|
/**
|
|
53
77
|
* Warm dictionaries for `locale`, so a subsequent render reads them
|
|
54
78
|
* synchronously instead of suspending.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionaryRegistry.d.ts","sourceRoot":"","sources":["../../i18n/dictionaryRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;CAClE;AAmED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,QAW7D;AAED,8EAA8E;AAC9E,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD;AAED,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,aAAa,GAAG,SAAS,CAE3B;AAWD;;;;GAIG;A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E,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,iBAgCtE;AAiBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,EACvD,MAAM,EAAE,MAAM,QAQf;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,QAIhE;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AA8BD,uEAAuE;AACvE,wBAAgB,yBAAyB,SAQxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as y,ba as p}from"../chunk-
|
|
2
|
+
import{aa as y,ba as p}from"../chunk-57a0nqfj.js";import{ka as c,la as d,na as l}from"../chunk-5ad8era8.js";import{Ld as e,Md as i,Od as t,Pd as r,Qd as o,Rd as n,Sd as a,Td as s}from"../chunk-8r8epsef.js";import"../chunk-4dan69s4.js";export{o as setActiveLocale,r as seedDictionaries,t as preloadDictionaries,d as localeStrings,i as loadDictionary,n as getActiveLocale,e as dictionaryRegistrationMark,c as dictionaryLocales,l as dictionaryId,y as defineDictionary,s as createDictionarySink,a as __resetDictionaryRegistry,p as __gemi_dict__};
|
|
3
3
|
|
|
4
4
|
//# debugId=CD60719F76296A5B64756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as R}from"../chunk-
|
|
2
|
+
import{aa as R}from"../chunk-57a0nqfj.js";import"../chunk-5ad8era8.js";import{Qa as L}from"../chunk-q6qghsy7.js";import{Sb as E,Tb as V}from"../chunk-p3qd0gqa.js";import"../chunk-ys904esh.js";import{Zb as j}from"../chunk-hk06nhxh.js";import"../chunk-djp2xeqe.js";import"../chunk-ybqss0jy.js";import"../chunk-8r8epsef.js";import"../chunk-ds44bqr9.js";import"../chunk-1aqzcgfr.js";import"../chunk-f233yzxf.js";import"../chunk-sz051605.js";import"../chunk-mca9wsvs.js";import"../chunk-3296fwss.js";import{tf as X}from"../chunk-x6y1z4cq.js";import"../chunk-tds3xq6b.js";import"../chunk-j23cengk.js";import"../chunk-hxb1eg2z.js";import"../chunk-4dan69s4.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{V as translationConfigDefaults,N as translate,E as defineTranslationConfig,R as defineDictionary,X as Translator,L as TranslationServiceProvider,P as Dictionary};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=250C5056AA44F55964756E2164756E21
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"// The module, not the `../facades` barrel. A dictionary is the one server-side\n// artifact a *component* test has to import — `<Page dictionaries={[…]}>` takes\n// the app's real `app/i18n/index.ts` — and the barrel drags the whole facade\n// set in behind it, including `Redis` and its `import { RedisClient } from\n// \"bun\"`. Under a browser-targeted runner (vitest/jsdom) that specifier does\n// not resolve, so importing the app's dictionaries failed to collect before it\n// rendered anything. `Lang` itself only needs the translator and the request\n// context.\nimport { Lang } from \"../facades/Lang\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type {\n ParseTranslationParams,\n ParseTranslationParamsServer,\n Prettify,\n} from \"../utils/type\";\n\ntype Translations = Record<string, Record<string, string>>;\n\nexport class Dictionary<T extends Translations> {\n constructor(\n public name: string,\n public dictionary: T,\n ) {}\n\n reference(key: keyof T) {\n if (typeof window !== \"undefined\") {\n throw new Error(\"Cannot use reference in the browser\");\n }\n if (!this.dictionary?.[key]) {\n throw new Error(`Translation not found for ${String(key)}`);\n }\n return this.dictionary[key];\n }\n\n render<\n K extends keyof T,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParams<T[K][U]>>,\n >(\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n ) {\n const { locale = Lang.locale(), params } = {\n params: {},\n ...args[0],\n };\n\n if (typeof window !== \"undefined\") {\n throw new Error(\"Cannot use render in the browser\");\n }\n\n if (!this.dictionary?.[key]?.[locale]) {\n throw new Error(\n `Translation not found for ${String(key)} in ${String(locale)}`,\n );\n }\n return parseTranslation(this.dictionary[key][locale], params ?? {});\n }\n\n /**\n * @deprecated Use `defineDictionary` from `gemi/client`, declared next to the\n * component that reads it. A dictionary made here has to be re-exported from\n * `app/i18n/index.ts` and listed against a route in the `prefetch` config,\n * and every locale of it stays resident whether a page uses it or not. Still\n * supported; see `docs/i18n.md`.\n */\n static create<const T extends Translations>(name: string, translations: T) {\n return new Dictionary<T>(name, translations);\n }\n\n static text<const T extends Record<string, string>, U extends keyof T>(\n content: T,\n ...args: Prettify<ParseTranslationParamsServer<T[U]>> extends Record<\n string,\n never\n >\n ? [args?: { locale?: U | (string & {}) }]\n : [\n args: {\n locale?: U | (string & {});\n params: Prettify<ParseTranslationParamsServer<T[U]>>;\n },\n ]\n ): string {\n const { locale = Lang.locale(), params } = { params: {}, ...args?.[0] };\n\n if (!content?.[locale]) {\n throw new Error(`Translation not found for ${String(locale)}`);\n }\n\n return parseTranslation(content[locale], params ?? {});\n }\n}\n",
|
|
7
7
|
"import { Lang } from \"../facades\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type { ParseTranslationParamsServer, Prettify } from \"../utils/type\";\nimport type { DictionaryHandle } from \"./defineDictionary\";\nimport type { DictionaryTranslations } from \"./dictionaryShape\";\n\n/**\n * Read one string from a `defineDictionary` dictionary outside React — a\n * controller, a job, an email template.\n *\n * Async because a bundled dictionary loads its locale on demand. Server code\n * does not go through the bundler, so in practice this resolves without ever\n * yielding; the `await` is what makes the same call work either way.\n *\n * Kept out of `defineDictionary.ts` on purpose: that module is imported by\n * components and has to stay free of the server facades this one needs.\n */\nexport async function translate<\n T extends DictionaryTranslations,\n K extends keyof T & string,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParamsServer<T[K][U] & string>>,\n>(\n dictionary: DictionaryHandle<T>,\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n): Promise<string> {\n const { locale = Lang.locale(), params } = { params: {}, ...args[0] };\n const strings = await dictionary.load(String(locale));\n const template = strings[key];\n\n if (typeof template !== \"string\") {\n throw new Error(\n `Translation not found for \"${key}\" in \"${String(locale)}\" (dictionary ${dictionary.id})`,\n );\n }\n\n return parseTranslation(template, (params ?? {}) as any) as string;\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";4uBAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,EAAO,JAAM,HAAE,AACnC,JAAC,DACC,OAAO,IAAU,YACjB,EAAgB,EAAkC,EAAE,CAAC,CACzD,EAMM,EAAQ,kDAEd,GAAI,CAAC,EAqCH,OAnCe,EAAS,QAAQ,EAAO,CAAC,EAAO,EAAM,EAAM,IAAY,CAErE,IAAM,EAAY,EAAK,SAAS,GAAG,EAAI,EAAK,MAAM,GAAG,EAAE,GAAK,EAEtD,EAAQ,EAAO,GACrB,GAAI,IAAU,OACZ,OAAO,EAGT,GAAI,OAAO,IAAU,WAAY,CAG/B,IAAM,EAAiB,EADD,IAAY,OAAY,EAAU,EACd,EAE1C,GAAI,EAAe,CAAc,EAC/B,MAAU,MAAM,gCAAgC,EAElD,OAAO,OAAO,CAAc,EAI9B,GAAI,EACF,OAAQ,EAAK,YAAY,OAClB,SACH,OAAO,OAAO,CAAK,EAAE,SAAS,MAC3B,SACH,OAAO,OAAO,CAAK,MAChB,UACH,OAAO,QAAQ,CAAK,EAAE,SAAS,UAE/B,OAAO,OAAO,CAAK,EAGzB,OAAO,OAAO,CAAK,EACpB,EAEI,KAEL,IAAM,EAAqC,CAAC,EACxC,EAAY,EACZ,EAAgC,KAEpC,OAAQ,EAAQ,EAAM,K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,KAAO,GAC5B,MAAU,MACR,6BAA6B,OAAO,CAAG,QAAQ,OAAO,CAAM,GAC9D,EAEF,OAAO,EAAiB,KAAK,WAAW,GAAK,GAAS,GAAU,CAAC,CAAC,QAU7D,OAAoC,CAAC,EAAc,EAAiB,CACzE,OAAO,IAAI,EAAc,EAAM,CAAY,QAGtC,KAA+D,CACpE,KACG,EAWK,CACR,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,IAAO,EAAG,EAEtE,GAAI,CAAC,IAAU,GACb,MAAU,MAAM,6BAA6B,OAAO,CAAM,GAAG,EAG/D,OAAO,EAAiB,EAAQ,GAAS,GAAU,CAAC,CAAC,EAEzD,CC7EA,eAAsB,CAKrB,CACC,EACA,KACG,EAGc,CACjB,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,EAAK,EAAG,EAE9D,GADU,MAAM,EAAW,KAAK,OAAO,CAAM,CAAC,GAC3B,GAEzB,GAAI,OAAO,IAAa,SACtB,MAAU,MACR,8BAA8B,UAAY,OAAO,CAAM,kBAAkB,EAAW,KACtF,EAGF,OAAO,EAAiB,EAAW,GAAU,CAAC,CAAS",
|
|
10
|
+
"debugId": "250C5056AA44F55964756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/kernel/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sa as Y}from"../chunk-
|
|
2
|
+
import{sa as Y}from"../chunk-cf7bvd12.js";import{Pa as M}from"../chunk-tr3cbx8k.js";import{Qa as Z}from"../chunk-q6qghsy7.js";import{$a as $,Ta as J,Ua as X,Va as _,ab as E,cb as T,db as V,eb as y,fb as F,ib as K,jb as L,mb as Q,nb as U,ub as B,xb as D,yb as I}from"../chunk-kac5vmvn.js";import{Bb as R}from"../chunk-b0t4zp6b.js";import"../chunk-p3qd0gqa.js";import"../chunk-ys904esh.js";import{Bc as m,Cc as k,Wb as f}from"../chunk-hk06nhxh.js";import"../chunk-djp2xeqe.js";import"../chunk-ybqss0jy.js";import"../chunk-8r8epsef.js";import{ne as h}from"../chunk-ds44bqr9.js";import{Ce as b}from"../chunk-1aqzcgfr.js";import"../chunk-f233yzxf.js";import"../chunk-sz051605.js";import"../chunk-mca9wsvs.js";import"../chunk-3296fwss.js";import"../chunk-5gdv4n4a.js";import"../chunk-x6y1z4cq.js";import{uf as H,wf as x}from"../chunk-tds3xq6b.js";import"../chunk-j23cengk.js";import"../chunk-hxb1eg2z.js";import"../chunk-4dan69s4.js";var G=[F,L,Y,$,I,X,E,K,V,U,T,D,Q,y,Z,B,_];class w{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new x;boot(){if(this.models.length>0)M(...this.models);else A();this.app.config.merge(this.config),x.setInstance(this.app),this.app.registerMany([...G,...this.providers]),this.registerServices()}registerServices(){let q=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let N=new Map;for(let z of this.services){let C=typeof z==="function"?new z:z,j=C.constructor;if(!j.token)throw Error(`Service [${j.name}] is listed in \`services\` but does not declare a \`static token\`.`);let O=N.get(j.token);if(O)throw Error(`Services [${O}] and [${j.name}] both declare the token "${j.token}". Tokens are the container's keys, so they must be unique.`);N.set(j.token,j.name);let W=j;if(!q.has(j.token)&&this.app.bound(W))throw Error(`Service [${j.name}] declares the token "${j.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(W,C),this.serviceInstances.push(C),this.serviceTokens.add(j.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices()}async bootServices(){if(this.servicesBooted)return;for(let q of this.serviceInstances)await q.boot();this.servicesBooted=!0}run(q){return H.run(this.app,q)}resolve(q){return this.app.make(q)}apiRoutes(){return this.app.make(k)}viewRoutes(){return this.app.make(m)}broadcast(){return this.app.make(f)}queue(){return this.app.make(R)}destroy(){if(this.app.resolved(J))this.app.make(J).stop();if(this.app.flush(),x.getInstance()===this.app)x.setInstance(void 0);H.disable()}}function A(){if(Bun.env.NODE_ENV==="production")return;let q=b();if(q.length===0)return;console.warn(`[gemi] ${q.length} model${q.length===1?" is":"s are"} registered, but Kernel.models is empty.
|
|
3
3
|
Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
|
|
4
4
|
`+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
|
|
5
5
|
to notice it. Declaring the modules registers each class under its own name and audits the set:
|
|
@@ -13,4 +13,4 @@ import{sa as Y}from"../chunk-3gvjn3q4.js";import{Pa as M}from"../chunk-2cwcfwg3.
|
|
|
13
13
|
|
|
14
14
|
See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{G as frameworkProviders,h as UserProvider,w as Kernel};
|
|
15
15
|
|
|
16
|
-
//# debugId=
|
|
16
|
+
//# debugId=C5639D5E3AF66AC964756E2164756E21
|
package/dist/kernel/index.js.map
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"import type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport { AuthServiceProvider } from \"../auth/AuthServiceProvider\";\nimport { DatabaseServiceProvider } from \"../database/DatabaseServiceProvider\";\nimport { TranslationServiceProvider } from \"../i18n/TranslationServiceProvider\";\nimport { ScheduleServiceProvider } from \"../services/cron/ScheduleServiceProvider\";\nimport { FeaturesServiceProvider } from \"../services/features/FeaturesServiceProvider\";\nimport { MailServiceProvider } from \"../services/email/MailServiceProvider\";\nimport { EventServiceProvider } from \"../services/events/EventServiceProvider\";\nimport { FilesystemServiceProvider } from \"../services/file-storage/FilesystemServiceProvider\";\nimport { ImageServiceProvider } from \"../services/image-optimization/ImageServiceProvider\";\nimport { KernelIdServiceProvider } from \"../services/kernel-id/KernelIdServiceProvider\";\nimport { LogServiceProvider } from \"../services/logging/LogServiceProvider\";\nimport { MiddlewareServiceProvider } from \"../services/middleware/MiddlewareServiceProvider\";\nimport { BroadcastServiceProvider } from \"../services/pubsub/BroadcastServiceProvider\";\nimport { QueueServiceProvider } from \"../services/queue/QueueServiceProvider\";\nimport { RateLimiterServiceProvider } from \"../services/rate-limiter/RateLimiterServiceProvider\";\nimport { RedisServiceProvider } from \"../services/redis/RedisServiceProvider\";\nimport { RouteServiceProvider } from \"../services/router/RouteServiceProvider\";\n\n/**\n * The providers every gemi app boots with, in registration order. Seventeen\n * providers for eighteen services — `RouteServiceProvider` owns both the api\n * and the view dispatcher, the way Laravel's does.\n *\n * Order only matters for `boot()`; `register()` binds factories and resolves\n * nothing, so no provider here depends on an earlier one having run — with one\n * exception, which is the reason to read this before reordering anything.\n *\n * **`EventServiceProvider` must stay after `QueueServiceProvider`.** A queued\n * listener is registered with the queue as a synthetic job, and\n * `EventServiceProvider.boot()` is what hands those over. `QueueManager.useJobs`\n * — which `QueueServiceProvider.boot()` calls with whatever it discovered under\n * `app/jobs` — *replaces* the registry (`this.jobs = {}`). Move the events\n * provider up and the two boots run in the order that discards: every\n * `listener:*` entry is registered and then thrown away. Nothing errors, boot\n * succeeds, and each queued dispatch afterwards lands on `next()`'s \"Dropped a\n * queued job: nothing is registered under the name listener:SendWelcomeEmail\",\n * long after `dispatch` returned to a caller that cannot hear it.\n */\nexport const frameworkProviders: ServiceProviderConstructor[] = [\n KernelIdServiceProvider,\n MiddlewareServiceProvider,\n DatabaseServiceProvider,\n // After the database, whose `boot()` its cache warm-up depends on, and before\n // the route dispatchers, which evaluate flags on every view request.\n FeaturesServiceProvider,\n RouteServiceProvider,\n AuthServiceProvider,\n MailServiceProvider,\n LogServiceProvider,\n FilesystemServiceProvider,\n QueueServiceProvider,\n EventServiceProvider,\n RedisServiceProvider,\n BroadcastServiceProvider,\n ImageServiceProvider,\n TranslationServiceProvider,\n RateLimiterServiceProvider,\n ScheduleServiceProvider,\n];\n",
|
|
6
6
|
"import { Application } from \"../foundation/Application\";\nimport type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport type { ServiceToken } from \"../container/Container\";\nimport type { ConfigItems } from \"../support/Repository\";\nimport type { Service, ServiceConstructor } from \"../support/Service\";\nimport { registerModels } from \"../orm/registration\";\nimport { registeredNames } from \"../orm/registry\";\nimport { Scheduler } from \"../services/cron/Scheduler\";\nimport { BroadcastManager } from \"../services/pubsub/BroadcastManager\";\nimport { QueueManager } from \"../services/queue/QueueManager\";\nimport { ApiRouteDispatcher } from \"../services/router/ApiRouteDispatcher\";\nimport { ViewRouteDispatcher } from \"../services/router/ViewRouteDispatcher\";\nimport { kernelContext } from \"./context\";\nimport { frameworkProviders } from \"./providers\";\n\n/**\n * The app's entry point into the framework. A Kernel subclass declares what the\n * app adds — its `config` slices and any extra `providers` — and everything\n * else lives in the Application container it owns.\n */\nexport class Kernel {\n /**\n * App-level config, merged over the framework defaults. Each key is a config\n * slice: `{ mail: { ... }, route: { ... } }`, normally the modules under\n * `app/config`.\n */\n protected config: ConfigItems = {};\n\n /**\n * App-level providers, registered after the framework's own so they can\n * rebind anything the framework bound.\n */\n protected providers: ServiceProviderConstructor[] = [];\n\n /**\n * The app's own singleton services. Each is constructed during the\n * synchronous boot phase and its `boot()` awaited during the asynchronous\n * one, in the order listed — so a service whose `boot()` depends on another\n * goes after it.\n *\n * An entry is either the class itself or a configured instance from\n * `Service.with({ ... })`. Listing is explicit rather than discovered because\n * the order is load-bearing here, and because a service is always imported by\n * whatever injects it — there is no file the import graph would miss.\n */\n protected services: Array<ServiceConstructor | Service> = [];\n\n private serviceInstances: Service[] = [];\n private serviceTokens = new Set<string>();\n private servicesBooted = false;\n\n /**\n * The modules holding the app's model classes — normally\n * `[generated, models]`, the generated namespace and the barrel of subclasses\n * written over it. Every model class they export is registered under the name\n * its schema carries, later modules winning, and the whole set is audited\n * before anything else boots.\n *\n * ### Why this is a Kernel field and not a line in a file somewhere\n *\n * Registration used to be `register(\"User\", User)` next to each subclass, and\n * the failure mode of forgetting it is an authorization hole that nothing\n * reports: a relation read resolves its target by name, so an unregistered\n * policied subclass leaves the generated base owning the name and every\n * nested `include` of that model comes back unscoped. No error at the root\n * either, because `$exec`'s divergence guard begins `registered !== this` and\n * the base it is running on *is* the registered one. A model only ever read\n * through an include — a membership, a pivot, the kind that carries a tenant\n * scope — never trips anything.\n *\n * Listing the modules here says it once, in the same place the app already\n * declares its config slices and providers, and turns the mistake into a\n * failure to boot rather than a quiet cross-tenant read.\n *\n * It sees the modules it is given, so a model class in a file that no barrel\n * re-exports is still invisible. That is the residual, and it is a smaller\n * one: a barrel is a place to notice an omission, and thirteen `register`\n * lines scattered across thirteen files is not.\n */\n protected models: Array<Record<string, unknown>> = [];\n\n readonly app = new Application();\n\n /**\n * Phase one, synchronous: every provider is constructed and its `register()`\n * runs. Only bindings are recorded here — no service is instantiated, so this\n * is safe to call from a synchronous constructor (`new App({ kernel })`).\n * Phase two is `waitForBoot()`.\n */\n boot() {\n // Before the container, deliberately. This throws on a model whose policies\n // would be skipped, and the useful moment for that is the one where nothing\n // has been constructed and no request can be in flight.\n if (this.models.length > 0) registerModels(...this.models);\n else warnIfModelsAreRegisteredButUndeclared();\n\n this.app.config.merge(this.config);\n Application.setInstance(this.app);\n this.app.registerMany([...frameworkProviders, ...this.providers]);\n this.registerServices();\n }\n\n /**\n * Constructs every listed service and binds it into the container. Runs after\n * the providers have registered, so a provider's `boot()` can `inject()` one;\n * a `Service` constructor does no I/O, so doing this synchronously costs\n * nothing beyond the field initializers.\n */\n private registerServices() {\n // What a previous pass bound, so re-running this on the same kernel is not\n // mistaken for a collision with something else.\n const ours = this.serviceTokens;\n\n this.serviceInstances = [];\n this.serviceTokens = new Set();\n this.servicesBooted = false;\n\n const owners = new Map<string, string>();\n\n for (const declaration of this.services) {\n const instance =\n typeof declaration === \"function\" ? new declaration() : declaration;\n const ctor = instance.constructor as ServiceConstructor;\n\n if (!ctor.token) {\n throw new Error(\n `Service [${ctor.name}] is listed in \\`services\\` but does not declare a \\`static token\\`.`,\n );\n }\n\n // Two services under one token is the failure this refuses to have\n // silently: the second would replace the first in the container, and\n // every `inject()` written against either would hand back whichever was\n // listed last.\n const owner = owners.get(ctor.token);\n if (owner) {\n throw new Error(\n `Services [${owner}] and [${ctor.name}] both declare the token \"${ctor.token}\". Tokens are the container's keys, so they must be unique.`,\n );\n }\n owners.set(ctor.token, ctor.name);\n\n // The same failure one level out. `Container.instance()` writes into\n // `instances`, which `make()` consults before `bindings`, so a token that\n // is already spoken for is not shared with its owner — it replaces it, for\n // every `app()` and `inject()` in the process. An app service that named\n // itself \"mail\" would leave `Mail.send()` resolving to an object with no\n // `send`, and the boot that caused it would report nothing. Providers have\n // all registered by now, so anything bound here belongs to somebody else.\n const token = ctor as unknown as ServiceToken<Service>;\n if (!ours.has(ctor.token) && this.app.bound(token)) {\n throw new Error(\n `Service [${ctor.name}] declares the token \"${ctor.token}\", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`,\n );\n }\n\n this.app.instance(token, instance);\n this.serviceInstances.push(instance);\n this.serviceTokens.add(ctor.token);\n }\n }\n\n /**\n * Phase two, asynchronous: every provider's `boot()` runs, in registration\n * order, after all of them have registered. Idempotent.\n */\n async waitForBoot() {\n await this.app.boot();\n await this.bootServices();\n }\n\n /**\n * Phase two for services, after every provider's `boot()` — so a service may\n * use the facades and anything else a provider owns. Idempotent, like the\n * provider phase it follows.\n */\n private async bootServices() {\n if (this.servicesBooted) {\n return;\n }\n for (const service of this.serviceInstances) {\n await service.boot();\n }\n this.servicesBooted = true;\n }\n\n run<T>(cb: () => T) {\n return kernelContext.run(this.app, cb);\n }\n\n /**\n * Resolve a service by token. Callers outside this module should prefer the\n * named accessors below or `app()`; this exists for tooling that holds a\n * Kernel but no ambient context.\n */\n resolve<T>(token: ServiceToken<T>): T {\n return this.app.make(token);\n }\n\n // Named accessors. `app/App.ts` goes through these rather than importing the\n // service classes itself — see the note in that file about the two copies of\n // gemi that coexist at build time.\n apiRoutes(): ApiRouteDispatcher {\n return this.app.make(ApiRouteDispatcher);\n }\n\n viewRoutes(): ViewRouteDispatcher {\n return this.app.make(ViewRouteDispatcher);\n }\n\n broadcast(): BroadcastManager {\n return this.app.make(BroadcastManager);\n }\n\n queue(): QueueManager {\n return this.app.make(QueueManager);\n }\n\n destroy() {\n // Only touch services that were actually resolved — resolving one here\n // would construct it purely to tear it down.\n if (this.app.resolved(Scheduler)) {\n this.app.make(Scheduler).stop();\n }\n\n this.app.flush();\n\n if (Application.getInstance() === this.app) {\n Application.setInstance(undefined);\n }\n\n kernelContext.disable();\n }\n}\n\n/**\n * Says something to an application that has models and has not declared them.\n *\n * Without this the fix for #316 defaults to off. `models` is `[]`, `boot()`\n * no-ops, and an app upgrading from 0.48 is in exactly the state the issue\n * describes until somebody edits their Kernel by hand — while the only place\n * that says to is the **Setup** section of `docs/orm.md`, which an existing app\n * read once and will not read again. #316 was filed by an app mid-migration\n * with a 79-model schema, which is precisely the reader who never sees it.\n *\n * The condition is what makes this worth printing. A populated registry with an\n * empty `models` means the generated `index.ts` was imported and its bases are\n * what every nested read resolves to — so if any policy lives on a subclass, it\n * is being skipped inside includes right now. A Kernel with no ORM at all has\n * an empty registry and hears nothing.\n *\n * Development only, and a warning rather than a throw: an app in this state is\n * running today, and turning a working deploy into a failure to start over an\n * arrangement that *might* be fine is not a patch-level thing to do. The\n * failure it points at is silent, so the fix for it has to be noisy somewhere,\n * and the terminal an author is already looking at is the cheapest somewhere\n * there is.\n */\nfunction warnIfModelsAreRegisteredButUndeclared(): void {\n if (process.env.NODE_ENV === \"production\") return;\n\n const registered = registeredNames();\n if (registered.length === 0) return;\n\n console.warn(\n `[gemi] ${registered.length} model${registered.length === 1 ? \" is\" : \"s are\"} ` +\n `registered, but Kernel.models is empty.\\n` +\n ` Nested relation reads resolve a model by name, so a policy on a ` +\n `subclass that does not own its\\n` +\n ` name is skipped inside every include — scoped at the root, ` +\n `unscoped in an include, with nothing\\n` +\n ` to notice it. Declaring the modules registers each class under ` +\n `its own name and audits the set:\\n\\n` +\n ` import * as generated from \"../models/generated\"\\n` +\n ` import * as models from \"../models\"\\n\\n` +\n ` export default class extends Kernel {\\n` +\n ` models = [generated, models]\\n` +\n ` }\\n\\n` +\n ` See docs/orm.md#your-model-class. Development only; this never ` +\n `prints in production.`,\n );\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";8gCAuCO,DAAM,HAAmD,JAC9D,HACA,HACA,HAGA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,JACF,HCvCO,CAAM,CAAO,CAMR,OAAsB,CAAC,EAMvB,UAA0C,CAAC,EAa3C,SAAgD,CAAC,EAEnD,iBAA8B,CAAC,EAC/B,cAAgB,IAAI,IACpB,eAAiB,GA8Bf,OAAyC,CAAC,EAE3C,IAAM,IAAI,EAQnB,IAAI,EAAG,CAIL,GAAI,KAAK,OAAO,OAAS,EAAG,EAAe,GAAG,KAAK,MAAM,EACpD,OAAuC,EAE5C,KAAK,IAAI,OAAO,MAAM,KAAK,MAAM,EACjC,EAAY,YAAY,KAAK,GAAG,EAChC,KAAK,IAAI,aAAa,CAAC,GAAG,EAAoB,GAAG,KAAK,SAAS,CAAC,EAChE,KAAK,iBAAiB,EAShB,gBAAgB,EAAG,CAGzB,IAAM,EAAO,KAAK,cAElB,KAAK,iBAAmB,CAAC,EACzB,KAAK,cAAgB,IAAI,IACzB,KAAK,eAAiB,GAEtB,IAAM,EAAS,IAAI,IAEnB,QAAW,KAAe,KAAK,SAAU,CACvC,IAAM,EACJ,OAAO,IAAgB,WAAa,IAAI,EAAgB,EACpD,EAAO,EAAS,YAEtB,GAAI,CAAC,EAAK,MACR,MAAU,MACR,YAAY,EAAK,0EACnB,EAOF,IAAM,EAAQ,EAAO,IAAI,EAAK,KAAK,EACnC,GAAI,EACF,MAAU,MACR,aAAa,WAAe,EAAK,iCAAiC,EAAK,kEACzE,EAEF,EAAO,IAAI,EAAK,MAAO,EAAK,IAAI,EAShC,IAAM,EAAQ,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