gemi 0.157.1 → 0.160.2
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 +231 -55
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +45 -11
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/eval/Eval.d.ts +2 -11
- package/dist/ai/eval/Eval.d.ts.map +1 -1
- package/dist/ai/generate.d.ts +165 -7
- package/dist/ai/generate.d.ts.map +1 -1
- package/dist/ai/index.d.ts +5 -5
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +11 -11
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/usageMeter.d.ts +149 -6
- package/dist/ai/usageMeter.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/gemi.js +178 -121
- package/dist/bin/gemi.js.map +5 -4
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-0v3bca8k.js → chunk-0b8m1f07.js} +3 -3
- package/dist/{chunk-0v3bca8k.js.map → chunk-0b8m1f07.js.map} +1 -1
- package/dist/{chunk-xff7tkde.js → chunk-0qernzn1.js} +2 -2
- package/dist/{chunk-xff7tkde.js.map → chunk-0qernzn1.js.map} +1 -1
- package/dist/chunk-0qrbspbe.js +5 -0
- package/dist/{chunk-6np1r9gk.js.map → chunk-0qrbspbe.js.map} +1 -1
- package/dist/{chunk-517fjfme.js → chunk-0vb4j7cx.js} +3 -3
- package/dist/{chunk-517fjfme.js.map → chunk-0vb4j7cx.js.map} +1 -1
- package/dist/{chunk-0yjm936b.js → chunk-191gkynh.js} +3 -3
- package/dist/{chunk-0yjm936b.js.map → chunk-191gkynh.js.map} +1 -1
- package/dist/chunk-1xxh48bd.js +4 -0
- package/dist/{chunk-cmt3jw6j.js.map → chunk-1xxh48bd.js.map} +2 -2
- package/dist/chunk-27habdva.js +4 -0
- package/dist/{chunk-3ndc8adc.js.map → chunk-27habdva.js.map} +2 -2
- package/dist/{chunk-qvngsa1c.js → chunk-2ednvght.js} +2 -2
- package/dist/{chunk-qvngsa1c.js.map → chunk-2ednvght.js.map} +1 -1
- package/dist/chunk-3cvza61a.js +4 -0
- package/dist/{chunk-pw5h5935.js.map → chunk-3cvza61a.js.map} +2 -2
- package/dist/{chunk-1de3awrh.js → chunk-3d8jxky6.js} +3 -3
- package/dist/{chunk-1de3awrh.js.map → chunk-3d8jxky6.js.map} +1 -1
- package/dist/chunk-3vmc6adw.js +4 -0
- package/dist/{chunk-z7224rhm.js.map → chunk-3vmc6adw.js.map} +2 -2
- package/dist/{chunk-7yww9aq7.js → chunk-4670xxae.js} +2 -2
- package/dist/{chunk-7yww9aq7.js.map → chunk-4670xxae.js.map} +1 -1
- package/dist/{chunk-xtqd9vpp.js → chunk-4vqnv41y.js} +2 -2
- package/dist/{chunk-xtqd9vpp.js.map → chunk-4vqnv41y.js.map} +1 -1
- package/dist/{chunk-exb35whf.js → chunk-4ye6p5yk.js} +2 -2
- package/dist/{chunk-exb35whf.js.map → chunk-4ye6p5yk.js.map} +1 -1
- package/dist/{chunk-9md6acv2.js → chunk-57qnqcrp.js} +1 -1
- package/dist/{chunk-zcg6m7gf.js → chunk-5c6dfy75.js} +2 -2
- package/dist/{chunk-zcg6m7gf.js.map → chunk-5c6dfy75.js.map} +1 -1
- package/dist/{chunk-t7yt8egz.js → chunk-5pc21syf.js} +3 -3
- package/dist/{chunk-t7yt8egz.js.map → chunk-5pc21syf.js.map} +1 -1
- package/dist/{chunk-5zxxd7qp.js → chunk-5qzxyj68.js} +1 -1
- package/dist/{chunk-pgdxqrjv.js → chunk-664ewdjv.js} +4 -4
- package/dist/{chunk-pgdxqrjv.js.map → chunk-664ewdjv.js.map} +2 -2
- package/dist/chunk-6d6p0q3p.js +5 -0
- package/dist/{chunk-7zy6nq9e.js.map → chunk-6d6p0q3p.js.map} +2 -2
- package/dist/{chunk-k1aw97dm.js → chunk-6ytezxzj.js} +2 -2
- package/dist/{chunk-78wht1ph.js.map → chunk-6ytezxzj.js.map} +1 -1
- package/dist/{chunk-00z7s34q.js → chunk-79nypedr.js} +2 -2
- package/dist/{chunk-00z7s34q.js.map → chunk-79nypedr.js.map} +1 -1
- package/dist/{chunk-4vnrnbn3.js → chunk-7bc9ypbk.js} +3 -3
- package/dist/{chunk-4vnrnbn3.js.map → chunk-7bc9ypbk.js.map} +1 -1
- package/dist/{chunk-wg0ttent.js → chunk-7rfw4h2x.js} +3 -3
- package/dist/{chunk-wg0ttent.js.map → chunk-7rfw4h2x.js.map} +1 -1
- package/dist/{chunk-rrz2ry81.js → chunk-8m3m5hcf.js} +2 -2
- package/dist/{chunk-rrz2ry81.js.map → chunk-8m3m5hcf.js.map} +1 -1
- package/dist/{chunk-aq5zx3vg.js → chunk-8tyw6faf.js} +2 -2
- package/dist/{chunk-aq5zx3vg.js.map → chunk-8tyw6faf.js.map} +1 -1
- package/dist/{chunk-p83cjehh.js → chunk-8z29qvvm.js} +3 -3
- package/dist/{chunk-p83cjehh.js.map → chunk-8z29qvvm.js.map} +1 -1
- package/dist/{chunk-dhq7zv0t.js → chunk-982x8jps.js} +2 -2
- package/dist/{chunk-dhq7zv0t.js.map → chunk-982x8jps.js.map} +1 -1
- package/dist/{chunk-38kjpa6q.js → chunk-98byy5m4.js} +1 -1
- package/dist/{chunk-986eh0n3.js → chunk-9983zmhx.js} +2 -2
- package/dist/{chunk-986eh0n3.js.map → chunk-9983zmhx.js.map} +1 -1
- package/dist/{chunk-r5y2khw4.js → chunk-9f2ps5v2.js} +2 -2
- package/dist/{chunk-r5y2khw4.js.map → chunk-9f2ps5v2.js.map} +1 -1
- package/dist/{chunk-q3e1bqrs.js → chunk-bfj2jafb.js} +3 -3
- package/dist/{chunk-q3e1bqrs.js.map → chunk-bfj2jafb.js.map} +1 -1
- package/dist/{chunk-0vc2akg0.js → chunk-bqxt1she.js} +1 -1
- package/dist/{chunk-159j20yr.js → chunk-bzcfw8qd.js} +2 -2
- package/dist/{chunk-159j20yr.js.map → chunk-bzcfw8qd.js.map} +1 -1
- package/dist/chunk-cn6dteec.js +6 -0
- package/dist/{chunk-vp6t1gmt.js.map → chunk-cn6dteec.js.map} +2 -2
- package/dist/{chunk-x82f3q6a.js → chunk-cq16azbw.js} +4 -4
- package/dist/{chunk-x82f3q6a.js.map → chunk-cq16azbw.js.map} +1 -1
- package/dist/{chunk-72f6pbap.js → chunk-csvffxjh.js} +2 -2
- package/dist/{chunk-72f6pbap.js.map → chunk-csvffxjh.js.map} +1 -1
- package/dist/chunk-ctrmztan.js +4 -0
- package/dist/{chunk-42646nt7.js.map → chunk-ctrmztan.js.map} +2 -2
- package/dist/chunk-cxz7wycm.js +10 -0
- package/dist/{chunk-set6qmjw.js.map → chunk-cxz7wycm.js.map} +3 -3
- package/dist/{chunk-4t2j3zcg.js → chunk-d249m2ct.js} +2 -2
- package/dist/{chunk-4t2j3zcg.js.map → chunk-d249m2ct.js.map} +2 -2
- package/dist/{chunk-p2c72zx3.js → chunk-d3195ypx.js} +2 -2
- package/dist/{chunk-p2c72zx3.js.map → chunk-d3195ypx.js.map} +1 -1
- package/dist/{chunk-h3gcxf2k.js → chunk-day21sfa.js} +3 -3
- package/dist/{chunk-h3gcxf2k.js.map → chunk-day21sfa.js.map} +1 -1
- package/dist/{chunk-78wht1ph.js → chunk-egwz89ze.js} +2 -2
- package/dist/{chunk-k1aw97dm.js.map → chunk-egwz89ze.js.map} +1 -1
- package/dist/chunk-fcjjd162.js +4 -0
- package/dist/{chunk-jrv31jp9.js.map → chunk-fcjjd162.js.map} +2 -2
- package/dist/{chunk-rtv4ax8z.js → chunk-g71ppv6x.js} +2 -2
- package/dist/{chunk-rtv4ax8z.js.map → chunk-g71ppv6x.js.map} +1 -1
- package/dist/{chunk-56a3vnrj.js → chunk-gmeeyg19.js} +3 -3
- package/dist/{chunk-56a3vnrj.js.map → chunk-gmeeyg19.js.map} +1 -1
- package/dist/chunk-htbvkr11.js +41 -0
- package/dist/chunk-htbvkr11.js.map +28 -0
- package/dist/{chunk-ctrae98c.js → chunk-hxe06cgw.js} +2 -2
- package/dist/{chunk-ctrae98c.js.map → chunk-hxe06cgw.js.map} +1 -1
- package/dist/{chunk-yzsyg1f7.js → chunk-j144nwvh.js} +3 -3
- package/dist/{chunk-yzsyg1f7.js.map → chunk-j144nwvh.js.map} +1 -1
- package/dist/{chunk-q7k2hc45.js → chunk-jarsydtr.js} +3 -3
- package/dist/{chunk-q7k2hc45.js.map → chunk-jarsydtr.js.map} +1 -1
- package/dist/chunk-jx1crzgg.js +117 -0
- package/dist/{chunk-t66ex43f.js.map → chunk-jx1crzgg.js.map} +10 -9
- package/dist/chunk-k43m5dvs.js +4 -0
- package/dist/{chunk-69c2s43a.js.map → chunk-k43m5dvs.js.map} +2 -2
- package/dist/chunk-kan3yz82.js +5 -0
- package/dist/{chunk-3t4nw1n2.js.map → chunk-kan3yz82.js.map} +2 -2
- package/dist/{chunk-ah2jy1vx.js → chunk-m4pkbndk.js} +2 -2
- package/dist/{chunk-ah2jy1vx.js.map → chunk-m4pkbndk.js.map} +1 -1
- package/dist/{chunk-fe12f946.js → chunk-m73mjzeh.js} +2 -2
- package/dist/{chunk-fe12f946.js.map → chunk-m73mjzeh.js.map} +1 -1
- package/dist/{chunk-9gt9qdge.js → chunk-m8a80sgn.js} +1 -1
- package/dist/{chunk-px3ctjxh.js → chunk-msxhf3m6.js} +2 -2
- package/dist/{chunk-px3ctjxh.js.map → chunk-msxhf3m6.js.map} +1 -1
- package/dist/chunk-p6nkfcn1.js +5 -0
- package/dist/{chunk-kwc68y45.js.map → chunk-p6nkfcn1.js.map} +2 -2
- package/dist/{chunk-ss3yn4g2.js → chunk-p9syxzxh.js} +3 -3
- package/dist/{chunk-ss3yn4g2.js.map → chunk-p9syxzxh.js.map} +1 -1
- package/dist/{chunk-yewj83ez.js → chunk-pyyhmeg1.js} +3 -3
- package/dist/{chunk-yewj83ez.js.map → chunk-pyyhmeg1.js.map} +1 -1
- package/dist/{chunk-nvhbkqmd.js → chunk-qbsk0jr8.js} +2 -2
- package/dist/{chunk-nvhbkqmd.js.map → chunk-qbsk0jr8.js.map} +1 -1
- package/dist/{chunk-g5d62d1n.js → chunk-qsbtqh47.js} +2 -2
- package/dist/{chunk-g5d62d1n.js.map → chunk-qsbtqh47.js.map} +1 -1
- package/dist/{chunk-wnjvfmqc.js → chunk-qz9n2e59.js} +3 -3
- package/dist/{chunk-wnjvfmqc.js.map → chunk-qz9n2e59.js.map} +1 -1
- package/dist/{chunk-qbvm5q1g.js → chunk-rq3wrwfa.js} +1 -1
- package/dist/{chunk-8eyxj78g.js → chunk-ryq2ezgt.js} +3 -3
- package/dist/{chunk-8eyxj78g.js.map → chunk-ryq2ezgt.js.map} +1 -1
- package/dist/{chunk-v10xzpqs.js → chunk-s0xwqcrf.js} +2 -2
- package/dist/{chunk-v10xzpqs.js.map → chunk-s0xwqcrf.js.map} +1 -1
- package/dist/{chunk-kbdt84xg.js → chunk-szdbsmq7.js} +2 -2
- package/dist/{chunk-kbdt84xg.js.map → chunk-szdbsmq7.js.map} +1 -1
- package/dist/{chunk-n95dppzm.js → chunk-tsbxdz4h.js} +2 -2
- package/dist/{chunk-n95dppzm.js.map → chunk-tsbxdz4h.js.map} +1 -1
- package/dist/chunk-v0gjdknx.js +4 -0
- package/dist/{chunk-7426gfgw.js.map → chunk-v0gjdknx.js.map} +2 -2
- package/dist/chunk-v8fx4vgq.js +4 -0
- package/dist/{chunk-zfbqgzwa.js.map → chunk-v8fx4vgq.js.map} +2 -2
- package/dist/{chunk-dce3w52r.js → chunk-vb73ddwz.js} +3 -3
- package/dist/{chunk-dce3w52r.js.map → chunk-vb73ddwz.js.map} +1 -1
- package/dist/{chunk-xyyq577r.js → chunk-w0rfypzx.js} +2 -2
- package/dist/{chunk-xyyq577r.js.map → chunk-w0rfypzx.js.map} +1 -1
- package/dist/{chunk-tr8se94g.js → chunk-weyv3zrt.js} +3 -3
- package/dist/{chunk-tr8se94g.js.map → chunk-weyv3zrt.js.map} +1 -1
- package/dist/{chunk-9kyfaeey.js → chunk-wtddr3vs.js} +2 -2
- package/dist/{chunk-9kyfaeey.js.map → chunk-wtddr3vs.js.map} +1 -1
- package/dist/{chunk-tzheb6ak.js → chunk-xp7x27n8.js} +3 -3
- package/dist/{chunk-tzheb6ak.js.map → chunk-xp7x27n8.js.map} +1 -1
- package/dist/{chunk-ycn7w2e9.js → chunk-yzw2tvqq.js} +2 -2
- package/dist/{chunk-ycn7w2e9.js.map → chunk-yzw2tvqq.js.map} +1 -1
- package/dist/{chunk-wbv6218d.js → chunk-zz2n9pa5.js} +3 -3
- package/dist/{chunk-wbv6218d.js.map → chunk-zz2n9pa5.js.map} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.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/McpRouter.d.ts +203 -6
- package/dist/http/McpRouter.d.ts.map +1 -1
- package/dist/http/index.d.ts +1 -1
- 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/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/probe/index.d.ts +79 -0
- package/dist/probe/index.d.ts.map +1 -0
- package/dist/probe/index.js +8 -0
- package/dist/probe/index.js.map +10 -0
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/image-optimization/ImageManager.d.ts +3 -0
- package/dist/services/image-optimization/ImageManager.d.ts.map +1 -1
- package/dist/services/image-optimization/config.d.ts +12 -0
- package/dist/services/image-optimization/config.d.ts.map +1 -1
- package/dist/services/image-optimization/fetchSourceImage.d.ts +37 -0
- package/dist/services/image-optimization/fetchSourceImage.d.ts.map +1 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +9 -9
- package/dist/services/index.js.map +3 -3
- package/dist/services/mcp/McpRegistry.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/rate-limiter/drivers/RedisRateLimiterDriver.d.ts +95 -13
- package/dist/services/rate-limiter/drivers/RedisRateLimiterDriver.d.ts.map +1 -1
- package/dist/services/router/ApiRouteDispatcher.d.ts +12 -0
- package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/createFlatApiRoutes.d.ts +10 -0
- package/dist/services/router/createFlatApiRoutes.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-3ndc8adc.js +0 -4
- package/dist/chunk-3t4nw1n2.js +0 -5
- package/dist/chunk-42646nt7.js +0 -4
- package/dist/chunk-69c2s43a.js +0 -4
- package/dist/chunk-6np1r9gk.js +0 -5
- package/dist/chunk-7426gfgw.js +0 -4
- package/dist/chunk-7zy6nq9e.js +0 -5
- package/dist/chunk-cmt3jw6j.js +0 -4
- package/dist/chunk-jrv31jp9.js +0 -4
- package/dist/chunk-kwc68y45.js +0 -5
- package/dist/chunk-pw5h5935.js +0 -4
- package/dist/chunk-set6qmjw.js +0 -10
- package/dist/chunk-t66ex43f.js +0 -117
- package/dist/chunk-vp6t1gmt.js +0 -6
- package/dist/chunk-xp5axyb5.js +0 -30
- package/dist/chunk-xp5axyb5.js.map +0 -28
- package/dist/chunk-z7224rhm.js +0 -4
- package/dist/chunk-zfbqgzwa.js +0 -4
- /package/dist/{chunk-9md6acv2.js.map → chunk-57qnqcrp.js.map} +0 -0
- /package/dist/{chunk-5zxxd7qp.js.map → chunk-5qzxyj68.js.map} +0 -0
- /package/dist/{chunk-38kjpa6q.js.map → chunk-98byy5m4.js.map} +0 -0
- /package/dist/{chunk-0vc2akg0.js.map → chunk-bqxt1she.js.map} +0 -0
- /package/dist/{chunk-9gt9qdge.js.map → chunk-m8a80sgn.js.map} +0 -0
- /package/dist/{chunk-qbvm5q1g.js.map → chunk-rq3wrwfa.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpRegistry.d.ts","sourceRoot":"","sources":["../../../services/mcp/McpRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAuB,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"McpRegistry.d.ts","sourceRoot":"","sources":["../../../services/mcp/McpRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAuB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMnG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAK,KAAK,SAAS,EAAmB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAA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AC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IAiBnD,6EAA6E;IAC7E,OAAO,CAAC,SAAS;IASjB;;;;;;OAMG;YACW,aAAa;YAwHb,QAAQ;YAuCR,QAAQ;IA6CtB;;;;;;OAMG;YACW,UAAU;IAgExB,+EAA+E;IAC/E,OAAO,CAAC,MAAM;IAOd;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAuCrB;;;;;;;;;;;;;;OAcG;YACW,OAAO;IAgDrB;;;;;;;;;;OAUG;YACW,IAAI;CAcnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$d as _,Yd as H}from"../../chunk-191gkynh.js";import{Uj as O}from"../../chunk-szdbsmq7.js";import"../../chunk-tsbxdz4h.js";import"../../chunk-5c6dfy75.js";import"../../chunk-j144nwvh.js";import"../../chunk-m73mjzeh.js";import"../../chunk-xp7x27n8.js";import"../../chunk-g71ppv6x.js";import{ll as U,ml as V,ql as Z}from"../../chunk-4670xxae.js";import{ul as Y}from"../../chunk-qbsk0jr8.js";import"../../chunk-egwz89ze.js";import X from"path";function T(z){if(!z.config.get("route.channels"))return null;let C=z.config.get("broadcast",{}).driver;if(!(C===void 0||C==="memory"||C instanceof O))return null;return'[gemi] Broadcasts from this worker reach no one: the broadcast driver is "memory", which delivers to the sockets of the process that emits, and a worker has none. Set `driver: "redis"` in app/config/broadcast.ts.'}class J extends Error{name="QueueWorkerRefused"}class N{kernel;stopping;keepAlive;settings;constructor(z,C={}){this.kernel=z;this.settings={...V(),...C}}async start(){if(await this.kernel.waitForBoot(),this.stopping)return;let z=this.kernel.app;if(!z.bound(H))throw new J("[gemi] `gemi queue:work` has no queue to claim from: this application does not register QueueServiceProvider.");let C=z.make(H);if(!C.durable)throw new J('[gemi] `gemi queue:work` refuses to start: the queue uses the memory driver, which keeps each job in the process that dispatched it, so a worker never sees one. Set `driver: "database"` (or another driver every process can reach) in app/config/queue.ts, or run jobs in the server and drop the worker.');C.start(),this.keepAlive=setInterval(()=>{},1073741824),console.log(`[gemi] Queue worker started: claiming up to ${C.config.concurrency} job(s) at a time.`);let E=T(z);if(E)console.warn(E)}stop(z={}){return this.stopping??=this.drain({...this.settings,...z}),this.stopping}async drain(z){U();let C=this.kernel.app,E=C.resolved(H)?C.make(H):void 0;if(E)console.log(`[gemi] Shutting down: waiting for ${E.running} running job(s) (up to ${z.timeoutMs/1000}s).`),await E.drain(z.timeoutMs);let F=await this.kernel.shutdown({timeoutMs:z.providerTimeoutMs});clearInterval(this.keepAlive);let G=(E?.running??0)===0&&F.failed.length===0&&F.timedOut.length===0;return console.log(`[gemi] Shutdown ${G?"complete":"finished with errors"}.`),G?0:1}}async function $(){let z=Y();process.env.ROOT_DIR=z,process.env.APP_DIR=X.join(z,"app"),_();let C=X.join(z,"app/kernel/Kernel.ts"),{default:E}=await import(C);if(typeof E!=="function")return console.error(`[gemi] ${C} has no default export to boot the worker from.`),1;let F=new E;F.boot();let G=new N(F);Z(()=>G.stop());try{await G.start()}catch(L){if(!(L instanceof J))throw L;return console.error(L.message),1}return}$().then((z)=>{if(z!==void 0)process.exit(z)},(z)=>{console.error("[gemi] The queue worker failed to start:",z),process.exit(1)});
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=0E43FDD0E82585C664756E2164756E21
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import type { Application, ShutdownReport } from \"../../foundation/Application\";\nimport { markShuttingDown, shutdownSettings, type ShutdownSettings } from \"../../server/shutdown\";\nimport { memoryBroadcastInWorker } from \"../broadcast/workerWarning\";\nimport { QueueManager } from \"./QueueManager\";\n\n/** The part of a `Kernel` a worker drives. */\nexport type WorkerKernel = {\n readonly app: Application;\n waitForBoot(): Promise<void>;\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport>;\n};\n\n/**\n * A worker that was told to start in an application it cannot claim for. The\n * message is written for the operator reading the deploy's logs.\n */\nexport class QueueWorkerRefused extends Error {\n name = \"QueueWorkerRefused\";\n}\n\n/**\n * The process `gemi queue:work` runs: the application booted as a server boots\n * it, claiming from the queue, and no `Bun.serve`. It exists so job capacity\n * can be scaled apart from request traffic, which needs a driver both kinds of\n * process can reach; see `start` for why the memory driver is refused.\n *\n * The caller marks the process as a worker (`markQueueWorker`) before the\n * kernel registers, so every claim rule that asks `claimsInThisProcess` sees a\n * process that claims, whatever `GEMI_QUEUE_CLAIM` says.\n */\nexport class QueueWorker {\n private stopping: Promise<number> | undefined;\n private keepAlive: ReturnType<typeof setInterval> | undefined;\n private readonly settings: ShutdownSettings;\n\n /**\n * `settings` default to the `GEMI_SHUTDOWN_*` variables, read here rather\n * than at the signal so a bad value is warned about while the deploy is\n * being watched, as `Server.start` does.\n */\n constructor(\n private readonly kernel: WorkerKernel,\n settings: Partial<ShutdownSettings> = {},\n ) {\n this.settings = { ...shutdownSettings(), ...settings };\n }\n\n /**\n * Boots the application and starts claiming. Rejects with\n * `QueueWorkerRefused` when the application has no queue, or its queue uses\n * the memory driver.\n *\n * Refused rather than warned about, because a memory worker can never do\n * anything: its jobs live in a `Map` in the process that dispatched them,\n * so a worker's is always empty. Left running, it looks like a healthy\n * deploy — a process up, no errors — that runs nothing, and scaling it out\n * adds no capacity. An exit the platform reports as a crash loop is a form\n * of the mistake someone will see.\n */\n async start(): Promise<void> {\n await this.kernel.waitForBoot();\n // A signal during the boot has already drained and cleared the handle\n // below. Going on would start the loop again and arm a handle nothing\n // clears, holding open a worker that has finished shutting down.\n if (this.stopping) return;\n\n const application = this.kernel.app;\n // `bound`, not `make` in a try: an application built without the queue\n // provider is a configuration to name, not an unbound-token stack trace.\n if (!application.bound(QueueManager)) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` has no queue to claim from: this application \" +\n \"does not register QueueServiceProvider.\",\n );\n }\n const queue = application.make(QueueManager);\n if (!queue.durable) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` refuses to start: the queue uses the memory \" +\n \"driver, which keeps each job in the process that dispatched it, so \" +\n 'a worker never sees one. Set `driver: \"database\"` (or another driver ' +\n \"every process can reach) in app/config/queue.ts, or run jobs in the \" +\n \"server and drop the worker.\",\n );\n }\n\n // Idempotent: a production boot with a durable driver has already started\n // it (`startClaimingIfServing`). Development has not, and a worker claims\n // in either.\n queue.start();\n // The queue's poll timer is unref'd, so that a script's queue does not\n // hold it open; here the queue is the process, and without a handle of its\n // own an idle worker would exit 0 as soon as it booted.\n this.keepAlive = setInterval(() => {}, 1 << 30);\n console.log(\n `[gemi] Queue worker started: claiming up to ${queue.config.concurrency} job(s) at a time.`,\n );\n const broadcastWarning = memoryBroadcastInWorker(application);\n if (broadcastWarning) console.warn(broadcastWarning);\n }\n\n /**\n * Stops claiming, waits for the running jobs, runs every provider's\n * `shutdown()`, and resolves with the exit code: 0 when no job was left\n * running and every provider finished in time, 1 otherwise. Idempotent.\n *\n * `gemi start`'s drain, with the jobs where the requests were:\n * `isShuttingDown()` turns true, which stops a durable queue claiming;\n * running jobs get `timeoutMs` (`GEMI_SHUTDOWN_TIMEOUT`), which a server\n * spends on requests; then `Application.shutdown` gets `providerTimeoutMs`,\n * and in it the queue provider waits for whatever is still running and\n * names it. The two budgets add up as they do for a server, so a worker\n * fits the same grace period. `delayMs` is not waited: it is for a load\n * balancer, and nothing routes to a worker.\n */\n stop(settings: Partial<ShutdownSettings> = {}): Promise<number> {\n this.stopping ??= this.drain({ ...this.settings, ...settings });\n return this.stopping;\n }\n\n private async drain(settings: ShutdownSettings): Promise<number> {\n markShuttingDown();\n const application = this.kernel.app;\n // Resolving the manager now would build a driver only to stop it, which\n // is what a signal during the boot, before the provider resolved it, finds.\n const queue = application.resolved(QueueManager) ? application.make(QueueManager) : undefined;\n if (queue) {\n console.log(\n `[gemi] Shutting down: waiting for ${queue.running} running job(s) ` +\n `(up to ${settings.timeoutMs / 1000}s).`,\n );\n await queue.drain(settings.timeoutMs);\n }\n\n const report = await this.kernel.shutdown({ timeoutMs: settings.providerTimeoutMs });\n clearInterval(this.keepAlive);\n const clean =\n (queue?.running ?? 0) === 0 && 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}\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";gcAYA,kBCDO,OAAS,DAAuB,DAAC,AAAyC,DAC/E,CAAI,DAAC,AAAY,KAAO,IAAI,gBAAgB,EAAG,OAAO,KACtD,IAAM,EAAS,EAAY,OAAO,IAAqB,YAAa,CAAC,CAAC,EAAE,OAGxE,GAAI,EADF,IAAW,QAAa,IAAW,UAAY,aAAkB,GACtD,OAAO,KACpB,MACE,uNCFG,MAAM,UAA2B,KAAM,CAC5C,KAAO,oBACT,CAYO,MAAM,CAAY,CAWJ,OAVX,SACA,UACS,SAOjB,WAAW,CACQ,EACjB,EAAsC,CAAC,EACvC,CAFiB,cAGjB,KAAK,SAAW,IAAK,EAAiB,KAAM,CAAS,OAejD,MAAK,EAAkB,CAK3B,GAJA,MAAM,KAAK,OAAO,YAAY,EAI1B,KAAK,SAAU,OAEnB,IAAM,EAAc,KAAK,OAAO,IAGhC,GAAI,CAAC,EAAY,MAAM,CAAY,EACjC,MAAM,IAAI,EACR,+GAEF,EAEF,IAAM,EAAQ,EAAY,KAAK,CAAY,EAC3C,GAAI,CAAC,EAAM,QACT,MAAM,IAAI,EACR,8SAKF,EAMF,EAAM,MAAM,EAIZ,KAAK,UAAY,YAAY,IAAM,GAAI,UAAO,EAC9C,QAAQ,IACN,+CAA+C,EAAM,OAAO,+BAC9D,EACA,IAAM,EAAmB,EAAwB,CAAW,EAC5D,GAAI,EAAkB,QAAQ,KAAK,CAAgB,EAiBrD,IAAI,CAAC,EAAsC,CAAC,EAAoB,CAE9D,OADA,KAAK,WAAa,KAAK,MAAM,IAAK,KAAK,YAAa,CAAS,CAAC,EACvD,KAAK,cAGA,MAAK,CAAC,EAA6C,CAC/D,EAAiB,EACj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
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -7,7 +7,21 @@ import { RateLimiterDriver } from "./RateLimiterDriver";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface RateLimiterRedisClient {
|
|
9
9
|
send(command: string, args: string[]): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Bun's client says whether its connection is up. Optional: a client that
|
|
12
|
+
* does not say is always sent to.
|
|
13
|
+
*/
|
|
14
|
+
readonly connected?: boolean;
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* How a call is answered when Redis cannot answer it:
|
|
18
|
+
* - `"memory"`: counted by an in-process limiter (`fallback`), so each
|
|
19
|
+
* instance enforces the limit on its own until Redis is back. The outage
|
|
20
|
+
* costs precision (one budget per instance), never the limit.
|
|
21
|
+
* - `"open"`: admitted, uncounted.
|
|
22
|
+
* - `"closed"`: refused.
|
|
23
|
+
*/
|
|
24
|
+
export type RedisRateLimiterFailureMode = "memory" | "open" | "closed";
|
|
11
25
|
export interface RedisRateLimiterOptions {
|
|
12
26
|
/**
|
|
13
27
|
* Client to run against. Defaults to the app's shared client from
|
|
@@ -18,21 +32,37 @@ export interface RedisRateLimiterOptions {
|
|
|
18
32
|
/** Key namespace. Defaults to `gemi:rl`. */
|
|
19
33
|
prefix?: string;
|
|
20
34
|
/**
|
|
21
|
-
* What
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
35
|
+
* What a call gets when Redis fails, times out or is known to be down.
|
|
36
|
+
* Default `"memory"`: the call is counted by `fallback`, so a Redis outage
|
|
37
|
+
* degrades every limit to a per-instance one instead of turning it off
|
|
38
|
+
* (`"open"`) or locking everyone out (`"closed"`). See
|
|
39
|
+
* {@link RedisRateLimiterFailureMode}.
|
|
40
|
+
*/
|
|
41
|
+
onRedisError?: RedisRateLimiterFailureMode;
|
|
42
|
+
/**
|
|
43
|
+
* The limiter that counts while Redis is down, with `onRedisError:
|
|
44
|
+
* "memory"`. Default: a new `InMemoryRateLimiter` for this driver.
|
|
45
|
+
*/
|
|
46
|
+
fallback?: RateLimiterDriver;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use `onRedisError`. `true` is `"open"`, `false` is
|
|
49
|
+
* `"closed"`. Ignored when `onRedisError` is set.
|
|
25
50
|
*/
|
|
26
51
|
failOpen?: boolean;
|
|
27
52
|
/**
|
|
28
53
|
* How long one `consume` may wait for Redis, in ms, before it gives up and
|
|
29
|
-
*
|
|
30
|
-
* the client does: up to the connect timeout and the
|
|
31
|
-
* 30 s) while Redis is down, and with no limit when
|
|
32
|
-
* an open connection. `0` turns it off.
|
|
54
|
+
* is answered as `onRedisError` says. Default `250`. Without it, a request
|
|
55
|
+
* waits as long as the client does: up to the connect timeout and the
|
|
56
|
+
* reconnect loop (10 to 30 s) while Redis is down, and with no limit when
|
|
57
|
+
* Redis stops answering on an open connection. `0` turns it off.
|
|
33
58
|
*/
|
|
34
59
|
timeout?: number;
|
|
35
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Called with every Redis failure: a command that failed or timed out, and
|
|
62
|
+
* each failed check (at most one a second) of whether Redis is back. By
|
|
63
|
+
* default a line goes to `console.error`, at most once a minute, saying how
|
|
64
|
+
* many calls were answered without Redis since the last one.
|
|
65
|
+
*/
|
|
36
66
|
onError?: (error: unknown) => void;
|
|
37
67
|
}
|
|
38
68
|
/** What `onError` gets when a `consume` ran past `timeout`. */
|
|
@@ -40,6 +70,14 @@ export declare class RedisRateLimiterTimeoutError extends Error {
|
|
|
40
70
|
readonly code = "ERR_RATE_LIMITER_TIMEOUT";
|
|
41
71
|
constructor(timeout: number);
|
|
42
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* What `onError` gets when the client says its connection is down, so the
|
|
75
|
+
* call was answered without sending anything to Redis.
|
|
76
|
+
*/
|
|
77
|
+
export declare class RedisRateLimiterDisconnectedError extends Error {
|
|
78
|
+
readonly code = "ERR_RATE_LIMITER_DISCONNECTED";
|
|
79
|
+
constructor();
|
|
80
|
+
}
|
|
43
81
|
/**
|
|
44
82
|
* Rate limiter backed by Redis, so every instance of the app counts against the
|
|
45
83
|
* same budget. Use it as soon as you run more than one process.
|
|
@@ -56,21 +94,65 @@ export declare class RedisRateLimiterTimeoutError extends Error {
|
|
|
56
94
|
* Window boundaries come from the app server's clock, not Redis's, so keep
|
|
57
95
|
* instances on NTP. A few seconds of skew only shifts where a window starts; it
|
|
58
96
|
* cannot double a budget the way an unsynchronised fixed window would.
|
|
97
|
+
*
|
|
98
|
+
* ## When Redis fails
|
|
99
|
+
*
|
|
100
|
+
* A call that fails or times out is answered as `onRedisError` says (by
|
|
101
|
+
* default, counted in memory), and the limiter then stops sending its script
|
|
102
|
+
* until Redis answers again. While it is down, each call is answered at once
|
|
103
|
+
* without touching Redis, and at most once a second one of them sends a `PING`
|
|
104
|
+
* in the background (none while the client says it is disconnected); the first `PING` that answers puts the limiter back on
|
|
105
|
+
* Redis.
|
|
106
|
+
*
|
|
107
|
+
* Not sending is what keeps an outage from being counted twice. Bun's client
|
|
108
|
+
* queues the commands it is given while disconnected and runs them once it
|
|
109
|
+
* reconnects, and a connection that stopped answering (a paused or partitioned
|
|
110
|
+
* Redis) delivers what was written to it once it answers again. Either way the
|
|
111
|
+
* increments of calls that were already answered from memory would land in
|
|
112
|
+
* Redis on recovery, and every caller of the outage would start the next
|
|
113
|
+
* window over budget. A `PING` is harmless to run late. What can still land
|
|
114
|
+
* late is the few calls sent before the first failure was seen: at most
|
|
115
|
+
* `timeout` worth of traffic.
|
|
59
116
|
*/
|
|
60
117
|
export declare class RedisRateLimiter extends RateLimiterDriver {
|
|
61
118
|
private injectedClient?;
|
|
62
119
|
private prefix;
|
|
63
|
-
private
|
|
120
|
+
private mode;
|
|
121
|
+
private fallback;
|
|
64
122
|
private timeout;
|
|
65
|
-
private onError
|
|
123
|
+
private onError?;
|
|
66
124
|
/** Cached `SCRIPT LOAD` result, so the script body is sent at most once. */
|
|
67
125
|
private scriptSha;
|
|
126
|
+
/** Set by a failure; cleared by the first `PING` that answers. */
|
|
127
|
+
private down;
|
|
128
|
+
private probing;
|
|
129
|
+
private lastProbeAt;
|
|
130
|
+
/**
|
|
131
|
+
* Clients seen connected. A client that says it is not connected is skipped
|
|
132
|
+
* only once it has been seen connected: a new one is still making its first
|
|
133
|
+
* connection, and its first commands wait for it (bounded by `timeout`).
|
|
134
|
+
*/
|
|
135
|
+
private seenConnected;
|
|
136
|
+
/** For the default `onError`: when it last wrote, and what it left out since. */
|
|
137
|
+
private loggedAt;
|
|
138
|
+
private failuresSinceLog;
|
|
139
|
+
private fallbacksSinceLog;
|
|
68
140
|
constructor(options?: RedisRateLimiterOptions);
|
|
69
141
|
consume(params: ConsumeParams): Promise<RateLimitResult>;
|
|
142
|
+
/** Answers a call Redis could not, as `onRedisError` says. */
|
|
143
|
+
private degrade;
|
|
144
|
+
/**
|
|
145
|
+
* While down: sends a `PING`, at most one at a time and one a second, and
|
|
146
|
+
* puts the limiter back on Redis once one answers. Never awaited by the call
|
|
147
|
+
* that starts it, so that call is not slowed down.
|
|
148
|
+
*/
|
|
149
|
+
private probe;
|
|
150
|
+
private report;
|
|
151
|
+
private logRecovery;
|
|
70
152
|
/**
|
|
71
153
|
* Settles with `work`, or rejects with `RedisRateLimiterTimeoutError` once
|
|
72
|
-
* `
|
|
73
|
-
*
|
|
154
|
+
* `ms` passes. The command itself is not cancelled (Redis may still run the
|
|
155
|
+
* script, so a request that timed out can still be counted); its late
|
|
74
156
|
* outcome is ignored.
|
|
75
157
|
*/
|
|
76
158
|
private withTimeout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisRateLimiterDriver.d.ts","sourceRoot":"","sources":["../../../../services/rate-limiter/drivers/RedisRateLimiterDriver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"RedisRateLimiterDriver.d.ts","sourceRoot":"","sources":["../../../../services/rate-limi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;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAA8B;IAC1C,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAC,CAA2B;IAE3C,4EAA4E;IAC5E,OAAO,CAAC,SAAS,CAAgC;IAEjD,kEAAkE;IAClE,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAK;IACxB;;;;OAIG;IACH,OAAO,CAAC,aAAa,CAAyB;IAE9C,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,iBAAiB,CAAK;gBAElB,OAAO,GAAE,uBAA4B;IAgB3C,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IA6D9D,8DAA8D;YAChD,OAAO;IAiCrB;;;;OAIG;IACH,OAAO,CAAC,KAAK;IAyCb,OAAO,CAAC,MAAM;IA6Bd,OAAO,CAAC,WAAW;IAUnB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAmBnB,OAAO,KAAK,MAAM,GAuBjB;IAED,4EAA4E;YAC9D,GAAG;IAkBjB,OAAO,CAAC,IAAI;CAcb"}
|
|
@@ -70,6 +70,18 @@ export declare function breakResponse(payload: {
|
|
|
70
70
|
* response a request ends with (`globalMiddleware.ts`).
|
|
71
71
|
*/
|
|
72
72
|
export declare function mergeContextIntoResponse(response: Response, headers: Headers, cookies: Set<string>): Response;
|
|
73
|
+
/**
|
|
74
|
+
* Whether this process is the development server, which is what may mount the
|
|
75
|
+
* framework's debug endpoints (`/__gemi__/debug/*`, `/__gemi__/services/logs/*`).
|
|
76
|
+
*
|
|
77
|
+
* An allowlist on `NODE_ENV === "development"`, which `gemi dev` sets, rather
|
|
78
|
+
* than `NODE_ENV !== "production"`: a deployment that starts the server some
|
|
79
|
+
* other way than `gemi start` and leaves `NODE_ENV` unset, or sets it to
|
|
80
|
+
* `staging` or `test`, then keeps them unmounted. Getting the signal wrong in
|
|
81
|
+
* that direction costs a developer a debug page; in the other it published
|
|
82
|
+
* every route, its middleware and the server's log file (#1030).
|
|
83
|
+
*/
|
|
84
|
+
export declare function isDevelopmentServer(): boolean;
|
|
73
85
|
export declare class ApiRouteDispatcher {
|
|
74
86
|
static token: string;
|
|
75
87
|
flatRoutes: FlatApiRoutes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRouteDispatcher.d.ts","sourceRoot":"","sources":["../../../services/router/ApiRouteDispatcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAa,WAAW,EAAE,MAAM,YAAY,CAAC;AAIpD,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,2BAA2B,CAAC;AAIhF,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAsChF,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,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AAM;IAE/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgD;IAC/E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;IAC3E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;gBAEjE,MAAM,EAAE,cAAc;IAuB3B,wBAAwB,CAAC,GAAG,EAAE,OAAO;;;;IAuBtC,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;IA+BzD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkC9C;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;;;;;;;;;;;OAkBG;YACW,UAAU;IAgCxB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,CAAC,eAAe;IAMjB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IA4GpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACG,UAAU,CACd,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAChC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,QAAQ,CAAC;CAwFrB"}
|
|
@@ -7,6 +7,16 @@ export type FlatApiRoutes = Record<string, Record<string, {
|
|
|
7
7
|
middleware: (string | (new () => Middleware) | RouterMiddleware)[];
|
|
8
8
|
source?: RouteSource;
|
|
9
9
|
}>>;
|
|
10
|
+
/**
|
|
11
|
+
* Strips `(group)` segments from an api path, as view routes do: a router
|
|
12
|
+
* mounted at `"/(builds)"` (or `"(builds)/"`) adds no segment of its own, so
|
|
13
|
+
* `/pages/(builds)/:pageId` is served at `/pages/:pageId`, the path `CreateRPC`
|
|
14
|
+
* types it at (`RemoveGroupPrefix`). A group is a name of word characters and
|
|
15
|
+
* `-` in parentheses. Parentheses right after a `:param` are its URLPattern
|
|
16
|
+
* regex (`/:id(\\d+)`), as are parentheses holding anything but a name
|
|
17
|
+
* (`/(\\d+)`); both are left for URLPattern to match.
|
|
18
|
+
*/
|
|
19
|
+
export declare function removeApiGroupSegments(path: string): string;
|
|
10
20
|
export declare function createFlatApiRoutes(routes: ApiRoutes, rootPath?: string, rootMiddleware?: RouterMiddleware[] | string[]): {
|
|
11
21
|
[k: string]: Record<string, {
|
|
12
22
|
exec: ApiRouteExec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFlatApiRoutes.d.ts","sourceRoot":"","sources":["../../../services/router/createFlatApiRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,KAAK,SAAS,EAMd,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,KAAK,YAAY,GAAG,GAAG,CAAC;AACxB,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,MAAM,CACJ,MAAM,EACN;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,GAAG,CAAC,UAAU,UAAU,CAAC,GAAG,gBAAgB,CAAC,EAAE,CAAC;IAGnE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CACF,CACF,CAAC;AA4CF,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,QAAQ,SAAK,EACb,cAAc,GAAE,gBAAgB,EAAE,GAAG,MAAM,EAAO;;
|
|
1
|
+
{"version":3,"file":"createFlatApiRoutes.d.ts","sourceRoot":"","sources":["../../../services/router/createFlatApiRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,KAAK,SAAS,EAMd,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,KAAK,YAAY,GAAG,GAAG,CAAC;AACxB,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,MAAM,CACJ,MAAM,EACN;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,GAAG,CAAC,UAAU,UAAU,CAAC,GAAG,gBAAgB,CAAC,EAAE,CAAC;IAGnE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CACF,CACF,CAAC;AA4CF;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,UAOlD;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,QAAQ,SAAK,EACb,cAAc,GAAE,gBAAgB,EAAE,GAAG,MAAM,EAAO;;cAxExC,YAAY;oBACN,CAAC,MAAM,GAAG,CAAC,UAAU,UAAU,CAAC,GAAG,gBAAgB,CAAC,EAAE;iBAGzD,WAAW;;EA2LzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-egwz89ze.js";import M from"path";import{writeFileSync as Q}from"fs";var L=new Set(["FILE","REDIRECT"]);function H(j){return j.run(()=>{let x=[];for(let{group:z,view:D}of j.domains().viewGroups())for(let[G,B]of Object.entries(D.flatViewRoutes)){let C=D.routeManifest[G]??B.segments.map((K)=>K.viewPath);if(C.length===0||L.has(C.at(-1)))continue;x.push({path:G,group:z,views:C,...B.static?{static:{...B.static.layout?{layout:B.static.layout}:{},...B.static.navigation?{navigation:!0}:{}}}:{}})}return x})}var J=process.argv[2];async function U(){if(!J)throw Error("usage: route-table <out.json>");let j=M.resolve(process.cwd(),"app/kernel/Kernel.ts"),x=await import(j);if(typeof x.default!=="function")throw Error(`${j} has no default export (the Kernel subclass).`);let z=new x.default;z.boot();try{Q(J,JSON.stringify(H(z)))}finally{z.destroy()}}U().then(()=>process.exit(0),(j)=>{console.error(j?.stack??String(j)),process.exit(1)});
|
|
3
3
|
|
|
4
4
|
//# debugId=05EB0087C5A2060D64756E2164756E21
|
package/dist/support/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ee as Y}from"../chunk-yzw2tvqq.js";import{Zj as M}from"../chunk-5c6dfy75.js";import{$k as P,bl as R}from"../chunk-xp7x27n8.js";import"../chunk-g71ppv6x.js";import{rl as Q,sl as U,tl as V,ul as W}from"../chunk-qbsk0jr8.js";import"../chunk-egwz89ze.js";class S{static token;async boot(){}static inject(){if(!this.token)throw Error(`Service [${this.name}] does not declare a \`static token\`, so the container has no key to resolve it by.`);try{return R(this)}catch(x){throw Error(`Could not inject [${this.name}]. Services are constructed when the kernel boots, so `+"inject() only works from code that runs after that \u2014 a constructor default or a method "+`body, never module top level. Check that [${this.name}] is listed in \`services\` on your Kernel.`,{cause:x})}}static with(x){let f=new this;for(let[C,g]of Object.entries(x))if(g!==void 0)f[C]=g;return f}}import{readdir as z}from"fs/promises";import{join as B,parse as j}from"path";var H=[".ts",".tsx",".js",".mjs",".jsx"];function J(x={}){let f={};for(let[C,g]of Object.entries(x))f[C]=q(g);return new P(f)}async function L(x,f=new P){let C=[];try{C=await z(x)}catch(D){return f}let g=C.filter((D)=>{let{ext:v,name:F}=j(D);return H.includes(v)&&!F.startsWith(".")}).sort();for(let D of g){let{name:v}=j(D),F=await import(B(x,D));f.set(v,q(F))}return f}function q(x){if(x&&typeof x==="object"&&"default"in x)return x.default;return x}export{M as withDefaults,Q as sourceFiles,W as projectRoot,L as loadConfigFrom,V as discoverClasses,J as createConfigRepository,Y as ServiceProvider,S as Service,P as Repository,U as DiscoveryError};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=A054E61D85B8190564756E2164756E21
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { readdir } from \"node:fs/promises\";\nimport { join, parse } from \"node:path\";\n\nimport { Repository } from \"./Repository\";\n\nconst CONFIG_EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".mjs\", \".jsx\"];\n\n// Builds a Repository from an already-imported map of config modules. The map\n// key becomes the top-level config key, so `{ mail: mailModule }` is readable\n// as `config.get(\"mail.driver\")`. Each entry may be either the module namespace\n// (its `default` export is unwrapped) or the config object itself.\nexport function createConfigRepository(\n modules: Record<string, any> = {},\n): Repository {\n const items: Record<string, any> = {};\n\n for (const [key, mod] of Object.entries(modules)) {\n items[key] = unwrap(mod);\n }\n\n return new Repository(items);\n}\n\n// Reads every config module in an app's `app/config` directory into a\n// Repository. The file's basename is the top-level key: `app/config/mail.ts`\n// populates `mail.*`. A missing directory yields an empty Repository so apps\n// that declare no config still boot.\nexport async function loadConfigFrom(\n directory: string,\n repository = new Repository(),\n): Promise<Repository> {\n let entries: string[] = [];\n\n try {\n entries = await readdir(directory);\n } catch (err) {\n return repository;\n }\n\n const files = entries\n .filter((entry) => {\n const { ext, name } = parse(entry);\n return CONFIG_EXTENSIONS.includes(ext) && !name.startsWith(\".\");\n })\n .sort();\n\n for (const file of files) {\n const { name } = parse(file);\n const mod = await import(join(directory, file));\n repository.set(name, unwrap(mod));\n }\n\n return repository;\n}\n\nfunction unwrap(mod: any) {\n if (mod && typeof mod === \"object\" && \"default\" in mod) {\n return mod.default;\n }\n return mod;\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";2RAgCO,CAAe,JAAQ,EAOrB,OAMD,AAAI,EAAkB,QAmBrB,OAAS,EAKX,CACH,GAAI,CAAC,KAAK,MACR,MAAU,MACR,YAAY,KAAK,0FACnB,EAGF,GAAI,CACF,OAAO,EAAI,IAAuB,EAClC,MAAO,EAAO,CACd,MAAU,MACR,qBAAqB,KAAK,6DACxB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|
+
import{fa as B,ga as D}from"../chunk-weyv3zrt.js";import"../chunk-qsbtqh47.js";import"../chunk-s0xwqcrf.js";import{Aa as J}from"../chunk-9983zmhx.js";import"../chunk-9f2ps5v2.js";import"../chunk-egwz89ze.js";function N(){return{name:"gemi-custom-request",enforce:"pre",async transform(G,H){let j=H.split("?",1)[0];if(j.includes("/node_modules/")||!B.test(j))return null;return{code:await D(G),map:null}}}}export{N as gemiRequestPlugin,J as gemiIslandPlugin};
|
|
3
3
|
|
|
4
4
|
//# debugId=C11E8611E15123D864756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gemi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.160.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Enes Tufekci <enes@gemijs.dev>",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"./database": "./dist/database/index.js",
|
|
42
42
|
"./orm": "./dist/orm/index.js",
|
|
43
43
|
"./support": "./dist/support/index.js",
|
|
44
|
+
"./probe": "./dist/probe/index.js",
|
|
44
45
|
"./console/run": "./dist/console/run.js",
|
|
45
46
|
"./queue/work": "./dist/services/queue/work.js",
|
|
46
47
|
"./stats/route-table": "./dist/stats/route-table.js",
|
package/dist/chunk-3ndc8adc.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{h as _t}from"./chunk-k1aw97dm.js";import{A as oo,B as Lt,C as yo,i as er,k as M,l as vo,m as Eo,n as So,p as Gr,q as zr,r as kt,s as Io,t as cr,u as Po,v as xo,w as ar,x as eo,y as ro,z as to}from"./chunk-q3e1bqrs.js";import{D as hr,E as mt,G as Qt,K as Ue,O as f}from"./chunk-pgdxqrjv.js";import{P as Oo}from"./chunk-t7yt8egz.js";import"./chunk-wg0ttent.js";import{X as zt}from"./chunk-q7k2hc45.js";import{Y as gt}from"./chunk-7zy6nq9e.js";import{Z as Ht}from"./chunk-wnjvfmqc.js";import"./chunk-dce3w52r.js";import"./chunk-p83cjehh.js";import"./chunk-56a3vnrj.js";import{la as Zt}from"./chunk-v10xzpqs.js";import{wl as S}from"./chunk-78wht1ph.js";var A=S((oe)=>{Object.defineProperty(oe,"__esModule",{value:!0});oe.resolveHttpAuthSchemeConfig=oe.defaultSSOOIDCHttpAuthSchemeProvider=oe.defaultSSOOIDCHttpAuthSchemeParametersProvider=void 0;var Rr=M(),w=hr(),fr=async(e,r,i)=>{return{operation:(0,w.getSmithyContext)(r).operation,region:await(0,w.normalizeProvider)(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}};oe.defaultSSOOIDCHttpAuthSchemeParametersProvider=fr;function Fr(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(r,i)=>({signingProperties:{config:r,context:i}})}}function Ur(e){return{schemeId:"smithy.api#noAuth"}}var $r=(e)=>{let r=[];switch(e.operation){case"CreateToken":{r.push(Ur(e));break}default:r.push(Fr(e))}return r};oe.defaultSSOOIDCHttpAuthSchemeProvider=$r;var jr=(e)=>{let r=(0,Rr.resolveAwsSdkSigV4Config)(e);return Object.assign(r,{authSchemePreference:(0,w.normalizeProvider)(e.authSchemePreference??[])})};oe.resolveHttpAuthSchemeConfig=jr});var De=S((xe)=>{Object.defineProperty(xe,"__esModule",{value:!0});xe.ruleSet=void 0;var Ee="required",p="fn",d="argv",q="ref",se=!0,ne="isSet",N="booleanEquals",D="error",b="endpoint",I="tree",G="PartitionResult",z="getAttr",pe={[Ee]:!1,type:"string"},de={[Ee]:!0,default:!1,type:"boolean"},ce={[q]:"Endpoint"},Se={[p]:N,[d]:[{[q]:"UseFIPS"},!0]},Ie={[p]:N,[d]:[{[q]:"UseDualStack"},!0]},n={},ae={[p]:z,[d]:[{[q]:G},"supportsFIPS"]},Pe={[q]:G},le={[p]:N,[d]:[!0,{[p]:z,[d]:[Pe,"supportsDualStack"]}]},ue=[Se],Oe=[Ie],ve=[{[q]:"Region"}],Ar={version:"1.0",parameters:{Region:pe,UseDualStack:de,UseFIPS:de,Endpoint:pe},rules:[{conditions:[{[p]:ne,[d]:[ce]}],rules:[{conditions:ue,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:D},{conditions:Oe,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:D},{endpoint:{url:ce,properties:n,headers:n},type:b}],type:I},{conditions:[{[p]:ne,[d]:ve}],rules:[{conditions:[{[p]:"aws.partition",[d]:ve,assign:G}],rules:[{conditions:[Se,Ie],rules:[{conditions:[{[p]:N,[d]:[se,ae]},le],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:D}],type:I},{conditions:ue,rules:[{conditions:[{[p]:N,[d]:[ae,se]}],rules:[{conditions:[{[p]:"stringEquals",[d]:[{[p]:z,[d]:[Pe,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:n,headers:n},type:b},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"FIPS is enabled but this partition does not support FIPS",type:D}],type:I},{conditions:Oe,rules:[{conditions:[le],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"DualStack is enabled but this partition does not support DualStack",type:D}],type:I},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:b}],type:I}],type:I},{error:"Invalid Configuration: Missing Region",type:D}]};xe.ruleSet=Ar});var Ne=S((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.defaultEndpointResolver=void 0;var mr=zr(),m=Gr(),Hr=De(),Lr=new m.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Tr=(e,r={})=>{return Lr.get(e,()=>(0,m.resolveEndpoint)(Hr.ruleSet,{endpointParams:e,logger:r.logger}))};be.defaultEndpointResolver=Tr;m.customEndpointFunctions.aws=mr.awsEndpointFunctions});var F=S((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.SSOOIDCServiceException=L.__ServiceException=void 0;var he=f();Object.defineProperty(L,"__ServiceException",{enumerable:!0,get:function(){return he.ServiceException}});class H extends he.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,H.prototype)}}L.SSOOIDCServiceException=H});var k=S((fe)=>{Object.defineProperty(fe,"__esModule",{value:!0});fe.UnsupportedGrantTypeException=fe.UnauthorizedClientException=fe.SlowDownException=fe.InvalidScopeException=fe.InvalidRequestException=fe.InvalidGrantException=fe.InvalidClientException=fe.InternalServerException=fe.ExpiredTokenException=fe.AuthorizationPendingException=fe.AccessDeniedException=void 0;var l=F();class T extends l.SSOOIDCServiceException{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,T.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}fe.AccessDeniedException=T;class B extends l.SSOOIDCServiceException{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e});Object.setPrototypeOf(this,B.prototype),this.error=e.error,this.error_description=e.error_description}}fe.AuthorizationPendingException=B;class V extends l.SSOOIDCServiceException{name="ExpiredTokenException";$fault="client";error;error_description;constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype),this.error=e.error,this.error_description=e.error_description}}fe.ExpiredTokenException=V;class W extends l.SSOOIDCServiceException{name="InternalServerException";$fault="server";error;error_description;constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,W.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InternalServerException=W;class Y extends l.SSOOIDCServiceException{name="InvalidClientException";$fault="client";error;error_description;constructor(e){super({name:"InvalidClientException",$fault:"client",...e});Object.setPrototypeOf(this,Y.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidClientException=Y;class J extends l.SSOOIDCServiceException{name="InvalidGrantException";$fault="client";error;error_description;constructor(e){super({name:"InvalidGrantException",$fault:"client",...e});Object.setPrototypeOf(this,J.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidGrantException=J;class K extends l.SSOOIDCServiceException{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}fe.InvalidRequestException=K;class X extends l.SSOOIDCServiceException{name="InvalidScopeException";$fault="client";error;error_description;constructor(e){super({name:"InvalidScopeException",$fault:"client",...e});Object.setPrototypeOf(this,X.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidScopeException=X;class C extends l.SSOOIDCServiceException{name="SlowDownException";$fault="client";error;error_description;constructor(e){super({name:"SlowDownException",$fault:"client",...e});Object.setPrototypeOf(this,C.prototype),this.error=e.error,this.error_description=e.error_description}}fe.SlowDownException=C;class Q extends l.SSOOIDCServiceException{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e});Object.setPrototypeOf(this,Q.prototype),this.error=e.error,this.error_description=e.error_description}}fe.UnauthorizedClientException=Q;class Z extends l.SSOOIDCServiceException{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e});Object.setPrototypeOf(this,Z.prototype),this.error=e.error,this.error_description=e.error_description}}fe.UnsupportedGrantTypeException=Z});var g=S((ze)=>{Object.defineProperty(ze,"__esModule",{value:!0});ze.CreateToken$=ze.CreateTokenResponse$=ze.CreateTokenRequest$=ze.errorTypeRegistries=ze.UnsupportedGrantTypeException$=ze.UnauthorizedClientException$=ze.SlowDownException$=ze.InvalidScopeException$=ze.InvalidRequestException$=ze.InvalidGrantException$=ze.InvalidClientException$=ze.InternalServerException$=ze.ExpiredTokenException$=ze.AuthorizationPendingException$=ze.AccessDeniedException$=ze.SSOOIDCServiceException$=void 0;var kr="AccessDeniedException",gr="AuthorizationPendingException",_r="AccessToken",et="ClientSecret",rt="CreateToken",tt="CreateTokenRequest",ot="CreateTokenResponse",it="CodeVerifier",st="ExpiredTokenException",nt="InvalidClientException",pt="InvalidGrantException",dt="InvalidRequestException",ct="InternalServerException",at="InvalidScopeException",lt="IdToken",ut="RefreshToken",Ot="SlowDownException",vt="UnauthorizedClientException",Et="UnsupportedGrantTypeException",St="accessToken",E="client",It="clientId",Pt="clientSecret",xt="codeVerifier",yt="code",Dt="deviceCode",t="error",bt="expiresIn",u="error_description",qt="grantType",Nt="http",O="httpError",ht="idToken",$e="reason",je="refreshToken",Rt="redirectUri",we="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc",ft="scope",Ft="server",Ut="tokenType",o="com.amazonaws.ssooidc",Me=Ue(),v=k(),$t=F(),Ae=Me.TypeRegistry.for(we);ze.SSOOIDCServiceException$=[-3,we,"SSOOIDCServiceException",0,[],[]];Ae.registerError(ze.SSOOIDCServiceException$,$t.SSOOIDCServiceException);var c=Me.TypeRegistry.for(o);ze.AccessDeniedException$=[-3,o,kr,{[t]:E,[O]:400},[t,$e,u],[0,0,0]];c.registerError(ze.AccessDeniedException$,v.AccessDeniedException);ze.AuthorizationPendingException$=[-3,o,gr,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.AuthorizationPendingException$,v.AuthorizationPendingException);ze.ExpiredTokenException$=[-3,o,st,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.ExpiredTokenException$,v.ExpiredTokenException);ze.InternalServerException$=[-3,o,ct,{[t]:Ft,[O]:500},[t,u],[0,0]];c.registerError(ze.InternalServerException$,v.InternalServerException);ze.InvalidClientException$=[-3,o,nt,{[t]:E,[O]:401},[t,u],[0,0]];c.registerError(ze.InvalidClientException$,v.InvalidClientException);ze.InvalidGrantException$=[-3,o,pt,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.InvalidGrantException$,v.InvalidGrantException);ze.InvalidRequestException$=[-3,o,dt,{[t]:E,[O]:400},[t,$e,u],[0,0,0]];c.registerError(ze.InvalidRequestException$,v.InvalidRequestException);ze.InvalidScopeException$=[-3,o,at,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.InvalidScopeException$,v.InvalidScopeException);ze.SlowDownException$=[-3,o,Ot,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.SlowDownException$,v.SlowDownException);ze.UnauthorizedClientException$=[-3,o,vt,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.UnauthorizedClientException$,v.UnauthorizedClientException);ze.UnsupportedGrantTypeException$=[-3,o,Et,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.UnsupportedGrantTypeException$,v.UnsupportedGrantTypeException);ze.errorTypeRegistries=[Ae,c];var jt=[0,o,_r,8,0],wt=[0,o,et,8,0],Mt=[0,o,it,8,0],At=[0,o,lt,8,0],Ge=[0,o,ut,8,0];ze.CreateTokenRequest$=[3,o,tt,0,[It,Pt,qt,Dt,yt,je,ft,Rt,xt],[0,[()=>wt,0],0,0,0,[()=>Ge,0],64,0,[()=>Mt,0]],3];ze.CreateTokenResponse$=[3,o,ot,0,[St,Ut,bt,je,ht],[[()=>jt,0],0,1,[()=>Ge,0],[()=>At,0]]];ze.CreateToken$=[9,o,rt,{[Nt]:["POST","/token",200]},()=>ze.CreateTokenRequest$,()=>ze.CreateTokenResponse$]});var or=S((rr)=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.getRuntimeConfig=void 0;var Tt=M(),Bt=Lt(),Vt=er(),Wt=f(),Yt=Ht(),ge=mt(),_e=zt(),Jt=A(),Kt=Ne(),Xt=g(),Ct=(e)=>{return{apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??ge.fromBase64,base64Encoder:e?.base64Encoder??ge.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Kt.defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Jt.defaultSSOOIDCHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Tt.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(r)=>r.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Vt.NoAuthSigner}],logger:e?.logger??new Wt.NoOpLogger,protocol:e?.protocol??Bt.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:Xt.errorTypeRegistries,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??Yt.parseUrl,utf8Decoder:e?.utf8Decoder??_e.fromUtf8,utf8Encoder:e?.utf8Encoder??_e.toUtf8}};rr.getRuntimeConfig=Ct});var Or=S((lr)=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.getRuntimeConfig=void 0;var io=Zt(),so=io.__importDefault(_t()),ir=M(),sr=eo(),U=cr(),no=ro(),nr=ar(),x=gt(),pr=Qt(),dr=f(),po=to(),co=oo(),ao=kt(),lo=or(),uo=(e)=>{(0,dr.emitWarningIfUnsupportedVersion)(process.version);let r=(0,co.resolveDefaultsModeConfig)(e),i=()=>r().then(dr.loadConfigsForDefaultMode),a=(0,lo.getRuntimeConfig)(e);(0,ir.emitWarningIfUnsupportedVersion)(process.version);let s={profile:e?.profile,logger:a.logger};return{...a,...e,runtime:"node",defaultsMode:r,authSchemePreference:e?.authSchemePreference??(0,x.loadConfig)(ir.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,s),bodyLengthChecker:e?.bodyLengthChecker??po.calculateBodyLength,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,sr.createDefaultUserAgentProvider)({serviceId:a.serviceId,clientVersion:so.default.version}),maxAttempts:e?.maxAttempts??(0,x.loadConfig)(nr.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??(0,x.loadConfig)(U.NODE_REGION_CONFIG_OPTIONS,{...U.NODE_REGION_CONFIG_FILE_OPTIONS,...s}),requestHandler:pr.NodeHttpHandler.create(e?.requestHandler??i),retryMode:e?.retryMode??(0,x.loadConfig)({...nr.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await i()).retryMode||ao.DEFAULT_RETRY_MODE},e),sha256:e?.sha256??no.Hash.bind(null,"sha256"),streamCollector:e?.streamCollector??pr.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(0,x.loadConfig)(U.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,s),useFipsEndpoint:e?.useFipsEndpoint??(0,x.loadConfig)(U.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,s),userAgentAppId:e?.userAgentAppId??(0,x.loadConfig)(sr.NODE_APP_ID_CONFIG_OPTIONS,s)}};lr.getRuntimeConfig=uo});var Yo=S((P)=>{var vr=vo(),Do=Eo(),bo=So(),Er=Io(),qo=cr(),_=er(),No=Ue(),ho=Po(),yr=xo(),Sr=ar(),y=f(),Ir=A(),Ro=Or(),Pr=yo(),xr=Oo(),h=g(),$=k(),fo=F(),Fo=(e)=>{return Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"})},Uo={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},$o=(e)=>{let{httpAuthSchemes:r,httpAuthSchemeProvider:i,credentials:a}=e;return{setHttpAuthScheme(s){let R=r.findIndex((j)=>j.schemeId===s.schemeId);if(R===-1)r.push(s);else r.splice(R,1,s)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(s){i=s},httpAuthSchemeProvider(){return i},setCredentials(s){a=s},credentials(){return a}}},jo=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}},wo=(e,r)=>{let i=Object.assign(Pr.getAwsRegionExtensionConfiguration(e),y.getDefaultExtensionConfiguration(e),xr.getHttpHandlerExtensionConfiguration(e),$o(e));return r.forEach((a)=>a.configure(i)),Object.assign(e,Pr.resolveAwsRegionExtensionConfiguration(i),y.resolveDefaultRuntimeConfig(i),xr.resolveHttpHandlerRuntimeConfig(i),jo(i))};class ee extends y.Client{config;constructor(...[e]){let r=Ro.getRuntimeConfig(e||{});super(r);this.initConfig=r;let i=Fo(r),a=Er.resolveUserAgentConfig(i),s=Sr.resolveRetryConfig(a),R=qo.resolveRegionConfig(s),j=vr.resolveHostHeaderConfig(R),Dr=yr.resolveEndpointConfig(j),br=Ir.resolveHttpAuthSchemeConfig(Dr),qr=wo(br,e?.extensions||[]);this.config=qr,this.middlewareStack.use(No.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(Er.getUserAgentPlugin(this.config)),this.middlewareStack.use(Sr.getRetryPlugin(this.config)),this.middlewareStack.use(ho.getContentLengthPlugin(this.config)),this.middlewareStack.use(vr.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Do.getLoggerPlugin(this.config)),this.middlewareStack.use(bo.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(_.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Ir.defaultSSOOIDCHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async(Nr)=>new _.DefaultIdentityProviderConfig({"aws.auth#sigv4":Nr.credentials})})),this.middlewareStack.use(_.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class re extends y.Command.classBuilder().ep(Uo).m(function(e,r,i,a){return[yr.getEndpointPlugin(i,e.getEndpointParameterInstructions())]}).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").sc(h.CreateToken$).build(){}var Mo={CreateTokenCommand:re};class te extends ee{}y.createAggregatedClient(Mo,te);var Ao={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"},Go={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"};P.$Command=y.Command;P.__Client=y.Client;P.SSOOIDCServiceException=fo.SSOOIDCServiceException;P.AccessDeniedExceptionReason=Ao;P.CreateTokenCommand=re;P.InvalidRequestExceptionReason=Go;P.SSOOIDC=te;P.SSOOIDCClient=ee;Object.prototype.hasOwnProperty.call(h,"__proto__")&&!Object.prototype.hasOwnProperty.call(P,"__proto__")&&Object.defineProperty(P,"__proto__",{enumerable:!0,value:h.__proto__});Object.keys(h).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(P,e))P[e]=h[e]});Object.prototype.hasOwnProperty.call($,"__proto__")&&!Object.prototype.hasOwnProperty.call(P,"__proto__")&&Object.defineProperty(P,"__proto__",{enumerable:!0,value:$.__proto__});Object.keys($).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(P,e))P[e]=$[e]})});export default Yo();
|
|
3
|
-
|
|
4
|
-
//# debugId=0D19622C2E38FAC464756E2164756E21
|
package/dist/chunk-3t4nw1n2.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Q as ne}from"./chunk-wg0ttent.js";import{_ as C}from"./chunk-dce3w52r.js";import"./chunk-p83cjehh.js";import{aa as _}from"./chunk-56a3vnrj.js";import{vl as c,zl as F}from"./chunk-78wht1ph.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-3ndc8adc.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-3ndc8adc.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-42646nt7.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
|
-
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
|
-
|
|
5
|
-
//# debugId=3CCCD7602715411F64756E2164756E21
|
package/dist/chunk-42646nt7.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{h as Tr}from"./chunk-k1aw97dm.js";import{A as Dr,B as ur,C as Hr,i as je,k as C,l as wr,m as fr,n as jr,p as It,q as Tt,r as qr,s as mr,t as We,u as zr,v as kr,w as Qe,x as Pr,y as Nr,z as br}from"./chunk-q3e1bqrs.js";import{D as lt,E as pr,G as vr,K as Te,O as q}from"./chunk-pgdxqrjv.js";import{P as gr}from"./chunk-t7yt8egz.js";import"./chunk-wg0ttent.js";import{X as ir}from"./chunk-q7k2hc45.js";import{Y as Ir}from"./chunk-7zy6nq9e.js";import{Z as ar}from"./chunk-wnjvfmqc.js";import"./chunk-dce3w52r.js";import"./chunk-p83cjehh.js";import"./chunk-56a3vnrj.js";import{la as Or}from"./chunk-v10xzpqs.js";import{vl as us,wl as u}from"./chunk-78wht1ph.js";var G=u((Y)=>{Object.defineProperty(Y,"__esModule",{value:!0});Y.resolveHttpAuthSchemeConfig=Y.defaultSSOHttpAuthSchemeProvider=Y.defaultSSOHttpAuthSchemeParametersProvider=void 0;var _t=C(),U=lt(),Et=async(e,t,r)=>{return{operation:(0,U.getSmithyContext)(t).operation,region:await(0,U.normalizeProvider)(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}};Y.defaultSSOHttpAuthSchemeParametersProvider=Et;function Rt(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}function yt(e){return{schemeId:"smithy.api#noAuth"}}var St=(e)=>{let t=[];switch(e.operation){case"GetRoleCredentials":{t.push(yt(e));break}default:t.push(Rt(e))}return t};Y.defaultSSOHttpAuthSchemeProvider=St;var xt=(e)=>{let t=(0,_t.resolveAwsSdkSigV4Config)(e);return Object.assign(t,{authSchemePreference:(0,U.normalizeProvider)(e.authSchemePreference??[])})};Y.resolveHttpAuthSchemeConfig=xt});var Ee=u((le)=>{Object.defineProperty(le,"__esModule",{value:!0});le.ruleSet=void 0;var ae="required",n="fn",i="argv",y="ref",X=!0,Z="isSet",S="booleanEquals",E="error",R="endpoint",c="tree",A="PartitionResult",g="getAttr",ee={[ae]:!1,type:"string"},te={[ae]:!0,default:!1,type:"boolean"},re={[y]:"Endpoint"},ue={[n]:S,[i]:[{[y]:"UseFIPS"},!0]},ce={[n]:S,[i]:[{[y]:"UseDualStack"},!0]},o={},se={[n]:g,[i]:[{[y]:A},"supportsFIPS"]},de={[y]:A},oe={[n]:S,[i]:[!0,{[n]:g,[i]:[de,"supportsDualStack"]}]},ne=[ue],ie=[ce],pe=[{[y]:"Region"}],qt={version:"1.0",parameters:{Region:ee,UseDualStack:te,UseFIPS:te,Endpoint:ee},rules:[{conditions:[{[n]:Z,[i]:[re]}],rules:[{conditions:ne,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:E},{conditions:ie,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:E},{endpoint:{url:re,properties:o,headers:o},type:R}],type:c},{conditions:[{[n]:Z,[i]:pe}],rules:[{conditions:[{[n]:"aws.partition",[i]:pe,assign:A}],rules:[{conditions:[ue,ce],rules:[{conditions:[{[n]:S,[i]:[X,se]},oe],rules:[{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:o,headers:o},type:R}],type:c},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:E}],type:c},{conditions:ne,rules:[{conditions:[{[n]:S,[i]:[se,X]}],rules:[{conditions:[{[n]:"stringEquals",[i]:[{[n]:g,[i]:[de,"name"]},"aws-us-gov"]}],endpoint:{url:"https://portal.sso.{Region}.amazonaws.com",properties:o,headers:o},type:R},{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",properties:o,headers:o},type:R}],type:c},{error:"FIPS is enabled but this partition does not support FIPS",type:E}],type:c},{conditions:ie,rules:[{conditions:[oe],rules:[{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:o,headers:o},type:R}],type:c},{error:"DualStack is enabled but this partition does not support DualStack",type:E}],type:c},{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",properties:o,headers:o},type:R}],type:c}],type:c},{error:"Invalid Configuration: Missing Region",type:E}]};le.ruleSet=qt});var Se=u((Re)=>{Object.defineProperty(Re,"__esModule",{value:!0});Re.defaultEndpointResolver=void 0;var Pt=Tt(),w=It(),Nt=Ee(),bt=new w.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Dt=(e,t={})=>{return bt.get(e,()=>(0,w.resolveEndpoint)(Nt.ruleSet,{endpointParams:e,logger:t.logger}))};Re.defaultEndpointResolver=Dt;w.customEndpointFunctions.aws=Pt.awsEndpointFunctions});var I=u((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.SSOServiceException=j.__ServiceException=void 0;var xe=q();Object.defineProperty(j,"__ServiceException",{enumerable:!0,get:function(){return xe.ServiceException}});class f extends xe.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,f.prototype)}}j.SSOServiceException=f});var K=u((Oe)=>{Object.defineProperty(Oe,"__esModule",{value:!0});Oe.UnauthorizedException=Oe.TooManyRequestsException=Oe.ResourceNotFoundException=Oe.InvalidRequestException=void 0;var T=I();class m extends T.SSOServiceException{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,m.prototype)}}Oe.InvalidRequestException=m;class z extends T.SSOServiceException{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,z.prototype)}}Oe.ResourceNotFoundException=z;class k extends T.SSOServiceException{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e});Object.setPrototypeOf(this,k.prototype)}}Oe.TooManyRequestsException=k;class H extends T.SSOServiceException{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e});Object.setPrototypeOf(this,H.prototype)}}Oe.UnauthorizedException=H});var L=u((De)=>{Object.defineProperty(De,"__esModule",{value:!0});De.GetRoleCredentials$=De.RoleCredentials$=De.GetRoleCredentialsResponse$=De.GetRoleCredentialsRequest$=De.errorTypeRegistries=De.UnauthorizedException$=De.TooManyRequestsException$=De.ResourceNotFoundException$=De.InvalidRequestException$=De.SSOServiceException$=void 0;var Mt="AccessTokenType",Ut="GetRoleCredentials",Ct="GetRoleCredentialsRequest",Gt="GetRoleCredentialsResponse",At="InvalidRequestException",gt="RoleCredentials",wt="ResourceNotFoundException",ft="SecretAccessKeyType",jt="SessionTokenType",mt="TooManyRequestsException",zt="UnauthorizedException",kt="accountId",Ht="accessKeyId",Kt="accessToken",Lt="account_id",P="client",N="error",Vt="expiration",Bt="http",b="httpError",Wt="httpHeader",Ie="httpQuery",D="message",Qt="roleCredentials",Yt="roleName",Jt="role_name",Pe="smithy.ts.sdk.synthetic.com.amazonaws.sso",Xt="secretAccessKey",Zt="sessionToken",er="x-amz-sso_bearer_token",p="com.amazonaws.sso",Ne=Te(),$=K(),tr=I(),be=Ne.TypeRegistry.for(Pe);De.SSOServiceException$=[-3,Pe,"SSOServiceException",0,[],[]];be.registerError(De.SSOServiceException$,tr.SSOServiceException);var x=Ne.TypeRegistry.for(p);De.InvalidRequestException$=[-3,p,At,{[N]:P,[b]:400},[D],[0]];x.registerError(De.InvalidRequestException$,$.InvalidRequestException);De.ResourceNotFoundException$=[-3,p,wt,{[N]:P,[b]:404},[D],[0]];x.registerError(De.ResourceNotFoundException$,$.ResourceNotFoundException);De.TooManyRequestsException$=[-3,p,mt,{[N]:P,[b]:429},[D],[0]];x.registerError(De.TooManyRequestsException$,$.TooManyRequestsException);De.UnauthorizedException$=[-3,p,zt,{[N]:P,[b]:401},[D],[0]];x.registerError(De.UnauthorizedException$,$.UnauthorizedException);De.errorTypeRegistries=[be,x];var rr=[0,p,Mt,8,0],sr=[0,p,ft,8,0],or=[0,p,jt,8,0];De.GetRoleCredentialsRequest$=[3,p,Ct,0,[Yt,kt,Kt],[[0,{[Ie]:Jt}],[0,{[Ie]:Lt}],[()=>rr,{[Wt]:er}]],3];De.GetRoleCredentialsResponse$=[3,p,Gt,0,[Qt],[[()=>De.RoleCredentials$,0]]];De.RoleCredentials$=[3,p,gt,0,[Ht,Xt,Zt,Vt],[0,[()=>sr,0],[()=>or,0],1]];De.GetRoleCredentials$=[9,p,Ut,{[Bt]:["GET","/federation/credentials",200]},()=>De.GetRoleCredentialsRequest$,()=>De.GetRoleCredentialsResponse$]});var ke=u((me)=>{Object.defineProperty(me,"__esModule",{value:!0});me.getRuntimeConfig=void 0;var cr=C(),dr=ur(),lr=je(),_r=q(),Er=ar(),we=pr(),fe=ir(),Rr=G(),yr=Se(),Sr=L(),xr=(e)=>{return{apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??we.fromBase64,base64Encoder:e?.base64Encoder??we.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??yr.defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Rr.defaultSSOHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new cr.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new lr.NoAuthSigner}],logger:e?.logger??new _r.NoOpLogger,protocol:e?.protocol??dr.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:Sr.errorTypeRegistries,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??Er.parseUrl,utf8Decoder:e?.utf8Decoder??fe.fromUtf8,utf8Encoder:e?.utf8Encoder??fe.toUtf8}};me.getRuntimeConfig=xr});var Xe=u((Ye)=>{Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getRuntimeConfig=void 0;var $r=Or(),Fr=$r.__importDefault(Tr()),He=C(),Ke=Pr(),F=We(),hr=Nr(),Le=Qe(),l=Ir(),Ve=vr(),Be=q(),Mr=br(),Ur=Dr(),Cr=qr(),Gr=ke(),Ar=(e)=>{(0,Be.emitWarningIfUnsupportedVersion)(process.version);let t=(0,Ur.resolveDefaultsModeConfig)(e),r=()=>t().then(Be.loadConfigsForDefaultMode),a=(0,Gr.getRuntimeConfig)(e);(0,He.emitWarningIfUnsupportedVersion)(process.version);let s={profile:e?.profile,logger:a.logger};return{...a,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,l.loadConfig)(He.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,s),bodyLengthChecker:e?.bodyLengthChecker??Mr.calculateBodyLength,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,Ke.createDefaultUserAgentProvider)({serviceId:a.serviceId,clientVersion:Fr.default.version}),maxAttempts:e?.maxAttempts??(0,l.loadConfig)(Le.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??(0,l.loadConfig)(F.NODE_REGION_CONFIG_OPTIONS,{...F.NODE_REGION_CONFIG_FILE_OPTIONS,...s}),requestHandler:Ve.NodeHttpHandler.create(e?.requestHandler??r),retryMode:e?.retryMode??(0,l.loadConfig)({...Le.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await r()).retryMode||Cr.DEFAULT_RETRY_MODE},e),sha256:e?.sha256??hr.Hash.bind(null,"sha256"),streamCollector:e?.streamCollector??Ve.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(0,l.loadConfig)(F.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,s),useFipsEndpoint:e?.useFipsEndpoint??(0,l.loadConfig)(F.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,s),userAgentAppId:e?.userAgentAppId??(0,l.loadConfig)(Ke.NODE_APP_ID_CONFIG_OPTIONS,s)}};Ye.getRuntimeConfig=Ar});var it=u((d)=>{var Ze=wr(),Kr=fr(),Lr=jr(),et=mr(),Vr=We(),V=je(),Br=Te(),Wr=zr(),nt=kr(),tt=Qe(),_=q(),rt=G(),Qr=Xe(),st=Hr(),ot=gr(),v=L(),h=K(),Yr=I(),Jr=(e)=>{return Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"})},Xr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},Zr=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:r,credentials:a}=e;return{setHttpAuthScheme(s){let O=t.findIndex((M)=>M.schemeId===s.schemeId);if(O===-1)t.push(s);else t.splice(O,1,s)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(s){r=s},httpAuthSchemeProvider(){return r},setCredentials(s){a=s},credentials(){return a}}},es=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}},ts=(e,t)=>{let r=Object.assign(st.getAwsRegionExtensionConfiguration(e),_.getDefaultExtensionConfiguration(e),ot.getHttpHandlerExtensionConfiguration(e),Zr(e));return t.forEach((a)=>a.configure(r)),Object.assign(e,st.resolveAwsRegionExtensionConfiguration(r),_.resolveDefaultRuntimeConfig(r),ot.resolveHttpHandlerRuntimeConfig(r),es(r))};class B extends _.Client{config;constructor(...[e]){let t=Qr.getRuntimeConfig(e||{});super(t);this.initConfig=t;let r=Jr(t),a=et.resolveUserAgentConfig(r),s=tt.resolveRetryConfig(a),O=Vr.resolveRegionConfig(s),M=Ze.resolveHostHeaderConfig(O),at=nt.resolveEndpointConfig(M),ut=rt.resolveHttpAuthSchemeConfig(at),ct=ts(ut,e?.extensions||[]);this.config=ct,this.middlewareStack.use(Br.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(et.getUserAgentPlugin(this.config)),this.middlewareStack.use(tt.getRetryPlugin(this.config)),this.middlewareStack.use(Wr.getContentLengthPlugin(this.config)),this.middlewareStack.use(Ze.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Kr.getLoggerPlugin(this.config)),this.middlewareStack.use(Lr.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(V.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:rt.defaultSSOHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async(dt)=>new V.DefaultIdentityProviderConfig({"aws.auth#sigv4":dt.credentials})})),this.middlewareStack.use(V.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class W extends _.Command.classBuilder().ep(Xr).m(function(e,t,r,a){return[nt.getEndpointPlugin(r,e.getEndpointParameterInstructions())]}).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").sc(v.GetRoleCredentials$).build(){}var rs={GetRoleCredentialsCommand:W};class Q extends B{}_.createAggregatedClient(rs,Q);d.$Command=_.Command;d.__Client=_.Client;d.SSOServiceException=Yr.SSOServiceException;d.GetRoleCredentialsCommand=W;d.SSO=Q;d.SSOClient=B;Object.prototype.hasOwnProperty.call(v,"__proto__")&&!Object.prototype.hasOwnProperty.call(d,"__proto__")&&Object.defineProperty(d,"__proto__",{enumerable:!0,value:v.__proto__});Object.keys(v).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(d,e))d[e]=v[e]});Object.prototype.hasOwnProperty.call(h,"__proto__")&&!Object.prototype.hasOwnProperty.call(d,"__proto__")&&Object.defineProperty(d,"__proto__",{enumerable:!0,value:h.__proto__});Object.keys(h).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(d,e))d[e]=h[e]})});var pt=us(it(),1);var export_SSOClient=pt.SSOClient;var export_GetRoleCredentialsCommand=pt.GetRoleCredentialsCommand;export{export_SSOClient as SSOClient,export_GetRoleCredentialsCommand as GetRoleCredentialsCommand};
|
|
3
|
-
|
|
4
|
-
//# debugId=1CC00CC9298BA06164756E2164756E21
|
package/dist/chunk-69c2s43a.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{P as ue}from"./chunk-t7yt8egz.js";import{Q as w}from"./chunk-wg0ttent.js";import{_}from"./chunk-dce3w52r.js";import"./chunk-p83cjehh.js";import{aa as l}from"./chunk-56a3vnrj.js";import{vl as o,zl as d}from"./chunk-78wht1ph.js";var g=o(_(),1);var ie=o(l(),1);var O=o(w(),1),R=o(l(),1),J=o(_(),1);var j=o(w(),1),E=o(l(),1),U=(e,s,t)=>{let n={EcsContainer:async(r)=>{let{fromHttp:a}=await import("./chunk-4t2j3zcg.js"),{fromContainerMetadata:c}=await import("./chunk-kwc68y45.js");return t?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>E.chain(a(r??{}),c(r))().then(L)},Ec2InstanceMetadata:async(r)=>{t?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");let{fromInstanceMetadata:a}=await import("./chunk-kwc68y45.js");return async()=>a(r)().then(L)},Environment:async(r)=>{t?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");let{fromEnv:a}=await import("./chunk-qbvm5q1g.js");return async()=>a(r)().then(L)}};if(e in n)return n[e];else throw new E.CredentialsProviderError(`Unsupported credential source in profile ${s}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:t})},L=(e)=>j.setCredentialFeature(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");var N=(e,{profile:s="default",logger:t}={})=>{return Boolean(e)&&typeof e==="object"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(he(e,{profile:s,logger:t})||ye(e,{profile:s,logger:t}))},he=(e,{profile:s,logger:t})=>{let n=typeof e.source_profile==="string"&&typeof e.credential_source>"u";if(n)t?.debug?.(` ${s} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`);return n},ye=(e,{profile:s,logger:t})=>{let n=typeof e.credential_source==="string"&&typeof e.source_profile>"u";if(n)t?.debug?.(` ${s} isCredentialSourceProfile credential_source=${e.credential_source}`);return n},v=async(e,s,t,n,r={},a)=>{t.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");let c=s[e],{source_profile:h,region:I}=c;if(!t.roleAssumer){let{getDefaultRoleAssumer:i}=await import("./chunk-zfbqgzwa.js").then((m)=>o(m.default,1));t.roleAssumer=i({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...n,...t?.parentClientConfig,region:I??t?.parentClientConfig?.region??n?.region}},t.clientPlugins)}if(h&&h in r)throw new R.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${J.getProfileName(t)}. Profiles visited: `+Object.keys(r).join(", "),{logger:t.logger});t.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${h?`source_profile=[${h}]`:`profile=[${e}]`}`);let T=h?a(h,s,t,n,{...r,[h]:!0},G(s[h]??{})):(await U(c.credential_source,e,t.logger)(t))();if(G(c))return T.then((i)=>O.setCredentialFeature(i,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));else{let i={RoleArn:c.role_arn,RoleSessionName:c.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:c.external_id,DurationSeconds:parseInt(c.duration_seconds||"3600",10)},{mfa_serial:u}=c;if(u){if(!t.mfaCodeProvider)throw new R.CredentialsProviderError(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:t.logger,tryNextLink:!1});i.SerialNumber=u,i.TokenCode=await t.mfaCodeProvider(u)}let y=await T;return t.roleAssumer(y,i).then((m)=>O.setCredentialFeature(m,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},G=(e)=>{return!e.role_arn&&!!e.credential_source};var V=o(w(),1);var C=o(w(),1),X=o(l(),1),K=o(_(),1);var k=o(l(),1),W=o(ue(),1),z=o(_(),1);import{createHash as de,createPrivateKey as we,createPublicKey as ke,sign as me}from"crypto";import{promises as D}from"fs";import{homedir as fe}from"os";import{dirname as Ie,join as Y}from"path";class b{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300000;constructor(e,s,t){this.profileData=e,this.init=s,this.callerClientConfig=t}async loadCredentials(){let e=await this.loadToken();if(!e)throw new k.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let s=e.accessToken,t=Date.now();if(new Date(s.expiresAt).getTime()-t<=b.REFRESH_THRESHOLD)return this.refresh(e);return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,sessionToken:s.sessionToken,accountId:s.accountId,expiration:new Date(s.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(e){let{SigninClient:s,CreateOAuth2TokenCommand:t}=await import("./chunk-jrv31jp9.js").then((m)=>o(m.default,1)),{logger:n,userAgentAppId:r}=this.callerClientConfig??{},c=((i)=>{return i?.metadata?.handlerProtocol==="h2"})(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,h=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,I=new s({credentials:{accessKeyId:"",secretAccessKey:""},region:h,requestHandler:c,logger:n,userAgentAppId:r,...this.init?.clientConfig});this.createDPoPInterceptor(I.middlewareStack);let T={tokenInput:{clientId:e.clientId,refreshToken:e.refreshToken,grantType:"refresh_token"}};try{let i=await I.send(new t(T)),{accessKeyId:u,secretAccessKey:y,sessionToken:m}=i.tokenOutput?.accessToken??{},{refreshToken:x,expiresIn:H}=i.tokenOutput??{};if(!u||!y||!m||!x)throw new k.CredentialsProviderError("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let A=(H??900)*1000,f=new Date(Date.now()+A),q={...e,accessToken:{...e.accessToken,accessKeyId:u,secretAccessKey:y,sessionToken:m,expiresAt:f.toISOString()},refreshToken:x};await this.saveToken(q);let S=q.accessToken;return{accessKeyId:S.accessKeyId,secretAccessKey:S.secretAccessKey,sessionToken:S.sessionToken,accountId:S.accountId,expiration:f}}catch(i){if(i.name==="AccessDeniedException"){let u=i.error,y;switch(u){case"TOKEN_EXPIRED":y="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":y="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":y="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:y=`Failed to refresh token: ${String(i)}. Please re-authenticate using \`aws login\``}throw new k.CredentialsProviderError(y,{logger:this.logger,tryNextLink:!1})}throw new k.CredentialsProviderError(`Failed to refresh token: ${String(i)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let s;try{s=await z.readFile(e,{ignoreCache:this.init?.ignoreCache})}catch{s=await D.readFile(e,"utf8")}let t=JSON.parse(s),n=["accessToken","clientId","refreshToken","dpopKey"].filter((r)=>!t[r]);if(!t.accessToken?.accountId)n.push("accountId");if(n.length>0)throw new k.CredentialsProviderError(`Token validation failed, missing fields: ${n.join(", ")}`,{logger:this.logger,tryNextLink:!1});return t}catch(s){throw new k.CredentialsProviderError(`Failed to load token from ${e}: ${String(s)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let s=this.getTokenFilePath(),t=Ie(s);try{await D.mkdir(t,{recursive:!0})}catch(n){}await D.writeFile(s,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??Y(fe(),".aws","login","cache"),s=Buffer.from(this.loginSession,"utf8"),t=de("sha256").update(s).digest("hex");return Y(e,`${t}.json`)}derToRawSignature(e){let s=2;if(e[s]!==2)throw Error("Invalid DER signature");s++;let t=e[s++],n=e.subarray(s,s+t);if(s+=t,e[s]!==2)throw Error("Invalid DER signature");s++;let r=e[s++],a=e.subarray(s,s+r);n=n[0]===0?n.subarray(1):n,a=a[0]===0?a.subarray(1):a;let c=Buffer.concat([Buffer.alloc(32-n.length),n]),h=Buffer.concat([Buffer.alloc(32-a.length),a]);return Buffer.concat([c,h])}createDPoPInterceptor(e){e.add((s)=>async(t)=>{if(W.HttpRequest.isInstance(t.request)){let n=t.request,r=`${n.protocol}//${n.hostname}${n.port?`:${n.port}`:""}${n.path}`,a=await this.generateDpop(n.method,r);n.headers={...n.headers,DPoP:a}}return s(t)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",s){let t=await this.loadToken();try{let n=we({key:t.dpopKey,format:"pem",type:"sec1"}),a=ke(n).export({format:"der",type:"spki"}),c=-1;for(let f=0;f<a.length;f++)if(a[f]===4){c=f;break}let h=a.slice(c+1,c+33),I=a.slice(c+33,c+65),T={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:h.toString("base64url"),y:I.toString("base64url")}},i={jti:crypto.randomUUID(),htm:e,htu:s,iat:Math.floor(Date.now()/1000)},u=Buffer.from(JSON.stringify(T)).toString("base64url"),y=Buffer.from(JSON.stringify(i)).toString("base64url"),m=`${u}.${y}`,x=me("sha256",Buffer.from(m),n),A=this.derToRawSignature(x).toString("base64url");return`${m}.${A}`}catch(n){throw new k.CredentialsProviderError(`Failed to generate Dpop proof: ${n instanceof Error?n.message:String(n)}`,{logger:this.logger,tryNextLink:!1})}}}var Q=(e)=>async({callerClientConfig:s}={})=>{e?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let t=await K.parseKnownFiles(e||{}),n=K.getProfileName({profile:e?.profile??s?.profile}),r=t[n];if(!r?.login_session)throw new X.CredentialsProviderError(`Profile ${n} does not contain login_session.`,{tryNextLink:!0,logger:e?.logger});let c=await new b(r,e,s).loadCredentials();return C.setCredentialFeature(c,"CREDENTIALS_LOGIN","AD")};var Z=(e)=>{return Boolean(e&&e.login_session)},M=async(e,s,t)=>{let n=await Q({...s,profile:e})({callerClientConfig:t});return V.setCredentialFeature(n,"CREDENTIALS_PROFILE_LOGIN","AC")};var p=o(w(),1),ee=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.credential_process==="string",te=async(e,s)=>import("./chunk-z7224rhm.js").then(({fromProcess:t})=>t({...e,profile:s})().then((n)=>p.setCredentialFeature(n,"CREDENTIALS_PROFILE_PROCESS","v")));var $=o(w(),1),se=async(e,s,t={},n)=>{let{fromSSO:r}=await import("./chunk-3t4nw1n2.js");return r({profile:e,logger:t.logger,parentClientConfig:t.parentClientConfig,clientConfig:t.clientConfig})({callerClientConfig:n}).then((a)=>{if(s.sso_session)return $.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO","r");else return $.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO_LEGACY","t")})},ne=(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 ce=o(w(),1),P=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.aws_access_key_id==="string"&&typeof e.aws_secret_access_key==="string"&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,F=async(e,s)=>{s?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");let t={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return ce.setCredentialFeature(t,"CREDENTIALS_PROFILE","n")};var re=o(w(),1),ae=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.web_identity_token_file==="string"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1,oe=async(e,s,t)=>import("./chunk-cmt3jw6j.js").then(({fromTokenFile:n})=>n({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:s.roleAssumerWithWebIdentity,logger:s.logger,parentClientConfig:s.parentClientConfig})({callerClientConfig:t}).then((r)=>re.setCredentialFeature(r,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")));var B=async(e,s,t,n,r={},a=!1)=>{let c=s[e];if(Object.keys(r).length>0&&P(c))return F(c,t);if(a||N(c,{profile:e,logger:t.logger}))return v(e,s,t,n,r,B);if(P(c))return F(c,t);if(ae(c))return oe(c,t,n);if(ee(c))return te(t,e);if(ne(c))return await se(e,c,t,n);if(Z(c))return M(e,t,n);throw new ie.CredentialsProviderError(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:t.logger})};var Ne=(e={})=>async({callerClientConfig:s}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");let t=await g.parseKnownFiles(e);return B(g.getProfileName({profile:e.profile??s?.profile}),t,e,s)};export{Ne as fromIni};
|
|
3
|
-
|
|
4
|
-
//# debugId=ECD3334305FA408864756E2164756E21
|
package/dist/chunk-6np1r9gk.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ae as o}from"./chunk-h3gcxf2k.js";import{be as i}from"./chunk-ycn7w2e9.js";import{Wj as t}from"./chunk-zcg6m7gf.js";import{Wk as r}from"./chunk-xff7tkde.js";class n extends i{register(){this.app.singleton(r,()=>new r(t(o(),this.app.config.get("translation",{}))))}}
|
|
3
|
-
export{n as ab};
|
|
4
|
-
|
|
5
|
-
//# debugId=39179AD679C8F5DE64756E2164756E21
|
package/dist/chunk-7426gfgw.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{X as M}from"./chunk-q7k2hc45.js";import{yl as E}from"./chunk-78wht1ph.js";class x{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:i,serializer:n,deserializer:o,serdeContext:c,defaultContentType:y}){this.marshaller=i,this.serializer=n,this.deserializer=o,this.serdeContext=c,this.defaultContentType=y}async serializeEventStream({eventStream:i,requestSchema:n,initialRequest:o}){let c=this.marshaller,y=n.getEventStreamMember(),p=n.getMemberSchema(y),d=this.serializer,f=this.defaultContentType,h=Symbol("initialRequestMarker"),S={async*[Symbol.asyncIterator](){if(o){let r={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};d.write(n,o);let t=d.flush();yield{[h]:!0,headers:r,body:t}}for await(let r of i)yield r}};return c.serialize(S,(r)=>{if(r[h])return{headers:r.headers,body:r.body};let t=Object.keys(r).find((s)=>{return s!=="__type"})??"",{additionalHeaders:e,body:a,eventType:l,explicitPayloadContentType:m}=this.writeEventBody(t,p,r);return{headers:{":event-type":{type:"string",value:l},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:m??f},...e},body:a}})}async deserializeEventStream({response:i,responseSchema:n,initialResponseContainer:o}){let c=this.marshaller,y=n.getEventStreamMember(),d=n.getMemberSchema(y).getMemberSchemas(),f=Symbol("initialResponseMarker"),h=c.deserialize(i.body,async(t)=>{let e=Object.keys(t).find((l)=>{return l!=="__type"})??"",a=t[e].body;if(e==="initial-response"){let l=await this.deserializer.read(n,a);return delete l[y],{[f]:!0,...l}}else if(e in d){let l=d[e];if(l.isStructSchema()){let m={},u=!1;for(let[s,g]of l.structIterator()){let{eventHeader:v,eventPayload:w}=g.getMergedTraits();if(u=u||Boolean(v||w),w){if(g.isBlobSchema())m[s]=a;else if(g.isStringSchema())m[s]=(this.serdeContext?.utf8Encoder??z.toUtf8)(a);else if(g.isStructSchema())m[s]=await this.deserializer.read(g,a)}else if(v){let b=t[e].headers[s]?.value;if(b!=null)if(g.isNumericSchema())if(b&&typeof b==="object"&&"bytes"in b)m[s]=BigInt(b.toString());else m[s]=Number(b);else m[s]=b}}if(u)return{[e]:m};if(a.byteLength===0)return{[e]:{}}}return{[e]:await this.deserializer.read(l,a)}}else return{$unknown:t}}),S=h[Symbol.asyncIterator](),r=await S.next();if(r.done)return h;if(r.value?.[f]){if(!n)throw Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let[t,e]of Object.entries(r.value))o[t]=e}return{async*[Symbol.asyncIterator](){if(!r?.value?.[f])yield r.value;while(!0){let{done:t,value:e}=await S.next();if(t)break;yield e}}}}writeEventBody(i,n,o){let c=this.serializer,y=i,p=null,d,f=(()=>{return n.getSchema()[4].includes(i)})(),h={};if(!f){let[t,e]=o[i];y=t,c.write(15,e)}else{let t=n.getMemberSchema(i);if(t.isStructSchema()){for(let[e,a]of t.structIterator()){let{eventHeader:l,eventPayload:m}=a.getMergedTraits();if(m)p=e;else if(l){let u=o[i][e],s="binary";if(a.isNumericSchema())if(-2147483648<=u&&u<=2147483647)s="integer";else s="long";else if(a.isTimestampSchema())s="timestamp";else if(a.isStringSchema())s="string";else if(a.isBooleanSchema())s="boolean";if(u!=null)h[e]={type:s,value:u},delete o[i][e]}}if(p!==null){let e=t.getMemberSchema(p);if(e.isBlobSchema())d="application/octet-stream";else if(e.isStringSchema())d="text/plain";c.write(e,o[i][p])}else c.write(t,o[i])}else if(t.isUnitSchema())c.write(t,{});else throw Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}let S=c.flush()??new Uint8Array;return{body:typeof S==="string"?(this.serdeContext?.utf8Decoder??z.fromUtf8)(S):S,eventType:y,explicitPayloadContentType:d,additionalHeaders:h}}}var z,T;var C=E(()=>{z=M();T=x});C();export{T as EventStreamSerde};export default {get EventStreamSerde(){return T}};
|
|
3
|
-
|
|
4
|
-
//# debugId=9B3DD079BF3EFE4364756E2164756E21
|
package/dist/chunk-7zy6nq9e.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{_ as F}from"./chunk-dce3w52r.js";import{aa as w}from"./chunk-56a3vnrj.js";import{wl as h}from"./chunk-78wht1ph.js";var P=h((p)=>{var t=w(),l=F();function d(e){try{let o=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return o.delete("CONFIG"),o.delete("CONFIG_PREFIX_SEPARATOR"),o.delete("ENV"),[...o].join(", ")}catch(o){return e}}var u=(e,o)=>async()=>{try{let r=e(process.env,o);if(r===void 0)throw Error();return r}catch(r){throw new t.CredentialsProviderError(r.message||`Not found in ENV: ${d(e.toString())}`,{logger:o?.logger})}},C=(e,{preferredFile:o="config",...r}={})=>async()=>{let n=l.getProfileName(r),{configFile:i,credentialsFile:c}=await l.loadSharedConfigFiles(r),s=c[n]||{},g=i[n]||{},m=o==="config"?{...s,...g}:{...g,...s};try{let f=e(m,o==="config"?i:c);if(f===void 0)throw Error();return f}catch(a){throw new t.CredentialsProviderError(a.message||`Not found in config files w/ profile [${n}]: ${d(e.toString())}`,{logger:r.logger})}},y=(e)=>typeof e==="function",E=(e)=>y(e)?async()=>await e():t.fromStatic(e),N=({environmentVariableSelector:e,configFileSelector:o,default:r},n={})=>{let{signingName:i,logger:c}=n,s={signingName:i,logger:c};return t.memoize(t.chain(u(e,s),C(o,n),E(r)))};p.loadConfig=N});
|
|
3
|
-
export{P as Y};
|
|
4
|
-
|
|
5
|
-
//# debugId=28F6CD7510FDDB1D64756E2164756E21
|
package/dist/chunk-cmt3jw6j.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Q as I}from"./chunk-wg0ttent.js";import{_ as A}from"./chunk-dce3w52r.js";import"./chunk-p83cjehh.js";import{aa as f}from"./chunk-56a3vnrj.js";import{vl as t,zl as T}from"./chunk-78wht1ph.js";var N=t(I(),1),a=t(f(),1),d=t(A(),1);import{readFileSync as g}from"fs";var c=(e)=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:r,webIdentityToken:i,providerId:n,policyArns:m,policy:S,durationSeconds:l}=e,{roleAssumerWithWebIdentity:E}=e;if(!E){let{getDefaultRoleAssumerWithWebIdentity:p}=await import("./chunk-zfbqgzwa.js").then((m)=>t(m.default,1));E=p({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...s?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return E({RoleArn:o,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:n,PolicyArns:m,Policy:S,DurationSeconds:l})};var _="AWS_WEB_IDENTITY_TOKEN_FILE",O="AWS_ROLE_ARN",k="AWS_ROLE_SESSION_NAME",L=(e={})=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let o=e?.webIdentityTokenFile??process.env[_],r=e?.roleArn??process.env[O],i=e?.roleSessionName??process.env[k];if(!o||!r)throw new a.CredentialsProviderError("Web identity configuration not specified",{logger:e.logger});let n=await c({...e,webIdentityToken:d.externalDataInterceptor?.getTokenRecord?.()[o]??g(o,{encoding:"ascii"}),roleArn:r,roleSessionName:i})(s);if(o===process.env[_])N.setCredentialFeature(n,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h");return n};export{c as fromWebToken,L as fromTokenFile};
|
|
3
|
-
|
|
4
|
-
//# debugId=C51A31A584BD44D064756E2164756E21
|