gemi 0.173.0 → 0.174.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/gemi.js +13 -2
- package/dist/bin/gemi.js.map +3 -3
- package/dist/{chunk-z58zh5gm.js → chunk-48pgk5j8.js} +1 -1
- package/dist/{chunk-dxtry1gh.js → chunk-a8c7fe9s.js} +1 -1
- package/dist/{chunk-1pvfgfhj.js → chunk-d6x90qty.js} +25 -25
- package/dist/{chunk-1pvfgfhj.js.map → chunk-d6x90qty.js.map} +10 -6
- package/dist/{chunk-9pet8zmd.js → chunk-ewf24h4z.js} +13 -2
- package/dist/chunk-ewf24h4z.js.map +10 -0
- package/dist/{chunk-psmwxtf5.js → chunk-hz37kkwy.js} +2 -2
- package/dist/{chunk-psmwxtf5.js.map → chunk-hz37kkwy.js.map} +1 -1
- package/dist/{chunk-yeaftz5a.js → chunk-jy4hy8d4.js} +1 -1
- package/dist/{chunk-eykb93pv.js → chunk-q1s9y4ce.js} +1 -1
- package/dist/{chunk-x2e20w8g.js → chunk-r5wtc9fw.js} +1 -1
- package/dist/client/IslandI18nContext.d.ts +32 -0
- package/dist/client/IslandI18nContext.d.ts.map +1 -0
- package/dist/client/index.js +29 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/islands.d.ts +40 -2
- package/dist/client/islands.d.ts.map +1 -1
- package/dist/client/useDictionary.d.ts.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/internal/islandRuntime.d.ts +10 -2
- package/dist/internal/islandRuntime.d.ts.map +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/staticDocument.d.ts +10 -0
- package/dist/services/router/staticDocument.d.ts.map +1 -1
- package/dist/testing/index.js +20 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/vite/index.mjs +12 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-9pet8zmd.js.map +0 -10
- /package/dist/{chunk-z58zh5gm.js.map → chunk-48pgk5j8.js.map} +0 -0
- /package/dist/{chunk-dxtry1gh.js.map → chunk-a8c7fe9s.js.map} +0 -0
- /package/dist/{chunk-yeaftz5a.js.map → chunk-jy4hy8d4.js.map} +0 -0
- /package/dist/{chunk-eykb93pv.js.map → chunk-q1s9y4ce.js.map} +0 -0
- /package/dist/{chunk-x2e20w8g.js.map → chunk-r5wtc9fw.js.map} +0 -0
package/dist/client/islands.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type ComponentType, type Context, type ReactElement } from "react";
|
|
2
|
+
import type { DictionarySink } from "../i18n/dictionarySink";
|
|
3
|
+
import type { LocaleStrings } from "../i18n/dictionaryShape";
|
|
4
|
+
import { type IslandI18n } from "./IslandI18nContext";
|
|
2
5
|
/**
|
|
3
6
|
* When an island's code is fetched and hydrated, per marker.
|
|
4
7
|
*
|
|
@@ -67,9 +70,42 @@ export interface StaticRenderCollector {
|
|
|
67
70
|
instances: WeakMap<object, IslandInstance>;
|
|
68
71
|
/** Instances rendered so far, for each one's `identifierPrefix`. */
|
|
69
72
|
count: number;
|
|
73
|
+
/**
|
|
74
|
+
* What an island's own root gets of the page's i18n (#1095). Each read of
|
|
75
|
+
* it sets `i18nUsed`.
|
|
76
|
+
*/
|
|
77
|
+
i18n: IslandI18n;
|
|
78
|
+
/**
|
|
79
|
+
* The app has a locale configured: the page then always carries its i18n
|
|
80
|
+
* for its islands, read or not, since an island may first read it in the
|
|
81
|
+
* browser (a subtree that mounts after a click).
|
|
82
|
+
*/
|
|
83
|
+
localeAware: boolean;
|
|
84
|
+
/** The dictionary sink `useDictionary` reports into inside an island's root. */
|
|
85
|
+
sink: DictionarySink;
|
|
86
|
+
/** An island read the page's locale or zone (`useDictionary`, `useFormatter`). */
|
|
87
|
+
i18nUsed: boolean;
|
|
88
|
+
/** The dictionaries islands read, as `[id, locale, strings]`, once each. */
|
|
89
|
+
dictionaries: IslandDictionary[];
|
|
90
|
+
}
|
|
91
|
+
/** @internal One dictionary an island read: what the island runtime seeds. */
|
|
92
|
+
export type IslandDictionary = [id: string, locale: string, strings: LocaleStrings];
|
|
93
|
+
/**
|
|
94
|
+
* @internal The page's i18n as the island runtime reads it, from the
|
|
95
|
+
* document's `<script type="application/json" id="gemi-island-i18n">`.
|
|
96
|
+
*/
|
|
97
|
+
export interface IslandI18nPayload extends IslandI18n {
|
|
98
|
+
/** Seeded into the dictionary registry before the island hydrates. */
|
|
99
|
+
dictionaries?: IslandDictionary[];
|
|
70
100
|
}
|
|
71
101
|
/** @internal */
|
|
72
|
-
export declare function createStaticRenderCollector(render: StaticRenderCollector["render"]): StaticRenderCollector;
|
|
102
|
+
export declare function createStaticRenderCollector(render: StaticRenderCollector["render"], i18n?: IslandI18n): StaticRenderCollector;
|
|
103
|
+
/**
|
|
104
|
+
* @internal The payload for a page with islands: always in an app with a
|
|
105
|
+
* locale, else only when an island read the zone or a dictionary. Its
|
|
106
|
+
* `dictionaries` are only the ones islands read during the server render.
|
|
107
|
+
*/
|
|
108
|
+
export declare function islandI18nPayload(collector: StaticRenderCollector): IslandI18nPayload | undefined;
|
|
73
109
|
/** @internal The element an island's static children land in. */
|
|
74
110
|
export declare const ISLAND_SLOT_TAG = "gemi-slot";
|
|
75
111
|
/** @internal On the empty slot an island's own render leaves for its children. */
|
|
@@ -123,7 +159,9 @@ type AnyComponent = ComponentType<any>;
|
|
|
123
159
|
*
|
|
124
160
|
* Props must be plain data (checked in dev). `children` are rendered on the
|
|
125
161
|
* server as static HTML and passed through untouched. On a static page the
|
|
126
|
-
* island is a separate React root, so context from the page does not reach it
|
|
162
|
+
* island is a separate React root, so context from the page does not reach it,
|
|
163
|
+
* except the page's locale and time zone: `useDictionary` and `useFormatter`
|
|
164
|
+
* work inside it, and the strings it read travel with the page.
|
|
127
165
|
*/
|
|
128
166
|
export declare function island<M extends {
|
|
129
167
|
default: AnyComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"islands.d.ts","sourceRoot":"","sources":["../../client/islands.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,YAAY,EAQlB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"islands.d.ts","sourceRoot":"","sources":["../../client/islands.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,YAAY,EAQlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG;IACvD,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,CAAC,CAAC;CAChB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI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F,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;KA6ChB,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAClD,CAAC,WACG,aAAa,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAC3E,MAAM;QAYI,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAChD,CAAC,WACG,aAAa,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAE1B,GAAG,CAAC,OAAO;IAG/D;;;OAGG;;EAIJ"}
|
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$e as a,Cf as p,Mg as v,Sf as q,bg as r,cf as c,cg as s,df as e,dg as t,ef as f,eg as u,ff as h,gf as i,hf as j,of as k,pf as l,qf as m,rf as n,sf as o}from"../chunk-
|
|
2
|
+
import{$e as a,Cf as p,Mg as v,Sf as q,bg as r,cf as c,cg as s,df as e,dg as t,ef as f,eg as u,ff as h,gf as i,hf as j,of as k,pf as l,qf as m,rf as n,sf as o}from"../chunk-d6x90qty.js";import"../chunk-hr9twa8v.js";import"../chunk-m0nvysa5.js";import{Ii as d,Ki as g,ji as b}from"../chunk-r22svpab.js";import"../chunk-4dnr1vg7.js";import"../chunk-4hhvaa7a.js";import"../chunk-6srzhv88.js";import"../chunk-0v46hne6.js";import"../chunk-rjsd8f8q.js";import"../chunk-vzz91xsm.js";import"../chunk-d7a79eqm.js";import"../chunk-ksgeqtcv.js";import"../chunk-6rh3brnr.js";import"../chunk-vpmbynke.js";import"../chunk-9bcsfce4.js";import"../chunk-9zcsshgb.js";import"../chunk-bsnp7h5w.js";import"../chunk-xtj7cgsx.js";import"../chunk-ewf24h4z.js";import"../chunk-ykd2ayw8.js";import"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import"../chunk-xe126csw.js";export{f as Url,d as Storage,r as Runs,j as Redis,a as Redirect,l as RateLimiter,e as Query,h as Meta,g as Log,m as Lock,c as Lang,s as Features,b as Facade,u as DB,n as Crypt,i as Cookie,o as Connections,t as ConnectionQueries,p as ChangeFeed,k as Cache,q as Broadcast,v as Auth};
|
|
3
3
|
|
|
4
4
|
//# debugId=072A8A24A2CFE26964756E2164756E21
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$g as la,Ng as $,Og as aa,Pg as ba,Sg as ca,Tg as da,Ug as ea,Vg as fa,Wg as ga,Xg as ha,Yg as ia,Ze as I,Zg as ja,_e as J,_g as ka,af as K,ah as ma,bf as L,bh as na,ch as oa,dh as pa,eh as qa,fh as ra,gh as sa,hh as ta,ie as q,je as r,ke as s,le as t,me as u,mg as _,ne as v,oe as w,pe as D,ue as E,xe as F,ye as G,ze as H}from"../chunk-
|
|
2
|
+
import{$g as la,Ng as $,Og as aa,Pg as ba,Sg as ca,Tg as da,Ug as ea,Vg as fa,Wg as ga,Xg as ha,Yg as ia,Ze as I,Zg as ja,_e as J,_g as ka,af as K,ah as ma,bf as L,bh as na,ch as oa,dh as pa,eh as qa,fh as ra,gh as sa,hh as ta,ie as q,je as r,ke as s,le as t,me as u,mg as _,ne as v,oe as w,pe as D,ue as E,xe as F,ye as G,ze as H}from"../chunk-d6x90qty.js";import"../chunk-hr9twa8v.js";import"../chunk-m0nvysa5.js";import{Ai as U,Bi as V,Ci as W,Di as X,Ei as Y,Fi as Z,Hh as a,Ih as b,Jh as d,Oh as e,Ph as f,Qh as g,Rh as h,Sh as i,Th as j,Yh as n,Zh as o,ci as p,di as x,ei as y,fi as z,gi as A,hi as B,ii as C,si as M,ti as N,ui as O,vi as P,wi as Q,xi as R,yi as S,zi as T}from"../chunk-r22svpab.js";import{Si as c}from"../chunk-4dnr1vg7.js";import{Xi as k,Yi as l,Zi as m}from"../chunk-4hhvaa7a.js";import"../chunk-6srzhv88.js";import"../chunk-0v46hne6.js";import"../chunk-rjsd8f8q.js";import"../chunk-vzz91xsm.js";import"../chunk-d7a79eqm.js";import"../chunk-ksgeqtcv.js";import"../chunk-6rh3brnr.js";import"../chunk-vpmbynke.js";import"../chunk-9bcsfce4.js";import"../chunk-9zcsshgb.js";import"../chunk-bsnp7h5w.js";import"../chunk-xtj7cgsx.js";import"../chunk-ewf24h4z.js";import"../chunk-ykd2ayw8.js";import"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import"../chunk-xe126csw.js";export{g as toRangeHeaderValue,s as toMiddlewareList,k as stateKey,Z as safeFetch,f as resolveRange,e as parseRangeHeader,h as parseContentRange,w as parseByteSize,ha as middlewareConfigDefaults,r as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,pa as defineResourcePolicy,ga as defineMiddlewareConfig,t as createUnsatisfiableResponse,u as createStreamResponse,K as createFileResponse,H as clientIp,X as classifyAddress,ba as authorizeChannel,L as ViewRouter,n as ValidationError,U as TooManyRedirectsError,S as TooLargeError,R as TimeoutError,qa as SitemapError,ra as Sitemap,J as SameSiteBounceMiddleware,Y as SafeResponse,M as SafeFetchError,I as SAME_SITE_BOUNCE_PARAM,sa as RobotsTxt,ta as Robots,oa as ResourcePolicy,b as ResourceController,m as RequestState,c as RequestBreakerError,G as RateLimitMiddleware,E as RateLimitExceededError,z as RangeNotSatisfiableError,ma as PoliciesServiceProvider,na as Policies,v as PayloadTooLargeError,A as NotFoundError,V as NetworkError,l as MissingRequestStateError,F as Middleware,ea as McpToolDeclaration,fa as McpRouter,da as McpRouteDeclaration,ca as McpModelParam,o as InvalidValidationRuleError,N as InvalidUrlError,y as InsufficientPermissionsError,W as HttpStatusError,q as HttpResponse,p as HttpRequest,B as FileNotFoundError,Q as DnsError,ka as CorsMiddleware,a as Controller,T as ContentTypeError,aa as ChannelRouter,$ as ChannelDeclaration,ja as CacheMiddleware,la as CSRFMiddleware,_ as BodyLimitMiddleware,O as BlockedHostError,P as BlockedAddressError,x as AuthorizationError,ia as AuthenticationMiddleware,C as AuthenticationError,D as ApiRouter};
|
|
3
3
|
|
|
4
4
|
//# debugId=0CB7EA72F595609964756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{da as T}from"../chunk-6016sfy5.js";import"../chunk-mvd4mc8p.js";import{bb as D}from"../chunk-2mvz2pjr.js";import{fe as b,ge as w}from"../chunk-w8hre8gz.js";import"../chunk-zqptpk90.js";import{cf as j}from"../chunk-
|
|
2
|
+
import{da as T}from"../chunk-6016sfy5.js";import"../chunk-mvd4mc8p.js";import{bb as D}from"../chunk-2mvz2pjr.js";import{fe as b,ge as w}from"../chunk-w8hre8gz.js";import"../chunk-zqptpk90.js";import{cf as j}from"../chunk-d6x90qty.js";import"../chunk-hr9twa8v.js";import"../chunk-m0nvysa5.js";import"../chunk-r22svpab.js";import"../chunk-4dnr1vg7.js";import"../chunk-4hhvaa7a.js";import"../chunk-6srzhv88.js";import"../chunk-0v46hne6.js";import"../chunk-rjsd8f8q.js";import"../chunk-vzz91xsm.js";import"../chunk-d7a79eqm.js";import"../chunk-ksgeqtcv.js";import"../chunk-6rh3brnr.js";import"../chunk-vpmbynke.js";import"../chunk-9bcsfce4.js";import{$k as L,Yk as V,Zk as X,_k as E,al as R,bl as S}from"../chunk-9zcsshgb.js";import"../chunk-bsnp7h5w.js";import"../chunk-xtj7cgsx.js";import"../chunk-ewf24h4z.js";import"../chunk-ykd2ayw8.js";import"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import"../chunk-xe126csw.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{w as translationConfigDefaults,N as translate,V as resolveLocale,X as negotiateLocale,L as isValidTimeZone,b as defineTranslationConfig,T as defineDictionary,R as createFormatter,S as Translator,D as TranslationServiceProvider,P as Dictionary,E as DEFAULT_TIME_ZONE};
|
|
3
3
|
|
|
4
4
|
//# debugId=A89A14B4AA5A57CC64756E2164756E21
|
|
@@ -36,12 +36,20 @@ export declare function islandEntrySource(file: string): string;
|
|
|
36
36
|
* `data-uid` is the `identifierPrefix` the server rendered the island with, so
|
|
37
37
|
* `useId` agrees on both sides and two islands never share an id.
|
|
38
38
|
*
|
|
39
|
+
* When the page carries `#gemi-island-i18n` (its islands read the page's
|
|
40
|
+
* locale or dictionaries, #1095), the dictionaries in it are seeded into the
|
|
41
|
+
* dictionary registry through `__GEMI_DICT__` and the island's root gets the
|
|
42
|
+
* locale and zone in `IslandI18nContext` (found on `globalThis`, where
|
|
43
|
+
* `gemi/client` puts it), so `useDictionary` resolves synchronously, with the
|
|
44
|
+
* strings the server rendered, and fetches nothing. An island that does not
|
|
45
|
+
* import `gemi/client` has no such context to read, and is left as it was.
|
|
46
|
+
*
|
|
39
47
|
* Written as a function body with `createElement` and `hydrateRoot` free, so a
|
|
40
48
|
* test can run it against real React without a bundler.
|
|
41
49
|
*/
|
|
42
|
-
export declare const ISLAND_HYDRATE_SOURCE = "function h(marker, Component) {\n if (typeof Component !== \"function\" && (typeof Component !== \"object\" || Component === null)) {\n throw new Error(\"gemi: island module has no component export for \" + marker.outerHTML.slice(0, 80));\n }\n const json = marker.getAttribute(\"data-props\");\n const props = json ? JSON.parse(json) : {};\n let slot = null;\n for (const candidate of marker.querySelectorAll(\"gemi-slot\")) {\n if (candidate.closest(\"gemi-island\") === marker) {\n slot = candidate;\n break;\n }\n }\n const children = slot\n ? [createElement(\"gemi-slot\", {\n style: { display: \"contents\" },\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: slot.innerHTML },\n })]\n : [];\n
|
|
50
|
+
export declare const ISLAND_HYDRATE_SOURCE = "function h(marker, Component) {\n if (typeof Component !== \"function\" && (typeof Component !== \"object\" || Component === null)) {\n throw new Error(\"gemi: island module has no component export for \" + marker.outerHTML.slice(0, 80));\n }\n const json = marker.getAttribute(\"data-props\");\n const props = json ? JSON.parse(json) : {};\n let slot = null;\n for (const candidate of marker.querySelectorAll(\"gemi-slot\")) {\n if (candidate.closest(\"gemi-island\") === marker) {\n slot = candidate;\n break;\n }\n }\n const children = slot\n ? [createElement(\"gemi-slot\", {\n style: { display: \"contents\" },\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: slot.innerHTML },\n })]\n : [];\n let element = createElement(Component, props, ...children);\n const i18n = document.getElementById(\"gemi-island-i18n\");\n const context = globalThis[Symbol.for(\"gemi.islandI18n\")];\n if (i18n && context) {\n const payload = (i18n.p = i18n.p || JSON.parse(i18n.textContent));\n const dictionaries = (self.__GEMI_DICT__ = self.__GEMI_DICT__ || []);\n for (const entry of payload.dictionaries || []) dictionaries.push(entry);\n element = createElement(context.Provider, {\n value: { currentLocale: payload.currentLocale, defaultLocale: payload.defaultLocale, timeZone: payload.timeZone },\n }, element);\n }\n return hydrateRoot(marker, element, {\n identifierPrefix: marker.getAttribute(\"data-uid\") || undefined,\n });\n}";
|
|
43
51
|
/** The runtime module's source, as the plugin serves and builds it. */
|
|
44
|
-
export declare const ISLAND_RUNTIME_SOURCE = "import { createElement } from \"react\";\nimport { hydrateRoot } from \"react-dom/client\";\nexport function h(marker, Component) {\n if (typeof Component !== \"function\" && (typeof Component !== \"object\" || Component === null)) {\n throw new Error(\"gemi: island module has no component export for \" + marker.outerHTML.slice(0, 80));\n }\n const json = marker.getAttribute(\"data-props\");\n const props = json ? JSON.parse(json) : {};\n let slot = null;\n for (const candidate of marker.querySelectorAll(\"gemi-slot\")) {\n if (candidate.closest(\"gemi-island\") === marker) {\n slot = candidate;\n break;\n }\n }\n const children = slot\n ? [createElement(\"gemi-slot\", {\n style: { display: \"contents\" },\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: slot.innerHTML },\n })]\n : [];\n
|
|
52
|
+
export declare const ISLAND_RUNTIME_SOURCE = "import { createElement } from \"react\";\nimport { hydrateRoot } from \"react-dom/client\";\nexport function h(marker, Component) {\n if (typeof Component !== \"function\" && (typeof Component !== \"object\" || Component === null)) {\n throw new Error(\"gemi: island module has no component export for \" + marker.outerHTML.slice(0, 80));\n }\n const json = marker.getAttribute(\"data-props\");\n const props = json ? JSON.parse(json) : {};\n let slot = null;\n for (const candidate of marker.querySelectorAll(\"gemi-slot\")) {\n if (candidate.closest(\"gemi-island\") === marker) {\n slot = candidate;\n break;\n }\n }\n const children = slot\n ? [createElement(\"gemi-slot\", {\n style: { display: \"contents\" },\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: slot.innerHTML },\n })]\n : [];\n let element = createElement(Component, props, ...children);\n const i18n = document.getElementById(\"gemi-island-i18n\");\n const context = globalThis[Symbol.for(\"gemi.islandI18n\")];\n if (i18n && context) {\n const payload = (i18n.p = i18n.p || JSON.parse(i18n.textContent));\n const dictionaries = (self.__GEMI_DICT__ = self.__GEMI_DICT__ || []);\n for (const entry of payload.dictionaries || []) dictionaries.push(entry);\n element = createElement(context.Provider, {\n value: { currentLocale: payload.currentLocale, defaultLocale: payload.defaultLocale, timeZone: payload.timeZone },\n }, element);\n }\n return hydrateRoot(marker, element, {\n identifierPrefix: marker.getAttribute(\"data-uid\") || undefined,\n });\n}\n";
|
|
45
53
|
/**
|
|
46
54
|
* The island loader, inlined into a static document that uses islands.
|
|
47
55
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"islandRuntime.d.ts","sourceRoot":"","sources":["../../internal/islandRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAE/D,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,kCAA2B,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAK7C;AAED
|
|
1
|
+
{"version":3,"file":"islandRuntime.d.ts","sourceRoot":"","sources":["../../internal/islandRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAE/D,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,kCAA2B,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAK7C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,ogDAkChC,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,0mDAGjC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,QAM8G,CAAC"}
|
package/dist/kernel/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fa as E}from"../chunk-5yvy70d7.js";import{ab as p}from"../chunk-1hhwqx50.js";import{bb as H}from"../chunk-2mvz2pjr.js";import{Cb as L,Db as Q,Eb as T,Ib as U,Jb as y,Kb as F,Lb as C,Ob as D,Pb as I,Sb as b,Vb as f,Wb as k,Xb as m,ob as g,pb as W,qb as _,rb as l,sb as P,tb as u,ub as $,vb as V,wb as q,xb as B,yb as K}from"../chunk-
|
|
2
|
+
import{Fa as E}from"../chunk-5yvy70d7.js";import{ab as p}from"../chunk-1hhwqx50.js";import{bb as H}from"../chunk-2mvz2pjr.js";import{Cb as L,Db as Q,Eb as T,Ib as U,Jb as y,Kb as F,Lb as C,Ob as D,Pb as I,Sb as b,Vb as f,Wb as k,Xb as m,ob as g,pb as W,qb as _,rb as l,sb as P,tb as u,ub as $,vb as V,wb as q,xb as B,yb as K}from"../chunk-a8c7fe9s.js";import"../chunk-pbc3w7mq.js";import"../chunk-ywcfezjq.js";import"../chunk-9aj6eavs.js";import{$d as h}from"../chunk-tbf76adx.js";import"../chunk-w8hre8gz.js";import"../chunk-zqptpk90.js";import{Cg as w,Ee as a,Fe as d,Gg as A,Kg as R,Xe as n,Ye as v}from"../chunk-d6x90qty.js";import"../chunk-hr9twa8v.js";import"../chunk-m0nvysa5.js";import"../chunk-r22svpab.js";import"../chunk-4dnr1vg7.js";import"../chunk-4hhvaa7a.js";import"../chunk-6srzhv88.js";import{lj as M}from"../chunk-0v46hne6.js";import"../chunk-rjsd8f8q.js";import"../chunk-vzz91xsm.js";import"../chunk-d7a79eqm.js";import"../chunk-ksgeqtcv.js";import"../chunk-6rh3brnr.js";import"../chunk-vpmbynke.js";import"../chunk-9bcsfce4.js";import"../chunk-tzne38pa.js";import"../chunk-9zcsshgb.js";import{cl as O,el as z}from"../chunk-bsnp7h5w.js";import"../chunk-xtj7cgsx.js";import"../chunk-ewf24h4z.js";import"../chunk-ykd2ayw8.js";import"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import"../chunk-xe126csw.js";var N=[C,I,E,T,L,k,B,Q,D,y,_,U,f,V,F,H,b,K,q,m,$];class S{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new z;boot(){if(this.models.length>0)p(...this.models);else s();this.app.config.merge(this.config),z.setInstance(this.app),this.app.registerMany([...N,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let G of this.services){let J=typeof G==="function"?new G:G,x=J.constructor;if(!x.token)throw Error(`Service [${x.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=X.get(x.token);if(Y)throw Error(`Services [${Y}] and [${x.name}] both declare the token "${x.token}". Tokens are the container's keys, so they must be unique.`);X.set(x.token,x.name);let Z=x;if(!j.has(x.token)&&this.app.bound(Z))throw Error(`Service [${x.name}] declares the token "${x.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(Z,J),this.serviceInstances.push(J),this.serviceTokens.add(x.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),l(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return O.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(A)}viewRoutes(){return this.app.make(w)}domains(){return this.app.make(R)}queue(){return this.app.make(h)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(g):null}sockets(){return this.app.config.get("route.channels")?this.app.make(u):null}globalMiddleware(j){return P(j)}destroy(){if(this.app.resolved(W))this.app.make(W).stop();if(this.app.flush(),z.getInstance()===this.app)z.setInstance(void 0);O.disable()}}function s(){if(Bun.env.NODE_ENV==="production")return;let j=M();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.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:
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Da as f}from"../chunk-s0z61m9j.js";import{Ea as S}from"../chunk-r1n2fkfz.js";import{ol as Q,ql as Z,rl as P,sl as y,tl as U,ul as A}from"../chunk-ykd2ayw8.js";import{yl as H}from"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import{Gl as F}from"../chunk-xe126csw.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-
|
|
2
|
+
import{Da as f}from"../chunk-s0z61m9j.js";import{Ea as S}from"../chunk-r1n2fkfz.js";import{ol as Q,ql as Z,rl as P,sl as y,tl as U,ul as A}from"../chunk-ykd2ayw8.js";import{yl as H}from"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import{Gl as F}from"../chunk-xe126csw.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-jy4hy8d4.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-48pgk5j8.js"),K=new Y(this.app);this.server=await J(this.app,K.track(I)),N(K)}return this.server}stop(z={}){let B=this.app.sockets();return this.stopping??=P({server:this.server,closeSockets:B?()=>B.shutdown():void 0,shutdownProviders:(I)=>this.app.shutdown(I),settings:{...this.settings??Z(),...z}}),this.stopping}}export{W as liveness,Q as isShuttingDown,k as Server};
|
|
3
3
|
|
|
4
4
|
//# debugId=935CE16C434EF4A464756E2164756E21
|
package/dist/services/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{db as E8}from"../chunk-8m9kgynj.js";import{Ab as H8,Bb as U8,Cb as O8,Db as S8,Eb as R8,Fb as T4,Gb as X6,Hb as C,Ib as _8,Jb as f8,Kb as C8,Lb as k8,Mb as b8,Nb as T8,Ob as P8,Pb as V8,Qb as I8,Rb as v8,Sb as q8,Tb as w8,Ub as y8,Vb as A8,Wb as h8,Xb as g8,eb as gZ,fb as EZ,gb as mZ,hb as cZ,ib as uZ,jb as f4,kb as pZ,lb as O4,mb as S4,nb as q1,ob as dZ,pb as lZ,qb as X8,ub as B8,vb as j8,wb as M8,xb as L8,yb as F8,zb as D8}from"../chunk-dxtry1gh.js";import{_b as k4}from"../chunk-pbc3w7mq.js";import{Ad as rZ,Bd as eZ,Cd as W8,Dd as Z8,Ed as $8,Fd as J8,Gd as Q8,Hd as Y8,Id as K8,Jd as G8,Kd as z8,vd as nZ,wd as iZ,xd as sZ,yd as oZ,zd as aZ}from"../chunk-ywcfezjq.js";import{Ld as tZ}from"../chunk-9aj6eavs.js";import{$d as AZ,Md as SZ,Nd as RZ,Od as _Z,Pd as fZ,Qd as CZ,Rd as kZ,Sd as bZ,Td as TZ,Ud as PZ,Vd as VZ,Wd as IZ,Xd as vZ,Yd as qZ,Zd as wZ,_d as yZ,ee as hZ}from"../chunk-tbf76adx.js";import{fe as N8,ge as x8}from"../chunk-w8hre8gz.js";import"../chunk-zqptpk90.js";import{$f as t5,Ae as B4,Af as I5,Be as c0,Bf as v5,Ce as j4,Cg as MZ,De as M4,Df as q5,Ef as z6,Ff as w5,Gg as LZ,He as mW,Ie as cW,Je as uW,Jf as y5,Ke as pW,Kf as A5,Le as dW,Lf as g5,Lg as w1,Me as lW,Ne as nW,Oe as iW,Of as E5,Pe as sW,Pf as m5,Qe as w0,Qf as c5,Re as oW,Rf as u5,Se as aW,Te as tW,Tf as p5,Ue as rW,Uf as d5,Ve as eW,Vf as l5,Wf as n5,Wg as NZ,Xf as i5,Xg as xZ,Yf as s5,Zf as o5,_f as a5,ag as r5,fg as k,gg as i,hg as e5,if as G5,ig as WZ,jf as z5,jg as ZZ,kf as X5,kg as $Z,lf as B5,lg as JZ,mf as j5,nf as M5,ng as QZ,og as YZ,pg as KZ,qe as Z6,qg as GZ,re as AW,rg as zZ,se as hW,te as gW,tf as f5,uf as C5,ug as XZ,ve as EW,vf as k5,vg as BZ,wf as b5,wg as jZ,xf as T5,yf as P5,ze as $6,zf as V5}from"../chunk-1pvfgfhj.js";import"../chunk-hr9twa8v.js";import"../chunk-m0nvysa5.js";import{Gi as Q5,Hi as Y5,Ji as K5,Li as P1,Ph as X4,Qh as K4,Rh as M1,ci as U4,fi as t,hi as d,li as G4,mi as L1,ni as T1,oi as W5,pi as Z5,qi as $5,ri as J5}from"../chunk-r22svpab.js";import"../chunk-4dnr1vg7.js";import{Vi as r}from"../chunk-4hhvaa7a.js";import{bj as U5,cj as O5,dj as b1,ej as S5,fj as v0,gj as R5,hj as _5}from"../chunk-6srzhv88.js";import{nj as F5,oj as D5,pj as H5}from"../chunk-0v46hne6.js";import"../chunk-rjsd8f8q.js";import{Yj as h5}from"../chunk-vzz91xsm.js";import{$j as N5,_j as L5,ak as x5}from"../chunk-d7a79eqm.js";import"../chunk-ksgeqtcv.js";import"../chunk-6rh3brnr.js";import"../chunk-vpmbynke.js";import"../chunk-9bcsfce4.js";import{Sk as FZ,Tk as DZ,Uk as HZ,Vk as UZ,Xk as OZ}from"../chunk-tzne38pa.js";import"../chunk-9zcsshgb.js";import{fl as w}from"../chunk-bsnp7h5w.js";import"../chunk-xtj7cgsx.js";import"../chunk-9pet8zmd.js";import"../chunk-ykd2ayw8.js";import"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import{Gl as A0}from"../chunk-xe126csw.js";import{Buffer as y0}from"buffer";class h0 extends L1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-699j2epd.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y=process.env.BUCKET_NAME;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket??Y,J=W.contentType||($ instanceof Blob||$ instanceof File?$.type:void 0);J=J||void 0;let K=$ instanceof y0?$:$ instanceof Blob||$ instanceof File?y0.from(await $.arrayBuffer()):"",{sdk:G,client:X}=await this.connect();return Z?.throwIfAborted(),await X.send(new G.PutObjectCommand({Bucket:Y,Key:Q,Body:K,ContentType:J}),{abortSignal:Z}),Q}async delete(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Z)throw Error("Object name has to be specified");let{sdk:J,client:Q}=await this.connect();try{await Q.send(new J.DeleteObjectCommand({Bucket:$,Key:Z}))}catch(Y){if(Y?.name==="NoSuchKey"||Y?.$metadata?.httpStatusCode===404)return;throw Y}}async*pages(W,{bucket:Z,signal:$}){let{sdk:J,client:Q}=await this.connect(),Y;do{$?.throwIfAborted();let K=await Q.send(new J.ListObjectsV2Command({Bucket:Z??process.env.BUCKET_NAME,Prefix:W,ContinuationToken:Y}),{abortSignal:$});yield(K.Contents??[]).map((G)=>({name:G.Key,size:G.Size??0,lastModified:G.LastModified??new Date(0)})),Y=K.IsTruncated?K.NextContinuationToken:void 0}while(Y)}async*objects(W,Z={}){for await(let $ of this.pages(W,Z))yield*$}async deletePrefix(W,Z={}){G4(W);let $=Z.bucket??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect(),Y=0;for await(let K of this.pages(W,{...Z,bucket:$})){if(K.length===0)continue;Z.signal?.throwIfAborted();let X=(await Q.send(new J.DeleteObjectsCommand({Bucket:$,Delete:{Objects:K.map((z)=>({Key:z.name})),Quiet:!0}}),{abortSignal:Z.signal}))?.Errors??[];if(X.length>0){let z=X[0];throw Error(`S3 could not delete ${X.length} object(s) under "${W}", e.g. "${z.Key}": ${z.Code??"unknown"} ${z.Message??""}`.trim())}Y+=K.length}return Y}async list(W){let{sdk:Z,client:$}=await this.connect();return await $.send(new Z.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else $=W.bucket??$,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Q,client:Y}=await this.connect();Z?.throwIfAborted();let K=await Y.send(new Q.GetObjectCommand({Bucket:$,Key:J}),{abortSignal:Z}),G=T1(K.Body.transformToWebStream(),Z);return Z?.throwIfAborted(),new Response(G,{headers:{"Content-Type":K.ContentType,"Content-Length":K.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":K.LastModified?.toUTCString()||"",ETag:K.ETag||""}})}async read(W){let Z=typeof W==="string"?{name:W}:W,$=Z.bucket??process.env.BUCKET_NAME,{name:J,range:Q=null}=Z;if(!J)throw Error("Object name has to be specified");let{sdk:Y,client:K}=await this.connect(),G;try{G=await K.send(new Y.GetObjectCommand({Bucket:$,Key:J,Range:Q?K4(Q):void 0}))}catch(j){if(j?.name==="InvalidRange"||j?.$metadata?.httpStatusCode===416)throw new t(await this.size({name:J,bucket:$}));if(j?.name==="NoSuchKey"||j?.$metadata?.httpStatusCode===404)throw new d(J);throw j}let X=M1(G.ContentRange),z=Boolean(X)&&G.$metadata?.httpStatusCode===206,B=X?.total??G.ContentLength??0;return{body:G.Body.transformToWebStream(),start:X?.start??0,end:X?.end??B-1,total:B,partial:z,type:G.ContentType??"application/octet-stream",etag:G.ETag||void 0,lastModified:G.LastModified,name:J}}async size(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect();try{return(await Q.send(new J.HeadObjectCommand({Bucket:$,Key:Z}))).ContentLength??0}catch(Y){if(Y?.name==="NotFound"||Y?.$metadata?.httpStatusCode===404)throw new d(Z);throw Y}}}import{Buffer as g0}from"buffer";import{Readable as s6}from"stream";function z4(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function o6(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class E0 extends L1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Z=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Z)return W.BlobServiceClient.fromConnectionString(Z);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Z){if(!W)throw Error("Object name has to be specified");let $=Z??this.config.container??process.env.BUCKET_NAME;if(!$)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient($).getBlockBlobClient(W)}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket,J=W.contentType??($ instanceof Blob||$ instanceof File?$.type:void 0);let K=$ instanceof g0?$:g0.from(await $.arrayBuffer()),G=await this.blob(Q,Y);return Z?.throwIfAborted(),await G.uploadData(K,{blobHTTPHeaders:J?{blobContentType:J}:void 0,abortSignal:Z}),Q}async*objects(W,{bucket:Z,signal:$}={}){$?.throwIfAborted();let J=Z??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");let Y=(await this.serviceClient()).getContainerClient(J);for await(let K of Y.listBlobsFlat({prefix:W}))$?.throwIfAborted(),yield{name:K.name,size:K.properties?.contentLength??0,lastModified:K.properties?.lastModified??new Date(0)}}async list(W){let Z=this.config.container??process.env.BUCKET_NAME,J=(await this.serviceClient()).getContainerClient(Z),Q=[];for await(let Y of J.listBlobsFlat({prefix:W}))Q.push(Y.name);return Q}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Z);return new Response($.body,{headers:{"Content-Type":$.type,"Content-Length":String($.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.lastModified?.toUTCString()??"",ETag:$.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Z){let{name:$,bucket:J,range:Q=null}=W,Y=await this.blob($,J);Z?.throwIfAborted();let K,G,X=Q?.kind==="suffix"||Q?.kind==="offset"&&Q.end===null&&Q.start===0;if(Q&&X){let H=await this.size({name:$,bucket:J}),p=X4(Q,H);if(!p)throw new t(H);K=p.start,G=p.length}else if(Q?.kind==="offset")K=Q.start,G=Q.end===null?void 0:Q.end-Q.start+1;let z;try{z=await Y.download(K,G,Z?{abortSignal:Z}:void 0)}catch(H){if(o6(H))throw new t(await this.size({name:$,bucket:J}));if(z4(H))throw new d($);throw H}let B=M1(z.contentRange),j=Boolean(B),x=B?.total??z.contentLength??0,O=await a6(z);if(O instanceof ReadableStream)O=T1(O,Z);return Z?.throwIfAborted(),{body:O,start:B?.start??0,end:B?.end??x-1,total:x,partial:j,type:z.contentType??"application/octet-stream",etag:z.etag||void 0,lastModified:z.lastModified,name:$}}async size(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{return(await J.getProperties()).contentLength??0}catch(Q){if(z4(Q))throw new d(Z);throw Q}}async delete(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{await J.delete()}catch(Q){if(z4(Q))return;throw Q}}}async function a6(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return s6.toWeb(W.readableStreamBody);return null}function t6(W){return W}class L4 extends Error{code="ERR_RATE_LIMITER_TIMEOUT";constructor(W){super(`RedisRateLimiter: Redis did not answer within ${W}ms.`);this.name="RedisRateLimiterTimeoutError"}}class V1 extends Error{code="ERR_RATE_LIMITER_DISCONNECTED";constructor(){super("RedisRateLimiter: the Redis client is not connected.");this.name="RedisRateLimiterDisconnectedError"}}var m0=1000,r6=60000,e6=`
|
|
2
|
+
import{db as E8}from"../chunk-8m9kgynj.js";import{Ab as H8,Bb as U8,Cb as O8,Db as S8,Eb as R8,Fb as T4,Gb as X6,Hb as C,Ib as _8,Jb as f8,Kb as C8,Lb as k8,Mb as b8,Nb as T8,Ob as P8,Pb as V8,Qb as I8,Rb as v8,Sb as q8,Tb as w8,Ub as y8,Vb as A8,Wb as h8,Xb as g8,eb as gZ,fb as EZ,gb as mZ,hb as cZ,ib as uZ,jb as f4,kb as pZ,lb as O4,mb as S4,nb as q1,ob as dZ,pb as lZ,qb as X8,ub as B8,vb as j8,wb as M8,xb as L8,yb as F8,zb as D8}from"../chunk-a8c7fe9s.js";import{_b as k4}from"../chunk-pbc3w7mq.js";import{Ad as rZ,Bd as eZ,Cd as W8,Dd as Z8,Ed as $8,Fd as J8,Gd as Q8,Hd as Y8,Id as K8,Jd as G8,Kd as z8,vd as nZ,wd as iZ,xd as sZ,yd as oZ,zd as aZ}from"../chunk-ywcfezjq.js";import{Ld as tZ}from"../chunk-9aj6eavs.js";import{$d as AZ,Md as SZ,Nd as RZ,Od as _Z,Pd as fZ,Qd as CZ,Rd as kZ,Sd as bZ,Td as TZ,Ud as PZ,Vd as VZ,Wd as IZ,Xd as vZ,Yd as qZ,Zd as wZ,_d as yZ,ee as hZ}from"../chunk-tbf76adx.js";import{fe as N8,ge as x8}from"../chunk-w8hre8gz.js";import"../chunk-zqptpk90.js";import{$f as t5,Ae as B4,Af as I5,Be as c0,Bf as v5,Ce as j4,Cg as MZ,De as M4,Df as q5,Ef as z6,Ff as w5,Gg as LZ,He as mW,Ie as cW,Je as uW,Jf as y5,Ke as pW,Kf as A5,Le as dW,Lf as g5,Lg as w1,Me as lW,Ne as nW,Oe as iW,Of as E5,Pe as sW,Pf as m5,Qe as w0,Qf as c5,Re as oW,Rf as u5,Se as aW,Te as tW,Tf as p5,Ue as rW,Uf as d5,Ve as eW,Vf as l5,Wf as n5,Wg as NZ,Xf as i5,Xg as xZ,Yf as s5,Zf as o5,_f as a5,ag as r5,fg as k,gg as i,hg as e5,if as G5,ig as WZ,jf as z5,jg as ZZ,kf as X5,kg as $Z,lf as B5,lg as JZ,mf as j5,nf as M5,ng as QZ,og as YZ,pg as KZ,qe as Z6,qg as GZ,re as AW,rg as zZ,se as hW,te as gW,tf as f5,uf as C5,ug as XZ,ve as EW,vf as k5,vg as BZ,wf as b5,wg as jZ,xf as T5,yf as P5,ze as $6,zf as V5}from"../chunk-d6x90qty.js";import"../chunk-hr9twa8v.js";import"../chunk-m0nvysa5.js";import{Gi as Q5,Hi as Y5,Ji as K5,Li as P1,Ph as X4,Qh as K4,Rh as M1,ci as U4,fi as t,hi as d,li as G4,mi as L1,ni as T1,oi as W5,pi as Z5,qi as $5,ri as J5}from"../chunk-r22svpab.js";import"../chunk-4dnr1vg7.js";import{Vi as r}from"../chunk-4hhvaa7a.js";import{bj as U5,cj as O5,dj as b1,ej as S5,fj as v0,gj as R5,hj as _5}from"../chunk-6srzhv88.js";import{nj as F5,oj as D5,pj as H5}from"../chunk-0v46hne6.js";import"../chunk-rjsd8f8q.js";import{Yj as h5}from"../chunk-vzz91xsm.js";import{$j as N5,_j as L5,ak as x5}from"../chunk-d7a79eqm.js";import"../chunk-ksgeqtcv.js";import"../chunk-6rh3brnr.js";import"../chunk-vpmbynke.js";import"../chunk-9bcsfce4.js";import{Sk as FZ,Tk as DZ,Uk as HZ,Vk as UZ,Xk as OZ}from"../chunk-tzne38pa.js";import"../chunk-9zcsshgb.js";import{fl as w}from"../chunk-bsnp7h5w.js";import"../chunk-xtj7cgsx.js";import"../chunk-ewf24h4z.js";import"../chunk-ykd2ayw8.js";import"../chunk-7gc1jp2z.js";import"../chunk-sjg5g92s.js";import{Gl as A0}from"../chunk-xe126csw.js";import{Buffer as y0}from"buffer";class h0 extends L1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-699j2epd.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y=process.env.BUCKET_NAME;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket??Y,J=W.contentType||($ instanceof Blob||$ instanceof File?$.type:void 0);J=J||void 0;let K=$ instanceof y0?$:$ instanceof Blob||$ instanceof File?y0.from(await $.arrayBuffer()):"",{sdk:G,client:X}=await this.connect();return Z?.throwIfAborted(),await X.send(new G.PutObjectCommand({Bucket:Y,Key:Q,Body:K,ContentType:J}),{abortSignal:Z}),Q}async delete(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Z)throw Error("Object name has to be specified");let{sdk:J,client:Q}=await this.connect();try{await Q.send(new J.DeleteObjectCommand({Bucket:$,Key:Z}))}catch(Y){if(Y?.name==="NoSuchKey"||Y?.$metadata?.httpStatusCode===404)return;throw Y}}async*pages(W,{bucket:Z,signal:$}){let{sdk:J,client:Q}=await this.connect(),Y;do{$?.throwIfAborted();let K=await Q.send(new J.ListObjectsV2Command({Bucket:Z??process.env.BUCKET_NAME,Prefix:W,ContinuationToken:Y}),{abortSignal:$});yield(K.Contents??[]).map((G)=>({name:G.Key,size:G.Size??0,lastModified:G.LastModified??new Date(0)})),Y=K.IsTruncated?K.NextContinuationToken:void 0}while(Y)}async*objects(W,Z={}){for await(let $ of this.pages(W,Z))yield*$}async deletePrefix(W,Z={}){G4(W);let $=Z.bucket??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect(),Y=0;for await(let K of this.pages(W,{...Z,bucket:$})){if(K.length===0)continue;Z.signal?.throwIfAborted();let X=(await Q.send(new J.DeleteObjectsCommand({Bucket:$,Delete:{Objects:K.map((z)=>({Key:z.name})),Quiet:!0}}),{abortSignal:Z.signal}))?.Errors??[];if(X.length>0){let z=X[0];throw Error(`S3 could not delete ${X.length} object(s) under "${W}", e.g. "${z.Key}": ${z.Code??"unknown"} ${z.Message??""}`.trim())}Y+=K.length}return Y}async list(W){let{sdk:Z,client:$}=await this.connect();return await $.send(new Z.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else $=W.bucket??$,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Q,client:Y}=await this.connect();Z?.throwIfAborted();let K=await Y.send(new Q.GetObjectCommand({Bucket:$,Key:J}),{abortSignal:Z}),G=T1(K.Body.transformToWebStream(),Z);return Z?.throwIfAborted(),new Response(G,{headers:{"Content-Type":K.ContentType,"Content-Length":K.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":K.LastModified?.toUTCString()||"",ETag:K.ETag||""}})}async read(W){let Z=typeof W==="string"?{name:W}:W,$=Z.bucket??process.env.BUCKET_NAME,{name:J,range:Q=null}=Z;if(!J)throw Error("Object name has to be specified");let{sdk:Y,client:K}=await this.connect(),G;try{G=await K.send(new Y.GetObjectCommand({Bucket:$,Key:J,Range:Q?K4(Q):void 0}))}catch(j){if(j?.name==="InvalidRange"||j?.$metadata?.httpStatusCode===416)throw new t(await this.size({name:J,bucket:$}));if(j?.name==="NoSuchKey"||j?.$metadata?.httpStatusCode===404)throw new d(J);throw j}let X=M1(G.ContentRange),z=Boolean(X)&&G.$metadata?.httpStatusCode===206,B=X?.total??G.ContentLength??0;return{body:G.Body.transformToWebStream(),start:X?.start??0,end:X?.end??B-1,total:B,partial:z,type:G.ContentType??"application/octet-stream",etag:G.ETag||void 0,lastModified:G.LastModified,name:J}}async size(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect();try{return(await Q.send(new J.HeadObjectCommand({Bucket:$,Key:Z}))).ContentLength??0}catch(Y){if(Y?.name==="NotFound"||Y?.$metadata?.httpStatusCode===404)throw new d(Z);throw Y}}}import{Buffer as g0}from"buffer";import{Readable as s6}from"stream";function z4(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function o6(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class E0 extends L1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Z=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Z)return W.BlobServiceClient.fromConnectionString(Z);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Z){if(!W)throw Error("Object name has to be specified");let $=Z??this.config.container??process.env.BUCKET_NAME;if(!$)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient($).getBlockBlobClient(W)}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket,J=W.contentType??($ instanceof Blob||$ instanceof File?$.type:void 0);let K=$ instanceof g0?$:g0.from(await $.arrayBuffer()),G=await this.blob(Q,Y);return Z?.throwIfAborted(),await G.uploadData(K,{blobHTTPHeaders:J?{blobContentType:J}:void 0,abortSignal:Z}),Q}async*objects(W,{bucket:Z,signal:$}={}){$?.throwIfAborted();let J=Z??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");let Y=(await this.serviceClient()).getContainerClient(J);for await(let K of Y.listBlobsFlat({prefix:W}))$?.throwIfAborted(),yield{name:K.name,size:K.properties?.contentLength??0,lastModified:K.properties?.lastModified??new Date(0)}}async list(W){let Z=this.config.container??process.env.BUCKET_NAME,J=(await this.serviceClient()).getContainerClient(Z),Q=[];for await(let Y of J.listBlobsFlat({prefix:W}))Q.push(Y.name);return Q}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Z);return new Response($.body,{headers:{"Content-Type":$.type,"Content-Length":String($.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.lastModified?.toUTCString()??"",ETag:$.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Z){let{name:$,bucket:J,range:Q=null}=W,Y=await this.blob($,J);Z?.throwIfAborted();let K,G,X=Q?.kind==="suffix"||Q?.kind==="offset"&&Q.end===null&&Q.start===0;if(Q&&X){let H=await this.size({name:$,bucket:J}),p=X4(Q,H);if(!p)throw new t(H);K=p.start,G=p.length}else if(Q?.kind==="offset")K=Q.start,G=Q.end===null?void 0:Q.end-Q.start+1;let z;try{z=await Y.download(K,G,Z?{abortSignal:Z}:void 0)}catch(H){if(o6(H))throw new t(await this.size({name:$,bucket:J}));if(z4(H))throw new d($);throw H}let B=M1(z.contentRange),j=Boolean(B),x=B?.total??z.contentLength??0,O=await a6(z);if(O instanceof ReadableStream)O=T1(O,Z);return Z?.throwIfAborted(),{body:O,start:B?.start??0,end:B?.end??x-1,total:x,partial:j,type:z.contentType??"application/octet-stream",etag:z.etag||void 0,lastModified:z.lastModified,name:$}}async size(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{return(await J.getProperties()).contentLength??0}catch(Q){if(z4(Q))throw new d(Z);throw Q}}async delete(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{await J.delete()}catch(Q){if(z4(Q))return;throw Q}}}async function a6(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return s6.toWeb(W.readableStreamBody);return null}function t6(W){return W}class L4 extends Error{code="ERR_RATE_LIMITER_TIMEOUT";constructor(W){super(`RedisRateLimiter: Redis did not answer within ${W}ms.`);this.name="RedisRateLimiterTimeoutError"}}class V1 extends Error{code="ERR_RATE_LIMITER_DISCONNECTED";constructor(){super("RedisRateLimiter: the Redis client is not connected.");this.name="RedisRateLimiterDisconnectedError"}}var m0=1000,r6=60000,e6=`
|
|
3
3
|
local currentKey = KEYS[1]
|
|
4
4
|
local previousKey = KEYS[2]
|
|
5
5
|
local limit = tonumber(ARGV[1])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewRouteDispatcher.d.ts","sourceRoot":"","sources":["../../../services/router/ViewRouteDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,2BAA2B,CAAC;AAEjG,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAWlB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBpD,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,kBAAkB,CAAC;AAiH1B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,QAY9D;AAaD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAQ1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAM7D;AAED,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,KAAK,SAAiB;IAE7B,cAAc,EAAE,cAAc,CAAM;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAM;IAC7C,0FAA0F;IAC1F,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAM;IACnD,aAAa,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CAAC,kBAAkB;IA0C1B;;;;;;OAMG;YACW,YAAY;YAiJZ,MAAM;IA2gBpB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,iBAAiB;IAyBnB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,gCAvb7C;QACpB;;;;;WAKG;QACH,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,OAAO,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5F,aAAa,EAAE,GAAG,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC3B;;;;WAIG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC;;;;;;;;;;;WAWG;QACH,WAAW,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;QACpD;;;WAGG;QACH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,wEAAwE;QACxE,aAAa,CAAC,EAAE,cAAc,CAAC;QAC/B;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CAilCJ"}
|
|
@@ -17,6 +17,12 @@ export type IslandAsset = {
|
|
|
17
17
|
export type IslandResolver = (moduleKey: string) => IslandAsset | undefined;
|
|
18
18
|
/** The id of the JSON block the loader reads its island table from. */
|
|
19
19
|
export declare const ISLAND_DATA_ID = "gemi-islands";
|
|
20
|
+
/**
|
|
21
|
+
* The id of the JSON block with the page's i18n for its islands (#1095): the
|
|
22
|
+
* locale, zone and the dictionaries islands read. Only on a page whose
|
|
23
|
+
* islands read any of it. Its id is also in `ISLAND_HYDRATE_SOURCE`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ISLAND_I18N_DATA_ID = "gemi-island-i18n";
|
|
20
26
|
/**
|
|
21
27
|
* `'sha256-…'` for the production island loader, ready to put in a
|
|
22
28
|
* `script-src` directive. The dev loader also installs the React Refresh
|
|
@@ -63,6 +69,10 @@ export interface DocumentScript {
|
|
|
63
69
|
* Without a resolver (a test rendering through `app.fetch`), no island table
|
|
64
70
|
* is injected and nothing is logged.
|
|
65
71
|
*
|
|
72
|
+
* When islands read the page's i18n (`useDictionary`, `useFormatter`), the
|
|
73
|
+
* locale, zone and the dictionaries they read go next to the table, so they
|
|
74
|
+
* hydrate with the strings they rendered without fetching them (#1095).
|
|
75
|
+
*
|
|
66
76
|
* A `script` (`.static({ script })`) is inlined at the end of the head as a
|
|
67
77
|
* module script, whatever else the page has. The navigation runtime leaves
|
|
68
78
|
* the head's scripts alone when it swaps a page in, so it runs once per
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticDocument.d.ts","sourceRoot":"","sources":["../../../services/router/staticDocument.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"staticDocument.d.ts","sourceRoot":"","sources":["../../../services/router/staticDocument.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAGlF,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAExF,qFAAqF;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;AAE5E,uEAAuE;AACvE,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,QAEb,CAAC;AAgBvB;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,QAEjB,CAAC;AAWvB,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B;AAED,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,qBAAqB,EAChC,aAAa,EAAE,cAAc,GAAG,SAAS,EACzC,GAAG,EAAE,OAAO,EACZ,UAAU,CAAC,EAAE,sBAAsB,EACnC,MAAM,CAAC,EAAE,cAAc,GACtB,MAAM,CAuDR;AAcD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgBtD"}
|
package/dist/testing/index.js
CHANGED
|
@@ -544,6 +544,14 @@ var Boundary = (props) => {
|
|
|
544
544
|
* `data-uid` is the `identifierPrefix` the server rendered the island with, so
|
|
545
545
|
* `useId` agrees on both sides and two islands never share an id.
|
|
546
546
|
*
|
|
547
|
+
* When the page carries `#gemi-island-i18n` (its islands read the page's
|
|
548
|
+
* locale or dictionaries, #1095), the dictionaries in it are seeded into the
|
|
549
|
+
* dictionary registry through `__GEMI_DICT__` and the island's root gets the
|
|
550
|
+
* locale and zone in `IslandI18nContext` (found on `globalThis`, where
|
|
551
|
+
* `gemi/client` puts it), so `useDictionary` resolves synchronously, with the
|
|
552
|
+
* strings the server rendered, and fetches nothing. An island that does not
|
|
553
|
+
* import `gemi/client` has no such context to read, and is left as it was.
|
|
554
|
+
*
|
|
547
555
|
* Written as a function body with `createElement` and `hydrateRoot` free, so a
|
|
548
556
|
* test can run it against real React without a bundler.
|
|
549
557
|
*/
|
|
@@ -567,7 +575,18 @@ var ISLAND_HYDRATE_SOURCE = `function h(marker, Component) {
|
|
|
567
575
|
dangerouslySetInnerHTML: { __html: slot.innerHTML },
|
|
568
576
|
})]
|
|
569
577
|
: [];
|
|
570
|
-
|
|
578
|
+
let element = createElement(Component, props, ...children);
|
|
579
|
+
const i18n = document.getElementById("gemi-island-i18n");
|
|
580
|
+
const context = globalThis[Symbol.for("gemi.islandI18n")];
|
|
581
|
+
if (i18n && context) {
|
|
582
|
+
const payload = (i18n.p = i18n.p || JSON.parse(i18n.textContent));
|
|
583
|
+
const dictionaries = (self.__GEMI_DICT__ = self.__GEMI_DICT__ || []);
|
|
584
|
+
for (const entry of payload.dictionaries || []) dictionaries.push(entry);
|
|
585
|
+
element = createElement(context.Provider, {
|
|
586
|
+
value: { currentLocale: payload.currentLocale, defaultLocale: payload.defaultLocale, timeZone: payload.timeZone },
|
|
587
|
+
}, element);
|
|
588
|
+
}
|
|
589
|
+
return hydrateRoot(marker, element, {
|
|
571
590
|
identifierPrefix: marker.getAttribute("data-uid") || undefined,
|
|
572
591
|
});
|
|
573
592
|
}`;
|