gemi 0.105.0 → 0.107.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/Agent.d.ts +88 -10
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +29 -1
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +6 -0
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/Schema.d.ts +26 -3
- package/dist/ai/Schema.d.ts.map +1 -1
- package/dist/ai/client/index.js +86 -25
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/client/reducer.d.ts.map +1 -1
- package/dist/ai/contextWindow.d.ts +122 -0
- package/dist/ai/contextWindow.d.ts.map +1 -0
- package/dist/ai/index.d.ts +4 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +14 -14
- package/dist/ai/index.js.map +10 -9
- package/dist/ai/providers/request.d.ts +1 -1
- package/dist/ai/providers/request.d.ts.map +1 -1
- package/dist/ai/providers/stream.d.ts.map +1 -1
- package/dist/ai/types.d.ts +50 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/useChat.d.ts +47 -1
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gemi.js +2 -2
- package/dist/bin/gemi.js.map +4 -4
- package/dist/bun/customRequestParser.d.ts +9 -0
- package/dist/bun/customRequestParser.d.ts.map +1 -0
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +2 -2
- package/dist/{chunk-rjcmbwcc.js → chunk-00y49jcf.js} +2 -2
- package/dist/{chunk-rjcmbwcc.js.map → chunk-00y49jcf.js.map} +1 -1
- package/dist/{chunk-22k4b395.js → chunk-1npdp1w2.js} +2 -2
- package/dist/{chunk-22k4b395.js.map → chunk-1npdp1w2.js.map} +1 -1
- package/dist/{chunk-j6e99sra.js → chunk-1rs13253.js} +75 -75
- package/dist/{chunk-j6e99sra.js.map → chunk-1rs13253.js.map} +4 -5
- package/dist/{chunk-0fney17e.js → chunk-2gmgd05c.js} +2 -2
- package/dist/{chunk-0fney17e.js.map → chunk-2gmgd05c.js.map} +1 -1
- package/dist/{chunk-4f7n1r02.js → chunk-2q7m8a16.js} +2 -2
- package/dist/{chunk-4f7n1r02.js.map → chunk-2q7m8a16.js.map} +1 -1
- package/dist/{chunk-cbywzv21.js → chunk-2xqrh6d0.js} +1 -1
- package/dist/{chunk-gyareq03.js → chunk-331s9wqr.js} +3 -3
- package/dist/{chunk-gyareq03.js.map → chunk-331s9wqr.js.map} +1 -1
- package/dist/{chunk-1xzdexbq.js → chunk-3s3awh38.js} +2 -2
- package/dist/{chunk-1xzdexbq.js.map → chunk-3s3awh38.js.map} +1 -1
- package/dist/{chunk-v4exgqbp.js → chunk-47rgq59q.js} +2 -2
- package/dist/{chunk-v4exgqbp.js.map → chunk-47rgq59q.js.map} +1 -1
- package/dist/{chunk-fcsq613t.js → chunk-4rr9wmh8.js} +2 -2
- package/dist/{chunk-fcsq613t.js.map → chunk-4rr9wmh8.js.map} +1 -1
- package/dist/{chunk-9a8qz3s7.js → chunk-564zfdd1.js} +2 -2
- package/dist/{chunk-9a8qz3s7.js.map → chunk-564zfdd1.js.map} +1 -1
- package/dist/chunk-5mj7a141.js +17 -0
- package/dist/{chunk-48wh5mbp.js.map → chunk-5mj7a141.js.map} +12 -7
- package/dist/{chunk-st0d3ndv.js → chunk-5wt25tyd.js} +2 -2
- package/dist/{chunk-st0d3ndv.js.map → chunk-5wt25tyd.js.map} +1 -1
- package/dist/{chunk-gy6d6jeg.js → chunk-661wezaf.js} +2 -2
- package/dist/{chunk-gy6d6jeg.js.map → chunk-661wezaf.js.map} +1 -1
- package/dist/{chunk-yxh4xs3k.js → chunk-6rz8kyqb.js} +2 -2
- package/dist/{chunk-yxh4xs3k.js.map → chunk-6rz8kyqb.js.map} +1 -1
- package/dist/{chunk-y926fhhz.js → chunk-6tyf0h6k.js} +2 -2
- package/dist/{chunk-y926fhhz.js.map → chunk-6tyf0h6k.js.map} +1 -1
- package/dist/{chunk-18aqqrev.js → chunk-6wrhc9bq.js} +3 -3
- package/dist/{chunk-18aqqrev.js.map → chunk-6wrhc9bq.js.map} +1 -1
- package/dist/{chunk-w8mm0z6r.js → chunk-6zqqec7r.js} +2 -2
- package/dist/{chunk-w8mm0z6r.js.map → chunk-6zqqec7r.js.map} +1 -1
- package/dist/{chunk-3m93v7bt.js → chunk-82hpq0bq.js} +2 -2
- package/dist/{chunk-3m93v7bt.js.map → chunk-82hpq0bq.js.map} +1 -1
- package/dist/{chunk-ee92kx8s.js → chunk-8pynv9rw.js} +2 -2
- package/dist/{chunk-ee92kx8s.js.map → chunk-8pynv9rw.js.map} +1 -1
- package/dist/{chunk-7kedxtbp.js → chunk-9hbwvcxn.js} +2 -2
- package/dist/{chunk-7kedxtbp.js.map → chunk-9hbwvcxn.js.map} +1 -1
- package/dist/{chunk-47dqttnk.js → chunk-9jz4rggd.js} +2 -2
- package/dist/{chunk-47dqttnk.js.map → chunk-9jz4rggd.js.map} +1 -1
- package/dist/{chunk-xnggfm0s.js → chunk-9mqqr05d.js} +3 -3
- package/dist/{chunk-xnggfm0s.js.map → chunk-9mqqr05d.js.map} +1 -1
- package/dist/{chunk-gvkydx8r.js → chunk-9r3znmqq.js} +2 -2
- package/dist/{chunk-gvkydx8r.js.map → chunk-9r3znmqq.js.map} +1 -1
- package/dist/{chunk-zq5m4scz.js → chunk-a1g0bahx.js} +2 -2
- package/dist/{chunk-zq5m4scz.js.map → chunk-a1g0bahx.js.map} +1 -1
- package/dist/{chunk-5ngv175h.js → chunk-anp4kv3w.js} +1 -1
- package/dist/{chunk-214av8am.js → chunk-cfsscms3.js} +4 -4
- package/dist/{chunk-214av8am.js.map → chunk-cfsscms3.js.map} +1 -1
- package/dist/{chunk-q8r9mvzx.js → chunk-eytdyahy.js} +2 -2
- package/dist/{chunk-q8r9mvzx.js.map → chunk-eytdyahy.js.map} +1 -1
- package/dist/{chunk-j041a7ej.js → chunk-ffagkj3x.js} +2 -2
- package/dist/{chunk-j041a7ej.js.map → chunk-ffagkj3x.js.map} +1 -1
- package/dist/{chunk-gvv2trvz.js → chunk-fq3sb3xt.js} +3 -3
- package/dist/{chunk-gvv2trvz.js.map → chunk-fq3sb3xt.js.map} +1 -1
- package/dist/{chunk-b1dqx3b9.js → chunk-ftgd68se.js} +3 -3
- package/dist/{chunk-b1dqx3b9.js.map → chunk-ftgd68se.js.map} +1 -1
- package/dist/{chunk-j9deswmn.js → chunk-fwympxqk.js} +2 -2
- package/dist/{chunk-j9deswmn.js.map → chunk-fwympxqk.js.map} +1 -1
- package/dist/{chunk-5dwtmkk8.js → chunk-gqpge54c.js} +2 -2
- package/dist/{chunk-5dwtmkk8.js.map → chunk-gqpge54c.js.map} +1 -1
- package/dist/{chunk-r5pnz4nn.js → chunk-h3t4n0bn.js} +2 -2
- package/dist/{chunk-r5pnz4nn.js.map → chunk-h3t4n0bn.js.map} +1 -1
- package/dist/{chunk-zm00crsx.js → chunk-h4x7cba0.js} +3 -3
- package/dist/{chunk-zm00crsx.js.map → chunk-h4x7cba0.js.map} +1 -1
- package/dist/{chunk-b0jpvp5t.js → chunk-h7pafjej.js} +3 -3
- package/dist/{chunk-b0jpvp5t.js.map → chunk-h7pafjej.js.map} +1 -1
- package/dist/{chunk-63hvh35x.js → chunk-hdhahvd4.js} +2 -2
- package/dist/{chunk-63hvh35x.js.map → chunk-hdhahvd4.js.map} +1 -1
- package/dist/{chunk-zytmxty5.js → chunk-hyfzw1fk.js} +2 -2
- package/dist/{chunk-zytmxty5.js.map → chunk-hyfzw1fk.js.map} +1 -1
- package/dist/{chunk-zmag8k0z.js → chunk-jnw73s8c.js} +2 -2
- package/dist/{chunk-zmag8k0z.js.map → chunk-jnw73s8c.js.map} +1 -1
- package/dist/{chunk-bsq80942.js → chunk-k17prwhx.js} +3 -3
- package/dist/{chunk-bsq80942.js.map → chunk-k17prwhx.js.map} +1 -1
- package/dist/{chunk-xxkk60aw.js → chunk-k9qmr2wa.js} +3 -3
- package/dist/{chunk-xxkk60aw.js.map → chunk-k9qmr2wa.js.map} +1 -1
- package/dist/chunk-kda25fn4.js +5 -0
- package/dist/chunk-kda25fn4.js.map +10 -0
- package/dist/{chunk-cw7qfcvt.js → chunk-kh273hj0.js} +2 -2
- package/dist/{chunk-cw7qfcvt.js.map → chunk-kh273hj0.js.map} +1 -1
- package/dist/{chunk-kwkbzswm.js → chunk-kqff894s.js} +2 -2
- package/dist/{chunk-kwkbzswm.js.map → chunk-kqff894s.js.map} +1 -1
- package/dist/{chunk-ma5rmcbe.js → chunk-kqz8jp6v.js} +2 -2
- package/dist/{chunk-ma5rmcbe.js.map → chunk-kqz8jp6v.js.map} +1 -1
- package/dist/{chunk-dtybftkq.js → chunk-kstvyvr0.js} +2 -2
- package/dist/{chunk-dtybftkq.js.map → chunk-kstvyvr0.js.map} +1 -1
- package/dist/{chunk-h945tg0r.js → chunk-m31pfz1s.js} +2 -2
- package/dist/{chunk-h945tg0r.js.map → chunk-m31pfz1s.js.map} +1 -1
- package/dist/{chunk-4p752vk2.js → chunk-mhq2bd9c.js} +3 -3
- package/dist/{chunk-4p752vk2.js.map → chunk-mhq2bd9c.js.map} +1 -1
- package/dist/chunk-mrvcaakf.js +5 -0
- package/dist/{chunk-f2n21fef.js.map → chunk-mrvcaakf.js.map} +1 -1
- package/dist/{chunk-ayss2f8c.js → chunk-njkk498k.js} +2 -2
- package/dist/{chunk-ayss2f8c.js.map → chunk-njkk498k.js.map} +1 -1
- package/dist/{chunk-hwc8gt4n.js → chunk-pj2e1p07.js} +2 -2
- package/dist/{chunk-hwc8gt4n.js.map → chunk-pj2e1p07.js.map} +1 -1
- package/dist/{chunk-5k3rm4b6.js → chunk-q2fyp44f.js} +2 -2
- package/dist/{chunk-5k3rm4b6.js.map → chunk-q2fyp44f.js.map} +1 -1
- package/dist/{chunk-53we503k.js → chunk-q7y9v2v5.js} +3 -3
- package/dist/{chunk-53we503k.js.map → chunk-q7y9v2v5.js.map} +1 -1
- package/dist/chunk-rh9j8cwv.js +9 -0
- package/dist/chunk-rh9j8cwv.js.map +31 -0
- package/dist/{chunk-sedwjgvf.js → chunk-rjernda5.js} +2 -2
- package/dist/{chunk-sedwjgvf.js.map → chunk-rjernda5.js.map} +1 -1
- package/dist/{chunk-2baxmae9.js → chunk-rn2kgbg4.js} +2 -2
- package/dist/{chunk-2baxmae9.js.map → chunk-rn2kgbg4.js.map} +1 -1
- package/dist/{chunk-8nkdvgd9.js → chunk-sbyqs03h.js} +2 -2
- package/dist/{chunk-8nkdvgd9.js.map → chunk-sbyqs03h.js.map} +1 -1
- package/dist/{chunk-wc46df4w.js → chunk-t26n9vzw.js} +2 -2
- package/dist/{chunk-wc46df4w.js.map → chunk-t26n9vzw.js.map} +1 -1
- package/dist/{chunk-8z37k28d.js → chunk-tvy2fqza.js} +2 -2
- package/dist/{chunk-8z37k28d.js.map → chunk-tvy2fqza.js.map} +1 -1
- package/dist/{chunk-zhk3z9zk.js → chunk-tyhrrnp5.js} +3 -3
- package/dist/{chunk-zhk3z9zk.js.map → chunk-tyhrrnp5.js.map} +1 -1
- package/dist/{chunk-vh1hxm9y.js → chunk-v52dyw0q.js} +3 -3
- package/dist/{chunk-vh1hxm9y.js.map → chunk-v52dyw0q.js.map} +1 -1
- package/dist/{chunk-k6rd1nd4.js → chunk-vbm1ng3f.js} +3 -3
- package/dist/{chunk-k6rd1nd4.js.map → chunk-vbm1ng3f.js.map} +1 -1
- package/dist/{chunk-p2jn4bnx.js → chunk-vj2t77x1.js} +2 -2
- package/dist/{chunk-p2jn4bnx.js.map → chunk-vj2t77x1.js.map} +1 -1
- package/dist/{chunk-mnctdd8r.js → chunk-we2sj339.js} +2 -2
- package/dist/{chunk-mnctdd8r.js.map → chunk-we2sj339.js.map} +1 -1
- package/dist/{chunk-szrgwggb.js → chunk-wedwkqe7.js} +3 -3
- package/dist/{chunk-szrgwggb.js.map → chunk-wedwkqe7.js.map} +1 -1
- package/dist/{chunk-pfjr510h.js → chunk-wsftnxzs.js} +2 -2
- package/dist/{chunk-pfjr510h.js.map → chunk-wsftnxzs.js.map} +1 -1
- package/dist/{chunk-62cv9vjt.js → chunk-wzqkdmjd.js} +2 -2
- package/dist/{chunk-62cv9vjt.js.map → chunk-wzqkdmjd.js.map} +1 -1
- package/dist/{chunk-rkre6bqc.js → chunk-xg9vye7c.js} +1 -1
- package/dist/{chunk-vqvdptx4.js → chunk-xpyhmg45.js} +2 -2
- package/dist/{chunk-vqvdptx4.js.map → chunk-xpyhmg45.js.map} +1 -1
- package/dist/{chunk-hzmnqe4x.js → chunk-ydkjf626.js} +2 -2
- package/dist/{chunk-hzmnqe4x.js.map → chunk-ydkjf626.js.map} +1 -1
- package/dist/{chunk-jfnhzza6.js → chunk-yebaheh7.js} +3 -3
- package/dist/{chunk-jfnhzza6.js.map → chunk-yebaheh7.js.map} +1 -1
- package/dist/chunk-z38355mx.js +6 -0
- package/dist/{chunk-dtcy3110.js.map → chunk-z38355mx.js.map} +2 -2
- package/dist/{chunk-dyew1yf7.js → chunk-zrdbytx4.js} +2 -2
- package/dist/{chunk-dyew1yf7.js.map → chunk-zrdbytx4.js.map} +1 -1
- 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/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/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/BodyLimitMiddleware.d.ts +27 -0
- package/dist/http/BodyLimitMiddleware.d.ts.map +1 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/bodyLimit.d.ts +45 -0
- package/dist/http/bodyLimit.d.ts.map +1 -0
- package/dist/http/index.d.ts +3 -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/middleware-config.d.ts +8 -0
- package/dist/http/middleware-config.d.ts.map +1 -1
- package/dist/http/safeFetch/addresses.d.ts +60 -0
- package/dist/http/safeFetch/addresses.d.ts.map +1 -0
- package/dist/http/safeFetch/errors.d.ts +78 -0
- package/dist/http/safeFetch/errors.d.ts.map +1 -0
- package/dist/http/safeFetch/index.d.ts +4 -0
- package/dist/http/safeFetch/index.d.ts.map +1 -0
- package/dist/http/safeFetch/safeFetch.d.ts +82 -0
- package/dist/http/safeFetch/safeFetch.d.ts.map +1 -0
- 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/kernel/index.js +2 -2
- package/dist/kernel/index.js.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/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/middleware/MiddlewareRegistry.d.ts +8 -0
- package/dist/services/middleware/MiddlewareRegistry.d.ts.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/vitest/index.d.ts +27 -0
- package/dist/vitest/index.d.ts.map +1 -0
- package/dist/vitest/index.js +4 -0
- package/dist/vitest/index.js.map +10 -0
- package/package.json +3 -2
- package/dist/chunk-3cxbvrts.js +0 -9
- package/dist/chunk-3cxbvrts.js.map +0 -31
- package/dist/chunk-48wh5mbp.js +0 -17
- package/dist/chunk-dtcy3110.js +0 -6
- package/dist/chunk-f2n21fef.js +0 -5
- /package/dist/{chunk-cbywzv21.js.map → chunk-2xqrh6d0.js.map} +0 -0
- /package/dist/{chunk-5ngv175h.js.map → chunk-anp4kv3w.js.map} +0 -0
- /package/dist/{chunk-rkre6bqc.js.map → chunk-xg9vye7c.js.map} +0 -0
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Shallow-merges an app config slice over the framework defaults, ignoring keys\n * whose value is `undefined`.\n *\n * A plain `{ ...defaults, ...config }` lets an explicit `undefined` win — a\n * `defineMailConfig({ headers: undefined })`, or any optional property the app\n * spread in from another object, would erase the default and hand the service a\n * missing dependency. Omitting a key and setting it to `undefined` mean the\n * same thing for a config slice, so both fall back to the default here.\n */\nexport function withDefaults<T extends object>(\n defaults: Required<T>,\n config: Partial<T> | undefined,\n): Required<T>;\nexport function withDefaults<D extends object, C extends object>(\n defaults: D,\n config: C | undefined,\n): D & C;\nexport function withDefaults(\n defaults: Record<string, any>,\n config: Record<string, any> | undefined,\n) {\n const merged: Record<string, any> = { ...defaults };\n if (!config) {\n return merged;\n }\n for (const key of Object.keys(config)) {\n if (config[key] !== undefined) {\n merged[key] = config[key];\n }\n }\n return merged;\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAkBO,SAAS,CAAY,CAC1B,EACA,EACA,CACA,IAAM,EAA8B,IAAK,CAAS,EAClD,GAAI,CAAC,EACH,OAAO,EAET,QAAW,KAAO,OAAO,KAAK,CAAM,EAClC,GAAI,EAAO,KAAS,OAClB,EAAO,GAAO,EAAO,GAGzB,OAAO",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "6C7E4672EAC8D1EF64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_ as J}from"./chunk-
|
|
2
|
+
import{_ as J}from"./chunk-eytdyahy.js";import{rh as I}from"./chunk-3s3awh38.js";var Z=I((Q)=>{var K=J(),L=(b)=>{return{setHttpHandler(j){b.httpHandler=j},httpHandler(){return b.httpHandler},updateHttpClientConfig(j,w){b.httpHandler?.updateHttpClientConfig(j,w)},httpHandlerConfigs(){return b.httpHandler.httpHandlerConfigs()}}},M=(b)=>{return{httpHandler:b.httpHandler()}};class B{name;kind;values;constructor({name:b,kind:j=K.FieldPosition.HEADER,values:w=[]}){this.name=b,this.kind=j,this.values=w}add(b){this.values.push(b)}set(b){this.values=b}remove(b){this.values=this.values.filter((j)=>j!==b)}toString(){return this.values.map((b)=>b.includes(",")||b.includes(" ")?`"${b}"`:b).join(", ")}get(){return this.values}}class D{entries={};encoding;constructor({fields:b=[],encoding:j="utf-8"}){b.forEach(this.setField.bind(this)),this.encoding=j}setField(b){this.entries[b.name.toLowerCase()]=b}getField(b){return this.entries[b.toLowerCase()]}removeField(b){delete this.entries[b.toLowerCase()]}getByType(b){return Object.values(this.entries).filter((j)=>j.kind===b)}}class z{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(b){this.method=b.method||"GET",this.hostname=b.hostname||"localhost",this.port=b.port,this.query=b.query||{},this.headers=b.headers||{},this.body=b.body,this.protocol=b.protocol?b.protocol.slice(-1)!==":"?`${b.protocol}:`:b.protocol:"https:",this.path=b.path?b.path.charAt(0)!=="/"?`/${b.path}`:b.path:"/",this.username=b.username,this.password=b.password,this.fragment=b.fragment}static clone(b){let j=new z({...b,headers:{...b.headers}});if(j.query)j.query=O(j.query);return j}static isInstance(b){if(!b)return!1;let j=b;return"method"in j&&"protocol"in j&&"hostname"in j&&"path"in j&&typeof j.query==="object"&&typeof j.headers==="object"}clone(){return z.clone(this)}}function O(b){return Object.keys(b).reduce((j,w)=>{let A=b[w];return{...j,[w]:Array.isArray(A)?[...A]:A}},{})}class G{statusCode;reason;headers;body;constructor(b){this.statusCode=b.statusCode,this.reason=b.reason,this.headers=b.headers||{},this.body=b.body}static isInstance(b){if(!b)return!1;let j=b;return typeof j.statusCode==="number"&&typeof j.headers==="object"}}function P(b){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(b)}Q.Field=B;Q.Fields=D;Q.HttpRequest=z;Q.HttpResponse=G;Q.getHttpHandlerExtensionConfiguration=L;Q.isValidHostname=P;Q.resolveHttpHandlerRuntimeConfig=M});
|
|
3
3
|
export{Z as U};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=5012786FB15268E264756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nvar types = require('@smithy/types');\n\nconst getHttpHandlerExtensionConfiguration = (runtimeConfig) => {\n return {\n setHttpHandler(handler) {\n runtimeConfig.httpHandler = handler;\n },\n httpHandler() {\n return runtimeConfig.httpHandler;\n },\n updateHttpClientConfig(key, value) {\n runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);\n },\n httpHandlerConfigs() {\n return runtimeConfig.httpHandler.httpHandlerConfigs();\n },\n };\n};\nconst resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {\n return {\n httpHandler: httpHandlerExtensionConfiguration.httpHandler(),\n };\n};\n\nclass Field {\n name;\n kind;\n values;\n constructor({ name, kind = types.FieldPosition.HEADER, values = [] }) {\n this.name = name;\n this.kind = kind;\n this.values = values;\n }\n add(value) {\n this.values.push(value);\n }\n set(values) {\n this.values = values;\n }\n remove(value) {\n this.values = this.values.filter((v) => v !== value);\n }\n toString() {\n return this.values.map((v) => (v.includes(\",\") || v.includes(\" \") ? `\"${v}\"` : v)).join(\", \");\n }\n get() {\n return this.values;\n }\n}\n\nclass Fields {\n entries = {};\n encoding;\n constructor({ fields = [], encoding = \"utf-8\" }) {\n fields.forEach(this.setField.bind(this));\n this.encoding = encoding;\n }\n setField(field) {\n this.entries[field.name.toLowerCase()] = field;\n }\n getField(name) {\n return this.entries[name.toLowerCase()];\n }\n removeField(name) {\n delete this.entries[name.toLowerCase()];\n }\n getByType(kind) {\n return Object.values(this.entries).filter((field) => field.kind === kind);\n }\n}\n\nclass HttpRequest {\n method;\n protocol;\n hostname;\n port;\n path;\n query;\n headers;\n username;\n password;\n fragment;\n body;\n constructor(options) {\n this.method = options.method || \"GET\";\n this.hostname = options.hostname || \"localhost\";\n this.port = options.port;\n this.query = options.query || {};\n this.headers = options.headers || {};\n this.body = options.body;\n this.protocol = options.protocol\n ? options.protocol.slice(-1) !== \":\"\n ? `${options.protocol}:`\n : options.protocol\n : \"https:\";\n this.path = options.path ? (options.path.charAt(0) !== \"/\" ? `/${options.path}` : options.path) : \"/\";\n this.username = options.username;\n this.password = options.password;\n this.fragment = options.fragment;\n }\n static clone(request) {\n const cloned = new HttpRequest({\n ...request,\n headers: { ...request.headers },\n });\n if (cloned.query) {\n cloned.query = cloneQuery(cloned.query);\n }\n return cloned;\n }\n static isInstance(request) {\n if (!request) {\n return false;\n }\n const req = request;\n return (\"method\" in req &&\n \"protocol\" in req &&\n \"hostname\" in req &&\n \"path\" in req &&\n typeof req[\"query\"] === \"object\" &&\n typeof req[\"headers\"] === \"object\");\n }\n clone() {\n return HttpRequest.clone(this);\n }\n}\nfunction cloneQuery(query) {\n return Object.keys(query).reduce((carry, paramName) => {\n const param = query[paramName];\n return {\n ...carry,\n [paramName]: Array.isArray(param) ? [...param] : param,\n };\n }, {});\n}\n\nclass HttpResponse {\n statusCode;\n reason;\n headers;\n body;\n constructor(options) {\n this.statusCode = options.statusCode;\n this.reason = options.reason;\n this.headers = options.headers || {};\n this.body = options.body;\n }\n static isInstance(response) {\n if (!response)\n return false;\n const resp = response;\n return typeof resp.statusCode === \"number\" && typeof resp.headers === \"object\";\n }\n}\n\nfunction isValidHostname(hostname) {\n const hostPattern = /^[a-z0-9][a-z0-9\\.\\-]*[a-z0-9]$/;\n return hostPattern.test(hostname);\n}\n\nexports.Field = Field;\nexports.Fields = Fields;\nexports.HttpRequest = HttpRequest;\nexports.HttpResponse = HttpResponse;\nexports.getHttpHandlerExtensionConfiguration = getHttpHandlerExtensionConfiguration;\nexports.isValidHostname = isValidHostname;\nexports.resolveHttpHandlerRuntimeConfig = resolveHttpHandlerRuntimeConfig;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";qGAEA,FAAI,MAEE,EAAuC,CAAC,IAAkB,CAC5D,MAAO,CACH,cAAc,CAAC,EAAS,CACpB,EAAc,YAAc,GAEhC,WAAW,EAAG,CACV,OAAO,EAAc,aAEzB,sBAAsB,CAAC,EAAK,EAAO,CAC/B,EAAc,aAAa,uBAAuB,EAAK,CAAK,GAEhE,kBAAkB,EAAG,CACjB,OAAO,EAAc,YAAY,mBAAmB,EAE5D,GAEE,EAAkC,CAAC,IAAsC,CAC3E,MAAO,CACH,YAAa,EAAkC,YAAY,CAC/D,GAGJ,MAAM,CAAM,CACR,KACA,KACA,OACA,WAAW,EAAG,OAAM,OAAO,EAAM,cAAc,OAAQ,SAAS,CAAC,GAAK,CAClE,KAAK,KAAO,EACZ,KAAK,KAAO,EACZ,KAAK,OAAS,EAElB,GAAG,CAAC,EAAO,CACP,KAAK,OAAO,KAAK,CAAK,EAE1B,GAAG,CAAC,EAAQ,CACR,KAAK,OAAS,EAElB,MAAM,CAAC,EAAO,CACV,KAAK,OAAS,KAAK,OAAO,OAAO,CAAC,IAAM,IAAM,CAAK,EAEvD,QAAQ,EAAG,CACP,OAAO,KAAK,OAAO,IAAI,CAAC,IAAO,EAAE,SAAS,GAAG,GAAK,EAAE,SAAS,GAAG,EAAI,IAAI,KAAO,CAAE,EAAE,KAAK,IAAI,EAEhG,GAAG,EAAG,CACF,OAAO,KAAK,OAEpB,CAEA,MAAM,CAAO,CACT,QAAU,CAAC,EACX,SACA,WAAW,EAAG,SAAS,CAAC,EAAG,WAAW,SAAW,CAC7C,EAAO,QAAQ,KAAK,SAAS,KAAK,IAAI,CAAC,EACvC,KAAK,SAAW,EAEpB,QAAQ,CAAC,EAAO,CACZ,KAAK,QAAQ,EAAM,KAAK,YAAY,GAA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AAO,OAAO,KAAK,CAAK,EAAE,OAAO,CAAC,EAAO,IAAc,CACnD,IAAM,EAAQ,EAAM,GACpB,MAAO,IACA,GACF,GAAY,MAAM,QAAQ,CAAK,EAAI,CAAC,GAAG,CAAK,EAAI,CACrD,GACD,CAAC,CAAC,EAGT,MAAM,CAAa,CACf,WACA,OACA,QACA,KACA,WAAW,CAAC,EAAS,CACjB,KAAK,WAAa,EAAQ,WAC1B,KAAK,OAAS,EAAQ,OACtB,KAAK,QAAU,EAAQ,SAAW,CAAC,EACnC,KAAK,KAAO,EAAQ,WAEjB,WAAU,CAAC,EAAU,CACxB,GAAI,CAAC,EACD,MAAO,GACX,IAAM,EAAO,EACb,OAAO,OAAO,EAAK,aAAe,UAAY,OAAO,EAAK,UAAY,SAE9E,CAEA,SAAS,CAAe,CAAC,EAAU,CAE/B,MADoB,kCACD,KAAK,CAAQ,EAG5B,QAAQ,EACR,SAAS,EACT,cAAc,EACd,eAAe,EACf,uCAAuC,EACvC,kBAAkB,EAClB,kCAAkC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "5012786FB15268E264756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{constants as X}from"os";var U=Symbol.for("gemi.server.shutdown");function P(){let j=globalThis;return j[U]??={shuttingDown:!1,drained:!1},j[U]}function Y(){return P().shuttingDown}function Z(){P().shuttingDown=!0}function $(){P().drained=!0}function y(j=process.env){let z={timeoutMs:Q(j.GEMI_SHUTDOWN_TIMEOUT,20),delayMs:Q(j.GEMI_SHUTDOWN_DELAY,0),providerTimeoutMs:Q(j.GEMI_SHUTDOWN_PROVIDER_TIMEOUT,5)};if(z.delayMs>0&&z.delayMs>=z.timeoutMs)console.warn(`[gemi] GEMI_SHUTDOWN_DELAY (${z.delayMs/1000}s) leaves no time to drain within GEMI_SHUTDOWN_TIMEOUT (${z.timeoutMs/1000}s); in-flight requests will be abandoned on every shutdown. Raise the timeout.`);return z}function Q(j,z){let B=j===void 0||j.trim()===""?NaN:Number(j);if(Number.isFinite(B)&&B>=0)return B*1000;if(j!==void 0)console.warn(`[gemi] Ignoring shutdown setting "${j}": expected a number of seconds.`);return z*1000}async function G(j){let{server:z,settings:B}=j,H=Date.now()+B.timeoutMs;Z(),console.log(`[gemi] Shutting down: draining in-flight requests (up to ${B.timeoutMs/1000}s).`);let F=!0;if(z){if(B.delayMs>0)await M(Math.min(B.delayMs,H-Date.now()));let O=z.stop(),R=H-Date.now();if(F=R>0?await C(O,R):z.pendingRequests===0,!F)console.error(`[gemi] Shutdown grace period elapsed with ${z.pendingRequests} request(s) still in flight; abandoning them.`),z.stop(!0).catch(()=>{})}$();let K=await j.shutdownProviders({timeoutMs:B.providerTimeoutMs}),J=F&&K.failed.length===0&&K.timedOut.length===0;return console.log(`[gemi] Shutdown ${J?"complete":"finished with errors"}.`),J?0:1}async function C(j,z){if(z<=0)return!1;let B,H=await Promise.race([j.then(()=>!0,()=>!0),new Promise((F)=>{B=setTimeout(()=>F(!1),z)})]);return clearTimeout(B),H}function M(j){return new Promise((z)=>setTimeout(z,Math.max(0,j)))}function f(j){if(!Y())return j;try{return j.headers.set("Connection","close"),j}catch{let z=new Response(j.body,j);return z.headers.set("Connection","close"),z}}function _(j){return async(z,B)=>{if(P().drained)return new Response("Service Unavailable",{status:503,headers:{Connection:"close"}});return f(await j(z,B))}}var V=Symbol.for("gemi.server.signalsInstalled"),q=1000;function w(j,z={}){let B=globalThis;if(B[V])return;B[V]=!0;let H=z.repeatWindowMs??q,F,K=(J)=>{if(F!==void 0){if(Date.now()-F<H)return;console.error(`[gemi] ${J} received again; exiting without waiting for the drain.`),process.exit(128+X.signals[J])}F=Date.now(),console.log(`[gemi] ${J} received.`),j().then((O)=>process.exit(O),(O)=>{console.error("[gemi] Shutdown failed:",O),process.exit(1)})};process.on("SIGTERM",K),process.on("SIGINT",K)}
|
|
3
|
-
export{Y as
|
|
3
|
+
export{Y as eh,Z as fh,y as gh,G as hh,_ as ih,w as jh};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=48A3ECEA2972B3F164756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { constants } from \"node:os\";\nimport type { ShutdownReport } from \"../foundation/Application\";\nimport type { Instrumentation } from \"./types\";\n\n// On `globalThis` under a registry symbol rather than in a module variable, so\n// the flag an app's health route reads is the one the server set even when two\n// copies of this module are loaded — the built CLI bundles its own gemi (see\n// `app/App.ts`), and `bun --hot` re-evaluates every module on a reload.\nconst STATE = Symbol.for(\"gemi.server.shutdown\");\n\ntype ShutdownState = { shuttingDown: boolean; drained: boolean };\n\nfunction state(): ShutdownState {\n const global = globalThis as { [STATE]?: ShutdownState };\n global[STATE] ??= { shuttingDown: false, drained: false };\n return global[STATE];\n}\n\n/**\n * True from the moment this server process has been told to stop — before it\n * stops accepting connections — until it exits.\n *\n * gemi has no health endpoint of its own, so taking an instance out of a load\n * balancer is the app's health route's job: answer it with a `503` while this\n * is true, and the platform's probe pulls the instance while the in-flight\n * requests are still draining. Every response sent in that window also carries\n * `Connection: close`, so a client that honours it opens its next request on a\n * new connection — one the load balancer can route elsewhere — instead of\n * reusing this one.\n */\nexport function isShuttingDown(): boolean {\n return state().shuttingDown;\n}\n\nexport function markShuttingDown() {\n state().shuttingDown = true;\n}\n\n/**\n * The request drain is over and the providers' `shutdown()` may be running:\n * from here on a request must not reach the app. See `serveForShutdown`.\n */\nexport function markDrained() {\n state().drained = true;\n}\n\n/** Test seam: a fresh process starts false, and so should each test. */\nexport function resetShuttingDown() {\n state().shuttingDown = false;\n state().drained = false;\n}\n\nexport type ShutdownSettings = {\n /**\n * From the signal to the end of the request drain, in milliseconds — the\n * delay below included. Requests still in flight when it runs out are\n * abandoned. `GEMI_SHUTDOWN_TIMEOUT`, in seconds; default 20. `0` means\n * \"close the listener and do not wait\": a shutdown with nothing in flight is\n * still a clean one.\n */\n timeoutMs: number;\n /**\n * How long to keep accepting new requests after `isShuttingDown()` turns\n * true, in milliseconds, so a health probe can see the `503` and the load\n * balancer stop routing here before the listener closes.\n * `GEMI_SHUTDOWN_DELAY`, in seconds; default 0.\n */\n delayMs: number;\n /**\n * The shared deadline for every provider's `shutdown()`, in milliseconds,\n * after the drain. `GEMI_SHUTDOWN_PROVIDER_TIMEOUT`, in seconds; default 5.\n * `0` skips the hooks — deliberately, so it is not reported as a failure.\n */\n providerTimeoutMs: number;\n};\n\n/**\n * 20s to drain plus 5s for providers is 25s: under the 30s that Kubernetes,\n * Azure Container Apps and ECS give by default between `SIGTERM` and `SIGKILL`,\n * with 5s left for the `gemi start` relay, the process exit and clock skew\n * between the platform's timer and ours. A platform with a shorter window\n * (Cloud Run's 10s, Fly's 5s) needs these lowered, not the other way round —\n * a drain that outlives the grace period ends in the same `SIGKILL` as no drain.\n *\n * The delay defaults to 0 because it only helps where a probe is watching, and\n * otherwise every shutdown would pay it for nothing.\n */\nexport function shutdownSettings(\n env: Record<string, string | undefined> = process.env,\n): ShutdownSettings {\n const settings = {\n timeoutMs: seconds(env.GEMI_SHUTDOWN_TIMEOUT, 20),\n delayMs: seconds(env.GEMI_SHUTDOWN_DELAY, 0),\n providerTimeoutMs: seconds(env.GEMI_SHUTDOWN_PROVIDER_TIMEOUT, 5),\n };\n // Warned, not clamped: the delay is sized to a probe, the timeout to the\n // platform's grace period, and which one is wrong only the operator knows.\n // Left alone, every shutdown spends the whole timeout in the delay and then\n // abandons whatever is in flight without draining it.\n if (settings.delayMs > 0 && settings.delayMs >= settings.timeoutMs) {\n console.warn(\n `[gemi] GEMI_SHUTDOWN_DELAY (${settings.delayMs / 1000}s) leaves no time to drain within GEMI_SHUTDOWN_TIMEOUT (${settings.timeoutMs / 1000}s); in-flight requests will be abandoned on every shutdown. Raise the timeout.`,\n );\n }\n return settings;\n}\n\nfunction seconds(value: string | undefined, fallback: number): number {\n const parsed = value === undefined || value.trim() === \"\" ? NaN : Number(value);\n if (Number.isFinite(parsed) && parsed >= 0) return parsed * 1000;\n if (value !== undefined) {\n console.warn(`[gemi] Ignoring shutdown setting \"${value}\": expected a number of seconds.`);\n }\n return fallback * 1000;\n}\n\n/** The part of `Bun.Server` a drain needs. */\nexport type Stoppable = {\n stop(closeActiveConnections?: boolean): Promise<void>;\n readonly pendingRequests: number;\n};\n\n/**\n * The shutdown sequence, in its order:\n *\n * 1. `isShuttingDown()` turns true — first, so the health route answers `503`\n * and responses carry `Connection: close` while the listener is still open.\n * 2. After `delayMs`, the listener closes (`server.stop()` without force):\n * new connections are refused, while every request in flight — a streamed\n * response included, to its last chunk — runs to completion.\n * 3. That completion is awaited until `timeoutMs` from the start.\n * 4. From here a request is refused with a `503` before it reaches the app\n * (`serveForShutdown`), and every provider's `shutdown()` runs, reverse\n * order, `providerTimeoutMs`.\n *\n * Resolves with the exit code: 0 when every step finished in time, 1 when the\n * drain was cut short or a provider failed or overran.\n *\n * Two things `stop()` does not do, both measured on Bun 1.3.14, and both why\n * the process exit that follows is what actually ends the server:\n *\n * - It does not close a kept-alive connection. One that is idle when the\n * listener closes stays open, and a request sent down it afterwards is\n * served. That is what the `Connection: close` on every response in the\n * window is for: a client (or a proxy in front) that honours it opens its\n * next request on a new connection, which the closed listener refuses. A\n * client that does not honour it is what step 4's `503` is for — Bun does\n * not close the socket after a `Connection: close` response either (#566).\n * - `stop(true)` issued after a graceful `stop()` does not cut the remaining\n * requests off; it waits for the same ones. It is still called when the\n * drain times out, for a Bun that does, but nothing here depends on it. Nor\n * does it close an idle kept-alive connection. Only a `stop(true)` issued\n * *first* does that, and it cuts off the requests in flight with it, which\n * is the drain given up — so the idle ones are refused, not closed.\n */\nexport async function drain(params: {\n server: Stoppable | undefined;\n shutdownProviders: (options: { timeoutMs: number }) => Promise<ShutdownReport>;\n settings: ShutdownSettings;\n}): Promise<number> {\n const { server, settings } = params;\n const deadline = Date.now() + settings.timeoutMs;\n\n markShuttingDown();\n console.log(\n `[gemi] Shutting down: draining in-flight requests (up to ${settings.timeoutMs / 1000}s).`,\n );\n\n let drained = true;\n if (server) {\n if (settings.delayMs > 0) {\n await sleep(Math.min(settings.delayMs, deadline - Date.now()));\n }\n const stopped = server.stop();\n // No time left to wait — a `GEMI_SHUTDOWN_TIMEOUT` of 0, or a delay that\n // spent all of it — is \"do not wait for what is in flight\", and that is\n // only a failure when something *is* in flight. Reading it as one made\n // every clean shutdown log an abandonment and exit 1 for the operator who\n // zeroed the budget to fit a 5s grace period, with nothing to abandon.\n const remaining = deadline - Date.now();\n drained =\n remaining > 0 ? await settlesWithin(stopped, remaining) : server.pendingRequests === 0;\n if (!drained) {\n console.error(\n `[gemi] Shutdown grace period elapsed with ${server.pendingRequests} request(s) still in flight; abandoning them.`,\n );\n void server.stop(true).catch(() => {});\n }\n }\n\n // Whether or not the drain finished: a request that arrives now, down a\n // kept-alive connection the listener's close left open, would run against\n // providers that are being shut down underneath it.\n markDrained();\n const report = await params.shutdownProviders({ timeoutMs: settings.providerTimeoutMs });\n const clean = drained && report.failed.length === 0 && report.timedOut.length === 0;\n console.log(`[gemi] Shutdown ${clean ? \"complete\" : \"finished with errors\"}.`);\n return clean ? 0 : 1;\n}\n\nasync function settlesWithin(promise: Promise<unknown>, ms: number): Promise<boolean> {\n // `drain` decides for itself what a budget that is already spent means, so\n // this is only a guard: a race against `setTimeout(0)` is a coin toss, and\n // \"did not settle within no time at all\" is the honest answer to it.\n if (ms <= 0) return false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const result = await Promise.race([\n promise.then(\n () => true,\n () => true,\n ),\n new Promise<false>((resolve) => {\n timer = setTimeout(() => resolve(false), ms);\n }),\n ]);\n clearTimeout(timer);\n return result;\n}\n\nfunction sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));\n}\n\n/**\n * `Connection: close` on a response sent while shutting down, so the client's\n * next request opens a connection — which the load balancer can send elsewhere\n * — instead of reusing this one.\n *\n * The spec makes some responses' headers immutable (a `Response.redirect`, a\n * proxied `fetch`), and setting one throws. Bun 1.3.14 lets both be set, so\n * the copy is for a Bun that follows the spec — a throw here would turn every\n * such response in the drain window into a 500.\n */\nexport function closeConnectionWhileShuttingDown(res: Response): Response {\n if (!isShuttingDown()) return res;\n try {\n res.headers.set(\"Connection\", \"close\");\n return res;\n } catch {\n const copy = new Response(res.body, res);\n copy.headers.set(\"Connection\", \"close\");\n return copy;\n }\n}\n\n/**\n * What every response goes through while this process serves: the app's\n * instrumentation, with the two changes a shutdown makes to it.\n *\n * - While the requests in flight drain, a response carries `Connection: close`\n * (`closeConnectionWhileShuttingDown`).\n * - Once they have drained, a request is answered `503` with\n * `Connection: close` and reaches neither the app nor its instrumentation.\n * The listener is closed by then, so only a kept-alive connection can still\n * deliver one, and `server.stop()` leaves those open. Serving it would run a\n * handler against providers whose `shutdown()` is closing the pool, the\n * queue or the cache it uses — until the process exits. The instrumentation\n * is skipped too because it is app code, and a tracer or error reporter is\n * exactly what a provider flushes and closes at this point.\n */\nexport function serveForShutdown(instrumentation: Instrumentation): Instrumentation {\n return async (req, next) => {\n if (state().drained) {\n return new Response(\"Service Unavailable\", {\n status: 503,\n headers: { Connection: \"close\" },\n });\n }\n return closeConnectionWhileShuttingDown(await instrumentation(req, next));\n };\n}\n\n// Installed once per process, not once per `Server`: a listener per instance\n// would each start a shutdown of its own, and read the other's signal as the\n// second one.\nconst SIGNALS_INSTALLED = Symbol.for(\"gemi.server.signalsInstalled\");\n\n/**\n * A repeat of the first signal inside this window is the same shutdown\n * delivered twice, not an operator asking to skip the drain. One shutdown\n * routinely arrives more than once, milliseconds apart: Ctrl+C on\n * `bun run start` reaches the server directly (the whole foreground group is\n * signalled), and again through `gemi start`'s relay — twice over, since\n * `bun run` forwards it to `gemi start` too. systemd's default\n * `KillMode=control-group` and `tini -g` do the same to every process in the\n * group. A person pressing Ctrl+C again is well outside a second.\n */\nconst REPEAT_WINDOW_MS = 1000;\n\n/**\n * `SIGTERM` or `SIGINT` runs `stop` and exits with the code it resolves with.\n * Another signal of either kind, more than `repeatWindowMs` after the first,\n * exits at once with `128 + n` — an operator pressing Ctrl+C again does not\n * want to wait out the grace period. Without a listener the first signal would\n * do that too: the default action for both is to terminate the process on the\n * spot.\n */\nexport function installShutdownSignals(\n stop: () => Promise<number>,\n options: { repeatWindowMs?: number } = {},\n) {\n const global = globalThis as { [SIGNALS_INSTALLED]?: boolean };\n if (global[SIGNALS_INSTALLED]) return;\n global[SIGNALS_INSTALLED] = true;\n\n const repeatWindowMs = options.repeatWindowMs ?? REPEAT_WINDOW_MS;\n let receivedAt: number | undefined;\n const onSignal = (signal: \"SIGTERM\" | \"SIGINT\") => {\n if (receivedAt !== undefined) {\n if (Date.now() - receivedAt < repeatWindowMs) return;\n console.error(`[gemi] ${signal} received again; exiting without waiting for the drain.`);\n process.exit(128 + constants.signals[signal]);\n }\n receivedAt = Date.now();\n console.log(`[gemi] ${signal} received.`);\n stop().then(\n (code) => process.exit(code),\n (error) => {\n console.error(\"[gemi] Shutdown failed:\", error);\n process.exit(1);\n },\n );\n };\n process.on(\"SIGTERM\", onSignal);\n process.on(\"SIGINT\", onSignal);\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAAA,oBAAS,WAQT,IAAM,EAAQ,OAAO,IAAI,sBAAsB,EAI/C,SAAS,CAAK,EAAkB,CAC9B,IAAM,EAAS,WAEf,OADA,EAAO,KAAW,CAAE,aAAc,GAAO,QAAS,EAAM,EACjD,EAAO,GAeT,SAAS,CAAc,EAAY,CACxC,OAAO,EAAM,EAAE,aAGV,SAAS,CAAgB,EAAG,CACjC,EAAM,EAAE,aAAe,GAOlB,SAAS,CAAW,EAAG,CAC5B,EAAM,EAAE,QAAU,GA4Cb,SAAS,CAAgB,CAC9B,EAA0C,QAAQ,IAChC,CAClB,IAAM,EAAW,CACf,UAAW,EAAQ,EAAI,sBAAuB,EAAE,EAChD,QAAS,EAAQ,EAAI,oBAAqB,CAAC,EAC3C,kBAAmB,EAAQ,EAAI,+B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AS,QAAQ,KAAK,CAAI,EAC3B,CAAC,IAAU,CACT,QAAQ,MAAM,0BAA2B,CAAK,EAC9C,QAAQ,KAAK,CAAC,EAElB,GAEF,QAAQ,GAAG,UAAW,CAAQ,EAC9B,QAAQ,GAAG,SAAU,CAAQ",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "48A3ECEA2972B3F164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{i as B,j as e}from"./chunk-
|
|
2
|
+
import{i as B,j as e}from"./chunk-z38355mx.js";import{ma as D,qa as I,ra as r}from"./chunk-a1g0bahx.js";import"./chunk-tvy2fqza.js";import{Ad as o,Bd as P,jc as c}from"./chunk-5mj7a141.js";import"./chunk-h7pafjej.js";import"./chunk-1npdp1w2.js";import{jf as f,kf as u,nf as m}from"./chunk-rh9j8cwv.js";import{Uf as n}from"./chunk-fwympxqk.js";import"./chunk-njkk498k.js";import"./chunk-gqpge54c.js";import"./chunk-5wt25tyd.js";import"./chunk-k9qmr2wa.js";import"./chunk-4rr9wmh8.js";import"./chunk-47rgq59q.js";import"./chunk-2q7m8a16.js";import"./chunk-9mqqr05d.js";import"./chunk-2gmgd05c.js";import{nh as a}from"./chunk-kqz8jp6v.js";import{oh as _}from"./chunk-82hpq0bq.js";import"./chunk-3s3awh38.js";import{join as M,resolve as yJ,sep as vJ}from"path";import{Duplex as KJ}from"stream";import{constants as L,createBrotliCompress as OJ,createGzip as YJ}from"zlib";var UJ=["br","gzip"],xJ=1024,VJ=5,IJ=19,CJ=6;function LJ(J){if(J===void 0)return 1;if(!/^\d+(\.\d{0,3})?$/.test(J.trim()))return 1;let $=Number(J.trim());return Number.isFinite($)?Math.min($,1):1}function AJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let X of J.split(",")){let[Z,...Q]=X.split(";"),W=Z.trim().toLowerCase();if(W==="")continue;let j=1;for(let G of Q){let Y=G.indexOf("=");if(Y===-1)continue;if(G.slice(0,Y).trim().toLowerCase()==="q"){j=LJ(G.slice(Y+1));break}}$.set(W,j)}return $}function PJ(J,$=UJ){let X=AJ(J);if(!X)return null;let Z=X.get("*"),Q=null,W=0;for(let j of $){let G=X.get(j)??Z??0;if(G>W)Q=j,W=G}return Q}function _J(J,$){if(!J)return!1;return J.split(",").some((X)=>X.trim().toLowerCase().split("=")[0].trim()===$)}function SJ(J,$){if(J==="HEAD")return!1;if($.status<200||$.status===204||$.status===206||$.status===304)return!1;if($.headers.has("Content-Range"))return!1;let X=$.headers.get("Content-Type");if(!X||!/^\s*text\/html\s*(;|$)/i.test(X))return!1;if(!$.body)return!1;let Z=$.headers.get("Content-Encoding");if(Z&&Z.trim().toLowerCase()!=="identity")return!1;if(_J($.headers.get("Cache-Control"),"no-transform"))return!1;let Q=$.headers.get("Content-Length");if(Q!==null&&Number(Q)<xJ)return!1;return!0}function TJ(J){let $=J==="br"?OJ({params:{[L.BROTLI_PARAM_QUALITY]:VJ,[L.BROTLI_PARAM_LGWIN]:IJ},flush:L.BROTLI_OPERATION_FLUSH}):YJ({level:CJ,flush:L.Z_SYNC_FLUSH});return KJ.toWeb($)}function DJ(J){let $=J.get("Vary");if(!$){J.set("Vary","Accept-Encoding");return}let X=$.split(",").map((Z)=>Z.trim().toLowerCase());if(X.includes("*")||X.includes("accept-encoding"))return;J.append("Vary","Accept-Encoding")}function g(J,$){if(!SJ(J.method,$))return $;let X=new Headers($.headers);DJ(X);let Z=PJ(J.headers.get("Accept-Encoding"));if(!Z)return new Response($.body,{status:$.status,statusText:$.statusText,headers:X});let Q;try{Q=TJ(Z)}catch{return new Response($.body,{status:$.status,statusText:$.statusText,headers:X})}return X.set("Content-Encoding",Z),X.delete("Content-Length"),new Response($.body.pipeThrough(Q),{status:$.status,statusText:$.statusText,headers:X})}import{readdir as FJ,stat as NJ}from"fs/promises";import{join as BJ}from"path";function w(J){let $=J.toString(),X=new Bun.CryptoHasher("sha1");return X.update($),X.digest("hex")}async function h(J){let $=new Set;async function X(Z,Q){let W;try{W=await FJ(Z,{withFileTypes:!0})}catch{return}for(let j of W){if(j.name.startsWith("."))continue;if(Q&&j.name==="assets")continue;let G=BJ(Z,j.name),Y=j.isDirectory(),V=j.isFile();if(j.isSymbolicLink())try{let C=await NJ(G);Y=C.isDirectory(),V=C.isFile()}catch{continue}if(V)$.add(G);else if(Y&&!j.isSymbolicLink())await X(G,!1)}}return await X(J,!0),$}var bJ="public, max-age=31536000, must-revalidate";function p(J,$){let X=Bun.file($),Z=X.size,Q=w(X.lastModified),W={"Content-Type":X.type||"application/octet-stream","Cache-Control":bJ,"Accept-Ranges":"bytes",ETag:Q},j=f(J.headers.get("Range"));if(j){let G=u(j,Z);if(!G)return c(Z);return new Response(X.slice(G.start,G.end+1).stream(),{status:206,headers:{...W,"Content-Range":m(G.start,G.end,Z),"Content-Length":String(G.length)}})}return new Response(X.stream(),{headers:{...W,"Content-Length":String(Z)}})}import{stat as EJ}from"fs/promises";var A="app/client.tsx";function d(J,$=D){let X=J[A]?.file;if(!X)return;return{module:I(X,$),preload:F(J,A,$)}}function F(J,$,X=D){let Z=[],Q=new Set,W=(j)=>{if(Q.has(j))return;Q.add(j);let G=J[j];if(!G?.file)return;Z.push(I(G.file,X));for(let Y of G.imports??[])W(Y)};return W($),Z}function l(J,$=30000){let X=JSON.stringify("gemi:chunk-reload"),Z=JSON.stringify(`Failed to fetch dynamically imported module: ${J}`);return`var r=!1;try{var s=window.sessionStorage,m=JSON.parse(s.getItem(${X})||"null");var d=m?Date.now()-m.at:NaN;if(navigator.onLine!==!1&&!(d>=0&&d<${$})){s.setItem(${X},JSON.stringify({url:window.location.href,at:Date.now()}));r=!0}}catch(e){}if(r)window.location.reload();else throw new Error(${Z});export {}`}var MJ=new RegExp(`^${o}/.+\\.m?js$`);function qJ(J){return MJ.test(J)}function i(J){if(qJ(J))return new Response(l(J),{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(P(J))return new Response("Not found",{status:404});return}var RJ=`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8" />
|
|
@@ -21,4 +21,4 @@ import{i as B,j as e}from"./chunk-dtcy3110.js";import{ka as D,oa as I,pa as r}fr
|
|
|
21
21
|
</html>`;function N(J,$,X){if(!X)console.error(J);else try{X(J instanceof Error?J:Error(String(J),{cause:J}))}catch(Z){console.error(J),console.error(Z)}if(_($))return new Response(JSON.stringify({error:n("server_error","Internal Server Error",500)}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(RJ,{status:500,headers:{"Content-Type":"text/html; charset=utf-8"}})}var kJ={kind:"none"};function s(J){let $=(J??"").trim().toLowerCase();if($===""||$==="false"||$==="off"||$==="0")return kJ;if($==="true")return{kind:"all"};if(/^[1-9]\d*$/.test($))return{kind:"hops",hops:Number($)};throw Error(`GEMI_TRUST_PROXY must be "false", "true" or the number of proxies in front of the app (e.g. 1). Got ${JSON.stringify(J)}.`)}function t(J,$,X){if(X.kind==="all"){if(!J.get("x-forwarded-for")&&$)J.set("x-forwarded-for",$);return}J.delete("x-real-ip");let Z=$;if(X.kind==="hops"){let Q=(J.get("x-forwarded-for")??"").split(",").map((j)=>j.trim()).filter(Boolean),W=Q.length-X.hops;Z=W>=0?Q[W]:Q[0]??$}if(Z)J.set("x-forwarded-for",Z);else J.delete("x-forwarded-for")}var S=a(),gJ=M(S,"app"),x=M(S,"dist"),b=M(x,"client");function wJ(J){let $;try{$=decodeURIComponent(J)}catch{return null}let X=yJ(b,"."+$.replace("/assets/assets","/assets"));return X.startsWith(b+vJ)?X:null}async function fJ(J){try{return(await EJ(J)).isFile()}catch{return!1}}async function L3(J,$){let X=await import(`${x}/client/.vite/manifest.json`),Z=await import(`${x}/server/.vite/manifest.json`),Q=await r(`${x}/client`);process.env.ROOT_DIR=S,process.env.APP_DIR=gJ,process.env.DIST_DIR=x;let W={},j={},G={},Y={},V={},C=(z,H)=>`"${z}": () => import("${H}")`,q=[];for(let z of["404",...J.getFlatComponentTree.call(J)]){let H=Z[`app/views/${z}.tsx`];if(!H?.file){console.log(`Server file not found for ${z}`),console.log(H);let U=Object.keys(Z),y=`app/views/${z}.tsx`;console.log(`${y} not found in server manifest`),console.log(U)}let O=await import(`${process.env.DIST_DIR}/server/${H?.file}`);W[z]=O.default,j[z]=O.OpenGraph,G[z]=O;let K=X[`app/views/${z}.tsx`];if(K?.css&&K?.css.length>0)Y[z]=K?.css;if(K)q.push(C(z,I(K?.file,Q))),V[z]=F(X,`app/views/${z}.tsx`,Q)}let JJ=`{${q.join(",")}}`,R=d(X,Q);if(!R)console.error(`Client manifest has no "${A}" entry \u2014 dist/client is incomplete, so documents will render but never hydrate.`);let $J=X["app/client.tsx"]?.css??[],XJ=(await Promise.all($J.map((z)=>Bun.file(`${x}/client/${z}`).text()))).join(`
|
|
22
22
|
`),ZJ=await h(b);async function zJ(z){let{pathname:H}=new URL(z.url);if(_(H))return await T(z,H);let O=wJ(H);if(P(H)||H.startsWith("/.well-known")||O!==null&&ZJ.has(O)){if(!O||!await fJ(O))return i(H)??await T(z,H);try{return p(z,O)}catch(U){return J.onException?.(U),new Response("Not found",{status:404})}}return await T(z,H)}async function T(z,H){let O=J.fetch.bind(J);try{let K=await O(z);if(K instanceof Response)return K;else{let U=[];return U.push({content:XJ}),await K({getStyles:async(v)=>{if(!v)return B([]);for(let GJ of v){let WJ=X[`app/views/${GJ}.tsx`];for(let E of WJ?.css??[]){let HJ=Bun.file(`${process.env.DIST_DIR}/client/${E}`);U.push({id:E,content:await HJ.text()})}}return B(U)},clientEntry:R,modulePreloadManifest:V,loaders:JJ,viewImportMap:W,viewModules:G,ogMap:j,cssManifest:Y,assetBase:Q})}}catch(K){return N(K,H,J.onException)}}let QJ=(process.env.GEMI_COMPRESSION??"auto").toLowerCase()!=="off",jJ=s(process.env.GEMI_TRUST_PROXY),k=Bun.serve({maxRequestBodySize:10737418240,fetch:async(z,H)=>{t(z.headers,H.requestIP(z)?.address??null,jJ);let O=await $(z,(K)=>J.withGlobalMiddleware(K,zJ,(U)=>N(U,new URL(K.url).pathname,J.onException)));return QJ?g(z,O):O},idleTimeout:Number(process.env.SERVER_IDLE_TIMEOUT??10),port:process.env.PORT||5173});return e({port:k.port,rootDir:S}),k}export{L3 as httpProd};
|
|
23
23
|
|
|
24
|
-
//# debugId=
|
|
24
|
+
//# debugId=E0B59B185FC1784364756E2164756E21
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"/**\n * Which `X-Forwarded-For` entries the production server believes (#8).\n *\n * `X-Forwarded-For` is written by whoever sends the request. A client talking\n * to the app directly — or through a proxy that appends to the header rather\n * than replacing it — picks any address it likes, and `clientIp` (the rate\n * limiter's default key) used to read the left-most entry, which is exactly\n * the one the client wrote. So the server decides here, once, at the edge,\n * and hands the app a single address it can rely on:\n *\n * - `none` (the default): no proxy is trusted. The header is replaced with the\n * socket's peer address, and `X-Real-IP` is dropped.\n * - `hops` (`GEMI_TRUST_PROXY=<n>`): the `n` proxies nearest the app are\n * trusted. Each appends the address it was reached from, so the client is\n * the `n`-th entry from the right of `X-Forwarded-For`. Anything\n * further left was written by someone the app does not trust and is dropped.\n * - `all` (`GEMI_TRUST_PROXY=true`): the inbound header is passed through\n * unchanged, as before 0.88. Only sound behind a proxy that overwrites\n * `X-Forwarded-For` (and `X-Real-IP`) rather than appending to it.\n */\nexport type ForwardedTrust =\n | { kind: \"none\" }\n | { kind: \"all\" }\n | { kind: \"hops\"; hops: number };\n\nconst NONE: ForwardedTrust = { kind: \"none\" };\n\n/**\n * `GEMI_TRUST_PROXY` as a policy. Unset, empty, `false`, `off` and `0` trust\n * nothing; `true` trusts everything; a positive integer is a hop count.\n * Anything else throws, so a typo fails the boot instead of silently trusting\n * nothing (every client sharing the proxy's address) or everything.\n */\nexport function parseTrustProxy(value: string | undefined): ForwardedTrust {\n const raw = (value ?? \"\").trim().toLowerCase();\n if (raw === \"\" || raw === \"false\" || raw === \"off\" || raw === \"0\") {\n return NONE;\n }\n if (raw === \"true\") {\n return { kind: \"all\" };\n }\n if (/^[1-9]\\d*$/.test(raw)) {\n return { kind: \"hops\", hops: Number(raw) };\n }\n throw new Error(\n `GEMI_TRUST_PROXY must be \"false\", \"true\" or the number of proxies in front of the app (e.g. 1). Got ${JSON.stringify(value)}.`,\n );\n}\n\n/**\n * Rewrites `headers` so `X-Forwarded-For` holds what `trust` says the client\n * address is. `peer` is the socket's remote address — `null` for a unix\n * socket, where the immediate hop is still counted as one proxy.\n */\nexport function applyForwardedTrust(\n headers: Headers,\n peer: string | null,\n trust: ForwardedTrust,\n): void {\n if (trust.kind === \"all\") {\n if (!headers.get(\"x-forwarded-for\") && peer) {\n headers.set(\"x-forwarded-for\", peer);\n }\n return;\n }\n\n // Under any other policy `X-Real-IP` is as client-written as the rest; the\n // address the app should use is the one left in `X-Forwarded-For`.\n headers.delete(\"x-real-ip\");\n\n let client: string | null = peer;\n if (trust.kind === \"hops\") {\n const entries = (headers.get(\"x-forwarded-for\") ?? \"\")\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean);\n // The chain is `entries` + `peer`; the client sits `hops` places left of\n // its end, i.e. `entries[entries.length - hops]`. A shorter chain than\n // expected means the request skipped a proxy, so its left-most hop is the\n // furthest thing seen — never anything further left than that.\n const index = entries.length - trust.hops;\n client = index >= 0 ? entries[index]! : (entries[0] ?? peer);\n }\n\n if (client) {\n headers.set(\"x-forwarded-for\", client);\n } else {\n headers.delete(\"x-forwarded-for\");\n }\n}\n"
|
|
14
14
|
],
|
|
15
15
|
"mappings": ";mzBAAA,SAAS,OAAM,IAAS,QCkBxB,WAAS,UACT,cAAS,oBAAW,WAAsB,QAW1C,FAAM,HAAuC,LAAC,DAAM,AAAM,JAQpD,HAAyB,DAYzB,HAAiB,EACjB,GAAqB,GAGrB,GAAa,EAEnB,SAAS,EAAW,CAAC,EAAiC,CACpD,GAAI,IAAQ,OACV,MAAO,GAKT,GAAI,CAAC,oBAAoB,KAAK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+1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Yf as J,_f as h}from"./chunk-gqpge54c.js";import{$f as g}from"./chunk-5wt25tyd.js";import{bg as D,cg as L,dg as Q,fg as _,gg as T,pg as N}from"./chunk-k9qmr2wa.js";import{Eg as C}from"./chunk-4rr9wmh8.js";import{_g as v,bh as p}from"./chunk-9mqqr05d.js";import{eh as f}from"./chunk-6rz8kyqb.js";class W{entries=new Map;counters=new Map;async acquire(z,G,H){let V=Date.now(),Y=this.entries.get(z);if(Y&&(Y.expiresAt>V||Y.fences>0))return null;let Z=(Y?.token??0)+1;return this.entries.set(z,{owner:G,token:Z,expiresAt:V+Math.max(0,H),fences:0}),Z}async extend(z,G,H,V){let Y=this.current(z,G,H);if(!Y)return!1;return Y.expiresAt=Date.now()+Math.max(0,V),!0}async release(z,G,H){let V=this.current(z,G,H);if(!V)return!1;return V.owner="",V.expiresAt=0,!0}async holder(z){let G=this.entries.get(z);if(!G||G.expiresAt<=Date.now())return null;return{owner:G.owner,token:G.token}}async held(z,G,H){return this.current(z,G,H)!==void 0}async advance(z,G){if((this.counters.get(z)??-1/0)>=G)return!1;return this.counters.set(z,G),!0}async fence(z,G,H,V){let Y=this.current(z,G,H);if(!Y)throw new J(z,H);Y.fences++;try{return await V()}finally{Y.fences--}}windows=new Map;async hit(z,G,H){let V=Date.now(),Y=this.windows.get(z);if(!Y||Y.endsAt<=V)Y={count:0,endsAt:V+Math.max(1,H)},this.windows.set(z,Y);if(Y.count>=G)return{allowed:!1,resetInMs:Y.endsAt-V};return Y.count++,{allowed:!0,resetInMs:Y.endsAt-V}}async refund(z){let G=this.windows.get(z);if(G&&G.endsAt>Date.now()&&G.count>0)G.count--}current(z,G,H){let V=this.entries.get(z);if(!V||V.owner!==G||V.expiresAt<=Date.now())return;if(H!==void 0&&V.token!==H)return;return V}}class F{table;sql;dialect;connection;busyTimeout;configured;constructor(z,G={}){let H=G.table??"gemi_locks";if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(H))throw Error(`The lock table name "${H}" is not a plain identifier. Use letters, digits and underscores.`);this.table=H,this.sql=z.sql,this.dialect=z.dialect,this.connection=z.name,this.busyTimeout=G.busyTimeout??1000}async createTable(){await this.configure();for(let z of j(this.dialect,this.table))await this.sql.unsafe(z)}async acquire(z,G,H){await this.configure();let V=this.sql,Y=this.now(V);if(await this.seed(V,z),this.mysql){let $=await V`
|
|
3
3
|
UPDATE ${this.name(V)}
|
|
4
4
|
SET owner = ${G}, token = token + 1, expires_at = ${Y} + ${this.ms(V,H)},
|
|
5
5
|
updated_at = ${Y}
|
|
@@ -212,6 +212,6 @@ import{Gf as J,If as h}from"./chunk-5dwtmkk8.js";import{Kf as D,Lf as L,Mf as Q,
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
`],"worker.ts"),Y=URL.createObjectURL(V);return new Worker(Y)}async function d(z,G){let H=b();return H.postMessage({jobName:z,args:G}),await new Promise((V,Y)=>{H.onmessage=(Z)=>{let $=Z.data;if("error"in $)Y($.error);else V($.result)}})}var m=new u("gemi.queue"),c=60000;class E{static token="queue";jobs={};config;driver;application;inFlight=new Map;state="idle";looping=!1;claiming;woken=!1;claimFailures=0;resume;unsubscribe;heartbeatTimer;releasedNames=new Set;lockManager;constructor(z={},G={}){this.config=g(M(),z),this.application=G.application,this.driver=t(this.config.driver,this.application),this.useJobs(this.config.jobs)}useJobs(z){this.config.jobs=z,this.jobs={};for(let G of z)this.claim(G)}registerJob(z){this.config.jobs=[...this.config.jobs,z],this.claim(z)}claim(z){if(this.jobs[z.name]){console.error(`Two queued jobs are named "${z.name}" \u2014 the first is registered `+"and this one is not, so dispatching either would have run one of them. A class name is the queue's key, so only one job can hold it. Rename one.");return}this.jobs[z.name]=z}get registeredJobs(){return[...this.config.jobs]}dispatchJob(z,G){if(this.jobs[z])return new this.jobs[z]().run(JSON.parse(G))}push(z,G,H={}){let V=this.uniqueKey(z,G);if(V)return this.pushUnique(z,G,V,H);let Y=this.driver.joinsTransaction?.()===!0;if(!Y){let Z=Bun.randomUUIDv7();if(_(()=>this.record(z,G,{id:Z,reportFailure:!0,committed:!0}).then(()=>{},()=>{})))return Promise.resolve(Z)}return this.record(z,G,{reportFailure:H.reportFailure,joins:Y})}get locks(){return this.lockManager??=new h(this.resolveLockStore()),this.lockManager}resolveLockStore(){let z=this.config.locks;if(z==="auto"){let G=this.driver.lockStore?.();if(G)return G;if(this.durable)console.warn('[gemi] The queue driver keeps no locks, so unique jobs, withoutOverlapping and onOneServer only hold within this process. Set the queue slice\'s `locks` to "database" or a LockStore.');return new W}if(z==="memory")return new W;if(z==="database"||typeof z==="function"){if(!this.application&&(z==="database"||z.length>0))throw Error("The queue's locks need the application they belong to, and this QueueManager was built without one. Pass { application }.");if(z==="database")return new F(this.application.make(C));return z(this.application)}if(typeof z==="string")throw Error(`Unknown queue locks "${z}". The queue slice's locks is "auto", "memory", "database", a LockStore, or a function returning one.`);return z}uniqueKey(z,G){if(z.prototype.uniqueId===R.prototype.uniqueId)return;let H=new z,V=H.uniqueId(...JSON.parse(G));if(V===void 0||V===null||V==="")return;return{key:x(z.name,V),ttl:Math.max(1,H.uniqueFor)}}pushUnique(z,G,H,V){let Y=Bun.randomUUIDv7();if(_(()=>this.recordUnique(z,G,H,Y,{report:!0,committed:!0}).then(()=>{},()=>{})))return Promise.resolve(Y);return this.recordUnique(z,G,H,Y,{report:V.reportFailure!==!1,committed:!1})}recordUnique(z,G,H,V,Y){let Z=this.locks.store,$=(async()=>{for(let B=0;B<5;B++){if(await Z.acquire(H.key,V,H.ttl)!==null)try{return await this.record(z,G,{id:V,reportFailure:!1})}catch(K){throw await Z.release(H.key,V).catch(()=>{}),K}let X=await Z.holder(H.key);if(X)return X.owner}throw Error(`The unique key "${H.key}" kept changing hands, so ${z.name} was not queued.`)})();return $.catch((B)=>{if(!Y.report)return;console.error(`[gemi] The queue could not record the unique job ${z.name}`+(Y.committed?", which was held until its transaction committed. The transaction stays committed; the job did not run and will not be retried.":", so it did not run and will not be retried."),B)}),$}async releaseUnique(z,G,H){if(z.uniqueId===R.prototype.uniqueId)return;try{let V=z.uniqueId(...G);if(V===void 0||V===null||V==="")return;await this.locks.store.release(x(H.name,V),H.id)}catch(V){console.error(`[gemi] Could not free the unique key of ${H.name} (${H.id}); it frees itself after uniqueFor.`,V)}}record(z,G,H){let V=this.driver.enqueue({name:z.name,args:G,...H.id===void 0?{}:{id:H.id}});this.startIfIdle();let Y=()=>!this.driver.subscribe&&this.state==="running"&&this.wake(),Z=H.joins===!0&&_(Y);return V.then(()=>Z||Y(),($)=>{if(H.reportFailure===!1)return;console.error(`[gemi] The queue driver could not record ${z.name}`+(H.committed?", which was held until its transaction committed. The transaction stays committed; the job did not run and will not be retried.":", so it did not run and will not be retried."),$)}),V}async retryDead(z){if(!this.driver.retryDead)throw Error("This queue's driver keeps nothing of a dead-lettered job, so there is nothing to retry. The database driver keeps them.");let G=await this.driver.retryDead(z);if(G)this.claimSoon();return G}startIfIdle(){if(this.state==="idle"&&(!this.durable||this.mayClaimHere()))this.start()}claimSoon(){if(this.startIfIdle(),!this.driver.subscribe&&this.state==="running")this.wake()}start(){if(this.state==="running")return;if(this.state="running",this.durable&&this.application&&this.mayClaimHere()&&!l())globalThis.__gemiDevQueue=this;if(this.unsubscribe=this.driver.subscribe?.(()=>this.wake()),this.looping)return this.wake();m.runInAsyncScope(()=>void this.loop())}async drain(z=1/0){if(this.state="stopped",globalThis.__gemiDevQueue===this)globalThis.__gemiDevQueue=void 0;this.unsubscribe?.(),this.unsubscribe=void 0,this.wake();let G,H=new Promise((Y)=>{if(z!==1/0)G=setTimeout(Y,z)}),V=(async()=>{await this.claiming?.catch(()=>{}),await Promise.allSettled([...this.inFlight.values()].map((Y)=>Y.done))})();return await Promise.race([V,H]),clearTimeout(G),{unfinished:[...this.inFlight.values()].map((Y)=>({...Y.job}))}}stop(){return this.drain(0)}get running(){return this.inFlight.size}async loop(){this.looping=!0;try{await this.claimWhileRunning()}finally{this.looping=!1}}async claimWhileRunning(){while(this.state==="running"){let z=this.durable&&f()?0:this.config.concurrency-this.inFlight.size;if(z>0){this.woken=!1;let G=this.driver.claim(z,{...this.lease(),registered:{names:Object.keys(this.jobs),graceMs:this.config.unknownJobGrace}});this.claiming=G;let H=[];try{H=await G,this.claimFailures=0}catch(V){this.claimFailures++,console.error(`The queue could not claim jobs from its driver; it will try again in ${this.retryDelay()}ms.`,V)}finally{this.claiming=void 0}for(let V of H)this.execute(V);if(H.length===z)continue;if(this.woken&&this.inFlight.size<this.config.concurrency)continue}await this.sleep()}}sleep(){return new Promise((z)=>{let G,H=this.claimFailures>0?this.retryDelay():this.driver.subscribe?void 0:this.config.pollInterval;if(H!==void 0)G=setTimeout(()=>this.wake(),H),G.unref?.();this.resume=()=>{clearTimeout(G),z()}})}retryDelay(){let z=Math.min(Math.max(0,this.claimFailures-1),30);return Math.min(this.config.pollInterval*2**z,c)}wake(){this.woken=!0;let z=this.resume;this.resume=void 0,z?.()}get durable(){return!(this.driver instanceof U)}mayClaimHere(){return!this.application||s()}lease(){return{visibilityTimeoutMs:this.config.visibilityTimeout}}execute(z){let G=`${z.id}:${z.attempt}`,H=()=>this.run(z),V=(this.application?v.run(this.application,H):H()).catch((Y)=>{console.error(`The queue could not record the outcome of ${z.name}.`,Y)}).finally(()=>{this.inFlight.delete(G),this.wake()});this.inFlight.set(G,{job:z,done:V}),this.heartbeat()}heartbeat(){let z=this.driver;if(!z.heartbeat||this.heartbeatTimer)return;this.heartbeatTimer=setInterval(()=>{if(this.inFlight.size===0){clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0;return}let G=[...this.inFlight.values()].map((H)=>H.job);z.heartbeat(G,this.lease()).catch((H)=>{console.error("The queue could not extend its job leases.",H)})},Math.max(1,Math.floor(this.config.visibilityTimeout/3))),this.heartbeatTimer.unref?.()}async run(z){let G=this.jobs[z.name];if(!G){let K=Date.now()-z.createdAt;if(this.durable&&K<this.config.unknownJobGrace){if(!this.releasedNames.has(z.name))this.releasedNames.add(z.name),console.error(`Left a queued "${z.name}" for another replica: nothing is registered here under that name. It is dead-lettered if no replica has run it within unknownJobGrace (${this.config.unknownJobGrace}ms) of its dispatch.`);await this.driver.release(z,{retryInMs:Math.round(this.config.pollInterval*(1+Math.random()))});return}console.error(`Dropped a queued job: nothing is registered under the name "${z.name}". If the class exists, it was not `+"discovered \u2014 check that it is under the queue slice's jobsDir "+"(app/jobs by default), or list it in app/config/queue.ts."),await this.driver.fail(z,{error:`No job is registered under the name "${z.name}".`,retryInMs:null});return}let H;try{H=new G}catch(K){console.error(`Dropped a queued ${z.name}: it could not be constructed.`,K),await this.driver.fail(z,{error:`The job could not be constructed: ${String(K)}`,retryInMs:null});return}let V;try{V=JSON.parse(z.args)}catch(K){console.error(`Dropped a queued ${z.name}: its arguments are not JSON.`,K),await this.driver.fail(z,{error:`The arguments are not JSON: ${String(K)}`,retryInMs:null});return}if(z.attempt>Math.max(1,H.maxAttempts)){let K=Error(`${z.name} was claimed for attempt ${z.attempt} of ${H.maxAttempts}: an earlier attempt never finished, most likely because the process running it exited. Dead-lettered without running it again.`);P(`${z.name}.onDeadletter`,()=>H.onDeadletter(K,...V)),await this.driver.fail(z,{error:K.message,retryInMs:null}),await this.releaseUnique(H,V,z);return}let Y=await this.admit(H,V,z);if(!Y)return;let Z,$;try{$=await(H.worker?d(z.name,z.args):H.run(...V))}catch(K){Z=K}finally{await Y.done()}let B=H.$outcome;if(Z===void 0&&B?.kind==="release"){await this.driver.release(z,{retryInMs:Math.max(0,B.delayMs)});return}if(Z===void 0&&B?.kind==="fail")Z=B.error;let X=B?.kind==="fail"?B.retry:!0;if(Z===void 0)try{H.onSuccess($,...V)}catch(K){Z=K}if(Z!==void 0){let K=String(Z?.stack??Z);if(P(`${z.name}.onFail`,()=>H.onFail(Z,...V)),!X||z.attempt>=H.maxAttempts)P(`${z.name}.onDeadletter`,()=>H.onDeadletter(Z,...V)),await this.driver.fail(z,{error:K,retryInMs:null}),await this.releaseUnique(H,V,z);else await this.driver.fail(z,{error:K,retryInMs:r(H.backoff,z.attempt)});return}await this.driver.complete(z),await this.releaseUnique(H,V,z)}async admit(z,G,H){let V=z.concurrency(...G),Y=[z.throttle(...G)??[]].flat();if(!V&&Y.length===0)return{done:async()=>{}};let Z=this.locks,$;if(V&&V.limit>0){let X=this.config.visibilityTimeout;for(let K=0;K<V.limit&&!$;K++)$=await Z.acquire(`gemi:concurrency:${V.key}:${K}`,{ttl:X,renew:!0})??void 0;if(!$){await this.driver.release(H,{retryInMs:Math.round(this.config.pollInterval*(1+Math.random()))});return}}let B=[];for(let X of Y){let K=`gemi:throttle:${X.key}`,O=await Z.store.hit(K,X.limit,X.window);if(!O.allowed){await Promise.all(B.map((k)=>Z.store.refund(k))),await $?.release(),await this.driver.release(H,{retryInMs:Math.max(1,O.resetInMs)});return}B.push(K)}return{done:async()=>{await $?.release().catch((X)=>{console.error(`[gemi] Could not free a concurrency slot of ${H.name}.`,X)})}}}}function x(z,G){return`gemi:job:${z}:${String(G)}`}function P(z,G){try{G()}catch(H){console.error(`${z} threw; the job's claim was ended anyway.`,H)}}function l(){return Bun.env.NODE_ENV==="production"}function s(){if(!w)return!1;if(a())return!0;return process.env.ROOT_DIR!==void 0&&!i()}function i(z=process.env){return(z.GEMI_QUEUE_CLAIM??"").trim().toLowerCase()==="off"}var y=Symbol.for("gemi.queue.worker");function Qz(z=!0){globalThis[y]=z}function a(){return globalThis[y]===!0}function r(z,G){let H=Array.isArray(z)?z[Math.min(G,z.length)-1]:z;return Math.max(0,H??0)}function t(z,G){if(z==="memory")return new U;if(z==="database"||typeof z==="function"){if(!G&&(z==="database"||z.length>0))throw Error("The queue driver needs the application it belongs to, and this QueueManager was built without one. Pass { application }.");if(z==="database")return new I(G.make(C));return z(G)}if(typeof z==="string")throw Error(`Unknown queue driver "${z}". The queue slice's driver is "memory", "database", a QueueDriver, or a function returning one.`);return z}class R{static name="unset";worker=!1;maxAttempts=3;backoff=0;uniqueId(...z){return}uniqueFor=3600000;throttle(...z){return}concurrency(...z){return}release(z=0){this.$outcome={kind:"release",delayMs:z}}fail(z,G={}){this.$outcome={kind:"fail",error:z instanceof Error?z:Error(String(z)),retry:G.retry??!0}}$outcome;run(...z){}onFail(z,...G){}onSuccess(z,...G){}onDeadletter(z,...G){}static dispatch(...z){if(this.name==="unset")throw Error("Cannot dispatch a job with no name");return p(E).push(this,JSON.stringify(z))}}
|
|
215
|
-
export{W as
|
|
215
|
+
export{W as Vb,F as Wb,I as Xb,R as Yb,Zz as Zb,M as _b,U as $b,E as ac,s as bc,i as cc,Qz as dc,a as ec};
|
|
216
216
|
|
|
217
|
-
//# debugId=
|
|
217
|
+
//# debugId=6E5D07D2E65089E164756E2164756E21
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"import { app } from \"../../foundation/app\";\nimport { QueueManager } from \"./QueueManager\";\n\nexport class Job {\n static name = \"unset\";\n worker = false;\n maxAttempts = 3;\n\n /**\n * Milliseconds to wait before each retry. A number is used for every retry;\n * an array gives the delay before the first retry, the second, and so on,\n * repeating its last entry. `0`, the default, retries as soon as a slot is\n * free.\n */\n backoff: number | number[] = 0;\n\n /**\n * Makes the job unique per key, across every process sharing the queue's\n * storage. Return a key from the dispatch arguments, or `undefined` for a\n * dispatch that should not be unique. While a job with the same key is\n * waiting or running, another dispatch is not queued: it resolves to the\n * id of the job already there. The key is freed when that job completes or\n * is dead-lettered, and at the latest after `uniqueFor`.\n *\n * The default returns `undefined`: a job is not unique unless it says so.\n */\n uniqueId(..._args: any[]): string | number | undefined | null {\n return undefined;\n }\n\n /**\n * How long a unique job's key is held at most, in milliseconds, so a job\n * lost with its process does not block its key forever. Default one hour.\n */\n uniqueFor = 60 * 60_000;\n\n /**\n * Rate limits per key, computed from the dispatch arguments: at most\n * `limit` jobs admitted per fixed `window` (milliseconds) under each `key`,\n * across every process sharing the queue's storage. A job over a limit is\n * put back until the window resets, without spending an attempt. Counted\n * when the job is admitted to run, whether it then succeeds or not.\n */\n throttle(..._args: any[]): JobThrottle | JobThrottle[] | undefined | null {\n return undefined;\n }\n\n /**\n * At most `limit` jobs with this `key` running at once, across every process\n * sharing the queue's storage. A job with no free slot waits, without\n * spending an attempt.\n */\n concurrency(..._args: any[]): JobConcurrency | undefined | null {\n return undefined;\n }\n\n /**\n * Called from `run`: puts the job back to wait `delayMs` once `run`\n * returns, without counting the attempt or calling any hook. For a provider\n * that answered \"slow down\". Not available to `worker` jobs.\n */\n release(delayMs = 0): void {\n this.$outcome = { kind: \"release\", delayMs };\n }\n\n /**\n * Called from `run`: fails this attempt once `run` returns, as a throw\n * would. With `retry: false` it is dead-lettered at once, whatever\n * `maxAttempts` says: for work that must not be repeated, such as a send\n * whose acceptance is uncertain. A throw after `fail(..., { retry: false })`\n * is dead-lettered too. Not available to `worker` jobs.\n */\n fail(error: unknown, options: { retry?: boolean } = {}): void {\n this.$outcome = {\n kind: \"fail\",\n error: error instanceof Error ? error : new Error(String(error)),\n retry: options.retry ?? true,\n };\n }\n\n /** @internal What `release` or `fail` asked for during this run. */\n $outcome:\n | { kind: \"release\"; delayMs: number }\n | { kind: \"fail\"; error: Error; retry: boolean }\n | undefined;\n\n run(..._args: any[]): Promise<any> | any {}\n\n onFail(_error: Error, ..._args: any[]): void {}\n onSuccess(_result: any, ..._args: any[]): void {}\n onDeadletter(_error: Error, ..._args: any[]): void {}\n\n /**\n * Queues the job and resolves to its id once the driver has recorded it.\n *\n * Not `async`, deliberately: a missing name and arguments JSON cannot carry\n * still throw here, on the caller's stack, as they did when this returned\n * `void`. Only the driver's answer is asynchronous. Ignoring the promise is\n * fine with the memory driver, whose enqueue cannot fail; with a driver\n * that can, an ignored rejection is an unhandled one, so await it.\n */\n static dispatch<T extends Job>(\n this: new () => T,\n ...args: Parameters<T[\"run\"]>\n ): Promise<string> {\n if (this.name === \"unset\") {\n throw new Error(\"Cannot dispatch a job with no name\");\n }\n\n return app(QueueManager).push(this, JSON.stringify(args));\n }\n}\n\nexport type JobThrottle = {\n /** Shared by every job that counts against the same budget. */\n key: string;\n limit: number;\n /** The window, in milliseconds. */\n window: number;\n};\n\nexport type JobConcurrency = { key: string; limit: number };\n"
|
|
12
12
|
],
|
|
13
13
|
"mappings": ";4UAeO,AAAM,LAAqC,LAC/B,EAAU,FAAI,IACd,SAAW,IAAI,SAE1B,QAAO,CAAC,EAAc,EAAe,EAAuC,CAChF,IAAM,EAAM,KAAK,IAAI,EACf,EAAQ,KAAK,QAAQ,IAAI,CAAI,EACnC,GAAI,IAAU,EAAM,UAAY,GAAO,EAAM,OAAS,GAAI,OAAO,KACjE,IAAM,GAAS,GAAO,OAAS,GAAK,EAEpC,OADA,KAAK,QAAQ,IAAI,EAAM,CAAE,QAAO,QAAO,UAAW,EAAM,KAAK,IAAI,EAAG,CAAK,EAAG,OAAQ,CAAE,CAAC,EAChF,OAGH,OAAM,CAAC,EAAc,EAAe,EAAe,EAAiC,CACxF,IAAM,EAAQ,KAAK,QAAQ,EAAM,EAAO,CAAK,EAC7C,GAAI,CAAC,EAAO,MAAO,GAEnB,OADA,EAAM,UAAY,KAAK,IAAI,EAAI,KAAK,IAAI,EAAG,CAAK,EACzC,QAGH,QAAO,CAAC,EAAc,EAAe,EAAkC,CAC3E,IAAM,EAAQ,KAAK,QAAQ,EAAM,EAAO,CAAK,EAC7C,GAAI,CAAC,EAAO,MAAO,GAGnB,OAFA,EAAM,MAAQ,GACd,EAAM,UAAY,EACX,QAGH,OAAM,CAAC,EAAc,CACzB,IAAM,EAAQ,KAAK,QAAQ,IAAI,CAAI,EACnC,GAAI,CAAC,GAAS,EAAM,WAAa,KAAK,IAAI,EAAG,OAAO,KACpD,MAAO,CAAE,MAAO,EAAM,MAAO,MAAO,EAAM,KAAM,OAG5C,KAAI,CAAC,EAAc,EAAe,EAAiC,CACvE,OAAO,KAAK,QAAQ,EAAM,EAAO,CAAK,IAAM,YAGxC,QAAO,CAAC,EAAc,EAAiC,CAC3D,IAAK,KAAK,SAAS,IAAI,CAAI,GAAK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AAO,IAAW,SACpB,MAAU,MACR,yBAAyB,mGAE3B,EAEF,OAAO,EGjvCF,MAAM,CAAI,OACR,MAAO,QACd,OAAS,GACT,YAAc,EAQd,QAA6B,EAY7B,QAAQ,IAAI,EAAkD,CAC5D,OAOF,UAAY,QASZ,QAAQ,IAAI,EAA8D,CACxE,OAQF,WAAW,IAAI,EAAiD,CAC9D,OAQF,OAAO,CAAC,EAAU,EAAS,CACzB,KAAK,SAAW,CAAE,KAAM,UAAW,SAAQ,EAU7C,IAAI,CAAC,EAAgB,EAA+B,CAAC,EAAS,CAC5D,KAAK,SAAW,CACd,KAAM,OACN,MAAO,aAAiB,MAAQ,EAAY,MAAM,OAAO,CAAK,CAAC,EAC/D,MAAO,EAAQ,OAAS,EAC1B,EAIF,SAKA,GAAG,IAAI,EAAkC,EAEzC,MAAM,CAAC,KAAkB,EAAoB,EAC7C,SAAS,CAAC,KAAiB,EAAoB,EAC/C,YAAY,CAAC,KAAkB,EAAoB,QAW5C,SAAuB,IAEzB,EACc,CACjB,GAAI,KAAK,OAAS,QAChB,MAAU,MAAM,oCAAoC,EAGtD,OAAO,EAAI,CAAY,EAAE,KAAK,KAAM,KAAK,UAAU,CAAI,CAAC,EAE5D",
|
|
14
|
-
"debugId": "
|
|
14
|
+
"debugId": "6E5D07D2E65089E164756E2164756E21",
|
|
15
15
|
"names": []
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h as N,j as q}from"./chunk-
|
|
2
|
+
import{h as N,j as q}from"./chunk-z38355mx.js";import{ka as E,la as w}from"./chunk-q7y9v2v5.js";import"./chunk-a1g0bahx.js";import"./chunk-564zfdd1.js";import"./chunk-9r3znmqq.js";import"./chunk-tvy2fqza.js";import"./chunk-wsftnxzs.js";import{Uf as _}from"./chunk-fwympxqk.js";import{oh as y}from"./chunk-82hpq0bq.js";import"./chunk-3s3awh38.js";import{join as KJ}from"path";import{createServer as QJ}from"vite";import{join as u}from"path";import{IncomingMessage as v,ServerResponse as l}from"http";import{Socket as d}from"net";function c(J){return J.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
|
|
3
3
|
`).split(`
|
|
4
4
|
`).map((K)=>K.trim()).filter((K)=>K.length>0).join(`
|
|
5
5
|
`).trim()}function F(J){return`
|
|
@@ -55,4 +55,4 @@ window.$RefreshSig$ = () => (type) => type;
|
|
|
55
55
|
window.__vite_plugin_react_preamble_installed__ = true;
|
|
56
56
|
`;function s(J){let{pathname:K}=new URL(J.url),Q=(W)=>new Response(W,{headers:{"Content-Type":"application/javascript"}});if(K===S)return Q(n);if(K.startsWith("/render-error.js"))return Q("window.render_error = true");if(K.startsWith("/refresh.js"))return Q(o);return null}function C(J,K,Q){let W=u(process.cwd(),"app");return async($)=>{let{pathname:G}=new URL($.url),B=(Z)=>{if(console.error(Z),Q.ssrFixStacktrace?.(Z),j(Z),y(G))return new Response(JSON.stringify({error:_("server_error",Z?.message??String(Z),500)}),{status:500,headers:{"Content-Type":"application/json"}});return globalThis.__gemiErrorPageServed=!0,new Response(F(I(Z)),{status:500,headers:{"Content-Type":"text/html"}})},z=async(Z)=>{let L=s(Z);if(L)return L;try{let Y=J.fetch.bind(J),X=await i(Q,Z)??await Y(Z);if(X instanceof Response)return X;let A={},b={},M={},h=(U,O)=>`"${U}": () => import("${O}")`,D=[];for(let U of["404",...J.getFlatComponentTree.call(J)]){if(Bun.env.NODE_ENV==="test")break;let O=`${process.env.APP_DIR}`,x=await H(Q).import(`${O}/views/${U}.tsx`);A[U]=x.default,b[U]=x?.OpenGraph,M[U]=x,D.push(h(U,`/app/views/${U}.tsx`))}let m=`{${D.join(",")}}`;return await X({getStyles:async(U)=>await N(W,Q,U),bootstrapModules:[S],viewImportMap:A,viewModules:M,ogMap:b,loaders:m,cssManifest:{}})}catch(Y){return B(Y)}};return await K($,(Z)=>J.withGlobalMiddleware(Z,z,B))}}function a(J){try{return Bun.listen({hostname:"0.0.0.0",port:J,socket:{data(){}}}).stop(!0),!0}catch(K){return K?.code!=="EADDRINUSE"}}function T(J,K=a){let Q=24678+(J-5173);if(Q>65471)Q=24678;for(let W=Q;W<Q+64;W++)if(K(W))return W;throw Error(`Could not find a free port for Vite's HMR websocket: tried ${Q}-${Q+64-1}. Set one explicitly in gemi.config.ts as \`vite: { server: { ws: { port } } }\`.`)}import{createServer as t}from"http";var r=new Set(["vite-hmr","vite-ping"]);async function k(J){let K=t((Q,W)=>{W.writeHead(426,{"Content-Type":"text/plain"}),W.end("Upgrade Required")});return await new Promise((Q,W)=>{K.once("error",W),K.listen(J,"127.0.0.1",()=>{K.off("error",W),Q()})}),K}function P(J){if(!J||typeof J!=="object")return null;let Q=J.server?.address?.();if(Q&&typeof Q==="object"&&"port"in Q)return Number(Q.port)||null;return null}function f(J){if(J.headers.get("upgrade")?.toLowerCase()!=="websocket")return!1;return r.has(J.headers.get("sec-websocket-protocol")??"")}var e=(J)=>typeof J==="string"?J:new Uint8Array(J);async function R(J,K,Q){let W=new URL(J.url),$=J.headers.get("sec-websocket-protocol")??"vite-hmr",G={host:J.headers.get("host")??W.host},B=J.headers.get("origin");if(B)G.origin=B;let z=new WebSocket(`ws://127.0.0.1:${Q}${W.pathname}${W.search}`,{protocols:[$],headers:G});z.binaryType="arraybuffer";let Z={upstream:z,early:[]};if(z.onmessage=(X)=>{let A=e(X.data);if(Z.browser)Z.browser.send(A);else Z.early.push(A)},z.onclose=(X)=>{Z.browser?.close(JJ(X.code),X.reason)},z.onerror=()=>{},!await new Promise((X)=>{z.addEventListener("open",()=>X(!0),{once:!0}),z.addEventListener("close",()=>X(!1),{once:!0})}))return new Response("Vite refused the HMR websocket",{status:403});if(!K.upgrade(J,{headers:{"Sec-WebSocket-Protocol":$},data:Z}))return z.close(),new Response("WebSocket upgrade failed",{status:400});return}function JJ(J){if(J===1000||J>=1001&&J<=1003||J>=1007&&J<=1014)return J;if(J>=3000&&J<=4999)return J;return 1000}var g={open(J){let K=J.data;for(let Q of K.early)J.send(Q);if(K.early=[],K.browser=J,K.upstream.readyState!==WebSocket.OPEN)J.close(1000)},message(J,K){if(J.data.upstream.readyState===WebSocket.OPEN)J.data.upstream.send(K)},close(J){let{upstream:K}=J.data;if(K.readyState<=WebSocket.OPEN)K.close()}};var V=process.cwd(),WJ=KJ(V,"app");if(!globalThis.__gemiErrorHooked)globalThis.__gemiErrorHooked=!0,process.on("unhandledRejection",(J)=>{console.error(J),j(J)}),process.on("uncaughtException",(J)=>{console.error(J),j(J)});async function _J(J,K){let Q=Number(process.env.PORT)||5173,W=Boolean(globalThis.__gemiVite),$=globalThis.__gemiVite??=await QJ({configFile:!1,plugins:[w()],server:{middlewareMode:!0,port:Q,ws:{server:await k(T(Q))},allowedHosts:J.devAllowedHosts.call(J),watch:{ignored:(Z)=>{let L=Z.split(/[/\\]/).pop()??"";return L===".env"||L.startsWith(".env.")}}},appType:"custom",resolve:{dedupe:["react","react-dom"]},optimizeDeps:{include:["react","react-dom","react-dom/client"]},ssr:{external:[...E]}});process.env.ROOT_DIR=V,process.env.APP_DIR=WJ;let G=C(J,K,$),B=P($.config?.server?.ws),z=Bun.serve({port:Q,fetch:(Z,L)=>{if(B!==null&&f(Z))return R(Z,L,B);return G(Z)},websocket:g});if(W)H($).clearCache();if(W)if(globalThis.__gemiErrorActive&&globalThis.__gemiErrorPageServed)globalThis.__gemiErrorActive=!1,globalThis.__gemiErrorPageServed=!1,$.ws.send({type:"full-reload"});else globalThis.__gemiErrorActive=!1,$.ws.send({type:"custom",event:"http-reload"});else q({port:z.port,rootDir:V});return z}export{I as viteErrorPayload,_J as httpDev};
|
|
57
57
|
|
|
58
|
-
//# debugId=
|
|
58
|
+
//# debugId=D737F08ECD671A5264756E2164756E21
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"import { createServer, type Server as NodeServer } from \"node:http\";\n\nimport type { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\n// Vite's HMR websocket, carried on the dev server's own port.\n//\n// In middleware mode Vite has no HTTP server of its own, so by default it\n// stands up a second one for the websocket, on a second port (see\n// `hmrPort.ts`), and tells the browser to connect to `<page host>:<that port>`.\n// A reverse proxy or tunnel (ngrok, a container port mapping, a phone on the\n// LAN through https) only carries the port the page came from, so HMR could\n// not connect there, and the client logged connection failures forever.\n//\n// Vite can attach its websocket to a server it is handed (`server.ws.server`)\n// instead, and then tells the browser to connect to the page's own origin. That\n// server has to be a Node `http.Server`; the dev server is `Bun.serve`. So:\n//\n// - the Node server Vite is handed listens on loopback only, on the port\n// `resolveHmrPort` picked, and answers nothing but websocket upgrades;\n// - `Bun.serve` accepts the browser's upgrade on the page's origin and relays\n// frames both ways to that loopback server.\n//\n// The relay forwards the browser's `Host` and `Origin` and the request's query\n// (the `token`), so Vite still runs its own host and token checks against what\n// the browser actually sent.\n\n/** The subprotocols Vite's client opens its sockets with. */\nconst VITE_PROTOCOLS = new Set([\"vite-hmr\", \"vite-ping\"]);\n\n/**\n * Start the loopback Node server Vite attaches its HMR websocket to.\n * Everything but an upgrade gets `426 Upgrade Required`, as Vite's own\n * websocket server answers.\n */\nexport async function listenHmrServer(port: number): Promise<NodeServer> {\n const server = createServer((_req, res) => {\n res.writeHead(426, { \"Content-Type\": \"text/plain\" });\n res.end(\"Upgrade Required\");\n });\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(port, \"127.0.0.1\", () => {\n server.off(\"error\", reject);\n resolve();\n });\n });\n return server;\n}\n\n/**\n * The loopback port to relay to, read from the config Vite actually resolved,\n * so an app that set its own `server.ws` in `gemi.config.ts` is relayed to\n * where Vite really is, or not relayed at all. `null` when Vite was not given\n * a server (its websocket is then on a port of its own, and the client goes\n * there directly) or when HMR is off.\n */\nexport function hmrRelayPort(wsConfig: unknown): number | null {\n if (!wsConfig || typeof wsConfig !== \"object\") return null;\n const server = (wsConfig as { server?: { address?: () => unknown } }).server;\n const address = server?.address?.();\n if (address && typeof address === \"object\" && \"port\" in address) {\n return Number((address as { port: number }).port) || null;\n }\n return null;\n}\n\n/** Whether a request is the Vite client opening its HMR (or ping) socket. */\nexport function isHmrUpgrade(req: Request): boolean {\n if (req.headers.get(\"upgrade\")?.toLowerCase() !== \"websocket\") return false;\n return VITE_PROTOCOLS.has(req.headers.get(\"sec-websocket-protocol\") ?? \"\");\n}\n\nexport type HmrRelayData = {\n /** The socket to Vite, already open when the browser's is accepted. */\n upstream: WebSocket;\n /** Frames Vite sent before the browser's socket opened (its `connected`). */\n early: (string | Uint8Array)[];\n browser?: ServerWebSocket<HmrRelayData>;\n};\n\ntype Frame = string | Uint8Array;\n\nconst frameOf = (data: unknown): Frame =>\n typeof data === \"string\" ? data : new Uint8Array(data as ArrayBuffer);\n\n/**\n * Open the socket to Vite first, and accept the browser's upgrade only once\n * Vite has accepted it. Returns `undefined` once Bun has taken the request\n * over, or a refusal.\n *\n * The order matters. Vite refuses a socket whose host is not in\n * `allowedHosts`, or a cross-origin one without its token. Had the browser's\n * socket been accepted first and closed when Vite refused, the client would\n * read that as \"server connection lost\", ping (which Vite always answers),\n * and reload the page, forever. Refused before it opens, the client logs one\n * \"failed to connect to websocket\" and the page keeps working.\n */\nexport async function upgradeHmr(\n req: Request,\n server: Server<HmrRelayData>,\n port: number,\n): Promise<Response | undefined> {\n const url = new URL(req.url);\n const protocol = req.headers.get(\"sec-websocket-protocol\") ?? \"vite-hmr\";\n // `Host` is what Vite's `allowedHosts` check reads; the URL's host is the\n // same value `Bun.serve` derived it from.\n const headers: Record<string, string> = {\n host: req.headers.get(\"host\") ?? url.host,\n };\n const origin = req.headers.get(\"origin\");\n if (origin) headers.origin = origin;\n\n const upstream = new WebSocket(\n `ws://127.0.0.1:${port}${url.pathname}${url.search}`,\n {\n protocols: [protocol],\n headers,\n } as any,\n );\n upstream.binaryType = \"arraybuffer\";\n const data: HmrRelayData = { upstream, early: [] };\n\n upstream.onmessage = (event) => {\n const frame = frameOf(event.data);\n if (data.browser) data.browser.send(frame);\n else data.early.push(frame);\n };\n upstream.onclose = (event) => {\n data.browser?.close(sendableCloseCode(event.code), event.reason);\n };\n upstream.onerror = () => {\n // A `close` follows; it ends the browser's socket if there is one.\n };\n\n const opened = await new Promise<boolean>((resolve) => {\n upstream.addEventListener(\"open\", () => resolve(true), { once: true });\n upstream.addEventListener(\"close\", () => resolve(false), { once: true });\n });\n if (!opened) {\n return new Response(\"Vite refused the HMR websocket\", { status: 403 });\n }\n\n const upgraded = server.upgrade(req, {\n // The browser fails a connection whose response does not echo the\n // subprotocol it asked for.\n headers: { \"Sec-WebSocket-Protocol\": protocol },\n data,\n });\n if (!upgraded) {\n upstream.close();\n return new Response(\"WebSocket upgrade failed\", { status: 400 });\n }\n return undefined;\n}\n\n// A close code that may be sent in a close frame. 1005, 1006 and 1015 are\n// reported locally and never sent.\nfunction sendableCloseCode(code: number): number {\n if (\n code === 1000 ||\n (code >= 1001 && code <= 1003) ||\n (code >= 1007 && code <= 1014)\n ) {\n return code;\n }\n if (code >= 3000 && code <= 4999) return code;\n return 1000;\n}\n\n/** `Bun.serve`'s `websocket` option: relays frames to and from Vite. */\nexport const hmrRelayHandler: WebSocketHandler<HmrRelayData> = {\n open(ws: ServerWebSocket<HmrRelayData>) {\n const data = ws.data;\n for (const frame of data.early) ws.send(frame);\n data.early = [];\n data.browser = ws;\n // Vite may have hung up while the upgrade was in flight.\n if (data.upstream.readyState !== WebSocket.OPEN) ws.close(1000);\n },\n message(ws: ServerWebSocket<HmrRelayData>, message) {\n if (ws.data.upstream.readyState === WebSocket.OPEN) {\n ws.data.upstream.send(message);\n }\n },\n close(ws: ServerWebSocket<HmrRelayData>) {\n const { upstream } = ws.data;\n if (upstream.readyState <= WebSocket.OPEN) upstream.close();\n },\n};\n"
|
|
10
10
|
],
|
|
11
11
|
"mappings": ";gZAAA,SAAS,QAET,iBAAS,QCDT,SAAS,OACT,oBAAS,cAAiB,OAC1B,iBAAS,YCHT,SAAS,CAAmB,CAAC,EAAM,CACjC,OACE,EAEG,QAAQ,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kB,CAAE,EAUpE,IAAK,CACH,SAAU,CAAC,GAAG,CAAwB,CACxC,CACF,CAAC,EAED,QAAQ,IAAI,SAAW,EACvB,QAAQ,IAAI,QAAU,GAEtB,IAAM,EAAW,EAAe,EAAK,EAAiB,CAAI,EAGpD,EAAY,EAAa,EAAK,QAAQ,QAAQ,EAAE,EAChD,EAAS,IAAI,MAAoB,CACrC,KAAM,EACN,MAAO,CAAC,EAAK,IAAW,CACtB,GAAI,IAAc,MAAQ,EAAa,CAAG,EACxC,OAAO,EAAW,EAAK,EAAQ,CAAS,EAE1C,OAAO,EAAS,CAAG,GAErB,UAAW,CACb,CAAC,EA+BD,GAAI,EACF,EAAU,CAAI,EAAE,WAAW,EAQ7B,GAAI,EAMF,GAAI,WAAW,mBAAqB,WAAW,sBAC7C,WAAW,kBAAoB,GAC/B,WAAW,sBAAwB,GACnC,EAAK,GAAG,KAAK,CAAE,KAAM,aAAc,CAAC,EAEpC,gBAAW,kBAAoB,GAC/B,EAAK,GAAG,KAAK,CAAE,KAAM,SAAU,MAAO,aAAc,CAAC,EAIvD,OAAmB,CAAE,KAAM,EAAO,KAAM,SAAQ,CAAC,EAGnD,OAAO",
|
|
12
|
-
"debugId": "
|
|
12
|
+
"debugId": "D737F08ECD671A5264756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * The prefix every api route is served under. The browser adds it when it\n * fetches (`/api${path}`) and the server strips it before matching, so an api\n * router's own paths never carry it.\n */\nexport const API_PREFIX = \"/api\";\n\n/**\n * Whether a request pathname is an api request: `/api` itself or anything\n * under `/api/`. A bare `startsWith(\"/api\")` also claims `/apidocs`,\n * `/api-keys` and `/apiary`, so a view route there would never render — the\n * api dispatcher would answer its 404 JSON instead.\n */\nexport function isApiPath(pathname: string): boolean {\n return pathname === API_PREFIX || pathname.startsWith(`${API_PREFIX}/`);\n}\n\n/**\n * The api router path a request pathname addresses: `/api/users/1` is\n * `/users/1`, `/api/` is `/` and `/api` is `\"\"`. Only the leading prefix is\n * stripped — `replace(\"/api\", \"\")` would also strip an `/api` inside the path\n * of a request that did not start with one (`/files/api` becoming `/files`).\n * A pathname outside `/api` comes back unchanged, so the dispatcher can still\n * be handed a request by its route path directly.\n */\nexport function apiPath(pathname: string): string {\n return isApiPath(pathname) ? pathname.slice(API_PREFIX.length) : pathname;\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAaO,SAAS,CAAS,CAAC,EAA2B,CACnD,OAAO,IATiB,QASU,EAAS,WAAW,OAAgB,EAWjE,SAAS,CAAO,CAAC,EAA0B,CAChD,OAAO,EAAU,CAAQ,EAAI,EAAS,MAAM,CAAiB,EAAI",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "CC4FCEC60805A31464756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{rh as y}from"./chunk-3s3awh38.js";var v=y((x)=>{class s extends Error{name="ProviderError";tryNextLink;constructor(r,t=!0){let n,e=!0;if(typeof t==="boolean")n=void 0,e=t;else if(t!=null&&typeof t==="object")n=t.logger,e=t.tryNextLink??!0;super(r);this.tryNextLink=e,Object.setPrototypeOf(this,s.prototype),n?.debug?.(`@smithy/property-provider ${e?"->":"(!)"} ${r}`)}static from(r,t=!0){return Object.assign(new this(r.message,t),r)}}class f extends s{name="CredentialsProviderError";constructor(r,t=!0){super(r,t);Object.setPrototypeOf(this,f.prototype)}}class l extends s{name="TokenProviderError";constructor(r,t=!0){super(r,t);Object.setPrototypeOf(this,l.prototype)}}var p=(...r)=>async()=>{if(r.length===0)throw new s("No providers in chain");let t;for(let n of r)try{return await n()}catch(e){if(t=e,e?.tryNextLink)continue;throw e}throw t},d=(r)=>()=>Promise.resolve(r),h=(r,t,n)=>{let e,o,i,c=!1,a=async()=>{if(!o)o=r();try{e=await o,i=!0,c=!1}finally{o=void 0}return e};if(t===void 0)return async(u)=>{if(!i||u?.forceRefresh)e=await a();return e};return async(u)=>{if(!i||u?.forceRefresh)e=await a();if(c)return e;if(n&&!n(e))return c=!0,e;if(t(e))return await a(),e;return e}};x.CredentialsProviderError=f;x.ProviderError=s;x.TokenProviderError=l;x.chain=p;x.fromStatic=d;x.memoize=h});
|
|
3
3
|
export{v as $};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=57AEEB77CA7CEEA264756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nclass ProviderError extends Error {\n name = \"ProviderError\";\n tryNextLink;\n constructor(message, options = true) {\n let logger;\n let tryNextLink = true;\n if (typeof options === \"boolean\") {\n logger = undefined;\n tryNextLink = options;\n }\n else if (options != null && typeof options === \"object\") {\n logger = options.logger;\n tryNextLink = options.tryNextLink ?? true;\n }\n super(message);\n this.tryNextLink = tryNextLink;\n Object.setPrototypeOf(this, ProviderError.prototype);\n logger?.debug?.(`@smithy/property-provider ${tryNextLink ? \"->\" : \"(!)\"} ${message}`);\n }\n static from(error, options = true) {\n return Object.assign(new this(error.message, options), error);\n }\n}\n\nclass CredentialsProviderError extends ProviderError {\n name = \"CredentialsProviderError\";\n constructor(message, options = true) {\n super(message, options);\n Object.setPrototypeOf(this, CredentialsProviderError.prototype);\n }\n}\n\nclass TokenProviderError extends ProviderError {\n name = \"TokenProviderError\";\n constructor(message, options = true) {\n super(message, options);\n Object.setPrototypeOf(this, TokenProviderError.prototype);\n }\n}\n\nconst chain = (...providers) => async () => {\n if (providers.length === 0) {\n throw new ProviderError(\"No providers in chain\");\n }\n let lastProviderError;\n for (const provider of providers) {\n try {\n const credentials = await provider();\n return credentials;\n }\n catch (err) {\n lastProviderError = err;\n if (err?.tryNextLink) {\n continue;\n }\n throw err;\n }\n }\n throw lastProviderError;\n};\n\nconst fromStatic = (staticValue) => () => Promise.resolve(staticValue);\n\nconst memoize = (provider, isExpired, requiresRefresh) => {\n let resolved;\n let pending;\n let hasResult;\n let isConstant = false;\n const coalesceProvider = async () => {\n if (!pending) {\n pending = provider();\n }\n try {\n resolved = await pending;\n hasResult = true;\n isConstant = false;\n }\n finally {\n pending = undefined;\n }\n return resolved;\n };\n if (isExpired === undefined) {\n return async (options) => {\n if (!hasResult || options?.forceRefresh) {\n resolved = await coalesceProvider();\n }\n return resolved;\n };\n }\n return async (options) => {\n if (!hasResult || options?.forceRefresh) {\n resolved = await coalesceProvider();\n }\n if (isConstant) {\n return resolved;\n }\n if (requiresRefresh && !requiresRefresh(resolved)) {\n isConstant = true;\n return resolved;\n }\n if (isExpired(resolved)) {\n await coalesceProvider();\n return resolved;\n }\n return resolved;\n };\n};\n\nexports.CredentialsProviderError = CredentialsProviderError;\nexports.ProviderError = ProviderError;\nexports.TokenProviderError = TokenProviderError;\nexports.chain = chain;\nexports.fromStatic = fromStatic;\nexports.memoize = memoize;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";uDAEA,MAAM,UAAsB,KAAM,CAC9B,KAAO,gBACP,YACA,WAAW,CAAC,EAAS,EAAU,GAAM,CACjC,IAAI,EACA,EAAc,GAClB,GAAI,OAAO,IAAY,UACnB,EAAS,OACT,EAAc,EAEb,QAAI,GAAW,MAAQ,OAAO,IAAY,SAC3C,EAAS,EAAQ,OACjB,EAAc,EAAQ,aAAe,GAEzC,MAAM,CAAO,EACb,KAAK,YAAc,EACnB,OAAO,eAAe,KAAM,EAAc,SAAS,EACnD,GAAQ,QAAQ,6BAA6B,EAAc,KAAO,SAAS,GAAS,QAEjF,KAAI,CAAC,EAAO,EAAU,GAAM,CAC/B,OAAO,OAAO,OAAO,IAAI,KAAK,EAAM,QAAS,CAAO,EAAG,CAAK,EAEpE,CAEA,MAAM,UAAiC,CAAc,CACjD,KAAO,2BACP,WAAW,CAAC,EAAS,EAAU,GAAM,CACjC,MAAM,EAAS,CAAO,EACtB,OAAO,eAAe,KAAM,EAAyB,SAAS,EAEtE,CAEA,MAAM,UAA2B,CAAc,CAC3C,KAAO,qBACP,WAAW,CAAC,EAAS,EAAU,GAAM,CACjC,MAAM,EAAS,CAAO,EACtB,OAAO,eAAe,KAAM,EAAmB,SAAS,EAEhE,CAEA,IAAM,EAAQ,IAAI,IAAc,SAAY,CACxC,GAAI,EAAU,SAAW,EACrB,MAAM,IAAI,EAAc,uBAAuB,EAEnD,IAAI,EACJ,QAAW,KAAY,EACnB,GAAI,CAEA,OADoB,MAAM,EAAS,EAGvC,MAAO,EAAK,CAER,GADA,EAAoB,EAChB,GAAK,YACL,SAEJ,MAAM,EAGd,MAAM,GAGJ,EAAa,CAAC,IAAgB,IAAM,QAAQ,QAAQ,CAAW,EAE/D,EAAU,CAAC,EAAU,EAAW,IAAoB,CACtD,IAAI,EACA,EACA,EACA,EAAa,GACX,EAAmB,SAAY,CACjC,GAAI,CAAC,EACD,EAAU,EAAS,EAEvB,GAAI,CACA,EAAW,MAAM,EACjB,EAAY,GACZ,EAAa,UAEjB,CACI,EAAU,OAEd,OAAO,GAEX,GAAI,IAAc,OACd,MAAO,OAAO,IAAY,CACtB,GAAI,CAAC,GAAa,GAAS,aACvB,EAAW,MAAM,EAAiB,EAEtC,OAAO,GAGf,MAAO,OAAO,IAAY,CACtB,GAAI,CAAC,GAAa,GAAS,aACvB,EAAW,MAAM,EAAiB,EAEtC,GAAI,EACA,OAAO,EAEX,GAAI,GAAmB,CAAC,EAAgB,CAAQ,EAE5C,OADA,EAAa,GACN,EAEX,GAAI,EAAU,CAAQ,EAElB,OADA,MAAM,EAAiB,EAChB,EAEX,OAAO,IAIP,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,UAAU",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "57AEEB77CA7CEEA264756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type { Application } from \"../foundation/Application\";\n\n/**\n * What a provider's `shutdown()` may resolve: nothing, or whether it\n * abandoned work at the deadline. See `ServiceProvider` below.\n */\nexport type ProviderShutdownResult = void | { abandoned: boolean };\n\n/**\n * Every hook defaults to a no-op. `register()` binds services into the\n * container and must not resolve any of them; `boot()` runs after every\n * provider has registered, so it may resolve freely.\n *\n * `shutdown()` runs once when a production server is told to stop (`SIGTERM`\n * or `SIGINT`), after it has stopped accepting requests and the in-flight ones\n * have finished or run out of grace — so nothing a request needs is torn down\n * under it. Providers shut down in reverse registration order, so one\n * registered after another may still use it. Each is awaited, but under a\n * shared deadline (`GEMI_SHUTDOWN_PROVIDER_TIMEOUT`): one that overruns is\n * abandoned and the next begins, and one that throws is logged and does not\n * stop the rest. See `Application.shutdown`.\n *\n * Under `gemi dev` it also runs on every `bun --hot` reload, for the\n * application the reload replaced, once the new one is serving and the old\n * one's requests have finished (see `server/devReload.ts`). A hook that closes\n * something kept on `globalThis` across reloads would close it for the new\n * application too.\n *\n * `timeoutMs` is what is left of that shared deadline when this provider is\n * reached. A provider that waits for something — jobs finishing, a queue\n * draining — should bound its own wait by a little less than this, so that it\n * is still the one to report what it gave up on. Ignoring it is fine; the\n * provider is then simply abandoned at the deadline, with only a generic line\n * from `Application` to say so.\n *\n * A provider that bounds its own wait and gives up on work it was waiting for\n * resolves `{ abandoned: true }`. `Application` then reports it in `timedOut`\n * as if it had overrun, and the process exits `1` — the work was cut off just\n * the same, and an orchestrator or a log alert has to be able to see that from\n * the exit code. The provider names what it abandoned in its own log line.\n */\nexport abstract class ServiceProvider {\n constructor(protected app: Application) {}\n\n register(): void {}\n\n boot(): void | Promise<void> {}\n\n shutdown(options?: {\n timeoutMs: number;\n }): ProviderShutdownResult | Promise<ProviderShutdownResult> {}\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAyCO,MAAe,CAAgB,CACd,IAAtB,WAAW,CAAW,EAAkB,CAAlB,WAEtB,QAAQ,EAAS,EAEjB,IAAI,EAAyB,EAE7B,QAAQ,CAAC,EAEoD,EAC/D",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "E85534E036CAEBF564756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{H as C}from"./chunk-
|
|
2
|
+
import{H as C}from"./chunk-kh273hj0.js";import{V as ne}from"./chunk-pj2e1p07.js";import"./chunk-eytdyahy.js";import{$ as _}from"./chunk-8pynv9rw.js";import{qh as c,uh as F}from"./chunk-3s3awh38.js";var x=c(_(),1),T=c(C(),1);var q=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var D=c(ne(),1);var u=c(_(),1),m=c(C(),1);var W=300000,h="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var j=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-we2sj339.js").then((m)=>c(m.default,1)),n=(f)=>o.clientConfig?.[f]??o.parentClientConfig?.[f]??r?.[f];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var X=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-we2sj339.js").then((m)=>c(m.default,1));return(await j(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var z=c(_(),1);var P=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new z.TokenProviderError(`Token is expired. ${h}`,!1)};var J=c(_(),1);var g=(e,o,r=!1)=>{if(typeof o>"u")throw new J.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${h}`,!1)};var V=c(C(),1);import{promises as re}from"fs";var{writeFile:te}=re,Y=(e,o)=>{let r=V.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return te(r,t)};var B=new Date(0),Q=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await m.parseKnownFiles(e),t=m.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new u.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new u.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let a=n.sso_session,p=(await m.loadSsoSessionData(e))[a];if(!p)throw new u.TokenProviderError(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(let i of["sso_start_url","sso_region"])if(!p[i])throw new u.TokenProviderError(`Sso session '${a}' is missing required property '${i}'.`,!1);let{sso_start_url:S,sso_region:I}=p,s;try{s=await m.getSSOTokenFromFile(a)}catch(i){throw new u.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${h}`,!1)}g("accessToken",s.accessToken),g("expiresAt",s.expiresAt);let{accessToken:y,expiresAt:E}=s,l={token:y,expiration:new Date(E)};if(l.expiration.getTime()-Date.now()>W)return l;if(Date.now()-B.getTime()<30000)return P(l),l;g("clientId",s.clientId,!0),g("clientSecret",s.clientSecret,!0),g("refreshToken",s.refreshToken,!0);try{B.setTime(Date.now());let i=await X(s,I,e,o);g("accessToken",i.accessToken),g("expiresIn",i.expiresIn);let O=new Date(Date.now()+i.expiresIn*1000);try{await Y(a,{...s,accessToken:i.accessToken,expiresAt:O.toISOString(),refreshToken:i.refreshToken})}catch(R){}return{token:i.accessToken,expiration:O}}catch(i){return P(l),l}};var k=c(_(),1),Z=c(C(),1),A=!1,$=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,clientConfig:f,parentClientConfig:p,callerClientConfig:S,profile:I,filepath:s,configFilepath:y,ignoreCache:E,logger:l})=>{let i,O="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let w=await Q({profile:I,filepath:s,configFilepath:y,ignoreCache:E})();i={accessToken:w.token,expiresAt:new Date(w.expiration).toISOString()}}catch(w){throw new k.CredentialsProviderError(w.message,{tryNextLink:A,logger:l})}else try{i=await Z.getSSOTokenFromFile(e)}catch(w){throw new k.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:A,logger:l})}if(new Date(i.expiresAt).getTime()-Date.now()<=0)throw new k.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:A,logger:l});let{accessToken:R}=i,{SSOClient:d,GetRoleCredentialsCommand:N}=await import("./chunk-kstvyvr0.js"),se=a||new d(Object.assign({},f??{},{logger:f?.logger??S?.logger??p?.logger,region:f?.region??t,userAgentAppId:f?.userAgentAppId??S?.userAgentAppId??p?.userAgentAppId})),L;try{L=await se.send(new N({accountId:r,roleName:n,accessToken:R}))}catch(w){throw new k.CredentialsProviderError(w,{tryNextLink:A,logger:l})}let{roleCredentials:{accessKeyId:M,secretAccessKey:G,sessionToken:K,expiration:b,credentialScope:H,accountId:U}={}}=L;if(!M||!G||!K||!b)throw new k.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:A,logger:l});let v={accessKeyId:M,secretAccessKey:G,sessionToken:K,expiration:new Date(b),...H&&{credentialScope:H},...U&&{accountId:U}};if(o)D.setCredentialFeature(v,"CREDENTIALS_SSO","s");else D.setCredentialFeature(v,"CREDENTIALS_SSO_LEGACY","u");return v};var ee=c(_(),1),oe=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:a}=e;if(!r||!t||!n||!a)throw new ee.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
|
|
3
3
|
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e};var Ce=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoSession:f}=e,{ssoClient:p}=e,S=T.getProfileName({profile:e.profile??o?.profile});if(!r&&!t&&!n&&!a&&!f){let s=(await T.parseKnownFiles(e))[S];if(!s)throw new x.CredentialsProviderError(`Profile ${S} was not found.`,{logger:e.logger});if(!q(s))throw new x.CredentialsProviderError(`Profile ${S} is not configured with SSO credentials.`,{logger:e.logger});if(s?.sso_session){let d=(await T.loadSsoSessionData(e))[s.sso_session],N=` configurations in profile ${S} and sso-session ${s.sso_session}`;if(n&&n!==d.sso_region)throw new x.CredentialsProviderError("Conflicting SSO region"+N,{tryNextLink:!1,logger:e.logger});if(r&&r!==d.sso_start_url)throw new x.CredentialsProviderError("Conflicting SSO start_url"+N,{tryNextLink:!1,logger:e.logger});s.sso_region=d.sso_region,s.sso_start_url=d.sso_start_url}let{sso_start_url:y,sso_account_id:E,sso_region:l,sso_role_name:i,sso_session:O}=oe(s,e.logger);return $({ssoStartUrl:y,ssoSession:O,ssoAccountId:E,ssoRegion:l,ssoRoleName:i,ssoClient:p,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:S,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else if(!r||!t||!n||!a)throw new x.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return $({ssoStartUrl:r,ssoSession:f,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoClient:p,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:S,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})};export{oe as validateSsoProfile,q as isSsoProfile,Ce as fromSSO};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=5C2B775B206DD93F64756E2164756E21
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"import { CredentialsProviderError } from \"@smithy/property-provider\";\nexport const validateSsoProfile = (profile, logger) => {\n const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;\n if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {\n throw new CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters \"sso_account_id\", ` +\n `\"sso_region\", \"sso_role_name\", \"sso_start_url\". Got ${Object.keys(profile).join(\", \")}\\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });\n }\n return profile;\n};\n"
|
|
16
16
|
],
|
|
17
17
|
"mappings": ";8NAAA,SACA,KCDO,FAAM,JAAe,CAAC,IAAQ,IAChC,OAAO,EAAI,gBAAkB,UAC1B,OAAO,EAAI,iBAAmB,UAC9B,OAAO,EAAI,cAAgB,UAC3B,OAAO,EAAI,aAAe,UAC1B,OAAO,EAAI,gBAAkB,UCLrC,gBCAA,eACA,WCDO,IAAM,EAAmB,OACnB,EAAkB,kFCDxB,IAAM,EAAmB,MAAO,EAAW,EAAO,CAAC,EAAG,IAAuB,CAChF,IAAQ,iBAAkB,KAAa,yDACjC,EAAW,CAAC,IAAS,EAAK,eAAe,IAAS,EAAK,qBAAqB,IAAS,IAAqB,GAMhH,OALsB,IAAI,EAAc,OAAO,OAAO,CAAC,EAAG,EAAK,cAAgB,CAAC,EAAG,CAC/E,OAAQ,GAAa,EAAK,cAAc,OACxC,OAAQ,EAAS,QAAQ,EACzB,eAAgB,EAAS,gBAAgB,CAC7C,CAAC,CAAC,GCNC,IAAM,EAAqB,MAAO,EAAU,EAAW,EAAO,CAAC,EAAG,IAAuB,CAC5F,IAAQ,sBAAuB,KAAa,yDAE5C,OADsB,MAAM,EAAiB,EAAW,EAAM,CAAkB,GAC3D,KAAK,IAAI,EAAmB,CAC7C,SAAU,EAAS,SACnB,aAAc,EAAS,aACvB,aAAc,EAAS,aACvB,UAAW,eACf,CAAC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