gemi 0.56.0 → 0.58.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/app/index.js +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-jdj7k3r9.js → chunk-0a2xgcj3.js} +2 -2
- package/dist/{chunk-jdj7k3r9.js.map → chunk-0a2xgcj3.js.map} +1 -1
- package/dist/{chunk-3e88tyee.js → chunk-3337e5g0.js} +2 -2
- package/dist/{chunk-3e88tyee.js.map → chunk-3337e5g0.js.map} +1 -1
- package/dist/chunk-3aa287k7.js +6 -0
- package/dist/{chunk-cv9w5cmb.js.map → chunk-3aa287k7.js.map} +2 -2
- package/dist/{chunk-01am9k5v.js → chunk-3g5bjvdf.js} +2 -2
- package/dist/{chunk-01am9k5v.js.map → chunk-3g5bjvdf.js.map} +1 -1
- package/dist/{chunk-w9k9s4wh.js → chunk-3xadx444.js} +2 -2
- package/dist/{chunk-w9k9s4wh.js.map → chunk-3xadx444.js.map} +1 -1
- package/dist/{chunk-npg72mez.js → chunk-3zxwscmf.js} +2 -2
- package/dist/{chunk-kgmr9qxx.js.map → chunk-3zxwscmf.js.map} +1 -1
- package/dist/{chunk-64s1pzz1.js → chunk-437085pe.js} +2 -2
- package/dist/{chunk-64s1pzz1.js.map → chunk-437085pe.js.map} +1 -1
- package/dist/{chunk-eqrd31ye.js → chunk-4yt5x8s2.js} +2 -2
- package/dist/{chunk-eqrd31ye.js.map → chunk-4yt5x8s2.js.map} +1 -1
- package/dist/{chunk-9r0sb4zn.js → chunk-5athahgr.js} +2 -2
- package/dist/{chunk-9r0sb4zn.js.map → chunk-5athahgr.js.map} +1 -1
- package/dist/{chunk-g30q4n5y.js → chunk-5n2rvfh3.js} +2 -2
- package/dist/{chunk-g30q4n5y.js.map → chunk-5n2rvfh3.js.map} +1 -1
- package/dist/{chunk-1zfsgffv.js → chunk-6235kb30.js} +3 -3
- package/dist/{chunk-1zfsgffv.js.map → chunk-6235kb30.js.map} +1 -1
- package/dist/{chunk-javjeayw.js → chunk-7b0x860b.js} +2 -2
- package/dist/{chunk-javjeayw.js.map → chunk-7b0x860b.js.map} +1 -1
- package/dist/{chunk-4qwwy968.js → chunk-7ef5n8k2.js} +2 -2
- package/dist/{chunk-4qwwy968.js.map → chunk-7ef5n8k2.js.map} +1 -1
- package/dist/{chunk-q0waxxz5.js → chunk-7j6wbv12.js} +2 -2
- package/dist/{chunk-q0waxxz5.js.map → chunk-7j6wbv12.js.map} +1 -1
- package/dist/chunk-86jebsm4.js +9 -0
- package/dist/{chunk-kry5vwam.js.map → chunk-86jebsm4.js.map} +3 -3
- package/dist/chunk-87qab82w.js +5 -0
- package/dist/chunk-87qab82w.js.map +37 -0
- package/dist/{chunk-36pg61vt.js → chunk-8gew8b9a.js} +2 -2
- package/dist/{chunk-36pg61vt.js.map → chunk-8gew8b9a.js.map} +1 -1
- package/dist/{chunk-v6v6sem5.js → chunk-9m2tbf3n.js} +2 -2
- package/dist/{chunk-v6v6sem5.js.map → chunk-9m2tbf3n.js.map} +1 -1
- package/dist/{chunk-gzdf2025.js → chunk-a2sgjpvq.js} +2 -2
- package/dist/{chunk-gzdf2025.js.map → chunk-a2sgjpvq.js.map} +1 -1
- package/dist/chunk-b35e128b.js +5 -0
- package/dist/{chunk-b50zmz3t.js.map → chunk-b35e128b.js.map} +1 -1
- package/dist/{chunk-ct274qts.js → chunk-cyaz97p5.js} +2 -2
- package/dist/{chunk-ct274qts.js.map → chunk-cyaz97p5.js.map} +1 -1
- package/dist/{chunk-v06qcyj5.js → chunk-d125j8t0.js} +3 -3
- package/dist/{chunk-v06qcyj5.js.map → chunk-d125j8t0.js.map} +1 -1
- package/dist/{chunk-hs5v3eqj.js → chunk-dgsgjg53.js} +2 -2
- package/dist/{chunk-hs5v3eqj.js.map → chunk-dgsgjg53.js.map} +1 -1
- package/dist/{chunk-xjy5apyr.js → chunk-eejmhtnc.js} +2 -2
- package/dist/{chunk-xjy5apyr.js.map → chunk-eejmhtnc.js.map} +1 -1
- package/dist/{chunk-3y75q5a2.js → chunk-fjm4y8bn.js} +2 -2
- package/dist/{chunk-3y75q5a2.js.map → chunk-fjm4y8bn.js.map} +1 -1
- package/dist/{chunk-9c89q2mz.js → chunk-grdahng8.js} +2 -2
- package/dist/{chunk-9c89q2mz.js.map → chunk-grdahng8.js.map} +1 -1
- package/dist/{chunk-699z6d8y.js → chunk-gw6agevz.js} +3 -3
- package/dist/{chunk-699z6d8y.js.map → chunk-gw6agevz.js.map} +1 -1
- package/dist/{chunk-62ke19q4.js → chunk-hppagzz4.js} +4 -4
- package/dist/{chunk-62ke19q4.js.map → chunk-hppagzz4.js.map} +1 -1
- package/dist/chunk-hwa5sqw5.js +19 -0
- package/dist/{chunk-tmnhkphv.js.map → chunk-hwa5sqw5.js.map} +12 -6
- package/dist/chunk-hxf1re93.js +4 -0
- package/dist/{chunk-vkngcrzq.js.map → chunk-hxf1re93.js.map} +6 -5
- package/dist/{chunk-d36dfqxw.js → chunk-j0c6ytkj.js} +3 -3
- package/dist/{chunk-d36dfqxw.js.map → chunk-j0c6ytkj.js.map} +1 -1
- package/dist/{chunk-kgmr9qxx.js → chunk-jhkjz9jr.js} +2 -2
- package/dist/{chunk-npg72mez.js.map → chunk-jhkjz9jr.js.map} +1 -1
- package/dist/{chunk-62723jyy.js → chunk-k0fvsyeh.js} +1 -1
- package/dist/{chunk-31kcf7dq.js → chunk-keehyx51.js} +2 -2
- package/dist/{chunk-31kcf7dq.js.map → chunk-keehyx51.js.map} +1 -1
- package/dist/{chunk-enhkf60v.js → chunk-m3xy5xyf.js} +2 -2
- package/dist/{chunk-enhkf60v.js.map → chunk-m3xy5xyf.js.map} +1 -1
- package/dist/{chunk-c75mymmq.js → chunk-mkfpnymy.js} +1 -1
- package/dist/{chunk-rgb69nh1.js → chunk-mwpdp09e.js} +2 -2
- package/dist/{chunk-rgb69nh1.js.map → chunk-mwpdp09e.js.map} +1 -1
- package/dist/chunk-pmhd6zfc.js +37 -0
- package/dist/chunk-pmhd6zfc.js.map +20 -0
- package/dist/chunk-qb5mv6pj.js +5 -0
- package/dist/chunk-qb5mv6pj.js.map +12 -0
- package/dist/{chunk-1pwwrpa3.js → chunk-qgxr0g36.js} +2 -2
- package/dist/{chunk-1pwwrpa3.js.map → chunk-qgxr0g36.js.map} +1 -1
- package/dist/{chunk-4yafsffx.js → chunk-sy7jbdeb.js} +2 -2
- package/dist/{chunk-4yafsffx.js.map → chunk-sy7jbdeb.js.map} +1 -1
- package/dist/{chunk-gasdfwva.js → chunk-szss069z.js} +2 -2
- package/dist/{chunk-gasdfwva.js.map → chunk-szss069z.js.map} +1 -1
- package/dist/{chunk-m0ggfy1m.js → chunk-tss5svjr.js} +2 -2
- package/dist/{chunk-m0ggfy1m.js.map → chunk-tss5svjr.js.map} +1 -1
- package/dist/{chunk-dzzmqv0j.js → chunk-vr90r27j.js} +2 -2
- package/dist/{chunk-dzzmqv0j.js.map → chunk-vr90r27j.js.map} +1 -1
- package/dist/{chunk-pvdbrt4z.js → chunk-w62m5f0n.js} +3 -3
- package/dist/{chunk-pvdbrt4z.js.map → chunk-w62m5f0n.js.map} +1 -1
- package/dist/{chunk-cn2r5jfj.js → chunk-w7rf99w6.js} +2 -2
- package/dist/{chunk-cn2r5jfj.js.map → chunk-w7rf99w6.js.map} +1 -1
- package/dist/{chunk-tja0c815.js → chunk-wbrj0gya.js} +2 -2
- package/dist/{chunk-tja0c815.js.map → chunk-wbrj0gya.js.map} +1 -1
- package/dist/{chunk-rsdg619q.js → chunk-xdv1b8mr.js} +2 -2
- package/dist/{chunk-rsdg619q.js.map → chunk-xdv1b8mr.js.map} +1 -1
- package/dist/{chunk-h3mwgbg7.js → chunk-xey9cbap.js} +2 -2
- package/dist/{chunk-h3mwgbg7.js.map → chunk-xey9cbap.js.map} +1 -1
- package/dist/{chunk-wgpa04jb.js → chunk-xzk827r3.js} +2 -2
- package/dist/{chunk-wgpa04jb.js.map → chunk-xzk827r3.js.map} +1 -1
- package/dist/{chunk-x14sk95v.js → chunk-y6a8r2bn.js} +3 -3
- package/dist/{chunk-x14sk95v.js.map → chunk-y6a8r2bn.js.map} +1 -1
- package/dist/{chunk-33wjsw4r.js → chunk-yed5whgs.js} +3 -3
- package/dist/{chunk-33wjsw4r.js.map → chunk-yed5whgs.js.map} +1 -1
- package/dist/{chunk-02gdzs5t.js → chunk-yf7vz71n.js} +1 -1
- package/dist/{chunk-y9fp58bg.js → chunk-yjzs247s.js} +2 -2
- package/dist/{chunk-y9fp58bg.js.map → chunk-yjzs247s.js.map} +1 -1
- package/dist/{chunk-kgg1eqne.js → chunk-yy0eb9wn.js} +2 -2
- package/dist/{chunk-kgg1eqne.js.map → chunk-yy0eb9wn.js.map} +1 -1
- package/dist/{chunk-4xx78ba9.js → chunk-zbxgbr12.js} +2 -2
- package/dist/{chunk-4xx78ba9.js.map → chunk-zbxgbr12.js.map} +1 -1
- package/dist/{chunk-8k1zqrvh.js → chunk-zh2egcyb.js} +2 -2
- package/dist/{chunk-8k1zqrvh.js.map → chunk-zh2egcyb.js.map} +1 -1
- package/dist/chunks/ThemeProvider-li1J_igh.js.map +1 -1
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/ProgressManager.d.ts +1 -1
- package/dist/client/RouteStateContext.d.ts +9 -0
- package/dist/client/RouteStateContext.d.ts.map +1 -1
- package/dist/client/ServerDataProvider.d.ts +7 -0
- package/dist/client/ServerDataProvider.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +68 -10
- package/dist/client/index.js.map +1 -1
- package/dist/client/rpc.d.ts +42 -0
- package/dist/client/rpc.d.ts.map +1 -1
- package/dist/client/useFeature.d.ts +40 -0
- package/dist/client/useFeature.d.ts.map +1 -0
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Features.d.ts +57 -0
- package/dist/facades/Features.d.ts.map +1 -0
- package/dist/facades/index.d.ts +1 -0
- package/dist/facades/index.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/gemi.d.ts +13 -5
- package/dist/http/ApiRouter.d.ts +3 -2
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/HttpRequest.d.ts +4 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/ViewRouter.d.ts +127 -4
- package/dist/http/ViewRouter.d.ts.map +1 -1
- package/dist/http/index.d.ts +1 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/http/middlewareList.d.ts +25 -0
- package/dist/http/middlewareList.d.ts.map +1 -0
- package/dist/http/requestContext.d.ts +57 -0
- package/dist/http/requestContext.d.ts.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/ide/typescript-plugin/index.js +1206 -0
- package/dist/ide/typescript-plugin/index.js.map +17 -0
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +3 -3
- package/dist/kernel/providers.d.ts +16 -4
- package/dist/kernel/providers.d.ts.map +1 -1
- package/dist/orm/context.d.ts +65 -0
- package/dist/orm/context.d.ts.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/discovery.d.ts +27 -0
- package/dist/services/discovery.d.ts.map +1 -1
- package/dist/services/events/Event.d.ts +208 -0
- package/dist/services/events/Event.d.ts.map +1 -0
- package/dist/services/events/EventManager.d.ts +285 -0
- package/dist/services/events/EventManager.d.ts.map +1 -0
- package/dist/services/events/EventServiceProvider.d.ts +46 -0
- package/dist/services/events/EventServiceProvider.d.ts.map +1 -0
- package/dist/services/events/FakeEventManager.d.ts +155 -0
- package/dist/services/events/FakeEventManager.d.ts.map +1 -0
- package/dist/services/events/FakeEventManager.test-d.d.ts +2 -0
- package/dist/services/events/FakeEventManager.test-d.d.ts.map +1 -0
- package/dist/services/events/Listener.d.ts +189 -0
- package/dist/services/events/Listener.d.ts.map +1 -0
- package/dist/services/events/Listener.test-d.d.ts +2 -0
- package/dist/services/events/Listener.test-d.d.ts.map +1 -0
- package/dist/services/events/config.d.ts +55 -0
- package/dist/services/events/config.d.ts.map +1 -0
- package/dist/services/events/listenerJob.d.ts +43 -0
- package/dist/services/events/listenerJob.d.ts.map +1 -0
- package/dist/services/features/FeatureFlagStore.d.ts +60 -0
- package/dist/services/features/FeatureFlagStore.d.ts.map +1 -0
- package/dist/services/features/FeatureManager.d.ts +82 -0
- package/dist/services/features/FeatureManager.d.ts.map +1 -0
- package/dist/services/features/FeaturesServiceProvider.d.ts +6 -0
- package/dist/services/features/FeaturesServiceProvider.d.ts.map +1 -0
- package/dist/services/features/bucket.d.ts +57 -0
- package/dist/services/features/bucket.d.ts.map +1 -0
- package/dist/services/features/config.d.ts +57 -0
- package/dist/services/features/config.d.ts.map +1 -0
- package/dist/services/features/context.d.ts +31 -0
- package/dist/services/features/context.d.ts.map +1 -0
- package/dist/services/features/defineFeature.d.ts +145 -0
- package/dist/services/features/defineFeature.d.ts.map +1 -0
- package/dist/services/features/evaluate.d.ts +74 -0
- package/dist/services/features/evaluate.d.ts.map +1 -0
- package/dist/services/features/sources/DatabaseFeatureFlagSource.d.ts +19 -0
- package/dist/services/features/sources/DatabaseFeatureFlagSource.d.ts.map +1 -0
- package/dist/services/features/sources/FeatureFlagSource.d.ts +30 -0
- package/dist/services/features/sources/FeatureFlagSource.d.ts.map +1 -0
- package/dist/services/features/sources/StaticFeatureFlagSource.d.ts +24 -0
- package/dist/services/features/sources/StaticFeatureFlagSource.d.ts.map +1 -0
- package/dist/services/features/types.d.ts +63 -0
- package/dist/services/features/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +18 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +8 -8
- package/dist/services/index.js.map +8 -4
- package/dist/services/queue/QueueManager.d.ts +31 -0
- package/dist/services/queue/QueueManager.d.ts.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts +8 -0
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/createFlatViewRoutes.d.ts +14 -0
- package/dist/services/router/createFlatViewRoutes.d.ts.map +1 -1
- package/dist/services/router/streamQueryInjection.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/Page.d.ts +12 -0
- package/dist/testing/Page.d.ts.map +1 -1
- package/dist/testing/index.d.ts +24 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +7 -3
- package/dist/testing/index.js.map +1 -1
- package/ide/typescript-plugin/package.json +5 -0
- package/package.json +4 -2
- package/dist/chunk-4t80js0n.js +0 -33
- package/dist/chunk-4t80js0n.js.map +0 -18
- package/dist/chunk-98a576s9.js +0 -5
- package/dist/chunk-98a576s9.js.map +0 -30
- package/dist/chunk-b50zmz3t.js +0 -5
- package/dist/chunk-cv9w5cmb.js +0 -6
- package/dist/chunk-f9mfw82d.js +0 -5
- package/dist/chunk-f9mfw82d.js.map +0 -12
- package/dist/chunk-kry5vwam.js +0 -9
- package/dist/chunk-tmnhkphv.js +0 -19
- package/dist/chunk-vkngcrzq.js +0 -4
- /package/dist/{chunk-62723jyy.js.map → chunk-k0fvsyeh.js.map} +0 -0
- /package/dist/{chunk-c75mymmq.js.map → chunk-mkfpnymy.js.map} +0 -0
- /package/dist/{chunk-02gdzs5t.js.map → chunk-yf7vz71n.js.map} +0 -0
|
@@ -2,6 +2,8 @@ import type { RemoveGroupPrefix } from "../client/types";
|
|
|
2
2
|
import type { KeyAndValue, KeyAndValueToObject } from "../internal/type-utils";
|
|
3
3
|
import type { Controller } from "./Controller";
|
|
4
4
|
import type { HttpRequest } from "./HttpRequest";
|
|
5
|
+
import type { FeatureKey } from "../client/rpc";
|
|
6
|
+
import { type MiddlewareInput } from "./middlewareList";
|
|
5
7
|
type ControllerMethods<T extends new () => Controller> = {
|
|
6
8
|
[K in keyof InstanceType<T>]: InstanceType<T>[K] extends Function ? K : never;
|
|
7
9
|
}[keyof InstanceType<T>];
|
|
@@ -20,10 +22,40 @@ export declare class RedirectRoute<Input, Output, Params> {
|
|
|
20
22
|
kind: "redirect";
|
|
21
23
|
viewPath: string;
|
|
22
24
|
middlewares: string[];
|
|
25
|
+
featureGates: string[];
|
|
23
26
|
private handler;
|
|
24
27
|
constructor(handler?: CallbackHandler<Input, RedirectOutput, Params> | [new () => Controller, ControllerMethods<any>]);
|
|
25
28
|
run(req: HttpRequest<Input, Params>, path: string): Promise<{}>;
|
|
26
|
-
middleware(middlewares:
|
|
29
|
+
middleware(middlewares: MiddlewareInput): this;
|
|
30
|
+
/**
|
|
31
|
+
* Hides this route behind a feature flag.
|
|
32
|
+
*
|
|
33
|
+
* When the flag is off the route behaves as though it does not exist — the
|
|
34
|
+
* application's own `404` view, with a 404 status — rather than returning an
|
|
35
|
+
* error page that confirms something is there.
|
|
36
|
+
*
|
|
37
|
+
* Returns `this`, so the route's type is unchanged and the path keeps its
|
|
38
|
+
* entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
|
|
39
|
+
* the path is still in the route manifest the browser receives, so this gates
|
|
40
|
+
* the *response*, not the route's existence. Declare the feature
|
|
41
|
+
* `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
|
|
42
|
+
* client tree if the name itself is the secret.
|
|
43
|
+
*
|
|
44
|
+
* ## A `rollout` is not access control
|
|
45
|
+
*
|
|
46
|
+
* Gate on `active` — a feature nobody has switched on is unreachable, which is
|
|
47
|
+
* the case this is for — or on a `when` that reads something the visitor
|
|
48
|
+
* cannot choose, like the signed-in user.
|
|
49
|
+
*
|
|
50
|
+
* A `rollout` is neither, for an anonymous visitor. The subject is their
|
|
51
|
+
* `session_id` cookie, which they supply; bucketing is a published pure
|
|
52
|
+
* function of it, so they can compute one that lands inside any percentage and
|
|
53
|
+
* send it. Signing the cookie would not fix this — they can equally well
|
|
54
|
+
* discard it and ask for a fresh one until a signed id happens to land inside,
|
|
55
|
+
* which for a 5% rollout is a couple of dozen requests. Nothing that hands out
|
|
56
|
+
* identities on demand can restrict anything to a fraction of them.
|
|
57
|
+
*/
|
|
58
|
+
feature(key: FeatureKey): this;
|
|
27
59
|
}
|
|
28
60
|
export type FileBody = Blob | ReadableStream | ArrayBuffer | ArrayBufferView | string;
|
|
29
61
|
export type FileOutput = Blob | Response | {
|
|
@@ -42,16 +74,47 @@ export declare class FileRoute<Input, Params> {
|
|
|
42
74
|
kind: "file";
|
|
43
75
|
viewPath: string;
|
|
44
76
|
middlewares: string[];
|
|
77
|
+
featureGates: string[];
|
|
45
78
|
private handler;
|
|
46
79
|
constructor(handler?: CallbackHandler<Input, FileOutput, Params> | [new () => Controller, ControllerMethods<any>]);
|
|
47
80
|
run(req: HttpRequest<Input, Params>, path: string): Promise<{
|
|
48
81
|
FILE: FileOutput;
|
|
49
82
|
}>;
|
|
50
|
-
middleware(middlewares:
|
|
83
|
+
middleware(middlewares: MiddlewareInput): this;
|
|
84
|
+
/**
|
|
85
|
+
* Hides this route behind a feature flag.
|
|
86
|
+
*
|
|
87
|
+
* When the flag is off the route behaves as though it does not exist — the
|
|
88
|
+
* application's own `404` view, with a 404 status — rather than returning an
|
|
89
|
+
* error page that confirms something is there.
|
|
90
|
+
*
|
|
91
|
+
* Returns `this`, so the route's type is unchanged and the path keeps its
|
|
92
|
+
* entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
|
|
93
|
+
* the path is still in the route manifest the browser receives, so this gates
|
|
94
|
+
* the *response*, not the route's existence. Declare the feature
|
|
95
|
+
* `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
|
|
96
|
+
* client tree if the name itself is the secret.
|
|
97
|
+
*
|
|
98
|
+
* ## A `rollout` is not access control
|
|
99
|
+
*
|
|
100
|
+
* Gate on `active` — a feature nobody has switched on is unreachable, which is
|
|
101
|
+
* the case this is for — or on a `when` that reads something the visitor
|
|
102
|
+
* cannot choose, like the signed-in user.
|
|
103
|
+
*
|
|
104
|
+
* A `rollout` is neither, for an anonymous visitor. The subject is their
|
|
105
|
+
* `session_id` cookie, which they supply; bucketing is a published pure
|
|
106
|
+
* function of it, so they can compute one that lands inside any percentage and
|
|
107
|
+
* send it. Signing the cookie would not fix this — they can equally well
|
|
108
|
+
* discard it and ask for a fresh one until a signed id happens to land inside,
|
|
109
|
+
* which for a 5% rollout is a couple of dozen requests. Nothing that hands out
|
|
110
|
+
* identities on demand can restrict anything to a fraction of them.
|
|
111
|
+
*/
|
|
112
|
+
feature(key: FeatureKey): this;
|
|
51
113
|
}
|
|
52
114
|
export declare class ViewRoute<Input, Output, Params> {
|
|
53
115
|
viewPath: string;
|
|
54
116
|
middlewares: string[];
|
|
117
|
+
featureGates: string[];
|
|
55
118
|
private handler;
|
|
56
119
|
constructor(viewPath: string, handler?: CallbackHandler<Input, Output, Params> | [new () => Controller, ControllerMethods<any>]);
|
|
57
120
|
run(req: HttpRequest<Input, Params>, path: string): Promise<{
|
|
@@ -62,12 +125,42 @@ export declare class ViewRoute<Input, Output, Params> {
|
|
|
62
125
|
};
|
|
63
126
|
};
|
|
64
127
|
}>;
|
|
65
|
-
middleware(middlewares:
|
|
128
|
+
middleware(middlewares: MiddlewareInput): this;
|
|
129
|
+
/**
|
|
130
|
+
* Hides this route behind a feature flag.
|
|
131
|
+
*
|
|
132
|
+
* When the flag is off the route behaves as though it does not exist — the
|
|
133
|
+
* application's own `404` view, with a 404 status — rather than returning an
|
|
134
|
+
* error page that confirms something is there.
|
|
135
|
+
*
|
|
136
|
+
* Returns `this`, so the route's type is unchanged and the path keeps its
|
|
137
|
+
* entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
|
|
138
|
+
* the path is still in the route manifest the browser receives, so this gates
|
|
139
|
+
* the *response*, not the route's existence. Declare the feature
|
|
140
|
+
* `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
|
|
141
|
+
* client tree if the name itself is the secret.
|
|
142
|
+
*
|
|
143
|
+
* ## A `rollout` is not access control
|
|
144
|
+
*
|
|
145
|
+
* Gate on `active` — a feature nobody has switched on is unreachable, which is
|
|
146
|
+
* the case this is for — or on a `when` that reads something the visitor
|
|
147
|
+
* cannot choose, like the signed-in user.
|
|
148
|
+
*
|
|
149
|
+
* A `rollout` is neither, for an anonymous visitor. The subject is their
|
|
150
|
+
* `session_id` cookie, which they supply; bucketing is a published pure
|
|
151
|
+
* function of it, so they can compute one that lands inside any percentage and
|
|
152
|
+
* send it. Signing the cookie would not fix this — they can equally well
|
|
153
|
+
* discard it and ask for a fresh one until a signed id happens to land inside,
|
|
154
|
+
* which for a 5% rollout is a couple of dozen requests. Nothing that hands out
|
|
155
|
+
* identities on demand can restrict anything to a fraction of them.
|
|
156
|
+
*/
|
|
157
|
+
feature(key: FeatureKey): this;
|
|
66
158
|
}
|
|
67
159
|
export declare class LayoutRoute<T extends ViewRoutes, Input, Output, Params> {
|
|
68
160
|
viewPath: string;
|
|
69
161
|
children: new () => ViewRouter;
|
|
70
162
|
middlewares: string[];
|
|
163
|
+
featureGates: string[];
|
|
71
164
|
/** @internal Set by `alwaysRun()`. */
|
|
72
165
|
alwaysRuns: boolean;
|
|
73
166
|
private handler;
|
|
@@ -90,10 +183,40 @@ export declare class LayoutRoute<T extends ViewRoutes, Input, Output, Params> {
|
|
|
90
183
|
* on every request regardless.
|
|
91
184
|
*/
|
|
92
185
|
alwaysRun(): this;
|
|
93
|
-
middleware(middlewares:
|
|
186
|
+
middleware(middlewares: MiddlewareInput): this;
|
|
187
|
+
/**
|
|
188
|
+
* Hides this route behind a feature flag.
|
|
189
|
+
*
|
|
190
|
+
* When the flag is off the route behaves as though it does not exist — the
|
|
191
|
+
* application's own `404` view, with a 404 status — rather than returning an
|
|
192
|
+
* error page that confirms something is there.
|
|
193
|
+
*
|
|
194
|
+
* Returns `this`, so the route's type is unchanged and the path keeps its
|
|
195
|
+
* entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
|
|
196
|
+
* the path is still in the route manifest the browser receives, so this gates
|
|
197
|
+
* the *response*, not the route's existence. Declare the feature
|
|
198
|
+
* `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
|
|
199
|
+
* client tree if the name itself is the secret.
|
|
200
|
+
*
|
|
201
|
+
* ## A `rollout` is not access control
|
|
202
|
+
*
|
|
203
|
+
* Gate on `active` — a feature nobody has switched on is unreachable, which is
|
|
204
|
+
* the case this is for — or on a `when` that reads something the visitor
|
|
205
|
+
* cannot choose, like the signed-in user.
|
|
206
|
+
*
|
|
207
|
+
* A `rollout` is neither, for an anonymous visitor. The subject is their
|
|
208
|
+
* `session_id` cookie, which they supply; bucketing is a published pure
|
|
209
|
+
* function of it, so they can compute one that lands inside any percentage and
|
|
210
|
+
* send it. Signing the cookie would not fix this — they can equally well
|
|
211
|
+
* discard it and ask for a fresh one until a signed id happens to land inside,
|
|
212
|
+
* which for a 5% rollout is a couple of dozen requests. Nothing that hands out
|
|
213
|
+
* identities on demand can restrict anything to a fraction of them.
|
|
214
|
+
*/
|
|
215
|
+
feature(key: FeatureKey): this;
|
|
94
216
|
}
|
|
95
217
|
export declare class ViewRouter {
|
|
96
218
|
middlewares: string[];
|
|
219
|
+
featureGates: string[];
|
|
97
220
|
routes: ViewRoutes;
|
|
98
221
|
view<C extends new () => Controller, M extends ControllerMethods<C>>(viewPath: string, handler?: [C, M]): ParseViewControllerHandler<C, M>;
|
|
99
222
|
view<Input, Output, Params>(viewPath: string, handler?: ViewHandler<Input, Output, Params>): ViewRoute<Input, Output, Params>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewRouter.d.ts","sourceRoot":"","sources":["../../http/ViewRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewRouter.d.ts","sourceRoot":"","sources":["../../http/ViewRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,kBAAkB,CAAC;AAE1E,KAAK,iBAAiB,CAAC,CAAC,SAAS,UAAU,UAAU,IAAI;KACtD,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,KAAK;CAC9E,CAAC,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzB,MAAM,MAAM,UAAU,GAAG,MAAM,CAC7B,MAAM,EACJ,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACxB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AK,CAAC;AAEV,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,UAAU,EACpB,MAAM,SAAS,WAAW,GAAG,EAAE,IAC7B,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
package/dist/http/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Controller, ResourceController } from "./Controller";
|
|
2
2
|
export { ApiRouter, type CreateRPC } from "./ApiRouter";
|
|
3
3
|
export { createFileResponse, ViewRouter, type CreateViewRPC, type FileOutput, type ViewHandler, } from "./ViewRouter";
|
|
4
|
+
export { toMiddlewareList, type MiddlewareInput } from "./middlewareList";
|
|
4
5
|
export { createStreamResponse, createUnsatisfiableResponse, type StreamOutput, type StreamDescriptor, } from "./createStreamResponse";
|
|
5
6
|
export { formatContentRange, formatUnsatisfiedContentRange, parseContentRange, parseRangeHeader, resolveRange, toRangeHeaderValue, type ByteRange, type ContentRange, type ResolvedRange, } from "./range";
|
|
6
7
|
export { ValidationError } from "./Router";
|
package/dist/http/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB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dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$d as
|
|
2
|
+
import{$d as d,Ee as A,Fe as B,Ge as C,Ie as D,Je as E,Ke as F,Le as G,Me as H,Ne as I,Xd as a,Yd as b,_d as c,ae as e,be as f,ce as g,de as h,fe as i,ge as j,he as k,ie as l,je as m,ke as n,le as o,me as p,ne as q,oe as r,pe as s,qe as t,te as u,ue as v,ve as w,we as x,xe as y,ye as z}from"../chunk-hxf1re93.js";import"../chunk-qb5mv6pj.js";import"../chunk-3g5bjvdf.js";import"../chunk-sy7jbdeb.js";import"../chunk-d125j8t0.js";import"../chunk-dgsgjg53.js";import"../chunk-jhkjz9jr.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=C628C1CDCF93D8C264756E2164756E21
|
package/dist/http/index.js.map
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a route's `.middleware()` accepts.
|
|
3
|
+
*
|
|
4
|
+
* A bare string is allowed because it is what people write — `"auth"` reads
|
|
5
|
+
* better than `["auth"]` for the overwhelmingly common single-middleware case,
|
|
6
|
+
* and the array form was accepted silently wrong for long enough that the
|
|
7
|
+
* starter template itself does it (`.middleware("cache:private")`).
|
|
8
|
+
*/
|
|
9
|
+
export type MiddlewareInput = string | string[];
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes `.middleware()`'s argument to the array the registry expects.
|
|
12
|
+
*
|
|
13
|
+
* Without this, a bare string was assigned straight to `middlewares`, and
|
|
14
|
+
* `transformMiddleware` iterates its input — so a string was iterated one
|
|
15
|
+
* **character** at a time. Each character became an alias lookup that resolved
|
|
16
|
+
* to nothing and was dropped by the trailing `.filter(Boolean)`, which means the
|
|
17
|
+
* middleware did not run and nothing anywhere said so. A route that looked
|
|
18
|
+
* authenticated was public.
|
|
19
|
+
*
|
|
20
|
+
* The type said `string[]`, so this was a type error at every call site — but
|
|
21
|
+
* only for a project whose `tsc` is clean, and the failure at runtime is silent
|
|
22
|
+
* either way. Accepting both shapes removes the trap rather than documenting it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toMiddlewareList(input: MiddlewareInput): string[];
|
|
25
|
+
//# sourceMappingURL=middlewareList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middlewareList.d.ts","sourceRoot":"","sources":["../../http/middlewareList.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,EAAE,CAEjE"}
|
|
@@ -37,6 +37,30 @@ declare class Store {
|
|
|
37
37
|
* silently returning partial bytes.
|
|
38
38
|
*/
|
|
39
39
|
rangeRequest: ByteRange | null;
|
|
40
|
+
/**
|
|
41
|
+
* This request's `session_id`, once read or minted.
|
|
42
|
+
*
|
|
43
|
+
* The cookie itself cannot answer for it. `setCookie` appends a *serialized*
|
|
44
|
+
* `Set-Cookie` string to `cookies`, so a value written during this request is
|
|
45
|
+
* not readable back out of it, and `req.cookies` still holds only what the
|
|
46
|
+
* browser sent. Anything needing the id in the same request that mints it —
|
|
47
|
+
* feature-flag bucketing, most obviously — has to read it from here.
|
|
48
|
+
*/
|
|
49
|
+
sessionId: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* This request's feature-flag evaluations, computed once.
|
|
52
|
+
*
|
|
53
|
+
* One map per request is what keeps a handler and the SSR payload from
|
|
54
|
+
* disagreeing: a percentage rollout evaluated twice would be consistent
|
|
55
|
+
* anyway — the bucketing is deterministic — but an attribute hook reading a
|
|
56
|
+
* clock, or a `now`-based rule, would not be. Anything the page renders and
|
|
57
|
+
* anything the server branched on have to be the same answer.
|
|
58
|
+
*/
|
|
59
|
+
featureEvaluations: Map<string, unknown> | null;
|
|
60
|
+
/** The context those evaluations were made against, built at most once. */
|
|
61
|
+
featureContext: unknown;
|
|
62
|
+
/** Bucket memo, shared across every flag evaluated for this request. */
|
|
63
|
+
featureBuckets: Map<string, number> | null;
|
|
40
64
|
constructor(req: HttpRequest);
|
|
41
65
|
setLocale(locale: string): void;
|
|
42
66
|
renderMeta(): {
|
|
@@ -52,6 +76,39 @@ declare class Store {
|
|
|
52
76
|
setRequest(req: HttpRequest<any, any>): void;
|
|
53
77
|
destroy(): void;
|
|
54
78
|
}
|
|
79
|
+
export declare const SESSION_ID_COOKIE = "session_id";
|
|
80
|
+
/**
|
|
81
|
+
* The `session_id` the browser sent, or the one minted earlier in this request.
|
|
82
|
+
* Never mints one, so it is safe on an api request, where a `Set-Cookie` nobody
|
|
83
|
+
* asked for would be a surprise.
|
|
84
|
+
*
|
|
85
|
+
* `null` outside a request, and for an anonymous visitor whose first request is
|
|
86
|
+
* not a view — both meaning "no stable subject", which callers must handle
|
|
87
|
+
* rather than paper over with a random value. A per-call random id would give
|
|
88
|
+
* every request its own bucket, which is worse than no bucketing at all: a
|
|
89
|
+
* percentage rollout would reshuffle on every page load.
|
|
90
|
+
*
|
|
91
|
+
* ## It is client-supplied, and unauthenticated
|
|
92
|
+
*
|
|
93
|
+
* Whatever the browser sent, unvalidated. It is a bucketing subject, not a
|
|
94
|
+
* credential — never authenticate or authorize on it. A visitor can pick a value
|
|
95
|
+
* that lands them in any percentage rollout, and signing it would not change
|
|
96
|
+
* that: they can discard the cookie and collect fresh ones until one does. Load
|
|
97
|
+
* bearing enough to state, because `.feature()` route gating is built on top of
|
|
98
|
+
* evaluation — see its documentation for what may safely gate a route.
|
|
99
|
+
*/
|
|
100
|
+
export declare function sessionId(): string | null;
|
|
101
|
+
/**
|
|
102
|
+
* The same, but mints and sets the cookie when the browser sent none.
|
|
103
|
+
*
|
|
104
|
+
* Call this once per **view** request, early enough that everything downstream —
|
|
105
|
+
* flag evaluation included — sees the same id the browser is about to be given.
|
|
106
|
+
* It used to live inline in `ViewRouteDispatcher.onRequestEnd`, which ran only
|
|
107
|
+
* on the document path and only after the response was decided, so a client-side
|
|
108
|
+
* navigation minted nothing and a first-ever visitor had no id at the point
|
|
109
|
+
* flags were evaluated.
|
|
110
|
+
*/
|
|
111
|
+
export declare function ensureSessionId(): string | null;
|
|
55
112
|
export declare class RequestContext {
|
|
56
113
|
static getStore(): Store;
|
|
57
114
|
static setRequest(req: HttpRequest<any, any>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestContext.d.ts","sourceRoot":"","sources":["../../http/requestContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE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,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAIvD;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;CAGhD"}
|
|
@@ -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-xzk827r3.js";import{ka as c,la as d,na as l}from"../chunk-5ad8era8.js";import{Od as e,Pd as i,Rd as t,Sd as r,Td as o,Ud as n,Vd as a,Wd as s}from"../chunk-7j6wbv12.js";import"../chunk-jhkjz9jr.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
|
-
//# debugId=
|
|
4
|
+
//# debugId=26339FF3A7438E2764756E2164756E21
|
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-xzk827r3.js";import"../chunk-5ad8era8.js";import{Qa as L}from"../chunk-b35e128b.js";import{Wb as E,Xb as V}from"../chunk-437085pe.js";import"../chunk-4yt5x8s2.js";import{bc as j}from"../chunk-hwa5sqw5.js";import"../chunk-86jebsm4.js";import"../chunk-y6a8r2bn.js";import"../chunk-7j6wbv12.js";import"../chunk-hxf1re93.js";import"../chunk-qb5mv6pj.js";import"../chunk-3g5bjvdf.js";import"../chunk-sy7jbdeb.js";import{wf as X}from"../chunk-cyaz97p5.js";import"../chunk-d125j8t0.js";import"../chunk-dgsgjg53.js";import"../chunk-jhkjz9jr.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=162E452EFA9ACE8564756E2164756E21
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
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
9
|
"mappings": ";soBAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,EAAO,JAAM,HAAE,KACnC,CAAC,IACC,OAAO,IAAU,YACjB,EAAgB,EAAkC,EAAE,CAA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