@opencode-ai/cli-linux-x64 0.0.0-beta-202606050000
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/bin/chunk-01tb5qes.js.map +131 -0
- package/bin/chunk-06d8aa69.js.map +10 -0
- package/bin/chunk-07w2xsfy.js.map +50 -0
- package/bin/chunk-0azwkk9z.js.map +12 -0
- package/bin/chunk-0d9ja06r.js.map +9 -0
- package/bin/chunk-14kv2kjk.js.map +13 -0
- package/bin/chunk-17j53wgt.js.map +11 -0
- package/bin/chunk-191djt7z.js.map +113 -0
- package/bin/chunk-1brm44vt.js.map +10 -0
- package/bin/chunk-1jb1dn9p.js.map +10 -0
- package/bin/chunk-1paeax4j.js.map +56 -0
- package/bin/chunk-1wb39pye.js.map +9 -0
- package/bin/chunk-2mjmecen.js.map +10 -0
- package/bin/chunk-2wqpg9fb.js.map +10 -0
- package/bin/chunk-32ewzcjk.js.map +10 -0
- package/bin/chunk-334z6v35.js.map +9 -0
- package/bin/chunk-3jqjf0hd.js.map +10 -0
- package/bin/chunk-3n6vddyq.js.map +73 -0
- package/bin/chunk-3zmvhepw.js.map +10 -0
- package/bin/chunk-4980h0t7.js.map +37 -0
- package/bin/chunk-4q5k6a0e.js.map +10 -0
- package/bin/chunk-5ft9zwf9.js.map +10 -0
- package/bin/chunk-6ttpn29p.js.map +10 -0
- package/bin/chunk-7fvpf4bs.js.map +10 -0
- package/bin/chunk-7vb6kdat.js.map +10 -0
- package/bin/chunk-84amh6xf.js.map +11 -0
- package/bin/chunk-8akfq1ty.js.map +19 -0
- package/bin/chunk-8rd9r1gb.js.map +11 -0
- package/bin/chunk-8x80qvzn.js.map +10 -0
- package/bin/chunk-943th5qs.js.map +10 -0
- package/bin/chunk-94yf089p.js.map +10 -0
- package/bin/chunk-98cxndhz.js.map +9 -0
- package/bin/chunk-9f8tmby0.js.map +9 -0
- package/bin/chunk-9fbstsnw.js.map +9 -0
- package/bin/chunk-9hq8aywf.js.map +10 -0
- package/bin/chunk-9m7hf7ms.js.map +10 -0
- package/bin/chunk-9vf55fj3.js.map +10 -0
- package/bin/chunk-9w9rk9en.js.map +20 -0
- package/bin/chunk-9y4hgfns.js.map +10 -0
- package/bin/chunk-aag5p1fp.js.map +10 -0
- package/bin/chunk-axy1v6wd.js.map +27 -0
- package/bin/chunk-bj9msmj2.js.map +10 -0
- package/bin/chunk-bt0r89ee.js.map +9 -0
- package/bin/chunk-c2gsyspz.js.map +10 -0
- package/bin/chunk-c8hr0q5n.js.map +10 -0
- package/bin/chunk-cab6ccj0.js.map +10 -0
- package/bin/chunk-ck4nkjtx.js.map +193 -0
- package/bin/chunk-cvm4kr56.js.map +23 -0
- package/bin/chunk-cyb9bpgm.js.map +10 -0
- package/bin/chunk-d1p8awq6.js.map +10 -0
- package/bin/chunk-d6nz1m6v.js.map +10 -0
- package/bin/chunk-d9g5798m.js.map +81 -0
- package/bin/chunk-dcn0azxw.js.map +10 -0
- package/bin/chunk-dd9pfwmr.js.map +10 -0
- package/bin/chunk-dk4qekzk.js.map +10 -0
- package/bin/chunk-dk9tgwkh.js.map +9 -0
- package/bin/chunk-dzzhxh1c.js.map +10 -0
- package/bin/chunk-efsmps94.js.map +9 -0
- package/bin/chunk-fdw7znt6.js.map +11 -0
- package/bin/chunk-fs6t8jdg.js.map +10 -0
- package/bin/chunk-fzcqzwx5.js.map +10 -0
- package/bin/chunk-g4fcmhkj.js.map +11 -0
- package/bin/chunk-g4ff66n8.js.map +10 -0
- package/bin/chunk-g8mpn6ke.js.map +11 -0
- package/bin/chunk-gahs293a.js.map +10 -0
- package/bin/chunk-gh9dcqbv.js.map +10 -0
- package/bin/chunk-grvxd8zq.js.map +10 -0
- package/bin/chunk-gv6nagng.js.map +10 -0
- package/bin/chunk-h1vz14ze.js.map +167 -0
- package/bin/chunk-hav16yge.js.map +10 -0
- package/bin/chunk-hp5nnq6f.js.map +11 -0
- package/bin/chunk-hrcbafh3.js.map +9 -0
- package/bin/chunk-hxfsfpek.js.map +10 -0
- package/bin/chunk-jcqp2wmf.js.map +10 -0
- package/bin/chunk-jt9t8203.js.map +9 -0
- package/bin/chunk-k0980eb5.js.map +10 -0
- package/bin/chunk-kghptcgb.js.map +9 -0
- package/bin/chunk-kkvk5eez.js.map +10 -0
- package/bin/chunk-kv0b3sh5.js.map +10 -0
- package/bin/chunk-kvfs5rat.js.map +10 -0
- package/bin/chunk-mf0qqhvb.js.map +10 -0
- package/bin/chunk-mkze6twx.js.map +10 -0
- package/bin/chunk-mzjs3qj3.js.map +10 -0
- package/bin/chunk-n10mj2m3.js.map +17 -0
- package/bin/chunk-n2fbt143.js.map +9 -0
- package/bin/chunk-n6a0rctn.js.map +9 -0
- package/bin/chunk-nd3yv9bg.js.map +388 -0
- package/bin/chunk-njn9a3jp.js.map +13 -0
- package/bin/chunk-nkhzpsnk.js.map +13 -0
- package/bin/chunk-ny5cyeha.js.map +10 -0
- package/bin/chunk-p3nkd9t2.js.map +10 -0
- package/bin/chunk-p3pr1t3k.js.map +10 -0
- package/bin/chunk-p7j7e7hb.js.map +10 -0
- package/bin/chunk-p89bk96c.js.map +10 -0
- package/bin/chunk-pnkd37ss.js.map +20 -0
- package/bin/chunk-prat77ba.js.map +577 -0
- package/bin/chunk-q6nf6fka.js.map +10 -0
- package/bin/chunk-qbpebjh2.js.map +10 -0
- package/bin/chunk-qzx2gre7.js.map +13 -0
- package/bin/chunk-r55kafff.js.map +9 -0
- package/bin/chunk-rrwp4x01.js.map +10 -0
- package/bin/chunk-rt02k446.js.map +11 -0
- package/bin/chunk-s39nwv01.js.map +9 -0
- package/bin/chunk-s983v0dp.js.map +10 -0
- package/bin/chunk-san15sca.js.map +10 -0
- package/bin/chunk-sfk73pp2.js.map +10 -0
- package/bin/chunk-sjd3wbjd.js.map +10 -0
- package/bin/chunk-swbdmja3.js.map +10 -0
- package/bin/chunk-tc8tvjey.js.map +33 -0
- package/bin/chunk-tcqtz83b.js.map +10 -0
- package/bin/chunk-tgxxchfy.js.map +28 -0
- package/bin/chunk-tvxakxv2.js.map +10 -0
- package/bin/chunk-v81ta3tx.js.map +15 -0
- package/bin/chunk-va2h4xya.js.map +37 -0
- package/bin/chunk-vezq3hc4.js.map +9 -0
- package/bin/chunk-vmbpvmpg.js.map +10 -0
- package/bin/chunk-w7p62pb6.js.map +17 -0
- package/bin/chunk-wr4x72qd.js.map +13 -0
- package/bin/chunk-x3ywttp7.js.map +10 -0
- package/bin/chunk-x988wmrk.js.map +10 -0
- package/bin/chunk-x9zjg1f7.js.map +20 -0
- package/bin/chunk-xaqrhtz6.js.map +10 -0
- package/bin/chunk-xd2mrkwy.js.map +10 -0
- package/bin/chunk-xfh2377b.js.map +10 -0
- package/bin/chunk-xs0ras4j.js.map +51 -0
- package/bin/chunk-xt7ap9fb.js.map +10 -0
- package/bin/chunk-xya5qk3h.js.map +16 -0
- package/bin/chunk-yg7w4jgd.js.map +10 -0
- package/bin/chunk-yhpv46tb.js.map +20 -0
- package/bin/chunk-ymy66kr8.js.map +15 -0
- package/bin/chunk-yx4z6xsb.js.map +11 -0
- package/bin/chunk-yymwxqpy.js.map +10 -0
- package/bin/chunk-z70c75xe.js.map +11 -0
- package/bin/chunk-zkqyr3hc.js.map +10 -0
- package/bin/index.js.map +12 -0
- package/bin/lildax +0 -0
- package/package.json +15 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.bun/ini@7.0.0/node_modules/ini/lib/ini.js", "../../node_modules/.bun/toml@4.1.1/node_modules/toml/lib/parser.js", "../../node_modules/.bun/toml@4.1.1/node_modules/toml/lib/compiler.js", "../../node_modules/.bun/toml@4.1.1/node_modules/toml/index.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/visit.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/directives.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/anchors.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/applyReviver.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/toJS.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Node.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Alias.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Scalar.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/createNode.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Collection.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyComment.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/foldFlowLines.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyString.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringify.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyPair.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/log.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/merge.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/addPairToJSMap.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Pair.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLMap.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/map.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLSeq.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/seq.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/string.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/null.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/bool.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyNumber.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/float.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/int.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/schema.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/json/schema.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/binary.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/pairs.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/omap.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/bool.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/float.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/int.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/set.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/schema.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/tags.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/Schema.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/Document.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/errors.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-props.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-contains-newline.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-flow-indent-check.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-map-includes.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-map.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-seq.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-end.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-collection.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-collection.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-scalar.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-scalar.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-scalar.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-empty-scalar-position.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-node.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-doc.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/composer.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-scalar.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-visit.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/lexer.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/line-counter.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/parser.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/public-api.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/Runtime.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/CliError.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Primitive.js", "../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/Terminal.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/ansi.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Prompt.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Param.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Argument.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Flag.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/Console.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/Stdio.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/CliOutput.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/completions/bash.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/completions/fish.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/completions/zsh.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Completions.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/config.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/command.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/completions/descriptor.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/help.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/GlobalFlag.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/lexer.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/auto-suggest.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/internal/parser.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/cli/Command.js", "src/framework/spec.ts", "src/commands/commands.ts", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Etag.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Cookies.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Headers.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClientError.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/UrlParams.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpBody.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpMethod.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClientRequest.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpIncomingMessage.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClientResponse.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpTraceContext.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClient.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/ErrorReporter.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Template.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerResponse.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpPlatform.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServer.js", "../../node_modules/.bun/find-my-way-ts@0.1.6/node_modules/find-my-way-ts/dist/esm/QueryString.js", "../../node_modules/.bun/find-my-way-ts@0.1.6/node_modules/find-my-way-ts/dist/esm/internal/router.js", "../../node_modules/.bun/find-my-way-ts@0.1.6/node_modules/find-my-way-ts/dist/esm/index.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerRespondable.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerError.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/socket/Socket.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/contentType.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/headers.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/search.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/multipart.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/index.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Multipart.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerRequest.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/internal/preResponseHandler.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpMiddleware.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpEffect.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpRouter.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/FetchHttpClient.js", "../core/src/global.ts", "../../node_modules/.bun/xdg-basedir@5.1.0/node_modules/xdg-basedir/index.js", "../core/src/util/flock.ts", "../core/src/util/hash.ts", "../core/src/flag/flag.ts", "../sdk/js/src/v2/gen/core/serverSentEvents.gen.ts", "../sdk/js/src/v2/gen/core/pathSerializer.gen.ts", "../sdk/js/src/v2/gen/core/utils.gen.ts", "../sdk/js/src/v2/gen/core/auth.gen.ts", "../sdk/js/src/v2/gen/core/bodySerializer.gen.ts", "../sdk/js/src/v2/gen/client/utils.gen.ts", "../sdk/js/src/v2/gen/client/client.gen.ts", "../sdk/js/src/v2/gen/core/params.gen.ts", "../sdk/js/src/v2/gen/client.gen.ts", "../sdk/js/src/v2/gen/sdk.gen.ts", "../sdk/js/src/error-interceptor.ts", "../sdk/js/src/v2/client.ts", "../server/src/auth.ts", "src/services/daemon.ts", "src/framework/runtime.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"const { hasOwnProperty } = Object.prototype\n\nconst encode = (obj, opt = {}) => {\n if (typeof opt === 'string') {\n opt = { section: opt }\n }\n opt.align = opt.align === true\n opt.newline = opt.newline === true\n opt.sort = opt.sort === true\n opt.whitespace = opt.whitespace === true || opt.align === true\n // The `typeof` check is required because accessing the `process` directly fails on browsers.\n /* istanbul ignore next */\n opt.platform = opt.platform || (typeof process !== 'undefined' && process.platform)\n opt.bracketedArray = opt.bracketedArray !== false\n\n /* istanbul ignore next */\n const eol = opt.platform === 'win32' ? '\\r\\n' : '\\n'\n const separator = opt.whitespace ? ' = ' : '='\n const children = []\n\n const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj)\n\n let padToChars = 0\n // If aligning on the separator, then padToChars is determined as follows:\n // 1. Get the keys\n // 2. Exclude keys pointing to objects unless the value is null or an array\n // 3. Add `[]` to array keys\n // 4. Ensure non empty set of keys\n // 5. Reduce the set to the longest `safe` key\n // 6. Get the `safe` length\n if (opt.align) {\n padToChars = safe(\n (\n keys\n .filter(k => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== 'object')\n .map(k => Array.isArray(obj[k]) ? `${k}[]` : k)\n )\n .concat([''])\n .reduce((a, b) => safe(a).length >= safe(b).length ? a : b)\n ).length\n }\n\n let out = ''\n const arraySuffix = opt.bracketedArray ? '[]' : ''\n\n for (const k of keys) {\n const val = obj[k]\n if (val && Array.isArray(val)) {\n for (const item of val) {\n out += safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + separator + safe(item) + eol\n }\n } else if (val && typeof val === 'object') {\n children.push(k)\n } else {\n out += safe(k).padEnd(padToChars, ' ') + separator + safe(val) + eol\n }\n }\n\n if (opt.section && out.length) {\n out = '[' + safe(opt.section) + ']' + (opt.newline ? eol + eol : eol) + out\n }\n\n for (const k of children) {\n const nk = splitSections(k, '.').join('\\\\.')\n const section = (opt.section ? opt.section + '.' : '') + nk\n const child = encode(obj[k], {\n ...opt,\n section,\n })\n if (out.length && child.length) {\n out += eol\n }\n\n out += child\n }\n\n return out\n}\n\nfunction splitSections (str, separator) {\n var lastMatchIndex = 0\n var lastSeparatorIndex = 0\n var nextIndex = 0\n var sections = []\n\n do {\n nextIndex = str.indexOf(separator, lastMatchIndex)\n\n if (nextIndex !== -1) {\n lastMatchIndex = nextIndex + separator.length\n\n if (nextIndex > 0 && str[nextIndex - 1] === '\\\\') {\n continue\n }\n\n sections.push(str.slice(lastSeparatorIndex, nextIndex))\n lastSeparatorIndex = nextIndex + separator.length\n }\n } while (nextIndex !== -1)\n\n sections.push(str.slice(lastSeparatorIndex))\n\n return sections\n}\n\nconst decode = (str, opt = {}) => {\n opt.bracketedArray = opt.bracketedArray !== false\n const out = Object.create(null)\n let p = out\n let section = null\n // section |key = value\n const re = /^\\[([^\\]]*)\\]\\s*$|^([^=]+)(=(.*))?$/i\n const lines = str.split(/[\\r\\n]+/g)\n const duplicates = {}\n\n for (const line of lines) {\n if (!line || line.match(/^\\s*[;#]/) || line.match(/^\\s*$/)) {\n continue\n }\n const match = line.match(re)\n if (!match) {\n continue\n }\n if (match[1] !== undefined) {\n section = unsafe(match[1])\n if (section === '__proto__') {\n // not allowed\n // keep parsing the section, but don't attach it.\n p = Object.create(null)\n continue\n }\n p = out[section] = out[section] || Object.create(null)\n continue\n }\n const keyRaw = unsafe(match[2])\n let isArray\n if (opt.bracketedArray) {\n isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'\n } else {\n duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1\n isArray = duplicates[keyRaw] > 1\n }\n const key = isArray && keyRaw.endsWith('[]')\n ? keyRaw.slice(0, -2) : keyRaw\n\n if (key === '__proto__') {\n continue\n }\n const valueRaw = match[3] ? unsafe(match[4]) : true\n const value = valueRaw === 'true' ||\n valueRaw === 'false' ||\n valueRaw === 'null' ? JSON.parse(valueRaw)\n : valueRaw\n\n // Convert keys with '[]' suffix to an array\n if (isArray) {\n if (!hasOwnProperty.call(p, key)) {\n p[key] = []\n } else if (!Array.isArray(p[key])) {\n p[key] = [p[key]]\n }\n }\n\n // safeguard against resetting a previously defined\n // array by accidentally forgetting the brackets\n if (Array.isArray(p[key])) {\n p[key].push(value)\n } else {\n p[key] = value\n }\n }\n\n // {a:{y:1},\"a.b\":{x:2}} --> {a:{y:1,b:{x:2}}}\n // use a filter to return the keys that have to be deleted.\n const remove = []\n for (const k of Object.keys(out)) {\n if (!hasOwnProperty.call(out, k) ||\n typeof out[k] !== 'object' ||\n Array.isArray(out[k])) {\n continue\n }\n\n // see if the parent section is also an object.\n // if so, add it to that, and mark this one for deletion\n const parts = splitSections(k, '.')\n p = out\n const l = parts.pop()\n const nl = l.replace(/\\\\\\./g, '.')\n for (const part of parts) {\n if (part === '__proto__') {\n continue\n }\n if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {\n p[part] = Object.create(null)\n }\n p = p[part]\n }\n if (p === out && nl === l) {\n continue\n }\n\n p[nl] = out[k]\n remove.push(k)\n }\n for (const del of remove) {\n delete out[del]\n }\n\n return out\n}\n\nconst isQuoted = val => {\n return (val.startsWith('\"') && val.endsWith('\"')) ||\n (val.startsWith(\"'\") && val.endsWith(\"'\"))\n}\n\nconst safe = val => {\n if (\n typeof val !== 'string' ||\n val.match(/[=\\r\\n]/) ||\n val.match(/^\\[/) ||\n (val.length > 1 && isQuoted(val)) ||\n val !== val.trim()\n ) {\n return JSON.stringify(val)\n }\n return val.split(';').join('\\\\;').split('#').join('\\\\#')\n}\n\nconst unsafe = val => {\n val = (val || '').trim()\n if (isQuoted(val)) {\n // remove the single quotes before calling JSON.parse\n if (val.charAt(0) === \"'\") {\n val = val.slice(1, -1)\n }\n try {\n val = JSON.parse(val)\n } catch {\n // ignore errors\n }\n } else {\n // walk the val to find the first not-escaped ; character\n let esc = false\n let unesc = ''\n for (let i = 0, l = val.length; i < l; i++) {\n const c = val.charAt(i)\n if (esc) {\n if ('\\\\;#'.indexOf(c) !== -1) {\n unesc += c\n } else {\n unesc += '\\\\' + c\n }\n\n esc = false\n } else if (';#'.indexOf(c) !== -1) {\n break\n } else if (c === '\\\\') {\n esc = true\n } else {\n unesc += c\n }\n }\n if (esc) {\n unesc += '\\\\'\n }\n\n return unesc.trim()\n }\n return val\n}\n\nmodule.exports = {\n parse: decode,\n decode,\n stringify: encode,\n encode,\n safe,\n unsafe,\n}\n",
|
|
6
|
+
"// @generated by Peggy 5.1.0.\n//\n// https://peggyjs.org/\n\n\"use strict\";\n\nclass peg$SyntaxError extends SyntaxError {\n constructor(message, expected, found, location) {\n super(message);\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n }\n\n format(sources) {\n let str = \"Error: \" + this.message;\n if (this.location) {\n let src = null;\n const st = sources.find(s => s.source === this.location.source);\n if (st) {\n src = st.text.split(/\\r\\n|\\n|\\r/g);\n }\n const s = this.location.start;\n const offset_s = (this.location.source && (typeof this.location.source.offset === \"function\"))\n ? this.location.source.offset(s)\n : s;\n const loc = this.location.source + \":\" + offset_s.line + \":\" + offset_s.column;\n if (src) {\n const e = this.location.end;\n const filler = \"\".padEnd(offset_s.line.toString().length, \" \");\n const line = src[s.line - 1];\n const last = s.line === e.line ? e.column : line.length + 1;\n const hatLen = (last - s.column) || 1;\n str += \"\\n --> \" + loc + \"\\n\"\n + filler + \" |\\n\"\n + offset_s.line + \" | \" + line + \"\\n\"\n + filler + \" | \" + \"\".padEnd(s.column - 1, \" \")\n + \"\".padEnd(hatLen, \"^\");\n } else {\n str += \"\\n at \" + loc;\n }\n }\n return str;\n }\n\n static buildMessage(expected, found) {\n function hex(ch) {\n return ch.codePointAt(0).toString(16).toUpperCase();\n }\n\n const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, \"unicode\")\n ? new RegExp(\"[\\\\p{C}\\\\p{Mn}\\\\p{Mc}]\", \"gu\")\n : null;\n function unicodeEscape(s) {\n if (nonPrintable) {\n return s.replace(nonPrintable, ch => \"\\\\u{\" + hex(ch) + \"}\");\n }\n return s;\n }\n\n function literalEscape(s) {\n return unicodeEscape(s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, \"\\\\\\\"\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, ch => \"\\\\x0\" + hex(ch))\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, ch => \"\\\\x\" + hex(ch)));\n }\n\n function classEscape(s) {\n return unicodeEscape(s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\]/g, \"\\\\]\")\n .replace(/\\^/g, \"\\\\^\")\n .replace(/-/g, \"\\\\-\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, ch => \"\\\\x0\" + hex(ch))\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, ch => \"\\\\x\" + hex(ch)));\n }\n\n const DESCRIBE_EXPECTATION_FNS = {\n literal(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n class(expectation) {\n const escapedParts = expectation.parts.map(\n part => (Array.isArray(part)\n ? classEscape(part[0]) + \"-\" + classEscape(part[1])\n : classEscape(part))\n );\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts.join(\"\") + \"]\" + (expectation.unicode ? \"u\" : \"\");\n },\n\n any() {\n return \"any character\";\n },\n\n end() {\n return \"end of input\";\n },\n\n other(expectation) {\n return expectation.description;\n },\n };\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n const descriptions = expected.map(describeExpectation);\n descriptions.sort();\n\n if (descriptions.length > 0) {\n let j = 1;\n for (let i = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n }\n}\n\nfunction peg$parse(input, options) {\n options = options !== undefined ? options : {};\n\n const peg$FAILED = {};\n const peg$source = options.grammarSource;\n\n const peg$startRuleFunctions = {\n start: peg$parsestart,\n };\n let peg$startRuleFunction = peg$parsestart;\n\n const peg$c0 = \"#\";\n const peg$c1 = \"[\";\n const peg$c2 = \"]\";\n const peg$c3 = \".\";\n const peg$c4 = \"=\";\n const peg$c5 = \"inf\";\n const peg$c6 = \"nan\";\n const peg$c7 = \"\\\"\\\"\\\"\";\n const peg$c8 = \"\\\"\";\n const peg$c9 = \"'''\";\n const peg$c10 = \"'\";\n const peg$c11 = \"\\\\\";\n const peg$c12 = \"\\r\\n\";\n const peg$c13 = \"\\\"\\\"\";\n const peg$c14 = \"''\";\n const peg$c15 = \"0\";\n const peg$c16 = \"0x\";\n const peg$c17 = \"0o\";\n const peg$c18 = \"0b\";\n const peg$c19 = \"true\";\n const peg$c20 = \"false\";\n const peg$c21 = \",\";\n const peg$c22 = \"{\";\n const peg$c23 = \"}\";\n const peg$c24 = \"-\";\n const peg$c25 = \":\";\n const peg$c26 = \"z\";\n const peg$c27 = \"t\";\n const peg$c28 = \" \";\n const peg$c29 = \"\\n\";\n const peg$c30 = \"\\r\";\n const peg$c31 = \"\\\\U\";\n const peg$c32 = \"\\\\u\";\n const peg$c33 = \"\\\\x\";\n\n const peg$r0 = /^[\\t -~\\x80-\\uFFFF]/;\n const peg$r1 = /^[+\\-]/;\n const peg$r2 = /^[^\"\\\\\\0-\\b\\v-\\x1F\\x7F\\r]/;\n const peg$r3 = /^[^'\\0-\\b\\v-\\x1F\\x7F\\r]/;\n const peg$r4 = /^[^\"\\\\\\0-\\b\\n-\\x1F\\x7F]/;\n const peg$r5 = /^[^'\\0-\\b\\n-\\x1F\\x7F]/;\n const peg$r6 = /^[eE]/;\n const peg$r7 = /^[0-9_]/;\n const peg$r8 = /^[1-9]/;\n const peg$r9 = /^[_]/;\n const peg$r10 = /^[0-9]/;\n const peg$r11 = /^[0-9a-fA-F]/;\n const peg$r12 = /^[0-7]/;\n const peg$r13 = /^[01]/;\n const peg$r14 = /^[ \\t]/;\n const peg$r15 = /^[A-Za-z0-9_\\-]/;\n const peg$r16 = /^[\"\\\\btnfre]/;\n\n const peg$e0 = peg$literalExpectation(\"#\", false);\n const peg$e1 = peg$classExpectation([\"\\t\", [\" \", \"~\"], [\"\\x80\", \"\\uFFFF\"]], false, false, false);\n const peg$e2 = peg$literalExpectation(\"[\", false);\n const peg$e3 = peg$literalExpectation(\"]\", false);\n const peg$e4 = peg$literalExpectation(\".\", false);\n const peg$e5 = peg$literalExpectation(\"=\", false);\n const peg$e6 = peg$classExpectation([\"+\", \"-\"], false, false, false);\n const peg$e7 = peg$literalExpectation(\"inf\", false);\n const peg$e8 = peg$literalExpectation(\"nan\", false);\n const peg$e9 = peg$literalExpectation(\"\\\"\\\"\\\"\", false);\n const peg$e10 = peg$literalExpectation(\"\\\"\", false);\n const peg$e11 = peg$literalExpectation(\"'''\", false);\n const peg$e12 = peg$literalExpectation(\"'\", false);\n const peg$e13 = peg$literalExpectation(\"\\\\\", false);\n const peg$e14 = peg$anyExpectation();\n const peg$e15 = peg$literalExpectation(\"\\r\\n\", false);\n const peg$e16 = peg$classExpectation([\"\\\"\", \"\\\\\", [\"\\0\", \"\\b\"], [\"\\v\", \"\\x1F\"], \"\\x7F\", \"\\r\"], true, false, false);\n const peg$e17 = peg$literalExpectation(\"\\\"\\\"\", false);\n const peg$e18 = peg$classExpectation([\"'\", [\"\\0\", \"\\b\"], [\"\\v\", \"\\x1F\"], \"\\x7F\", \"\\r\"], true, false, false);\n const peg$e19 = peg$literalExpectation(\"''\", false);\n const peg$e20 = peg$classExpectation([\"\\\"\", \"\\\\\", [\"\\0\", \"\\b\"], [\"\\n\", \"\\x1F\"], \"\\x7F\"], true, false, false);\n const peg$e21 = peg$classExpectation([\"'\", [\"\\0\", \"\\b\"], [\"\\n\", \"\\x1F\"], \"\\x7F\"], true, false, false);\n const peg$e22 = peg$classExpectation([\"e\", \"E\"], false, false, false);\n const peg$e23 = peg$literalExpectation(\"0\", false);\n const peg$e24 = peg$literalExpectation(\"0x\", false);\n const peg$e25 = peg$literalExpectation(\"0o\", false);\n const peg$e26 = peg$literalExpectation(\"0b\", false);\n const peg$e27 = peg$classExpectation([[\"0\", \"9\"], \"_\"], false, false, false);\n const peg$e28 = peg$classExpectation([[\"1\", \"9\"]], false, false, false);\n const peg$e29 = peg$classExpectation([\"_\"], false, false, false);\n const peg$e30 = peg$classExpectation([[\"0\", \"9\"]], false, false, false);\n const peg$e31 = peg$classExpectation([[\"0\", \"9\"], [\"a\", \"f\"], [\"A\", \"F\"]], false, false, false);\n const peg$e32 = peg$classExpectation([[\"0\", \"7\"]], false, false, false);\n const peg$e33 = peg$classExpectation([\"0\", \"1\"], false, false, false);\n const peg$e34 = peg$literalExpectation(\"true\", false);\n const peg$e35 = peg$literalExpectation(\"false\", false);\n const peg$e36 = peg$literalExpectation(\",\", false);\n const peg$e37 = peg$literalExpectation(\"{\", false);\n const peg$e38 = peg$literalExpectation(\"}\", false);\n const peg$e39 = peg$literalExpectation(\"-\", false);\n const peg$e40 = peg$literalExpectation(\":\", false);\n const peg$e41 = peg$literalExpectation(\"Z\", true);\n const peg$e42 = peg$literalExpectation(\"T\", true);\n const peg$e43 = peg$literalExpectation(\" \", false);\n const peg$e44 = peg$classExpectation([\" \", \"\\t\"], false, false, false);\n const peg$e45 = peg$literalExpectation(\"\\n\", false);\n const peg$e46 = peg$literalExpectation(\"\\r\", false);\n const peg$e47 = peg$classExpectation([[\"A\", \"Z\"], [\"a\", \"z\"], [\"0\", \"9\"], \"_\", \"-\"], false, false, false);\n const peg$e48 = peg$classExpectation([\"\\\"\", \"\\\\\", \"b\", \"t\", \"n\", \"f\", \"r\", \"e\"], false, false, false);\n const peg$e49 = peg$literalExpectation(\"\\\\U\", false);\n const peg$e50 = peg$literalExpectation(\"\\\\u\", false);\n const peg$e51 = peg$literalExpectation(\"\\\\x\", false);\n\n function peg$f0() { return nodes }\n function peg$f1(name) { addNode(node('ArrayPath', name, offset())) }\n function peg$f2(name) { addNode(node('ObjectPath', name, offset())) }\n function peg$f3(parts, name) { return parts.concat(name) }\n function peg$f4(name) { return [name] }\n function peg$f5(name) { return name }\n function peg$f6(name) { return name }\n function peg$f7(keys, value) { addNode(node('Assign', value, offset(), keys)) }\n function peg$f8(node) { return node.value }\n function peg$f9(node) { return node.value }\n function peg$f10(sign) { return node('Float', sign === '-' ? -Infinity : Infinity, offset()) }\n function peg$f11(sign) { return node('Float', NaN, offset()) }\n function peg$f12(body) { return node('String', body, offset()) }\n function peg$f13(chars) { return node('String', chars.join(''), offset()) }\n function peg$f14(body) { return node('String', body, offset()) }\n function peg$f15(chars) { return node('String', chars.join(''), offset()) }\n function peg$f16(head, parts, tail) {\n var result = head.join('');\n for (var i = 0; i < parts.length; i++) { result += parts[i][0] + parts[i][1].join(''); }\n return result + (tail || '');\n }\n function peg$f17() { genError(\"Invalid escape sequence\", offset()) }\n function peg$f18() { return \"\\n\" }\n function peg$f19() { return '' }\n function peg$f20() { return '\"\"' }\n function peg$f21() { return '\"' }\n function peg$f22() { return '\"\"' }\n function peg$f23() { return '\"' }\n function peg$f24(head, parts, tail) {\n var result = head.join('');\n for (var i = 0; i < parts.length; i++) { result += parts[i][0] + parts[i][1].join(''); }\n return result + (tail || '');\n }\n function peg$f25() { return \"\\n\" }\n function peg$f26() { return \"''\" }\n function peg$f27() { return \"'\" }\n function peg$f28() { return \"''\" }\n function peg$f29() { return \"'\" }\n function peg$f30() { genError(\"Invalid escape sequence\", offset()) }\n function peg$f31(left, right) { return node('Float', parseFloat(stripUnderscores(left + 'e' + right)), offset()) }\n function peg$f32(text) { return node('Float', parseFloat(stripUnderscores(text)), offset()) }\n function peg$f33(sign, digits, frac) { return (sign === '-' ? '-' : '') + digits + '.' + frac }\n function peg$f34(sign, digits, frac) { return (sign === '-' ? '-' : '') + digits + '.' + frac }\n function peg$f35(sign, digits) { return (sign === '-' ? '-' : '') + digits }\n function peg$f36() { return '0' }\n function peg$f37(sign, digits) { return (sign || '') + digits }\n function peg$f38(digits) { return node('Integer', parseInt(stripUnderscores(digits), 16), offset()) }\n function peg$f39(digits) { return node('Integer', parseInt(stripUnderscores(digits), 8), offset()) }\n function peg$f40(digits) { return node('Integer', parseInt(stripUnderscores(digits), 2), offset()) }\n function peg$f41(text) { return node('Integer', parseInt(stripUnderscores(text), 10), offset()) }\n function peg$f42(sign) { return (sign || '') + '0' }\n function peg$f43(sign, digits) { return (sign || '') + digits }\n function peg$f44() { return node('Boolean', true, offset()) }\n function peg$f45() { return node('Boolean', false, offset()) }\n function peg$f46() { return node('Array', [], offset()) }\n function peg$f47(head, v) { return v }\n function peg$f48(head, tail) {\n tail.unshift(head); return node('Array', tail, offset())\n }\n function peg$f49() { return node('InlineTable', [], offset()) }\n function peg$f50(head, e) { return e }\n function peg$f51(head, tail) {\n tail.unshift(head); return node('InlineTable', tail, offset())\n }\n function peg$f52(keys, value) { return node('InlineTableValue', value, offset(), keys) }\n function peg$f53(parts, last) { return parts.concat(last) }\n function peg$f54(k) { return [k] }\n function peg$f55(k) { return k }\n function peg$f56(t, frac) { return frac ? t + frac : t }\n function peg$f57(t) { return t + ':00' }\n function peg$f58() { return \"Z\" }\n function peg$f59(d, t, o) { var off = offset(); validateDate(d, off); validateTime(t, off); validateOffset(o, off); return node('Date', new Date(d + \"T\" + t + o), off) }\n function peg$f60(d, t) { var off = offset(); validateDate(d, off); validateTime(t, off); return node('LocalDateTime', d + \"T\" + t, off) }\n function peg$f61(d) { var off = offset(); validateDate(d, off); return node('LocalDate', d, off) }\n function peg$f62(t) { var off = offset(); validateTime(t, off); return node('LocalTime', t, off) }\n function peg$f63(ch) { return ch === 'n' ? '\\n' : ch === 't' ? '\\t' : ch === 'r' ? '\\r' : ch === '\\\\' ? '\\\\' : ch === '\"' ? '\"' : ch === 'b' ? '\\b' : ch === 'f' ? '\\f' : '\\x1B' }\n function peg$f64(digits) { return convertCodePoint(digits) }\n function peg$f65(digits) { return convertCodePoint(digits) }\n function peg$f66(digits) { return convertCodePoint(digits) }\n let peg$currPos = options.peg$currPos | 0;\n let peg$savedPos = peg$currPos;\n const peg$posDetailsCache = [{ line: 1, column: 1 }];\n let peg$maxFailPos = peg$currPos;\n let peg$maxFailExpected = options.peg$maxFailExpected || [];\n let peg$silentFails = options.peg$silentFails | 0;\n\n let peg$result;\n\n if (options.startRule) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function offset() {\n return peg$savedPos;\n }\n\n function range() {\n return {\n source: peg$source,\n start: peg$savedPos,\n end: peg$currPos,\n };\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== undefined\n ? location\n : peg$computeLocation(peg$savedPos, peg$currPos);\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$getUnicode(pos = peg$currPos) {\n const cp = input.codePointAt(pos);\n if (cp === undefined) {\n return \"\";\n }\n return String.fromCodePoint(cp);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text, ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase, unicode) {\n return { type: \"class\", parts, inverted, ignoreCase, unicode };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description };\n }\n\n function peg$computePosDetails(pos) {\n let details = peg$posDetailsCache[pos];\n let p;\n\n if (details) {\n return details;\n } else {\n if (pos >= peg$posDetailsCache.length) {\n p = peg$posDetailsCache.length - 1;\n } else {\n p = pos;\n while (!peg$posDetailsCache[--p]) {}\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column,\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos, offset) {\n const startPosDetails = peg$computePosDetails(startPos);\n const endPosDetails = peg$computePosDetails(endPos);\n\n const res = {\n source: peg$source,\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column,\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column,\n },\n };\n if (offset && peg$source && (typeof peg$source.offset === \"function\")) {\n res.start = peg$source.offset(res.start);\n res.end = peg$source.offset(res.end);\n }\n return res;\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsestart() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseline();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseline();\n }\n peg$savedPos = s0;\n s1 = peg$f0();\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseline() {\n let s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseS();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseS();\n }\n s2 = peg$parseexpression();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseS();\n }\n s4 = peg$parsecomment();\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = [];\n s6 = peg$parseNL();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseNL();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 === peg$FAILED) {\n s5 = peg$parseEOF();\n }\n if (s5 !== peg$FAILED) {\n s1 = [s1, s2, s3, s4, s5];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseS();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseS();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseNL();\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseNL();\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 === peg$FAILED) {\n s2 = peg$parseEOF();\n }\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseNL();\n }\n }\n\n return s0;\n }\n\n function peg$parseexpression() {\n let s0;\n\n s0 = peg$parsecomment();\n if (s0 === peg$FAILED) {\n s0 = peg$parsetable_or_array_path();\n if (s0 === peg$FAILED) {\n s0 = peg$parseassignment();\n }\n }\n\n return s0;\n }\n\n function peg$parsecomment() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c0;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e0); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = input.charAt(peg$currPos);\n if (peg$r0.test(s3)) {\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e1); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = input.charAt(peg$currPos);\n if (peg$r0.test(s3)) {\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e1); }\n }\n }\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsetable_or_array_path() {\n let s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c1;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s2 = peg$c1;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseS();\n }\n s4 = peg$parsetable_key();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseS();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseS();\n }\n if (input.charCodeAt(peg$currPos) === 93) {\n s6 = peg$c2;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s7 = peg$c2;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f1(s4);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c1;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseS();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseS();\n }\n s3 = peg$parsetable_key();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseS();\n }\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c2;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f2(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsetable_key() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsedot_ended_table_key_part();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsedot_ended_table_key_part();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsetable_key_part();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f3(s1, s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsetable_key_part();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f4(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsetable_key_part() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseS();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseS();\n }\n s2 = peg$parsesimple_key();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseS();\n }\n peg$savedPos = s0;\n s0 = peg$f5(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsedot_ended_table_key_part() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseS();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseS();\n }\n s2 = peg$parsesimple_key();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseS();\n }\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c3;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f6(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseassignment() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$parseinline_key();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseS();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseS();\n }\n if (input.charCodeAt(peg$currPos) === 61) {\n s3 = peg$c4;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseS();\n }\n s5 = peg$parsevalue();\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f7(s1, s5);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsekey() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseASCII_BASIC();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseASCII_BASIC();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsequoted_key() {\n let s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parsedouble_quoted_single_line_string();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f8(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsesingle_quoted_single_line_string();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f9(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsevalue() {\n let s0;\n\n s0 = peg$parsestring();\n if (s0 === peg$FAILED) {\n s0 = peg$parsenumber_or_date();\n if (s0 === peg$FAILED) {\n s0 = peg$parseboolean();\n if (s0 === peg$FAILED) {\n s0 = peg$parsearray();\n if (s0 === peg$FAILED) {\n s0 = peg$parseinline_table();\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsenumber_or_date() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (input.substr(peg$currPos, 3) === peg$c5) {\n s2 = peg$c5;\n peg$currPos += 3;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e7); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f10(s1);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (input.substr(peg$currPos, 3) === peg$c6) {\n s2 = peg$c6;\n peg$currPos += 3;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e8); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f11(s1);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parsedatetime();\n if (s0 === peg$FAILED) {\n s0 = peg$parsefloat();\n if (s0 === peg$FAILED) {\n s0 = peg$parseinteger();\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsestring() {\n let s0;\n\n s0 = peg$parsedouble_quoted_multiline_string();\n if (s0 === peg$FAILED) {\n s0 = peg$parsedouble_quoted_single_line_string();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesingle_quoted_multiline_string();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesingle_quoted_single_line_string();\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsedouble_quoted_multiline_string() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c7) {\n s1 = peg$c7;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNL();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n s3 = peg$parsemlb_body();\n if (input.substr(peg$currPos, 3) === peg$c7) {\n s4 = peg$c7;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f12(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsedouble_quoted_single_line_string() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c8;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsestring_char();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsestring_char();\n }\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c8;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f13(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesingle_quoted_multiline_string() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c9) {\n s1 = peg$c9;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseNL();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n s3 = peg$parsemll_body();\n if (input.substr(peg$currPos, 3) === peg$c9) {\n s4 = peg$c9;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f14(s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesingle_quoted_single_line_string() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c10;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseliteral_char();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseliteral_char();\n }\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c10;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f15(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsemlb_body() {\n let s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsemlb_content();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsemlb_content();\n }\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parsemlb_quotes();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parsemlb_content();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parsemlb_content();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parsemlb_quotes();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parsemlb_content();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parsemlb_content();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s3 = peg$parsemlb_trailing();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n peg$savedPos = s0;\n s0 = peg$f16(s1, s2, s3);\n\n return s0;\n }\n\n function peg$parsemlb_content() {\n let s0, s1, s2;\n\n s0 = peg$parseESCAPED();\n if (s0 === peg$FAILED) {\n s0 = peg$parsemlb_escaped_newline();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c11;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e13); }\n }\n if (s1 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e14); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f17();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c12) {\n s1 = peg$c12;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e15); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f18();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r2.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e16); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r2.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e16); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsemlb_escaped_newline() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c11;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e13); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseS();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseS();\n }\n s3 = peg$parseNL();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseNLS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseNLS();\n }\n peg$savedPos = s0;\n s0 = peg$f19();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsemlb_quotes() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c13) {\n s1 = peg$c13;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e17); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c8;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n peg$silentFails--;\n if (s3 === peg$FAILED) {\n s2 = undefined;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f20();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c8;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c8;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n peg$silentFails--;\n if (s3 === peg$FAILED) {\n s2 = undefined;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f21();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsemlb_trailing() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c13) {\n s1 = peg$c13;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e17); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.substr(peg$currPos, 3) === peg$c7) {\n s3 = peg$c7;\n peg$currPos += 3;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n peg$silentFails--;\n if (s3 !== peg$FAILED) {\n peg$currPos = s2;\n s2 = undefined;\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f22();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c8;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e10); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.substr(peg$currPos, 3) === peg$c7) {\n s3 = peg$c7;\n peg$currPos += 3;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e9); }\n }\n peg$silentFails--;\n if (s3 !== peg$FAILED) {\n peg$currPos = s2;\n s2 = undefined;\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f23();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsemll_body() {\n let s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsemll_content();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsemll_content();\n }\n s2 = [];\n s3 = peg$currPos;\n s4 = peg$parsemll_quotes();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parsemll_content();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parsemll_content();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = peg$parsemll_quotes();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parsemll_content();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parsemll_content();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s3 = peg$parsemll_trailing();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n peg$savedPos = s0;\n s0 = peg$f24(s1, s2, s3);\n\n return s0;\n }\n\n function peg$parsemll_content() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c12) {\n s1 = peg$c12;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e15); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f25();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r3.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e18); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r3.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e18); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n\n return s0;\n }\n\n function peg$parsemll_quotes() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c14) {\n s1 = peg$c14;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e19); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c10;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n peg$silentFails--;\n if (s3 === peg$FAILED) {\n s2 = undefined;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f26();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c10;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c10;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n peg$silentFails--;\n if (s3 === peg$FAILED) {\n s2 = undefined;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f27();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsemll_trailing() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c14) {\n s1 = peg$c14;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e19); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.substr(peg$currPos, 3) === peg$c9) {\n s3 = peg$c9;\n peg$currPos += 3;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n peg$silentFails--;\n if (s3 !== peg$FAILED) {\n peg$currPos = s2;\n s2 = undefined;\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f28();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c10;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e12); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.substr(peg$currPos, 3) === peg$c9) {\n s3 = peg$c9;\n peg$currPos += 3;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e11); }\n }\n peg$silentFails--;\n if (s3 !== peg$FAILED) {\n peg$currPos = s2;\n s2 = undefined;\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f29();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsestring_char() {\n let s0, s1, s2;\n\n s0 = peg$parseESCAPED();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c11;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e13); }\n }\n if (s1 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e14); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f30();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r4.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e20); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r4.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e20); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseliteral_char() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = input.charAt(peg$currPos);\n if (peg$r5.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e21); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = input.charAt(peg$currPos);\n if (peg$r5.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e21); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsefloat() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parsefloat_or_int_text();\n if (s1 !== peg$FAILED) {\n s2 = input.charAt(peg$currPos);\n if (peg$r6.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e22); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsefloat_exp_text();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f31(s1, s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefloat_text();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f32(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsefloat_text() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = peg$parseFLOAT_DEC_INT();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c3;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$currPos;\n s5 = peg$parseDEC_DIGIT_SEQ();\n if (s5 !== peg$FAILED) {\n s4 = input.substring(s4, peg$currPos);\n } else {\n s4 = s5;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f33(s1, s2, s4);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsefloat_or_int_text() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = peg$parseFLOAT_DEC_INT();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c3;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$currPos;\n s5 = peg$parseDEC_DIGIT_SEQ();\n if (s5 !== peg$FAILED) {\n s4 = input.substring(s4, peg$currPos);\n } else {\n s4 = s5;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f34(s1, s2, s4);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = peg$parseFLOAT_DEC_INT();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f35(s1, s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseFLOAT_DEC_INT() {\n let s0, s1;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 48) {\n s1 = peg$c15;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e23); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f36();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseDEC_INT_NOZERO_SEQ();\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n\n return s0;\n }\n\n function peg$parsefloat_exp_text() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = peg$currPos;\n s3 = peg$parseDEC_DIGIT_SEQ();\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f37(s1, s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseinteger() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c16) {\n s1 = peg$c16;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e24); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX_DIGIT_SEQ();\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f38(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c17) {\n s1 = peg$c17;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e25); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseOCT_DIGIT_SEQ();\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f39(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c18) {\n s1 = peg$c18;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e26); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseBIN_DIGIT_SEQ();\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f40(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsedec_integer_text();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f41(s1);\n }\n s0 = s1;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsedec_integer_text() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (input.charCodeAt(peg$currPos) === 48) {\n s2 = peg$c15;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e23); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$currPos;\n peg$silentFails++;\n s4 = input.charAt(peg$currPos);\n if (peg$r7.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e27); }\n }\n peg$silentFails--;\n if (s4 === peg$FAILED) {\n s3 = undefined;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c3;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n peg$silentFails--;\n if (s5 === peg$FAILED) {\n s4 = undefined;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f42(s1);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r1.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n s2 = peg$currPos;\n s3 = peg$parseDEC_INT_NOZERO_SEQ();\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c3;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n peg$silentFails--;\n if (s4 === peg$FAILED) {\n s3 = undefined;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f43(s1, s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseDEC_INT_NOZERO_SEQ() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r8.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e28); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r10.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r10.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseDEC_DIGIT_SEQ() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r10.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r10.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r10.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseHEX_DIGIT_SEQ() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r11.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e31); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r11.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e31); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r11.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e31); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseOCT_DIGIT_SEQ() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r12.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e32); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r12.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e32); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r12.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e32); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseBIN_DIGIT_SEQ() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (peg$r13.test(s1)) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e33); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r13.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e33); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = input.charAt(peg$currPos);\n if (peg$r9.test(s4)) {\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e29); }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n s5 = input.charAt(peg$currPos);\n if (peg$r13.test(s5)) {\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e33); }\n }\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseboolean() {\n let s0, s1;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 4) === peg$c19) {\n s1 = peg$c19;\n peg$currPos += 4;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e34); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f44();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 5) === peg$c20) {\n s1 = peg$c20;\n peg$currPos += 5;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e35); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f45();\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsearray() {\n let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c1;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsearray_sep();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsearray_sep();\n }\n if (input.charCodeAt(peg$currPos) === 93) {\n s3 = peg$c2;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f46();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c1;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e2); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsearray_sep();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsearray_sep();\n }\n s3 = peg$parsevalue();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$currPos;\n s6 = [];\n s7 = peg$parsearray_sep();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsearray_sep();\n }\n if (input.charCodeAt(peg$currPos) === 44) {\n s7 = peg$c21;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsearray_sep();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsearray_sep();\n }\n s9 = peg$parsevalue();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s5;\n s5 = peg$f47(s3, s9);\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$currPos;\n s6 = [];\n s7 = peg$parsearray_sep();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsearray_sep();\n }\n if (input.charCodeAt(peg$currPos) === 44) {\n s7 = peg$c21;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsearray_sep();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsearray_sep();\n }\n s9 = peg$parsevalue();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s5;\n s5 = peg$f47(s3, s9);\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n }\n s5 = [];\n s6 = peg$parsearray_sep();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parsearray_sep();\n }\n if (input.charCodeAt(peg$currPos) === 44) {\n s6 = peg$c21;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s6 === peg$FAILED) {\n s6 = null;\n }\n s7 = [];\n s8 = peg$parsearray_sep();\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsearray_sep();\n }\n if (input.charCodeAt(peg$currPos) === 93) {\n s8 = peg$c2;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e3); }\n }\n if (s8 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f48(s3, s4);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsearray_sep() {\n let s0;\n\n s0 = peg$parseS();\n if (s0 === peg$FAILED) {\n s0 = peg$parseNL();\n if (s0 === peg$FAILED) {\n s0 = peg$parsecomment();\n }\n }\n\n return s0;\n }\n\n function peg$parseinline_table() {\n let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c22;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e37); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseinline_sep();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseinline_sep();\n }\n if (input.charCodeAt(peg$currPos) === 125) {\n s3 = peg$c23;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e38); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f49();\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c22;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e37); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseinline_sep();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseinline_sep();\n }\n s3 = peg$parseinline_table_entry();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$currPos;\n s6 = [];\n s7 = peg$parseinline_sep();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parseinline_sep();\n }\n if (input.charCodeAt(peg$currPos) === 44) {\n s7 = peg$c21;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parseinline_sep();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parseinline_sep();\n }\n s9 = peg$parseinline_table_entry();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s5;\n s5 = peg$f50(s3, s9);\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$currPos;\n s6 = [];\n s7 = peg$parseinline_sep();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parseinline_sep();\n }\n if (input.charCodeAt(peg$currPos) === 44) {\n s7 = peg$c21;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parseinline_sep();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parseinline_sep();\n }\n s9 = peg$parseinline_table_entry();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s5;\n s5 = peg$f50(s3, s9);\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n }\n s5 = [];\n s6 = peg$parseinline_sep();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseinline_sep();\n }\n if (input.charCodeAt(peg$currPos) === 44) {\n s6 = peg$c21;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e36); }\n }\n if (s6 === peg$FAILED) {\n s6 = null;\n }\n s7 = [];\n s8 = peg$parseinline_sep();\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parseinline_sep();\n }\n if (input.charCodeAt(peg$currPos) === 125) {\n s8 = peg$c23;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e38); }\n }\n if (s8 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f51(s3, s4);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseinline_table_entry() {\n let s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$parseinline_key();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseS();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseS();\n }\n if (input.charCodeAt(peg$currPos) === 61) {\n s3 = peg$c4;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e5); }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseS();\n }\n s5 = peg$parsevalue();\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f52(s1, s5);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseinline_sep() {\n let s0;\n\n s0 = peg$parseS();\n if (s0 === peg$FAILED) {\n s0 = peg$parseNL();\n if (s0 === peg$FAILED) {\n s0 = peg$parsecomment();\n }\n }\n\n return s0;\n }\n\n function peg$parseinline_key() {\n let s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseinline_dot_key_part();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseinline_dot_key_part();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseS();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseS();\n }\n s3 = peg$parsesimple_key();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f53(s1, s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsesimple_key();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f54(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseinline_dot_key_part() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseS();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseS();\n }\n s2 = peg$parsesimple_key();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseS();\n }\n if (input.charCodeAt(peg$currPos) === 46) {\n s4 = peg$c3;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f55(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesimple_key() {\n let s0;\n\n s0 = peg$parsekey();\n if (s0 === peg$FAILED) {\n s0 = peg$parsequoted_key();\n }\n\n return s0;\n }\n\n function peg$parsesecfragment() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s2 = peg$c3;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e4); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseDIGIT();\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseDIGIT();\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsedate_part() {\n let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$parseDIGIT();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseDIGIT();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseDIGIT();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseDIGIT();\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s6 = peg$c24;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e39); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseDIGIT();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseDIGIT();\n if (s8 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s9 = peg$c24;\n peg$currPos++;\n } else {\n s9 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e39); }\n }\n if (s9 !== peg$FAILED) {\n s10 = peg$parseDIGIT();\n if (s10 !== peg$FAILED) {\n s11 = peg$parseDIGIT();\n if (s11 !== peg$FAILED) {\n s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10, s11];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsetime_part() {\n let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n s3 = peg$parseDIGIT();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseDIGIT();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s5 = peg$c25;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e40); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseDIGIT();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseDIGIT();\n if (s7 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s8 = peg$c25;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e40); }\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parseDIGIT();\n if (s9 !== peg$FAILED) {\n s10 = peg$parseDIGIT();\n if (s10 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6, s7, s8, s9, s10];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsesecfragment();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n peg$savedPos = s0;\n s0 = peg$f56(s1, s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n s3 = peg$parseDIGIT();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseDIGIT();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s5 = peg$c25;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e40); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseDIGIT();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseDIGIT();\n if (s7 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6, s7];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c25;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e40); }\n }\n peg$silentFails--;\n if (s3 === peg$FAILED) {\n s2 = undefined;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f57(s1);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseoffset() {\n let s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = input.charAt(peg$currPos);\n if (s1.toLowerCase() === peg$c26) {\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e41); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f58();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = input.charAt(peg$currPos);\n if (peg$r1.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e6); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parseDIGIT();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseDIGIT();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s5 = peg$c25;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e40); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseDIGIT();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseDIGIT();\n if (s7 !== peg$FAILED) {\n s2 = [s2, s3, s4, s5, s6, s7];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n }\n\n return s0;\n }\n\n function peg$parsedatetime() {\n let s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$parsedate_part();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedatetime_delim();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsetime_part();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseoffset();\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f59(s1, s3, s4);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsedate_part();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedatetime_delim();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsetime_part();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f60(s1, s3);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsedate_part();\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n s3 = peg$parsedatetime_delim();\n peg$silentFails--;\n if (s3 === peg$FAILED) {\n s2 = undefined;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f61(s1);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsetime_part();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$f62(s1);\n }\n s0 = s1;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsedatetime_delim() {\n let s0, s1, s2, s3;\n\n s0 = input.charAt(peg$currPos);\n if (s0.toLowerCase() === peg$c27) {\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e42); }\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 32) {\n s1 = peg$c28;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e43); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n peg$silentFails++;\n s3 = peg$parseDIGIT();\n peg$silentFails--;\n if (s3 !== peg$FAILED) {\n peg$currPos = s2;\n s2 = undefined;\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseS() {\n let s0;\n\n s0 = input.charAt(peg$currPos);\n if (peg$r14.test(s0)) {\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e44); }\n }\n\n return s0;\n }\n\n function peg$parseNL() {\n let s0, s1, s2;\n\n if (input.charCodeAt(peg$currPos) === 10) {\n s0 = peg$c29;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e45); }\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 13) {\n s1 = peg$c30;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e46); }\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 10) {\n s2 = peg$c29;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e45); }\n }\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseNLS() {\n let s0;\n\n s0 = peg$parseNL();\n if (s0 === peg$FAILED) {\n s0 = peg$parseS();\n }\n\n return s0;\n }\n\n function peg$parseEOF() {\n let s0, s1;\n\n s0 = peg$currPos;\n peg$silentFails++;\n if (input.length > peg$currPos) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e14); }\n }\n peg$silentFails--;\n if (s1 === peg$FAILED) {\n s0 = undefined;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseDIGIT() {\n let s0;\n\n s0 = input.charAt(peg$currPos);\n if (peg$r10.test(s0)) {\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e30); }\n }\n\n return s0;\n }\n\n function peg$parseHEX() {\n let s0;\n\n s0 = input.charAt(peg$currPos);\n if (peg$r11.test(s0)) {\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e31); }\n }\n\n return s0;\n }\n\n function peg$parseASCII_BASIC() {\n let s0;\n\n s0 = input.charAt(peg$currPos);\n if (peg$r15.test(s0)) {\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e47); }\n }\n\n return s0;\n }\n\n function peg$parseESCAPED() {\n let s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c11;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e13); }\n }\n if (s1 !== peg$FAILED) {\n s2 = input.charAt(peg$currPos);\n if (peg$r16.test(s2)) {\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e48); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f63(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseESCAPED_UNICODE();\n }\n\n return s0;\n }\n\n function peg$parseESCAPED_UNICODE() {\n let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c31) {\n s1 = peg$c31;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e49); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$currPos;\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseHEX();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseHEX();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseHEX();\n if (s9 !== peg$FAILED) {\n s10 = peg$parseHEX();\n if (s10 !== peg$FAILED) {\n s11 = peg$parseHEX();\n if (s11 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7, s8, s9, s10, s11];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f64(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c32) {\n s1 = peg$c32;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e50); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$currPos;\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseHEX();\n if (s7 !== peg$FAILED) {\n s4 = [s4, s5, s6, s7];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f65(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c33) {\n s1 = peg$c33;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$e51); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$currPos;\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s4 = [s4, s5];\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = input.substring(s2, peg$currPos);\n } else {\n s2 = s3;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s0 = peg$f66(s2);\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n\n var nodes = [];\n var inputText = input;\n\n function resolveLineCol(off) {\n var line = 1, col = 1;\n for (var i = 0; i < off; i++) {\n if (inputText.charCodeAt(i) === 10) { line++; col = 1; }\n else { col++; }\n }\n return { line: line, column: col };\n }\n\n function genError(err, off) {\n var pos = resolveLineCol(off);\n var ex = new Error(err);\n ex.line = pos.line;\n ex.column = pos.column;\n throw ex;\n }\n\n function addNode(node) {\n nodes.push(node);\n }\n\n function node(type, value, off, key) {\n var obj = { type: type, value: value, offset: off };\n if (key) obj.key = key;\n return obj;\n }\n\n function validateDate(dateStr, off) {\n var year = dateStr.charCodeAt(0) * 1000 + dateStr.charCodeAt(1) * 100 + dateStr.charCodeAt(2) * 10 + dateStr.charCodeAt(3) - 53328;\n var month = (dateStr.charCodeAt(5) - 48) * 10 + dateStr.charCodeAt(6) - 48;\n var day = (dateStr.charCodeAt(8) - 48) * 10 + dateStr.charCodeAt(9) - 48;\n if (month < 1 || month > 12) {\n genError(\"Invalid date: month \" + month + \" out of range.\", off);\n }\n var maxDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {\n maxDays[1] = 29;\n }\n if (day < 1 || day > maxDays[month - 1]) {\n genError(\"Invalid date: day \" + day + \" out of range for month \" + month + \".\", off);\n }\n }\n\n function validateTime(timeStr, off) {\n var hour = (timeStr.charCodeAt(0) - 48) * 10 + timeStr.charCodeAt(1) - 48;\n var minute = (timeStr.charCodeAt(3) - 48) * 10 + timeStr.charCodeAt(4) - 48;\n var second = (timeStr.charCodeAt(6) - 48) * 10 + timeStr.charCodeAt(7) - 48;\n if (hour > 23) {\n genError(\"Invalid time: hour \" + hour + \" out of range.\", off);\n }\n if (minute > 59) {\n genError(\"Invalid time: minute \" + minute + \" out of range.\", off);\n }\n if (second > 59) {\n genError(\"Invalid time: second \" + second + \" out of range.\", off);\n }\n }\n\n function validateOffset(offsetStr, off) {\n if (offsetStr === \"Z\" || offsetStr === \"z\") return;\n var hour = (offsetStr.charCodeAt(1) - 48) * 10 + offsetStr.charCodeAt(2) - 48;\n var minute = (offsetStr.charCodeAt(4) - 48) * 10 + offsetStr.charCodeAt(5) - 48;\n if (hour > 23) {\n genError(\"Invalid offset: hour \" + hour + \" out of range.\", off);\n }\n if (minute > 59) {\n genError(\"Invalid offset: minute \" + minute + \" out of range.\", off);\n }\n }\n\n function stripUnderscores(str) {\n return str.indexOf('_') === -1 ? str : str.replace(/_/g, '');\n }\n\n function convertCodePoint(str) {\n var num = parseInt(str, 16);\n\n if (\n num !== num ||\n num < 0 ||\n num > 0x10FFFF ||\n (num > 0xD7FF && num < 0xE000)\n ) {\n genError(\"Invalid Unicode escape code: \" + str, offset());\n } else {\n return String.fromCodePoint(num);\n }\n }\n\n peg$result = peg$startRuleFunction();\n\n const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);\n function peg$throw() {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n if (options.peg$library) {\n return /** @type {any} */ ({\n peg$result,\n peg$currPos,\n peg$FAILED,\n peg$maxFailExpected,\n peg$maxFailPos,\n peg$success,\n peg$throw: peg$success ? undefined : peg$throw,\n });\n }\n if (peg$success) {\n return peg$result;\n } else {\n peg$throw();\n }\n}\n\nmodule.exports = {\n StartRules: [\"start\"],\n SyntaxError: peg$SyntaxError,\n parse: peg$parse,\n};\n",
|
|
7
|
+
"\"use strict\";\nfunction compile(nodes, inputText) {\n var assignedPaths = new Set();\n var valueAssignments = new Set();\n var explicitTablePaths = new Set();\n var currentPath = \"\";\n var data = Object.create(null);\n var context = data;\n\n return reduce(nodes);\n\n function reduce(nodes) {\n var node;\n for (var i = 0; i < nodes.length; i++) {\n node = nodes[i];\n switch (node.type) {\n case \"Assign\":\n assign(node);\n break;\n case \"ObjectPath\":\n setPath(node);\n break;\n case \"ArrayPath\":\n addTableArray(node);\n break;\n }\n }\n\n return data;\n }\n\n function resolveLineCol(off) {\n var line = 1, col = 1;\n for (var i = 0; i < off; i++) {\n if (inputText.charCodeAt(i) === 10) { line++; col = 1; }\n else { col++; }\n }\n return { line: line, column: col };\n }\n\n function genError(err, off) {\n var pos = resolveLineCol(off);\n var ex = new Error(err);\n ex.line = pos.line;\n ex.column = pos.column;\n throw ex;\n }\n\n function assign(node) {\n var keys = node.key;\n var value = node.value;\n var off = node.offset;\n\n if (!Array.isArray(keys)) keys = [keys];\n\n var reduced = reduceValueNode(value);\n\n var target = context;\n for (var i = 0; i < keys.length - 1; i++) {\n var k = keys[i];\n var intermediatePath = currentPath ? currentPath + \".\" + keys.slice(0, i + 1).join(\".\") : keys.slice(0, i + 1).join(\".\");\n\n if (typeof target[k] === \"undefined\") {\n target[k] = Object.create(null);\n assignedPaths.add(intermediatePath);\n } else if (typeof target[k] !== \"object\" || target[k] === null || Array.isArray(target[k])) {\n genError(\"Cannot redefine existing key '\" + intermediatePath + \"'.\", off);\n } else if (valueAssignments.has(intermediatePath)) {\n genError(\"Cannot redefine existing key '\" + intermediatePath + \"'.\", off);\n } else if (explicitTablePaths.has(intermediatePath) && intermediatePath !== (Array.isArray(currentPath) ? currentPath.join(\".\") : currentPath)) {\n genError(\"Cannot use dotted keys to extend table '\" + intermediatePath + \"' defined elsewhere.\", off);\n }\n target = target[k];\n }\n\n var lastKey = keys[keys.length - 1];\n var fullPath = currentPath ? currentPath + \".\" + keys.join(\".\") : keys.join(\".\");\n\n if (typeof target[lastKey] !== \"undefined\") {\n genError(\"Cannot redefine existing key '\" + fullPath + \"'.\", off);\n }\n\n target[lastKey] = reduced;\n\n assignedPaths.add(fullPath);\n valueAssignments.add(fullPath);\n }\n\n\n function reduceValueNode(node) {\n if (node.type === \"Array\") {\n return reduceArray(node.value);\n } else if (node.type === \"InlineTable\") {\n return reduceInlineTableNode(node.value);\n } else {\n return node.value;\n }\n }\n\n function reduceInlineTableNode(values) {\n var obj = Object.create(null);\n var definedKeys = new Set();\n\n for (var i = 0; i < values.length; i++) {\n var val = values[i];\n if (val.type !== \"InlineTableValue\") continue;\n\n var keys = val.key;\n if (!Array.isArray(keys)) keys = [keys];\n\n var reduced = reduceValueNode(val.value);\n setNestedKey(obj, keys, reduced, val.offset, definedKeys);\n\n definedKeys.add(keys.join(\".\"));\n }\n\n return obj;\n }\n\n function setNestedKey(obj, keys, value, off, definedKeys) {\n for (var i = 0; i < keys.length - 1; i++) {\n var k = keys[i];\n var intermediatePath = keys.slice(0, i + 1).join(\".\");\n if (typeof obj[k] === \"undefined\") {\n obj[k] = Object.create(null);\n } else if (typeof obj[k] !== \"object\" || obj[k] === null || Array.isArray(obj[k])) {\n genError(\"Cannot redefine existing key '\" + intermediatePath + \"'.\", off);\n } else if (definedKeys && definedKeys.has(intermediatePath)) {\n genError(\"Cannot extend inline table '\" + intermediatePath + \"'.\", off);\n }\n obj = obj[k];\n }\n var lastKey = keys[keys.length - 1];\n if (typeof obj[lastKey] !== \"undefined\") {\n genError(\"Cannot redefine existing key '\" + keys.join(\".\") + \"'.\", off);\n }\n obj[lastKey] = value;\n }\n\n function setPath(node) {\n var path = node.value;\n var quotedPath = path.map(quoteDottedString).join(\".\");\n var off = node.offset;\n\n if (assignedPaths.has(quotedPath)) {\n genError(\"Cannot redefine existing key '\" + path + \"'.\", off);\n }\n assignedPaths.add(quotedPath);\n explicitTablePaths.add(quotedPath);\n context = deepRef(data, path, Object.create(null), off);\n currentPath = path;\n }\n\n function addTableArray(node) {\n var path = node.value;\n var quotedPath = path.map(quoteDottedString).join(\".\");\n var off = node.offset;\n\n if (valueAssignments.has(quotedPath)) {\n genError(\"Cannot append to statically defined array '\" + quotedPath + \"'.\", off);\n }\n\n // Clear paths that start with this table array path\n assignedPaths.forEach(function(p) {\n if (p.indexOf(quotedPath) === 0) assignedPaths.delete(p);\n });\n valueAssignments.forEach(function(p) {\n if (p.indexOf(quotedPath) === 0) valueAssignments.delete(p);\n });\n assignedPaths.add(quotedPath);\n context = deepRef(data, path, [], off);\n currentPath = quotedPath;\n\n if (context instanceof Array) {\n var newObj = Object.create(null);\n context.push(newObj);\n context = newObj;\n } else {\n genError(\"Cannot redefine existing key '\" + path + \"'.\", off);\n }\n }\n\n function deepRef(start, keys, value, off) {\n var traversedPath = \"\";\n var ctx = start;\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n traversedPath = traversedPath ? traversedPath + \".\" + key : key;\n if (typeof ctx[key] === \"undefined\") {\n if (i === keys.length - 1) {\n ctx[key] = value;\n } else {\n ctx[key] = Object.create(null);\n }\n } else if (i !== keys.length - 1 && valueAssignments.has(traversedPath)) {\n genError(\"Cannot redefine existing key '\" + traversedPath + \"'.\", off);\n }\n\n ctx = ctx[key];\n if (ctx instanceof Array && ctx.length && i < keys.length - 1) {\n ctx = ctx[ctx.length - 1];\n }\n }\n\n return ctx;\n }\n\n function reduceArray(array) {\n return array.map(reduceValueNode);\n }\n\n function quoteDottedString(str) {\n if (str.indexOf(\".\") > -1) {\n return \"\\\"\" + str + \"\\\"\";\n } else {\n return str;\n }\n }\n}\n\nmodule.exports = {\n compile: compile\n};\n",
|
|
8
|
+
"var parser = require('./lib/parser');\nvar compiler = require('./lib/compiler');\n\nmodule.exports = {\n parse: function(input) {\n var str = input.toString();\n var nodes = parser.parse(str);\n return compiler.compile(nodes, str);\n }\n};\n",
|
|
9
|
+
"'use strict';\n\nconst ALIAS = Symbol.for('yaml.alias');\nconst DOC = Symbol.for('yaml.document');\nconst MAP = Symbol.for('yaml.map');\nconst PAIR = Symbol.for('yaml.pair');\nconst SCALAR = Symbol.for('yaml.scalar');\nconst SEQ = Symbol.for('yaml.seq');\nconst NODE_TYPE = Symbol.for('yaml.node.type');\nconst isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;\nconst isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;\nconst isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;\nconst isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;\nconst isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;\nconst isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;\nfunction isCollection(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case MAP:\n case SEQ:\n return true;\n }\n return false;\n}\nfunction isNode(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case ALIAS:\n case MAP:\n case SCALAR:\n case SEQ:\n return true;\n }\n return false;\n}\nconst hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;\n\nexports.ALIAS = ALIAS;\nexports.DOC = DOC;\nexports.MAP = MAP;\nexports.NODE_TYPE = NODE_TYPE;\nexports.PAIR = PAIR;\nexports.SCALAR = SCALAR;\nexports.SEQ = SEQ;\nexports.hasAnchor = hasAnchor;\nexports.isAlias = isAlias;\nexports.isCollection = isCollection;\nexports.isDocument = isDocument;\nexports.isMap = isMap;\nexports.isNode = isNode;\nexports.isPair = isPair;\nexports.isScalar = isScalar;\nexports.isSeq = isSeq;\n",
|
|
10
|
+
"'use strict';\n\nvar identity = require('./nodes/identity.js');\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove node');\n/**\n * Apply a visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nfunction visit(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n visit_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisit.SKIP = SKIP;\n/** Remove the current node */\nvisit.REMOVE = REMOVE;\nfunction visit_(key, node, visitor, path) {\n const ctrl = callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visit_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = visit_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = visit_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = visit_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\n/**\n * Apply an async visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `Promise`: Must resolve to one of the following values\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nasync function visitAsync(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n await visitAsync_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisitAsync.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisitAsync.SKIP = SKIP;\n/** Remove the current node */\nvisitAsync.REMOVE = REMOVE;\nasync function visitAsync_(key, node, visitor, path) {\n const ctrl = await callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visitAsync_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = await visitAsync_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = await visitAsync_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = await visitAsync_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\nfunction initVisitor(visitor) {\n if (typeof visitor === 'object' &&\n (visitor.Collection || visitor.Node || visitor.Value)) {\n return Object.assign({\n Alias: visitor.Node,\n Map: visitor.Node,\n Scalar: visitor.Node,\n Seq: visitor.Node\n }, visitor.Value && {\n Map: visitor.Value,\n Scalar: visitor.Value,\n Seq: visitor.Value\n }, visitor.Collection && {\n Map: visitor.Collection,\n Seq: visitor.Collection\n }, visitor);\n }\n return visitor;\n}\nfunction callVisitor(key, node, visitor, path) {\n if (typeof visitor === 'function')\n return visitor(key, node, path);\n if (identity.isMap(node))\n return visitor.Map?.(key, node, path);\n if (identity.isSeq(node))\n return visitor.Seq?.(key, node, path);\n if (identity.isPair(node))\n return visitor.Pair?.(key, node, path);\n if (identity.isScalar(node))\n return visitor.Scalar?.(key, node, path);\n if (identity.isAlias(node))\n return visitor.Alias?.(key, node, path);\n return undefined;\n}\nfunction replaceNode(key, path, node) {\n const parent = path[path.length - 1];\n if (identity.isCollection(parent)) {\n parent.items[key] = node;\n }\n else if (identity.isPair(parent)) {\n if (key === 'key')\n parent.key = node;\n else\n parent.value = node;\n }\n else if (identity.isDocument(parent)) {\n parent.contents = node;\n }\n else {\n const pt = identity.isAlias(parent) ? 'alias' : 'scalar';\n throw new Error(`Cannot replace node with ${pt} parent`);\n }\n}\n\nexports.visit = visit;\nexports.visitAsync = visitAsync;\n",
|
|
11
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\nconst escapeChars = {\n '!': '%21',\n ',': '%2C',\n '[': '%5B',\n ']': '%5D',\n '{': '%7B',\n '}': '%7D'\n};\nconst escapeTagName = (tn) => tn.replace(/[!,[\\]{}]/g, ch => escapeChars[ch]);\nclass Directives {\n constructor(yaml, tags) {\n /**\n * The directives-end/doc-start marker `---`. If `null`, a marker may still be\n * included in the document's stringified representation.\n */\n this.docStart = null;\n /** The doc-end marker `...`. */\n this.docEnd = false;\n this.yaml = Object.assign({}, Directives.defaultYaml, yaml);\n this.tags = Object.assign({}, Directives.defaultTags, tags);\n }\n clone() {\n const copy = new Directives(this.yaml, this.tags);\n copy.docStart = this.docStart;\n return copy;\n }\n /**\n * During parsing, get a Directives instance for the current document and\n * update the stream state according to the current version's spec.\n */\n atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }\n /**\n * @param onError - May be called even if the action was successful\n * @returns `true` on success\n */\n add(line, onError) {\n if (this.atNextDocument) {\n this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };\n this.tags = Object.assign({}, Directives.defaultTags);\n this.atNextDocument = false;\n }\n const parts = line.trim().split(/[ \\t]+/);\n const name = parts.shift();\n switch (name) {\n case '%TAG': {\n if (parts.length !== 2) {\n onError(0, '%TAG directive should contain exactly two parts');\n if (parts.length < 2)\n return false;\n }\n const [handle, prefix] = parts;\n this.tags[handle] = prefix;\n return true;\n }\n case '%YAML': {\n this.yaml.explicit = true;\n if (parts.length !== 1) {\n onError(0, '%YAML directive should contain exactly one part');\n return false;\n }\n const [version] = parts;\n if (version === '1.1' || version === '1.2') {\n this.yaml.version = version;\n return true;\n }\n else {\n const isValid = /^\\d+\\.\\d+$/.test(version);\n onError(6, `Unsupported YAML version ${version}`, isValid);\n return false;\n }\n }\n default:\n onError(0, `Unknown directive ${name}`, true);\n return false;\n }\n }\n /**\n * Resolves a tag, matching handles to those defined in %TAG directives.\n *\n * @returns Resolved tag, which may also be the non-specific tag `'!'` or a\n * `'!local'` tag, or `null` if unresolvable.\n */\n tagName(source, onError) {\n if (source === '!')\n return '!'; // non-specific tag\n if (source[0] !== '!') {\n onError(`Not a valid tag: ${source}`);\n return null;\n }\n if (source[1] === '<') {\n const verbatim = source.slice(2, -1);\n if (verbatim === '!' || verbatim === '!!') {\n onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);\n return null;\n }\n if (source[source.length - 1] !== '>')\n onError('Verbatim tags must end with a >');\n return verbatim;\n }\n const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);\n if (!suffix)\n onError(`The ${source} tag has no suffix`);\n const prefix = this.tags[handle];\n if (prefix) {\n try {\n return prefix + decodeURIComponent(suffix);\n }\n catch (error) {\n onError(String(error));\n return null;\n }\n }\n if (handle === '!')\n return source; // local tag\n onError(`Could not resolve tag: ${source}`);\n return null;\n }\n /**\n * Given a fully resolved tag, returns its printable string form,\n * taking into account current tag prefixes and defaults.\n */\n tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }\n toString(doc) {\n const lines = this.yaml.explicit\n ? [`%YAML ${this.yaml.version || '1.2'}`]\n : [];\n const tagEntries = Object.entries(this.tags);\n let tagNames;\n if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {\n const tags = {};\n visit.visit(doc.contents, (_key, node) => {\n if (identity.isNode(node) && node.tag)\n tags[node.tag] = true;\n });\n tagNames = Object.keys(tags);\n }\n else\n tagNames = [];\n for (const [handle, prefix] of tagEntries) {\n if (handle === '!!' && prefix === 'tag:yaml.org,2002:')\n continue;\n if (!doc || tagNames.some(tn => tn.startsWith(prefix)))\n lines.push(`%TAG ${handle} ${prefix}`);\n }\n return lines.join('\\n');\n }\n}\nDirectives.defaultYaml = { explicit: false, version: '1.2' };\nDirectives.defaultTags = { '!!': 'tag:yaml.org,2002:' };\n\nexports.Directives = Directives;\n",
|
|
12
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\n/**\n * Verify that the input string is a valid anchor.\n *\n * Will throw on errors.\n */\nfunction anchorIsValid(anchor) {\n if (/[\\x00-\\x19\\s,[\\]{}]/.test(anchor)) {\n const sa = JSON.stringify(anchor);\n const msg = `Anchor must not contain whitespace or control characters: ${sa}`;\n throw new Error(msg);\n }\n return true;\n}\nfunction anchorNames(root) {\n const anchors = new Set();\n visit.visit(root, {\n Value(_key, node) {\n if (node.anchor)\n anchors.add(node.anchor);\n }\n });\n return anchors;\n}\n/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */\nfunction findNewAnchor(prefix, exclude) {\n for (let i = 1; true; ++i) {\n const name = `${prefix}${i}`;\n if (!exclude.has(name))\n return name;\n }\n}\nfunction createNodeAnchors(doc, prefix) {\n const aliasObjects = [];\n const sourceObjects = new Map();\n let prevAnchors = null;\n return {\n onAnchor: (source) => {\n aliasObjects.push(source);\n prevAnchors ?? (prevAnchors = anchorNames(doc));\n const anchor = findNewAnchor(prefix, prevAnchors);\n prevAnchors.add(anchor);\n return anchor;\n },\n /**\n * With circular references, the source node is only resolved after all\n * of its child nodes are. This is why anchors are set only after all of\n * the nodes have been created.\n */\n setAnchors: () => {\n for (const source of aliasObjects) {\n const ref = sourceObjects.get(source);\n if (typeof ref === 'object' &&\n ref.anchor &&\n (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {\n ref.node.anchor = ref.anchor;\n }\n else {\n const error = new Error('Failed to resolve repeated object (this should not happen)');\n error.source = source;\n throw error;\n }\n }\n },\n sourceObjects\n };\n}\n\nexports.anchorIsValid = anchorIsValid;\nexports.anchorNames = anchorNames;\nexports.createNodeAnchors = createNodeAnchors;\nexports.findNewAnchor = findNewAnchor;\n",
|
|
13
|
+
"'use strict';\n\n/**\n * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,\n * in section 24.5.1.1 \"Runtime Semantics: InternalizeJSONProperty\" of the\n * 2021 edition: https://tc39.es/ecma262/#sec-json.parse\n *\n * Includes extensions for handling Map and Set objects.\n */\nfunction applyReviver(reviver, obj, key, val) {\n if (val && typeof val === 'object') {\n if (Array.isArray(val)) {\n for (let i = 0, len = val.length; i < len; ++i) {\n const v0 = val[i];\n const v1 = applyReviver(reviver, val, String(i), v0);\n // eslint-disable-next-line @typescript-eslint/no-array-delete\n if (v1 === undefined)\n delete val[i];\n else if (v1 !== v0)\n val[i] = v1;\n }\n }\n else if (val instanceof Map) {\n for (const k of Array.from(val.keys())) {\n const v0 = val.get(k);\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n val.delete(k);\n else if (v1 !== v0)\n val.set(k, v1);\n }\n }\n else if (val instanceof Set) {\n for (const v0 of Array.from(val)) {\n const v1 = applyReviver(reviver, val, v0, v0);\n if (v1 === undefined)\n val.delete(v0);\n else if (v1 !== v0) {\n val.delete(v0);\n val.add(v1);\n }\n }\n }\n else {\n for (const [k, v0] of Object.entries(val)) {\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n delete val[k];\n else if (v1 !== v0)\n val[k] = v1;\n }\n }\n }\n return reviver.call(obj, key, val);\n}\n\nexports.applyReviver = applyReviver;\n",
|
|
14
|
+
"'use strict';\n\nvar identity = require('./identity.js');\n\n/**\n * Recursively convert any node or its contents to native JavaScript\n *\n * @param value - The input value\n * @param arg - If `value` defines a `toJSON()` method, use this\n * as its first argument\n * @param ctx - Conversion context, originally set in Document#toJS(). If\n * `{ keep: true }` is not set, output should be suitable for JSON\n * stringification.\n */\nfunction toJS(value, arg, ctx) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n if (Array.isArray(value))\n return value.map((v, i) => toJS(v, String(i), ctx));\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (!ctx || !identity.hasAnchor(value))\n return value.toJSON(arg, ctx);\n const data = { aliasCount: 0, count: 1, res: undefined };\n ctx.anchors.set(value, data);\n ctx.onCreate = res => {\n data.res = res;\n delete ctx.onCreate;\n };\n const res = value.toJSON(arg, ctx);\n if (ctx.onCreate)\n ctx.onCreate(res);\n return res;\n }\n if (typeof value === 'bigint' && !ctx?.keep)\n return Number(value);\n return value;\n}\n\nexports.toJS = toJS;\n",
|
|
15
|
+
"'use strict';\n\nvar applyReviver = require('../doc/applyReviver.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nclass NodeBase {\n constructor(type) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: type });\n }\n /** Create a copy of this node. */\n clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** A plain JavaScript representation of this node. */\n toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n if (!identity.isDocument(doc))\n throw new TypeError('A document argument is required');\n const ctx = {\n anchors: new Map(),\n doc,\n keep: true,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this, '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n}\n\nexports.NodeBase = NodeBase;\n",
|
|
16
|
+
"'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar visit = require('../visit.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nclass Alias extends Node.NodeBase {\n constructor(source) {\n super(identity.ALIAS);\n this.source = source;\n Object.defineProperty(this, 'tag', {\n set() {\n throw new Error('Alias nodes cannot have tags');\n }\n });\n }\n /**\n * Resolve the value of this alias within `doc`, finding the last\n * instance of the `source` anchor before this node.\n */\n resolve(doc, ctx) {\n if (ctx?.maxAliasCount === 0)\n throw new ReferenceError('Alias resolution is disabled');\n let nodes;\n if (ctx?.aliasResolveCache) {\n nodes = ctx.aliasResolveCache;\n }\n else {\n nodes = [];\n visit.visit(doc, {\n Node: (_key, node) => {\n if (identity.isAlias(node) || identity.hasAnchor(node))\n nodes.push(node);\n }\n });\n if (ctx)\n ctx.aliasResolveCache = nodes;\n }\n let found = undefined;\n for (const node of nodes) {\n if (node === this)\n break;\n if (node.anchor === this.source)\n found = node;\n }\n return found;\n }\n toJSON(_arg, ctx) {\n if (!ctx)\n return { source: this.source };\n const { anchors, doc, maxAliasCount } = ctx;\n const source = this.resolve(doc, ctx);\n if (!source) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new ReferenceError(msg);\n }\n let data = anchors.get(source);\n if (!data) {\n // Resolve anchors for Node.prototype.toJS()\n toJS.toJS(source, null, ctx);\n data = anchors.get(source);\n }\n /* istanbul ignore if */\n if (data?.res === undefined) {\n const msg = 'This should not happen: Alias anchor was not resolved?';\n throw new ReferenceError(msg);\n }\n if (maxAliasCount >= 0) {\n data.count += 1;\n if (data.aliasCount === 0)\n data.aliasCount = getAliasCount(doc, source, anchors);\n if (data.count * data.aliasCount > maxAliasCount) {\n const msg = 'Excessive alias count indicates a resource exhaustion attack';\n throw new ReferenceError(msg);\n }\n }\n return data.res;\n }\n toString(ctx, _onComment, _onChompKeep) {\n const src = `*${this.source}`;\n if (ctx) {\n anchors.anchorIsValid(this.source);\n if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new Error(msg);\n }\n if (ctx.implicitKey)\n return `${src} `;\n }\n return src;\n }\n}\nfunction getAliasCount(doc, node, anchors) {\n if (identity.isAlias(node)) {\n const source = node.resolve(doc);\n const anchor = anchors && source && anchors.get(source);\n return anchor ? anchor.count * anchor.aliasCount : 0;\n }\n else if (identity.isCollection(node)) {\n let count = 0;\n for (const item of node.items) {\n const c = getAliasCount(doc, item, anchors);\n if (c > count)\n count = c;\n }\n return count;\n }\n else if (identity.isPair(node)) {\n const kc = getAliasCount(doc, node.key, anchors);\n const vc = getAliasCount(doc, node.value, anchors);\n return Math.max(kc, vc);\n }\n return 1;\n}\n\nexports.Alias = Alias;\n",
|
|
17
|
+
"'use strict';\n\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nconst isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');\nclass Scalar extends Node.NodeBase {\n constructor(value) {\n super(identity.SCALAR);\n this.value = value;\n }\n toJSON(arg, ctx) {\n return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);\n }\n toString() {\n return String(this.value);\n }\n}\nScalar.BLOCK_FOLDED = 'BLOCK_FOLDED';\nScalar.BLOCK_LITERAL = 'BLOCK_LITERAL';\nScalar.PLAIN = 'PLAIN';\nScalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';\nScalar.QUOTE_SINGLE = 'QUOTE_SINGLE';\n\nexports.Scalar = Scalar;\nexports.isScalarValue = isScalarValue;\n",
|
|
18
|
+
"'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\n\nconst defaultTagPrefix = 'tag:yaml.org,2002:';\nfunction findTagObject(value, tagName, tags) {\n if (tagName) {\n const match = tags.filter(t => t.tag === tagName);\n const tagObj = match.find(t => !t.format) ?? match[0];\n if (!tagObj)\n throw new Error(`Tag ${tagName} not found`);\n return tagObj;\n }\n return tags.find(t => t.identify?.(value) && !t.format);\n}\nfunction createNode(value, tagName, ctx) {\n if (identity.isDocument(value))\n value = value.contents;\n if (identity.isNode(value))\n return value;\n if (identity.isPair(value)) {\n const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);\n map.items.push(value);\n return map;\n }\n if (value instanceof String ||\n value instanceof Number ||\n value instanceof Boolean ||\n (typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere\n ) {\n // https://tc39.es/ecma262/#sec-serializejsonproperty\n value = value.valueOf();\n }\n const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;\n // Detect duplicate references to the same object & use Alias nodes for all\n // after first. The `ref` wrapper allows for circular references to resolve.\n let ref = undefined;\n if (aliasDuplicateObjects && value && typeof value === 'object') {\n ref = sourceObjects.get(value);\n if (ref) {\n ref.anchor ?? (ref.anchor = onAnchor(value));\n return new Alias.Alias(ref.anchor);\n }\n else {\n ref = { anchor: null, node: null };\n sourceObjects.set(value, ref);\n }\n }\n if (tagName?.startsWith('!!'))\n tagName = defaultTagPrefix + tagName.slice(2);\n let tagObj = findTagObject(value, tagName, schema.tags);\n if (!tagObj) {\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n value = value.toJSON();\n }\n if (!value || typeof value !== 'object') {\n const node = new Scalar.Scalar(value);\n if (ref)\n ref.node = node;\n return node;\n }\n tagObj =\n value instanceof Map\n ? schema[identity.MAP]\n : Symbol.iterator in Object(value)\n ? schema[identity.SEQ]\n : schema[identity.MAP];\n }\n if (onTagObj) {\n onTagObj(tagObj);\n delete ctx.onTagObj;\n }\n const node = tagObj?.createNode\n ? tagObj.createNode(ctx.schema, value, ctx)\n : typeof tagObj?.nodeClass?.from === 'function'\n ? tagObj.nodeClass.from(ctx.schema, value, ctx)\n : new Scalar.Scalar(value);\n if (tagName)\n node.tag = tagName;\n else if (!tagObj.default)\n node.tag = tagObj.tag;\n if (ref)\n ref.node = node;\n return node;\n}\n\nexports.createNode = createNode;\n",
|
|
19
|
+
"'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\n\nfunction collectionFromPath(schema, path, value) {\n let v = value;\n for (let i = path.length - 1; i >= 0; --i) {\n const k = path[i];\n if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {\n const a = [];\n a[k] = v;\n v = a;\n }\n else {\n v = new Map([[k, v]]);\n }\n }\n return createNode.createNode(v, undefined, {\n aliasDuplicateObjects: false,\n keepUndefined: false,\n onAnchor: () => {\n throw new Error('This should not happen, please report a bug.');\n },\n schema,\n sourceObjects: new Map()\n });\n}\n// Type guard is intentionally a little wrong so as to be more useful,\n// as it does not cover untypable empty non-string iterables (e.g. []).\nconst isEmptyPath = (path) => path == null ||\n (typeof path === 'object' && !!path[Symbol.iterator]().next().done);\nclass Collection extends Node.NodeBase {\n constructor(type, schema) {\n super(type);\n Object.defineProperty(this, 'schema', {\n value: schema,\n configurable: true,\n enumerable: false,\n writable: true\n });\n }\n /**\n * Create a copy of this collection.\n *\n * @param schema - If defined, overwrites the original's schema\n */\n clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /**\n * Adds a value to the collection. For `!!map` and `!!omap` the value must\n * be a Pair instance or a `{ key, value }` object, which may not have a key\n * that already exists in the map.\n */\n addIn(path, value) {\n if (isEmptyPath(path))\n this.add(value);\n else {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.addIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n /**\n * Removes a value from the collection.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.delete(key);\n const node = this.get(key, true);\n if (identity.isCollection(node))\n return node.deleteIn(rest);\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (rest.length === 0)\n return !keepScalar && identity.isScalar(node) ? node.value : node;\n else\n return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;\n }\n hasAllNullValues(allowScalar) {\n return this.items.every(node => {\n if (!identity.isPair(node))\n return false;\n const n = node.value;\n return (n == null ||\n (allowScalar &&\n identity.isScalar(n) &&\n n.value == null &&\n !n.commentBefore &&\n !n.comment &&\n !n.tag));\n });\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n */\n hasIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.has(key);\n const node = this.get(key, true);\n return identity.isCollection(node) ? node.hasIn(rest) : false;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n const [key, ...rest] = path;\n if (rest.length === 0) {\n this.set(key, value);\n }\n else {\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.setIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n}\n\nexports.Collection = Collection;\nexports.collectionFromPath = collectionFromPath;\nexports.isEmptyPath = isEmptyPath;\n",
|
|
20
|
+
"'use strict';\n\n/**\n * Stringifies a comment.\n *\n * Empty comment lines are left empty,\n * lines consisting of a single space are replaced by `#`,\n * and all other lines are prefixed with a `#`.\n */\nconst stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');\nfunction indentComment(comment, indent) {\n if (/^\\n+$/.test(comment))\n return comment.substring(1);\n return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;\n}\nconst lineComment = (str, indent, comment) => str.endsWith('\\n')\n ? indentComment(comment, indent)\n : comment.includes('\\n')\n ? '\\n' + indentComment(comment, indent)\n : (str.endsWith(' ') ? '' : ' ') + comment;\n\nexports.indentComment = indentComment;\nexports.lineComment = lineComment;\nexports.stringifyComment = stringifyComment;\n",
|
|
21
|
+
"'use strict';\n\nconst FOLD_FLOW = 'flow';\nconst FOLD_BLOCK = 'block';\nconst FOLD_QUOTED = 'quoted';\n/**\n * Tries to keep input at up to `lineWidth` characters, splitting only on spaces\n * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are\n * terminated with `\\n` and started with `indent`.\n */\nfunction foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {\n if (!lineWidth || lineWidth < 0)\n return text;\n if (lineWidth < minContentWidth)\n minContentWidth = 0;\n const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);\n if (text.length <= endStep)\n return text;\n const folds = [];\n const escapedFolds = {};\n let end = lineWidth - indent.length;\n if (typeof indentAtStart === 'number') {\n if (indentAtStart > lineWidth - Math.max(2, minContentWidth))\n folds.push(0);\n else\n end = lineWidth - indentAtStart;\n }\n let split = undefined;\n let prev = undefined;\n let overflow = false;\n let i = -1;\n let escStart = -1;\n let escEnd = -1;\n if (mode === FOLD_BLOCK) {\n i = consumeMoreIndentedLines(text, i, indent.length);\n if (i !== -1)\n end = i + endStep;\n }\n for (let ch; (ch = text[(i += 1)]);) {\n if (mode === FOLD_QUOTED && ch === '\\\\') {\n escStart = i;\n switch (text[i + 1]) {\n case 'x':\n i += 3;\n break;\n case 'u':\n i += 5;\n break;\n case 'U':\n i += 9;\n break;\n default:\n i += 1;\n }\n escEnd = i;\n }\n if (ch === '\\n') {\n if (mode === FOLD_BLOCK)\n i = consumeMoreIndentedLines(text, i, indent.length);\n end = i + indent.length + endStep;\n split = undefined;\n }\n else {\n if (ch === ' ' &&\n prev &&\n prev !== ' ' &&\n prev !== '\\n' &&\n prev !== '\\t') {\n // space surrounded by non-space can be replaced with newline + indent\n const next = text[i + 1];\n if (next && next !== ' ' && next !== '\\n' && next !== '\\t')\n split = i;\n }\n if (i >= end) {\n if (split) {\n folds.push(split);\n end = split + endStep;\n split = undefined;\n }\n else if (mode === FOLD_QUOTED) {\n // white-space collected at end may stretch past lineWidth\n while (prev === ' ' || prev === '\\t') {\n prev = ch;\n ch = text[(i += 1)];\n overflow = true;\n }\n // Account for newline escape, but don't break preceding escape\n const j = i > escEnd + 1 ? i - 2 : escStart - 1;\n // Bail out if lineWidth & minContentWidth are shorter than an escape string\n if (escapedFolds[j])\n return text;\n folds.push(j);\n escapedFolds[j] = true;\n end = j + endStep;\n split = undefined;\n }\n else {\n overflow = true;\n }\n }\n }\n prev = ch;\n }\n if (overflow && onOverflow)\n onOverflow();\n if (folds.length === 0)\n return text;\n if (onFold)\n onFold();\n let res = text.slice(0, folds[0]);\n for (let i = 0; i < folds.length; ++i) {\n const fold = folds[i];\n const end = folds[i + 1] || text.length;\n if (fold === 0)\n res = `\\n${indent}${text.slice(0, end)}`;\n else {\n if (mode === FOLD_QUOTED && escapedFolds[fold])\n res += `${text[fold]}\\\\`;\n res += `\\n${indent}${text.slice(fold + 1, end)}`;\n }\n }\n return res;\n}\n/**\n * Presumes `i + 1` is at the start of a line\n * @returns index of last newline in more-indented block\n */\nfunction consumeMoreIndentedLines(text, i, indent) {\n let end = i;\n let start = i + 1;\n let ch = text[start];\n while (ch === ' ' || ch === '\\t') {\n if (i < start + indent) {\n ch = text[++i];\n }\n else {\n do {\n ch = text[++i];\n } while (ch && ch !== '\\n');\n end = i;\n start = i + 1;\n ch = text[start];\n }\n }\n return end;\n}\n\nexports.FOLD_BLOCK = FOLD_BLOCK;\nexports.FOLD_FLOW = FOLD_FLOW;\nexports.FOLD_QUOTED = FOLD_QUOTED;\nexports.foldFlowLines = foldFlowLines;\n",
|
|
22
|
+
"'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar foldFlowLines = require('./foldFlowLines.js');\n\nconst getFoldOptions = (ctx, isBlock) => ({\n indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,\n lineWidth: ctx.options.lineWidth,\n minContentWidth: ctx.options.minContentWidth\n});\n// Also checks for lines starting with %, as parsing the output as YAML 1.1 will\n// presume that's starting a new document.\nconst containsDocumentMarker = (str) => /^(%|---|\\.\\.\\.)/m.test(str);\nfunction lineLengthOverLimit(str, lineWidth, indentLength) {\n if (!lineWidth || lineWidth < 0)\n return false;\n const limit = lineWidth - indentLength;\n const strLen = str.length;\n if (strLen <= limit)\n return false;\n for (let i = 0, start = 0; i < strLen; ++i) {\n if (str[i] === '\\n') {\n if (i - start > limit)\n return true;\n start = i + 1;\n if (strLen - start <= limit)\n return false;\n }\n }\n return true;\n}\nfunction doubleQuotedString(value, ctx) {\n const json = JSON.stringify(value);\n if (ctx.options.doubleQuotedAsJSON)\n return json;\n const { implicitKey } = ctx;\n const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n let str = '';\n let start = 0;\n for (let i = 0, ch = json[i]; ch; ch = json[++i]) {\n if (ch === ' ' && json[i + 1] === '\\\\' && json[i + 2] === 'n') {\n // space before newline needs to be escaped to not be folded\n str += json.slice(start, i) + '\\\\ ';\n i += 1;\n start = i;\n ch = '\\\\';\n }\n if (ch === '\\\\')\n switch (json[i + 1]) {\n case 'u':\n {\n str += json.slice(start, i);\n const code = json.substr(i + 2, 4);\n switch (code) {\n case '0000':\n str += '\\\\0';\n break;\n case '0007':\n str += '\\\\a';\n break;\n case '000b':\n str += '\\\\v';\n break;\n case '001b':\n str += '\\\\e';\n break;\n case '0085':\n str += '\\\\N';\n break;\n case '00a0':\n str += '\\\\_';\n break;\n case '2028':\n str += '\\\\L';\n break;\n case '2029':\n str += '\\\\P';\n break;\n default:\n if (code.substr(0, 2) === '00')\n str += '\\\\x' + code.substr(2);\n else\n str += json.substr(i, 6);\n }\n i += 5;\n start = i + 1;\n }\n break;\n case 'n':\n if (implicitKey ||\n json[i + 2] === '\"' ||\n json.length < minMultiLineLength) {\n i += 1;\n }\n else {\n // folding will eat first newline\n str += json.slice(start, i) + '\\n\\n';\n while (json[i + 2] === '\\\\' &&\n json[i + 3] === 'n' &&\n json[i + 4] !== '\"') {\n str += '\\n';\n i += 2;\n }\n str += indent;\n // space after newline needs to be escaped to not be folded\n if (json[i + 2] === ' ')\n str += '\\\\';\n i += 1;\n start = i + 1;\n }\n break;\n default:\n i += 1;\n }\n }\n str = start ? str + json.slice(start) : json;\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));\n}\nfunction singleQuotedString(value, ctx) {\n if (ctx.options.singleQuote === false ||\n (ctx.implicitKey && value.includes('\\n')) ||\n /[ \\t]\\n|\\n[ \\t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline\n )\n return doubleQuotedString(value, ctx);\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n const res = \"'\" + value.replace(/'/g, \"''\").replace(/\\n+/g, `$&\\n${indent}`) + \"'\";\n return ctx.implicitKey\n ? res\n : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction quotedString(value, ctx) {\n const { singleQuote } = ctx.options;\n let qs;\n if (singleQuote === false)\n qs = doubleQuotedString;\n else {\n const hasDouble = value.includes('\"');\n const hasSingle = value.includes(\"'\");\n if (hasDouble && !hasSingle)\n qs = singleQuotedString;\n else if (hasSingle && !hasDouble)\n qs = doubleQuotedString;\n else\n qs = singleQuote ? singleQuotedString : doubleQuotedString;\n }\n return qs(value, ctx);\n}\n// The negative lookbehind avoids a polynomial search,\n// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind\nlet blockEndNewlines;\ntry {\n blockEndNewlines = new RegExp('(^|(?<!\\n))\\n+(?!\\n|$)', 'g');\n}\ncatch {\n blockEndNewlines = /\\n+(?!\\n|$)/g;\n}\nfunction blockString({ comment, type, value }, ctx, onComment, onChompKeep) {\n const { blockQuote, commentString, lineWidth } = ctx.options;\n // 1. Block can't end in whitespace unless the last line is non-empty.\n // 2. Strings consisting of only whitespace are best rendered explicitly.\n if (!blockQuote || /\\n[\\t ]+$/.test(value)) {\n return quotedString(value, ctx);\n }\n const indent = ctx.indent ||\n (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');\n const literal = blockQuote === 'literal'\n ? true\n : blockQuote === 'folded' || type === Scalar.Scalar.BLOCK_FOLDED\n ? false\n : type === Scalar.Scalar.BLOCK_LITERAL\n ? true\n : !lineLengthOverLimit(value, lineWidth, indent.length);\n if (!value)\n return literal ? '|\\n' : '>\\n';\n // determine chomping from whitespace at value end\n let chomp;\n let endStart;\n for (endStart = value.length; endStart > 0; --endStart) {\n const ch = value[endStart - 1];\n if (ch !== '\\n' && ch !== '\\t' && ch !== ' ')\n break;\n }\n let end = value.substring(endStart);\n const endNlPos = end.indexOf('\\n');\n if (endNlPos === -1) {\n chomp = '-'; // strip\n }\n else if (value === end || endNlPos !== end.length - 1) {\n chomp = '+'; // keep\n if (onChompKeep)\n onChompKeep();\n }\n else {\n chomp = ''; // clip\n }\n if (end) {\n value = value.slice(0, -end.length);\n if (end[end.length - 1] === '\\n')\n end = end.slice(0, -1);\n end = end.replace(blockEndNewlines, `$&${indent}`);\n }\n // determine indent indicator from whitespace at value start\n let startWithSpace = false;\n let startEnd;\n let startNlPos = -1;\n for (startEnd = 0; startEnd < value.length; ++startEnd) {\n const ch = value[startEnd];\n if (ch === ' ')\n startWithSpace = true;\n else if (ch === '\\n')\n startNlPos = startEnd;\n else\n break;\n }\n let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);\n if (start) {\n value = value.substring(start.length);\n start = start.replace(/\\n+/g, `$&${indent}`);\n }\n const indentSize = indent ? '2' : '1'; // root is at -1\n // Leading | or > is added later\n let header = (startWithSpace ? indentSize : '') + chomp;\n if (comment) {\n header += ' ' + commentString(comment.replace(/ ?[\\r\\n]+/g, ' '));\n if (onComment)\n onComment();\n }\n if (!literal) {\n const foldedValue = value\n .replace(/\\n+/g, '\\n$&')\n .replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g, '$1$2') // more-indented lines aren't folded\n // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent\n .replace(/\\n+/g, `$&${indent}`);\n let literalFallback = false;\n const foldOptions = getFoldOptions(ctx, true);\n if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {\n foldOptions.onOverflow = () => {\n literalFallback = true;\n };\n }\n const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);\n if (!literalFallback)\n return `>${header}\\n${indent}${body}`;\n }\n value = value.replace(/\\n+/g, `$&${indent}`);\n return `|${header}\\n${indent}${start}${value}${end}`;\n}\nfunction plainString(item, ctx, onComment, onChompKeep) {\n const { type, value } = item;\n const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;\n if ((implicitKey && value.includes('\\n')) ||\n (inFlow && /[[\\]{},]/.test(value))) {\n return quotedString(value, ctx);\n }\n if (/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(value)) {\n // not allowed:\n // - '-' or '?'\n // - start with an indicator character (except [?:-]) or /[?-] /\n // - '\\n ', ': ' or ' \\n' anywhere\n // - '#' not preceded by a non-space char\n // - end with ' ' or ':'\n return implicitKey || inFlow || !value.includes('\\n')\n ? quotedString(value, ctx)\n : blockString(item, ctx, onComment, onChompKeep);\n }\n if (!implicitKey &&\n !inFlow &&\n type !== Scalar.Scalar.PLAIN &&\n value.includes('\\n')) {\n // Where allowed & type not set explicitly, prefer block style for multiline strings\n return blockString(item, ctx, onComment, onChompKeep);\n }\n if (containsDocumentMarker(value)) {\n if (indent === '') {\n ctx.forceBlockIndent = true;\n return blockString(item, ctx, onComment, onChompKeep);\n }\n else if (implicitKey && indent === indentStep) {\n return quotedString(value, ctx);\n }\n }\n const str = value.replace(/\\n+/g, `$&\\n${indent}`);\n // Verify that output will be parsed as a string, as e.g. plain numbers and\n // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),\n // and others in v1.1.\n if (actualString) {\n const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);\n const { compat, tags } = ctx.doc.schema;\n if (tags.some(test) || compat?.some(test))\n return quotedString(value, ctx);\n }\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction stringifyString(item, ctx, onComment, onChompKeep) {\n const { implicitKey, inFlow } = ctx;\n const ss = typeof item.value === 'string'\n ? item\n : Object.assign({}, item, { value: String(item.value) });\n let { type } = item;\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n // force double quotes on control characters & unpaired surrogates\n if (/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(ss.value))\n type = Scalar.Scalar.QUOTE_DOUBLE;\n }\n const _stringify = (_type) => {\n switch (_type) {\n case Scalar.Scalar.BLOCK_FOLDED:\n case Scalar.Scalar.BLOCK_LITERAL:\n return implicitKey || inFlow\n ? quotedString(ss.value, ctx) // blocks are not valid inside flow containers\n : blockString(ss, ctx, onComment, onChompKeep);\n case Scalar.Scalar.QUOTE_DOUBLE:\n return doubleQuotedString(ss.value, ctx);\n case Scalar.Scalar.QUOTE_SINGLE:\n return singleQuotedString(ss.value, ctx);\n case Scalar.Scalar.PLAIN:\n return plainString(ss, ctx, onComment, onChompKeep);\n default:\n return null;\n }\n };\n let res = _stringify(type);\n if (res === null) {\n const { defaultKeyType, defaultStringType } = ctx.options;\n const t = (implicitKey && defaultKeyType) || defaultStringType;\n res = _stringify(t);\n if (res === null)\n throw new Error(`Unsupported default string type ${t}`);\n }\n return res;\n}\n\nexports.stringifyString = stringifyString;\n",
|
|
23
|
+
"'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar identity = require('../nodes/identity.js');\nvar stringifyComment = require('./stringifyComment.js');\nvar stringifyString = require('./stringifyString.js');\n\nfunction createStringifyContext(doc, options) {\n const opt = Object.assign({\n blockQuote: true,\n commentString: stringifyComment.stringifyComment,\n defaultKeyType: null,\n defaultStringType: 'PLAIN',\n directives: null,\n doubleQuotedAsJSON: false,\n doubleQuotedMinMultiLineLength: 40,\n falseStr: 'false',\n flowCollectionPadding: true,\n indentSeq: true,\n lineWidth: 80,\n minContentWidth: 20,\n nullStr: 'null',\n simpleKeys: false,\n singleQuote: null,\n trailingComma: false,\n trueStr: 'true',\n verifyAliasOrder: true\n }, doc.schema.toStringOptions, options);\n let inFlow;\n switch (opt.collectionStyle) {\n case 'block':\n inFlow = false;\n break;\n case 'flow':\n inFlow = true;\n break;\n default:\n inFlow = null;\n }\n return {\n anchors: new Set(),\n doc,\n flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',\n indent: '',\n indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',\n inFlow,\n options: opt\n };\n}\nfunction getTagObject(tags, item) {\n if (item.tag) {\n const match = tags.filter(t => t.tag === item.tag);\n if (match.length > 0)\n return match.find(t => t.format === item.format) ?? match[0];\n }\n let tagObj = undefined;\n let obj;\n if (identity.isScalar(item)) {\n obj = item.value;\n let match = tags.filter(t => t.identify?.(obj));\n if (match.length > 1) {\n const testMatch = match.filter(t => t.test);\n if (testMatch.length > 0)\n match = testMatch;\n }\n tagObj =\n match.find(t => t.format === item.format) ?? match.find(t => !t.format);\n }\n else {\n obj = item;\n tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);\n }\n if (!tagObj) {\n const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);\n throw new Error(`Tag not resolved for ${name} value`);\n }\n return tagObj;\n}\n// needs to be called before value stringifier to allow for circular anchor refs\nfunction stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {\n if (!doc.directives)\n return '';\n const props = [];\n const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;\n if (anchor && anchors.anchorIsValid(anchor)) {\n anchors$1.add(anchor);\n props.push(`&${anchor}`);\n }\n const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);\n if (tag)\n props.push(doc.directives.tagString(tag));\n return props.join(' ');\n}\nfunction stringify(item, ctx, onComment, onChompKeep) {\n if (identity.isPair(item))\n return item.toString(ctx, onComment, onChompKeep);\n if (identity.isAlias(item)) {\n if (ctx.doc.directives)\n return item.toString(ctx);\n if (ctx.resolvedAliases?.has(item)) {\n throw new TypeError(`Cannot stringify circular structure without alias nodes`);\n }\n else {\n if (ctx.resolvedAliases)\n ctx.resolvedAliases.add(item);\n else\n ctx.resolvedAliases = new Set([item]);\n item = item.resolve(ctx.doc);\n }\n }\n let tagObj = undefined;\n const node = identity.isNode(item)\n ? item\n : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });\n tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));\n const props = stringifyProps(node, tagObj, ctx);\n if (props.length > 0)\n ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;\n const str = typeof tagObj.stringify === 'function'\n ? tagObj.stringify(node, ctx, onComment, onChompKeep)\n : identity.isScalar(node)\n ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)\n : node.toString(ctx, onComment, onChompKeep);\n if (!props)\n return str;\n return identity.isScalar(node) || str[0] === '{' || str[0] === '['\n ? `${props} ${str}`\n : `${props}\\n${ctx.indent}${str}`;\n}\n\nexports.createStringifyContext = createStringifyContext;\nexports.stringify = stringify;\n",
|
|
24
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyPair({ key, value }, ctx, onComment, onChompKeep) {\n const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;\n let keyComment = (identity.isNode(key) && key.comment) || null;\n if (simpleKeys) {\n if (keyComment) {\n throw new Error('With simple keys, key nodes cannot have comments');\n }\n if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {\n const msg = 'With simple keys, collection cannot be used as a key value';\n throw new Error(msg);\n }\n }\n let explicitKey = !simpleKeys &&\n (!key ||\n (keyComment && value == null && !ctx.inFlow) ||\n identity.isCollection(key) ||\n (identity.isScalar(key)\n ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL\n : typeof key === 'object'));\n ctx = Object.assign({}, ctx, {\n allNullValues: false,\n implicitKey: !explicitKey && (simpleKeys || !allNullValues),\n indent: indent + indentStep\n });\n let keyCommentDone = false;\n let chompKeep = false;\n let str = stringify.stringify(key, ctx, () => (keyCommentDone = true), () => (chompKeep = true));\n if (!explicitKey && !ctx.inFlow && str.length > 1024) {\n if (simpleKeys)\n throw new Error('With simple keys, single line scalar must not span more than 1024 characters');\n explicitKey = true;\n }\n if (ctx.inFlow) {\n if (allNullValues || value == null) {\n if (keyCommentDone && onComment)\n onComment();\n return str === '' ? '?' : explicitKey ? `? ${str}` : str;\n }\n }\n else if ((allNullValues && !simpleKeys) || (value == null && explicitKey)) {\n str = `? ${str}`;\n if (keyComment && !keyCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n }\n if (keyCommentDone)\n keyComment = null;\n if (explicitKey) {\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n str = `? ${str}\\n${indent}:`;\n }\n else {\n str = `${str}:`;\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n let vsb, vcb, valueComment;\n if (identity.isNode(value)) {\n vsb = !!value.spaceBefore;\n vcb = value.commentBefore;\n valueComment = value.comment;\n }\n else {\n vsb = false;\n vcb = null;\n valueComment = null;\n if (value && typeof value === 'object')\n value = doc.createNode(value);\n }\n ctx.implicitKey = false;\n if (!explicitKey && !keyComment && identity.isScalar(value))\n ctx.indentAtStart = str.length + 1;\n chompKeep = false;\n if (!indentSeq &&\n indentStep.length >= 2 &&\n !ctx.inFlow &&\n !explicitKey &&\n identity.isSeq(value) &&\n !value.flow &&\n !value.tag &&\n !value.anchor) {\n // If indentSeq === false, consider '- ' as part of indentation where possible\n ctx.indent = ctx.indent.substring(2);\n }\n let valueCommentDone = false;\n const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));\n let ws = ' ';\n if (keyComment || vsb || vcb) {\n ws = vsb ? '\\n' : '';\n if (vcb) {\n const cs = commentString(vcb);\n ws += `\\n${stringifyComment.indentComment(cs, ctx.indent)}`;\n }\n if (valueStr === '' && !ctx.inFlow) {\n if (ws === '\\n' && valueComment)\n ws = '\\n\\n';\n }\n else {\n ws += `\\n${ctx.indent}`;\n }\n }\n else if (!explicitKey && identity.isCollection(value)) {\n const vs0 = valueStr[0];\n const nl0 = valueStr.indexOf('\\n');\n const hasNewline = nl0 !== -1;\n const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;\n if (hasNewline || !flow) {\n let hasPropsLine = false;\n if (hasNewline && (vs0 === '&' || vs0 === '!')) {\n let sp0 = valueStr.indexOf(' ');\n if (vs0 === '&' &&\n sp0 !== -1 &&\n sp0 < nl0 &&\n valueStr[sp0 + 1] === '!') {\n sp0 = valueStr.indexOf(' ', sp0 + 1);\n }\n if (sp0 === -1 || nl0 < sp0)\n hasPropsLine = true;\n }\n if (!hasPropsLine)\n ws = `\\n${ctx.indent}`;\n }\n }\n else if (valueStr === '' || valueStr[0] === '\\n') {\n ws = '';\n }\n str += ws + valueStr;\n if (ctx.inFlow) {\n if (valueCommentDone && onComment)\n onComment();\n }\n else if (valueComment && !valueCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));\n }\n else if (chompKeep && onChompKeep) {\n onChompKeep();\n }\n return str;\n}\n\nexports.stringifyPair = stringifyPair;\n",
|
|
25
|
+
"'use strict';\n\nvar node_process = require('process');\n\nfunction debug(logLevel, ...messages) {\n if (logLevel === 'debug')\n console.log(...messages);\n}\nfunction warn(logLevel, warning) {\n if (logLevel === 'debug' || logLevel === 'warn') {\n if (typeof node_process.emitWarning === 'function')\n node_process.emitWarning(warning);\n else\n console.warn(warning);\n }\n}\n\nexports.debug = debug;\nexports.warn = warn;\n",
|
|
26
|
+
"'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Scalar = require('../../nodes/Scalar.js');\n\n// If the value associated with a merge key is a single mapping node, each of\n// its key/value pairs is inserted into the current mapping, unless the key\n// already exists in it. If the value associated with the merge key is a\n// sequence, then this sequence is expected to contain mapping nodes and each\n// of these nodes is merged in turn according to its order in the sequence.\n// Keys in mapping nodes earlier in the sequence override keys specified in\n// later mapping nodes. -- http://yaml.org/type/merge.html\nconst MERGE_KEY = '<<';\nconst merge = {\n identify: value => value === MERGE_KEY ||\n (typeof value === 'symbol' && value.description === MERGE_KEY),\n default: 'key',\n tag: 'tag:yaml.org,2002:merge',\n test: /^<<$/,\n resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {\n addToJSMap: addMergeToJSMap\n }),\n stringify: () => MERGE_KEY\n};\nconst isMergeKey = (ctx, key) => (merge.identify(key) ||\n (identity.isScalar(key) &&\n (!key.type || key.type === Scalar.Scalar.PLAIN) &&\n merge.identify(key.value))) &&\n ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);\nfunction addMergeToJSMap(ctx, map, value) {\n const source = resolveAliasValue(ctx, value);\n if (identity.isSeq(source))\n for (const it of source.items)\n mergeValue(ctx, map, it);\n else if (Array.isArray(source))\n for (const it of source)\n mergeValue(ctx, map, it);\n else\n mergeValue(ctx, map, source);\n}\nfunction mergeValue(ctx, map, value) {\n const source = resolveAliasValue(ctx, value);\n if (!identity.isMap(source))\n throw new Error('Merge sources must be maps or map aliases');\n const srcMap = source.toJSON(null, ctx, Map);\n for (const [key, value] of srcMap) {\n if (map instanceof Map) {\n if (!map.has(key))\n map.set(key, value);\n }\n else if (map instanceof Set) {\n map.add(key);\n }\n else if (!Object.prototype.hasOwnProperty.call(map, key)) {\n Object.defineProperty(map, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n }\n return map;\n}\nfunction resolveAliasValue(ctx, value) {\n return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;\n}\n\nexports.addMergeToJSMap = addMergeToJSMap;\nexports.isMergeKey = isMergeKey;\nexports.merge = merge;\n",
|
|
27
|
+
"'use strict';\n\nvar log = require('../log.js');\nvar merge = require('../schema/yaml-1.1/merge.js');\nvar stringify = require('../stringify/stringify.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nfunction addPairToJSMap(ctx, map, { key, value }) {\n if (identity.isNode(key) && key.addToJSMap)\n key.addToJSMap(ctx, map, value);\n // TODO: Should drop this special case for bare << handling\n else if (merge.isMergeKey(ctx, key))\n merge.addMergeToJSMap(ctx, map, value);\n else {\n const jsKey = toJS.toJS(key, '', ctx);\n if (map instanceof Map) {\n map.set(jsKey, toJS.toJS(value, jsKey, ctx));\n }\n else if (map instanceof Set) {\n map.add(jsKey);\n }\n else {\n const stringKey = stringifyKey(key, jsKey, ctx);\n const jsValue = toJS.toJS(value, stringKey, ctx);\n if (stringKey in map)\n Object.defineProperty(map, stringKey, {\n value: jsValue,\n writable: true,\n enumerable: true,\n configurable: true\n });\n else\n map[stringKey] = jsValue;\n }\n }\n return map;\n}\nfunction stringifyKey(key, jsKey, ctx) {\n if (jsKey === null)\n return '';\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n if (typeof jsKey !== 'object')\n return String(jsKey);\n if (identity.isNode(key) && ctx?.doc) {\n const strCtx = stringify.createStringifyContext(ctx.doc, {});\n strCtx.anchors = new Set();\n for (const node of ctx.anchors.keys())\n strCtx.anchors.add(node.anchor);\n strCtx.inFlow = true;\n strCtx.inStringifyKey = true;\n const strKey = key.toString(strCtx);\n if (!ctx.mapKeyWarned) {\n let jsonStr = JSON.stringify(strKey);\n if (jsonStr.length > 40)\n jsonStr = jsonStr.substring(0, 36) + '...\"';\n log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);\n ctx.mapKeyWarned = true;\n }\n return strKey;\n }\n return JSON.stringify(jsKey);\n}\n\nexports.addPairToJSMap = addPairToJSMap;\n",
|
|
28
|
+
"'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyPair = require('../stringify/stringifyPair.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar identity = require('./identity.js');\n\nfunction createPair(key, value, ctx) {\n const k = createNode.createNode(key, undefined, ctx);\n const v = createNode.createNode(value, undefined, ctx);\n return new Pair(k, v);\n}\nclass Pair {\n constructor(key, value = null) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });\n this.key = key;\n this.value = value;\n }\n clone(schema) {\n let { key, value } = this;\n if (identity.isNode(key))\n key = key.clone(schema);\n if (identity.isNode(value))\n value = value.clone(schema);\n return new Pair(key, value);\n }\n toJSON(_, ctx) {\n const pair = ctx?.mapAsMap ? new Map() : {};\n return addPairToJSMap.addPairToJSMap(ctx, pair, this);\n }\n toString(ctx, onComment, onChompKeep) {\n return ctx?.doc\n ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)\n : JSON.stringify(this);\n }\n}\n\nexports.Pair = Pair;\nexports.createPair = createPair;\n",
|
|
29
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyCollection(collection, ctx, options) {\n const flow = ctx.inFlow ?? collection.flow;\n const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;\n return stringify(collection, ctx, options);\n}\nfunction stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {\n const { indent, options: { commentString } } = ctx;\n const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });\n let chompKeep = false; // flag for the preceding node's status\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (!chompKeep && item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, chompKeep);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (!chompKeep && ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);\n }\n }\n chompKeep = false;\n let str = stringify.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (chompKeep && comment)\n chompKeep = false;\n lines.push(blockItemPrefix + str);\n }\n let str;\n if (lines.length === 0) {\n str = flowChars.start + flowChars.end;\n }\n else {\n str = lines[0];\n for (let i = 1; i < lines.length; ++i) {\n const line = lines[i];\n str += line ? `\\n${indent}${line}` : '\\n';\n }\n }\n if (comment) {\n str += '\\n' + stringifyComment.indentComment(commentString(comment), indent);\n if (onComment)\n onComment();\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n}\nfunction stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {\n const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;\n itemIndent += indentStep;\n const itemCtx = Object.assign({}, ctx, {\n indent: itemIndent,\n inFlow: true,\n type: null\n });\n let reqNewline = false;\n let linesAtValue = 0;\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, false);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, false);\n if (ik.comment)\n reqNewline = true;\n }\n const iv = identity.isNode(item.value) ? item.value : null;\n if (iv) {\n if (iv.comment)\n comment = iv.comment;\n if (iv.commentBefore)\n reqNewline = true;\n }\n else if (item.value == null && ik?.comment) {\n comment = ik.comment;\n }\n }\n if (comment)\n reqNewline = true;\n let str = stringify.stringify(item, itemCtx, () => (comment = null));\n reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\\n'));\n if (i < items.length - 1) {\n str += ',';\n }\n else if (ctx.options.trailingComma) {\n if (ctx.options.lineWidth > 0) {\n reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +\n (str.length + 2) >\n ctx.options.lineWidth);\n }\n if (reqNewline) {\n str += ',';\n }\n }\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n lines.push(str);\n linesAtValue = lines.length;\n }\n const { start, end } = flowChars;\n if (lines.length === 0) {\n return start + end;\n }\n else {\n if (!reqNewline) {\n const len = lines.reduce((sum, line) => sum + line.length + 2, 2);\n reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;\n }\n if (reqNewline) {\n let str = start;\n for (const line of lines)\n str += line ? `\\n${indentStep}${indent}${line}` : '\\n';\n return `${str}\\n${indent}${end}`;\n }\n else {\n return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;\n }\n }\n}\nfunction addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {\n if (comment && chompKeep)\n comment = comment.replace(/^\\n+/, '');\n if (comment) {\n const ic = stringifyComment.indentComment(commentString(comment), indent);\n lines.push(ic.trimStart()); // Avoid double indent on first line\n }\n}\n\nexports.stringifyCollection = stringifyCollection;\n",
|
|
30
|
+
"'use strict';\n\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Pair = require('./Pair.js');\nvar Scalar = require('./Scalar.js');\n\nfunction findPair(items, key) {\n const k = identity.isScalar(key) ? key.value : key;\n for (const it of items) {\n if (identity.isPair(it)) {\n if (it.key === key || it.key === k)\n return it;\n if (identity.isScalar(it.key) && it.key.value === k)\n return it;\n }\n }\n return undefined;\n}\nclass YAMLMap extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:map';\n }\n constructor(schema) {\n super(identity.MAP, schema);\n this.items = [];\n }\n /**\n * A generic collection parsing method that can be extended\n * to other node classes that inherit from YAMLMap\n */\n static from(schema, obj, ctx) {\n const { keepUndefined, replacer } = ctx;\n const map = new this(schema);\n const add = (key, value) => {\n if (typeof replacer === 'function')\n value = replacer.call(obj, key, value);\n else if (Array.isArray(replacer) && !replacer.includes(key))\n return;\n if (value !== undefined || keepUndefined)\n map.items.push(Pair.createPair(key, value, ctx));\n };\n if (obj instanceof Map) {\n for (const [key, value] of obj)\n add(key, value);\n }\n else if (obj && typeof obj === 'object') {\n for (const key of Object.keys(obj))\n add(key, obj[key]);\n }\n if (typeof schema.sortMapEntries === 'function') {\n map.items.sort(schema.sortMapEntries);\n }\n return map;\n }\n /**\n * Adds a value to the collection.\n *\n * @param overwrite - If not set `true`, using a key that is already in the\n * collection will throw. Otherwise, overwrites the previous value.\n */\n add(pair, overwrite) {\n let _pair;\n if (identity.isPair(pair))\n _pair = pair;\n else if (!pair || typeof pair !== 'object' || !('key' in pair)) {\n // In TypeScript, this never happens.\n _pair = new Pair.Pair(pair, pair?.value);\n }\n else\n _pair = new Pair.Pair(pair.key, pair.value);\n const prev = findPair(this.items, _pair.key);\n const sortEntries = this.schema?.sortMapEntries;\n if (prev) {\n if (!overwrite)\n throw new Error(`Key ${_pair.key} already set`);\n // For scalars, keep the old node & its comments and anchors\n if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))\n prev.value.value = _pair.value;\n else\n prev.value = _pair.value;\n }\n else if (sortEntries) {\n const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);\n if (i === -1)\n this.items.push(_pair);\n else\n this.items.splice(i, 0, _pair);\n }\n else {\n this.items.push(_pair);\n }\n }\n delete(key) {\n const it = findPair(this.items, key);\n if (!it)\n return false;\n const del = this.items.splice(this.items.indexOf(it), 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const it = findPair(this.items, key);\n const node = it?.value;\n return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? undefined;\n }\n has(key) {\n return !!findPair(this.items, key);\n }\n set(key, value) {\n this.add(new Pair.Pair(key, value), true);\n }\n /**\n * @param ctx - Conversion context, originally set in Document#toJS()\n * @param {Class} Type - If set, forces the returned collection type\n * @returns Instance of Type, Map, or Object\n */\n toJSON(_, ctx, Type) {\n const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const item of this.items)\n addPairToJSMap.addPairToJSMap(ctx, map, item);\n return map;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n for (const item of this.items) {\n if (!identity.isPair(item))\n throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);\n }\n if (!ctx.allNullValues && this.hasAllNullValues(false))\n ctx = Object.assign({}, ctx, { allNullValues: true });\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '',\n flowChars: { start: '{', end: '}' },\n itemIndent: ctx.indent || '',\n onChompKeep,\n onComment\n });\n }\n}\n\nexports.YAMLMap = YAMLMap;\nexports.findPair = findPair;\n",
|
|
31
|
+
"'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nconst map = {\n collection: 'map',\n default: true,\n nodeClass: YAMLMap.YAMLMap,\n tag: 'tag:yaml.org,2002:map',\n resolve(map, onError) {\n if (!identity.isMap(map))\n onError('Expected a mapping for this tag');\n return map;\n },\n createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)\n};\n\nexports.map = map;\n",
|
|
32
|
+
"'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Scalar = require('./Scalar.js');\nvar toJS = require('./toJS.js');\n\nclass YAMLSeq extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:seq';\n }\n constructor(schema) {\n super(identity.SEQ, schema);\n this.items = [];\n }\n add(value) {\n this.items.push(value);\n }\n /**\n * Removes a value from the collection.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n *\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return false;\n const del = this.items.splice(idx, 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return undefined;\n const it = this.items[idx];\n return !keepScalar && identity.isScalar(it) ? it.value : it;\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n */\n has(key) {\n const idx = asItemIndex(key);\n return typeof idx === 'number' && idx < this.items.length;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n *\n * If `key` does not contain a representation of an integer, this will throw.\n * It may be wrapped in a `Scalar`.\n */\n set(key, value) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n throw new Error(`Expected a valid index, not ${key}.`);\n const prev = this.items[idx];\n if (identity.isScalar(prev) && Scalar.isScalarValue(value))\n prev.value = value;\n else\n this.items[idx] = value;\n }\n toJSON(_, ctx) {\n const seq = [];\n if (ctx?.onCreate)\n ctx.onCreate(seq);\n let i = 0;\n for (const item of this.items)\n seq.push(toJS.toJS(item, String(i++), ctx));\n return seq;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '- ',\n flowChars: { start: '[', end: ']' },\n itemIndent: (ctx.indent || '') + ' ',\n onChompKeep,\n onComment\n });\n }\n static from(schema, obj, ctx) {\n const { replacer } = ctx;\n const seq = new this(schema);\n if (obj && Symbol.iterator in Object(obj)) {\n let i = 0;\n for (let it of obj) {\n if (typeof replacer === 'function') {\n const key = obj instanceof Set ? it : String(i++);\n it = replacer.call(obj, key, it);\n }\n seq.items.push(createNode.createNode(it, undefined, ctx));\n }\n }\n return seq;\n }\n}\nfunction asItemIndex(key) {\n let idx = identity.isScalar(key) ? key.value : key;\n if (idx && typeof idx === 'string')\n idx = Number(idx);\n return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0\n ? idx\n : null;\n}\n\nexports.YAMLSeq = YAMLSeq;\n",
|
|
33
|
+
"'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nconst seq = {\n collection: 'seq',\n default: true,\n nodeClass: YAMLSeq.YAMLSeq,\n tag: 'tag:yaml.org,2002:seq',\n resolve(seq, onError) {\n if (!identity.isSeq(seq))\n onError('Expected a sequence for this tag');\n return seq;\n },\n createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)\n};\n\nexports.seq = seq;\n",
|
|
34
|
+
"'use strict';\n\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst string = {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify(item, ctx, onComment, onChompKeep) {\n ctx = Object.assign({ actualString: true }, ctx);\n return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);\n }\n};\n\nexports.string = string;\n",
|
|
35
|
+
"'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst nullTag = {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^(?:~|[Nn]ull|NULL)?$/,\n resolve: () => new Scalar.Scalar(null),\n stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)\n ? source\n : ctx.options.nullStr\n};\n\nexports.nullTag = nullTag;\n",
|
|
36
|
+
"'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst boolTag = {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,\n resolve: str => new Scalar.Scalar(str[0] === 't' || str[0] === 'T'),\n stringify({ source, value }, ctx) {\n if (source && boolTag.test.test(source)) {\n const sv = source[0] === 't' || source[0] === 'T';\n if (value === sv)\n return source;\n }\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n }\n};\n\nexports.boolTag = boolTag;\n",
|
|
37
|
+
"'use strict';\n\nfunction stringifyNumber({ format, minFractionDigits, tag, value }) {\n if (typeof value === 'bigint')\n return String(value);\n const num = typeof value === 'number' ? value : Number(value);\n if (!isFinite(num))\n return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';\n let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);\n if (!format &&\n minFractionDigits &&\n (!tag || tag === 'tag:yaml.org,2002:float') &&\n /^-?\\d/.test(n) &&\n !n.includes('e')) {\n let i = n.indexOf('.');\n if (i < 0) {\n i = n.length;\n n += '.';\n }\n let d = minFractionDigits - (n.length - i - 1);\n while (d-- > 0)\n n += '0';\n }\n return n;\n}\n\nexports.stringifyNumber = stringifyNumber;\n",
|
|
38
|
+
"'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: str => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,\n resolve: str => parseFloat(str),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str));\n const dot = str.indexOf('.');\n if (dot !== -1 && str[str.length - 1] === '0')\n node.minFractionDigits = str.length - dot - 1;\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n",
|
|
39
|
+
"'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nconst intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value) && value >= 0)\n return prefix + value.toString(radix);\n return stringifyNumber.stringifyNumber(node);\n}\nconst intOct = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^0o[0-7]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),\n stringify: node => intStringify(node, 8, '0o')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^0x[0-9a-fA-F]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intHex = intHex;\nexports.intOct = intOct;\n",
|
|
40
|
+
"'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.boolTag,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float\n];\n\nexports.schema = schema;\n",
|
|
41
|
+
"'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar map = require('../common/map.js');\nvar seq = require('../common/seq.js');\n\nfunction intIdentify(value) {\n return typeof value === 'bigint' || Number.isInteger(value);\n}\nconst stringifyJSON = ({ value }) => JSON.stringify(value);\nconst jsonScalars = [\n {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify: stringifyJSON\n },\n {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^null$/,\n resolve: () => null,\n stringify: stringifyJSON\n },\n {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^true$|^false$/,\n resolve: str => str === 'true',\n stringify: stringifyJSON\n },\n {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^-?(?:0|[1-9][0-9]*)$/,\n resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),\n stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)\n },\n {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,\n resolve: str => parseFloat(str),\n stringify: stringifyJSON\n }\n];\nconst jsonError = {\n default: true,\n tag: '',\n test: /^/,\n resolve(str, onError) {\n onError(`Unresolved plain scalar ${JSON.stringify(str)}`);\n return str;\n }\n};\nconst schema = [map.map, seq.seq].concat(jsonScalars, jsonError);\n\nexports.schema = schema;\n",
|
|
42
|
+
"'use strict';\n\nvar node_buffer = require('buffer');\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst binary = {\n identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array\n default: false,\n tag: 'tag:yaml.org,2002:binary',\n /**\n * Returns a Buffer in node and an Uint8Array in browsers\n *\n * To use the resulting buffer as an image, you'll want to do something like:\n *\n * const blob = new Blob([buffer], { type: 'image/jpeg' })\n * document.querySelector('#photo').src = URL.createObjectURL(blob)\n */\n resolve(src, onError) {\n if (typeof node_buffer.Buffer === 'function') {\n return node_buffer.Buffer.from(src, 'base64');\n }\n else if (typeof atob === 'function') {\n // On IE 11, atob() can't handle newlines\n const str = atob(src.replace(/[\\n\\r]/g, ''));\n const buffer = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i)\n buffer[i] = str.charCodeAt(i);\n return buffer;\n }\n else {\n onError('This environment does not support reading binary tags; either Buffer or atob is required');\n return src;\n }\n },\n stringify({ comment, type, value }, ctx, onComment, onChompKeep) {\n if (!value)\n return '';\n const buf = value; // checked earlier by binary.identify()\n let str;\n if (typeof node_buffer.Buffer === 'function') {\n str =\n buf instanceof node_buffer.Buffer\n ? buf.toString('base64')\n : node_buffer.Buffer.from(buf.buffer).toString('base64');\n }\n else if (typeof btoa === 'function') {\n let s = '';\n for (let i = 0; i < buf.length; ++i)\n s += String.fromCharCode(buf[i]);\n str = btoa(s);\n }\n else {\n throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');\n }\n type ?? (type = Scalar.Scalar.BLOCK_LITERAL);\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);\n const n = Math.ceil(str.length / lineWidth);\n const lines = new Array(n);\n for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {\n lines[i] = str.substr(o, lineWidth);\n }\n str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? '\\n' : ' ');\n }\n return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);\n }\n};\n\nexports.binary = binary;\n",
|
|
43
|
+
"'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar Scalar = require('../../nodes/Scalar.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nfunction resolvePairs(seq, onError) {\n if (identity.isSeq(seq)) {\n for (let i = 0; i < seq.items.length; ++i) {\n let item = seq.items[i];\n if (identity.isPair(item))\n continue;\n else if (identity.isMap(item)) {\n if (item.items.length > 1)\n onError('Each pair must have its own sequence indicator');\n const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));\n if (item.commentBefore)\n pair.key.commentBefore = pair.key.commentBefore\n ? `${item.commentBefore}\\n${pair.key.commentBefore}`\n : item.commentBefore;\n if (item.comment) {\n const cn = pair.value ?? pair.key;\n cn.comment = cn.comment\n ? `${item.comment}\\n${cn.comment}`\n : item.comment;\n }\n item = pair;\n }\n seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);\n }\n }\n else\n onError('Expected a sequence for this tag');\n return seq;\n}\nfunction createPairs(schema, iterable, ctx) {\n const { replacer } = ctx;\n const pairs = new YAMLSeq.YAMLSeq(schema);\n pairs.tag = 'tag:yaml.org,2002:pairs';\n let i = 0;\n if (iterable && Symbol.iterator in Object(iterable))\n for (let it of iterable) {\n if (typeof replacer === 'function')\n it = replacer.call(iterable, String(i++), it);\n let key, value;\n if (Array.isArray(it)) {\n if (it.length === 2) {\n key = it[0];\n value = it[1];\n }\n else\n throw new TypeError(`Expected [key, value] tuple: ${it}`);\n }\n else if (it && it instanceof Object) {\n const keys = Object.keys(it);\n if (keys.length === 1) {\n key = keys[0];\n value = it[key];\n }\n else {\n throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);\n }\n }\n else {\n key = it;\n }\n pairs.items.push(Pair.createPair(key, value, ctx));\n }\n return pairs;\n}\nconst pairs = {\n collection: 'seq',\n default: false,\n tag: 'tag:yaml.org,2002:pairs',\n resolve: resolvePairs,\n createNode: createPairs\n};\n\nexports.createPairs = createPairs;\nexports.pairs = pairs;\nexports.resolvePairs = resolvePairs;\n",
|
|
44
|
+
"'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar toJS = require('../../nodes/toJS.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\nvar pairs = require('./pairs.js');\n\nclass YAMLOMap extends YAMLSeq.YAMLSeq {\n constructor() {\n super();\n this.add = YAMLMap.YAMLMap.prototype.add.bind(this);\n this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this);\n this.get = YAMLMap.YAMLMap.prototype.get.bind(this);\n this.has = YAMLMap.YAMLMap.prototype.has.bind(this);\n this.set = YAMLMap.YAMLMap.prototype.set.bind(this);\n this.tag = YAMLOMap.tag;\n }\n /**\n * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,\n * but TypeScript won't allow widening the signature of a child method.\n */\n toJSON(_, ctx) {\n if (!ctx)\n return super.toJSON(_);\n const map = new Map();\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const pair of this.items) {\n let key, value;\n if (identity.isPair(pair)) {\n key = toJS.toJS(pair.key, '', ctx);\n value = toJS.toJS(pair.value, key, ctx);\n }\n else {\n key = toJS.toJS(pair, '', ctx);\n }\n if (map.has(key))\n throw new Error('Ordered maps must not include duplicate keys');\n map.set(key, value);\n }\n return map;\n }\n static from(schema, iterable, ctx) {\n const pairs$1 = pairs.createPairs(schema, iterable, ctx);\n const omap = new this();\n omap.items = pairs$1.items;\n return omap;\n }\n}\nYAMLOMap.tag = 'tag:yaml.org,2002:omap';\nconst omap = {\n collection: 'seq',\n identify: value => value instanceof Map,\n nodeClass: YAMLOMap,\n default: false,\n tag: 'tag:yaml.org,2002:omap',\n resolve(seq, onError) {\n const pairs$1 = pairs.resolvePairs(seq, onError);\n const seenKeys = [];\n for (const { key } of pairs$1.items) {\n if (identity.isScalar(key)) {\n if (seenKeys.includes(key.value)) {\n onError(`Ordered maps must not include duplicate keys: ${key.value}`);\n }\n else {\n seenKeys.push(key.value);\n }\n }\n }\n return Object.assign(new YAMLOMap(), pairs$1);\n },\n createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)\n};\n\nexports.YAMLOMap = YAMLOMap;\nexports.omap = omap;\n",
|
|
45
|
+
"'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nfunction boolStringify({ value, source }, ctx) {\n const boolObj = value ? trueTag : falseTag;\n if (source && boolObj.test.test(source))\n return source;\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n}\nconst trueTag = {\n identify: value => value === true,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,\n resolve: () => new Scalar.Scalar(true),\n stringify: boolStringify\n};\nconst falseTag = {\n identify: value => value === false,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,\n resolve: () => new Scalar.Scalar(false),\n stringify: boolStringify\n};\n\nexports.falseTag = falseTag;\nexports.trueTag = trueTag;\n",
|
|
46
|
+
"'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: (str) => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,\n resolve: (str) => parseFloat(str.replace(/_/g, '')),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, '')));\n const dot = str.indexOf('.');\n if (dot !== -1) {\n const f = str.substring(dot + 1).replace(/_/g, '');\n if (f[f.length - 1] === '0')\n node.minFractionDigits = f.length;\n }\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n",
|
|
47
|
+
"'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nfunction intResolve(str, offset, radix, { intAsBigInt }) {\n const sign = str[0];\n if (sign === '-' || sign === '+')\n offset += 1;\n str = str.substring(offset).replace(/_/g, '');\n if (intAsBigInt) {\n switch (radix) {\n case 2:\n str = `0b${str}`;\n break;\n case 8:\n str = `0o${str}`;\n break;\n case 16:\n str = `0x${str}`;\n break;\n }\n const n = BigInt(str);\n return sign === '-' ? BigInt(-1) * n : n;\n }\n const n = parseInt(str, radix);\n return sign === '-' ? -1 * n : n;\n}\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value)) {\n const str = value.toString(radix);\n return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;\n }\n return stringifyNumber.stringifyNumber(node);\n}\nconst intBin = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'BIN',\n test: /^[-+]?0b[0-1_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),\n stringify: node => intStringify(node, 2, '0b')\n};\nconst intOct = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^[-+]?0[0-7_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),\n stringify: node => intStringify(node, 8, '0')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9][0-9_]*$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^[-+]?0x[0-9a-fA-F_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intBin = intBin;\nexports.intHex = intHex;\nexports.intOct = intOct;\n",
|
|
48
|
+
"'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nclass YAMLSet extends YAMLMap.YAMLMap {\n constructor(schema) {\n super(schema);\n this.tag = YAMLSet.tag;\n }\n add(key) {\n let pair;\n if (identity.isPair(key))\n pair = key;\n else if (key &&\n typeof key === 'object' &&\n 'key' in key &&\n 'value' in key &&\n key.value === null)\n pair = new Pair.Pair(key.key, null);\n else\n pair = new Pair.Pair(key, null);\n const prev = YAMLMap.findPair(this.items, pair.key);\n if (!prev)\n this.items.push(pair);\n }\n /**\n * If `keepPair` is `true`, returns the Pair matching `key`.\n * Otherwise, returns the value of that Pair's key.\n */\n get(key, keepPair) {\n const pair = YAMLMap.findPair(this.items, key);\n return !keepPair && identity.isPair(pair)\n ? identity.isScalar(pair.key)\n ? pair.key.value\n : pair.key\n : pair;\n }\n set(key, value) {\n if (typeof value !== 'boolean')\n throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);\n const prev = YAMLMap.findPair(this.items, key);\n if (prev && !value) {\n this.items.splice(this.items.indexOf(prev), 1);\n }\n else if (!prev && value) {\n this.items.push(new Pair.Pair(key));\n }\n }\n toJSON(_, ctx) {\n return super.toJSON(_, ctx, Set);\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n if (this.hasAllNullValues(true))\n return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);\n else\n throw new Error('Set items must all have null values');\n }\n static from(schema, iterable, ctx) {\n const { replacer } = ctx;\n const set = new this(schema);\n if (iterable && Symbol.iterator in Object(iterable))\n for (let value of iterable) {\n if (typeof replacer === 'function')\n value = replacer.call(iterable, value, value);\n set.items.push(Pair.createPair(value, null, ctx));\n }\n return set;\n }\n}\nYAMLSet.tag = 'tag:yaml.org,2002:set';\nconst set = {\n collection: 'map',\n identify: value => value instanceof Set,\n nodeClass: YAMLSet,\n default: false,\n tag: 'tag:yaml.org,2002:set',\n createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),\n resolve(map, onError) {\n if (identity.isMap(map)) {\n if (map.hasAllNullValues(true))\n return Object.assign(new YAMLSet(), map);\n else\n onError('Set items must all have null values');\n }\n else\n onError('Expected a mapping for this tag');\n return map;\n }\n};\n\nexports.YAMLSet = YAMLSet;\nexports.set = set;\n",
|
|
49
|
+
"'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\n/** Internal types handle bigint as number, because TS can't figure it out. */\nfunction parseSexagesimal(str, asBigInt) {\n const sign = str[0];\n const parts = sign === '-' || sign === '+' ? str.substring(1) : str;\n const num = (n) => asBigInt ? BigInt(n) : Number(n);\n const res = parts\n .replace(/_/g, '')\n .split(':')\n .reduce((res, p) => res * num(60) + num(p), num(0));\n return (sign === '-' ? num(-1) * res : res);\n}\n/**\n * hhhh:mm:ss.sss\n *\n * Internal types handle bigint as number, because TS can't figure it out.\n */\nfunction stringifySexagesimal(node) {\n let { value } = node;\n let num = (n) => n;\n if (typeof value === 'bigint')\n num = n => BigInt(n);\n else if (isNaN(value) || !isFinite(value))\n return stringifyNumber.stringifyNumber(node);\n let sign = '';\n if (value < 0) {\n sign = '-';\n value *= num(-1);\n }\n const _60 = num(60);\n const parts = [value % _60]; // seconds, including ms\n if (value < 60) {\n parts.unshift(0); // at least one : is required\n }\n else {\n value = (value - parts[0]) / _60;\n parts.unshift(value % _60); // minutes\n if (value >= 60) {\n value = (value - parts[0]) / _60;\n parts.unshift(value); // hours\n }\n }\n return (sign +\n parts\n .map(n => String(n).padStart(2, '0'))\n .join(':')\n .replace(/000000\\d*$/, '') // % 60 may introduce error\n );\n}\nconst intTime = {\n identify: value => typeof value === 'bigint' || Number.isInteger(value),\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,\n resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),\n stringify: stringifySexagesimal\n};\nconst floatTime = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,\n resolve: str => parseSexagesimal(str, false),\n stringify: stringifySexagesimal\n};\nconst timestamp = {\n identify: value => value instanceof Date,\n default: true,\n tag: 'tag:yaml.org,2002:timestamp',\n // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part\n // may be omitted altogether, resulting in a date format. In such a case, the time part is\n // assumed to be 00:00:00Z (start of day, UTC).\n test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd\n '(?:' + // time is optional\n '(?:t|T|[ \\\\t]+)' + // t | T | whitespace\n '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?\n '(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30\n ')?$'),\n resolve(str) {\n const match = str.match(timestamp.test);\n if (!match)\n throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');\n const [, year, month, day, hour, minute, second] = match.map(Number);\n const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;\n let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);\n const tz = match[8];\n if (tz && tz !== 'Z') {\n let d = parseSexagesimal(tz, false);\n if (Math.abs(d) < 30)\n d *= 60;\n date -= 60000 * d;\n }\n return new Date(date);\n },\n stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\\.000Z$/, '') ?? ''\n};\n\nexports.floatTime = floatTime;\nexports.intTime = intTime;\nexports.timestamp = timestamp;\n",
|
|
50
|
+
"'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar binary = require('./binary.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\nvar merge = require('./merge.js');\nvar omap = require('./omap.js');\nvar pairs = require('./pairs.js');\nvar set = require('./set.js');\nvar timestamp = require('./timestamp.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.trueTag,\n bool.falseTag,\n int.intBin,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float,\n binary.binary,\n merge.merge,\n omap.omap,\n pairs.pairs,\n set.set,\n timestamp.intTime,\n timestamp.floatTime,\n timestamp.timestamp\n];\n\nexports.schema = schema;\n",
|
|
51
|
+
"'use strict';\n\nvar map = require('./common/map.js');\nvar _null = require('./common/null.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar bool = require('./core/bool.js');\nvar float = require('./core/float.js');\nvar int = require('./core/int.js');\nvar schema = require('./core/schema.js');\nvar schema$1 = require('./json/schema.js');\nvar binary = require('./yaml-1.1/binary.js');\nvar merge = require('./yaml-1.1/merge.js');\nvar omap = require('./yaml-1.1/omap.js');\nvar pairs = require('./yaml-1.1/pairs.js');\nvar schema$2 = require('./yaml-1.1/schema.js');\nvar set = require('./yaml-1.1/set.js');\nvar timestamp = require('./yaml-1.1/timestamp.js');\n\nconst schemas = new Map([\n ['core', schema.schema],\n ['failsafe', [map.map, seq.seq, string.string]],\n ['json', schema$1.schema],\n ['yaml11', schema$2.schema],\n ['yaml-1.1', schema$2.schema]\n]);\nconst tagsByName = {\n binary: binary.binary,\n bool: bool.boolTag,\n float: float.float,\n floatExp: float.floatExp,\n floatNaN: float.floatNaN,\n floatTime: timestamp.floatTime,\n int: int.int,\n intHex: int.intHex,\n intOct: int.intOct,\n intTime: timestamp.intTime,\n map: map.map,\n merge: merge.merge,\n null: _null.nullTag,\n omap: omap.omap,\n pairs: pairs.pairs,\n seq: seq.seq,\n set: set.set,\n timestamp: timestamp.timestamp\n};\nconst coreKnownTags = {\n 'tag:yaml.org,2002:binary': binary.binary,\n 'tag:yaml.org,2002:merge': merge.merge,\n 'tag:yaml.org,2002:omap': omap.omap,\n 'tag:yaml.org,2002:pairs': pairs.pairs,\n 'tag:yaml.org,2002:set': set.set,\n 'tag:yaml.org,2002:timestamp': timestamp.timestamp\n};\nfunction getTags(customTags, schemaName, addMergeTag) {\n const schemaTags = schemas.get(schemaName);\n if (schemaTags && !customTags) {\n return addMergeTag && !schemaTags.includes(merge.merge)\n ? schemaTags.concat(merge.merge)\n : schemaTags.slice();\n }\n let tags = schemaTags;\n if (!tags) {\n if (Array.isArray(customTags))\n tags = [];\n else {\n const keys = Array.from(schemas.keys())\n .filter(key => key !== 'yaml11')\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown schema \"${schemaName}\"; use one of ${keys} or define customTags array`);\n }\n }\n if (Array.isArray(customTags)) {\n for (const tag of customTags)\n tags = tags.concat(tag);\n }\n else if (typeof customTags === 'function') {\n tags = customTags(tags.slice());\n }\n if (addMergeTag)\n tags = tags.concat(merge.merge);\n return tags.reduce((tags, tag) => {\n const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;\n if (!tagObj) {\n const tagName = JSON.stringify(tag);\n const keys = Object.keys(tagsByName)\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);\n }\n if (!tags.includes(tagObj))\n tags.push(tagObj);\n return tags;\n }, []);\n}\n\nexports.coreKnownTags = coreKnownTags;\nexports.getTags = getTags;\n",
|
|
52
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar map = require('./common/map.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar tags = require('./tags.js');\n\nconst sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;\nclass Schema {\n constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {\n this.compat = Array.isArray(compat)\n ? tags.getTags(compat, 'compat')\n : compat\n ? tags.getTags(null, compat)\n : null;\n this.name = (typeof schema === 'string' && schema) || 'core';\n this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};\n this.tags = tags.getTags(customTags, this.name, merge);\n this.toStringOptions = toStringDefaults ?? null;\n Object.defineProperty(this, identity.MAP, { value: map.map });\n Object.defineProperty(this, identity.SCALAR, { value: string.string });\n Object.defineProperty(this, identity.SEQ, { value: seq.seq });\n // Used by createMap()\n this.sortMapEntries =\n typeof sortMapEntries === 'function'\n ? sortMapEntries\n : sortMapEntries === true\n ? sortMapEntriesByKey\n : null;\n }\n clone() {\n const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));\n copy.tags = this.tags.slice();\n return copy;\n }\n}\n\nexports.Schema = Schema;\n",
|
|
53
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyDocument(doc, options) {\n const lines = [];\n let hasDirectives = options.directives === true;\n if (options.directives !== false && doc.directives) {\n const dir = doc.directives.toString(doc);\n if (dir) {\n lines.push(dir);\n hasDirectives = true;\n }\n else if (doc.directives.docStart)\n hasDirectives = true;\n }\n if (hasDirectives)\n lines.push('---');\n const ctx = stringify.createStringifyContext(doc, options);\n const { commentString } = ctx.options;\n if (doc.commentBefore) {\n if (lines.length !== 1)\n lines.unshift('');\n const cs = commentString(doc.commentBefore);\n lines.unshift(stringifyComment.indentComment(cs, ''));\n }\n let chompKeep = false;\n let contentComment = null;\n if (doc.contents) {\n if (identity.isNode(doc.contents)) {\n if (doc.contents.spaceBefore && hasDirectives)\n lines.push('');\n if (doc.contents.commentBefore) {\n const cs = commentString(doc.contents.commentBefore);\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n // top-level block scalars need to be indented if followed by a comment\n ctx.forceBlockIndent = !!doc.comment;\n contentComment = doc.contents.comment;\n }\n const onChompKeep = contentComment ? undefined : () => (chompKeep = true);\n let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);\n if (contentComment)\n body += stringifyComment.lineComment(body, '', commentString(contentComment));\n if ((body[0] === '|' || body[0] === '>') &&\n lines[lines.length - 1] === '---') {\n // Top-level block scalars with a preceding doc marker ought to use the\n // same line for their header.\n lines[lines.length - 1] = `--- ${body}`;\n }\n else\n lines.push(body);\n }\n else {\n lines.push(stringify.stringify(doc.contents, ctx));\n }\n if (doc.directives?.docEnd) {\n if (doc.comment) {\n const cs = commentString(doc.comment);\n if (cs.includes('\\n')) {\n lines.push('...');\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n else {\n lines.push(`... ${cs}`);\n }\n }\n else {\n lines.push('...');\n }\n }\n else {\n let dc = doc.comment;\n if (dc && chompKeep)\n dc = dc.replace(/^\\n+/, '');\n if (dc) {\n if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')\n lines.push('');\n lines.push(stringifyComment.indentComment(commentString(dc), ''));\n }\n }\n return lines.join('\\n') + '\\n';\n}\n\nexports.stringifyDocument = stringifyDocument;\n",
|
|
54
|
+
"'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar Collection = require('../nodes/Collection.js');\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar toJS = require('../nodes/toJS.js');\nvar Schema = require('../schema/Schema.js');\nvar stringifyDocument = require('../stringify/stringifyDocument.js');\nvar anchors = require('./anchors.js');\nvar applyReviver = require('./applyReviver.js');\nvar createNode = require('./createNode.js');\nvar directives = require('./directives.js');\n\nclass Document {\n constructor(value, replacer, options) {\n /** A comment before this Document */\n this.commentBefore = null;\n /** A comment immediately after this Document */\n this.comment = null;\n /** Errors encountered during parsing. */\n this.errors = [];\n /** Warnings encountered during parsing. */\n this.warnings = [];\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const opt = Object.assign({\n intAsBigInt: false,\n keepSourceTokens: false,\n logLevel: 'warn',\n prettyErrors: true,\n strict: true,\n stringKeys: false,\n uniqueKeys: true,\n version: '1.2'\n }, options);\n this.options = opt;\n let { version } = opt;\n if (options?._directives) {\n this.directives = options._directives.atDocument();\n if (this.directives.yaml.explicit)\n version = this.directives.yaml.version;\n }\n else\n this.directives = new directives.Directives({ version });\n this.setSchema(version, options);\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents =\n value === undefined ? null : this.createNode(value, _replacer, options);\n }\n /**\n * Create a deep copy of this Document and its contents.\n *\n * Custom Node values that inherit from `Object` still refer to their original instances.\n */\n clone() {\n const copy = Object.create(Document.prototype, {\n [identity.NODE_TYPE]: { value: identity.DOC }\n });\n copy.commentBefore = this.commentBefore;\n copy.comment = this.comment;\n copy.errors = this.errors.slice();\n copy.warnings = this.warnings.slice();\n copy.options = Object.assign({}, this.options);\n if (this.directives)\n copy.directives = this.directives.clone();\n copy.schema = this.schema.clone();\n // @ts-expect-error We can't really know that this matches Contents.\n copy.contents = identity.isNode(this.contents)\n ? this.contents.clone(copy.schema)\n : this.contents;\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** Adds a value to the document. */\n add(value) {\n if (assertCollection(this.contents))\n this.contents.add(value);\n }\n /** Adds a value to the document. */\n addIn(path, value) {\n if (assertCollection(this.contents))\n this.contents.addIn(path, value);\n }\n /**\n * Create a new `Alias` node, ensuring that the target `node` has the required anchor.\n *\n * If `node` already has an anchor, `name` is ignored.\n * Otherwise, the `node.anchor` value will be set to `name`,\n * or if an anchor with that name is already present in the document,\n * `name` will be used as a prefix for a new unique anchor.\n * If `name` is undefined, the generated anchor will use 'a' as a prefix.\n */\n createAlias(node, name) {\n if (!node.anchor) {\n const prev = anchors.anchorNames(this);\n node.anchor =\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n !name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;\n }\n return new Alias.Alias(node.anchor);\n }\n createNode(value, replacer, options) {\n let _replacer = undefined;\n if (typeof replacer === 'function') {\n value = replacer.call({ '': value }, '', value);\n _replacer = replacer;\n }\n else if (Array.isArray(replacer)) {\n const keyToStr = (v) => typeof v === 'number' || v instanceof String || v instanceof Number;\n const asStr = replacer.filter(keyToStr).map(String);\n if (asStr.length > 0)\n replacer = replacer.concat(asStr);\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};\n const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, \n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n anchorPrefix || 'a');\n const ctx = {\n aliasDuplicateObjects: aliasDuplicateObjects ?? true,\n keepUndefined: keepUndefined ?? false,\n onAnchor,\n onTagObj,\n replacer: _replacer,\n schema: this.schema,\n sourceObjects\n };\n const node = createNode.createNode(value, tag, ctx);\n if (flow && identity.isCollection(node))\n node.flow = true;\n setAnchors();\n return node;\n }\n /**\n * Convert a key and a value into a `Pair` using the current schema,\n * recursively wrapping all values as `Scalar` or `Collection` nodes.\n */\n createPair(key, value, options = {}) {\n const k = this.createNode(key, null, options);\n const v = this.createNode(value, null, options);\n return new Pair.Pair(k, v);\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n return assertCollection(this.contents) ? this.contents.delete(key) : false;\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n if (Collection.isEmptyPath(path)) {\n if (this.contents == null)\n return false;\n // @ts-expect-error Presumed impossible if Strict extends false\n this.contents = null;\n return true;\n }\n return assertCollection(this.contents)\n ? this.contents.deleteIn(path)\n : false;\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n get(key, keepScalar) {\n return identity.isCollection(this.contents)\n ? this.contents.get(key, keepScalar)\n : undefined;\n }\n /**\n * Returns item at `path`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n if (Collection.isEmptyPath(path))\n return !keepScalar && identity.isScalar(this.contents)\n ? this.contents.value\n : this.contents;\n return identity.isCollection(this.contents)\n ? this.contents.getIn(path, keepScalar)\n : undefined;\n }\n /**\n * Checks if the document includes a value with the key `key`.\n */\n has(key) {\n return identity.isCollection(this.contents) ? this.contents.has(key) : false;\n }\n /**\n * Checks if the document includes a value at `path`.\n */\n hasIn(path) {\n if (Collection.isEmptyPath(path))\n return this.contents !== undefined;\n return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n set(key, value) {\n if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, [key], value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.set(key, value);\n }\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n if (Collection.isEmptyPath(path)) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = value;\n }\n else if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.setIn(path, value);\n }\n }\n /**\n * Change the YAML version and schema used by the document.\n * A `null` version disables support for directives, explicit tags, anchors, and aliases.\n * It also requires the `schema` option to be given as a `Schema` instance value.\n *\n * Overrides all previously set schema options.\n */\n setSchema(version, options = {}) {\n if (typeof version === 'number')\n version = String(version);\n let opt;\n switch (version) {\n case '1.1':\n if (this.directives)\n this.directives.yaml.version = '1.1';\n else\n this.directives = new directives.Directives({ version: '1.1' });\n opt = { resolveKnownTags: false, schema: 'yaml-1.1' };\n break;\n case '1.2':\n case 'next':\n if (this.directives)\n this.directives.yaml.version = version;\n else\n this.directives = new directives.Directives({ version });\n opt = { resolveKnownTags: true, schema: 'core' };\n break;\n case null:\n if (this.directives)\n delete this.directives;\n opt = null;\n break;\n default: {\n const sv = JSON.stringify(version);\n throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);\n }\n }\n // Not using `instanceof Schema` to allow for duck typing\n if (options.schema instanceof Object)\n this.schema = options.schema;\n else if (opt)\n this.schema = new Schema.Schema(Object.assign(opt, options));\n else\n throw new Error(`With a null YAML version, the { schema: Schema } option is required`);\n }\n // json & jsonArg are only used from toJSON()\n toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n const ctx = {\n anchors: new Map(),\n doc: this,\n keep: !json,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n /**\n * A JSON representation of the document `contents`.\n *\n * @param jsonArg Used by `JSON.stringify` to indicate the array index or\n * property name.\n */\n toJSON(jsonArg, onAnchor) {\n return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });\n }\n /** A YAML representation of the document. */\n toString(options = {}) {\n if (this.errors.length > 0)\n throw new Error('Document with errors cannot be stringified');\n if ('indent' in options &&\n (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {\n const s = JSON.stringify(options.indent);\n throw new Error(`\"indent\" option must be a positive integer, not ${s}`);\n }\n return stringifyDocument.stringifyDocument(this, options);\n }\n}\nfunction assertCollection(contents) {\n if (identity.isCollection(contents))\n return true;\n throw new Error('Expected a YAML collection as document contents');\n}\n\nexports.Document = Document;\n",
|
|
55
|
+
"'use strict';\n\nclass YAMLError extends Error {\n constructor(name, pos, code, message) {\n super();\n this.name = name;\n this.code = code;\n this.message = message;\n this.pos = pos;\n }\n}\nclass YAMLParseError extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLParseError', pos, code, message);\n }\n}\nclass YAMLWarning extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLWarning', pos, code, message);\n }\n}\nconst prettifyError = (src, lc) => (error) => {\n if (error.pos[0] === -1)\n return;\n error.linePos = error.pos.map(pos => lc.linePos(pos));\n const { line, col } = error.linePos[0];\n error.message += ` at line ${line}, column ${col}`;\n let ci = col - 1;\n let lineStr = src\n .substring(lc.lineStarts[line - 1], lc.lineStarts[line])\n .replace(/[\\n\\r]+$/, '');\n // Trim to max 80 chars, keeping col position near the middle\n if (ci >= 60 && lineStr.length > 80) {\n const trimStart = Math.min(ci - 39, lineStr.length - 79);\n lineStr = '…' + lineStr.substring(trimStart);\n ci -= trimStart - 1;\n }\n if (lineStr.length > 80)\n lineStr = lineStr.substring(0, 79) + '…';\n // Include previous line in context if pointing at line start\n if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {\n // Regexp won't match if start is trimmed\n let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);\n if (prev.length > 80)\n prev = prev.substring(0, 79) + '…\\n';\n lineStr = prev + lineStr;\n }\n if (/[^ ]/.test(lineStr)) {\n let count = 1;\n const end = error.linePos[1];\n if (end?.line === line && end.col > col) {\n count = Math.max(1, Math.min(end.col - col, 80 - ci));\n }\n const pointer = ' '.repeat(ci) + '^'.repeat(count);\n error.message += `:\\n\\n${lineStr}\\n${pointer}\\n`;\n }\n};\n\nexports.YAMLError = YAMLError;\nexports.YAMLParseError = YAMLParseError;\nexports.YAMLWarning = YAMLWarning;\nexports.prettifyError = prettifyError;\n",
|
|
56
|
+
"'use strict';\n\nfunction resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {\n let spaceBefore = false;\n let atNewline = startOnNewline;\n let hasSpace = startOnNewline;\n let comment = '';\n let commentSep = '';\n let hasNewline = false;\n let reqSpace = false;\n let tab = null;\n let anchor = null;\n let tag = null;\n let newlineAfterProp = null;\n let comma = null;\n let found = null;\n let start = null;\n for (const token of tokens) {\n if (reqSpace) {\n if (token.type !== 'space' &&\n token.type !== 'newline' &&\n token.type !== 'comma')\n onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n reqSpace = false;\n }\n if (tab) {\n if (atNewline && token.type !== 'comment' && token.type !== 'newline') {\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n }\n tab = null;\n }\n switch (token.type) {\n case 'space':\n // At the doc level, tabs at line start may be parsed\n // as leading white space rather than indentation.\n // In a flow collection, only the parser handles indent.\n if (!flow &&\n (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&\n token.source.includes('\\t')) {\n tab = token;\n }\n hasSpace = true;\n break;\n case 'comment': {\n if (!hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = token.source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += commentSep + cb;\n commentSep = '';\n atNewline = false;\n break;\n }\n case 'newline':\n if (atNewline) {\n if (comment)\n comment += token.source;\n else if (!found || indicator !== 'seq-item-ind')\n spaceBefore = true;\n }\n else\n commentSep += token.source;\n atNewline = true;\n hasNewline = true;\n if (anchor || tag)\n newlineAfterProp = token;\n hasSpace = true;\n break;\n case 'anchor':\n if (anchor)\n onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');\n if (token.source.endsWith(':'))\n onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);\n anchor = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n case 'tag': {\n if (tag)\n onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');\n tag = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n }\n case indicator:\n // Could here handle preceding comments differently\n if (anchor || tag)\n onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);\n if (found)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);\n found = token;\n atNewline =\n indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';\n hasSpace = false;\n break;\n case 'comma':\n if (flow) {\n if (comma)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);\n comma = token;\n atNewline = false;\n hasSpace = false;\n break;\n }\n // else fallthrough\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);\n atNewline = false;\n hasSpace = false;\n }\n }\n const last = tokens[tokens.length - 1];\n const end = last ? last.offset + last.source.length : offset;\n if (reqSpace &&\n next &&\n next.type !== 'space' &&\n next.type !== 'newline' &&\n next.type !== 'comma' &&\n (next.type !== 'scalar' || next.source !== '')) {\n onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n }\n if (tab &&\n ((atNewline && tab.indent <= parentIndent) ||\n next?.type === 'block-map' ||\n next?.type === 'block-seq'))\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n return {\n comma,\n found,\n spaceBefore,\n comment,\n hasNewline,\n anchor,\n tag,\n newlineAfterProp,\n end,\n start: start ?? end\n };\n}\n\nexports.resolveProps = resolveProps;\n",
|
|
57
|
+
"'use strict';\n\nfunction containsNewline(key) {\n if (!key)\n return null;\n switch (key.type) {\n case 'alias':\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n if (key.source.includes('\\n'))\n return true;\n if (key.end)\n for (const st of key.end)\n if (st.type === 'newline')\n return true;\n return false;\n case 'flow-collection':\n for (const it of key.items) {\n for (const st of it.start)\n if (st.type === 'newline')\n return true;\n if (it.sep)\n for (const st of it.sep)\n if (st.type === 'newline')\n return true;\n if (containsNewline(it.key) || containsNewline(it.value))\n return true;\n }\n return false;\n default:\n return true;\n }\n}\n\nexports.containsNewline = containsNewline;\n",
|
|
58
|
+
"'use strict';\n\nvar utilContainsNewline = require('./util-contains-newline.js');\n\nfunction flowIndentCheck(indent, fc, onError) {\n if (fc?.type === 'flow-collection') {\n const end = fc.end[0];\n if (end.indent === indent &&\n (end.source === ']' || end.source === '}') &&\n utilContainsNewline.containsNewline(fc)) {\n const msg = 'Flow end indicator should be more indented than parent';\n onError(end, 'BAD_INDENT', msg, true);\n }\n }\n}\n\nexports.flowIndentCheck = flowIndentCheck;\n",
|
|
59
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\n\nfunction mapIncludes(ctx, items, search) {\n const { uniqueKeys } = ctx.options;\n if (uniqueKeys === false)\n return false;\n const isEqual = typeof uniqueKeys === 'function'\n ? uniqueKeys\n : (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);\n return items.some(pair => isEqual(pair.key, search));\n}\n\nexports.mapIncludes = mapIncludes;\n",
|
|
60
|
+
"'use strict';\n\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst startColMsg = 'All mapping items must start at the same column';\nfunction resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;\n const map = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n let offset = bm.offset;\n let commentEnd = null;\n for (const collItem of bm.items) {\n const { start, key, sep, value } = collItem;\n // key properties\n const keyProps = resolveProps.resolveProps(start, {\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: bm.indent,\n startOnNewline: true\n });\n const implicitKey = !keyProps.found;\n if (implicitKey) {\n if (key) {\n if (key.type === 'block-seq')\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');\n else if ('indent' in key && key.indent !== bm.indent)\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n if (!keyProps.anchor && !keyProps.tag && !sep) {\n commentEnd = keyProps.end;\n if (keyProps.comment) {\n if (map.comment)\n map.comment += '\\n' + keyProps.comment;\n else\n map.comment = keyProps.comment;\n }\n continue;\n }\n if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {\n onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');\n }\n }\n else if (keyProps.found?.indent !== bm.indent) {\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n // key value\n ctx.atKey = true;\n const keyStart = keyProps.end;\n const keyNode = key\n ? composeNode(ctx, key, keyProps, onError)\n : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);\n ctx.atKey = false;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: bm.indent,\n startOnNewline: !key || key.type === 'block-scalar'\n });\n offset = valueProps.end;\n if (valueProps.found) {\n if (implicitKey) {\n if (value?.type === 'block-map' && !valueProps.hasNewline)\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');\n if (ctx.options.strict &&\n keyProps.start < valueProps.found.offset - 1024)\n onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);\n offset = valueNode.range[2];\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n else {\n // key with no value\n if (implicitKey)\n onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');\n if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n }\n if (commentEnd && commentEnd < offset)\n onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');\n map.range = [bm.offset, offset, commentEnd ?? offset];\n return map;\n}\n\nexports.resolveBlockMap = resolveBlockMap;\n",
|
|
61
|
+
"'use strict';\n\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\n\nfunction resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq;\n const seq = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = bs.offset;\n let commentEnd = null;\n for (const { start, value } of bs.items) {\n const props = resolveProps.resolveProps(start, {\n indicator: 'seq-item-ind',\n next: value,\n offset,\n onError,\n parentIndent: bs.indent,\n startOnNewline: true\n });\n if (!props.found) {\n if (props.anchor || props.tag || value) {\n if (value?.type === 'block-seq')\n onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');\n else\n onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');\n }\n else {\n commentEnd = props.end;\n if (props.comment)\n seq.comment = props.comment;\n continue;\n }\n }\n const node = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, start, null, props, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);\n offset = node.range[2];\n seq.items.push(node);\n }\n seq.range = [bs.offset, offset, commentEnd ?? offset];\n return seq;\n}\n\nexports.resolveBlockSeq = resolveBlockSeq;\n",
|
|
62
|
+
"'use strict';\n\nfunction resolveEnd(end, offset, reqSpace, onError) {\n let comment = '';\n if (end) {\n let hasSpace = false;\n let sep = '';\n for (const token of end) {\n const { source, type } = token;\n switch (type) {\n case 'space':\n hasSpace = true;\n break;\n case 'comment': {\n if (reqSpace && !hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += sep + cb;\n sep = '';\n break;\n }\n case 'newline':\n if (comment)\n sep += source;\n hasSpace = true;\n break;\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${type} at node end`);\n }\n offset += source.length;\n }\n }\n return { comment, offset };\n}\n\nexports.resolveEnd = resolveEnd;\n",
|
|
63
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst blockMsg = 'Block collections are not allowed within flow collections';\nconst isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');\nfunction resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {\n const isMap = fc.start.source === '{';\n const fcName = isMap ? 'flow map' : 'flow sequence';\n const NodeClass = (tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq));\n const coll = new NodeClass(ctx.schema);\n coll.flow = true;\n const atRoot = ctx.atRoot;\n if (atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = fc.offset + fc.start.source.length;\n for (let i = 0; i < fc.items.length; ++i) {\n const collItem = fc.items[i];\n const { start, key, sep, value } = collItem;\n const props = resolveProps.resolveProps(start, {\n flow: fcName,\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (!props.found) {\n if (!props.anchor && !props.tag && !sep && !value) {\n if (i === 0 && props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n else if (i < fc.items.length - 1)\n onError(props.start, 'UNEXPECTED_TOKEN', `Unexpected empty item in ${fcName}`);\n if (props.comment) {\n if (coll.comment)\n coll.comment += '\\n' + props.comment;\n else\n coll.comment = props.comment;\n }\n offset = props.end;\n continue;\n }\n if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))\n onError(key, // checked by containsNewline()\n 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n }\n if (i === 0) {\n if (props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n }\n else {\n if (!props.comma)\n onError(props.start, 'MISSING_CHAR', `Missing , between ${fcName} items`);\n if (props.comment) {\n let prevItemComment = '';\n loop: for (const st of start) {\n switch (st.type) {\n case 'comma':\n case 'space':\n break;\n case 'comment':\n prevItemComment = st.source.substring(1);\n break loop;\n default:\n break loop;\n }\n }\n if (prevItemComment) {\n let prev = coll.items[coll.items.length - 1];\n if (identity.isPair(prev))\n prev = prev.value ?? prev.key;\n if (prev.comment)\n prev.comment += '\\n' + prevItemComment;\n else\n prev.comment = prevItemComment;\n props.comment = props.comment.substring(prevItemComment.length + 1);\n }\n }\n }\n if (!isMap && !sep && !props.found) {\n // item is a value in a seq\n // → key & sep are empty, start does not include ? or :\n const valueNode = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, sep, null, props, onError);\n coll.items.push(valueNode);\n offset = valueNode.range[2];\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else {\n // item is a key+value pair\n // key value\n ctx.atKey = true;\n const keyStart = props.end;\n const keyNode = key\n ? composeNode(ctx, key, props, onError)\n : composeEmptyNode(ctx, keyStart, start, null, props, onError);\n if (isBlock(key))\n onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);\n ctx.atKey = false;\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n flow: fcName,\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (valueProps.found) {\n if (!isMap && !props.found && ctx.options.strict) {\n if (sep)\n for (const st of sep) {\n if (st === valueProps.found)\n break;\n if (st.type === 'newline') {\n onError(st, 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n break;\n }\n }\n if (props.start < valueProps.found.offset - 1024)\n onError(valueProps.found, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit flow sequence key');\n }\n }\n else if (value) {\n if ('source' in value && value.source?.[0] === ':')\n onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);\n else\n onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : valueProps.found\n ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError)\n : null;\n if (valueNode) {\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n if (isMap) {\n const map = coll;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n map.items.push(pair);\n }\n else {\n const map = new YAMLMap.YAMLMap(ctx.schema);\n map.flow = true;\n map.items.push(pair);\n const endRange = (valueNode ?? keyNode).range;\n map.range = [keyNode.range[0], endRange[1], endRange[2]];\n coll.items.push(map);\n }\n offset = valueNode ? valueNode.range[2] : valueProps.end;\n }\n }\n const expectedEnd = isMap ? '}' : ']';\n const [ce, ...ee] = fc.end;\n let cePos = offset;\n if (ce?.source === expectedEnd)\n cePos = ce.offset + ce.source.length;\n else {\n const name = fcName[0].toUpperCase() + fcName.substring(1);\n const msg = atRoot\n ? `${name} must end with a ${expectedEnd}`\n : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;\n onError(offset, atRoot ? 'MISSING_CHAR' : 'BAD_INDENT', msg);\n if (ce && ce.source.length !== 1)\n ee.unshift(ce);\n }\n if (ee.length > 0) {\n const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);\n if (end.comment) {\n if (coll.comment)\n coll.comment += '\\n' + end.comment;\n else\n coll.comment = end.comment;\n }\n coll.range = [fc.offset, cePos, end.offset];\n }\n else {\n coll.range = [fc.offset, cePos, cePos];\n }\n return coll;\n}\n\nexports.resolveFlowCollection = resolveFlowCollection;\n",
|
|
64
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveBlockMap = require('./resolve-block-map.js');\nvar resolveBlockSeq = require('./resolve-block-seq.js');\nvar resolveFlowCollection = require('./resolve-flow-collection.js');\n\nfunction resolveCollection(CN, ctx, token, onError, tagName, tag) {\n const coll = token.type === 'block-map'\n ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag)\n : token.type === 'block-seq'\n ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag)\n : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);\n const Coll = coll.constructor;\n // If we got a tagName matching the class, or the tag name is '!',\n // then use the tagName from the node class used to create it.\n if (tagName === '!' || tagName === Coll.tagName) {\n coll.tag = Coll.tagName;\n return coll;\n }\n if (tagName)\n coll.tag = tagName;\n return coll;\n}\nfunction composeCollection(CN, ctx, token, props, onError) {\n const tagToken = props.tag;\n const tagName = !tagToken\n ? null\n : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));\n if (token.type === 'block-seq') {\n const { anchor, newlineAfterProp: nl } = props;\n const lastProp = anchor && tagToken\n ? anchor.offset > tagToken.offset\n ? anchor\n : tagToken\n : (anchor ?? tagToken);\n if (lastProp && (!nl || nl.offset < lastProp.offset)) {\n const message = 'Missing newline after block sequence props';\n onError(lastProp, 'MISSING_CHAR', message);\n }\n }\n const expType = token.type === 'block-map'\n ? 'map'\n : token.type === 'block-seq'\n ? 'seq'\n : token.start.source === '{'\n ? 'map'\n : 'seq';\n // shortcut: check if it's a generic YAMLMap or YAMLSeq\n // before jumping into the custom tag logic.\n if (!tagToken ||\n !tagName ||\n tagName === '!' ||\n (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||\n (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);\n if (!tag) {\n const kt = ctx.schema.knownTags[tagName];\n if (kt?.collection === expType) {\n ctx.schema.tags.push(Object.assign({}, kt, { default: false }));\n tag = kt;\n }\n else {\n if (kt) {\n onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);\n }\n else {\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);\n }\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n }\n const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);\n const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;\n const node = identity.isNode(res)\n ? res\n : new Scalar.Scalar(res);\n node.range = coll.range;\n node.tag = tagName;\n if (tag?.format)\n node.format = tag.format;\n return node;\n}\n\nexports.composeCollection = composeCollection;\n",
|
|
65
|
+
"'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\n\nfunction resolveBlockScalar(ctx, scalar, onError) {\n const start = scalar.offset;\n const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);\n if (!header)\n return { value: '', type: null, comment: '', range: [start, start, start] };\n const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;\n const lines = scalar.source ? splitLines(scalar.source) : [];\n // determine the end of content & start of chomping\n let chompStart = lines.length;\n for (let i = lines.length - 1; i >= 0; --i) {\n const content = lines[i][1];\n if (content === '' || content === '\\r')\n chompStart = i;\n else\n break;\n }\n // shortcut for empty contents\n if (chompStart === 0) {\n const value = header.chomp === '+' && lines.length > 0\n ? '\\n'.repeat(Math.max(1, lines.length - 1))\n : '';\n let end = start + header.length;\n if (scalar.source)\n end += scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n }\n // find the indentation level to trim from start\n let trimIndent = scalar.indent + header.indent;\n let offset = scalar.offset + header.length;\n let contentStart = 0;\n for (let i = 0; i < chompStart; ++i) {\n const [indent, content] = lines[i];\n if (content === '' || content === '\\r') {\n if (header.indent === 0 && indent.length > trimIndent)\n trimIndent = indent.length;\n }\n else {\n if (indent.length < trimIndent) {\n const message = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator';\n onError(offset + indent.length, 'MISSING_CHAR', message);\n }\n if (header.indent === 0)\n trimIndent = indent.length;\n contentStart = i;\n if (trimIndent === 0 && !ctx.atRoot) {\n const message = 'Block scalar values in collections must be indented';\n onError(offset, 'BAD_INDENT', message);\n }\n break;\n }\n offset += indent.length + content.length + 1;\n }\n // include trailing more-indented empty lines in content\n for (let i = lines.length - 1; i >= chompStart; --i) {\n if (lines[i][0].length > trimIndent)\n chompStart = i + 1;\n }\n let value = '';\n let sep = '';\n let prevMoreIndented = false;\n // leading whitespace is kept intact\n for (let i = 0; i < contentStart; ++i)\n value += lines[i][0].slice(trimIndent) + '\\n';\n for (let i = contentStart; i < chompStart; ++i) {\n let [indent, content] = lines[i];\n offset += indent.length + content.length + 1;\n const crlf = content[content.length - 1] === '\\r';\n if (crlf)\n content = content.slice(0, -1);\n /* istanbul ignore if already caught in lexer */\n if (content && indent.length < trimIndent) {\n const src = header.indent\n ? 'explicit indentation indicator'\n : 'first line';\n const message = `Block scalar lines must not be less indented than their ${src}`;\n onError(offset - content.length - (crlf ? 2 : 1), 'BAD_INDENT', message);\n indent = '';\n }\n if (type === Scalar.Scalar.BLOCK_LITERAL) {\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n }\n else if (indent.length > trimIndent || content[0] === '\\t') {\n // more-indented content within a folded block\n if (sep === ' ')\n sep = '\\n';\n else if (!prevMoreIndented && sep === '\\n')\n sep = '\\n\\n';\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n prevMoreIndented = true;\n }\n else if (content === '') {\n // empty line\n if (sep === '\\n')\n value += '\\n';\n else\n sep = '\\n';\n }\n else {\n value += sep + content;\n sep = ' ';\n prevMoreIndented = false;\n }\n }\n switch (header.chomp) {\n case '-':\n break;\n case '+':\n for (let i = chompStart; i < lines.length; ++i)\n value += '\\n' + lines[i][0].slice(trimIndent);\n if (value[value.length - 1] !== '\\n')\n value += '\\n';\n break;\n default:\n value += '\\n';\n }\n const end = start + header.length + scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n}\nfunction parseBlockScalarHeader({ offset, props }, strict, onError) {\n /* istanbul ignore if should not happen */\n if (props[0].type !== 'block-scalar-header') {\n onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found');\n return null;\n }\n const { source } = props[0];\n const mode = source[0];\n let indent = 0;\n let chomp = '';\n let error = -1;\n for (let i = 1; i < source.length; ++i) {\n const ch = source[i];\n if (!chomp && (ch === '-' || ch === '+'))\n chomp = ch;\n else {\n const n = Number(ch);\n if (!indent && n)\n indent = n;\n else if (error === -1)\n error = offset + i;\n }\n }\n if (error !== -1)\n onError(error, 'UNEXPECTED_TOKEN', `Block scalar header includes extra characters: ${source}`);\n let hasSpace = false;\n let comment = '';\n let length = source.length;\n for (let i = 1; i < props.length; ++i) {\n const token = props[i];\n switch (token.type) {\n case 'space':\n hasSpace = true;\n // fallthrough\n case 'newline':\n length += token.source.length;\n break;\n case 'comment':\n if (strict && !hasSpace) {\n const message = 'Comments must be separated from other tokens by white space characters';\n onError(token, 'MISSING_CHAR', message);\n }\n length += token.source.length;\n comment = token.source.substring(1);\n break;\n case 'error':\n onError(token, 'UNEXPECTED_TOKEN', token.message);\n length += token.source.length;\n break;\n /* istanbul ignore next should not happen */\n default: {\n const message = `Unexpected token in block scalar header: ${token.type}`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n const ts = token.source;\n if (ts && typeof ts === 'string')\n length += ts.length;\n }\n }\n }\n return { mode, indent, chomp, comment, length };\n}\n/** @returns Array of lines split up as `[indent, content]` */\nfunction splitLines(source) {\n const split = source.split(/\\n( *)/);\n const first = split[0];\n const m = first.match(/^( *)/);\n const line0 = m?.[1]\n ? [m[1], first.slice(m[1].length)]\n : ['', first];\n const lines = [line0];\n for (let i = 1; i < split.length; i += 2)\n lines.push([split[i], split[i + 1]]);\n return lines;\n}\n\nexports.resolveBlockScalar = resolveBlockScalar;\n",
|
|
66
|
+
"'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction resolveFlowScalar(scalar, strict, onError) {\n const { offset, type, source, end } = scalar;\n let _type;\n let value;\n const _onError = (rel, code, msg) => onError(offset + rel, code, msg);\n switch (type) {\n case 'scalar':\n _type = Scalar.Scalar.PLAIN;\n value = plainValue(source, _onError);\n break;\n case 'single-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_SINGLE;\n value = singleQuotedValue(source, _onError);\n break;\n case 'double-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_DOUBLE;\n value = doubleQuotedValue(source, _onError);\n break;\n /* istanbul ignore next should not happen */\n default:\n onError(scalar, 'UNEXPECTED_TOKEN', `Expected a flow scalar value, but found: ${type}`);\n return {\n value: '',\n type: null,\n comment: '',\n range: [offset, offset + source.length, offset + source.length]\n };\n }\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);\n return {\n value,\n type: _type,\n comment: re.comment,\n range: [offset, valueEnd, re.offset]\n };\n}\nfunction plainValue(source, onError) {\n let badChar = '';\n switch (source[0]) {\n /* istanbul ignore next should not happen */\n case '\\t':\n badChar = 'a tab character';\n break;\n case ',':\n badChar = 'flow indicator character ,';\n break;\n case '%':\n badChar = 'directive indicator character %';\n break;\n case '|':\n case '>': {\n badChar = `block scalar indicator ${source[0]}`;\n break;\n }\n case '@':\n case '`': {\n badChar = `reserved character ${source[0]}`;\n break;\n }\n }\n if (badChar)\n onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);\n return foldLines(source);\n}\nfunction singleQuotedValue(source, onError) {\n if (source[source.length - 1] !== \"'\" || source.length === 1)\n onError(source.length, 'MISSING_CHAR', \"Missing closing 'quote\");\n return foldLines(source.slice(1, -1)).replace(/''/g, \"'\");\n}\nfunction foldLines(source) {\n /**\n * The negative lookbehind here and in the `re` RegExp is to\n * prevent causing a polynomial search time in certain cases.\n *\n * The try-catch is for Safari, which doesn't support this yet:\n * https://caniuse.com/js-regexp-lookbehind\n */\n let first, line;\n try {\n first = new RegExp('(.*?)(?<![ \\t])[ \\t]*\\r?\\n', 'sy');\n line = new RegExp('[ \\t]*(.*?)(?:(?<![ \\t])[ \\t]*)?\\r?\\n', 'sy');\n }\n catch {\n first = /(.*?)[ \\t]*\\r?\\n/sy;\n line = /[ \\t]*(.*?)[ \\t]*\\r?\\n/sy;\n }\n let match = first.exec(source);\n if (!match)\n return source;\n let res = match[1];\n let sep = ' ';\n let pos = first.lastIndex;\n line.lastIndex = pos;\n while ((match = line.exec(source))) {\n if (match[1] === '') {\n if (sep === '\\n')\n res += sep;\n else\n sep = '\\n';\n }\n else {\n res += sep + match[1];\n sep = ' ';\n }\n pos = line.lastIndex;\n }\n const last = /[ \\t]*(.*)/sy;\n last.lastIndex = pos;\n match = last.exec(source);\n return res + sep + (match?.[1] ?? '');\n}\nfunction doubleQuotedValue(source, onError) {\n let res = '';\n for (let i = 1; i < source.length - 1; ++i) {\n const ch = source[i];\n if (ch === '\\r' && source[i + 1] === '\\n')\n continue;\n if (ch === '\\n') {\n const { fold, offset } = foldNewline(source, i);\n res += fold;\n i = offset;\n }\n else if (ch === '\\\\') {\n let next = source[++i];\n const cc = escapeCodes[next];\n if (cc)\n res += cc;\n else if (next === '\\n') {\n // skip escaped newlines, but still trim the following line\n next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === '\\r' && source[i + 1] === '\\n') {\n // skip escaped CRLF newlines, but still trim the following line\n next = source[++i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === 'x' || next === 'u' || next === 'U') {\n const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;\n res += parseCharCode(source, i + 1, length, onError);\n i += length;\n }\n else {\n const raw = source.substr(i - 1, 2);\n onError(i - 1, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n res += raw;\n }\n }\n else if (ch === ' ' || ch === '\\t') {\n // trim trailing whitespace\n const wsStart = i;\n let next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n if (next !== '\\n' && !(next === '\\r' && source[i + 2] === '\\n'))\n res += i > wsStart ? source.slice(wsStart, i + 1) : ch;\n }\n else {\n res += ch;\n }\n }\n if (source[source.length - 1] !== '\"' || source.length === 1)\n onError(source.length, 'MISSING_CHAR', 'Missing closing \"quote');\n return res;\n}\n/**\n * Fold a single newline into a space, multiple newlines to N - 1 newlines.\n * Presumes `source[offset] === '\\n'`\n */\nfunction foldNewline(source, offset) {\n let fold = '';\n let ch = source[offset + 1];\n while (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r') {\n if (ch === '\\r' && source[offset + 2] !== '\\n')\n break;\n if (ch === '\\n')\n fold += '\\n';\n offset += 1;\n ch = source[offset + 1];\n }\n if (!fold)\n fold = ' ';\n return { fold, offset };\n}\nconst escapeCodes = {\n '0': '\\0', // null character\n a: '\\x07', // bell character\n b: '\\b', // backspace\n e: '\\x1b', // escape character\n f: '\\f', // form feed\n n: '\\n', // line feed\n r: '\\r', // carriage return\n t: '\\t', // horizontal tab\n v: '\\v', // vertical tab\n N: '\\u0085', // Unicode next line\n _: '\\u00a0', // Unicode non-breaking space\n L: '\\u2028', // Unicode line separator\n P: '\\u2029', // Unicode paragraph separator\n ' ': ' ',\n '\"': '\"',\n '/': '/',\n '\\\\': '\\\\',\n '\\t': '\\t'\n};\nfunction parseCharCode(source, offset, length, onError) {\n const cc = source.substr(offset, length);\n const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);\n const code = ok ? parseInt(cc, 16) : NaN;\n try {\n return String.fromCodePoint(code);\n }\n catch {\n const raw = source.substr(offset - 2, length + 2);\n onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n return raw;\n }\n}\n\nexports.resolveFlowScalar = resolveFlowScalar;\n",
|
|
67
|
+
"'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveBlockScalar = require('./resolve-block-scalar.js');\nvar resolveFlowScalar = require('./resolve-flow-scalar.js');\n\nfunction composeScalar(ctx, token, tagToken, onError) {\n const { value, type, comment, range } = token.type === 'block-scalar'\n ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)\n : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);\n const tagName = tagToken\n ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))\n : null;\n let tag;\n if (ctx.options.stringKeys && ctx.atKey) {\n tag = ctx.schema[identity.SCALAR];\n }\n else if (tagName)\n tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);\n else if (token.type === 'scalar')\n tag = findScalarTagByTest(ctx, value, token, onError);\n else\n tag = ctx.schema[identity.SCALAR];\n let scalar;\n try {\n const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);\n scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);\n }\n catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);\n scalar = new Scalar.Scalar(value);\n }\n scalar.range = range;\n scalar.source = value;\n if (type)\n scalar.type = type;\n if (tagName)\n scalar.tag = tagName;\n if (tag.format)\n scalar.format = tag.format;\n if (comment)\n scalar.comment = comment;\n return scalar;\n}\nfunction findScalarTagByName(schema, value, tagName, tagToken, onError) {\n if (tagName === '!')\n return schema[identity.SCALAR]; // non-specific tag\n const matchWithTest = [];\n for (const tag of schema.tags) {\n if (!tag.collection && tag.tag === tagName) {\n if (tag.default && tag.test)\n matchWithTest.push(tag);\n else\n return tag;\n }\n }\n for (const tag of matchWithTest)\n if (tag.test?.test(value))\n return tag;\n const kt = schema.knownTags[tagName];\n if (kt && !kt.collection) {\n // Ensure that the known tag is available for stringifying,\n // but does not get used by default.\n schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));\n return kt;\n }\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');\n return schema[identity.SCALAR];\n}\nfunction findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {\n const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&\n tag.test?.test(value)) || schema[identity.SCALAR];\n if (schema.compat) {\n const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??\n schema[identity.SCALAR];\n if (tag.tag !== compat.tag) {\n const ts = directives.tagString(tag.tag);\n const cs = directives.tagString(compat.tag);\n const msg = `Value may be parsed as either ${ts} or ${cs}`;\n onError(token, 'TAG_RESOLVE_FAILED', msg, true);\n }\n }\n return tag;\n}\n\nexports.composeScalar = composeScalar;\n",
|
|
68
|
+
"'use strict';\n\nfunction emptyScalarPosition(offset, before, pos) {\n if (before) {\n pos ?? (pos = before.length);\n for (let i = pos - 1; i >= 0; --i) {\n let st = before[i];\n switch (st.type) {\n case 'space':\n case 'comment':\n case 'newline':\n offset -= st.source.length;\n continue;\n }\n // Technically, an empty scalar is immediately after the last non-empty\n // node, but it's more useful to place it after any whitespace.\n st = before[++i];\n while (st?.type === 'space') {\n offset += st.source.length;\n st = before[++i];\n }\n break;\n }\n }\n return offset;\n}\n\nexports.emptyScalarPosition = emptyScalarPosition;\n",
|
|
69
|
+
"'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar composeCollection = require('./compose-collection.js');\nvar composeScalar = require('./compose-scalar.js');\nvar resolveEnd = require('./resolve-end.js');\nvar utilEmptyScalarPosition = require('./util-empty-scalar-position.js');\n\nconst CN = { composeNode, composeEmptyNode };\nfunction composeNode(ctx, token, props, onError) {\n const atKey = ctx.atKey;\n const { spaceBefore, comment, anchor, tag } = props;\n let node;\n let isSrcToken = true;\n switch (token.type) {\n case 'alias':\n node = composeAlias(ctx, token, onError);\n if (anchor || tag)\n onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');\n break;\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'block-scalar':\n node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n case 'block-map':\n case 'block-seq':\n case 'flow-collection':\n try {\n node = composeCollection.composeCollection(CN, ctx, token, props, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n }\n catch (error) {\n // Almost certainly here due to a stack overflow\n const message = error instanceof Error ? error.message : String(error);\n onError(token, 'RESOURCE_EXHAUSTION', message);\n }\n break;\n default: {\n const message = token.type === 'error'\n ? token.message\n : `Unsupported token (type: ${token.type})`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n isSrcToken = false;\n }\n }\n node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));\n if (anchor && node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n if (atKey &&\n ctx.options.stringKeys &&\n (!identity.isScalar(node) ||\n typeof node.value !== 'string' ||\n (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {\n const msg = 'With stringKeys, all keys must be strings';\n onError(tag ?? token, 'NON_STRING_KEY', msg);\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n if (token.type === 'scalar' && token.source === '')\n node.comment = comment;\n else\n node.commentBefore = comment;\n }\n // @ts-expect-error Type checking misses meaning of isSrcToken\n if (ctx.options.keepSourceTokens && isSrcToken)\n node.srcToken = token;\n return node;\n}\nfunction composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {\n const token = {\n type: 'scalar',\n offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),\n indent: -1,\n source: ''\n };\n const node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor) {\n node.anchor = anchor.source.substring(1);\n if (node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n node.comment = comment;\n node.range[2] = end;\n }\n return node;\n}\nfunction composeAlias({ options }, { offset, source, end }, onError) {\n const alias = new Alias.Alias(source.substring(1));\n if (alias.source === '')\n onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');\n if (alias.source.endsWith(':'))\n onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);\n alias.range = [offset, valueEnd, re.offset];\n if (re.comment)\n alias.comment = re.comment;\n return alias;\n}\n\nexports.composeEmptyNode = composeEmptyNode;\nexports.composeNode = composeNode;\n",
|
|
70
|
+
"'use strict';\n\nvar Document = require('../doc/Document.js');\nvar composeNode = require('./compose-node.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\n\nfunction composeDoc(options, directives, { offset, start, value, end }, onError) {\n const opts = Object.assign({ _directives: directives }, options);\n const doc = new Document.Document(undefined, opts);\n const ctx = {\n atKey: false,\n atRoot: true,\n directives: doc.directives,\n options: doc.options,\n schema: doc.schema\n };\n const props = resolveProps.resolveProps(start, {\n indicator: 'doc-start',\n next: value ?? end?.[0],\n offset,\n onError,\n parentIndent: 0,\n startOnNewline: true\n });\n if (props.found) {\n doc.directives.docStart = true;\n if (value &&\n (value.type === 'block-map' || value.type === 'block-seq') &&\n !props.hasNewline)\n onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');\n }\n // @ts-expect-error If Contents is set, let's trust the user\n doc.contents = value\n ? composeNode.composeNode(ctx, value, props, onError)\n : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);\n const contentEnd = doc.contents.range[2];\n const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);\n if (re.comment)\n doc.comment = re.comment;\n doc.range = [offset, contentEnd, re.offset];\n return doc;\n}\n\nexports.composeDoc = composeDoc;\n",
|
|
71
|
+
"'use strict';\n\nvar node_process = require('process');\nvar directives = require('../doc/directives.js');\nvar Document = require('../doc/Document.js');\nvar errors = require('../errors.js');\nvar identity = require('../nodes/identity.js');\nvar composeDoc = require('./compose-doc.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction getErrorPos(src) {\n if (typeof src === 'number')\n return [src, src + 1];\n if (Array.isArray(src))\n return src.length === 2 ? src : [src[0], src[1]];\n const { offset, source } = src;\n return [offset, offset + (typeof source === 'string' ? source.length : 1)];\n}\nfunction parsePrelude(prelude) {\n let comment = '';\n let atComment = false;\n let afterEmptyLine = false;\n for (let i = 0; i < prelude.length; ++i) {\n const source = prelude[i];\n switch (source[0]) {\n case '#':\n comment +=\n (comment === '' ? '' : afterEmptyLine ? '\\n\\n' : '\\n') +\n (source.substring(1) || ' ');\n atComment = true;\n afterEmptyLine = false;\n break;\n case '%':\n if (prelude[i + 1]?.[0] !== '#')\n i += 1;\n atComment = false;\n break;\n default:\n // This may be wrong after doc-end, but in that case it doesn't matter\n if (!atComment)\n afterEmptyLine = true;\n atComment = false;\n }\n }\n return { comment, afterEmptyLine };\n}\n/**\n * Compose a stream of CST nodes into a stream of YAML Documents.\n *\n * ```ts\n * import { Composer, Parser } from 'yaml'\n *\n * const src: string = ...\n * const tokens = new Parser().parse(src)\n * const docs = new Composer().compose(tokens)\n * ```\n */\nclass Composer {\n constructor(options = {}) {\n this.doc = null;\n this.atDirectives = false;\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n this.onError = (source, code, message, warning) => {\n const pos = getErrorPos(source);\n if (warning)\n this.warnings.push(new errors.YAMLWarning(pos, code, message));\n else\n this.errors.push(new errors.YAMLParseError(pos, code, message));\n };\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n this.directives = new directives.Directives({ version: options.version || '1.2' });\n this.options = options;\n }\n decorate(doc, afterDoc) {\n const { comment, afterEmptyLine } = parsePrelude(this.prelude);\n //console.log({ dc: doc.comment, prelude, comment })\n if (comment) {\n const dc = doc.contents;\n if (afterDoc) {\n doc.comment = doc.comment ? `${doc.comment}\\n${comment}` : comment;\n }\n else if (afterEmptyLine || doc.directives.docStart || !dc) {\n doc.commentBefore = comment;\n }\n else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {\n let it = dc.items[0];\n if (identity.isPair(it))\n it = it.key;\n const cb = it.commentBefore;\n it.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n else {\n const cb = dc.commentBefore;\n dc.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n }\n if (afterDoc) {\n for (let i = 0; i < this.errors.length; ++i)\n doc.errors.push(this.errors[i]);\n for (let i = 0; i < this.warnings.length; ++i)\n doc.warnings.push(this.warnings[i]);\n }\n else {\n doc.errors = this.errors;\n doc.warnings = this.warnings;\n }\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n }\n /**\n * Current stream status information.\n *\n * Mostly useful at the end of input for an empty stream.\n */\n streamInfo() {\n return {\n comment: parsePrelude(this.prelude).comment,\n directives: this.directives,\n errors: this.errors,\n warnings: this.warnings\n };\n }\n /**\n * Compose tokens into documents.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *compose(tokens, forceDoc = false, endOffset = -1) {\n for (const token of tokens)\n yield* this.next(token);\n yield* this.end(forceDoc, endOffset);\n }\n /** Advance the composer by one CST token. */\n *next(token) {\n if (node_process.env.LOG_STREAM)\n console.dir(token, { depth: null });\n switch (token.type) {\n case 'directive':\n this.directives.add(token.source, (offset, message, warning) => {\n const pos = getErrorPos(token);\n pos[0] += offset;\n this.onError(pos, 'BAD_DIRECTIVE', message, warning);\n });\n this.prelude.push(token.source);\n this.atDirectives = true;\n break;\n case 'document': {\n const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);\n if (this.atDirectives && !doc.directives.docStart)\n this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');\n this.decorate(doc, false);\n if (this.doc)\n yield this.doc;\n this.doc = doc;\n this.atDirectives = false;\n break;\n }\n case 'byte-order-mark':\n case 'space':\n break;\n case 'comment':\n case 'newline':\n this.prelude.push(token.source);\n break;\n case 'error': {\n const msg = token.source\n ? `${token.message}: ${JSON.stringify(token.source)}`\n : token.message;\n const error = new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);\n if (this.atDirectives || !this.doc)\n this.errors.push(error);\n else\n this.doc.errors.push(error);\n break;\n }\n case 'doc-end': {\n if (!this.doc) {\n const msg = 'Unexpected doc-end without preceding document';\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));\n break;\n }\n this.doc.directives.docEnd = true;\n const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);\n this.decorate(this.doc, true);\n if (end.comment) {\n const dc = this.doc.comment;\n this.doc.comment = dc ? `${dc}\\n${end.comment}` : end.comment;\n }\n this.doc.range[2] = end.offset;\n break;\n }\n default:\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));\n }\n }\n /**\n * Call at end of input to yield any remaining document.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *end(forceDoc = false, endOffset = -1) {\n if (this.doc) {\n this.decorate(this.doc, true);\n yield this.doc;\n this.doc = null;\n }\n else if (forceDoc) {\n const opts = Object.assign({ _directives: this.directives }, this.options);\n const doc = new Document.Document(undefined, opts);\n if (this.atDirectives)\n this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');\n doc.range = [0, endOffset, endOffset];\n this.decorate(doc, false);\n yield doc;\n }\n }\n}\n\nexports.Composer = Composer;\n",
|
|
72
|
+
"'use strict';\n\nvar resolveBlockScalar = require('../compose/resolve-block-scalar.js');\nvar resolveFlowScalar = require('../compose/resolve-flow-scalar.js');\nvar errors = require('../errors.js');\nvar stringifyString = require('../stringify/stringifyString.js');\n\nfunction resolveAsScalar(token, strict = true, onError) {\n if (token) {\n const _onError = (pos, code, message) => {\n const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;\n if (onError)\n onError(offset, code, message);\n else\n throw new errors.YAMLParseError([offset, offset + 1], code, message);\n };\n switch (token.type) {\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);\n case 'block-scalar':\n return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);\n }\n }\n return null;\n}\n/**\n * Create a new scalar token with `value`\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.indent The indent level of the token.\n * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.\n * @param context.offset The offset position of the token.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction createScalarToken(value, context) {\n const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey,\n indent: indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n const end = context.end ?? [\n { type: 'newline', offset: -1, indent, source: '\\n' }\n ];\n switch (source[0]) {\n case '|':\n case '>': {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, end))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n return { type: 'block-scalar', offset, indent, props, source: body };\n }\n case '\"':\n return { type: 'double-quoted-scalar', offset, indent, source, end };\n case \"'\":\n return { type: 'single-quoted-scalar', offset, indent, source, end };\n default:\n return { type: 'scalar', offset, indent, source, end };\n }\n}\n/**\n * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.\n *\n * Best efforts are made to retain any comments previously associated with the `token`,\n * though all contents within a collection's `items` will be overwritten.\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.afterKey In most cases, values after a key should have an additional level of indentation.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction setScalarValue(token, value, context = {}) {\n let { afterKey = false, implicitKey = false, inFlow = false, type } = context;\n let indent = 'indent' in token ? token.indent : null;\n if (afterKey && typeof indent === 'number')\n indent += 2;\n if (!type)\n switch (token.type) {\n case 'single-quoted-scalar':\n type = 'QUOTE_SINGLE';\n break;\n case 'double-quoted-scalar':\n type = 'QUOTE_DOUBLE';\n break;\n case 'block-scalar': {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n type = header.source[0] === '>' ? 'BLOCK_FOLDED' : 'BLOCK_LITERAL';\n break;\n }\n default:\n type = 'PLAIN';\n }\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey: implicitKey || indent === null,\n indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n switch (source[0]) {\n case '|':\n case '>':\n setBlockScalarValue(token, source);\n break;\n case '\"':\n setFlowScalarValue(token, source, 'double-quoted-scalar');\n break;\n case \"'\":\n setFlowScalarValue(token, source, 'single-quoted-scalar');\n break;\n default:\n setFlowScalarValue(token, source, 'scalar');\n }\n}\nfunction setBlockScalarValue(token, source) {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n if (token.type === 'block-scalar') {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n header.source = head;\n token.source = body;\n }\n else {\n const { offset } = token;\n const indent = 'indent' in token ? token.indent : -1;\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, 'end' in token ? token.end : undefined))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type: 'block-scalar', indent, props, source: body });\n }\n}\n/** @returns `true` if last token is a newline */\nfunction addEndtoBlockProps(props, end) {\n if (end)\n for (const st of end)\n switch (st.type) {\n case 'space':\n case 'comment':\n props.push(st);\n break;\n case 'newline':\n props.push(st);\n return true;\n }\n return false;\n}\nfunction setFlowScalarValue(token, source, type) {\n switch (token.type) {\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n token.type = type;\n token.source = source;\n break;\n case 'block-scalar': {\n const end = token.props.slice(1);\n let oa = source.length;\n if (token.props[0].type === 'block-scalar-header')\n oa -= token.props[0].source.length;\n for (const tok of end)\n tok.offset += oa;\n delete token.props;\n Object.assign(token, { type, source, end });\n break;\n }\n case 'block-map':\n case 'block-seq': {\n const offset = token.offset + source.length;\n const nl = { type: 'newline', offset, indent: token.indent, source: '\\n' };\n delete token.items;\n Object.assign(token, { type, source, end: [nl] });\n break;\n }\n default: {\n const indent = 'indent' in token ? token.indent : -1;\n const end = 'end' in token && Array.isArray(token.end)\n ? token.end.filter(st => st.type === 'space' ||\n st.type === 'comment' ||\n st.type === 'newline')\n : [];\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type, indent, source, end });\n }\n }\n}\n\nexports.createScalarToken = createScalarToken;\nexports.resolveAsScalar = resolveAsScalar;\nexports.setScalarValue = setScalarValue;\n",
|
|
73
|
+
"'use strict';\n\n/**\n * Stringify a CST document, token, or collection item\n *\n * Fair warning: This applies no validation whatsoever, and\n * simply concatenates the sources in their logical order.\n */\nconst stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);\nfunction stringifyToken(token) {\n switch (token.type) {\n case 'block-scalar': {\n let res = '';\n for (const tok of token.props)\n res += stringifyToken(tok);\n return res + token.source;\n }\n case 'block-map':\n case 'block-seq': {\n let res = '';\n for (const item of token.items)\n res += stringifyItem(item);\n return res;\n }\n case 'flow-collection': {\n let res = token.start.source;\n for (const item of token.items)\n res += stringifyItem(item);\n for (const st of token.end)\n res += st.source;\n return res;\n }\n case 'document': {\n let res = stringifyItem(token);\n if (token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n default: {\n let res = token.source;\n if ('end' in token && token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n }\n}\nfunction stringifyItem({ start, key, sep, value }) {\n let res = '';\n for (const st of start)\n res += st.source;\n if (key)\n res += stringifyToken(key);\n if (sep)\n for (const st of sep)\n res += st.source;\n if (value)\n res += stringifyToken(value);\n return res;\n}\n\nexports.stringify = stringify;\n",
|
|
74
|
+
"'use strict';\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove item');\n/**\n * Apply a visitor to a CST document or item.\n *\n * Walks through the tree (depth-first) starting from the root, calling a\n * `visitor` function with two arguments when entering each item:\n * - `item`: The current item, which included the following members:\n * - `start: SourceToken[]` – Source tokens before the key or value,\n * possibly including its anchor or tag.\n * - `key?: Token | null` – Set for pair values. May then be `null`, if\n * the key before the `:` separator is empty.\n * - `sep?: SourceToken[]` – Source tokens between the key and the value,\n * which should include the `:` map value indicator if `value` is set.\n * - `value?: Token` – The value of a sequence item, or of a map pair.\n * - `path`: The steps from the root to the current node, as an array of\n * `['key' | 'value', number]` tuples.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this token, continue with\n * next sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current item, then continue with the next one\n * - `number`: Set the index of the next step. This is useful especially if\n * the index of the current token has changed.\n * - `function`: Define the next visitor for this item. After the original\n * visitor is called on item entry, next visitors are called after handling\n * a non-empty `key` and when exiting the item.\n */\nfunction visit(cst, visitor) {\n if ('type' in cst && cst.type === 'document')\n cst = { start: cst.start, value: cst.value };\n _visit(Object.freeze([]), cst, visitor);\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current item */\nvisit.SKIP = SKIP;\n/** Remove the current item */\nvisit.REMOVE = REMOVE;\n/** Find the item at `path` from `cst` as the root */\nvisit.itemAtPath = (cst, path) => {\n let item = cst;\n for (const [field, index] of path) {\n const tok = item?.[field];\n if (tok && 'items' in tok) {\n item = tok.items[index];\n }\n else\n return undefined;\n }\n return item;\n};\n/**\n * Get the immediate parent collection of the item at `path` from `cst` as the root.\n *\n * Throws an error if the collection is not found, which should never happen if the item itself exists.\n */\nvisit.parentCollection = (cst, path) => {\n const parent = visit.itemAtPath(cst, path.slice(0, -1));\n const field = path[path.length - 1][0];\n const coll = parent?.[field];\n if (coll && 'items' in coll)\n return coll;\n throw new Error('Parent collection not found');\n};\nfunction _visit(path, item, visitor) {\n let ctrl = visitor(item, path);\n if (typeof ctrl === 'symbol')\n return ctrl;\n for (const field of ['key', 'value']) {\n const token = item[field];\n if (token && 'items' in token) {\n for (let i = 0; i < token.items.length; ++i) {\n const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n token.items.splice(i, 1);\n i -= 1;\n }\n }\n if (typeof ctrl === 'function' && field === 'key')\n ctrl = ctrl(item, path);\n }\n }\n return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;\n}\n\nexports.visit = visit;\n",
|
|
75
|
+
"'use strict';\n\nvar cstScalar = require('./cst-scalar.js');\nvar cstStringify = require('./cst-stringify.js');\nvar cstVisit = require('./cst-visit.js');\n\n/** The byte order mark */\nconst BOM = '\\u{FEFF}';\n/** Start of doc-mode */\nconst DOCUMENT = '\\x02'; // C0: Start of Text\n/** Unexpected end of flow-mode */\nconst FLOW_END = '\\x18'; // C0: Cancel\n/** Next token is a scalar value */\nconst SCALAR = '\\x1f'; // C0: Unit Separator\n/** @returns `true` if `token` is a flow or block collection */\nconst isCollection = (token) => !!token && 'items' in token;\n/** @returns `true` if `token` is a flow or block scalar; not an alias */\nconst isScalar = (token) => !!token &&\n (token.type === 'scalar' ||\n token.type === 'single-quoted-scalar' ||\n token.type === 'double-quoted-scalar' ||\n token.type === 'block-scalar');\n/* istanbul ignore next */\n/** Get a printable representation of a lexer token */\nfunction prettyToken(token) {\n switch (token) {\n case BOM:\n return '<BOM>';\n case DOCUMENT:\n return '<DOC>';\n case FLOW_END:\n return '<FLOW_END>';\n case SCALAR:\n return '<SCALAR>';\n default:\n return JSON.stringify(token);\n }\n}\n/** Identify the type of a lexer token. May return `null` for unknown tokens. */\nfunction tokenType(source) {\n switch (source) {\n case BOM:\n return 'byte-order-mark';\n case DOCUMENT:\n return 'doc-mode';\n case FLOW_END:\n return 'flow-error-end';\n case SCALAR:\n return 'scalar';\n case '---':\n return 'doc-start';\n case '...':\n return 'doc-end';\n case '':\n case '\\n':\n case '\\r\\n':\n return 'newline';\n case '-':\n return 'seq-item-ind';\n case '?':\n return 'explicit-key-ind';\n case ':':\n return 'map-value-ind';\n case '{':\n return 'flow-map-start';\n case '}':\n return 'flow-map-end';\n case '[':\n return 'flow-seq-start';\n case ']':\n return 'flow-seq-end';\n case ',':\n return 'comma';\n }\n switch (source[0]) {\n case ' ':\n case '\\t':\n return 'space';\n case '#':\n return 'comment';\n case '%':\n return 'directive-line';\n case '*':\n return 'alias';\n case '&':\n return 'anchor';\n case '!':\n return 'tag';\n case \"'\":\n return 'single-quoted-scalar';\n case '\"':\n return 'double-quoted-scalar';\n case '|':\n case '>':\n return 'block-scalar-header';\n }\n return null;\n}\n\nexports.createScalarToken = cstScalar.createScalarToken;\nexports.resolveAsScalar = cstScalar.resolveAsScalar;\nexports.setScalarValue = cstScalar.setScalarValue;\nexports.stringify = cstStringify.stringify;\nexports.visit = cstVisit.visit;\nexports.BOM = BOM;\nexports.DOCUMENT = DOCUMENT;\nexports.FLOW_END = FLOW_END;\nexports.SCALAR = SCALAR;\nexports.isCollection = isCollection;\nexports.isScalar = isScalar;\nexports.prettyToken = prettyToken;\nexports.tokenType = tokenType;\n",
|
|
76
|
+
"'use strict';\n\nvar cst = require('./cst.js');\n\n/*\nSTART -> stream\n\nstream\n directive -> line-end -> stream\n indent + line-end -> stream\n [else] -> line-start\n\nline-end\n comment -> line-end\n newline -> .\n input-end -> END\n\nline-start\n doc-start -> doc\n doc-end -> stream\n [else] -> indent -> block-start\n\nblock-start\n seq-item-start -> block-start\n explicit-key-start -> block-start\n map-value-start -> block-start\n [else] -> doc\n\ndoc\n line-end -> line-start\n spaces -> doc\n anchor -> doc\n tag -> doc\n flow-start -> flow -> doc\n flow-end -> error -> doc\n seq-item-start -> error -> doc\n explicit-key-start -> error -> doc\n map-value-start -> doc\n alias -> doc\n quote-start -> quoted-scalar -> doc\n block-scalar-header -> line-end -> block-scalar(min) -> line-start\n [else] -> plain-scalar(false, min) -> doc\n\nflow\n line-end -> flow\n spaces -> flow\n anchor -> flow\n tag -> flow\n flow-start -> flow -> flow\n flow-end -> .\n seq-item-start -> error -> flow\n explicit-key-start -> flow\n map-value-start -> flow\n alias -> flow\n quote-start -> quoted-scalar -> flow\n comma -> flow\n [else] -> plain-scalar(true, 0) -> flow\n\nquoted-scalar\n quote-end -> .\n [else] -> quoted-scalar\n\nblock-scalar(min)\n newline + peek(indent < min) -> .\n [else] -> block-scalar(min)\n\nplain-scalar(is-flow, min)\n scalar-end(is-flow) -> .\n peek(newline + (indent < min)) -> .\n [else] -> plain-scalar(min)\n*/\nfunction isEmpty(ch) {\n switch (ch) {\n case undefined:\n case ' ':\n case '\\n':\n case '\\r':\n case '\\t':\n return true;\n default:\n return false;\n }\n}\nconst hexDigits = new Set('0123456789ABCDEFabcdef');\nconst tagChars = new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\");\nconst flowIndicatorChars = new Set(',[]{}');\nconst invalidAnchorChars = new Set(' ,[]{}\\n\\r\\t');\nconst isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);\n/**\n * Splits an input string into lexical tokens, i.e. smaller strings that are\n * easily identifiable by `tokens.tokenType()`.\n *\n * Lexing starts always in a \"stream\" context. Incomplete input may be buffered\n * until a complete token can be emitted.\n *\n * In addition to slices of the original input, the following control characters\n * may also be emitted:\n *\n * - `\\x02` (Start of Text): A document starts with the next token\n * - `\\x18` (Cancel): Unexpected end of flow-mode (indicates an error)\n * - `\\x1f` (Unit Separator): Next token is a scalar value\n * - `\\u{FEFF}` (Byte order mark): Emitted separately outside documents\n */\nclass Lexer {\n constructor() {\n /**\n * Flag indicating whether the end of the current buffer marks the end of\n * all input\n */\n this.atEnd = false;\n /**\n * Explicit indent set in block scalar header, as an offset from the current\n * minimum indent, so e.g. set to 1 from a header `|2+`. Set to -1 if not\n * explicitly set.\n */\n this.blockScalarIndent = -1;\n /**\n * Block scalars that include a + (keep) chomping indicator in their header\n * include trailing empty lines, which are otherwise excluded from the\n * scalar's contents.\n */\n this.blockScalarKeep = false;\n /** Current input */\n this.buffer = '';\n /**\n * Flag noting whether the map value indicator : can immediately follow this\n * node within a flow context.\n */\n this.flowKey = false;\n /** Count of surrounding flow collection levels. */\n this.flowLevel = 0;\n /**\n * Minimum level of indentation required for next lines to be parsed as a\n * part of the current scalar value.\n */\n this.indentNext = 0;\n /** Indentation level of the current line. */\n this.indentValue = 0;\n /** Position of the next \\n character. */\n this.lineEndPos = null;\n /** Stores the state of the lexer if reaching the end of incpomplete input */\n this.next = null;\n /** A pointer to `buffer`; the current position of the lexer. */\n this.pos = 0;\n }\n /**\n * Generate YAML tokens from the `source` string. If `incomplete`,\n * a part of the last line may be left as a buffer for the next call.\n *\n * @returns A generator of lexical tokens\n */\n *lex(source, incomplete = false) {\n if (source) {\n if (typeof source !== 'string')\n throw TypeError('source is not a string');\n this.buffer = this.buffer ? this.buffer + source : source;\n this.lineEndPos = null;\n }\n this.atEnd = !incomplete;\n let next = this.next ?? 'stream';\n while (next && (incomplete || this.hasChars(1)))\n next = yield* this.parseNext(next);\n }\n atLineEnd() {\n let i = this.pos;\n let ch = this.buffer[i];\n while (ch === ' ' || ch === '\\t')\n ch = this.buffer[++i];\n if (!ch || ch === '#' || ch === '\\n')\n return true;\n if (ch === '\\r')\n return this.buffer[i + 1] === '\\n';\n return false;\n }\n charAt(n) {\n return this.buffer[this.pos + n];\n }\n continueScalar(offset) {\n let ch = this.buffer[offset];\n if (this.indentNext > 0) {\n let indent = 0;\n while (ch === ' ')\n ch = this.buffer[++indent + offset];\n if (ch === '\\r') {\n const next = this.buffer[indent + offset + 1];\n if (next === '\\n' || (!next && !this.atEnd))\n return offset + indent + 1;\n }\n return ch === '\\n' || indent >= this.indentNext || (!ch && !this.atEnd)\n ? offset + indent\n : -1;\n }\n if (ch === '-' || ch === '.') {\n const dt = this.buffer.substr(offset, 3);\n if ((dt === '---' || dt === '...') && isEmpty(this.buffer[offset + 3]))\n return -1;\n }\n return offset;\n }\n getLine() {\n let end = this.lineEndPos;\n if (typeof end !== 'number' || (end !== -1 && end < this.pos)) {\n end = this.buffer.indexOf('\\n', this.pos);\n this.lineEndPos = end;\n }\n if (end === -1)\n return this.atEnd ? this.buffer.substring(this.pos) : null;\n if (this.buffer[end - 1] === '\\r')\n end -= 1;\n return this.buffer.substring(this.pos, end);\n }\n hasChars(n) {\n return this.pos + n <= this.buffer.length;\n }\n setNext(state) {\n this.buffer = this.buffer.substring(this.pos);\n this.pos = 0;\n this.lineEndPos = null;\n this.next = state;\n return null;\n }\n peek(n) {\n return this.buffer.substr(this.pos, n);\n }\n *parseNext(next) {\n switch (next) {\n case 'stream':\n return yield* this.parseStream();\n case 'line-start':\n return yield* this.parseLineStart();\n case 'block-start':\n return yield* this.parseBlockStart();\n case 'doc':\n return yield* this.parseDocument();\n case 'flow':\n return yield* this.parseFlowCollection();\n case 'quoted-scalar':\n return yield* this.parseQuotedScalar();\n case 'block-scalar':\n return yield* this.parseBlockScalar();\n case 'plain-scalar':\n return yield* this.parsePlainScalar();\n }\n }\n *parseStream() {\n let line = this.getLine();\n if (line === null)\n return this.setNext('stream');\n if (line[0] === cst.BOM) {\n yield* this.pushCount(1);\n line = line.substring(1);\n }\n if (line[0] === '%') {\n let dirEnd = line.length;\n let cs = line.indexOf('#');\n while (cs !== -1) {\n const ch = line[cs - 1];\n if (ch === ' ' || ch === '\\t') {\n dirEnd = cs - 1;\n break;\n }\n else {\n cs = line.indexOf('#', cs + 1);\n }\n }\n while (true) {\n const ch = line[dirEnd - 1];\n if (ch === ' ' || ch === '\\t')\n dirEnd -= 1;\n else\n break;\n }\n const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));\n yield* this.pushCount(line.length - n); // possible comment\n this.pushNewline();\n return 'stream';\n }\n if (this.atLineEnd()) {\n const sp = yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - sp);\n yield* this.pushNewline();\n return 'stream';\n }\n yield cst.DOCUMENT;\n return yield* this.parseLineStart();\n }\n *parseLineStart() {\n const ch = this.charAt(0);\n if (!ch && !this.atEnd)\n return this.setNext('line-start');\n if (ch === '-' || ch === '.') {\n if (!this.atEnd && !this.hasChars(4))\n return this.setNext('line-start');\n const s = this.peek(3);\n if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {\n yield* this.pushCount(3);\n this.indentValue = 0;\n this.indentNext = 0;\n return s === '---' ? 'doc' : 'stream';\n }\n }\n this.indentValue = yield* this.pushSpaces(false);\n if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1)))\n this.indentNext = this.indentValue;\n return yield* this.parseBlockStart();\n }\n *parseBlockStart() {\n const [ch0, ch1] = this.peek(2);\n if (!ch1 && !this.atEnd)\n return this.setNext('block-start');\n if ((ch0 === '-' || ch0 === '?' || ch0 === ':') && isEmpty(ch1)) {\n const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));\n this.indentNext = this.indentValue + 1;\n this.indentValue += n;\n return 'block-start';\n }\n return 'doc';\n }\n *parseDocument() {\n yield* this.pushSpaces(true);\n const line = this.getLine();\n if (line === null)\n return this.setNext('doc');\n let n = yield* this.pushIndicators();\n switch (line[n]) {\n case '#':\n yield* this.pushCount(line.length - n);\n // fallthrough\n case undefined:\n yield* this.pushNewline();\n return yield* this.parseLineStart();\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel = 1;\n return 'flow';\n case '}':\n case ']':\n // this is an error\n yield* this.pushCount(1);\n return 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'doc';\n case '\"':\n case \"'\":\n return yield* this.parseQuotedScalar();\n case '|':\n case '>':\n n += yield* this.parseBlockScalarHeader();\n n += yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - n);\n yield* this.pushNewline();\n return yield* this.parseBlockScalar();\n default:\n return yield* this.parsePlainScalar();\n }\n }\n *parseFlowCollection() {\n let nl, sp;\n let indent = -1;\n do {\n nl = yield* this.pushNewline();\n if (nl > 0) {\n sp = yield* this.pushSpaces(false);\n this.indentValue = indent = sp;\n }\n else {\n sp = 0;\n }\n sp += yield* this.pushSpaces(true);\n } while (nl + sp > 0);\n const line = this.getLine();\n if (line === null)\n return this.setNext('flow');\n if ((indent !== -1 && indent < this.indentNext && line[0] !== '#') ||\n (indent === 0 &&\n (line.startsWith('---') || line.startsWith('...')) &&\n isEmpty(line[3]))) {\n // Allowing for the terminal ] or } at the same (rather than greater)\n // indent level as the initial [ or { is technically invalid, but\n // failing here would be surprising to users.\n const atFlowEndMarker = indent === this.indentNext - 1 &&\n this.flowLevel === 1 &&\n (line[0] === ']' || line[0] === '}');\n if (!atFlowEndMarker) {\n // this is an error\n this.flowLevel = 0;\n yield cst.FLOW_END;\n return yield* this.parseLineStart();\n }\n }\n let n = 0;\n while (line[n] === ',') {\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n this.flowKey = false;\n }\n n += yield* this.pushIndicators();\n switch (line[n]) {\n case undefined:\n return 'flow';\n case '#':\n yield* this.pushCount(line.length - n);\n return 'flow';\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel += 1;\n return 'flow';\n case '}':\n case ']':\n yield* this.pushCount(1);\n this.flowKey = true;\n this.flowLevel -= 1;\n return this.flowLevel ? 'flow' : 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'flow';\n case '\"':\n case \"'\":\n this.flowKey = true;\n return yield* this.parseQuotedScalar();\n case ':': {\n const next = this.charAt(1);\n if (this.flowKey || isEmpty(next) || next === ',') {\n this.flowKey = false;\n yield* this.pushCount(1);\n yield* this.pushSpaces(true);\n return 'flow';\n }\n }\n // fallthrough\n default:\n this.flowKey = false;\n return yield* this.parsePlainScalar();\n }\n }\n *parseQuotedScalar() {\n const quote = this.charAt(0);\n let end = this.buffer.indexOf(quote, this.pos + 1);\n if (quote === \"'\") {\n while (end !== -1 && this.buffer[end + 1] === \"'\")\n end = this.buffer.indexOf(\"'\", end + 2);\n }\n else {\n // double-quote\n while (end !== -1) {\n let n = 0;\n while (this.buffer[end - 1 - n] === '\\\\')\n n += 1;\n if (n % 2 === 0)\n break;\n end = this.buffer.indexOf('\"', end + 1);\n }\n }\n // Only looking for newlines within the quotes\n const qb = this.buffer.substring(0, end);\n let nl = qb.indexOf('\\n', this.pos);\n if (nl !== -1) {\n while (nl !== -1) {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = qb.indexOf('\\n', cs);\n }\n if (nl !== -1) {\n // this is an error caused by an unexpected unindent\n end = nl - (qb[nl - 1] === '\\r' ? 2 : 1);\n }\n }\n if (end === -1) {\n if (!this.atEnd)\n return this.setNext('quoted-scalar');\n end = this.buffer.length;\n }\n yield* this.pushToIndex(end + 1, false);\n return this.flowLevel ? 'flow' : 'doc';\n }\n *parseBlockScalarHeader() {\n this.blockScalarIndent = -1;\n this.blockScalarKeep = false;\n let i = this.pos;\n while (true) {\n const ch = this.buffer[++i];\n if (ch === '+')\n this.blockScalarKeep = true;\n else if (ch > '0' && ch <= '9')\n this.blockScalarIndent = Number(ch) - 1;\n else if (ch !== '-')\n break;\n }\n return yield* this.pushUntil(ch => isEmpty(ch) || ch === '#');\n }\n *parseBlockScalar() {\n let nl = this.pos - 1; // may be -1 if this.pos === 0\n let indent = 0;\n let ch;\n loop: for (let i = this.pos; (ch = this.buffer[i]); ++i) {\n switch (ch) {\n case ' ':\n indent += 1;\n break;\n case '\\n':\n nl = i;\n indent = 0;\n break;\n case '\\r': {\n const next = this.buffer[i + 1];\n if (!next && !this.atEnd)\n return this.setNext('block-scalar');\n if (next === '\\n')\n break;\n } // fallthrough\n default:\n break loop;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('block-scalar');\n if (indent >= this.indentNext) {\n if (this.blockScalarIndent === -1)\n this.indentNext = indent;\n else {\n this.indentNext =\n this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);\n }\n do {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = this.buffer.indexOf('\\n', cs);\n } while (nl !== -1);\n if (nl === -1) {\n if (!this.atEnd)\n return this.setNext('block-scalar');\n nl = this.buffer.length;\n }\n }\n // Trailing insufficiently indented tabs are invalid.\n // To catch that during parsing, we include them in the block scalar value.\n let i = nl + 1;\n ch = this.buffer[i];\n while (ch === ' ')\n ch = this.buffer[++i];\n if (ch === '\\t') {\n while (ch === '\\t' || ch === ' ' || ch === '\\r' || ch === '\\n')\n ch = this.buffer[++i];\n nl = i - 1;\n }\n else if (!this.blockScalarKeep) {\n do {\n let i = nl - 1;\n let ch = this.buffer[i];\n if (ch === '\\r')\n ch = this.buffer[--i];\n const lastChar = i; // Drop the line if last char not more indented\n while (ch === ' ')\n ch = this.buffer[--i];\n if (ch === '\\n' && i >= this.pos && i + 1 + indent > lastChar)\n nl = i;\n else\n break;\n } while (true);\n }\n yield cst.SCALAR;\n yield* this.pushToIndex(nl + 1, true);\n return yield* this.parseLineStart();\n }\n *parsePlainScalar() {\n const inFlow = this.flowLevel > 0;\n let end = this.pos - 1;\n let i = this.pos - 1;\n let ch;\n while ((ch = this.buffer[++i])) {\n if (ch === ':') {\n const next = this.buffer[i + 1];\n if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))\n break;\n end = i;\n }\n else if (isEmpty(ch)) {\n let next = this.buffer[i + 1];\n if (ch === '\\r') {\n if (next === '\\n') {\n i += 1;\n ch = '\\n';\n next = this.buffer[i + 1];\n }\n else\n end = i;\n }\n if (next === '#' || (inFlow && flowIndicatorChars.has(next)))\n break;\n if (ch === '\\n') {\n const cs = this.continueScalar(i + 1);\n if (cs === -1)\n break;\n i = Math.max(i, cs - 2); // to advance, but still account for ' #'\n }\n }\n else {\n if (inFlow && flowIndicatorChars.has(ch))\n break;\n end = i;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('plain-scalar');\n yield cst.SCALAR;\n yield* this.pushToIndex(end + 1, true);\n return inFlow ? 'flow' : 'doc';\n }\n *pushCount(n) {\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos += n;\n return n;\n }\n return 0;\n }\n *pushToIndex(i, allowEmpty) {\n const s = this.buffer.slice(this.pos, i);\n if (s) {\n yield s;\n this.pos += s.length;\n return s.length;\n }\n else if (allowEmpty)\n yield '';\n return 0;\n }\n *pushIndicators() {\n let n = 0;\n loop: while (true) {\n switch (this.charAt(0)) {\n case '!':\n n += yield* this.pushTag();\n n += yield* this.pushSpaces(true);\n continue loop;\n case '&':\n n += yield* this.pushUntil(isNotAnchorChar);\n n += yield* this.pushSpaces(true);\n continue loop;\n case '-': // this is an error\n case '?': // this is an error outside flow collections\n case ':': {\n const inFlow = this.flowLevel > 0;\n const ch1 = this.charAt(1);\n if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {\n if (!inFlow)\n this.indentNext = this.indentValue + 1;\n else if (this.flowKey)\n this.flowKey = false;\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n continue loop;\n }\n }\n }\n break loop;\n }\n return n;\n }\n *pushTag() {\n if (this.charAt(1) === '<') {\n let i = this.pos + 2;\n let ch = this.buffer[i];\n while (!isEmpty(ch) && ch !== '>')\n ch = this.buffer[++i];\n return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);\n }\n else {\n let i = this.pos + 1;\n let ch = this.buffer[i];\n while (ch) {\n if (tagChars.has(ch))\n ch = this.buffer[++i];\n else if (ch === '%' &&\n hexDigits.has(this.buffer[i + 1]) &&\n hexDigits.has(this.buffer[i + 2])) {\n ch = this.buffer[(i += 3)];\n }\n else\n break;\n }\n return yield* this.pushToIndex(i, false);\n }\n }\n *pushNewline() {\n const ch = this.buffer[this.pos];\n if (ch === '\\n')\n return yield* this.pushCount(1);\n else if (ch === '\\r' && this.charAt(1) === '\\n')\n return yield* this.pushCount(2);\n else\n return 0;\n }\n *pushSpaces(allowTabs) {\n let i = this.pos - 1;\n let ch;\n do {\n ch = this.buffer[++i];\n } while (ch === ' ' || (allowTabs && ch === '\\t'));\n const n = i - this.pos;\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos = i;\n }\n return n;\n }\n *pushUntil(test) {\n let i = this.pos;\n let ch = this.buffer[i];\n while (!test(ch))\n ch = this.buffer[++i];\n return yield* this.pushToIndex(i, false);\n }\n}\n\nexports.Lexer = Lexer;\n",
|
|
77
|
+
"'use strict';\n\n/**\n * Tracks newlines during parsing in order to provide an efficient API for\n * determining the one-indexed `{ line, col }` position for any offset\n * within the input.\n */\nclass LineCounter {\n constructor() {\n this.lineStarts = [];\n /**\n * Should be called in ascending order. Otherwise, call\n * `lineCounter.lineStarts.sort()` before calling `linePos()`.\n */\n this.addNewLine = (offset) => this.lineStarts.push(offset);\n /**\n * Performs a binary search and returns the 1-indexed { line, col }\n * position of `offset`. If `line === 0`, `addNewLine` has never been\n * called or `offset` is before the first known newline.\n */\n this.linePos = (offset) => {\n let low = 0;\n let high = this.lineStarts.length;\n while (low < high) {\n const mid = (low + high) >> 1; // Math.floor((low + high) / 2)\n if (this.lineStarts[mid] < offset)\n low = mid + 1;\n else\n high = mid;\n }\n if (this.lineStarts[low] === offset)\n return { line: low + 1, col: 1 };\n if (low === 0)\n return { line: 0, col: offset };\n const start = this.lineStarts[low - 1];\n return { line: low, col: offset - start + 1 };\n };\n }\n}\n\nexports.LineCounter = LineCounter;\n",
|
|
78
|
+
"'use strict';\n\nvar node_process = require('process');\nvar cst = require('./cst.js');\nvar lexer = require('./lexer.js');\n\nfunction includesToken(list, type) {\n for (let i = 0; i < list.length; ++i)\n if (list[i].type === type)\n return true;\n return false;\n}\nfunction findNonEmptyIndex(list) {\n for (let i = 0; i < list.length; ++i) {\n switch (list[i].type) {\n case 'space':\n case 'comment':\n case 'newline':\n break;\n default:\n return i;\n }\n }\n return -1;\n}\nfunction isFlowToken(token) {\n switch (token?.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'flow-collection':\n return true;\n default:\n return false;\n }\n}\nfunction getPrevProps(parent) {\n switch (parent.type) {\n case 'document':\n return parent.start;\n case 'block-map': {\n const it = parent.items[parent.items.length - 1];\n return it.sep ?? it.start;\n }\n case 'block-seq':\n return parent.items[parent.items.length - 1].start;\n /* istanbul ignore next should not happen */\n default:\n return [];\n }\n}\n/** Note: May modify input array */\nfunction getFirstKeyStartProps(prev) {\n if (prev.length === 0)\n return [];\n let i = prev.length;\n loop: while (--i >= 0) {\n switch (prev[i].type) {\n case 'doc-start':\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n case 'newline':\n break loop;\n }\n }\n while (prev[++i]?.type === 'space') {\n /* loop */\n }\n return prev.splice(i, prev.length);\n}\nfunction arrayPushArray(target, source) {\n // May exhaust call stack with large `source` array\n if (source.length < 1e5)\n Array.prototype.push.apply(target, source);\n else\n for (let i = 0; i < source.length; ++i)\n target.push(source[i]);\n}\nfunction fixFlowSeqItems(fc) {\n if (fc.start.type === 'flow-seq-start') {\n for (const it of fc.items) {\n if (it.sep &&\n !it.value &&\n !includesToken(it.start, 'explicit-key-ind') &&\n !includesToken(it.sep, 'map-value-ind')) {\n if (it.key)\n it.value = it.key;\n delete it.key;\n if (isFlowToken(it.value)) {\n if (it.value.end)\n arrayPushArray(it.value.end, it.sep);\n else\n it.value.end = it.sep;\n }\n else\n arrayPushArray(it.start, it.sep);\n delete it.sep;\n }\n }\n }\n}\n/**\n * A YAML concrete syntax tree (CST) parser\n *\n * ```ts\n * const src: string = ...\n * for (const token of new Parser().parse(src)) {\n * // token: Token\n * }\n * ```\n *\n * To use the parser with a user-provided lexer:\n *\n * ```ts\n * function* parse(source: string, lexer: Lexer) {\n * const parser = new Parser()\n * for (const lexeme of lexer.lex(source))\n * yield* parser.next(lexeme)\n * yield* parser.end()\n * }\n *\n * const src: string = ...\n * const lexer = new Lexer()\n * for (const token of parse(src, lexer)) {\n * // token: Token\n * }\n * ```\n */\nclass Parser {\n /**\n * @param onNewLine - If defined, called separately with the start position of\n * each new line (in `parse()`, including the start of input).\n */\n constructor(onNewLine) {\n /** If true, space and sequence indicators count as indentation */\n this.atNewLine = true;\n /** If true, next token is a scalar value */\n this.atScalar = false;\n /** Current indentation level */\n this.indent = 0;\n /** Current offset since the start of parsing */\n this.offset = 0;\n /** On the same line with a block map key */\n this.onKeyLine = false;\n /** Top indicates the node that's currently being built */\n this.stack = [];\n /** The source of the current token, set in parse() */\n this.source = '';\n /** The type of the current token, set in parse() */\n this.type = '';\n // Must be defined after `next()`\n this.lexer = new lexer.Lexer();\n this.onNewLine = onNewLine;\n }\n /**\n * Parse `source` as a YAML stream.\n * If `incomplete`, a part of the last line may be left as a buffer for the next call.\n *\n * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.\n *\n * @returns A generator of tokens representing each directive, document, and other structure.\n */\n *parse(source, incomplete = false) {\n if (this.onNewLine && this.offset === 0)\n this.onNewLine(0);\n for (const lexeme of this.lexer.lex(source, incomplete))\n yield* this.next(lexeme);\n if (!incomplete)\n yield* this.end();\n }\n /**\n * Advance the parser by the `source` of one lexical token.\n */\n *next(source) {\n this.source = source;\n if (node_process.env.LOG_TOKENS)\n console.log('|', cst.prettyToken(source));\n if (this.atScalar) {\n this.atScalar = false;\n yield* this.step();\n this.offset += source.length;\n return;\n }\n const type = cst.tokenType(source);\n if (!type) {\n const message = `Not a YAML token: ${source}`;\n yield* this.pop({ type: 'error', offset: this.offset, message, source });\n this.offset += source.length;\n }\n else if (type === 'scalar') {\n this.atNewLine = false;\n this.atScalar = true;\n this.type = 'scalar';\n }\n else {\n this.type = type;\n yield* this.step();\n switch (type) {\n case 'newline':\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine)\n this.onNewLine(this.offset + source.length);\n break;\n case 'space':\n if (this.atNewLine && source[0] === ' ')\n this.indent += source.length;\n break;\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n if (this.atNewLine)\n this.indent += source.length;\n break;\n case 'doc-mode':\n case 'flow-error-end':\n return;\n default:\n this.atNewLine = false;\n }\n this.offset += source.length;\n }\n }\n /** Call at end of input to push out any remaining constructions */\n *end() {\n while (this.stack.length > 0)\n yield* this.pop();\n }\n get sourceToken() {\n const st = {\n type: this.type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n return st;\n }\n *step() {\n const top = this.peek(1);\n if (this.type === 'doc-end' && top?.type !== 'doc-end') {\n while (this.stack.length > 0)\n yield* this.pop();\n this.stack.push({\n type: 'doc-end',\n offset: this.offset,\n source: this.source\n });\n return;\n }\n if (!top)\n return yield* this.stream();\n switch (top.type) {\n case 'document':\n return yield* this.document(top);\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return yield* this.scalar(top);\n case 'block-scalar':\n return yield* this.blockScalar(top);\n case 'block-map':\n return yield* this.blockMap(top);\n case 'block-seq':\n return yield* this.blockSequence(top);\n case 'flow-collection':\n return yield* this.flowCollection(top);\n case 'doc-end':\n return yield* this.documentEnd(top);\n }\n /* istanbul ignore next should not happen */\n yield* this.pop();\n }\n peek(n) {\n return this.stack[this.stack.length - n];\n }\n *pop(error) {\n const token = error ?? this.stack.pop();\n /* istanbul ignore if should not happen */\n if (!token) {\n const message = 'Tried to pop an empty stack';\n yield { type: 'error', offset: this.offset, source: '', message };\n }\n else if (this.stack.length === 0) {\n yield token;\n }\n else {\n const top = this.peek(1);\n if (token.type === 'block-scalar') {\n // Block scalars use their parent rather than header indent\n token.indent = 'indent' in top ? top.indent : 0;\n }\n else if (token.type === 'flow-collection' && top.type === 'document') {\n // Ignore all indent for top-level flow collections\n token.indent = 0;\n }\n if (token.type === 'flow-collection')\n fixFlowSeqItems(token);\n switch (top.type) {\n case 'document':\n top.value = token;\n break;\n case 'block-scalar':\n top.props.push(token); // error\n break;\n case 'block-map': {\n const it = top.items[top.items.length - 1];\n if (it.value) {\n top.items.push({ start: [], key: token, sep: [] });\n this.onKeyLine = true;\n return;\n }\n else if (it.sep) {\n it.value = token;\n }\n else {\n Object.assign(it, { key: token, sep: [] });\n this.onKeyLine = !it.explicitKey;\n return;\n }\n break;\n }\n case 'block-seq': {\n const it = top.items[top.items.length - 1];\n if (it.value)\n top.items.push({ start: [], value: token });\n else\n it.value = token;\n break;\n }\n case 'flow-collection': {\n const it = top.items[top.items.length - 1];\n if (!it || it.value)\n top.items.push({ start: [], key: token, sep: [] });\n else if (it.sep)\n it.value = token;\n else\n Object.assign(it, { key: token, sep: [] });\n return;\n }\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.pop(token);\n }\n if ((top.type === 'document' ||\n top.type === 'block-map' ||\n top.type === 'block-seq') &&\n (token.type === 'block-map' || token.type === 'block-seq')) {\n const last = token.items[token.items.length - 1];\n if (last &&\n !last.sep &&\n !last.value &&\n last.start.length > 0 &&\n findNonEmptyIndex(last.start) === -1 &&\n (token.indent === 0 ||\n last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {\n if (top.type === 'document')\n top.end = last.start;\n else\n top.items.push({ start: last.start });\n token.items.splice(-1, 1);\n }\n }\n }\n }\n *stream() {\n switch (this.type) {\n case 'directive-line':\n yield { type: 'directive', offset: this.offset, source: this.source };\n return;\n case 'byte-order-mark':\n case 'space':\n case 'comment':\n case 'newline':\n yield this.sourceToken;\n return;\n case 'doc-mode':\n case 'doc-start': {\n const doc = {\n type: 'document',\n offset: this.offset,\n start: []\n };\n if (this.type === 'doc-start')\n doc.start.push(this.sourceToken);\n this.stack.push(doc);\n return;\n }\n }\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML stream`,\n source: this.source\n };\n }\n *document(doc) {\n if (doc.value)\n return yield* this.lineEnd(doc);\n switch (this.type) {\n case 'doc-start': {\n if (findNonEmptyIndex(doc.start) !== -1) {\n yield* this.pop();\n yield* this.step();\n }\n else\n doc.start.push(this.sourceToken);\n return;\n }\n case 'anchor':\n case 'tag':\n case 'space':\n case 'comment':\n case 'newline':\n doc.start.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(doc);\n if (bv)\n this.stack.push(bv);\n else {\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML document`,\n source: this.source\n };\n }\n }\n *scalar(scalar) {\n if (this.type === 'map-value-ind') {\n const prev = getPrevProps(this.peek(2));\n const start = getFirstKeyStartProps(prev);\n let sep;\n if (scalar.end) {\n sep = scalar.end;\n sep.push(this.sourceToken);\n delete scalar.end;\n }\n else\n sep = [this.sourceToken];\n const map = {\n type: 'block-map',\n offset: scalar.offset,\n indent: scalar.indent,\n items: [{ start, key: scalar, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else\n yield* this.lineEnd(scalar);\n }\n *blockScalar(scalar) {\n switch (this.type) {\n case 'space':\n case 'comment':\n case 'newline':\n scalar.props.push(this.sourceToken);\n return;\n case 'scalar':\n scalar.source = this.source;\n // block-scalar source includes trailing newline\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n yield* this.pop();\n break;\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.step();\n }\n }\n *blockMap(map) {\n const it = map.items[map.items.length - 1];\n // it.sep is true-ish if pair already has key or : separator\n switch (this.type) {\n case 'newline':\n this.onKeyLine = false;\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'space':\n case 'comment':\n if (it.value) {\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n if (this.atIndentedComment(it.start, map.indent)) {\n const prev = map.items[map.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n arrayPushArray(end, it.start);\n end.push(this.sourceToken);\n map.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n }\n if (this.indent >= map.indent) {\n const atMapIndent = !this.onKeyLine && this.indent === map.indent;\n const atNextItem = atMapIndent &&\n (it.sep || it.explicitKey) &&\n this.type !== 'seq-item-ind';\n // For empty nodes, assign newline-separated not indented empty tokens to following node\n let start = [];\n if (atNextItem && it.sep && !it.value) {\n const nl = [];\n for (let i = 0; i < it.sep.length; ++i) {\n const st = it.sep[i];\n switch (st.type) {\n case 'newline':\n nl.push(i);\n break;\n case 'space':\n break;\n case 'comment':\n if (st.indent > map.indent)\n nl.length = 0;\n break;\n default:\n nl.length = 0;\n }\n }\n if (nl.length >= 2)\n start = it.sep.splice(nl[1]);\n }\n switch (this.type) {\n case 'anchor':\n case 'tag':\n if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'explicit-key-ind':\n if (!it.sep && !it.explicitKey) {\n it.start.push(this.sourceToken);\n it.explicitKey = true;\n }\n else if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start, explicitKey: true });\n }\n else {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken], explicitKey: true }]\n });\n }\n this.onKeyLine = true;\n return;\n case 'map-value-ind':\n if (it.explicitKey) {\n if (!it.sep) {\n if (includesToken(it.start, 'newline')) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else {\n const start = getFirstKeyStartProps(it.start);\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n }\n else if (it.value) {\n map.items.push({ start: [], key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n else if (isFlowToken(it.key) &&\n !includesToken(it.sep, 'newline')) {\n const start = getFirstKeyStartProps(it.start);\n const key = it.key;\n const sep = it.sep;\n sep.push(this.sourceToken);\n // @ts-expect-error type guard is wrong here\n delete it.key;\n // @ts-expect-error type guard is wrong here\n delete it.sep;\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key, sep }]\n });\n }\n else if (start.length > 0) {\n // Not actually at next item\n it.sep = it.sep.concat(start, this.sourceToken);\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n else {\n if (!it.sep) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else if (it.value || atNextItem) {\n map.items.push({ start, key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [], key: null, sep: [this.sourceToken] }]\n });\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n this.onKeyLine = true;\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (atNextItem || it.value) {\n map.items.push({ start, key: fs, sep: [] });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n this.stack.push(fs);\n }\n else {\n Object.assign(it, { key: fs, sep: [] });\n this.onKeyLine = true;\n }\n return;\n }\n default: {\n const bv = this.startBlockValue(map);\n if (bv) {\n if (bv.type === 'block-seq') {\n if (!it.explicitKey &&\n it.sep &&\n !includesToken(it.sep, 'newline')) {\n yield* this.pop({\n type: 'error',\n offset: this.offset,\n message: 'Unexpected block-seq-ind on same line with key',\n source: this.source\n });\n return;\n }\n }\n else if (atMapIndent) {\n map.items.push({ start });\n }\n this.stack.push(bv);\n return;\n }\n }\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *blockSequence(seq) {\n const it = seq.items[seq.items.length - 1];\n switch (this.type) {\n case 'newline':\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n seq.items.push({ start: [this.sourceToken] });\n }\n else\n it.start.push(this.sourceToken);\n return;\n case 'space':\n case 'comment':\n if (it.value)\n seq.items.push({ start: [this.sourceToken] });\n else {\n if (this.atIndentedComment(it.start, seq.indent)) {\n const prev = seq.items[seq.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n arrayPushArray(end, it.start);\n end.push(this.sourceToken);\n seq.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n case 'anchor':\n case 'tag':\n if (it.value || this.indent <= seq.indent)\n break;\n it.start.push(this.sourceToken);\n return;\n case 'seq-item-ind':\n if (this.indent !== seq.indent)\n break;\n if (it.value || includesToken(it.start, 'seq-item-ind'))\n seq.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n }\n if (this.indent > seq.indent) {\n const bv = this.startBlockValue(seq);\n if (bv) {\n this.stack.push(bv);\n return;\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *flowCollection(fc) {\n const it = fc.items[fc.items.length - 1];\n if (this.type === 'flow-error-end') {\n let top;\n do {\n yield* this.pop();\n top = this.peek(1);\n } while (top?.type === 'flow-collection');\n }\n else if (fc.end.length === 0) {\n switch (this.type) {\n case 'comma':\n case 'explicit-key-ind':\n if (!it || it.sep)\n fc.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n case 'map-value-ind':\n if (!it || it.value)\n fc.items.push({ start: [], key: null, sep: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n return;\n case 'space':\n case 'comment':\n case 'newline':\n case 'anchor':\n case 'tag':\n if (!it || it.value)\n fc.items.push({ start: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n it.start.push(this.sourceToken);\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (!it || it.value)\n fc.items.push({ start: [], key: fs, sep: [] });\n else if (it.sep)\n this.stack.push(fs);\n else\n Object.assign(it, { key: fs, sep: [] });\n return;\n }\n case 'flow-map-end':\n case 'flow-seq-end':\n fc.end.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(fc);\n /* istanbul ignore else should not happen */\n if (bv)\n this.stack.push(bv);\n else {\n yield* this.pop();\n yield* this.step();\n }\n }\n else {\n const parent = this.peek(2);\n if (parent.type === 'block-map' &&\n ((this.type === 'map-value-ind' && parent.indent === fc.indent) ||\n (this.type === 'newline' &&\n !parent.items[parent.items.length - 1].sep))) {\n yield* this.pop();\n yield* this.step();\n }\n else if (this.type === 'map-value-ind' &&\n parent.type !== 'flow-collection') {\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n fixFlowSeqItems(fc);\n const sep = fc.end.splice(1, fc.end.length);\n sep.push(this.sourceToken);\n const map = {\n type: 'block-map',\n offset: fc.offset,\n indent: fc.indent,\n items: [{ start, key: fc, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else {\n yield* this.lineEnd(fc);\n }\n }\n }\n flowScalar(type) {\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n return {\n type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n }\n startBlockValue(parent) {\n switch (this.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return this.flowScalar(this.type);\n case 'block-scalar-header':\n return {\n type: 'block-scalar',\n offset: this.offset,\n indent: this.indent,\n props: [this.sourceToken],\n source: ''\n };\n case 'flow-map-start':\n case 'flow-seq-start':\n return {\n type: 'flow-collection',\n offset: this.offset,\n indent: this.indent,\n start: this.sourceToken,\n items: [],\n end: []\n };\n case 'seq-item-ind':\n return {\n type: 'block-seq',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken] }]\n };\n case 'explicit-key-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n start.push(this.sourceToken);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, explicitKey: true }]\n };\n }\n case 'map-value-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n };\n }\n }\n return null;\n }\n atIndentedComment(start, indent) {\n if (this.type !== 'comment')\n return false;\n if (this.indent <= indent)\n return false;\n return start.every(st => st.type === 'newline' || st.type === 'space');\n }\n *documentEnd(docEnd) {\n if (this.type !== 'doc-mode') {\n if (docEnd.end)\n docEnd.end.push(this.sourceToken);\n else\n docEnd.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n *lineEnd(token) {\n switch (this.type) {\n case 'comma':\n case 'doc-start':\n case 'doc-end':\n case 'flow-seq-end':\n case 'flow-map-end':\n case 'map-value-ind':\n yield* this.pop();\n yield* this.step();\n break;\n case 'newline':\n this.onKeyLine = false;\n // fallthrough\n case 'space':\n case 'comment':\n default:\n // all other values are errors\n if (token.end)\n token.end.push(this.sourceToken);\n else\n token.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n}\n\nexports.Parser = Parser;\n",
|
|
79
|
+
"'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar errors = require('./errors.js');\nvar log = require('./log.js');\nvar identity = require('./nodes/identity.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\n\nfunction parseOptions(options) {\n const prettyErrors = options.prettyErrors !== false;\n const lineCounter$1 = options.lineCounter || (prettyErrors && new lineCounter.LineCounter()) || null;\n return { lineCounter: lineCounter$1, prettyErrors };\n}\n/**\n * Parse the input as a stream of YAML documents.\n *\n * Documents should be separated from each other by `...` or `---` marker lines.\n *\n * @returns If an empty `docs` array is returned, it will be of type\n * EmptyStream and contain additional stream information. In\n * TypeScript, you should use `'empty' in docs` as a type guard for it.\n */\nfunction parseAllDocuments(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n const docs = Array.from(composer$1.compose(parser$1.parse(source)));\n if (prettyErrors && lineCounter)\n for (const doc of docs) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n if (docs.length > 0)\n return docs;\n return Object.assign([], { empty: true }, composer$1.streamInfo());\n}\n/** Parse an input string into a single YAML.Document */\nfunction parseDocument(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n // `doc` is always set by compose.end(true) at the very latest\n let doc = null;\n for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {\n if (!doc)\n doc = _doc;\n else if (doc.options.logLevel !== 'silent') {\n doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));\n break;\n }\n }\n if (prettyErrors && lineCounter) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n return doc;\n}\nfunction parse(src, reviver, options) {\n let _reviver = undefined;\n if (typeof reviver === 'function') {\n _reviver = reviver;\n }\n else if (options === undefined && reviver && typeof reviver === 'object') {\n options = reviver;\n }\n const doc = parseDocument(src, options);\n if (!doc)\n return null;\n doc.warnings.forEach(warning => log.warn(doc.options.logLevel, warning));\n if (doc.errors.length > 0) {\n if (doc.options.logLevel !== 'silent')\n throw doc.errors[0];\n else\n doc.errors = [];\n }\n return doc.toJS(Object.assign({ reviver: _reviver }, options));\n}\nfunction stringify(value, replacer, options) {\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n }\n if (typeof options === 'string')\n options = options.length;\n if (typeof options === 'number') {\n const indent = Math.round(options);\n options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };\n }\n if (value === undefined) {\n const { keepUndefined } = options ?? replacer ?? {};\n if (!keepUndefined)\n return undefined;\n }\n if (identity.isDocument(value) && !_replacer)\n return value.toString(options);\n return new Document.Document(value, _replacer, options).toString(options);\n}\n\nexports.parse = parse;\nexports.parseAllDocuments = parseAllDocuments;\nexports.parseDocument = parseDocument;\nexports.stringify = stringify;\n",
|
|
80
|
+
"/**\n * Runtime helpers for turning an `Effect` program into a host application's\n * main entry point.\n *\n * This module is the low-level layer used by platform adapters to run a main\n * effect, observe its fiber, report unhandled failures, and translate the\n * resulting `Exit` into an application or process exit code. Application code\n * usually calls the platform-provided runner; runtime integrations use\n * {@link makeRunMain} directly.\n *\n * **Mental model**\n *\n * - {@link makeRunMain} forks the supplied `Effect` and gives the host adapter\n * the running fiber plus a teardown callback\n * - The host adapter installs platform-specific hooks such as signal handlers,\n * fiber observers, process exits, worker termination, or test harness\n * callbacks\n * - {@link defaultTeardown} maps successful exits to `0`, interruption-only\n * failures to `130`, failures with {@link errorExitCode} to that code, and\n * other failures to `1`\n * - {@link errorReported} controls automatic failure logging; set it to\n * `false` on errors that have already been reported\n *\n * **Common tasks**\n *\n * - Build a platform runner: {@link makeRunMain}\n * - Reuse the standard exit-code rules: {@link defaultTeardown}\n * - Customize failure exit codes: {@link errorExitCode},\n * {@link getErrorExitCode}\n * - Control automatic failure logging: {@link errorReported},\n * {@link getErrorReported}\n *\n * **Gotchas**\n *\n * - `makeRunMain` starts the main fiber, but the adapter callback is\n * responsible for observing that fiber and eventually invoking teardown.\n * - `disableErrorReporting` only disables automatic failure logging. It does\n * not change the `Exit`, interruption behavior, or teardown exit-code rules.\n * - Error markers are read from `Cause.squash(cause)`, so causes with multiple\n * failures use the squashed failure value to determine logging and exit code.\n *\n * **Example** (Creating a minimal runner)\n *\n * ```ts\n * import { Effect, Runtime } from \"effect\"\n *\n * const runMain = Runtime.makeRunMain(({ fiber, teardown }) => {\n * fiber.addObserver((exit) => {\n * teardown(exit, (code) => {\n * console.log(`finished with exit code ${code}`)\n * })\n * })\n * })\n *\n * runMain(Effect.log(\"booted\"))\n * ```\n *\n * @since 4.0.0\n */\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport { constVoid, dual } from \"effect/Function\";\n/**\n * The default teardown function that determines exit codes from an Effect exit.\n *\n * **When to use**\n *\n * Use as the standard teardown for main programs when you want conventional\n * process exit codes and support for {@link errorExitCode}.\n *\n * **Details**\n *\n * This teardown follows these exit-code rules:\n *\n * - `0` for successful completion.\n * - `130` for interruption-only failures.\n * - The squashed error's {@link errorExitCode} value for other failures when\n * present.\n * - `1` for other failures.\n *\n * **Gotchas**\n *\n * The `130` code is used only when the Cause contains interruptions and no\n * other failure reasons. Mixed causes use the squashed error path instead.\n *\n * **Example** (Using default teardown)\n *\n * ```ts\n * import { Exit, Runtime } from \"effect\"\n *\n * const logExitCode = (exit: Exit.Exit<any, any>) => {\n * Runtime.defaultTeardown(exit, (code) => {\n * console.log(`Exit code: ${code}`)\n * })\n * }\n *\n * logExitCode(Exit.succeed(42))\n * // Output: Exit code: 0\n *\n * logExitCode(Exit.fail(\"error\"))\n * // Output: Exit code: 1\n *\n * logExitCode(Exit.interrupt(123))\n * // Output: Exit code: 130\n * ```\n *\n * @see {@link errorExitCode} for customizing failure exit codes\n *\n * @category running\n * @since 4.0.0\n */\nexport const defaultTeardown = (exit, onExit) => {\n if (Exit.isSuccess(exit)) return onExit(0);\n if (Cause.hasInterruptsOnly(exit.cause)) return onExit(130);\n return onExit(getErrorExitCode(Cause.squash(exit.cause)));\n};\n/**\n * Creates a platform-specific main program runner that handles Effect execution lifecycle.\n *\n * **When to use**\n *\n * Use when building a runtime adapter for a host platform. Most applications\n * should use a platform-provided runner, such as `NodeRuntime.runMain`, rather\n * than constructing one directly.\n *\n * **Details**\n *\n * The runner executes Effect programs as main entry points. The provided function receives a forked fiber and a teardown callback so it can install platform-specific signal handling, fiber observers, and final exit behavior.\n *\n * `disableErrorReporting` disables the automatic log emitted for unreported\n * non-interruption failures. It does not change exit-code calculation or the\n * custom teardown callback.\n *\n * **Gotchas**\n *\n * The setup function is responsible for observing the fiber and eventually\n * invoking teardown. `makeRunMain` also tries to keep the host process alive\n * with a long interval while the main fiber is running; if the host blocks\n * timers, the runner still starts but cannot use that keep-alive fallback.\n *\n * **Example** (Creating platform runners)\n *\n * ```ts\n * import { Effect, Fiber, Runtime } from \"effect\"\n *\n * // Create a simple runner for a hypothetical platform\n * const runMain = Runtime.makeRunMain(({ fiber, teardown }) => {\n * // Set up signal handling\n * const handleSignal = () => {\n * Effect.runSync(Fiber.interrupt(fiber))\n * }\n *\n * // Add signal listeners (platform-specific)\n * // process.on('SIGINT', handleSignal)\n * // process.on('SIGTERM', handleSignal)\n *\n * // Handle fiber completion\n * fiber.addObserver((exit) => {\n * teardown(exit, (code) => {\n * console.log(`Program finished with exit code: ${code}`)\n * // process.exit(code)\n * })\n * })\n * })\n *\n * // Use the runner\n * const program = Effect.gen(function*() {\n * yield* Effect.log(\"Starting program\")\n * yield* Effect.sleep(1000)\n * yield* Effect.log(\"Program completed\")\n * return \"success\"\n * })\n *\n * // Run with default options\n * runMain(program)\n *\n * // Run with custom teardown\n * runMain(program, {\n * teardown: (exit, onExit) => {\n * console.log(\"Custom teardown logic\")\n * Runtime.defaultTeardown(exit, onExit)\n * }\n * })\n * ```\n *\n * @category running\n * @since 4.0.0\n */\nexport const makeRunMain = f => dual(args => Effect.isEffect(args[0]), (effect, options) => {\n const fiber = options?.disableErrorReporting === true ? Effect.runFork(effect) : Effect.runFork(Effect.tapCause(effect, cause => {\n if (Cause.hasInterruptsOnly(cause)) return Effect.void;\n const isReported = getErrorReported(Cause.squash(cause));\n return isReported ? Effect.logError(cause) : Effect.void;\n }));\n try {\n const keepAlive = globalThis.setInterval(constVoid, 2_147_483_647);\n fiber.addObserver(() => {\n clearInterval(keepAlive);\n });\n } catch {}\n const teardown = options?.teardown ?? defaultTeardown;\n return f({\n fiber,\n teardown\n });\n});\n/**\n * Allows associating an exit code with an error for determining the process\n * exit code on failure.\n *\n * **When to use**\n *\n * Use when error classes should map failures to a specific process exit code\n * when handled by {@link defaultTeardown}.\n *\n * **Details**\n *\n * Attach this marker as a readonly property on an error object. When the main\n * program fails, {@link defaultTeardown} squashes the Cause and reads the marker\n * from the resulting error value.\n *\n * **Gotchas**\n *\n * The marker is read from the squashed failure value. If a Cause contains\n * multiple failures, the selected squashed error determines the exit code.\n *\n * **Example** (Setting a process exit code)\n *\n * ```ts\n * import { Data, Effect, Runtime } from \"effect\"\n * import { NodeRuntime } from \"@effect/platform-node\"\n *\n * class MyError extends Data.TaggedError(\"MyError\") {\n * readonly [Runtime.errorExitCode] = 42\n * }\n *\n * // If the program fails with MyError, the process will exit with code 42\n * NodeRuntime.runMain(Effect.fail(new MyError()))\n * ```\n *\n * @see {@link errorReported} for controlling automatic error logging\n * @see {@link defaultTeardown} for the default failure exit-code rules that read this marker\n * @see {@link getErrorExitCode} for reading the marker from unknown error values\n *\n * @category symbols\n * @since 4.0.0\n */\nexport const errorExitCode = \"~effect/Runtime/errorExitCode\";\n/**\n * Reads the runtime exit-code marker from an unknown error value.\n *\n * **When to use**\n *\n * Use to read a custom failure exit code from an unknown error value, falling\n * back to the default failure code.\n *\n * **Details**\n *\n * Returns the numeric `[Runtime.errorExitCode]` property when it is present on\n * an object. Otherwise returns `1`, the default failure exit code used by\n * `defaultTeardown`.\n *\n * **Gotchas**\n *\n * Non-object values, missing markers, and non-number marker values all return\n * `1`.\n *\n * @see {@link errorExitCode} for the marker read by this function\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const getErrorExitCode = u => {\n if (typeof u === \"object\" && u !== null && errorExitCode in u) {\n const code = u[errorExitCode];\n if (typeof code === \"number\") {\n return code;\n }\n }\n return 1;\n};\n/**\n * Defines the runtime marker that controls default `runMain` error logging for an error.\n *\n * **When to use**\n *\n * Use when error classes are already reported by application code and should\n * not be logged again by the default main runner.\n *\n * **Details**\n *\n * Set `[Runtime.errorReported]` to `false` on an error object to suppress the\n * runtime log because the error has already been reported. Omitted or\n * non-boolean values are treated as `true`, so failures are logged by default.\n *\n * **Gotchas**\n *\n * This marker controls only automatic error logging. It does not change the\n * failure Cause or the process exit code.\n * `makeRunMain` reads the marker from `Cause.squash(cause)`, so for causes\n * with multiple failures, the squashed error determines whether default logging\n * is suppressed.\n *\n * **Example** (Suppressing error reporting)\n *\n * ```ts\n * import { Data, Effect, Runtime } from \"effect\"\n * import { NodeRuntime } from \"@effect/platform-node\"\n *\n * class MyError extends Data.TaggedError(\"MyError\") {\n * readonly [Runtime.errorReported] = false\n * }\n *\n * // If the program fails with MyError, the process will exit with code 1 but\n * // no error will be logged.\n * NodeRuntime.runMain(Effect.fail(new MyError()))\n * ```\n *\n * @see {@link errorExitCode} for controlling failure exit codes\n * @see {@link getErrorReported} for reading the marker from unknown error values\n *\n * @category symbols\n * @since 4.0.0\n */\nexport const errorReported = \"~effect/Runtime/errorReported\";\n/**\n * Reads the runtime error-reporting marker from an unknown error value.\n *\n * **When to use**\n *\n * Use to read whether an unknown error value should be treated as already\n * reported by the default main runner.\n *\n * **Details**\n *\n * Returns a boolean `[Runtime.errorReported]` property when it is present on an\n * object. Otherwise returns `true`, so failures are logged by default.\n *\n * **Gotchas**\n *\n * Non-object values, missing markers, and non-boolean marker values all return\n * `true`.\n *\n * @see {@link errorReported} for the marker read by this function\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const getErrorReported = u => {\n if (typeof u === \"object\" && u !== null && errorReported in u) {\n const isReported = u[errorReported];\n if (typeof isReported === \"boolean\") {\n return isReported;\n }\n }\n return true;\n};\n//# sourceMappingURL=Runtime.js.map",
|
|
81
|
+
"/**\n * The `CliError` module defines the structured error model used by the\n * unstable CLI parser and runner. It distinguishes command-line parse failures,\n * CLI definition problems, explicit help requests, and user handler failures so\n * applications can report errors consistently while still pattern matching on\n * the exact cause.\n *\n * **Common tasks**\n *\n * - Detect CLI errors at runtime with {@link isCliError}\n * - Represent parse failures such as unknown flags, missing required inputs, or\n * invalid argument values\n * - Attach parse or validation errors to {@link ShowHelp} when the runner should\n * render help text together with the failure\n * - Preserve command handler failures with {@link UserError}\n *\n * **Gotchas**\n *\n * - {@link ShowHelp} is a control-flow error, not a parse failure; it exits with\n * code `0` for explicit help and `1` when it carries errors\n * - Duplicate option names between parent and child commands are rejected\n * because the parent command claims the flag before the child can see it\n * - Suggestion-bearing errors keep suggestions separate from the primary cause\n * so help renderers can decide how much guidance to display\n *\n * @since 4.0.0\n */\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Runtime from \"../../Runtime.js\";\nimport * as Schema from \"../../Schema.js\";\n/**\n * @category type IDs\n * @since 4.0.0\n */\nconst TypeId = \"~effect/cli/CliError\";\n/**\n * Type guard to check if a value is a CLI error.\n *\n * **Example** (Checking CLI errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * const handleError = (error: unknown) => {\n * if (CliError.isCliError(error)) {\n * console.log(\"CLI Error:\", error.message)\n * return Effect.succeed(\"Handled CLI error\")\n * }\n * return Effect.fail(\"Unknown error\")\n * }\n *\n * // Example usage in error handling\n * const program = Effect.gen(function*() {\n * const result = yield* Effect.try({\n * try: () => ({ success: true }),\n * catch: (error) => error\n * })\n * handleError(result)\n * })\n * ```\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCliError = u => Predicate.hasProperty(u, TypeId);\n/**\n * Error thrown when an unrecognized option is encountered.\n *\n * **Example** (Creating unrecognized option errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * // Creating an unrecognized option error\n * const unrecognizedError = new CliError.UnrecognizedOption({\n * option: \"--unknown-flag\",\n * command: [\"deploy\", \"production\"],\n * suggestions: [\"--verbose\", \"--force\"]\n * })\n *\n * console.log(unrecognizedError.message)\n * // \"Unrecognized flag: --unknown-flag in command deploy production\n * //\n * // Did you mean this?\n * // --verbose\n * // --force\"\n *\n * // In CLI parsing context\n * const parseCommand = Effect.gen(function*() {\n * // If parsing encounters unknown flag\n * return yield* unrecognizedError\n * })\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class UnrecognizedOption extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/UnrecognizedOption`)({\n _tag: /*#__PURE__*/Schema.tag(\"UnrecognizedOption\"),\n option: Schema.String,\n command: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),\n suggestions: /*#__PURE__*/Schema.Array(Schema.String)\n}) {\n /**\n * Marks this value as a CLI parsing error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * Formats the unrecognized option with command context and suggestions.\n *\n * @since 4.0.0\n */\n get message() {\n const suggestionText = this.suggestions.length > 0 ? `\\n\\n Did you mean this?\\n ${this.suggestions.join(\"\\n \")}` : \"\";\n const baseMessage = this.command ? `Unrecognized flag: ${this.option} in command ${this.command.join(\" \")}` : `Unrecognized flag: ${this.option}`;\n return baseMessage + suggestionText;\n }\n}\n/**\n * Error thrown when duplicate option names are detected between parent and child commands.\n *\n * **Example** (Creating duplicate option errors)\n *\n * ```ts\n * import { CliError } from \"effect/unstable/cli\"\n *\n * const duplicateError = new CliError.DuplicateOption({\n * option: \"--verbose\",\n * parentCommand: \"myapp\",\n * childCommand: \"deploy\"\n * })\n *\n * console.log(duplicateError.message)\n * // \"Duplicate flag name \"--verbose\" in parent command \"myapp\" and subcommand \"deploy\".\n * // Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.\"\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class DuplicateOption extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/DuplicateOption`)({\n _tag: /*#__PURE__*/Schema.tag(\"DuplicateOption\"),\n option: Schema.String,\n parentCommand: Schema.String,\n childCommand: Schema.String\n}) {\n /**\n * Marks this value as a CLI configuration error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * Explains which parent and child commands define the duplicate option.\n *\n * @since 4.0.0\n */\n get message() {\n return `Duplicate flag name \"${this.option}\" in parent command \"${this.parentCommand}\" and subcommand \"${this.childCommand}\". ` + `Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`;\n }\n}\n/**\n * Error thrown when a required option is missing.\n *\n * **Example** (Creating missing option errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * const missingOptionError = new CliError.MissingOption({\n * option: \"api-key\"\n * })\n *\n * console.log(missingOptionError.message)\n * // \"Missing required flag: --api-key\"\n *\n * // In validation context\n * const validateRequiredOptions = (options: Record<string, string | undefined>) =>\n * Effect.gen(function*() {\n * const apiKey = options[\"api-key\"]\n * if (!apiKey) {\n * return yield* missingOptionError\n * }\n * return apiKey\n * })\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class MissingOption extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/MissingOption`)({\n _tag: /*#__PURE__*/Schema.tag(\"MissingOption\"),\n option: Schema.String\n}) {\n /**\n * Marks this value as a missing CLI option error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * Formats the missing required flag for display.\n *\n * @since 4.0.0\n */\n get message() {\n return `Missing required flag: --${this.option}`;\n }\n}\n/**\n * Error thrown when a required positional argument is missing.\n *\n * **Example** (Creating missing argument errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * const missingArgError = new CliError.MissingArgument({\n * argument: \"target\"\n * })\n *\n * console.log(missingArgError.message)\n * // \"Missing required argument: target\"\n *\n * // In argument parsing\n * const parseArguments = (args: Array<string>) =>\n * Effect.gen(function*() {\n * if (args.length === 0) {\n * return yield* missingArgError\n * }\n * return args[0]\n * })\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class MissingArgument extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/MissingArgument`)({\n _tag: /*#__PURE__*/Schema.tag(\"MissingArgument\"),\n argument: Schema.String\n}) {\n /**\n * Marks this value as a missing CLI argument error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * Formats the missing required positional argument for display.\n *\n * @since 4.0.0\n */\n get message() {\n return `Missing required argument: ${this.argument}`;\n }\n}\n/**\n * Error thrown when an option or argument value is invalid.\n *\n * **Example** (Creating invalid value errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * const invalidValueError = new CliError.InvalidValue({\n * option: \"port\",\n * value: \"abc123\",\n * expected: \"integer between 1 and 65535\",\n * kind: \"flag\"\n * })\n *\n * console.log(invalidValueError.message)\n * // \"Invalid value for flag --port: \"abc123\". Expected: integer between 1 and 65535\"\n *\n * // For positional arguments\n * const invalidArgError = new CliError.InvalidValue({\n * option: \"count\",\n * value: \"abc\",\n * expected: \"integer\",\n * kind: \"argument\"\n * })\n *\n * console.log(invalidArgError.message)\n * // \"Invalid value for argument <count>: \"abc\". Expected: integer\"\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class InvalidValue extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/InvalidValue`)({\n _tag: /*#__PURE__*/Schema.tag(\"InvalidValue\"),\n option: Schema.String,\n value: Schema.String,\n expected: Schema.String,\n kind: /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Literal(\"flag\"), /*#__PURE__*/Schema.Literal(\"argument\")])\n}) {\n /**\n * Marks this value as an invalid CLI value error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * Formats the invalid flag or argument value with the expected input.\n *\n * @since 4.0.0\n */\n get message() {\n if (this.kind === \"argument\") {\n return `Invalid value for argument <${this.option}>: \"${this.value}\". Expected: ${this.expected}`;\n }\n return `Invalid value for flag --${this.option}: \"${this.value}\". Expected: ${this.expected}`;\n }\n}\n/**\n * Error thrown when an unknown subcommand is encountered.\n *\n * **Example** (Creating unknown subcommand errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * const unknownSubcommandError = new CliError.UnknownSubcommand({\n * subcommand: \"deplyo\", // typo\n * parent: [\"myapp\"],\n * suggestions: [\"deploy\", \"destroy\"]\n * })\n *\n * console.log(unknownSubcommandError.message)\n * // \"Unknown subcommand \"deplyo\" for \"myapp\"\n * //\n * // Did you mean this?\n * // deploy\n * // destroy\"\n *\n * // In subcommand parsing\n * const parseSubcommand = (subcommand: string) =>\n * Effect.gen(function*() {\n * const validCommands = [\"deploy\", \"destroy\", \"status\"]\n * if (!validCommands.includes(subcommand)) {\n * return yield* unknownSubcommandError\n * }\n * return subcommand\n * })\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class UnknownSubcommand extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/UnknownSubcommand`)({\n _tag: /*#__PURE__*/Schema.tag(\"UnknownSubcommand\"),\n subcommand: Schema.String,\n parent: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),\n suggestions: /*#__PURE__*/Schema.Array(Schema.String)\n}) {\n /**\n * Marks this value as an unknown CLI subcommand error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * Formats the unknown subcommand with parent command context and suggestions.\n *\n * @since 4.0.0\n */\n get message() {\n const suggestionText = this.suggestions.length > 0 ? `\\n\\n Did you mean this?\\n ${this.suggestions.join(\"\\n \")}` : \"\";\n return this.parent ? `Unknown subcommand \"${this.subcommand}\" for \"${this.parent.join(\" \")}\"${suggestionText}` : `Unknown subcommand \"${this.subcommand}\"${suggestionText}`;\n }\n}\n/**\n * Error wrapper for user handler failures in the CLI error channel.\n *\n * **Example** (Wrapping user errors)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError } from \"effect/unstable/cli\"\n *\n * // Wrapping user errors\n * const userError = new CliError.UserError({\n * cause: new Error(\"Database connection failed\")\n * })\n *\n * // In command handler\n * const deployCommand = Effect.gen(function*() {\n * const result = yield* Effect.try({\n * try: () => ({ deployed: true }),\n * catch: (error) => new CliError.UserError({ cause: error })\n * })\n * return result\n * })\n *\n * // In error handling\n * const handleError = (error: CliError.CliError): Effect.Effect<number> => {\n * if (error._tag === \"UserError\") {\n * console.log(\"Command failed:\", error.cause)\n * return Effect.succeed(1) // Exit code 1\n * }\n * return Effect.succeed(0)\n * }\n * ```\n *\n * @category models\n * @since 4.0.0\n */\nexport class UserError extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/UserError`)({\n _tag: /*#__PURE__*/Schema.tag(\"UserError\"),\n cause: Schema.Defect\n}) {\n /**\n * Marks this value as a user handler error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n}\n/**\n * Schema for concrete CLI errors that can be reported together with help output.\n *\n * **Details**\n *\n * This excludes `ShowHelp` itself, allowing parse and validation errors to be\n * stored in `ShowHelp.errors` without nesting another help-control value.\n *\n * @category models\n * @since 4.0.0\n */\nexport const NonShowHelpErrors = /*#__PURE__*/Schema.Union([UnrecognizedOption, DuplicateOption, MissingOption, MissingArgument, InvalidValue, UnknownSubcommand, UserError]);\n/**\n * Error data requesting CLI help rendering for a command path.\n *\n * **Details**\n *\n * It is used for explicit help requests and for parse or validation failures\n * that should be shown with help text. When `errors` is non-empty, the runtime\n * exit code is `1`; otherwise it is `0`.\n *\n * @category models\n * @since 4.0.0\n */\nexport class ShowHelp extends /*#__PURE__*/Schema.ErrorClass(`${TypeId}/ShowHelp`)({\n _tag: /*#__PURE__*/Schema.tag(\"ShowHelp\"),\n commandPath: /*#__PURE__*/Schema.Array(Schema.String),\n errors: /*#__PURE__*/Schema.Array(NonShowHelpErrors)\n}) {\n [TypeId] = TypeId;\n [Runtime.errorExitCode] = this.errors.length ? 1 : 0;\n [Runtime.errorReported] = false;\n get message() {\n return \"Help requested\";\n }\n}\n//# sourceMappingURL=CliError.js.map",
|
|
82
|
+
"/**\n * The `Primitive` module defines the lowest-level value parsers used by the\n * unstable CLI package. A `Primitive<A>` takes one raw command-line string and\n * returns an `Effect` that either produces an `A` or fails with a parser\n * message.\n *\n * `Argument` and `Flag` build on primitives to add names, aliases, defaults,\n * prompts, config fallbacks, repetition, and help metadata. Use this module\n * directly when defining a custom CLI input shape or when composing parser\n * behavior before it becomes an argument or flag.\n *\n * **Mental model**\n *\n * - A primitive parses one value token; it does not know whether the token came\n * from a positional argument or a named flag.\n * - Parsing may be pure, such as {@link string}, {@link integer},\n * {@link boolean}, or {@link choice}, or effectful, such as {@link path},\n * {@link fileText}, {@link fileParse}, and {@link fileSchema}.\n * - Failure is represented as a string message so higher-level CLI parsers can\n * attach it to generated usage and help output.\n * - File and path primitives require filesystem and path services through the\n * parsing effect environment.\n *\n * **Common tasks**\n *\n * - Parse scalar values with {@link string}, {@link integer}, {@link float},\n * {@link boolean}, and {@link date}.\n * - Restrict input to named alternatives with {@link choice}.\n * - Resolve and validate filesystem paths with {@link path}.\n * - Read raw file content with {@link fileText}, parse structured files with\n * {@link fileParse}, or decode parsed content with {@link fileSchema}.\n * - Hide sensitive input with {@link redacted}.\n * - Parse `key=value` entries with {@link keyValuePair}.\n *\n * **Example** (Parsing raw CLI values)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseValues = Effect.gen(function*() {\n * const port = yield* Primitive.integer.parse(\"8080\")\n * const mode = yield* Primitive.choice([\n * [\"dev\", \"development\"],\n * [\"prod\", \"production\"]\n * ] as const).parse(\"prod\")\n *\n * return { port, mode }\n * })\n * ```\n *\n * **Gotchas**\n *\n * - `choice` matches input strings exactly; it does not normalize casing or\n * trim whitespace.\n * - `fileParse` selects a parser from `options.format` or the file extension;\n * unsupported formats fail before schema decoding.\n * - {@link none} is a sentinel parser that always fails. It is used by higher\n * layers for parameters that must reject attached values.\n *\n * @since 4.0.0\n */\nimport * as Ini from \"ini\";\nimport * as Toml from \"toml\";\nimport * as Yaml from \"yaml\";\nimport * as Config from \"../../Config.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { format } from \"../../Formatter.js\";\nimport { identity } from \"../../Function.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Redacted from \"../../Redacted.js\";\nimport * as Schema from \"../../Schema.js\";\nconst TypeId = \"~effect/cli/Primitive\";\nconst Proto = {\n [TypeId]: {\n _A: identity\n }\n};\n/** @internal */\nexport const isTrueValue = /*#__PURE__*/Schema.is(Config.TrueValues);\n/** @internal */\nexport const isFalseValue = /*#__PURE__*/Schema.is(Config.FalseValues);\n/** @internal */\nexport const isBoolean = p => p._tag === \"Boolean\";\nconst makePrimitive = (tag, parse) => Object.assign(Object.create(Proto), {\n _tag: tag,\n parse\n});\nconst makeSchemaPrimitive = (tag, schema) => {\n const toCodecStringTree = Schema.toCodecStringTree(schema);\n const decode = Schema.decodeUnknownEffect(toCodecStringTree);\n return makePrimitive(tag, value => Effect.mapError(decode(value), error => error.message));\n};\n/**\n * Creates a primitive that parses boolean values from string input.\n *\n * **Details**\n *\n * Recognizes various forms of true/false values:\n * - True values: \"true\", \"1\", \"y\", \"yes\", \"on\"\n * - False values: \"false\", \"0\", \"n\", \"no\", \"off\"\n *\n * **Example** (Parsing boolean values)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseBoolean = Effect.gen(function*() {\n * const result1 = yield* Primitive.boolean.parse(\"true\")\n * console.log(result1) // true\n *\n * const result2 = yield* Primitive.boolean.parse(\"yes\")\n * console.log(result2) // true\n *\n * const result3 = yield* Primitive.boolean.parse(\"false\")\n * console.log(result3) // false\n *\n * const result4 = yield* Primitive.boolean.parse(\"0\")\n * console.log(result4) // false\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const boolean = /*#__PURE__*/makeSchemaPrimitive(\"Boolean\", Config.Boolean);\n/**\n * Creates a primitive that parses floating-point numbers from string input.\n *\n * **Example** (Parsing floating-point numbers)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseFloat = Effect.gen(function*() {\n * const result1 = yield* Primitive.float.parse(\"3.14\")\n * console.log(result1) // 3.14\n *\n * const result2 = yield* Primitive.float.parse(\"-42.5\")\n * console.log(result2) // -42.5\n *\n * const result3 = yield* Primitive.float.parse(\"0\")\n * console.log(result3) // 0\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const float = /*#__PURE__*/makeSchemaPrimitive(\"Float\", Schema.Finite);\n/**\n * Creates a primitive that parses integer numbers from string input.\n *\n * **Example** (Parsing integer values)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseInteger = Effect.gen(function*() {\n * const result1 = yield* Primitive.integer.parse(\"42\")\n * console.log(result1) // 42\n *\n * const result2 = yield* Primitive.integer.parse(\"-123\")\n * console.log(result2) // -123\n *\n * const result3 = yield* Primitive.integer.parse(\"0\")\n * console.log(result3) // 0\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const integer = /*#__PURE__*/makeSchemaPrimitive(\"Integer\", Schema.Int);\n/**\n * Creates a primitive that parses Date objects from string input.\n *\n * **Example** (Parsing date values)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseDate = Effect.gen(function*() {\n * const result1 = yield* Primitive.date.parse(\"2023-12-25\")\n * console.log(result1) // Date object for December 25, 2023\n *\n * const result2 = yield* Primitive.date.parse(\"2023-12-25T10:30:00Z\")\n * console.log(result2) // Date object with time\n *\n * const result3 = yield* Primitive.date.parse(\"Dec 25, 2023\")\n * console.log(result3) // Date object parsed from natural format\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const date = /*#__PURE__*/makeSchemaPrimitive(\"Date\", Schema.DateValid);\n/**\n * Creates a primitive that accepts any string value without validation.\n *\n * **Example** (Parsing string values)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseString = Effect.gen(function*() {\n * const result1 = yield* Primitive.string.parse(\"hello world\")\n * console.log(result1) // \"hello world\"\n *\n * const result2 = yield* Primitive.string.parse(\"\")\n * console.log(result2) // \"\"\n *\n * const result3 = yield* Primitive.string.parse(\"123\")\n * console.log(result3) // \"123\"\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const string = /*#__PURE__*/makePrimitive(\"String\", value => Effect.succeed(value));\n/**\n * Creates a primitive that accepts only specific choice values mapped to custom types.\n *\n * **Example** (Parsing choices)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\"\n *\n * const logLevelPrimitive = Primitive.choice<LogLevel>([\n * [\"debug\", \"debug\"],\n * [\"info\", \"info\"],\n * [\"warn\", \"warn\"],\n * [\"error\", \"error\"]\n * ])\n *\n * const parseLogLevel = Effect.gen(function*() {\n * const result1 = yield* logLevelPrimitive.parse(\"info\")\n * console.log(result1) // \"info\"\n *\n * const result2 = yield* logLevelPrimitive.parse(\"debug\")\n * console.log(result2) // \"debug\"\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choice = choices => {\n const choiceMap = new Map(choices);\n const validChoices = choices.map(([key]) => format(key)).join(\" | \");\n const primitive = makePrimitive(\"Choice\", value => {\n if (choiceMap.has(value)) {\n return Effect.succeed(choiceMap.get(value));\n }\n return Effect.fail(`Expected ${validChoices}, got ${format(value)}`);\n });\n return Object.assign(primitive, {\n choiceKeys: choices.map(([key]) => key)\n });\n};\n/**\n * Creates a primitive that validates and resolves file system paths.\n *\n * **Example** (Parsing file system paths)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const program = Effect.gen(function*() {\n * // Parse a file path that must exist\n * const filePrimitive = Primitive.path(\"file\", true)\n * const filePath = yield* filePrimitive.parse(\"./package.json\")\n * console.log(filePath) // Absolute path to package.json\n *\n * // Parse a directory path\n * const dirPrimitive = Primitive.path(\"directory\", false)\n * const dirPath = yield* dirPrimitive.parse(\"./src\")\n * console.log(dirPath) // Absolute path to src directory\n *\n * // Parse any path type\n * const anyPrimitive = Primitive.path(\"either\", false)\n * const anyPath = yield* anyPrimitive.parse(\"./some/path\")\n * console.log(anyPath) // Absolute path\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const path = (pathType, mustExist) => makePrimitive(\"Path\", Effect.fnUntraced(function* (value) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n // Resolve the path to absolute\n const absolutePath = path.isAbsolute(value) ? value : path.resolve(value);\n // Check if path exists\n const exists = yield* Effect.mapError(fs.exists(absolutePath), error => `Failed to check path existence: ${error.message}`);\n // Validate existence requirements\n if (mustExist === true && !exists) {\n return yield* Effect.fail(`Path does not exist: ${absolutePath}`);\n }\n // Validate path type if it exists\n if (exists && pathType !== \"either\") {\n const stat = yield* Effect.mapError(fs.stat(absolutePath), error => `Failed to stat path: ${error.message}`);\n if (pathType === \"file\" && stat.type !== \"File\") {\n return yield* Effect.fail(`Path is not a file: ${absolutePath}`);\n }\n if (pathType === \"directory\" && stat.type !== \"Directory\") {\n return yield* Effect.fail(`Path is not a directory: ${absolutePath}`);\n }\n }\n return absolutePath;\n}));\n/**\n * Creates a primitive that wraps string input in `Redacted`.\n *\n * **Details**\n *\n * The wrapped value is hidden when formatted or inspected, while the original\n * string remains available through the `Redacted` API when explicitly needed.\n *\n * **Example** (Parsing redacted values)\n *\n * ```ts\n * import { Effect, Redacted } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseRedacted = Effect.gen(function*() {\n * const result = yield* Primitive.redacted.parse(\"secret-password\")\n * console.log(Redacted.value(result)) // \"secret-password\"\n * console.log(String(result)) // \"<redacted>\"\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redacted = /*#__PURE__*/makePrimitive(\"Redacted\", value => Effect.succeed(Redacted.make(value)));\n/**\n * Creates a primitive that reads and returns the contents of a file as a string.\n *\n * **Example** (Reading file text)\n *\n * ```ts\n * import { Effect, Schema } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const ConfigSchema = Schema.Struct({\n * name: Schema.String,\n * version: Schema.String,\n * port: Schema.Number\n * })\n * const decodeConfig = Schema.decodeUnknownEffect(\n * Schema.fromJsonString(ConfigSchema)\n * )\n *\n * const readConfigFile = Effect.gen(function*() {\n * const content = yield* Primitive.fileText.parse(\"./config.json\")\n * console.log(content) // {\"name\":\"my-app\",\"version\":\"1.0.0\",\"port\":3000}\n *\n * const config = yield* decodeConfig(content)\n * console.log(config) // { name: \"my-app\", version: \"1.0.0\", port: 3000 }\n * return config\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileText = /*#__PURE__*/makePrimitive(\"FileText\", /*#__PURE__*/Effect.fnUntraced(function* (filePath) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n // Resolve to absolute path\n const absolutePath = path.isAbsolute(filePath) ? filePath : path.resolve(filePath);\n // Check if file exists\n const exists = yield* Effect.mapError(fs.exists(absolutePath), error => `Failed to check file existence: ${error.message}`);\n if (!exists) {\n return yield* Effect.fail(`File does not exist: ${absolutePath}`);\n }\n // Check if it's actually a file\n const stat = yield* Effect.mapError(fs.stat(absolutePath), error => `Failed to stat file: ${error.message}`);\n if (stat.type !== \"File\") {\n return yield* Effect.fail(`Path is not a file: ${absolutePath}`);\n }\n // Read file content\n const content = yield* Effect.mapError(fs.readFileString(absolutePath), error => `Failed to read file: ${error.message}`);\n return content;\n}));\nconst fileParsers = {\n ini: content => Ini.parse(content),\n json: content => JSON.parse(content),\n toml: content => Toml.parse(content),\n yml: content => Yaml.parse(content),\n yaml: content => Yaml.parse(content)\n};\n/**\n * Creates a primitive that reads a file and parses its content as structured\n * data.\n *\n * **Details**\n *\n * The parser is selected from `options.format` when provided, otherwise from\n * the file extension. Supported formats include INI, JSON, TOML, YAML, and YML.\n *\n * **Example** (Parsing file content)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const tomlFilePrimitive = Primitive.fileParse({ format: \"toml\" })\n *\n * const loadConfig = Effect.gen(function*() {\n * const config = yield* tomlFilePrimitive.parse(\"./config.toml\")\n * console.log(config) // { name: \"my-app\", version: \"1.0.0\", port: 3000 }\n * return config\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileParse = options => {\n return makePrimitive(\"FileParse\", Effect.fnUntraced(function* (filePath) {\n const fileFormat = options?.format ?? filePath.split(\".\").pop();\n const parser = fileParsers[fileFormat];\n if (parser === undefined) {\n return yield* Effect.fail(`Unsupported file format: ${fileFormat}`);\n }\n const content = yield* fileText.parse(filePath);\n return yield* Effect.try({\n try: () => parser(content),\n catch: error => `Failed to parse '.${fileFormat}' file content: ${error}`\n });\n }));\n};\n/**\n * Reads and parses file content using the specified schema.\n *\n * **Example** (Parsing file content with a schema)\n *\n * ```ts\n * import { Effect, Schema } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const ConfigSchema = Schema.Struct({\n * name: Schema.String,\n * version: Schema.String,\n * port: Schema.Number\n * })\n *\n * const jsonConfigPrimitive = Primitive.fileSchema(ConfigSchema, {\n * format: \"json\"\n * })\n *\n * const loadConfig = Effect.gen(function*() {\n * const config = yield* jsonConfigPrimitive.parse(\"./config.json\")\n * console.log(config) // { name: \"my-app\", version: \"1.0.0\", port: 3000 }\n * return config\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileSchema = (schema, options) => {\n const decode = Schema.decodeUnknownEffect(schema);\n return makePrimitive(\"FileSchema\", Effect.fnUntraced(function* (filePath) {\n const content = yield* fileParse(options).parse(filePath);\n return yield* Effect.mapError(decode(content), error => options?.errorFormatter?.(error.issue) ?? error.toString());\n }));\n};\n/**\n * Parses a single `key=value` pair into a record object.\n *\n * **Example** (Parsing key-value pairs)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const parseKeyValue = Effect.gen(function*() {\n * const result1 = yield* Primitive.keyValuePair.parse(\"name=john\")\n * console.log(result1) // { name: \"john\" }\n *\n * const result2 = yield* Primitive.keyValuePair.parse(\"port=3000\")\n * console.log(result2) // { port: \"3000\" }\n *\n * const result3 = yield* Primitive.keyValuePair.parse(\"debug=true\")\n * console.log(result3) // { debug: \"true\" }\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const keyValuePair = /*#__PURE__*/makePrimitive(\"KeyValuePair\", /*#__PURE__*/Effect.fnUntraced(function* (value) {\n const parts = value.split(\"=\");\n if (parts.length !== 2) {\n return yield* Effect.fail(`Invalid key=value format. Expected format: key=value, got: ${value}`);\n }\n const [key, val] = parts;\n if (!key || !val) {\n return yield* Effect.fail(`Invalid key=value format. Both key and value must be non-empty. Got: ${value}`);\n }\n return {\n [key]: val\n };\n}));\n/**\n * Creates a sentinel primitive that always fails to parse a value.\n *\n * **When to use**\n *\n * Use when you need flags that don't accept values.\n *\n * **Example** (Rejecting option values)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * const program = Effect.gen(function*() {\n * // This will always fail - useful for boolean flags\n * return yield* Primitive.none.parse(\"any-value\")\n * })\n *\n * // The above effect will fail with \"This option does not accept values\"\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const none = /*#__PURE__*/makePrimitive(\"None\", () => Effect.fail(\"This option does not accept values\"));\n/**\n * Gets a human-readable type name for a primitive.\n *\n * **When to use**\n *\n * Use when you need generating help documentation.\n *\n * **Example** (Getting primitive type names)\n *\n * ```ts\n * import { Primitive } from \"effect/unstable/cli\"\n *\n * console.log(Primitive.getTypeName(Primitive.string)) // \"string\"\n * console.log(Primitive.getTypeName(Primitive.integer)) // \"integer\"\n * console.log(Primitive.getTypeName(Primitive.boolean)) // \"boolean\"\n * console.log(Primitive.getTypeName(Primitive.date)) // \"date\"\n * console.log(Primitive.getTypeName(Primitive.keyValuePair)) // \"key=value\"\n *\n * const logLevelChoice = Primitive.choice([\n * [\"debug\", \"debug\"],\n * [\"info\", \"info\"]\n * ])\n * console.log(Primitive.getTypeName(logLevelChoice)) // \"choice\"\n * ```\n *\n * @category getters\n * @since 4.0.0\n */\nexport const getTypeName = primitive => {\n switch (primitive._tag) {\n case \"Boolean\":\n return \"boolean\";\n case \"String\":\n return \"string\";\n case \"Integer\":\n return \"integer\";\n case \"Float\":\n return \"number\";\n case \"Date\":\n return \"date\";\n case \"Path\":\n return \"path\";\n case \"Choice\":\n return \"choice\";\n case \"Redacted\":\n return \"string\";\n case \"FileText\":\n return \"file\";\n case \"FileParse\":\n return \"file\";\n case \"FileSchema\":\n return \"file\";\n case \"KeyValuePair\":\n return \"key=value\";\n case \"None\":\n return \"none\";\n default:\n return \"value\";\n }\n};\n/** @internal */\nexport const getChoiceKeys = primitive => primitive._tag === \"Choice\" ? primitive.choiceKeys : undefined;\n//# sourceMappingURL=Primitive.js.map",
|
|
83
|
+
"'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar Schema = require('./schema/Schema.js');\nvar errors = require('./errors.js');\nvar Alias = require('./nodes/Alias.js');\nvar identity = require('./nodes/identity.js');\nvar Pair = require('./nodes/Pair.js');\nvar Scalar = require('./nodes/Scalar.js');\nvar YAMLMap = require('./nodes/YAMLMap.js');\nvar YAMLSeq = require('./nodes/YAMLSeq.js');\nvar cst = require('./parse/cst.js');\nvar lexer = require('./parse/lexer.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\nvar publicApi = require('./public-api.js');\nvar visit = require('./visit.js');\n\n\n\nexports.Composer = composer.Composer;\nexports.Document = Document.Document;\nexports.Schema = Schema.Schema;\nexports.YAMLError = errors.YAMLError;\nexports.YAMLParseError = errors.YAMLParseError;\nexports.YAMLWarning = errors.YAMLWarning;\nexports.Alias = Alias.Alias;\nexports.isAlias = identity.isAlias;\nexports.isCollection = identity.isCollection;\nexports.isDocument = identity.isDocument;\nexports.isMap = identity.isMap;\nexports.isNode = identity.isNode;\nexports.isPair = identity.isPair;\nexports.isScalar = identity.isScalar;\nexports.isSeq = identity.isSeq;\nexports.Pair = Pair.Pair;\nexports.Scalar = Scalar.Scalar;\nexports.YAMLMap = YAMLMap.YAMLMap;\nexports.YAMLSeq = YAMLSeq.YAMLSeq;\nexports.CST = cst;\nexports.Lexer = lexer.Lexer;\nexports.LineCounter = lineCounter.LineCounter;\nexports.Parser = parser.Parser;\nexports.parse = publicApi.parse;\nexports.parseAllDocuments = publicApi.parseAllDocuments;\nexports.parseDocument = publicApi.parseDocument;\nexports.stringify = publicApi.stringify;\nexports.visit = visit.visit;\nexports.visitAsync = visit.visitAsync;\n",
|
|
84
|
+
"import * as Context from \"./Context.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as Schema from \"./Schema.js\";\nconst TypeId = \"~effect/platform/Terminal\";\nconst QuitErrorTypeId = \"effect/platform/Terminal/QuitError\";\n/**\n * Represents an error that occurs when a user attempts to\n * quit out of a `Terminal` prompt for input (usually by entering `ctrl`+`c`).\n *\n * **When to use**\n *\n * Use when implementing terminal input or prompts that need to signal\n * user-requested cancellation through the typed error channel.\n *\n * @see {@link isQuitError} for checking unknown errors when handling terminal cancellation\n *\n * @category QuitError\n * @since 4.0.0\n */\nexport class QuitError extends /*#__PURE__*/Schema.ErrorClass(\"QuitError\")({\n _tag: /*#__PURE__*/Schema.tag(\"QuitError\")\n}) {\n /**\n * Marks this value as a terminal quit error for runtime guards.\n *\n * @since 4.0.0\n */\n [QuitErrorTypeId] = QuitErrorTypeId;\n}\n/**\n * Returns `true` if the provided value is a `Terminal.QuitError`.\n *\n * **When to use**\n *\n * Use to narrow unknown failures to `QuitError` when handling terminal input\n * cancellation.\n *\n * **Details**\n *\n * Returns `true` when the value carries the `QuitError` runtime marker and\n * narrows it to `QuitError`.\n *\n * @see {@link QuitError} for the error value produced when terminal input is quit\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isQuitError = u => Predicate.hasProperty(u, QuitErrorTypeId);\n/**\n * Service tag for command-line input and output services.\n *\n * **When to use**\n *\n * Use to access or provide platform terminal capabilities such as reading\n * input, writing output, and inspecting terminal dimensions.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Terminal = /*#__PURE__*/Context.Service(\"effect/platform/Terminal\");\n/**\n * Creates a `Terminal` service implementation.\n *\n * **When to use**\n *\n * Use to construct a custom `Terminal` service implementation from concrete\n * terminal capabilities when writing a platform adapter, test implementation,\n * or custom runtime service.\n *\n * **Details**\n *\n * The implementation object supplies `columns`, `rows`, `readInput`,\n * `readLine`, and `display`; `make` attaches the `Terminal` service marker so\n * the result can be provided through the `Terminal` context service.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = impl => Terminal.of({\n ...impl,\n [TypeId]: TypeId\n});\n//# sourceMappingURL=Terminal.js.map",
|
|
85
|
+
"/**\n * Internal ANSI escape sequence helpers used by the unstable CLI rendering\n * implementation. This module centralizes the control codes for text styling,\n * cursor movement, line erasing, and terminal notifications so renderers can\n * compose terminal output without scattering raw escape sequences throughout\n * the CLI internals.\n *\n * The helpers deliberately work with plain strings because terminal rendering\n * is sensitive to ordering: style codes must be reset after annotated text,\n * cursor operations must account for one-based terminal coordinates, and line\n * clearing usually needs to preserve the cursor position expected by the next\n * frame.\n */\nconst ESC = \"\\x1B[\";\nconst BEL = \"\\x07\";\nconst SEP = \";\";\n/** @internal */\nexport const reset = `${ESC}0m`;\n/** @internal */\nexport const bold = `${ESC}1m`;\n/** @internal */\nexport const italicized = `${ESC}3m`;\n/** @internal */\nexport const underlined = `${ESC}4m`;\n/** @internal */\nexport const strikethrough = `${ESC}9m`;\n/** @internal */\nexport const cursorShow = `${ESC}?25h`;\n/** @internal */\nexport const cursorHide = `${ESC}?25l`;\n/** @internal */\nexport const cursorLeft = `${ESC}G`;\n/** @internal */\nexport const cursorSavePosition = `${ESC}s`;\n/** @internal */\nexport const cursorRestorePosition = `${ESC}u`;\n/** @internal */\nexport const eraseLine = `${ESC}2K`;\n/** @internal */\nexport const beep = BEL;\n/** @internal */\nexport const black = `${ESC}30m`;\n/** @internal */\nexport const red = `${ESC}31m`;\n/** @internal */\nexport const green = `${ESC}32m`;\n/** @internal */\nexport const yellow = `${ESC}33m`;\n/** @internal */\nexport const blue = `${ESC}34m`;\n/** @internal */\nexport const magenta = `${ESC}35m`;\n/** @internal */\nexport const cyan = `${ESC}36m`;\n/** @internal */\nexport const white = `${ESC}37m`;\n/** @internal */\nexport const blackBright = `${ESC}90m`;\n/** @internal */\nexport const redBright = `${ESC}91m`;\n/** @internal */\nexport const greenBright = `${ESC}92m`;\n/** @internal */\nexport const yellowBright = `${ESC}93m`;\n/** @internal */\nexport const blueBright = `${ESC}94m`;\n/** @internal */\nexport const magentaBright = `${ESC}95m`;\n/** @internal */\nexport const cyanBright = `${ESC}96m`;\n/** @internal */\nexport const whiteBright = `${ESC}97m`;\nexport const annotate = (text, ...styles) => {\n const flat = styles.flat();\n return `${flat.join(\"\")}${text}${reset}`;\n};\nexport const combine = (...styles) => styles;\n/** @internal */\nexport const cursorTo = (column, row) => {\n if (row === undefined) {\n return `\\x1b${Math.max(column + 1, 0)} G`;\n }\n return `\\x1b${row + 1}${SEP}${Math.max(column + 1, 0)} H`;\n};\n/** @internal */\nexport const cursorDown = (lines = 1) => {\n return `${ESC}${lines}B`;\n};\n/** @internal */\nexport const cursorMove = (column, row = 0) => {\n let command = \"\";\n if (row < 0) {\n command += `${ESC}${-row}A`;\n }\n if (row > 0) {\n command += `${ESC}${row}B`;\n }\n if (column > 0) {\n command += `${ESC}${column}C`;\n }\n if (column < 0) {\n command += `${ESC}${-column}D`;\n }\n return command;\n};\n/** @internal */\nexport const eraseLines = rows => {\n let command = \"\";\n for (let i = 0; i < rows; i++) {\n command += `${ESC}2K` + (i < rows - 1 ? `${ESC}1A` : \"\");\n }\n if (rows > 0) {\n command += `${ESC}G`;\n }\n return command;\n};\n//# sourceMappingURL=ansi.js.map",
|
|
86
|
+
"/**\n * The `Prompt` module provides composable, effectful building blocks for\n * interactive command-line questions. A `Prompt<A>` describes terminal UI that\n * renders frames, reads keyboard input, validates responses, and eventually\n * produces a value of type `A`.\n *\n * **Common tasks**\n *\n * - Ask for text, password, hidden, list, confirm, toggle, number, or date input\n * - Let users choose from select, autocomplete, multi-select, and file prompts\n * - Combine prompts with {@link all}, {@link map}, and {@link flatMap}\n * - Build specialized prompts with {@link custom}\n * - Run a prompt against the current terminal with {@link run}\n *\n * **Gotchas**\n *\n * - Prompts require terminal services and may fail with `Terminal.QuitError`\n * when input ends or the prompt is quit\n * - Rendering is frame-based: custom prompts must return ANSI output from\n * `render` and matching ANSI clearing output from `clear`\n * - Choices and file lists are paged by `maxPerPage`, so keyboard navigation\n * and filtering should account for hidden off-page entries\n * - `password` and `hidden` return `Redacted` values; unwrap them only at the\n * boundary where the secret is needed\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Effectable from \"../../Effectable.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { dual, pipe } from \"../../Function.js\";\nimport * as EffectNumber from \"../../Number.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Queue from \"../../Queue.js\";\nimport * as Redacted from \"../../Redacted.js\";\nimport * as Terminal from \"../../Terminal.js\";\nimport * as Ansi from \"./internal/ansi.js\";\nconst TypeId = \"~effect/cli/Prompt\";\n/**\n * Returns `true` if the provided value is a `Prompt`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPrompt = u => Predicate.hasProperty(u, TypeId);\nconst defaultFigures = {\n arrowUp: \"↑\",\n arrowDown: \"↓\",\n arrowLeft: \"←\",\n arrowRight: \"→\",\n radioOn: \"◉\",\n radioOff: \"◯\",\n checkboxOn: \"☒\",\n checkboxOff: \"☐\",\n tick: \"✔\",\n cross: \"✖\",\n ellipsis: \"…\",\n pointerSmall: \"›\",\n line: \"─\",\n pointer: \"❯\"\n};\nconst windowsFigures = {\n arrowUp: defaultFigures.arrowUp,\n arrowDown: defaultFigures.arrowDown,\n arrowLeft: defaultFigures.arrowLeft,\n arrowRight: defaultFigures.arrowRight,\n radioOn: \"(*)\",\n radioOff: \"( )\",\n checkboxOn: \"[*]\",\n checkboxOff: \"[ ]\",\n tick: \"√\",\n cross: \"×\",\n ellipsis: \"...\",\n pointerSmall: \"»\",\n line: \"─\",\n pointer: \">\"\n};\n/** @internal */\nexport const platformFigures = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.sync(() => process.platform === \"win32\"), isWindows => isWindows ? windowsFigures : defaultFigures);\n/**\n * Runs all the provided prompts in sequence respecting the structure provided\n * in input.\n *\n * **Details**\n *\n * Supports either a tuple / iterable of prompts or a record / struct of prompts\n * as an argument.\n *\n * **Example** (Collecting prompt results)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Prompt } from \"effect/unstable/cli\"\n *\n * const username = Prompt.text({\n * message: \"Enter your username: \"\n * })\n *\n * const password = Prompt.password({\n * message: \"Enter your password: \",\n * validate: (value) =>\n * value.length === 0\n * ? Effect.fail(\"Password cannot be empty\")\n * : Effect.succeed(value)\n * })\n *\n * const allWithTuple = Prompt.all([username, password])\n *\n * const allWithRecord = Prompt.all({ username, password })\n * ```\n *\n * @category collecting & elements\n * @since 4.0.0\n */\nexport const all = function () {\n if (arguments.length === 1) {\n if (isPrompt(arguments[0])) {\n return map(arguments[0], x => [x]);\n } else if (Array.isArray(arguments[0])) {\n return allTupled(arguments[0]);\n } else {\n const entries = Object.entries(arguments[0]);\n let result = map(entries[0][1], value => ({\n [entries[0][0]]: value\n }));\n if (entries.length === 1) {\n return result;\n }\n const rest = entries.slice(1);\n for (const [key, prompt] of rest) {\n result = result.pipe(flatMap(record => prompt.pipe(map(value => ({\n ...record,\n [key]: value\n })))));\n }\n return result;\n }\n }\n return allTupled(arguments[0]);\n};\nconst annotateLine = line => Ansi.annotate(line, Ansi.bold);\nconst annotateErrorLine = line => Ansi.annotate(line, Ansi.combine(Ansi.italicized, Ansi.red));\n/**\n * Creates a confirmation prompt that asks the user to choose a boolean yes/no\n * value.\n *\n * **When to use**\n *\n * Use to ask for a yes/no answer that can be submitted directly.\n *\n * **Details**\n *\n * `initial` defaults to `false`. Enter submits the current default, yes-style\n * input submits `true`, no-style input submits `false`, and other input beeps.\n *\n * @see {@link toggle} for an interactive switch-before-submit boolean prompt\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const confirm = options => {\n const opts = {\n initial: false,\n ...options,\n label: {\n confirm: \"yes\",\n deny: \"no\",\n ...options.label\n },\n placeholder: {\n defaultConfirm: \"(Y/n)\",\n defaultDeny: \"(y/N)\",\n ...options.placeholder\n }\n };\n const initialState = {\n value: opts.initial\n };\n return custom(initialState, {\n render: handleConfirmRender(opts),\n process: input => handleConfirmProcess(input, opts.initial),\n clear: handleConfirmClear(opts)\n });\n};\n/**\n * Creates a custom `Prompt` from the specified initial state and handlers.\n *\n * **Details**\n *\n * The initial state can either be a pure value or an `Effect`. This is\n * particularly useful when the initial state of the `Prompt` must be computed\n * by performing an effectful computation, such as reading data from the file\n * system. A `Prompt` runs as a render loop: `render` returns ANSI output for\n * the current frame, the `Terminal` obtains user input, `process` returns the\n * next prompt action, and `clear` returns ANSI output used to clear the previous\n * frame.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const custom = (initialState, handlers) => {\n const op = Object.create(proto);\n op._tag = \"Loop\";\n op.initialState = initialState;\n op.render = handlers.render;\n op.process = handlers.process;\n op.clear = handlers.clear;\n return op;\n};\n/**\n * Creates a date prompt that lets the user edit a formatted date value and\n * validates the final `Date` before submission.\n *\n * **Details**\n *\n * `initial` defaults to the current `Date`, `dateMask` defaults to\n * `YYYY-MM-DD HH:mm:ss`, mask parsing creates editable date parts plus literal\n * tokens, `locales` customizes month and weekday labels, and `validate` runs on\n * submission.\n *\n * **Gotchas**\n *\n * A supplied `initial` `Date` is edited in place during prompt interaction.\n * Date edits use JavaScript `Date` setters, so out-of-range typed values can\n * normalize before validation. If the prompt is meant to be editable,\n * `dateMask` should contain at least one editable date token.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const date = options => {\n const opts = {\n initial: new Date(),\n dateMask: \"YYYY-MM-DD HH:mm:ss\",\n validate: Effect.succeed,\n ...options,\n locales: {\n ...defaultLocales,\n ...options.locales\n }\n };\n const dateParts = makeDateParts(opts.dateMask, opts.initial, opts.locales);\n const initialCursorPosition = dateParts.findIndex(part => !part.isToken());\n const initialState = {\n dateParts,\n typed: \"\",\n cursor: initialCursorPosition,\n value: opts.initial,\n error: Option.none()\n };\n return custom(initialState, {\n render: handleDateRender(opts),\n process: handleDateProcess(opts),\n clear: handleDateClear(opts)\n });\n};\n/**\n * Creates a file-system selection prompt and returns the selected path.\n *\n * **Details**\n *\n * The prompt can be configured to select files, directories, or either path\n * type.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (options = {}) => {\n const opts = {\n type: options.type ?? \"file\",\n message: options.message ?? `Choose a file`,\n startingPath: Option.fromUndefinedOr(options.startingPath),\n default: Option.fromUndefinedOr(options.default),\n maxPerPage: options.maxPerPage ?? 10,\n filter: options.filter ?? (() => Effect.succeed(true))\n };\n const initialState = Effect.gen(function* () {\n const currentPath = yield* resolveCurrentPath(Option.none(), opts);\n const path = yield* Path.Path;\n const defaultPath = Option.map(opts.default, defaultValue => path.resolve(currentPath, defaultValue));\n const initialPath = Option.match(defaultPath, {\n onNone: () => currentPath,\n onSome: defaultPath => path.dirname(defaultPath)\n });\n const files = yield* getFileList(initialPath, opts);\n const cursor = Option.match(defaultPath, {\n onNone: () => 0,\n onSome: defaultPath => {\n const index = files.indexOf(path.basename(defaultPath));\n return index === -1 ? 0 : index;\n }\n });\n const confirm = Confirm.Hide();\n return {\n cursor,\n files,\n allFiles: files,\n query: \"\",\n path: Option.map(defaultPath, path.dirname),\n confirm\n };\n });\n return custom(initialState, {\n render: handleFileRender(opts),\n process: handleFileProcess(opts),\n clear: handleFileClear(opts)\n });\n};\n/**\n * Composes prompts by using the output of this prompt to create the next prompt.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const flatMap = /*#__PURE__*/dual(2, (self, f) => {\n const op = Object.create(proto);\n op._tag = \"OnSuccess\";\n op.prompt = self;\n op.onSuccess = f;\n return op;\n});\n/**\n * Creates a floating-point number prompt.\n *\n * **Details**\n *\n * The prompt supports minimum and maximum bounds, keyboard step sizes, display\n * precision, and additional validation before submission.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const float = options => {\n const opts = {\n default: 0,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n incrementBy: 1,\n decrementBy: 1,\n precision: 2,\n validate: n => {\n if (n < opts.min) {\n return Effect.fail(`${n} must be greater than or equal to ${opts.min}`);\n }\n if (n > opts.max) {\n return Effect.fail(`${n} must be less than or equal to ${opts.max}`);\n }\n return Effect.succeed(n);\n },\n ...options\n };\n const initialValue = options.default === undefined ? \"\" : `${opts.default}`;\n const initialState = {\n cursor: initialValue.length,\n value: initialValue,\n error: Option.none()\n };\n return custom(initialState, {\n render: handleRenderFloat(opts),\n process: handleProcessFloat(opts),\n clear: handleNumberClear(opts)\n });\n};\n/**\n * Creates a text prompt that does not echo typed input and returns the\n * submitted value wrapped in `Redacted`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const hidden = options => basePrompt(options, \"hidden\").pipe(map(Redacted.make));\n/**\n * Creates an integer prompt.\n *\n * **Details**\n *\n * The prompt supports minimum and maximum bounds, keyboard step sizes, and\n * additional validation before submission.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const integer = options => {\n const opts = {\n default: 0,\n min: Number.NEGATIVE_INFINITY,\n max: Number.POSITIVE_INFINITY,\n incrementBy: 1,\n decrementBy: 1,\n validate: n => {\n if (n < opts.min) {\n return Effect.fail(`${n} must be greater than or equal to ${opts.min}`);\n }\n if (n > opts.max) {\n return Effect.fail(`${n} must be less than or equal to ${opts.max}`);\n }\n return Effect.succeed(n);\n },\n ...options\n };\n const initialValue = options.default === undefined ? \"\" : `${opts.default}`;\n const initialState = {\n cursor: initialValue.length,\n value: initialValue,\n error: Option.none()\n };\n return custom(initialState, {\n render: handleRenderInteger(opts),\n process: handleProcessInteger(opts),\n clear: handleNumberClear(opts)\n });\n};\n/**\n * Creates a text prompt that returns an array of strings by splitting the\n * submitted input on the configured delimiter.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const list = options => text(options).pipe(map(output => output.split(options.delimiter || \",\")));\n/**\n * Transforms the output value produced by a prompt.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => flatMap(self, a => succeed(f(a))));\n/**\n * Creates a password prompt that masks typed input and returns the submitted\n * value wrapped in `Redacted`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const password = options => basePrompt(options, \"password\").pipe(map(Redacted.make));\n/**\n * Runs a prompt by reading terminal input and rendering prompt frames until the\n * prompt submits a value.\n *\n * **Gotchas**\n *\n * The returned effect may fail with `Terminal.QuitError` if terminal input ends\n * or the prompt is quit.\n *\n * @category execution\n * @since 4.0.0\n */\nexport const run = /*#__PURE__*/Effect.fnUntraced(function* (self) {\n const terminal = yield* Terminal.Terminal;\n const input = yield* terminal.readInput;\n return yield* runWithInput(self, terminal, input);\n}, /*#__PURE__*/Effect.mapError(() => new Terminal.QuitError({})), Effect.scoped);\nconst getSelectInitialIndex = choices => {\n let initialIndex = 0;\n let seenSelected = -1;\n for (let i = 0; i < choices.length; i++) {\n const choice = choices[i];\n if (choice.selected === true) {\n if (seenSelected !== -1) {\n throw new Error(\"InvalidArgumentException: only a single choice can be selected by default for Prompt.select\");\n }\n seenSelected = i;\n }\n }\n if (seenSelected !== -1) {\n initialIndex = seenSelected;\n }\n return initialIndex;\n};\n/**\n * Creates a prompt that lets the user select a single value from a list of\n * choices.\n *\n * **Gotchas**\n *\n * At most one choice may be marked as selected by default.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const select = options => {\n const opts = {\n maxPerPage: 10,\n ...options\n };\n const initialIndex = getSelectInitialIndex(opts.choices);\n return custom(initialIndex, {\n render: handleSelectRender(opts),\n process: handleSelectProcess(opts),\n clear: handleSelectClear(opts)\n });\n};\n/**\n * Creates a prompt that lets users filter select choices by typing.\n *\n * **Example** (Filtering choices with autocomplete)\n *\n * ```ts\n * import { Prompt } from \"effect/unstable/cli\"\n *\n * const language = Prompt.autoComplete({\n * message: \"Choose a language\",\n * choices: [\n * { title: \"TypeScript\", value: \"ts\" },\n * { title: \"Rust\", value: \"rs\" },\n * { title: \"Kotlin\", value: \"kt\" }\n * ]\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const autoComplete = options => {\n const opts = {\n maxPerPage: 10,\n filterLabel: \"filter\",\n filterPlaceholder: \"type to filter\",\n emptyMessage: \"No matches\",\n ...options\n };\n const initialIndex = getSelectInitialIndex(opts.choices);\n const filtered = filterAutoCompleteChoices(opts.choices, \"\");\n const index = filtered.length === 0 ? 0 : filtered.includes(initialIndex) ? initialIndex : filtered[0];\n const initialState = {\n query: \"\",\n index,\n filtered\n };\n return custom(initialState, {\n render: handleAutoCompleteRender(opts),\n process: handleAutoCompleteProcess(opts),\n clear: handleAutoCompleteClear(opts)\n });\n};\n/**\n * Creates a prompt that lets the user select multiple choices and returns their\n * values as an array.\n *\n * **Details**\n *\n * The prompt supports default selected choices, bulk-selection commands, and\n * minimum or maximum selection counts.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const multiSelect = options => {\n const opts = {\n maxPerPage: 10,\n ...options\n };\n // Seed initial selection from choices marked as selected: true\n const initialSelected = new Set();\n for (let i = 0; i < opts.choices.length; i++) {\n const choice = opts.choices[i];\n if (choice.selected === true) {\n initialSelected.add(i);\n }\n }\n const initialState = {\n index: 0,\n selectedIndices: initialSelected,\n error: Option.none()\n };\n return custom(initialState, {\n render: handleMultiSelectRender(opts),\n process: handleMultiSelectProcess(opts),\n clear: handleMultiSelectClear(opts)\n });\n};\n/**\n * Creates a `Prompt` which immediately succeeds with the specified value.\n *\n * **Details**\n *\n * This prompt does not attempt to obtain user input or render anything to the\n * screen.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const succeed = value => {\n const op = Object.create(proto);\n op._tag = \"Succeed\";\n op.value = value;\n return op;\n};\n/**\n * Creates a text-entry prompt that echoes input and returns the submitted\n * string after validation.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = options => basePrompt(options, \"text\");\n/**\n * Creates a toggle prompt that lets the user switch between active and inactive\n * states and returns the selected boolean value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const toggle = options => {\n const opts = {\n initial: false,\n active: \"on\",\n inactive: \"off\",\n ...options\n };\n return custom(opts.initial, {\n render: handleToggleRender(opts),\n process: handleToggleProcess,\n clear: () => handleToggleClear(opts)\n });\n};\nconst proto = {\n ... /*#__PURE__*/Effectable.Prototype({\n label: \"Prompt\",\n evaluate() {\n return run(this);\n }\n }),\n [TypeId]: {\n _Output: _ => _\n }\n};\nconst allTupled = arg => {\n if (arg.length === 0) {\n return succeed([]);\n }\n if (arg.length === 1) {\n return map(arg[0], x => [x]);\n }\n let result = map(arg[0], x => [x]);\n for (let i = 1; i < arg.length; i++) {\n const curr = arg[i];\n result = flatMap(result, tuple => map(curr, a => [...tuple, a]));\n }\n return result;\n};\nconst runWithInput = (prompt, terminal, input) => Effect.suspend(() => {\n const op = prompt;\n switch (op._tag) {\n case \"Loop\":\n {\n return runLoop(op, terminal, input);\n }\n case \"OnSuccess\":\n {\n return Effect.flatMap(runWithInput(op.prompt, terminal, input), a => runWithInput(op.onSuccess(a), terminal, input));\n }\n case \"Succeed\":\n {\n return Effect.succeed(op.value);\n }\n }\n});\nconst runLoop = /*#__PURE__*/Effect.fnUntraced(function* (loop, terminal, input) {\n let state = Effect.isEffect(loop.initialState) ? yield* loop.initialState : loop.initialState;\n let action = Action.NextFrame({\n state\n });\n while (true) {\n const msg = yield* loop.render(state, action);\n yield* Effect.orDie(terminal.display(msg));\n const event = yield* Queue.take(input);\n action = yield* loop.process(event, state);\n switch (action._tag) {\n case \"Beep\":\n continue;\n case \"NextFrame\":\n {\n yield* Effect.orDie(terminal.display(yield* loop.clear(state, action)));\n state = action.state;\n continue;\n }\n case \"Submit\":\n {\n yield* Effect.orDie(terminal.display(yield* loop.clear(state, action)));\n const msg = yield* loop.render(state, action);\n yield* Effect.orDie(terminal.display(msg));\n return action.value;\n }\n }\n }\n}, (effect, _, terminal) => Effect.ensuring(effect, Effect.orDie(terminal.display(Ansi.cursorShow))));\nconst Action = /*#__PURE__*/Data.taggedEnum();\n/**\n * Clears all lines taken up by the specified `text`.\n */\nconst eraseText = (text, columns) => {\n if (columns === 0) {\n return Ansi.eraseLine + Ansi.cursorTo(0);\n }\n let rows = 0;\n const lines = text.split(NEWLINE_REGEXP);\n for (const line of lines) {\n rows += 1 + Math.floor(Math.max(line.length - 1, 0) / columns);\n }\n return Ansi.eraseLines(rows);\n};\nconst lines = (prompt, columns) => {\n const lines = prompt.split(NEWLINE_REGEXP);\n return columns === 0 ? lines.length : pipe(Arr.map(lines, line => Math.ceil(line.length / columns)), Arr.reduce(0, (left, right) => left + right));\n};\nconst clearOutputWithError = (outputText, columns, errorText) => {\n if (errorText !== undefined && errorText.length > 0) {\n return Ansi.cursorDown(lines(errorText, columns)) + eraseText(`\\n${errorText}`, columns) + eraseText(outputText, columns);\n }\n return eraseText(outputText, columns);\n};\nconst renderBeep = Ansi.beep;\nconst NEWLINE_REGEXP = /\\r?\\n/;\nconst handleConfirmClear = options => {\n return Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;\n const promptText = renderConfirmOutput(confirmMessage, \"?\", figures.pointerSmall, options, {\n plain: true\n });\n const clearOutput = eraseText(promptText, columns);\n const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;\n return clearOutput + resetCurrentLine;\n });\n};\nconst renderConfirmOutput = (confirm, leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, renderOptions);\nconst renderConfirmNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n // Marking these explicitly as present with `!` because they always will be\n // and there is really no value in adding a `DeepRequired` type helper just\n // for these internal cases\n const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;\n const confirm = Ansi.annotate(confirmMessage, Ansi.blackBright);\n const promptMsg = renderConfirmOutput(confirm, leadingSymbol, trailingSymbol, options);\n return Ansi.cursorHide + promptMsg;\n});\nconst renderConfirmSubmission = /*#__PURE__*/Effect.fnUntraced(function* (value, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const confirmMessage = value ? options.label.confirm : options.label.deny;\n const promptMsg = renderConfirmOutput(confirmMessage, leadingSymbol, trailingSymbol, options);\n return promptMsg + \"\\n\";\n});\nconst handleConfirmRender = options => {\n return (_, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderConfirmNextFrame(state, options),\n Submit: ({\n value\n }) => renderConfirmSubmission(value, options)\n });\n };\n};\nconst TRUE_VALUE_REGEXP = /^y|t$/;\nconst FALSE_VALUE_REGEXP = /^n|f$/;\nconst handleConfirmProcess = (input, defaultValue) => {\n const value = Option.getOrElse(input.input, () => \"\");\n if (input.key.name === \"enter\" || input.key.name === \"return\") {\n return Effect.succeed(Action.Submit({\n value: defaultValue\n }));\n }\n if (TRUE_VALUE_REGEXP.test(value.toLowerCase())) {\n return Effect.succeed(Action.Submit({\n value: true\n }));\n }\n if (FALSE_VALUE_REGEXP.test(value.toLowerCase())) {\n return Effect.succeed(Action.Submit({\n value: false\n }));\n }\n return Effect.succeed(Action.Beep());\n};\nconst handleDateClear = options => {\n return Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;\n const parts = Arr.reduce(state.dateParts, \"\", (doc, part) => doc + part.toString());\n const promptText = renderDateOutput(\"?\", figures.pointerSmall, parts, options, {\n plain: true\n });\n const errorText = Option.isSome(state.error) ? Arr.match(state.error.value.split(NEWLINE_REGEXP), {\n onEmpty: () => \"\",\n onNonEmpty: errorLines => `${figures.pointerSmall} ${errorLines.join(\"\\n\")}`\n }) : \"\";\n const clearOutput = clearOutputWithError(promptText, columns, errorText);\n return clearOutput + resetCurrentLine;\n });\n};\nconst renderDateError = (state, pointer) => {\n if (Option.isSome(state.error)) {\n const errorLines = state.error.value.split(NEWLINE_REGEXP);\n if (Arr.isReadonlyArrayNonEmpty(errorLines)) {\n const prefix = Ansi.annotate(pointer, Ansi.red) + \" \";\n const lines = Arr.map(errorLines, str => annotateErrorLine(str));\n return Ansi.cursorSavePosition + \"\\n\" + prefix + lines.join(\"\\n\") + Ansi.cursorRestorePosition;\n }\n }\n return \"\";\n};\nconst renderParts = (state, submitted = false) => {\n return Arr.reduce(state.dateParts, \"\", (doc, part, currentIndex) => {\n const partDoc = part.toString();\n if (currentIndex === state.cursor && !submitted) {\n const annotation = Ansi.combine(Ansi.underlined, Ansi.cyanBright);\n return doc + Ansi.annotate(partDoc, annotation);\n }\n return doc + partDoc;\n });\n};\nconst renderDateOutput = (leadingSymbol, trailingSymbol, parts, options, renderOptions) => renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, renderOptions);\nconst renderDateNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const parts = renderParts(state);\n const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options);\n const errorMsg = renderDateError(state, figures.pointerSmall);\n return Ansi.cursorHide + promptMsg + errorMsg;\n});\nconst renderDateSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const parts = renderParts(state, true);\n const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options);\n return promptMsg + \"\\n\";\n});\nconst processUp = state => {\n state.dateParts[state.cursor].increment();\n return Action.NextFrame({\n state: {\n ...state,\n typed: \"\"\n }\n });\n};\nconst processDown = state => {\n state.dateParts[state.cursor].decrement();\n return Action.NextFrame({\n state: {\n ...state,\n typed: \"\"\n }\n });\n};\nconst processDateCursorLeft = state => {\n const previous = state.dateParts[state.cursor].previousPart();\n if (Option.isSome(previous)) {\n return Action.NextFrame({\n state: {\n ...state,\n typed: \"\",\n cursor: state.dateParts.indexOf(previous.value)\n }\n });\n }\n return Action.Beep();\n};\nconst processDateCursorRight = state => {\n const next = state.dateParts[state.cursor].nextPart();\n if (Option.isSome(next)) {\n return Action.NextFrame({\n state: {\n ...state,\n typed: \"\",\n cursor: state.dateParts.indexOf(next.value)\n }\n });\n }\n return Action.Beep();\n};\nconst processDateNext = state => {\n const next = state.dateParts[state.cursor].nextPart();\n const cursor = Option.match(next, {\n onNone: () => state.dateParts.findIndex(part => !part.isToken()),\n onSome: next => state.dateParts.indexOf(next)\n });\n return Action.NextFrame({\n state: {\n ...state,\n cursor\n }\n });\n};\nconst defaultDateProcessor = (value, state) => {\n if (/\\d/.test(value)) {\n const typed = state.typed + value;\n state.dateParts[state.cursor].setValue(typed);\n return Action.NextFrame({\n state: {\n ...state,\n typed\n }\n });\n }\n return Action.Beep();\n};\nconst defaultLocales = {\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n weekdays: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n weekdaysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"]\n};\nconst handleDateRender = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderDateNextFrame(state, options),\n Submit: () => renderDateSubmission(state, options)\n });\n };\n};\nconst handleDateProcess = options => {\n return (input, state) => {\n switch (input.key.name) {\n case \"left\":\n {\n return Effect.succeed(processDateCursorLeft(state));\n }\n case \"right\":\n {\n return Effect.succeed(processDateCursorRight(state));\n }\n case \"k\":\n case \"up\":\n {\n return Effect.succeed(processUp(state));\n }\n case \"j\":\n case \"down\":\n {\n return Effect.succeed(processDown(state));\n }\n case \"tab\":\n {\n return Effect.succeed(processDateNext(state));\n }\n case \"enter\":\n case \"return\":\n {\n return Effect.match(options.validate(state.value), {\n onFailure: error => Action.NextFrame({\n state: {\n ...state,\n error: Option.some(error)\n }\n }),\n onSuccess: value => Action.Submit({\n value\n })\n });\n }\n default:\n {\n return Effect.succeed(defaultDateProcessor(Option.getOrElse(input.input, () => \"\"), state));\n }\n }\n };\n};\nconst DATE_PART_REGEXP = /\\\\(.)|\"((?:\\\\[\"\\\\]|[^\"])+)\"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;\nconst regExpGroups = {\n 1: ({\n token,\n ...opts\n }) => new Token({\n token: token.replace(/\\\\(.)/g, \"$1\"),\n ...opts\n }),\n 2: opts => new Day(opts),\n 3: opts => new Month(opts),\n 4: opts => new Year(opts),\n 5: opts => new Meridiem(opts),\n 6: opts => new Hours(opts),\n 7: opts => new Minutes(opts),\n 8: opts => new Seconds(opts),\n 9: opts => new Milliseconds(opts)\n};\nconst makeDateParts = (dateMask, date, locales) => {\n const parts = [];\n let result = null;\n // oxlint-disable-next-line no-cond-assign\n while (result = DATE_PART_REGEXP.exec(dateMask)) {\n const match = result.shift();\n const index = result.findIndex(group => group !== undefined);\n if (index in regExpGroups) {\n const token = result[index] || match;\n parts.push(regExpGroups[index]({\n token,\n date,\n parts,\n locales\n }));\n } else {\n parts.push(new Token({\n token: result[index] || match,\n date,\n parts,\n locales\n }));\n }\n }\n const orderedParts = parts.reduce((array, element) => {\n const lastElement = array[array.length - 1];\n if (element.isToken() && lastElement !== undefined && lastElement.isToken()) {\n lastElement.setValue(element.token);\n } else {\n array.push(element);\n }\n return array;\n }, Arr.empty());\n parts.splice(0, parts.length, ...orderedParts);\n return parts;\n};\nclass DatePart {\n token;\n date;\n parts;\n locales;\n constructor(params) {\n this.token = params.token;\n this.locales = params.locales;\n this.date = params.date || new Date();\n this.parts = params.parts || [this];\n }\n /**\n * Returns `true` if this `DatePart` is a `Token`, `false` otherwise.\n */\n isToken() {\n return false;\n }\n /**\n * Retrieves the next date part in the list of parts.\n */\n nextPart() {\n const currentPartIndex = Option.getOrElse(Arr.findFirstIndex(this.parts, part => part === this), () => 0);\n return Arr.findFirst(this.parts.slice(currentPartIndex + 1), part => !part.isToken());\n }\n /**\n * Retrieves the previous date part in the list of parts.\n */\n previousPart() {\n const currentPartIndex = Arr.findFirstIndex(this.parts, part => part === this);\n if (Option.isSome(currentPartIndex)) {\n return Arr.findLast(this.parts.slice(0, currentPartIndex.value), part => !part.isToken());\n }\n return Option.none();\n }\n toString() {\n return String(this.date);\n }\n}\nclass Token extends DatePart {\n increment() {}\n decrement() {}\n setValue(value) {\n this.token = this.token + value;\n }\n isToken() {\n return true;\n }\n toString() {\n return this.token;\n }\n}\nclass Milliseconds extends DatePart {\n increment() {\n this.date.setMilliseconds(this.date.getMilliseconds() + 1);\n }\n decrement() {\n this.date.setMilliseconds(this.date.getMilliseconds() - 1);\n }\n setValue(value) {\n this.date.setMilliseconds(Number.parseInt(value.slice(-this.token.length)));\n }\n toString() {\n const millis = `${this.date.getMilliseconds()}`;\n return millis.padStart(4, \"0\").substring(0, this.token.length);\n }\n}\nclass Seconds extends DatePart {\n increment() {\n this.date.setSeconds(this.date.getSeconds() + 1);\n }\n decrement() {\n this.date.setSeconds(this.date.getSeconds() - 1);\n }\n setValue(value) {\n this.date.setSeconds(Number.parseInt(value.slice(-2)));\n }\n toString() {\n const seconds = `${this.date.getSeconds()}`;\n return this.token.length > 1 ? seconds.padStart(2, \"0\") : seconds;\n }\n}\nclass Minutes extends DatePart {\n increment() {\n this.date.setMinutes(this.date.getMinutes() + 1);\n }\n decrement() {\n this.date.setMinutes(this.date.getMinutes() - 1);\n }\n setValue(value) {\n this.date.setMinutes(Number.parseInt(value.slice(-2)));\n }\n toString() {\n const minutes = `${this.date.getMinutes()}`;\n return this.token.length > 1 ? minutes.padStart(2, \"0\") : minutes;\n }\n}\nclass Hours extends DatePart {\n increment() {\n this.date.setHours(this.date.getHours() + 1);\n }\n decrement() {\n this.date.setHours(this.date.getHours() - 1);\n }\n setValue(value) {\n this.date.setHours(Number.parseInt(value.slice(-2)));\n }\n toString() {\n const hours = /h/.test(this.token) ? this.date.getHours() % 12 || 12 : this.date.getHours();\n return this.token.length > 1 ? `${hours}`.padStart(2, \"0\") : `${hours}`;\n }\n}\nclass Day extends DatePart {\n increment() {\n this.date.setDate(this.date.getDate() + 1);\n }\n decrement() {\n this.date.setDate(this.date.getDate() - 1);\n }\n setValue(value) {\n this.date.setDate(Number.parseInt(value.slice(-2)));\n }\n toString() {\n const date = this.date.getDate();\n const day = this.date.getDay();\n switch (this.token) {\n case \"DD\":\n return `${date}`.padStart(2, \"0\");\n case \"Do\":\n return `${date}${this.ordinalIndicator(date)}`;\n case \"d\":\n return `${day + 1}`;\n case \"ddd\":\n return this.locales.weekdaysShort[day];\n case \"dddd\":\n return this.locales.weekdays[day];\n default:\n return `${date}`;\n }\n }\n ordinalIndicator(day) {\n switch (day % 10) {\n case 1:\n return \"st\";\n case 2:\n return \"nd\";\n case 3:\n return \"rd\";\n default:\n return \"th\";\n }\n }\n}\nclass Month extends DatePart {\n increment() {\n this.date.setMonth(this.date.getMonth() + 1);\n }\n decrement() {\n this.date.setMonth(this.date.getMonth() - 1);\n }\n setValue(value) {\n const month = Number.parseInt(value.slice(-2)) - 1;\n this.date.setMonth(month < 0 ? 0 : month);\n }\n toString() {\n const month = this.date.getMonth();\n switch (this.token.length) {\n case 2:\n return `${month + 1}`.padStart(2, \"0\");\n case 3:\n return this.locales.monthsShort[month];\n case 4:\n return this.locales.months[month];\n default:\n return `${month + 1}`;\n }\n }\n}\nclass Year extends DatePart {\n increment() {\n this.date.setFullYear(this.date.getFullYear() + 1);\n }\n decrement() {\n this.date.setFullYear(this.date.getFullYear() - 1);\n }\n setValue(value) {\n this.date.setFullYear(Number.parseInt(value.slice(-4)));\n }\n toString() {\n const year = `${this.date.getFullYear()}`.padStart(4, \"0\");\n return this.token.length === 2 ? year.substring(-2) : year;\n }\n}\nclass Meridiem extends DatePart {\n increment() {\n this.date.setHours((this.date.getHours() + 12) % 24);\n }\n decrement() {\n this.increment();\n }\n setValue(_value) {}\n toString() {\n const meridiem = this.date.getHours() > 12 ? \"pm\" : \"am\";\n return /A/.test(this.token) ? meridiem.toUpperCase() : meridiem;\n }\n}\nconst CONFIRM_MESSAGE = \"The selected directory contains files. Would you like to traverse the selected directory?\";\nconst FILE_FILTER_LABEL = \"filter\";\nconst FILE_FILTER_PLACEHOLDER = \"type to filter\";\nconst FILE_EMPTY_MESSAGE = \"No matches\";\nconst Confirm = /*#__PURE__*/Data.taggedEnum();\nconst showConfirmation = /*#__PURE__*/Confirm.$is(\"Show\");\nconst resolveCurrentPath = (path, options) => {\n if (Option.isSome(path)) {\n return Effect.succeed(path.value);\n }\n if (Option.isSome(options.startingPath)) {\n const startingPath = options.startingPath.value;\n return Effect.flatMap(FileSystem.FileSystem, fs =>\n // Ensure the user provided starting path exists\n Effect.orDie(fs.exists(startingPath)).pipe(Effect.flatMap(exists => exists ? Effect.void : Effect.die(`The provided starting path '${startingPath}' does not exist`)), Effect.as(startingPath)));\n }\n return Effect.sync(() => process.cwd());\n};\nconst getFileList = /*#__PURE__*/Effect.fnUntraced(function* (directory, options) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const files = yield* Effect.orDie(fs.readDirectory(directory)).pipe(\n // Always prepend the `\"..\"` option to the file list but allow it\n // to be filtered out if the user so desires\n Effect.map(files => [\"..\", ...files]));\n return yield* Effect.filter(files, file => {\n const result = options.filter(file);\n const userDefinedFilter = Effect.isEffect(result) ? result : Effect.succeed(result);\n const directoryFilter = options.type === \"directory\" ? Effect.map(Effect.orDie(fs.stat(path.join(directory, file))), info => info.type === \"Directory\") : Effect.succeed(true);\n return Effect.zipWith(userDefinedFilter, directoryFilter, (a, b) => a && b);\n }, {\n concurrency: files.length\n });\n});\nconst filterFiles = (files, query) => {\n if (query.length === 0) {\n return files;\n }\n const normalizedQuery = query.toLowerCase();\n const filtered = [];\n for (let index = 0; index < files.length; index++) {\n if (files[index].toLowerCase().includes(normalizedQuery)) {\n filtered.push(files[index]);\n }\n }\n return filtered;\n};\nconst updateFileState = (state, query, allFiles = state.allFiles) => {\n const files = filterFiles(allFiles, query);\n if (files.length === 0) {\n return {\n ...state,\n query,\n allFiles,\n files,\n cursor: 0\n };\n }\n const selected = state.files[state.cursor];\n const cursor = selected === undefined ? 0 : files.indexOf(selected);\n return {\n ...state,\n query,\n allFiles,\n files,\n cursor: cursor === -1 ? 0 : cursor\n };\n};\nconst handleFileClear = options => {\n return Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const path = yield* Path.Path;\n const figures = yield* platformFigures;\n const currentPath = yield* resolveCurrentPath(state.path, options);\n const selectedPath = state.files[state.cursor];\n const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath);\n const resolvedPathText = `${figures.pointerSmall} ${resolvedPath}`;\n const isConfirming = showConfirmation(state.confirm);\n const promptText = isConfirming ? renderPrompt(\"(Y/n)\", CONFIRM_MESSAGE, \"?\", figures.pointerSmall, {\n plain: true\n }) : renderPrompt(renderFileFilter(state, {\n plain: true\n }), options.message, figures.tick, figures.ellipsis, {\n plain: true\n });\n const filesText = isConfirming ? \"\" : renderFiles(state, state.files, figures, options, {\n plain: true\n });\n const outputText = isConfirming ? `${promptText}\\n${resolvedPathText}` : `${promptText}\\n${resolvedPathText}\\n${filesText}`;\n const clearOutput = eraseText(outputText, columns);\n const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;\n return clearOutput + resetCurrentLine;\n });\n};\nconst renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options) => {\n const prefix = leadingSymbol + \" \";\n const annotate = options?.plain === true ? line => line : annotateLine;\n return Arr.match(message.split(NEWLINE_REGEXP), {\n onEmpty: () => prefix + \" \" + trailingSymbol + \" \" + confirm,\n onNonEmpty: promptLines => {\n const lines = Arr.map(promptLines, line => annotate(line));\n return prefix + lines.join(\"\\n\") + \" \" + trailingSymbol + \" \" + confirm;\n }\n });\n};\nconst renderPrefix = (state, toDisplay, currentIndex, length, figures, renderOptions) => {\n let prefix = \" \";\n if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {\n prefix = figures.arrowUp;\n } else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length) {\n prefix = figures.arrowDown;\n }\n if (state.cursor === currentIndex) {\n return renderOptions?.plain === true ? figures.pointer + prefix : Ansi.annotate(figures.pointer, Ansi.cyanBright) + prefix;\n }\n return prefix + \" \";\n};\nconst renderFileName = (file, isSelected, renderOptions) => {\n if (renderOptions?.plain === true) {\n return file;\n }\n return isSelected ? Ansi.annotate(file, Ansi.combine(Ansi.underlined, Ansi.cyanBright)) : file;\n};\nconst renderFileFilter = (state, renderOptions) => {\n const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? FILE_FILTER_PLACEHOLDER : Ansi.annotate(FILE_FILTER_PLACEHOLDER, Ansi.blackBright) : renderOptions?.plain === true ? state.query : Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, Ansi.cyanBright));\n return `[${FILE_FILTER_LABEL}: ${filterValue}]`;\n};\nconst renderFiles = (state, files, figures, options, renderOptions) => {\n const length = files.length;\n if (length === 0) {\n return renderOptions?.plain === true ? FILE_EMPTY_MESSAGE : Ansi.annotate(FILE_EMPTY_MESSAGE, Ansi.blackBright);\n }\n const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage);\n const documents = [];\n for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {\n const isSelected = state.cursor === index;\n const prefix = renderPrefix(state, toDisplay, index, length, figures, renderOptions);\n const fileName = renderFileName(files[index], isSelected, renderOptions);\n documents.push(prefix + fileName);\n }\n return documents.join(\"\\n\");\n};\nconst renderFileNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const path = yield* Path.Path;\n const figures = yield* platformFigures;\n const currentPath = yield* resolveCurrentPath(state.path, options);\n const selectedPath = state.files[state.cursor];\n const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath);\n const resolvedPathMsg = Ansi.annotate(figures.pointerSmall + \" \" + resolvedPath, Ansi.blackBright);\n if (showConfirmation(state.confirm)) {\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const confirm = Ansi.annotate(\"(Y/n)\", Ansi.blackBright);\n const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol);\n return Ansi.cursorHide + promptMsg + \"\\n\" + resolvedPathMsg;\n }\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderPrompt(renderFileFilter(state), options.message, leadingSymbol, trailingSymbol);\n const files = renderFiles(state, state.files, figures, options);\n return Ansi.cursorHide + promptMsg + \"\\n\" + resolvedPathMsg + \"\\n\" + files;\n});\nconst renderFileSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, value, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderPrompt(renderFileFilter(state), options.message, leadingSymbol, trailingSymbol);\n return promptMsg + \" \" + Ansi.annotate(value, Ansi.white) + \"\\n\";\n});\nconst handleFileRender = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderFileNextFrame(state, options),\n Submit: ({\n value\n }) => renderFileSubmission(state, value, options)\n });\n };\n};\nconst processFileCursorUp = state => {\n if (state.files.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const cursor = state.cursor - 1;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor: cursor < 0 ? state.files.length - 1 : cursor\n }\n }));\n};\nconst processFileCursorDown = state => {\n if (state.files.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor: (state.cursor + 1) % state.files.length\n }\n }));\n};\nconst processFileBackspace = state => {\n if (state.query.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const query = state.query.slice(0, state.query.length - 1);\n return Effect.succeed(Action.NextFrame({\n state: updateFileState(state, query)\n }));\n};\nconst processFileClear = state => Effect.succeed(Action.NextFrame({\n state: updateFileState(state, \"\")\n}));\nconst processFileInput = (input, state) => {\n if (input.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const query = state.query + input;\n return Effect.succeed(Action.NextFrame({\n state: updateFileState(state, query)\n }));\n};\nconst processSelection = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n if (state.files.length === 0) {\n return Action.Beep();\n }\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const currentPath = yield* resolveCurrentPath(state.path, options);\n const selectedPath = state.files[state.cursor];\n const resolvedPath = path.resolve(currentPath, selectedPath);\n const info = yield* Effect.orDie(fs.stat(resolvedPath));\n if (info.type === \"Directory\") {\n const files = yield* getFileList(resolvedPath, options);\n const filesWithoutParent = files.filter(file => file !== \"..\");\n // If the user selected a directory AND the prompt type can result with\n // a directory, we must confirm:\n // - If the selected directory has any files\n // - Confirm whether or not the user wants to traverse those files\n if (options.type === \"directory\" || options.type === \"either\") {\n return filesWithoutParent.length === 0\n // Directory is empty so it's safe to select it\n ? Action.Submit({\n value: resolvedPath\n })\n // Directory has contents - show confirmation to user\n : Action.NextFrame({\n state: {\n ...state,\n confirm: Confirm.Show()\n }\n });\n }\n return Action.NextFrame({\n state: {\n cursor: 0,\n files,\n allFiles: files,\n query: \"\",\n path: Option.some(resolvedPath),\n confirm: Confirm.Hide()\n }\n });\n }\n return Action.Submit({\n value: resolvedPath\n });\n});\nconst handleFileProcess = options => {\n return Effect.fnUntraced(function* (input, state) {\n if (input.key.ctrl) {\n if (input.key.name === \"u\") {\n if (showConfirmation(state.confirm)) {\n return Action.Beep();\n }\n return yield* processFileClear(state);\n }\n return Action.Beep();\n }\n switch (input.key.name) {\n case \"k\":\n case \"up\":\n {\n return yield* processFileCursorUp(state);\n }\n case \"j\":\n case \"down\":\n case \"tab\":\n {\n return yield* processFileCursorDown(state);\n }\n case \"backspace\":\n {\n if (showConfirmation(state.confirm)) {\n return Action.Beep();\n }\n return yield* processFileBackspace(state);\n }\n case \"enter\":\n case \"return\":\n {\n return yield* processSelection(state, options);\n }\n case \"y\":\n case \"t\":\n {\n if (showConfirmation(state.confirm)) {\n const path = yield* Path.Path;\n const currentPath = yield* resolveCurrentPath(state.path, options);\n const selectedPath = state.files[state.cursor];\n const resolvedPath = path.resolve(currentPath, selectedPath);\n const files = yield* getFileList(resolvedPath, options);\n return Action.NextFrame({\n state: {\n cursor: 0,\n files,\n allFiles: files,\n query: \"\",\n path: Option.some(resolvedPath),\n confirm: Confirm.Hide()\n }\n });\n }\n return yield* processFileInput(Option.getOrElse(input.input, () => \"\"), state);\n }\n case \"n\":\n case \"f\":\n {\n if (showConfirmation(state.confirm)) {\n const path = yield* Path.Path;\n const currentPath = yield* resolveCurrentPath(state.path, options);\n const selectedPath = state.files[state.cursor];\n const resolvedPath = path.resolve(currentPath, selectedPath);\n return Action.Submit({\n value: resolvedPath\n });\n }\n return yield* processFileInput(Option.getOrElse(input.input, () => \"\"), state);\n }\n default:\n {\n if (showConfirmation(state.confirm)) {\n return Action.Beep();\n }\n return yield* processFileInput(Option.getOrElse(input.input, () => \"\"), state);\n }\n }\n });\n};\nconst renderMultiSelectError = (state, pointer, renderOptions) => {\n if (Option.isSome(state.error)) {\n return Arr.match(state.error.value.split(NEWLINE_REGEXP), {\n onEmpty: () => \"\",\n onNonEmpty: errorLines => {\n if (renderOptions?.plain === true) {\n return `${pointer} ${errorLines.join(\"\\n\")}`;\n }\n const prefix = Ansi.annotate(pointer, Ansi.red) + \" \";\n const lines = Arr.map(errorLines, str => annotateErrorLine(str));\n return Ansi.cursorSavePosition + \"\\n\" + prefix + lines.join(\"\\n\") + Ansi.cursorRestorePosition;\n }\n });\n }\n return \"\";\n};\nconst renderChoiceDescription = (choice, isActive, renderOptions) => {\n if (!choice.disabled && choice.description && isActive) {\n return renderOptions?.plain === true ? \"- \" + choice.description : Ansi.annotate(\"- \" + choice.description, Ansi.blackBright);\n }\n return \"\";\n};\nconst metaOptionsCount = 2;\nconst renderMultiSelectTitle = (title, isHighlighted, renderOptions) => {\n if (renderOptions?.plain === true || !isHighlighted) {\n return title;\n }\n return Ansi.annotate(title, Ansi.combine(Ansi.underlined, Ansi.cyanBright));\n};\nconst renderMultiSelectChoices = (state, options, figures, renderOptions) => {\n const choices = options.choices;\n const totalChoices = choices.length;\n const selectedCount = state.selectedIndices.size;\n const allSelected = selectedCount === totalChoices;\n const selectAllText = allSelected ? options?.selectNone ?? \"Select None\" : options?.selectAll ?? \"Select All\";\n const inverseSelectionText = options?.inverseSelection ?? \"Inverse Selection\";\n const metaOptions = [{\n title: selectAllText\n }, {\n title: inverseSelectionText\n }];\n const allChoices = [...metaOptions, ...choices];\n const toDisplay = entriesToDisplay(state.index, allChoices.length, options.maxPerPage);\n const documents = [];\n for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {\n const choice = allChoices[index];\n const isHighlighted = state.index === index;\n let prefix = \" \";\n if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {\n prefix = figures.arrowUp;\n } else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < allChoices.length) {\n prefix = figures.arrowDown;\n }\n if (index < metaOptions.length) {\n // Meta options\n const title = renderMultiSelectTitle(choice.title, isHighlighted, renderOptions);\n documents.push(prefix + \" \" + title);\n } else {\n // Regular choices\n const choiceIndex = index - metaOptions.length;\n const isSelected = state.selectedIndices.has(choiceIndex);\n const checkbox = isSelected ? figures.checkboxOn : figures.checkboxOff;\n const annotatedCheckbox = isHighlighted && renderOptions?.plain !== true ? Ansi.annotate(checkbox, Ansi.cyanBright) : checkbox;\n const title = renderMultiSelectTitle(choice.title, isHighlighted, renderOptions);\n const description = renderChoiceDescription(choice, isHighlighted, renderOptions);\n documents.push(prefix + \" \" + annotatedCheckbox + \" \" + title + \" \" + description);\n }\n }\n return documents.join(\"\\n\");\n};\nconst renderMultiSelectNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const choices = renderMultiSelectChoices(state, options, figures);\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);\n const error = renderMultiSelectError(state, figures.pointer);\n return Ansi.cursorHide + promptMsg + \"\\n\" + choices + error;\n});\nconst renderMultiSelectSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const selectedChoices = Array.from(state.selectedIndices).sort(EffectNumber.Order).map(index => options.choices[index].title);\n const selectedText = selectedChoices.join(\", \");\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);\n return promptMsg + \" \" + Ansi.annotate(selectedText, Ansi.white) + \"\\n\";\n});\nconst processMultiSelectCursorUp = (state, totalChoices) => {\n const newIndex = state.index === 0 ? totalChoices - 1 : state.index - 1;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n index: newIndex\n }\n }));\n};\nconst processMultiSelectCursorDown = (state, totalChoices) => {\n const newIndex = (state.index + 1) % totalChoices;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n index: newIndex\n }\n }));\n};\nconst processSpace = (state, options) => {\n const selectedIndices = new Set(state.selectedIndices);\n if (state.index === 0) {\n if (state.selectedIndices.size === options.choices.length) {\n selectedIndices.clear();\n } else {\n for (let i = 0; i < options.choices.length; i++) {\n selectedIndices.add(i);\n }\n }\n } else if (state.index === 1) {\n for (let i = 0; i < options.choices.length; i++) {\n if (state.selectedIndices.has(i)) {\n selectedIndices.delete(i);\n } else {\n selectedIndices.add(i);\n }\n }\n } else {\n const choiceIndex = state.index - metaOptionsCount;\n if (selectedIndices.has(choiceIndex)) {\n selectedIndices.delete(choiceIndex);\n } else {\n selectedIndices.add(choiceIndex);\n }\n }\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n selectedIndices\n }\n }));\n};\nconst handleMultiSelectClear = options => Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;\n const promptText = renderSelectOutput(\"?\", figures.pointerSmall, options, {\n plain: true\n });\n const choicesText = renderMultiSelectChoices(state, options, figures, {\n plain: true\n });\n const errorText = renderMultiSelectError(state, figures.pointer, {\n plain: true\n });\n const clearOutput = clearOutputWithError(`${promptText}\\n${choicesText}`, columns, errorText);\n return clearOutput + clearPrompt;\n});\nconst handleMultiSelectProcess = options => {\n return (input, state) => {\n const totalChoices = options.choices.length + metaOptionsCount;\n switch (input.key.name) {\n case \"k\":\n case \"up\":\n {\n return processMultiSelectCursorUp({\n ...state,\n error: Option.none()\n }, totalChoices);\n }\n case \"j\":\n case \"down\":\n case \"tab\":\n {\n return processMultiSelectCursorDown({\n ...state,\n error: Option.none()\n }, totalChoices);\n }\n case \"space\":\n {\n return processSpace(state, options);\n }\n case \"enter\":\n case \"return\":\n {\n const selectedCount = state.selectedIndices.size;\n if (options.min !== undefined && selectedCount < options.min) {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n error: Option.some(`At least ${options.min} are required`)\n }\n }));\n }\n if (options.max !== undefined && selectedCount > options.max) {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n error: Option.some(`At most ${options.max} choices are allowed`)\n }\n }));\n }\n const selectedValues = Array.from(state.selectedIndices).sort(EffectNumber.Order).map(index => options.choices[index].value);\n return Effect.succeed(Action.Submit({\n value: selectedValues\n }));\n }\n default:\n {\n return Effect.succeed(Action.Beep());\n }\n }\n };\n};\nconst handleMultiSelectRender = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderMultiSelectNextFrame(state, options),\n Submit: () => renderMultiSelectSubmission(state, options)\n });\n };\n};\nconst handleNumberClear = options => {\n return Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;\n const errorText = renderNumberError(state, figures.pointerSmall, {\n plain: true\n });\n const promptText = renderNumberOutput(state, \"?\", figures.pointerSmall, options, {\n plain: true\n });\n const clearOutput = clearOutputWithError(promptText, columns, errorText);\n return clearOutput + resetCurrentLine;\n });\n};\nconst renderNumberInput = (state, submitted, renderOptions) => {\n const value = state.value === \"\" ? \"\" : `${state.value}`;\n if (submitted || renderOptions?.plain === true) {\n return value;\n }\n const annotation = Option.isSome(state.error) ? Ansi.red : Ansi.combine(Ansi.underlined, Ansi.cyanBright);\n return Ansi.annotate(value, annotation);\n};\nconst renderNumberError = (state, pointer, renderOptions) => {\n if (Option.isSome(state.error)) {\n return Arr.match(state.error.value.split(NEWLINE_REGEXP), {\n onEmpty: () => \"\",\n onNonEmpty: errorLines => {\n if (renderOptions?.plain === true) {\n return `${pointer} ${errorLines.join(\"\\n\")}`;\n }\n const prefix = Ansi.annotate(pointer, Ansi.red) + \" \";\n const lines = Arr.map(errorLines, str => annotateErrorLine(str));\n return Ansi.cursorSavePosition + \"\\n\" + prefix + lines.join(\"\\n\") + Ansi.cursorRestorePosition;\n }\n });\n }\n return \"\";\n};\nconst renderNumberOutput = (state, leadingSymbol, trailingSymbol, options, renderOptions, submitted = false) => {\n const value = renderNumberInput(state, submitted, renderOptions);\n return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);\n};\nconst renderNumberNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const errorMsg = renderNumberError(state, figures.pointerSmall);\n const promptMsg = renderNumberOutput(state, leadingSymbol, trailingSymbol, options);\n return promptMsg + errorMsg;\n});\nconst renderNumberSubmission = /*#__PURE__*/Effect.fnUntraced(function* (nextState, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, undefined, true);\n return promptMsg + \"\\n\";\n});\nconst processNumberBackspace = state => {\n if (state.value.length <= 0) {\n return Effect.succeed(Action.Beep());\n }\n const value = state.value.slice(0, state.value.length - 1);\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value,\n error: Option.none()\n }\n }));\n};\nconst processNumberClear = state => Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor: 0,\n value: \"\",\n error: Option.none()\n }\n}));\nconst defaultIntProcessor = (input, state) => {\n if (state.value.length === 0 && input === \"-\") {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: \"-\",\n error: Option.none()\n }\n }));\n }\n const parsed = Number.parseInt(state.value + input);\n if (Number.isNaN(parsed)) {\n return Effect.succeed(Action.Beep());\n } else {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: `${parsed}`,\n error: Option.none()\n }\n }));\n }\n};\nconst defaultFloatProcessor = (input, state) => {\n if (input === \".\" && state.value.includes(\".\")) {\n return Effect.succeed(Action.Beep());\n }\n if (state.value.length === 0 && input === \"-\") {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: \"-\",\n error: Option.none()\n }\n }));\n }\n const parsed = Number.parseFloat(state.value + input);\n if (Number.isNaN(parsed)) {\n return Effect.succeed(Action.Beep());\n } else {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: input === \".\" ? `${parsed}.` : `${parsed}`,\n error: Option.none()\n }\n }));\n }\n};\nconst handleRenderInteger = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderNumberNextFrame(state, options),\n Submit: () => renderNumberSubmission(state, options)\n });\n };\n};\nconst handleProcessInteger = options => {\n return (input, state) => {\n if (input.key.ctrl && input.key.name === \"u\") {\n return processNumberClear(state);\n }\n switch (input.key.name) {\n case \"backspace\":\n {\n return processNumberBackspace(state);\n }\n case \"k\":\n case \"up\":\n {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: state.value === \"\" || state.value === \"-\" ? `${options.incrementBy}` : `${Number.parseInt(state.value) + options.incrementBy}`,\n error: Option.none()\n }\n }));\n }\n case \"j\":\n case \"down\":\n {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: state.value === \"\" || state.value === \"-\" ? `-${options.decrementBy}` : `${Number.parseInt(state.value) - options.decrementBy}`,\n error: Option.none()\n }\n }));\n }\n case \"enter\":\n case \"return\":\n {\n const parsed = Number.parseInt(state.value);\n if (Number.isNaN(parsed)) {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n error: Option.some(\"Must provide an integer value\")\n }\n }));\n } else {\n return Effect.match(options.validate(parsed), {\n onFailure: error => Action.NextFrame({\n state: {\n ...state,\n error: Option.some(error)\n }\n }),\n onSuccess: value => Action.Submit({\n value\n })\n });\n }\n }\n default:\n {\n return defaultIntProcessor(Option.getOrElse(input.input, () => \"\"), state);\n }\n }\n };\n};\nconst handleRenderFloat = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderNumberNextFrame(state, options),\n Submit: () => renderNumberSubmission(state, options)\n });\n };\n};\nconst handleProcessFloat = options => {\n return (input, state) => {\n if (input.key.ctrl && input.key.name === \"u\") {\n return processNumberClear(state);\n }\n switch (input.key.name) {\n case \"backspace\":\n {\n return processNumberBackspace(state);\n }\n case \"k\":\n case \"up\":\n {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: state.value === \"\" || state.value === \"-\" ? `${options.incrementBy}` : `${Number.parseFloat(state.value) + options.incrementBy}`,\n error: Option.none()\n }\n }));\n }\n case \"j\":\n case \"down\":\n {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value: state.value === \"\" || state.value === \"-\" ? `-${options.decrementBy}` : `${Number.parseFloat(state.value) - options.decrementBy}`,\n error: Option.none()\n }\n }));\n }\n case \"enter\":\n case \"return\":\n {\n const parsed = Number.parseFloat(state.value);\n if (Number.isNaN(parsed)) {\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n error: Option.some(\"Must provide a floating point value\")\n }\n }));\n } else {\n return Effect.flatMap(Effect.sync(() => EffectNumber.round(parsed, options.precision)), rounded => Effect.match(options.validate(rounded), {\n onFailure: error => Action.NextFrame({\n state: {\n ...state,\n error: Option.some(error)\n }\n }),\n onSuccess: value => Action.Submit({\n value\n })\n }));\n }\n }\n default:\n {\n return defaultFloatProcessor(Option.getOrElse(input.input, () => \"\"), state);\n }\n }\n };\n};\nconst filterAutoCompleteChoices = (choices, query) => {\n const normalizedQuery = query.toLowerCase();\n const indices = [];\n for (let i = 0; i < choices.length; i++) {\n if (choices[i].title.toLowerCase().includes(normalizedQuery)) {\n indices.push(i);\n }\n }\n return indices;\n};\nconst updateAutoCompleteState = (state, options, query) => {\n const filtered = filterAutoCompleteChoices(options.choices, query);\n if (filtered.length === 0) {\n return {\n ...state,\n query,\n filtered,\n index: 0\n };\n }\n if (filtered.includes(state.index)) {\n return {\n ...state,\n query,\n filtered\n };\n }\n return {\n ...state,\n query,\n filtered,\n index: filtered[0]\n };\n};\nconst autoCompleteCursor = state => Option.getOrElse(Arr.findFirstIndex(state.filtered, index => index === state.index), () => 0);\nconst renderSelectOutput = (leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt(\"\", options.message, leadingSymbol, trailingSymbol, renderOptions);\nconst renderAutoCompleteFilter = (state, options, renderOptions) => {\n const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? options.filterPlaceholder : Ansi.annotate(options.filterPlaceholder, Ansi.blackBright) : renderOptions?.plain === true ? state.query : Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, Ansi.cyanBright));\n return `[${options.filterLabel}: ${filterValue}]`;\n};\nconst renderAutoCompleteOutput = (state, leadingSymbol, trailingSymbol, options, renderOptions) => {\n const filter = renderAutoCompleteFilter(state, options, renderOptions);\n return renderPrompt(filter, options.message, leadingSymbol, trailingSymbol, renderOptions);\n};\nconst renderChoicePrefix = (state, choices, toDisplay, currentIndex, figures, renderOptions) => {\n let prefix = \" \";\n if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {\n prefix = figures.arrowUp;\n } else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length) {\n prefix = figures.arrowDown;\n }\n if (renderOptions?.plain === true) {\n return state === currentIndex ? figures.pointer + prefix : prefix + \" \";\n }\n if (choices[currentIndex].disabled) {\n const annotation = Ansi.combine(Ansi.bold, Ansi.blackBright);\n return state === currentIndex ? Ansi.annotate(figures.pointer, annotation) + prefix : prefix + \" \";\n }\n return state === currentIndex ? Ansi.annotate(figures.pointer, Ansi.cyanBright) + prefix : prefix + \" \";\n};\nconst renderAutoCompleteChoicePrefix = (state, options, toDisplay, currentIndex, figures, renderOptions) => {\n let prefix = \" \";\n if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {\n prefix = figures.arrowUp;\n } else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < state.filtered.length) {\n prefix = figures.arrowDown;\n }\n const choiceIndex = state.filtered[currentIndex];\n if (renderOptions?.plain === true) {\n return state.index === choiceIndex ? figures.pointer + prefix : prefix + \" \";\n }\n const choice = options.choices[choiceIndex];\n if (choice.disabled) {\n const annotation = Ansi.combine(Ansi.bold, Ansi.blackBright);\n return state.index === choiceIndex ? Ansi.annotate(figures.pointer, annotation) + prefix : prefix + \" \";\n }\n return state.index === choiceIndex ? Ansi.annotate(figures.pointer, Ansi.cyanBright) + prefix : prefix + \" \";\n};\nconst renderChoiceTitle = (choice, isSelected, renderOptions) => {\n if (renderOptions?.plain === true) {\n return choice.title;\n }\n const title = choice.title;\n if (isSelected) {\n return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.underlined, Ansi.blackBright)) : Ansi.annotate(title, Ansi.combine(Ansi.underlined, Ansi.cyanBright));\n }\n return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.strikethrough, Ansi.blackBright)) : title;\n};\nconst renderSelectChoices = (state, options, figures, renderOptions) => {\n const choices = options.choices;\n const toDisplay = entriesToDisplay(state, choices.length, options.maxPerPage);\n const documents = [];\n for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {\n const choice = choices[index];\n const isSelected = state === index;\n const prefix = renderChoicePrefix(state, choices, toDisplay, index, figures, renderOptions);\n const title = renderChoiceTitle(choice, isSelected, renderOptions);\n const description = renderChoiceDescription(choice, isSelected, renderOptions);\n documents.push(prefix + title + \" \" + description);\n }\n return documents.join(\"\\n\");\n};\nconst renderAutoCompleteChoices = (state, options, figures, renderOptions) => {\n if (state.filtered.length === 0) {\n return renderOptions?.plain === true ? options.emptyMessage : Ansi.annotate(options.emptyMessage, Ansi.blackBright);\n }\n const cursor = autoCompleteCursor(state);\n const toDisplay = entriesToDisplay(cursor, state.filtered.length, options.maxPerPage);\n const documents = [];\n for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {\n const choiceIndex = state.filtered[index];\n const choice = options.choices[choiceIndex];\n const isSelected = state.index === choiceIndex;\n const prefix = renderAutoCompleteChoicePrefix(state, options, toDisplay, index, figures, renderOptions);\n const title = renderChoiceTitle(choice, isSelected, renderOptions);\n const description = renderChoiceDescription(choice, isSelected, renderOptions);\n documents.push(prefix + title + \" \" + description);\n }\n return documents.join(\"\\n\");\n};\nconst renderSelectNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const choices = renderSelectChoices(state, options, figures);\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);\n return Ansi.cursorHide + promptMsg + \"\\n\" + choices;\n});\nconst renderAutoCompleteNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const choices = renderAutoCompleteChoices(state, options, figures);\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options);\n return Ansi.cursorHide + promptMsg + \"\\n\" + choices;\n});\nconst renderSelectSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const selected = options.choices[state].title;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);\n return promptMsg + \" \" + Ansi.annotate(selected, Ansi.white) + \"\\n\";\n});\nconst renderAutoCompleteSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const selected = options.choices[state.index].title;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options);\n return promptMsg + \" \" + Ansi.annotate(selected, Ansi.white) + \"\\n\";\n});\nconst processSelectCursorUp = (state, choices) => {\n if (state === 0) {\n return Effect.succeed(Action.NextFrame({\n state: choices.length - 1\n }));\n }\n return Effect.succeed(Action.NextFrame({\n state: state - 1\n }));\n};\nconst processSelectCursorDown = (state, choices) => {\n if (state === choices.length - 1) {\n return Effect.succeed(Action.NextFrame({\n state: 0\n }));\n }\n return Effect.succeed(Action.NextFrame({\n state: state + 1\n }));\n};\nconst processSelectNext = (state, choices) => {\n return Effect.succeed(Action.NextFrame({\n state: (state + 1) % choices.length\n }));\n};\nconst processAutoCompleteCursorUp = state => {\n if (state.filtered.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const cursor = autoCompleteCursor(state);\n const nextCursor = cursor === 0 ? state.filtered.length - 1 : cursor - 1;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n index: state.filtered[nextCursor]\n }\n }));\n};\nconst processAutoCompleteCursorDown = state => {\n if (state.filtered.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const cursor = autoCompleteCursor(state);\n const nextCursor = (cursor + 1) % state.filtered.length;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n index: state.filtered[nextCursor]\n }\n }));\n};\nconst processAutoCompleteNext = state => processAutoCompleteCursorDown(state);\nconst processAutoCompleteBackspace = (state, options) => {\n if (state.query.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const query = state.query.slice(0, state.query.length - 1);\n return Effect.succeed(Action.NextFrame({\n state: updateAutoCompleteState(state, options, query)\n }));\n};\nconst processAutoCompleteClear = (state, options) => Effect.succeed(Action.NextFrame({\n state: updateAutoCompleteState(state, options, \"\")\n}));\nconst processAutoCompleteInput = (input, state, options) => {\n if (input.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const query = state.query + input;\n return Effect.succeed(Action.NextFrame({\n state: updateAutoCompleteState(state, options, query)\n }));\n};\nconst handleSelectRender = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderSelectNextFrame(state, options),\n Submit: () => renderSelectSubmission(state, options)\n });\n };\n};\nconst handleAutoCompleteRender = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderAutoCompleteNextFrame(state, options),\n Submit: () => renderAutoCompleteSubmission(state, options)\n });\n };\n};\nconst handleSelectClear = options => Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;\n const promptText = renderSelectOutput(\"?\", figures.pointerSmall, options, {\n plain: true\n });\n const choicesText = renderSelectChoices(state, options, figures, {\n plain: true\n });\n const clearOutput = eraseText(`${promptText}\\n${choicesText}`, columns);\n return clearOutput + clearPrompt;\n});\nconst handleAutoCompleteClear = options => Effect.fnUntraced(function* (state, _) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;\n const promptText = renderAutoCompleteOutput(state, \"?\", figures.pointerSmall, options, {\n plain: true\n });\n const choicesText = renderAutoCompleteChoices(state, options, figures, {\n plain: true\n });\n const clearOutput = eraseText(`${promptText}\\n${choicesText}`, columns);\n return clearOutput + clearPrompt;\n});\nconst handleSelectProcess = options => {\n return (input, state) => {\n switch (input.key.name) {\n case \"k\":\n case \"up\":\n {\n return processSelectCursorUp(state, options.choices);\n }\n case \"j\":\n case \"down\":\n {\n return processSelectCursorDown(state, options.choices);\n }\n case \"tab\":\n {\n return processSelectNext(state, options.choices);\n }\n case \"enter\":\n case \"return\":\n {\n const selected = options.choices[state];\n if (selected.disabled) {\n return Effect.succeed(Action.Beep());\n }\n return Effect.succeed(Action.Submit({\n value: selected.value\n }));\n }\n default:\n {\n return Effect.succeed(Action.Beep());\n }\n }\n };\n};\nconst handleAutoCompleteProcess = options => {\n return (input, state) => {\n if (input.key.ctrl) {\n if (input.key.name === \"u\") {\n return processAutoCompleteClear(state, options);\n }\n return Effect.succeed(Action.Beep());\n }\n switch (input.key.name) {\n case \"k\":\n case \"up\":\n {\n return processAutoCompleteCursorUp(state);\n }\n case \"j\":\n case \"down\":\n {\n return processAutoCompleteCursorDown(state);\n }\n case \"tab\":\n {\n return processAutoCompleteNext(state);\n }\n case \"backspace\":\n {\n return processAutoCompleteBackspace(state, options);\n }\n case \"enter\":\n case \"return\":\n {\n if (state.filtered.length === 0) {\n return Effect.succeed(Action.Beep());\n }\n const selected = options.choices[state.index];\n if (selected.disabled) {\n return Effect.succeed(Action.Beep());\n }\n return Effect.succeed(Action.Submit({\n value: selected.value\n }));\n }\n default:\n {\n return processAutoCompleteInput(Option.getOrElse(input.input, () => \"\"), state, options);\n }\n }\n };\n};\nconst renderClearScreen = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;\n const errorText = renderTextError(state, figures.pointerSmall, {\n plain: true\n });\n const clearOutput = clearOutputWithError(renderTextOutput(state, \"?\", figures.pointerSmall, options, {\n plain: true\n }), columns, errorText);\n return clearOutput + resetCurrentLine;\n});\nconst renderTextInput = (nextState, options, submitted, renderOptions) => {\n const text = nextState.value;\n if (renderOptions?.plain === true) {\n switch (options.type) {\n case \"hidden\":\n {\n return \"\";\n }\n case \"password\":\n {\n return \"*\".repeat(text.length);\n }\n case \"text\":\n {\n return text;\n }\n }\n }\n const annotation = Option.isSome(nextState.error) ? Ansi.red : submitted ? Ansi.white : nextState.value.length === 0 ? Ansi.blackBright : Ansi.combine(Ansi.underlined, Ansi.cyanBright);\n switch (options.type) {\n case \"hidden\":\n {\n return \"\";\n }\n case \"password\":\n {\n return Ansi.annotate(\"*\".repeat(text.length), annotation);\n }\n case \"text\":\n {\n return Ansi.annotate(text, annotation);\n }\n }\n};\nconst renderTextError = (nextState, pointer, renderOptions) => {\n if (Option.isSome(nextState.error)) {\n return Arr.match(nextState.error.value.split(NEWLINE_REGEXP), {\n onEmpty: () => \"\",\n onNonEmpty: errorLines => {\n if (renderOptions?.plain === true) {\n return `${pointer} ${errorLines.join(\"\\n\")}`;\n }\n const prefix = Ansi.annotate(pointer, Ansi.red) + \" \";\n const lines = Arr.map(errorLines, str => annotateErrorLine(str));\n return Ansi.cursorSavePosition + \"\\n\" + prefix + lines.join(\"\\n\") + Ansi.cursorRestorePosition;\n }\n });\n }\n return \"\";\n};\nconst renderTextOutput = (nextState, leadingSymbol, trailingSymbol, options, renderOptions, submitted = false) => {\n const value = renderTextInput(nextState, options, submitted, renderOptions);\n return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);\n};\nconst renderTextNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options);\n const errorMsg = renderTextError(state, figures.pointerSmall);\n const offset = state.cursor - state.value.length;\n return promptMsg + errorMsg + Ansi.cursorMove(offset);\n});\nconst renderTextSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, undefined, true);\n return promptMsg + \"\\n\";\n});\nconst processTextBackspace = state => {\n if (state.cursor <= 0) {\n return Effect.succeed(Action.Beep());\n }\n const beforeCursor = state.value.slice(0, state.cursor - 1);\n const afterCursor = state.value.slice(state.cursor);\n const cursor = state.cursor - 1;\n const value = `${beforeCursor}${afterCursor}`;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor,\n value,\n error: Option.none()\n }\n }));\n};\nconst processTextClear = state => Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor: 0,\n value: \"\",\n error: Option.none()\n }\n}));\nconst processTextCursorLeft = state => {\n if (state.cursor <= 0) {\n return Effect.succeed(Action.Beep());\n }\n const cursor = state.cursor - 1;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor,\n error: Option.none()\n }\n }));\n};\nconst processTextCursorRight = state => {\n if (state.cursor >= state.value.length) {\n return Effect.succeed(Action.Beep());\n }\n const cursor = Math.min(state.cursor + 1, state.value.length);\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor,\n error: Option.none()\n }\n }));\n};\nconst processTextCursorStart = state => Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor: 0,\n error: Option.none()\n }\n}));\nconst processTextCursorEnd = state => Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor: state.value.length,\n error: Option.none()\n }\n}));\nconst processTab = (state, options) => {\n if (state.value === options.default) {\n return Effect.succeed(Action.Beep());\n }\n const value = state.value.length === 0 ? options.default : state.value;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n value,\n cursor: value.length,\n error: Option.none()\n }\n }));\n};\nconst defaultTextProcessor = (input, state) => {\n const beforeCursor = state.value.slice(0, state.cursor);\n const afterCursor = state.value.slice(state.cursor);\n const value = `${beforeCursor}${input}${afterCursor}`;\n const cursor = state.cursor + input.length;\n return Effect.succeed(Action.NextFrame({\n state: {\n ...state,\n cursor,\n value,\n error: Option.none()\n }\n }));\n};\nconst handleTextRender = options => {\n return (state, action) => {\n return Action.$match(action, {\n Beep: () => Effect.succeed(renderBeep),\n NextFrame: ({\n state\n }) => renderTextNextFrame(state, options),\n Submit: () => renderTextSubmission(state, options)\n });\n };\n};\nconst handleTextProcess = options => {\n return (input, state) => {\n if (input.key.ctrl) {\n switch (input.key.name) {\n case \"u\":\n {\n return processTextClear(state);\n }\n case \"a\":\n {\n return processTextCursorStart(state);\n }\n case \"e\":\n {\n return processTextCursorEnd(state);\n }\n default:\n {\n return Effect.succeed(Action.Beep());\n }\n }\n }\n switch (input.key.name) {\n case \"backspace\":\n {\n return processTextBackspace(state);\n }\n case \"left\":\n {\n return processTextCursorLeft(state);\n }\n case \"right\":\n {\n return processTextCursorRight(state);\n }\n case \"home\":\n {\n return processTextCursorStart(state);\n }\n case \"end\":\n {\n return processTextCursorEnd(state);\n }\n case \"enter\":\n case \"return\":\n {\n const value = state.value;\n return Effect.match(options.validate(value), {\n onFailure: error => Action.NextFrame({\n state: {\n ...state,\n value,\n error: Option.some(error)\n }\n }),\n onSuccess: value => Action.Submit({\n value\n })\n });\n }\n case \"tab\":\n {\n return processTab(state, options);\n }\n default:\n {\n return defaultTextProcessor(Option.getOrElse(input.input, () => \"\"), state);\n }\n }\n };\n};\nconst handleTextClear = options => {\n return (state, _) => {\n return renderClearScreen(state, options);\n };\n};\nconst basePrompt = (options, type) => {\n const opts = {\n default: \"\",\n type,\n validate: Effect.succeed,\n ...options\n };\n const initialState = {\n cursor: opts.default.length,\n value: opts.default,\n error: Option.none()\n };\n return custom(initialState, {\n render: handleTextRender(opts),\n process: handleTextProcess(opts),\n clear: handleTextClear(opts)\n });\n};\nconst handleToggleClear = /*#__PURE__*/Effect.fnUntraced(function* (options) {\n const terminal = yield* Terminal.Terminal;\n const columns = yield* terminal.columns;\n const figures = yield* platformFigures;\n const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;\n const toggleText = `${options.active} / ${options.inactive}`;\n const promptText = renderPrompt(toggleText, options.message, \"?\", figures.pointerSmall, {\n plain: true\n });\n const clearOutput = eraseText(promptText, columns);\n return clearOutput + clearPrompt;\n});\nconst renderToggle = (value, options, submitted = false) => {\n const separator = Ansi.annotate(\"/\", Ansi.blackBright);\n const selectedAnnotation = Ansi.combine(Ansi.underlined, submitted ? Ansi.white : Ansi.cyanBright);\n const inactive = value ? options.inactive : Ansi.annotate(options.inactive, selectedAnnotation);\n const active = value ? Ansi.annotate(options.active, selectedAnnotation) : options.active;\n return active + \" \" + separator + \" \" + inactive;\n};\nconst renderToggleOutput = (toggle, leadingSymbol, trailingSymbol, options) => {\n const promptLines = options.message.split(NEWLINE_REGEXP);\n const prefix = leadingSymbol + \" \";\n if (Arr.isReadonlyArrayNonEmpty(promptLines)) {\n const lines = Arr.map(promptLines, line => annotateLine(line));\n return prefix + lines.join(\"\\n\") + \" \" + trailingSymbol + \" \" + toggle;\n }\n return prefix + \" \" + trailingSymbol + \" \" + toggle;\n};\nconst renderToggleNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(\"?\", Ansi.cyanBright);\n const trailingSymbol = Ansi.annotate(figures.pointerSmall, Ansi.blackBright);\n const toggle = renderToggle(state, options);\n const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options);\n return Ansi.cursorHide + promptMsg;\n});\nconst renderToggleSubmission = /*#__PURE__*/Effect.fnUntraced(function* (value, options) {\n const figures = yield* platformFigures;\n const leadingSymbol = Ansi.annotate(figures.tick, Ansi.green);\n const trailingSymbol = Ansi.annotate(figures.ellipsis, Ansi.blackBright);\n const toggle = renderToggle(value, options, true);\n const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options);\n return promptMsg + \"\\n\";\n});\nconst activate = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Action.NextFrame({\n state: true\n}));\nconst deactivate = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Action.NextFrame({\n state: false\n}));\nconst handleToggleRender = options => {\n return (state, action) => {\n switch (action._tag) {\n case \"Beep\":\n {\n return Effect.succeed(renderBeep);\n }\n case \"NextFrame\":\n {\n return renderToggleNextFrame(state, options);\n }\n case \"Submit\":\n {\n return renderToggleSubmission(state, options);\n }\n }\n };\n};\nconst handleToggleProcess = (input, state) => {\n switch (input.key.name) {\n case \"0\":\n case \"j\":\n case \"delete\":\n case \"right\":\n case \"down\":\n {\n return deactivate;\n }\n case \"1\":\n case \"k\":\n case \"left\":\n case \"up\":\n {\n return activate;\n }\n case \" \":\n case \"tab\":\n {\n return state ? deactivate : activate;\n }\n case \"enter\":\n case \"return\":\n {\n return Effect.succeed(Action.Submit({\n value: state\n }));\n }\n default:\n {\n return Effect.succeed(Action.Beep());\n }\n }\n};\nconst entriesToDisplay = (cursor, total, maxVisible) => {\n const max = maxVisible === undefined ? total : maxVisible;\n let startIndex = Math.min(total - max, cursor - Math.floor(max / 2));\n if (startIndex < 0) {\n startIndex = 0;\n }\n const endIndex = Math.min(startIndex + max, total);\n return {\n startIndex,\n endIndex\n };\n};\n//# sourceMappingURL=Prompt.js.map",
|
|
87
|
+
"/**\n * The `Param` module defines the shared parser tree used by the unstable CLI\n * `Argument` and `Flag` modules. A `Param<Kind, A>` describes how to consume\n * either positional arguments or named flags from parsed command-line input and\n * return a typed value.\n *\n * **Common tasks**\n *\n * - Build primitive CLI inputs such as strings, booleans, numbers, choices,\n * paths, files, and redacted values\n * - Attach help metadata with aliases and descriptions\n * - Transform parsed values with pure or effectful validation\n * - Model missing inputs with `Option`, defaults, config fallbacks, or prompts\n * - Accept repeated inputs with variadic, bounded, and non-empty parameters\n *\n * **Gotchas**\n *\n * - The `Kind` type parameter (`\"argument\"` or `\"flag\"`) keeps positional\n * arguments and flags separate while allowing the implementation and\n * combinators to be shared.\n * - Combinators preserve the parameter kind, so an argument parameter cannot be\n * accidentally composed into a flag parameter or the reverse.\n * - Parsers return both the remaining positional arguments and the parsed\n * value; this is important for argument ordering and variadic parameters.\n * - Some parsers require CLI services such as filesystem, path, terminal, or\n * child-process support through the parsing environment.\n *\n * @since 4.0.0\n */\nimport * as Config from \"../../Config.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { dual, identity } from \"../../Function.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as CliError from \"./CliError.js\";\nimport * as Primitive from \"./Primitive.js\";\nimport * as Prompt from \"./Prompt.js\";\nconst TypeId = \"~effect/cli/Param\";\n/**\n * Defines the kind discriminator for positional argument parameters.\n *\n * **When to use**\n *\n * Use to build low-level `Param` constructors or type positions for positional\n * argument parameters.\n *\n * @see {@link flagKind} for the named flag parameter discriminator\n * @see {@link ParamKind} for the full parameter kind union\n *\n * @category constants\n * @since 4.0.0\n */\nexport const argumentKind = \"argument\";\n/**\n * Defines the kind discriminator for flag parameters.\n *\n * **When to use**\n *\n * Use to build low-level `Param` constructors or type positions for named flag\n * parameters.\n *\n * @see {@link argumentKind} for the positional argument parameter discriminator\n *\n * @category constants\n * @since 4.0.0\n */\nexport const flagKind = \"flag\";\nconst Proto = {\n [TypeId]: {\n _A: identity\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Type guard to check if a value is a Param.\n *\n * **Example** (Checking for params)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const maybeParam = Param.string(Param.flagKind, \"name\")\n *\n * if (Param.isParam(maybeParam)) {\n * console.log(\"This is a Param\")\n * }\n * ```\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isParam = u => Predicate.hasProperty(u, TypeId);\n/**\n * Type guard to check if a param is a Single param (not composed).\n *\n * **Example** (Checking for single params)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const nameParam = Param.string(Param.flagKind, \"name\")\n * const optionalParam = Param.optional(nameParam)\n *\n * console.log(Param.isSingle(nameParam)) // true\n * console.log(Param.isSingle(optionalParam)) // false\n * ```\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isSingle = param => Predicate.isTagged(param, \"Single\");\n/**\n * Type guard to check if a Single param is a flag (not an argument).\n *\n * @internal\n */\nexport const isFlagParam = single => single.kind === \"flag\";\n/**\n * Constructs a leaf `Single` parameter from its kind, name, primitive parser,\n * and optional help metadata.\n *\n * **Details**\n *\n * The returned parser reads either one positional argument or the named flag,\n * depending on `kind`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeSingle = params => {\n const parse = args => params.kind === argumentKind ? parsePositional(params.name, params.primitiveType, args) : parseFlag(params.name, params.primitiveType, args);\n return Object.assign(Object.create(Proto), {\n _tag: \"Single\",\n ...params,\n description: params.description ?? Option.none(),\n aliases: params.aliases ?? [],\n hidden: params.hidden ?? false,\n parse\n });\n};\n/**\n * Creates a string parameter.\n *\n * **Example** (Creating string parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Create a string flag\n * const nameFlag = Param.string(Param.flagKind, \"name\")\n *\n * // Create a string argument\n * const fileArg = Param.string(Param.argumentKind, \"file\")\n *\n * // Usage in CLI: --name \"John Doe\" or as positional argument\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const string = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.string,\n kind\n});\n/**\n * Creates a boolean parameter.\n *\n * **Example** (Creating boolean parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Create a boolean flag\n * const verboseFlag = Param.boolean(Param.flagKind, \"verbose\")\n *\n * // Create a boolean argument\n * const enableArg = Param.boolean(Param.argumentKind, \"enable\")\n *\n * // Usage in CLI: --verbose (defaults to true when present, false when absent)\n * // or as positional: true/false\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const boolean = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.boolean,\n kind\n});\n/**\n * Creates an integer parameter.\n *\n * **Example** (Creating integer parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Create an integer flag\n * const portFlag = Param.integer(Param.flagKind, \"port\")\n *\n * // Create an integer argument\n * const countArg = Param.integer(Param.argumentKind, \"count\")\n *\n * // Usage in CLI: --port 8080 or as positional argument: 42\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const integer = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.integer,\n kind\n});\n/**\n * Creates a floating-point number parameter.\n *\n * **Example** (Creating float parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Create a float flag\n * const rateFlag = Param.float(Param.flagKind, \"rate\")\n *\n * // Create a float argument\n * const thresholdArg = Param.float(Param.argumentKind, \"threshold\")\n *\n * // Usage in CLI: --rate 0.95 or as positional argument: 3.14159\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const float = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.float,\n kind\n});\n/**\n * Creates a date parameter that parses ISO date strings.\n *\n * **Example** (Creating date parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Create a date flag\n * const startFlag = Param.date(Param.flagKind, \"start-date\")\n *\n * // Create a date argument\n * const dueDateArg = Param.date(Param.argumentKind, \"due-date\")\n *\n * // Usage in CLI: --start-date \"2023-12-25\" or as positional: \"2023-01-01\"\n * // Parses to JavaScript Date object\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const date = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.date,\n kind\n});\n/**\n * Constructs command-line params that represent a choice between several\n * inputs. The input will be mapped to it's associated value during parsing.\n *\n * **Example** (Creating valued choices)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * type Animal = Dog | Cat\n *\n * interface Dog {\n * readonly _tag: \"Dog\"\n * }\n *\n * interface Cat {\n * readonly _tag: \"Cat\"\n * }\n *\n * const animal = Param.choiceWithValue(Param.flagKind, \"animal\", [\n * [\"dog\", { _tag: \"Dog\" }],\n * [\"cat\", { _tag: \"Cat\" }]\n * ])\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choiceWithValue = (kind, name, choices) => makeSingle({\n name,\n primitiveType: Primitive.choice(choices),\n kind\n});\n/**\n * Constructs command-line params that represent a choice between several\n * string inputs.\n *\n * **Example** (Creating string choices)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const logLevel = Param.choice(Param.flagKind, \"log-level\", [\n * \"debug\",\n * \"info\",\n * \"warn\",\n * \"error\"\n * ])\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choice = (kind, name, choices) => {\n const mappedChoices = choices.map(value => [value, value]);\n return choiceWithValue(kind, name, mappedChoices);\n};\n/**\n * Creates a path parameter that accepts file or directory paths.\n *\n * **Example** (Creating path parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Basic path parameter\n * const outputPath = Param.path(Param.flagKind, \"output\")\n *\n * // Path that must exist\n * const inputPath = Param.path(Param.flagKind, \"input\", { mustExist: true })\n *\n * // File-only path\n * const configFile = Param.path(Param.flagKind, \"config\", {\n * pathType: \"file\",\n * mustExist: true,\n * typeName: \"config-file\"\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const path = (kind, name, options) => makeSingle({\n name,\n kind,\n primitiveType: Primitive.path(options?.pathType ?? \"either\", options?.mustExist),\n typeName: options?.typeName\n});\n/**\n * Creates a directory path parameter.\n *\n * **Details**\n *\n * This is a convenience function that creates a path parameter with the\n * `pathType` set to `\"directory\"` and a default type name of `\"directory\"`.\n *\n * **Example** (Creating directory parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Basic directory parameter\n * const outputDir = Param.directory(Param.flagKind, \"output-dir\")\n *\n * // Directory that must exist\n * const sourceDir = Param.directory(Param.flagKind, \"source\", { mustExist: true })\n *\n * // Usage: --output-dir /path/to/dir --source /existing/dir\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const directory = (kind, name, options) => path(kind, name, {\n pathType: \"directory\",\n typeName: \"directory\",\n mustExist: options?.mustExist\n});\n/**\n * Creates a file path parameter.\n *\n * **Details**\n *\n * This is a convenience function that creates a path parameter with a\n * `pathType` set to `\"file\"` and a default type name of `\"file\"`.\n *\n * **Example** (Creating file parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Basic file parameter\n * const outputFile = Param.file(Param.flagKind, \"output\")\n *\n * // File that must exist\n * const inputFile = Param.file(Param.flagKind, \"input\", { mustExist: true })\n *\n * // Usage: --output result.txt --input existing-file.txt\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (kind, name, options) => path(kind, name, {\n pathType: \"file\",\n typeName: \"file\",\n mustExist: options?.mustExist\n});\n/**\n * Creates a redacted parameter for sensitive data like passwords.\n * The value is masked in help output and logging.\n *\n * **Example** (Creating redacted parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Create a password parameter\n * const password = Param.redacted(Param.flagKind, \"password\")\n *\n * // Create an API key argument\n * const apiKey = Param.redacted(Param.argumentKind, \"api-key\")\n *\n * // Usage: --password (value will be hidden in help/logs)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redacted = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.redacted,\n kind\n});\n/**\n * Creates a parameter that reads and returns file content as a string.\n *\n * **Example** (Reading file text)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Read a config file as string\n * const configContent = Param.fileText(Param.flagKind, \"config\")\n *\n * // Read a template file as argument\n * const templateContent = Param.fileText(Param.argumentKind, \"template\")\n *\n * // Usage: --config config.txt (reads file content into string)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileText = (kind, name) => makeSingle({\n name,\n primitiveType: Primitive.fileText,\n kind\n});\n/**\n * Creates a param that reads and parses the content of the specified file.\n *\n * **Details**\n *\n * The parser that is utilized will depend on the specified `format`, or the\n * extension of the file passed on the command-line if no `format` is specified.\n *\n * **Example** (Parsing file contents)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Will use the extension of the file passed on the command line to determine\n * // the parser to use\n * const config = Param.fileParse(Param.flagKind, \"config\")\n *\n * // Will use the JSON parser\n * const jsonConfig = Param.fileParse(Param.flagKind, \"json-config\", {\n * format: \"json\"\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileParse = (kind, name, options) => makeSingle({\n name,\n primitiveType: Primitive.fileParse(options),\n kind\n});\n/**\n * Creates a parameter that reads and validates file content using a schema.\n *\n * **Example** (Validating file contents)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { Param } from \"effect/unstable/cli\"\n * // @internal - this module is not exported publicly\n *\n * // Parse JSON config file\n * const configSchema = Schema.Struct({\n * port: Schema.Number,\n * host: Schema.String\n * })\n *\n * const config = Param.fileSchema(Param.flagKind, \"config\", configSchema, {\n * format: \"json\"\n * })\n *\n * // Parse YAML file\n * const yamlConfig = Param.fileSchema(Param.flagKind, \"config\", configSchema, {\n * format: \"yaml\"\n * })\n *\n * // Usage: --config config.json (reads and validates file content)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileSchema = (kind, name, schema, options) => makeSingle({\n name,\n primitiveType: Primitive.fileSchema(schema, options),\n kind\n});\n/**\n * Creates a param that parses key=value pairs.\n *\n * **When to use**\n *\n * Use when you use it for options that accept configuration values.\n *\n * **Details**\n *\n * Requires at least one key=value pair. The parsed pairs are merged into a\n * single record object.\n *\n * **Example** (Parsing key-value pairs)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const env = Param.keyValuePair(Param.flagKind, \"env\")\n * // --env FOO=bar --env BAZ=qux will parse to { FOO: \"bar\", BAZ: \"qux\" }\n *\n * const props = Param.keyValuePair(Param.flagKind, \"property\")\n * // --property name=value --property debug=true\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const keyValuePair = (kind, name) => map(variadic(makeSingle({\n name,\n primitiveType: Primitive.keyValuePair,\n kind\n}), {\n min: 1\n}), objects => Object.assign({}, ...objects));\n/**\n * Creates an empty sentinel parameter that always fails to parse.\n *\n * **When to use**\n *\n * Use when this is useful for creating placeholder parameters or for combinators.\n *\n * **Example** (Creating sentinel parameters)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const disabledDebugParam = Param.none(Param.flagKind)\n *\n * const makeDebugParam = (enableDebug: boolean) =>\n * enableDebug ? Param.string(Param.flagKind, \"debug\") : disabledDebugParam\n *\n * console.log(makeDebugParam(true) === disabledDebugParam) // false\n * console.log(makeDebugParam(false) === disabledDebugParam) // true\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const none = kind => makeSingle({\n name: \"__none__\",\n primitiveType: Primitive.none,\n kind\n});\nconst FLAG_DASH_REGEXP = /^-+/;\n/**\n * Adds an alias to an option.\n *\n * **When to use**\n *\n * Use when aliases allow params to be specified with alternative names,\n * typically single-character shortcuts like \"-f\" for \"--force\".\n *\n * **Details**\n *\n * This works on any param structure by recursively finding the underlying\n * `Single` node and applying the alias there.\n *\n * **Example** (Adding parameter aliases)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const force = Param.boolean(Param.flagKind, \"force\").pipe(\n * Param.withAlias(\"-f\"),\n * Param.withAlias(\"-F\")\n * )\n *\n * // Also works on composed params:\n * const count = Param.integer(Param.flagKind, \"count\").pipe(\n * Param.optional,\n * Param.withAlias(\"-c\") // finds the underlying Single and adds alias\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withAlias = /*#__PURE__*/dual(2, (self, alias) => {\n return transformSingle(self, single => makeSingle({\n ...single,\n aliases: [...single.aliases, alias.replace(FLAG_DASH_REGEXP, \"\")]\n }));\n});\n/**\n * Adds a description to an option for help text.\n *\n * **Details**\n *\n * Descriptions provide users with information about what the option does\n * when they view help documentation.\n *\n * **Example** (Adding help descriptions)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const verbose = Param.boolean(Param.flagKind, \"verbose\").pipe(\n * Param.withAlias(\"-v\"),\n * Param.withDescription(\"Enable verbose output\")\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withDescription = /*#__PURE__*/dual(2, (self, description) => {\n return transformSingle(self, single => makeSingle({\n ...single,\n description: Option.some(description)\n }));\n});\n/**\n * Hides a parameter from generated help output and completions while keeping\n * it parseable on the command line.\n *\n * **When to use**\n *\n * Use when experimental, internal, or deprecated flags that should be\n * accepted but not advertised.\n *\n * **Example** (Hiding a flag from help)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const experimental = Param.boolean(Param.flagKind, \"experimental-foo\").pipe(\n * Param.withHidden\n * )\n * ```\n *\n * @category metadata\n * @since 4.0.0\n */\nexport const withHidden = self => transformSingle(self, single => makeSingle({\n ...single,\n hidden: true\n}));\n/**\n * Transforms the parsed value of an option using a mapping function.\n *\n * **Example** (Mapping parsed values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const port = Param.integer(Param.flagKind, \"port\").pipe(\n * Param.map((n) => ({ port: n, url: `http://localhost:${n}` }))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => {\n const parse = args => Effect.map(self.parse(args), ([operands, value]) => [operands, f(value)]);\n return Object.assign(Object.create(Proto), {\n _tag: \"Map\",\n kind: self.kind,\n param: self,\n f,\n parse\n });\n});\nconst transform = (self, f) => Object.assign(Object.create(Proto), {\n _tag: \"Transform\",\n kind: self.kind,\n param: self,\n f,\n parse: f(self.parse)\n});\n/**\n * Transforms the parsed value of an option using an effectful mapping function.\n *\n * **Example** (Mapping parsed values effectfully)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError, Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const validatedEmail = Param.string(Param.flagKind, \"email\").pipe(\n * Param.mapEffect((email) =>\n * email.includes(\"@\")\n * ? Effect.succeed(email)\n * : Effect.fail(\n * new CliError.InvalidValue({\n * option: \"email\",\n * value: email,\n * expected: \"valid email format\",\n * kind: \"flag\"\n * })\n * )\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mapEffect = /*#__PURE__*/dual(2, (self, f) => transform(self, parse => args => Effect.flatMap(parse(args), ([leftover, a]) => f(a).pipe(Effect.map(b => [leftover, b])))));\n/**\n * Transforms the parsed value of an option using a function that may throw,\n * converting any thrown errors into failure messages.\n *\n * **Example** (Mapping thrown errors)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const parsedJson = Param.string(Param.flagKind, \"config\").pipe(\n * Param.mapTryCatch(\n * (str) => JSON.parse(str),\n * (error) =>\n * `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mapTryCatch = /*#__PURE__*/dual(3, (self, f, onError) => {\n const single = getUnderlyingSingleOrThrow(self);\n return transform(self, parse => args => Effect.flatMap(parse(args), ([leftover, a]) => Effect.try({\n try: () => f(a),\n catch: error => onError(error)\n }).pipe(Effect.mapError(error => new CliError.InvalidValue({\n option: single.name,\n value: String(a),\n expected: error,\n kind: single.kind\n })), Effect.map(b => [leftover, b]))));\n});\n/**\n * Makes a flag or positional argument optional.\n *\n * **Details**\n *\n * When the parameter is absent, parsing succeeds with `Option.none()` instead\n * of failing with a missing option or missing argument error. When present, the\n * parsed value is wrapped in `Option.some()`.\n *\n * **Example** (Making parameters optional)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // Create an optional port option\n * // - When not provided: returns Option.none()\n * // - When provided: returns Option.some(parsedValue)\n * const port = Param.optional(Param.integer(Param.flagKind, \"port\"))\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const optional = param => {\n const parse = Effect.fnUntraced(function* (args) {\n const single = getUnderlyingSingleOrThrow(param);\n // Handle boolean params that are explicitly marked as optional (i.e. the\n // end user wants to return `Option.none()` instead of `false` when the\n // flag (or its negated variant) are not present on the command line\n if (isFlagParam(single) && Primitive.isBoolean(single.primitiveType) && ![single.name, ...single.aliases].some(name => (args.flags[name] ?? []).length > 0)) {\n return [args.arguments, Option.none()];\n }\n return yield* param.parse(args).pipe(Effect.map(([leftover, value]) => [leftover, Option.some(value)]),\n // Catch both MissingOption (for flags) and MissingArgument (for positional arguments)\n Effect.catchTags({\n MissingOption: () => Effect.succeed([args.arguments, Option.none()]),\n MissingArgument: () => Effect.succeed([args.arguments, Option.none()])\n }));\n });\n return Object.assign(Object.create(Proto), {\n _tag: \"Optional\",\n kind: param.kind,\n param,\n parse\n });\n};\n/**\n * Makes a flag or positional argument optional by supplying a fallback value.\n *\n * **Details**\n *\n * The fallback may be a pure value or an effect. It is used only when the\n * parameter is absent; provided values are parsed normally.\n *\n * **Example** (Providing default values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Using the pipe operator to make an option optional\n * const port = Param.integer(Param.flagKind, \"port\").pipe(\n * Param.withDefault(8080)\n * )\n *\n * // Can also be used with other combinators\n * const verbose = Param.boolean(Param.flagKind, \"verbose\").pipe(\n * Param.withAlias(\"-v\"),\n * Param.withDescription(\"Enable verbose output\"),\n * Param.withDefault(false)\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withDefault = /*#__PURE__*/dual(2, (self, defaultValue) => {\n if (!Effect.isEffect(defaultValue)) {\n return map(optional(self), Option.getOrElse(() => defaultValue));\n }\n return mapEffect(optional(self), Option.match({\n onNone: () => defaultValue,\n onSome: Effect.succeed\n }));\n});\n/**\n * Adds a fallback config that is loaded when a required parameter is missing.\n *\n * **When to use**\n *\n * Use when config should provide a fallback source for required flags or\n * arguments that are absent from CLI input.\n *\n * **Details**\n *\n * Provided CLI values win. Config is loaded only after a missing option or\n * missing argument error.\n *\n * **Gotchas**\n *\n * Missing config preserves the original missing-parameter error. Config parse\n * failure becomes `CliError.InvalidValue`.\n *\n * @see {@link withDefault} for a pure default value\n * @see {@link withFallbackPrompt} for prompting interactively when input is missing\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withFallbackConfig = /*#__PURE__*/dual(2, (self, config) => {\n const toInvalidValue = (error, configError) => new CliError.InvalidValue({\n option: error._tag === \"MissingOption\" ? error.option : error.argument,\n value: \"config\",\n expected: configError.message,\n kind: error._tag === \"MissingOption\" ? \"flag\" : \"argument\"\n });\n const runConfig = (error, args) => Config.option(config).pipe(Effect.mapError(configError => toInvalidValue(error, configError)), Effect.flatMap(Option.match({\n onNone: () => Effect.fail(error),\n onSome: value => Effect.succeed([args.arguments, value])\n })));\n return transform(self, parse => args => parse(args).pipe(Effect.catchTag([\"MissingOption\", \"MissingArgument\"], error => runConfig(error, args))));\n});\n/**\n * Adds a fallback prompt that is shown when a required parameter is missing.\n *\n * **When to use**\n *\n * Use when a CLI should ask interactively for a missing required flag or\n * argument.\n *\n * **Details**\n *\n * `FallbackPrompt` accepts either a `Prompt` or an effect that builds one.\n * Effectful prompt creation is lazy and runs only when the fallback is needed.\n *\n * **Gotchas**\n *\n * This only handles missing options and missing arguments. Invalid values do not\n * prompt, and prompt cancellation re-fails with the original missing error.\n *\n * @see {@link FallbackPrompt} for accepted fallback prompt forms\n * @see {@link withFallbackConfig} for loading a fallback from config\n * @see {@link withDefault} for a pure default value\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withFallbackPrompt = /*#__PURE__*/dual(2, (self, prompt) => {\n const runPrompt = (error, args) => Effect.flatMap(Prompt.isPrompt(prompt) ? Effect.succeed(prompt) : prompt, Prompt.run).pipe(Effect.map(value => [args.arguments, value]), Effect.catchTag(\"QuitError\", () => Effect.fail(error)));\n return transform(self, parse => args => parse(args).pipe(Effect.catchTag([\"MissingOption\", \"MissingArgument\"], error => runPrompt(error, args))));\n});\n/**\n * Creates a variadic parameter that can be specified multiple times.\n *\n * **Details**\n *\n * This is the base combinator for creating parameters that accept multiple values.\n * The min and max parameters are optional - if not provided, the parameter can be\n * specified any number of times (0 to infinity).\n *\n * **Example** (Accepting multiple values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Basic variadic parameter (0 to infinity)\n * const tags = Param.variadic(Param.string(Param.flagKind, \"tag\"))\n *\n * // Variadic with minimum count\n * const inputs = Param.variadic(\n * Param.string(Param.flagKind, \"input\"),\n * { min: 1 } // at least 1 required\n * )\n *\n * // Variadic with both min and max\n * const limited = Param.variadic(Param.string(Param.flagKind, \"item\"), {\n * min: 2, // at least 2 times\n * max: 2 // at most 2 times\n * })\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const variadic = (self, options) => {\n const single = getUnderlyingSingleOrThrow(self);\n const parse = args => {\n if (single.kind === \"argument\") {\n return parsePositionalVariadic(self, single, args, options);\n } else {\n return parseOptionVariadic(self, single, args, options);\n }\n };\n return Object.assign(Object.create(Proto), {\n _tag: \"Variadic\",\n kind: self.kind,\n param: self,\n min: Option.fromUndefinedOr(options?.min),\n max: Option.fromUndefinedOr(options?.max),\n parse\n });\n};\n/**\n * Wraps an option to allow it to be specified multiple times within a range.\n *\n * **Details**\n *\n * This combinator transforms an option to accept between `min` and `max`\n * occurrences on the command line, returning an array of all provided values.\n *\n * **Example** (Bounding repeated values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Allow 1-3 file inputs\n * const files = Param.string(Param.flagKind, \"file\").pipe(\n * Param.between(1, 3),\n * Param.withAlias(\"-f\")\n * )\n *\n * // Parse: --file a.txt --file b.txt\n * // Result: [\"a.txt\", \"b.txt\"]\n *\n * // Allow 0 or more tags\n * const tags = Param.string(Param.flagKind, \"tag\").pipe(\n * Param.between(0, Number.MAX_SAFE_INTEGER)\n * )\n *\n * // Parse: --tag dev --tag staging --tag v1.0\n * // Result: [\"dev\", \"staging\", \"v1.0\"]\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const between = /*#__PURE__*/dual(3, (self, min, max) => {\n if (min < 0) {\n throw new Error(\"between: min must be non-negative\");\n }\n if (max < min) {\n throw new Error(\"between: max must be greater than or equal to min\");\n }\n return variadic(self, {\n min,\n max\n });\n});\n/**\n * Wraps an option to allow it to be specified at most `max` times.\n *\n * **Details**\n *\n * This combinator transforms an option to accept between 0 and `max`\n * occurrences on the command line, returning an array of all provided values.\n *\n * **Example** (Limiting repeated values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Allow at most 3 warning suppressions\n * const suppressions = Param.string(Param.flagKind, \"suppress\").pipe(\n * Param.atMost(3)\n * )\n *\n * // Parse: --suppress warning1 --suppress warning2\n * // Result: [\"warning1\", \"warning2\"]\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const atMost = /*#__PURE__*/dual(2, (self, max) => {\n if (max < 0) {\n throw new Error(\"atMost: max must be non-negative\");\n }\n return variadic(self, {\n max\n });\n});\n/**\n * Wraps an option to require it to be specified at least `min` times.\n *\n * **Details**\n *\n * This combinator transforms an option to accept at least `min`\n * occurrences on the command line, returning an array of all provided values.\n *\n * **Example** (Requiring repeated values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * // Require at least 2 input files\n * const inputs = Param.string(Param.flagKind, \"input\").pipe(\n * Param.atLeast(2),\n * Param.withAlias(\"-i\")\n * )\n *\n * // Parse: --input file1.txt --input file2.txt --input file3.txt\n * // Result: [\"file1.txt\", \"file2.txt\", \"file3.txt\"]\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const atLeast = /*#__PURE__*/dual(2, (self, min) => {\n if (min < 0) {\n throw new Error(\"atLeast: min must be non-negative\");\n }\n return variadic(self, {\n min\n });\n});\n/**\n * Filters and transforms parsed values, failing with a custom error message\n * if the filter function returns `Option.none()`.\n *\n * **When to use**\n *\n * Use when you use this combinator for validation and transformation in a single step.\n *\n * **Example** (Filtering and transforming values)\n *\n * ```ts\n * import { Option } from \"effect\"\n * import { Param } from \"effect/unstable/cli\"\n * // @internal - this module is not exported publicly\n *\n * const positiveInt = Param.integer(Param.flagKind, \"count\").pipe(\n * Param.filterMap(\n * (n) => n > 0 ? Option.some(n) : Option.none(),\n * (n) => `Expected positive integer, got ${n}`\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const filterMap = /*#__PURE__*/dual(3, (self, filter, onNone) => mapEffect(self, Effect.fnUntraced(function* (a) {\n const result = filter(a);\n if (Option.isSome(result)) {\n return result.value;\n }\n const single = getUnderlyingSingleOrThrow(self);\n return yield* new CliError.InvalidValue({\n option: single.name,\n value: String(a),\n expected: onNone(a),\n kind: single.kind\n });\n})));\n/**\n * Filters parsed values, failing with a custom error message if the predicate returns false.\n *\n * **Example** (Filtering parsed values)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const evenNumber = Param.integer(Param.flagKind, \"num\").pipe(\n * Param.filter(\n * (n) => n % 2 === 0,\n * (n) => `Expected even number, got ${n}`\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const filter = /*#__PURE__*/dual(3, (self, predicate, onFalse) => filterMap(self, Option.liftPredicate(predicate), onFalse));\n/**\n * Sets a custom metavar (placeholder name) for the param in help documentation.\n *\n * **Details**\n *\n * The metavar is displayed in usage text to indicate what value the user should provide.\n * For example, `--output FILE` shows `FILE` as the metavar.\n *\n * **Example** (Setting metavars)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const port = Param.integer(Param.flagKind, \"port\").pipe(\n * Param.withMetavar(\"PORT\"),\n * Param.filter(\n * (p) => p >= 1 && p <= 65535,\n * () => \"Port must be between 1 and 65535\"\n * )\n * )\n * ```\n *\n * @category metadata\n * @since 4.0.0\n */\nexport const withMetavar = /*#__PURE__*/dual(2, (self, metavar) => transformSingle(self, single => makeSingle({\n ...single,\n typeName: metavar\n})));\n/**\n * Validates parsed values against a Schema, providing detailed error messages.\n *\n * **Example** (Validating with schemas)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { Param } from \"effect/unstable/cli\"\n * // @internal - this module is not exported publicly\n *\n * const isEmail = Schema.isPattern(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)\n *\n * const Email = Schema.String.pipe(\n * Schema.check(isEmail)\n * )\n *\n * const email = Param.string(Param.flagKind, \"email\").pipe(\n * Param.withSchema(Email)\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withSchema = /*#__PURE__*/dual(2, (self, schema) => {\n const decodeParam = Schema.decodeUnknownEffect(schema);\n return mapEffect(self, value => Effect.mapError(decodeParam(value), error => {\n const single = getUnderlyingSingleOrThrow(self);\n return new CliError.InvalidValue({\n option: single.name,\n value: String(value),\n expected: `Schema validation failed: ${error.message}`,\n kind: single.kind\n });\n }));\n});\n/**\n * Provides a fallback param to use if this param fails to parse.\n *\n * **Example** (Falling back to another parameter)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const config = Param.file(Param.flagKind, \"config\").pipe(\n * Param.orElse(() => Param.string(Param.flagKind, \"config-url\"))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const orElse = /*#__PURE__*/dual(2, (self, orElse) => transform(self, parse => args => Effect.catch(parse(args), err => orElse(err).parse(args))));\n/**\n * Provides a fallback param and returns a `Result` indicating which param\n * succeeded.\n *\n * **Details**\n *\n * The original param's value is returned as `Result.succeed`, while the\n * fallback param's value is returned as `Result.fail`.\n *\n * **Example** (Returning fallback results)\n *\n * ```ts\n * import { Param } from \"effect/unstable/cli\"\n *\n * // @internal - this module is not exported publicly\n *\n * const configSource = Param.file(Param.flagKind, \"config\").pipe(\n * Param.orElseResult(() => Param.string(Param.flagKind, \"config-url\"))\n * )\n * // Returns Result<string, string>\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const orElseResult = /*#__PURE__*/dual(2, (self, orElse) => {\n return transform(self, parse => args => Effect.catch(Effect.map(parse(args), ([leftover, value]) => [leftover, Result.succeed(value)]), err => Effect.map(orElse(err).parse(args), ([leftover, value]) => [leftover, Result.fail(value)])));\n});\n// =============================================================================\n// Parsing Utilities\n// =============================================================================\nconst parsePositional = /*#__PURE__*/Effect.fnUntraced(function* (name, primitiveType, args) {\n if (args.arguments.length === 0) {\n return yield* new CliError.MissingArgument({\n argument: name\n });\n }\n const arg = args.arguments[0];\n const value = yield* Effect.mapError(primitiveType.parse(arg), error => new CliError.InvalidValue({\n option: name,\n value: arg,\n expected: error,\n kind: \"argument\"\n }));\n return [args.arguments.slice(1), value];\n});\nconst parseFlag = /*#__PURE__*/Effect.fnUntraced(function* (name, primitiveType, args) {\n const providedValues = args.flags[name];\n if (providedValues === undefined || providedValues.length === 0) {\n // Option not provided (empty array due to initialization)\n if (Primitive.isBoolean(primitiveType)) {\n // Boolean params default to false when not present\n return [args.arguments, false];\n } else {\n return yield* new CliError.MissingOption({\n option: name\n });\n }\n }\n // Parse the first value (later we can handle multiple)\n const arg = providedValues[0];\n const value = yield* Effect.mapError(primitiveType.parse(arg), error => new CliError.InvalidValue({\n option: name,\n value: arg,\n expected: error,\n kind: \"flag\"\n }));\n return [args.arguments, value];\n});\nconst parsePositionalVariadic = /*#__PURE__*/Effect.fnUntraced(function* (self, single, args, options) {\n const results = [];\n const minValue = options?.min ?? 0;\n const maxValue = options?.max ?? Number.POSITIVE_INFINITY;\n let count = 0;\n let currentArgs = args.arguments;\n while (currentArgs.length > 0 && count < maxValue) {\n const [remainingArgs, value] = yield* self.parse({\n flags: args.flags,\n arguments: currentArgs\n });\n results.push(value);\n currentArgs = remainingArgs;\n count++;\n }\n if (count < minValue) {\n return yield* new CliError.InvalidValue({\n option: single.name,\n value: `${count} values`,\n expected: `at least ${minValue} value${minValue === 1 ? \"\" : \"s\"}`,\n kind: single.kind\n });\n }\n return [currentArgs, results];\n});\nconst parseOptionVariadic = /*#__PURE__*/Effect.fnUntraced(function* (self, single, args, options) {\n const results = [];\n const names = [single.name, ...single.aliases];\n const values = names.flatMap(name => args.flags[name] ?? []);\n const count = values.length;\n // Validate count constraints\n if (Predicate.isNotUndefined(options?.min) && count < options.min) {\n return yield* count === 0 ? new CliError.MissingOption({\n option: single.name\n }) : new CliError.InvalidValue({\n option: single.name,\n value: `${count} occurrences`,\n expected: `at least ${options.min} value${options.min === 1 ? \"\" : \"s\"}`,\n kind: single.kind\n });\n }\n if (Predicate.isNotUndefined(options?.max) && count > options.max) {\n return yield* new CliError.InvalidValue({\n option: single.name,\n value: `${count} occurrences`,\n expected: `at most ${options.max} value${options.max === 1 ? \"\" : \"s\"}`,\n kind: single.kind\n });\n }\n // Parse each value individually\n for (const value of values) {\n const [, parsedValue] = yield* self.parse({\n flags: {\n [single.name]: [value]\n },\n arguments: []\n });\n results.push(parsedValue);\n }\n return [args.arguments, results];\n});\n/**\n * Type-safe param matcher that handles the unsafe casting internally.\n * This provides a clean API for pattern matching on param types while\n * maintaining type safety at the call site.\n */\nconst matchParam = (param, patterns) => {\n const p = param;\n switch (p._tag) {\n case \"Single\":\n return patterns.Single(p);\n case \"Map\":\n return patterns.Map(p);\n case \"Transform\":\n return patterns.Transform(p);\n case \"Optional\":\n return patterns.Optional(p);\n case \"Variadic\":\n return patterns.Variadic(p);\n }\n};\n/**\n * Recursively transforms a param by applying a function to any `Single` nodes.\n * This is used internally by combinators like `withAlias` to traverse the param tree.\n */\nconst transformSingle = (param, f) => {\n return matchParam(param, {\n Single: single => f(single),\n Map: mapped => map(transformSingle(mapped.param, f), mapped.f),\n Transform: mapped => transform(transformSingle(mapped.param, f), mapped.f),\n Optional: p => optional(transformSingle(p.param, f)),\n Variadic: p => variadic(transformSingle(p.param, f), {\n min: Option.getOrUndefined(p.min),\n max: Option.getOrUndefined(p.max)\n })\n });\n};\n/**\n * Extracts all Single params from a potentially nested param structure.\n * This handles all param combinators including Map, Transform, Optional, and Variadic.\n *\n * @internal\n */\nexport const extractSingleParams = param => {\n return matchParam(param, {\n Single: single => [single],\n Map: mapped => extractSingleParams(mapped.param),\n Transform: mapped => extractSingleParams(mapped.param),\n Optional: optional => extractSingleParams(optional.param),\n Variadic: variadic => extractSingleParams(variadic.param)\n });\n};\n/**\n * Gets the underlying Single param from a potentially nested param structure.\n * Throws an error if there are no singles or multiple singles found.\n *\n * @internal\n */\nexport const getUnderlyingSingleOrThrow = param => {\n const singles = extractSingleParams(param);\n if (singles.length === 0) {\n throw new Error(\"No Single param found in param structure\");\n }\n if (singles.length > 1) {\n throw new Error(`Multiple Single params found: ${singles.map(s => s.name).join(\", \")}`);\n }\n return singles[0];\n};\n/**\n * Gets param metadata by traversing the structure.\n *\n * @internal\n */\nexport const getParamMetadata = param => {\n return matchParam(param, {\n Single: () => ({\n isOptional: false,\n isVariadic: false\n }),\n Map: mapped => getParamMetadata(mapped.param),\n Transform: mapped => getParamMetadata(mapped.param),\n Optional: optional => ({\n ...getParamMetadata(optional.param),\n isOptional: true\n }),\n Variadic: variadic => ({\n ...getParamMetadata(variadic.param),\n isVariadic: true\n })\n });\n};\n//# sourceMappingURL=Param.js.map",
|
|
88
|
+
"import { dual } from \"../../Function.js\";\nimport * as Param from \"./Param.js\";\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Creates a positional string argument.\n *\n * **Example** (Creating a string argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const filename = Argument.string(\"filename\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const string = name => Param.string(Param.argumentKind, name);\n/**\n * Creates a positional integer argument.\n *\n * **Example** (Creating an integer argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const count = Argument.integer(\"count\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const integer = name => Param.integer(Param.argumentKind, name);\n/**\n * Creates a positional file path argument.\n *\n * **Example** (Creating file path arguments)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const inputFile = Argument.file(\"input\", { mustExist: true }) // Must exist\n * const outputFile = Argument.file(\"output\", { mustExist: false }) // Must not exist\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (name, options) => Param.file(Param.argumentKind, name, options);\n/**\n * Creates a positional directory path argument.\n *\n * **Example** (Creating a directory path argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const workspace = Argument.directory(\"workspace\", { mustExist: true }) // Must exist\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const directory = (name, options) => Param.directory(Param.argumentKind, name, options);\n/**\n * Creates a positional float argument.\n *\n * **Example** (Creating a float argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const ratio = Argument.float(\"ratio\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const float = name => Param.float(Param.argumentKind, name);\n/**\n * Creates a positional date argument.\n *\n * **Example** (Creating a date argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const startDate = Argument.date(\"start-date\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const date = name => Param.date(Param.argumentKind, name);\n/**\n * Creates a positional choice argument.\n *\n * **Example** (Creating a choice argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const environment = Argument.choice(\"environment\", [\"dev\", \"staging\", \"prod\"])\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choice = (name, choices) => Param.choice(Param.argumentKind, name, choices);\n/**\n * Creates a positional path argument.\n *\n * **Example** (Creating a path argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const configPath = Argument.path(\"config\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const path = (name, options) => Param.path(Param.argumentKind, name, options);\n/**\n * Creates a positional redacted argument that obscures its value.\n *\n * **Example** (Creating a redacted argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const secret = Argument.redacted(\"secret\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redacted = name => Param.redacted(Param.argumentKind, name);\n/**\n * Creates a positional argument that reads file content as a string.\n *\n * **Example** (Reading file text)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const config = Argument.fileText(\"config-file\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileText = name => Param.fileText(Param.argumentKind, name);\n/**\n * Creates a positional argument that reads a file and parses its content.\n *\n * **Details**\n *\n * The parser is chosen from the explicit `format` option or, when omitted, the\n * file extension. The parsed value is `unknown`; use `fileSchema` when the\n * parsed content should also be decoded with a Schema.\n *\n * **Example** (Parsing file content)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const config = Argument.fileParse(\"config\", { format: \"json\" })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileParse = (name, options) => Param.fileParse(Param.argumentKind, name, options);\n/**\n * Creates a positional argument that reads and validates file content using a schema.\n *\n * **Example** (Validating file content with a schema)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const ConfigSchema = Schema.Struct({\n * port: Schema.Number,\n * host: Schema.String\n * })\n *\n * const config = Argument.fileSchema(\"config\", ConfigSchema)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileSchema = (name, schema, options) => Param.fileSchema(Param.argumentKind, name, schema, options);\n/**\n * Creates an empty sentinel argument that always fails to parse.\n *\n * **Example** (Creating a sentinel argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * // Used as a placeholder or default in combinators\n * const noArg = Argument.none\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const none = /*#__PURE__*/Param.none(Param.argumentKind);\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * Makes a positional argument optional.\n *\n * **Example** (Making an argument optional)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const optionalVersion = Argument.string(\"version\").pipe(Argument.optional)\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const optional = arg => Param.optional(arg);\n/**\n * Adds a description to a positional argument.\n *\n * **Example** (Adding an argument description)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const filename = Argument.string(\"filename\").pipe(\n * Argument.withDescription(\"The input file to process\")\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withDescription = /*#__PURE__*/dual(2, (self, description) => Param.withDescription(self, description));\n/**\n * Provides a default value for a positional argument.\n *\n * **Example** (Providing a default value)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const port = Argument.integer(\"port\").pipe(Argument.withDefault(8080))\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withDefault = Param.withDefault;\n/**\n * Adds a fallback config that is loaded when a required argument is missing.\n *\n * **Example** (Loading a fallback config)\n *\n * ```ts\n * import { Config } from \"effect\"\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const repository = Argument.string(\"repository\").pipe(\n * Argument.withFallbackConfig(Config.string(\"REPOSITORY\"))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withFallbackConfig = /*#__PURE__*/dual(2, (self, config) => Param.withFallbackConfig(self, config));\n/**\n * Adds a fallback prompt that is shown when a required argument is missing.\n *\n * **Example** (Showing a fallback prompt)\n *\n * ```ts\n * import { Argument, Prompt } from \"effect/unstable/cli\"\n *\n * const filename = Argument.string(\"filename\").pipe(\n * Argument.withFallbackPrompt(Prompt.text({ message: \"Filename\" }))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withFallbackPrompt = /*#__PURE__*/dual(2, (self, prompt) => Param.withFallbackPrompt(self, prompt));\n/**\n * Creates a variadic positional argument that accepts multiple values.\n *\n * **Example** (Accepting multiple values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * // Accept any number of files\n * const anyFiles = Argument.string(\"files\").pipe(Argument.variadic)\n *\n * // Accept at least 1 file\n * const atLeastOneFile = Argument.string(\"files\").pipe(\n * Argument.variadic({ min: 1 })\n * )\n *\n * // Accept between 1 and 5 files\n * const limitedFiles = Argument.string(\"files\").pipe(\n * Argument.variadic({ min: 1, max: 5 })\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const variadic = /*#__PURE__*/dual(args => Param.isParam(args[0]), (self, options) => Param.variadic(self, options));\n/**\n * Transforms the parsed value of a positional argument.\n *\n * **Example** (Mapping parsed values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const port = Argument.integer(\"port\").pipe(\n * Argument.map((p) => ({ port: p, url: `http://localhost:${p}` }))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => Param.map(self, f));\n/**\n * Transforms the parsed value of a positional argument using an effectful function.\n *\n * **Example** (Validating values effectfully)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { Argument, CliError } from \"effect/unstable/cli\"\n *\n * const files = Argument.string(\"files\").pipe(\n * Argument.mapEffect((file) =>\n * file.endsWith(\".txt\")\n * ? Effect.succeed(file)\n * : Effect.fail(\n * new CliError.UserError({\n * cause: new Error(\"Only .txt files allowed\")\n * })\n * )\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mapEffect = /*#__PURE__*/dual(2, (self, f) => Param.mapEffect(self, f));\n/**\n * Transforms the parsed value of a positional argument using a function that may throw.\n *\n * **Example** (Mapping values that may throw)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const json = Argument.string(\"data\").pipe(\n * Argument.mapTryCatch(\n * (str) => JSON.parse(str),\n * (error) =>\n * `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mapTryCatch = /*#__PURE__*/dual(3, (self, f, onError) => Param.mapTryCatch(self, f, onError));\n/**\n * Creates a variadic argument that requires at least n values.\n *\n * **Example** (Requiring a minimum number of values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const files = Argument.string(\"files\").pipe(Argument.atLeast(1))\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const atLeast = /*#__PURE__*/dual(2, (self, min) => Param.atLeast(self, min));\n/**\n * Creates a variadic argument that accepts at most n values.\n *\n * **Example** (Limiting the maximum number of values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const files = Argument.string(\"files\").pipe(Argument.atMost(5))\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const atMost = /*#__PURE__*/dual(2, (self, max) => Param.atMost(self, max));\n/**\n * Creates a variadic argument that accepts between min and max values.\n *\n * **Example** (Requiring a range of values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const files = Argument.string(\"files\").pipe(Argument.between(1, 5))\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const between = /*#__PURE__*/dual(3, (self, min, max) => Param.between(self, min, max));\n/**\n * Validates parsed values against a Schema.\n *\n * **Example** (Validating parsed values with a schema)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const input = Argument.string(\"input\").pipe(\n * Argument.withSchema(Schema.NonEmptyString)\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withSchema = /*#__PURE__*/dual(2, (self, schema) => Param.withSchema(self, schema));\n/**\n * Creates a positional choice argument with custom value mapping.\n *\n * **Example** (Mapping choices to values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const logLevel = Argument.choiceWithValue(\"level\", [\n * [\"debug\", 0],\n * [\"info\", 1],\n * [\"warn\", 2],\n * [\"error\", 3]\n * ])\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choiceWithValue = (name, choices) => Param.choiceWithValue(Param.argumentKind, name, choices);\n// -------------------------------------------------------------------------------------\n// metadata\n// -------------------------------------------------------------------------------------\n/**\n * Sets a custom metavar (placeholder name) for the argument in help documentation.\n *\n * **Details**\n *\n * The metavar is displayed in usage text to indicate what value the user should provide.\n * For example, `<FILE>` shows `FILE` as the metavar.\n *\n * **Example** (Setting a metavar)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const port = Argument.integer(\"port\").pipe(\n * Argument.withMetavar(\"PORT\")\n * )\n * ```\n *\n * @category metadata\n * @since 4.0.0\n */\nexport const withMetavar = /*#__PURE__*/dual(2, (self, metavar) => Param.withMetavar(self, metavar));\n/**\n * Filters parsed values, failing with a custom error message if the predicate returns false.\n *\n * **Example** (Filtering parsed values)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const positiveInt = Argument.integer(\"count\").pipe(\n * Argument.filter(\n * (n) => n > 0,\n * (n) => `Expected positive integer, got ${n}`\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const filter = /*#__PURE__*/dual(3, (self, predicate, onFalse) => Param.filter(self, predicate, onFalse));\n/**\n * Filters and transforms parsed values, failing with a custom error message\n * if the filter function returns None.\n *\n * **Example** (Filtering and mapping parsed values)\n *\n * ```ts\n * import { Option } from \"effect\"\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const positiveInt = Argument.integer(\"count\").pipe(\n * Argument.filterMap(\n * (n) => n > 0 ? Option.some(n) : Option.none(),\n * (n) => `Expected positive integer, got ${n}`\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const filterMap = /*#__PURE__*/dual(3, (self, f, onNone) => Param.filterMap(self, f, onNone));\n/**\n * Provides a fallback argument to use if this argument fails to parse.\n *\n * **Example** (Providing a fallback argument)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const value = Argument.integer(\"value\").pipe(\n * Argument.orElse(() => Argument.string(\"value\"))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const orElse = /*#__PURE__*/dual(2, (self, that) => Param.orElse(self, that));\n/**\n * Provides a fallback argument, wrapping results in Result to distinguish which succeeded.\n *\n * **Example** (Returning which fallback succeeded)\n *\n * ```ts\n * import { Argument } from \"effect/unstable/cli\"\n *\n * const source = Argument.file(\"source\").pipe(\n * Argument.orElseResult(() => Argument.string(\"url\"))\n * )\n * // Returns Result<string, string>\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const orElseResult = /*#__PURE__*/dual(2, (self, that) => Param.orElseResult(self, that));\n//# sourceMappingURL=Argument.js.map",
|
|
89
|
+
"import { dual } from \"../../Function.js\";\nimport * as Param from \"./Param.js\";\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Creates a string flag that accepts text input.\n *\n * **Example** (Creating string flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const nameFlag = Flag.string(\"name\")\n * // Usage: --name \"John Doe\"\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const string = name => Param.string(Param.flagKind, name);\n/**\n * Creates a boolean flag that can be enabled or disabled.\n *\n * **Example** (Creating boolean flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const verboseFlag = Flag.boolean(\"verbose\")\n * // Usage: --verbose (true) or --no-verbose (false)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const boolean = name => Param.boolean(Param.flagKind, name);\n/**\n * Creates an integer flag that accepts whole number input.\n *\n * **Example** (Creating integer flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const portFlag = Flag.integer(\"port\")\n * // Usage: --port 8080\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const integer = name => Param.integer(Param.flagKind, name);\n/**\n * Creates a float flag that accepts decimal number input.\n *\n * **Example** (Creating float flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const rateFlag = Flag.float(\"rate\")\n * // Usage: --rate 3.14\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const float = name => Param.float(Param.flagKind, name);\n/**\n * Creates a date flag that accepts date input in ISO format.\n *\n * **Example** (Creating date flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const startDateFlag = Flag.date(\"start-date\")\n * // Usage: --start-date 2023-12-25\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const date = name => Param.date(Param.flagKind, name);\n/**\n * Constructs option parameters that represent a choice between several inputs.\n * Each tuple maps a string flag value to an associated typed value.\n *\n * **Example** (Creating flag choices with values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // simple enum like choice mapping directly to string union\n * const color = Flag.choice(\"color\", [\"red\", \"green\", \"blue\"])\n *\n * // choice with custom value mapping\n * const logLevel = Flag.choiceWithValue(\"log-level\", [\n * [\"debug\", \"Debug\" as const],\n * [\"info\", \"Info\" as const],\n * [\"error\", \"Error\" as const]\n * ])\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choiceWithValue = (name, choices) => Param.choiceWithValue(Param.flagKind, name, choices);\n/**\n * Creates a flag that accepts one of the provided string choices and returns\n * the selected string.\n *\n * **When to use**\n *\n * Use when a named option must be restricted to a fixed set of string values\n * and no custom value mapping is needed.\n *\n * **Gotchas**\n *\n * An empty choices array compiles, but no input value can parse successfully.\n *\n * @see {@link choiceWithValue} for mapping accepted strings to different typed values\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const choice = (name, choices) => Param.choice(Param.flagKind, name, choices);\n/**\n * Creates a path flag that accepts file system path input with validation options.\n *\n * **Example** (Creating path flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Basic path flag\n * const pathFlag = Flag.path(\"config-path\")\n *\n * // File-only path that must exist\n * const fileFlag = Flag.path(\"input-file\", {\n * pathType: \"file\",\n * mustExist: true\n * })\n *\n * // Directory path with custom type name\n * const dirFlag = Flag.path(\"output-dir\", {\n * pathType: \"directory\",\n * typeName: \"OUTPUT_DIRECTORY\"\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const path = (name, options) => Param.path(Param.flagKind, name, options);\n/**\n * Creates a file path flag that accepts file paths with optional existence validation.\n *\n * **Example** (Creating file flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Basic file flag\n * const inputFlag = Flag.file(\"input\")\n * // Usage: --input ./data.json\n *\n * // File that must exist\n * const configFlag = Flag.file(\"config\", { mustExist: true })\n * // Usage: --config ./config.yaml (file must exist)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (name, options) => Param.file(Param.flagKind, name, options);\n/**\n * Creates a directory path flag that accepts directory paths with optional existence validation.\n *\n * **Example** (Creating directory flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Basic directory flag\n * const outputFlag = Flag.directory(\"output\")\n * // Usage: --output ./build\n *\n * // Directory that must exist\n * const sourceFlag = Flag.directory(\"source\", { mustExist: true })\n * // Usage: --source ./src (directory must exist)\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const directory = (name, options) => Param.directory(Param.flagKind, name, options);\n/**\n * Creates a string flag whose parsed value is wrapped in `Redacted.Redacted` so\n * stringification and logging redact the value.\n *\n * **Gotchas**\n *\n * Values supplied on the command line may still be visible to the operating\n * system or shell history.\n *\n * **Example** (Creating redacted flags)\n *\n * ```ts\n * import { Effect, Redacted } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const passwordFlag = Flag.redacted(\"password\")\n *\n * const program = Effect.gen(function*() {\n * const [leftover, password] = yield* passwordFlag.parse({\n * arguments: [],\n * flags: { \"password\": [\"abc123\"] }\n * })\n * const value = Redacted.value(password) // Access the underlying value\n * console.log(\"Password length:\", value.length)\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redacted = name => Param.redacted(Param.flagKind, name);\n/**\n * Creates a flag that reads and returns file content as a string.\n *\n * **Example** (Reading file text)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const config = Flag.fileText(\"config-file\")\n * // --config-file ./app.json will read the file content\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileText = name => Param.fileText(Param.flagKind, name);\n/**\n * Creates a flag that reads and parses the content of the specified file.\n *\n * **Details**\n *\n * The parser that is utilized will depend on the specified `format`, or the\n * extension of the file passed on the command-line if no `format` is specified.\n *\n * **Example** (Parsing file contents)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Will use the extension of the file passed on the command line to determine\n * // the parser to use\n * const config = Flag.fileParse(\"config\")\n *\n * // Will use the JSON parser\n * const jsonConfig = Flag.fileParse(\"json-config\", { format: \"json\" })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileParse = (name, options) => Param.fileParse(Param.flagKind, name, options);\n/**\n * Creates a flag that reads and validates file content using the specified\n * schema.\n *\n * **Example** (Validating file contents)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const ConfigSchema = Schema.Struct({\n * port: Schema.Number,\n * host: Schema.String\n * })\n *\n * const config = Flag.fileSchema(\"config\", ConfigSchema, { format: \"json\" })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileSchema = (name, schema, options) => Param.fileSchema(Param.flagKind, name, schema, options);\n/**\n * Creates a flag that parses key=value pairs.\n *\n * **When to use**\n *\n * Use when you use this for options that accept configuration values.\n *\n * **Details**\n *\n * Requires at least one key=value pair. Multiple pairs are merged into a single\n * record.\n *\n * **Example** (Parsing key-value pairs)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const env = Flag.keyValuePair(\"env\")\n * // --env FOO=bar --env BAZ=qux will parse to { FOO: \"bar\", BAZ: \"qux\" }\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const keyValuePair = name => Param.keyValuePair(Param.flagKind, name);\n/**\n * Creates an empty sentinel flag that always fails to parse.\n * This is useful for creating placeholder flags or for combinators.\n *\n * **Example** (Creating sentinel flags)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const makeValueFlag = (includeValue: boolean) =>\n * includeValue ? Flag.string(\"value\") : Flag.none\n *\n * console.log(makeValueFlag(true) === Flag.none) // false\n * console.log(makeValueFlag(false) === Flag.none) // true\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const none = /*#__PURE__*/Param.none(Param.flagKind);\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * Adds an alias to a flag, allowing it to be referenced by multiple names.\n *\n * **Example** (Adding flag aliases)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Flag can be used as both --verbose and -v\n * const verboseFlag = Flag.boolean(\"verbose\").pipe(\n * Flag.withAlias(\"v\")\n * )\n *\n * // Multiple aliases can be chained\n * const helpFlag = Flag.boolean(\"help\").pipe(\n * Flag.withAlias(\"h\"),\n * Flag.withAlias(\"?\")\n * )\n * ```\n *\n * @category aliasing\n * @since 4.0.0\n */\nexport const withAlias = /*#__PURE__*/dual(2, (self, alias) => Param.withAlias(self, alias));\n/**\n * Adds a description to a flag for help documentation.\n *\n * **Example** (Adding help descriptions)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const portFlag = Flag.integer(\"port\").pipe(\n * Flag.withDescription(\"The port number to listen on\")\n * )\n *\n * const configFlag = Flag.file(\"config\").pipe(\n * Flag.withDescription(\"Path to the configuration file\")\n * )\n * ```\n *\n * @category help documentation\n * @since 4.0.0\n */\nexport const withDescription = /*#__PURE__*/dual(2, (self, description) => Param.withDescription(self, description));\n// -------------------------------------------------------------------------------------\n// metadata\n// -------------------------------------------------------------------------------------\n/**\n * Sets a custom metavar (placeholder name) for the flag in help documentation.\n *\n * **Details**\n *\n * The metavar is displayed in usage text to indicate what value the user should\n * provide. For example, `--output FILE` shows `FILE` as the metavar.\n *\n * **Example** (Setting metavars)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const databaseFlag = Flag.string(\"database-url\").pipe(\n * Flag.withMetavar(\"URL\"),\n * Flag.withDescription(\"Database connection URL\")\n * )\n * // In help: --database-url URL\n *\n * const timeoutFlag = Flag.integer(\"timeout\").pipe(\n * Flag.withMetavar(\"SECONDS\")\n * )\n * // In help: --timeout SECONDS\n * ```\n *\n * @category metadata\n * @since 4.0.0\n */\nexport const withMetavar = /*#__PURE__*/dual(2, (self, metavar) => Param.withMetavar(self, metavar));\n/**\n * Hides a flag from generated help output and shell completions while keeping\n * it fully parseable on the command line.\n *\n * **When to use**\n *\n * Use when you use this for experimental or internal flags that should be accepted but not\n * advertised, such as `--experimental-foo`, debug toggles, or escape hatches\n * that are not yet committed to the public CLI surface.\n *\n * **Example** (Hiding a flag from help)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Flag still parses --experimental-foo, but it does not appear in --help.\n * const experimental = Flag.boolean(\"experimental-foo\").pipe(\n * Flag.withHidden\n * )\n * ```\n *\n * @category metadata\n * @since 4.0.0\n */\nexport const withHidden = self => Param.withHidden(self);\n/**\n * Makes a flag optional, returning an Option type that can be None if not provided.\n *\n * **Example** (Making flags optional)\n *\n * ```ts\n * import { Effect, Option } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const optionalPort = Flag.optional(Flag.integer(\"port\"))\n *\n * const program = Effect.gen(function*() {\n * const [leftover, port] = yield* optionalPort.parse({\n * arguments: [],\n * flags: { \"port\": [\"4000\"] }\n * })\n * if (Option.isSome(port)) {\n * console.log(\"Port specified:\", port.value)\n * } else {\n * console.log(\"No port specified, using default\")\n * }\n * })\n * ```\n *\n * @category optionality\n * @since 4.0.0\n */\nexport const optional = param => Param.optional(param);\n/**\n * Provides a default value for a flag when it's not specified.\n *\n * **Example** (Providing default values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const portFlag = Flag.integer(\"port\").pipe(\n * Flag.withDefault(8080)\n * )\n * // If --port is not provided, defaults to 8080\n *\n * const hostFlag = Flag.string(\"host\").pipe(\n * Flag.withDefault(\"localhost\")\n * )\n * // If --host is not provided, defaults to \"localhost\"\n * ```\n *\n * @category optionality\n * @since 4.0.0\n */\nexport const withDefault = Param.withDefault;\n/**\n * Adds a fallback config that is loaded when a required flag is missing.\n *\n * **Example** (Falling back to config)\n *\n * ```ts\n * import { Config } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const verbose = Flag.boolean(\"verbose\").pipe(\n * Flag.withFallbackConfig(Config.boolean(\"VERBOSE\"))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withFallbackConfig = /*#__PURE__*/dual(2, (self, config) => Param.withFallbackConfig(self, config));\n/**\n * Adds a fallback prompt that is shown when a required flag is missing.\n *\n * **Example** (Falling back to prompts)\n *\n * ```ts\n * import { Flag, Prompt } from \"effect/unstable/cli\"\n *\n * const name = Flag.string(\"name\").pipe(\n * Flag.withFallbackPrompt(Prompt.text({ message: \"Name\" }))\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withFallbackPrompt = /*#__PURE__*/dual(2, (self, prompt) => Param.withFallbackPrompt(self, prompt));\n/**\n * Transforms the parsed value of a flag using a mapping function.\n *\n * **Example** (Mapping parsed values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Convert string to uppercase\n * const nameFlag = Flag.string(\"name\").pipe(\n * Flag.map((name) => name.toUpperCase())\n * )\n *\n * // Convert port to URL\n * const urlFlag = Flag.integer(\"port\").pipe(\n * Flag.map((port) => `http://localhost:${port}`)\n * )\n * ```\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => Param.map(self, f));\n/**\n * Transforms the parsed value using an Effect that can perform IO operations.\n *\n * **Example** (Mapping parsed values effectfully)\n *\n * ```ts\n * import { Effect, FileSystem } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Read file size from path flag\n * const fileSizeFlag = Flag.file(\"input\").pipe(\n * Flag.mapEffect(Effect.fnUntraced(function*(path) {\n * const fs = yield* FileSystem.FileSystem\n * const stats = yield* Effect.orDie(fs.stat(path))\n * return stats.size\n * }))\n * )\n * ```\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const mapEffect = /*#__PURE__*/dual(2, (self, f) => Param.mapEffect(self, f));\n/**\n * Transforms the parsed value using a function that might throw, with error handling.\n *\n * **Example** (Mapping thrown errors)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Parse JSON string with error handling\n * const jsonFlag = Flag.string(\"config\").pipe(\n * Flag.mapTryCatch(\n * (json) => JSON.parse(json),\n * (error) => `Invalid JSON: ${error}`\n * )\n * )\n *\n * // Parse URL with error handling\n * const urlFlag = Flag.string(\"url\").pipe(\n * Flag.mapTryCatch(\n * (url) => new URL(url),\n * (error) => `Invalid URL: ${error}`\n * )\n * )\n * ```\n *\n * @category mapping\n * @since 4.0.0\n */\nexport const mapTryCatch = /*#__PURE__*/dual(3, (self, f, onError) => Param.mapTryCatch(self, f, onError));\n/**\n * Ensures a flag is specified at least a minimum number of times.\n *\n * **Example** (Requiring repeated values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const sourceFlag = Flag.atLeast(Flag.file(\"source\"), 2)\n * // Requires at least 2 source files\n * // Usage: --source file1.ts --source file2.ts\n *\n * const tagFlag = Flag.string(\"tag\").pipe(\n * Flag.atLeast(1)\n * )\n * // Requires at least 1 tag\n * ```\n *\n * @category repetition\n * @since 4.0.0\n */\nexport const atLeast = /*#__PURE__*/dual(2, (self, min) => Param.atLeast(self, min));\n/**\n * Ensures a flag is specified at most a maximum number of times.\n *\n * **Example** (Limiting repeated values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const warningFlag = Flag.atMost(Flag.string(\"warning\"), 3)\n * // Allows up to 3 warning flags\n * // Usage: --warning w1 --warning w2 --warning w3\n *\n * const debugFlag = Flag.string(\"debug\").pipe(\n * Flag.atMost(1)\n * )\n * // Allows at most 1 debug flag\n * ```\n *\n * @category repetition\n * @since 4.0.0\n */\nexport const atMost = /*#__PURE__*/dual(2, (self, max) => Param.atMost(self, max));\n/**\n * Ensures a flag is specified between a minimum and maximum number of times.\n *\n * **Example** (Bounding repeated values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const hostFlag = Flag.between(Flag.string(\"host\"), 1, 3)\n * // Requires 1-3 host flags\n * // Usage: --host host1 --host host2\n *\n * const excludeFlag = Flag.string(\"exclude\").pipe(\n * Flag.between(0, 5)\n * )\n * // Allows 0-5 exclude patterns\n * ```\n *\n * @category repetition\n * @since 4.0.0\n */\nexport const between = /*#__PURE__*/dual(3, (self, min, max) => Param.between(self, min, max));\n/**\n * Transforms and filters a flag value, failing with a custom error if the transformation returns None.\n *\n * **Example** (Filtering and transforming values)\n *\n * ```ts\n * import { Option } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Parse positive integers only\n * const positiveInt = Flag.integer(\"count\").pipe(\n * Flag.filterMap(\n * (n) => n > 0 ? Option.some(n) : Option.none(),\n * (n) => `Expected positive integer, got ${n}`\n * )\n * )\n *\n * // Parse valid email addresses\n * const emailFlag = Flag.string(\"email\").pipe(\n * Flag.filterMap(\n * (email) => email.includes(\"@\") ? Option.some(email) : Option.none(),\n * (email) => `Invalid email address: ${email}`\n * )\n * )\n * ```\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filterMap = /*#__PURE__*/dual(3, (self, f, onNone) => Param.filterMap(self, f, onNone));\n/**\n * Filters a flag value based on a predicate, failing with a custom error if the predicate returns false.\n *\n * **Example** (Filtering parsed values)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Ensure port is in valid range\n * const portFlag = Flag.integer(\"port\").pipe(\n * Flag.filter(\n * (port) => port >= 1 && port <= 65535,\n * (port) => `Port ${port} is out of range (1-65535)`\n * )\n * )\n *\n * // Ensure non-empty string\n * const nameFlag = Flag.string(\"name\").pipe(\n * Flag.filter(\n * (name) => name.trim().length > 0,\n * () => \"Name cannot be empty\"\n * )\n * )\n * ```\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const filter = /*#__PURE__*/dual(3, (self, predicate, onFalse) => Param.filter(self, predicate, onFalse));\n/**\n * Provides an alternative flag if the first one fails to parse.\n *\n * **Example** (Falling back to another flag)\n *\n * ```ts\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Try parsing as integer, fallback to string\n * const valueFlag = Flag.orElse(\n * Flag.integer(\"value\"),\n * () => Flag.string(\"value\")\n * )\n *\n * // Multiple input sources with fallback\n * const configFlag = Flag.orElse(\n * Flag.file(\"config\"),\n * () => Flag.string(\"config-url\")\n * )\n * ```\n *\n * @category alternatives\n * @since 4.0.0\n */\nexport const orElse = /*#__PURE__*/dual(2, (self, that) => Param.orElse(self, that));\n/**\n * Tries to parse with the first flag, then the second, returning a Result that indicates which succeeded.\n *\n * **Example** (Returning fallback results)\n *\n * ```ts\n * import { Effect, Result } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * // Try file path, fallback to URL\n * const sourceFlag = Flag.orElseResult(\n * Flag.file(\"source\"),\n * () => Flag.string(\"source-url\")\n * )\n *\n * const program = Effect.gen(function*() {\n * const [leftover, source] = yield* sourceFlag.parse({\n * arguments: [],\n * flags: { \"source-url\": [\"https://google.com\"] }\n * })\n * if (Result.isSuccess(source)) {\n * console.log(\"Using file:\", source.success)\n * } else {\n * console.log(\"Using URL:\", source.failure)\n * }\n * })\n * ```\n *\n * @category alternatives\n * @since 4.0.0\n */\nexport const orElseResult = /*#__PURE__*/dual(2, (self, that) => Param.orElseResult(self, that));\n/**\n * Validates and transforms a flag value using a Schema codec.\n *\n * **Example** (Validating with schemas)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { Flag } from \"effect/unstable/cli\"\n *\n * const isEmail = Schema.isPattern(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/, {\n * message: \"Must be a valid email address\"\n * })\n *\n * // Parse and validate email with custom schema\n * const EmailSchema = Schema.String.pipe(\n * Schema.check(isEmail)\n * )\n *\n * const emailFlag = Flag.string(\"email\").pipe(\n * Flag.withSchema(EmailSchema)\n * )\n *\n * // Parse JSON configuration with schema validation\n * const ConfigSchema = Schema.Struct({\n * port: Schema.Number,\n * host: Schema.String,\n * ssl: Schema.optional(Schema.Boolean)\n * }).pipe(Schema.fromJsonString)\n *\n * const configFlag = Flag.string(\"config\").pipe(\n * Flag.withSchema(ConfigSchema)\n * )\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const withSchema = /*#__PURE__*/dual(2, (self, schema) => Param.withSchema(self, schema));\n//# sourceMappingURL=Flag.js.map",
|
|
90
|
+
"import { dual } from \"./Function.js\";\nimport * as core from \"./internal/core.js\";\nimport * as effect from \"./internal/effect.js\";\n/**\n * Context reference for the current console service in the Effect system, allowing access to the active console implementation from within the Effect context.\n *\n * **When to use**\n *\n * Use when an Effect program needs the current console service as a context\n * reference, such as when providing or overriding a console implementation.\n *\n * **Details**\n *\n * When no override is provided, the reference resolves to `globalThis.console`.\n *\n * **Example** (Accessing the current console)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Console.consoleWith((console) =>\n * Effect.sync(() => {\n * console.log(\"Hello from current console!\")\n * })\n * )\n * ```\n *\n * @see {@link consoleWith} for using the current console service inside an effect\n *\n * @category references\n * @since 2.0.0\n */\nexport const Console = effect.ConsoleRef;\n/**\n * Creates an Effect that provides access to the current console service and lets you perform operations with it within an Effect context.\n *\n * **Example** (Using the current console service)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Console.consoleWith((console) =>\n * Effect.sync(() => {\n * console.log(\"Hello, world!\")\n * console.error(\"This is an error message\")\n * })\n * )\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const consoleWith = f => core.withFiber(fiber => f(fiber.getRef(Console)));\n/**\n * Writes the supplied assertion message to the console as an error when `condition` is false; when `condition` is true, no console output is produced.\n *\n * **Example** (Logging failed assertions)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.assert(2 + 2 === 4, \"Math is working correctly\")\n * yield* Console.assert(2 + 2 === 5, \"This will be logged as an error\")\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const assert = (condition, ...args) => consoleWith(console => effect.sync(() => {\n console.assert(condition, ...args);\n}));\n/**\n * Runs the current console service's clear operation.\n *\n * **When to use**\n *\n * Use to request that the active console implementation clear its visible\n * output.\n *\n * **Gotchas**\n *\n * The clearing behavior depends on the active console implementation and host\n * environment.\n *\n * **Example** (Clearing console output)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.log(\"This will be cleared\")\n * yield* Console.clear\n * yield* Console.log(\"This appears after clearing\")\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const clear = /*#__PURE__*/consoleWith(console => effect.sync(() => {\n console.clear();\n}));\n/**\n * Logs and increments the counter associated with `label`, using the console's default counter when no label is provided.\n *\n * **Example** (Counting repeated calls)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.count(\"my-counter\")\n * yield* Console.count(\"my-counter\") // Will show: my-counter: 2\n * yield* Console.count() // Default counter\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const count = label => consoleWith(console => effect.sync(() => {\n console.count(label);\n}));\n/**\n * Resets the counter associated with the specified label back to zero.\n *\n * **Example** (Resetting a counter)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.count(\"my-counter\")\n * yield* Console.count(\"my-counter\") // Will show: my-counter: 2\n * yield* Console.countReset(\"my-counter\")\n * yield* Console.count(\"my-counter\") // Will show: my-counter: 1\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const countReset = label => consoleWith(console => effect.sync(() => {\n console.countReset(label);\n}));\n/**\n * Writes a debug message through the current `Console` service.\n *\n * **Details**\n *\n * The arguments are passed to the service's `debug` method when the returned\n * Effect is executed. Any filtering behavior depends on the active console\n * implementation.\n *\n * **Example** (Writing debug messages)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.debug(\"Debug info:\", { userId: 123, action: \"login\" })\n * yield* Console.debug(\"Processing step\", 1, \"of\", 5)\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const debug = (...args) => consoleWith(console => effect.sync(() => {\n console.debug(...args);\n}));\n/**\n * Displays an interactive list of the properties of the specified object, optionally using console-specific inspection options for debugging complex data structures.\n *\n * **Example** (Inspecting an object)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const obj = { name: \"John\", age: 30, nested: { city: \"New York\" } }\n * yield* Console.dir(obj)\n * yield* Console.dir(obj, { depth: 2, colors: true })\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const dir = (item, options) => consoleWith(console => effect.sync(() => {\n console.dir(item, options);\n}));\n/**\n * Displays an interactive tree of descendant XML or HTML elements, which is particularly useful for inspecting DOM elements in browser environments.\n *\n * **Example** (Inspecting XML-like data)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.dirxml(\"<user id=\\\"1\\\">Ada</user>\")\n * })\n *\n * Effect.runSync(program)\n * // <user id=\"1\">Ada</user>\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const dirxml = (...args) => consoleWith(console => effect.sync(() => {\n console.dirxml(...args);\n}));\n/**\n * Writes an error-level message to the console, typically displayed with error\n * styling by the active console implementation.\n *\n * **Example** (Writing error messages)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.error(\"Something went wrong!\")\n * yield* Console.error(\"Error details:\", {\n * code: 500,\n * message: \"Internal Server Error\"\n * })\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const error = (...args) => consoleWith(console => effect.sync(() => {\n console.error(...args);\n}));\n/**\n * Creates a scoped console group, optionally collapsed and labeled, and closes it automatically when the Effect scope is finalized.\n *\n * **Example** (Grouping scoped output)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Effect.scoped(\n * Effect.gen(function*() {\n * yield* Console.group({ label: \"User Processing\" })\n * yield* Console.log(\"Loading user data...\")\n * yield* Console.log(\"Validating user...\")\n * yield* Console.log(\"User processed successfully\")\n * })\n * )\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const group = options => consoleWith(console => effect.acquireRelease(effect.sync(() => {\n if (options?.collapsed) {\n console.groupCollapsed(options.label);\n } else {\n console.group(options?.label);\n }\n}), () => effect.sync(() => {\n console.groupEnd();\n})));\n/**\n * Writes an informational message to the console, typically displayed with info\n * styling by the active console implementation.\n *\n * **Example** (Writing informational messages)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.info(\"Application started successfully\")\n * yield* Console.info(\"Server configuration:\", {\n * port: 3000,\n * env: \"development\"\n * })\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const info = (...args) => consoleWith(console => effect.sync(() => {\n console.info(...args);\n}));\n/**\n * Logs a general-purpose message to the console.\n *\n * **Example** (Writing log messages)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.log(\"Hello, world!\")\n * yield* Console.log(\"User data:\", { name: \"John\", age: 30 })\n * yield* Console.log(\"Processing\", 42, \"items\")\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const log = (...args) => consoleWith(console => effect.sync(() => {\n console.log(...args);\n}));\n/**\n * Displays tabular data as a formatted table in the console, optionally limited to selected properties.\n *\n * **Example** (Displaying tabular data)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const users = [\n * { name: \"John\", age: 30, city: \"New York\" },\n * { name: \"Jane\", age: 25, city: \"London\" },\n * { name: \"Bob\", age: 35, city: \"Paris\" }\n * ]\n * yield* Console.table(users)\n * yield* Console.table(users, [\"name\", \"age\"]) // Only show specific columns\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const table = (tabularData, properties) => consoleWith(console => effect.sync(() => {\n console.table(tabularData, properties);\n}));\n/**\n * Starts a scoped timer for `label` and automatically ends it when the Effect scope is finalized.\n *\n * **Example** (Timing scoped work)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Effect.scoped(\n * Effect.gen(function*() {\n * yield* Console.time(\"operation-timer\")\n * yield* Effect.sleep(\"1 second\")\n * yield* Console.log(\"Operation completed\")\n * // Timer ends automatically when scope closes\n * })\n * )\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const time = label => consoleWith(console => effect.acquireRelease(effect.sync(() => {\n console.time(label);\n}), () => effect.sync(() => {\n console.timeEnd(label);\n})));\n/**\n * Logs the elapsed time for an existing timer without stopping it, allowing progress reports for long-running operations.\n *\n * **Example** (Logging timer progress)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Effect.scoped(\n * Effect.gen(function*() {\n * yield* Console.time(\"long-operation\")\n * yield* Effect.sleep(\"500 millis\")\n * yield* Console.timeLog(\"long-operation\", \"Halfway done\")\n * yield* Effect.sleep(\"500 millis\")\n * // Timer ends when scope closes\n * })\n * )\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const timeLog = (label, ...args) => consoleWith(console => effect.sync(() => {\n console.timeLog(label, ...args);\n}));\n/**\n * Writes the current stack trace to the console to show how the current point in\n * the code was reached.\n *\n * **Example** (Writing stack traces)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.trace(\"Debug trace point\")\n * yield* Console.trace(\"Function call:\", { functionName: \"processData\" })\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const trace = (...args) => consoleWith(console => effect.sync(() => {\n console.trace(...args);\n}));\n/**\n * Writes a warning-level message to the console, typically displayed with\n * warning styling by the active console implementation.\n *\n * **Example** (Writing warning messages)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.warn(\"This feature is deprecated\")\n * yield* Console.warn(\"Performance warning:\", {\n * slowQuery: \"SELECT * FROM large_table\"\n * })\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const warn = (...args) => consoleWith(console => effect.sync(() => {\n console.warn(...args);\n}));\n/**\n * Runs an Effect inside an optionally labeled or collapsed console group, starting the group before execution and ending it after the Effect completes.\n *\n * **Example** (Wrapping an effect in a group)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.withGroup(\n * Effect.gen(function*() {\n * yield* Console.log(\"Step 1: Initialize\")\n * yield* Console.log(\"Step 2: Process\")\n * yield* Console.log(\"Step 3: Complete\")\n * }),\n * { label: \"Processing Steps\", collapsed: false }\n * )\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const withGroup = /*#__PURE__*/dual(args => core.isEffect(args[0]), (self, options) => consoleWith(console => effect.acquireUseRelease(effect.sync(() => {\n if (options?.collapsed) {\n console.groupCollapsed(options.label);\n } else {\n console.group(options?.label);\n }\n}), () => self, () => effect.sync(() => {\n console.groupEnd();\n}))));\n/**\n * Runs an Effect with a console timer, starting the timer before execution and ending it after the Effect completes.\n *\n * **Example** (Timing an effect)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * yield* Console.withTime(\n * Effect.gen(function*() {\n * yield* Effect.sleep(\"1 second\")\n * yield* Console.log(\"Operation completed\")\n * }),\n * \"my-operation\"\n * )\n * })\n * ```\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const withTime = /*#__PURE__*/dual(args => core.isEffect(args[0]), (self, label) => consoleWith(console => effect.acquireUseRelease(effect.sync(() => {\n console.time(label);\n}), () => self, () => effect.sync(() => {\n console.timeEnd(label);\n}))));\n//# sourceMappingURL=Console.js.map",
|
|
91
|
+
"/**\n * Service contract for process standard input, output, error output, and\n * command-line arguments.\n *\n * `Stdio` lets command-line programs depend on standard I/O through the Effect\n * environment instead of reading from or writing to global process handles\n * directly. The service exposes arguments as an `Effect`, stdout and stderr as\n * `Sink`s that accept strings or bytes, and stdin as a byte `Stream`.\n *\n * **Mental model**\n *\n * Application code describes what it needs from standard I/O, and a runtime\n * layer supplies the concrete streams. Platform packages provide real process\n * implementations, while tests can use `Stdio.layerTest` to replace only the\n * fields that matter for a scenario and keep the rest inert.\n *\n * **Common tasks**\n *\n * - Read command-line arguments from the service's `args` effect.\n * - Write text or bytes by running values into the service's `stdout()` or\n * `stderr()` sinks.\n * - Consume `stdin` as a stream of `Uint8Array` chunks.\n * - Build deterministic tests with `Stdio.layerTest`.\n *\n * **Gotchas**\n *\n * Standard I/O is a platform capability. Reads and writes can fail with\n * `PlatformError`, so handle failures in the Effect error channel instead of\n * assuming the process streams are always available.\n *\n * @since 4.0.0\n */\nimport * as Context from \"./Context.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Layer from \"./Layer.js\";\nimport * as Sink from \"./Sink.js\";\nimport * as Stream from \"./Stream.js\";\n/**\n * Runtime identifier stored on `Stdio` service implementations.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `Stdio` service\n * implementations.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/Stdio\";\n/**\n * Service tag for process standard I/O.\n *\n * **When to use**\n *\n * Use when an effect needs command-line arguments or standard I/O streams\n * supplied by its environment.\n *\n * @see {@link make} for constructing a `Stdio` service directly\n * @see {@link layerTest} for a test layer with defaults and overrides\n *\n * @category services\n * @since 4.0.0\n */\nexport const Stdio = /*#__PURE__*/Context.Service(TypeId);\n/**\n * Creates a `Stdio` service implementation from the provided fields and\n * attaches the `Stdio` type identifier.\n *\n * **When to use**\n *\n * Use to assemble a concrete `Stdio` service when you already have\n * implementations for command-line arguments, standard output, standard error,\n * and standard input.\n *\n * **Details**\n *\n * The returned service reuses the supplied fields unchanged and only adds the\n * `Stdio` type identifier; it does not create a `Layer` or provide defaults.\n *\n * @see {@link layerTest} for a test layer with default fields that can be overridden\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => ({\n [TypeId]: TypeId,\n ...options\n});\n/**\n * Creates a test layer for `Stdio`.\n *\n * **When to use**\n *\n * Use to provide deterministic standard I/O in tests while overriding only the\n * command-line arguments, input stream, or output sinks relevant to the case.\n *\n * **Details**\n *\n * Any provided fields override defaults. By default, arguments are empty,\n * standard output and error are draining sinks, and standard input is an empty\n * stream.\n *\n * @see {@link make} for constructing a `Stdio` service directly without a `Layer` or defaults\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerTest = impl => Layer.succeed(Stdio, make({\n args: Effect.succeed([]),\n stdout: () => Sink.drain,\n stderr: () => Sink.drain,\n stdin: Stream.empty,\n ...impl\n}));\n//# sourceMappingURL=Stdio.js.map",
|
|
92
|
+
"/**\n * The `CliOutput` module provides the formatting service used by Effect CLI\n * applications to turn parsed CLI metadata and failures into terminal text.\n * It renders help documents, parser errors, grouped errors, and version output,\n * while allowing applications and tests to replace the formatter through a\n * `Context` service or `Layer`.\n *\n * **Common tasks**\n *\n * - Render generated {@link HelpDoc} values for `--help` output\n * - Display parser failures and validation errors from CLI programs\n * - Customize output for plain text, colored terminals, tests, or alternate\n * formats\n * - Format version strings consistently with the rest of CLI output\n *\n * **Gotchas**\n *\n * - Color output is auto-detected from `process.stdout.isTTY` and `NO_COLOR`,\n * but can be forced with {@link defaultFormatter}\n * - Help tables measure visible width after stripping ANSI escape codes, so\n * colored output stays aligned with plain output\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\n/**\n * Service reference for the CLI output formatter. Provides a default implementation\n * that can be overridden for custom formatting or testing.\n *\n * **Example** (Accessing the output formatter)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliOutput } from \"effect/unstable/cli\"\n *\n * // Access the formatter service\n * const program = Effect.gen(function*() {\n * const formatter = yield* CliOutput.Formatter\n *\n * // Format version information\n * const versionText = formatter.formatVersion(\"my-cli\", \"2.1.0\")\n * console.log(versionText) // \"my-cli v2.1.0\" (with colors if supported)\n *\n * return versionText\n * })\n *\n * // Run with default formatter\n * const result = Effect.runSync(program)\n * ```\n *\n * @category services\n * @since 4.0.0\n */\nexport const Formatter = /*#__PURE__*/Context.Reference(\"effect/cli/CliOutput\", {\n defaultValue: () => defaultFormatter()\n});\n/**\n * Creates a Layer that provides a custom Formatter implementation.\n *\n * **Example** (Providing a custom formatter)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n * import { CliOutput } from \"effect/unstable/cli\"\n *\n * // Create a custom formatter without colors\n * const noColorFormatter = CliOutput.defaultFormatter({ colors: false })\n * const NoColorLayer = CliOutput.layer(noColorFormatter)\n *\n * // Create a program that uses the custom formatter\n * const program = Effect.gen(function*() {\n * const formatter = yield* CliOutput.Formatter\n * const versionText = formatter.formatVersion(\"my-cli\", \"1.0.0\")\n * yield* Console.log(`Using custom formatter: ${versionText}`)\n * }).pipe(\n * Effect.provide(NoColorLayer)\n * )\n *\n * // You can also create completely custom formatters\n * const jsonFormatter: CliOutput.Formatter = {\n * formatHelpDoc: (doc) => JSON.stringify(doc, null, 2),\n * formatCliError: (error) => JSON.stringify({ error: error.message }),\n * formatError: (error) =>\n * JSON.stringify({ type: \"error\", message: error.message }),\n * formatVersion: (name, version) => JSON.stringify({ name, version }),\n * formatErrors: (errors) => JSON.stringify(errors.map((error) => error.message))\n * }\n * const JsonLayer = CliOutput.layer(jsonFormatter)\n * ```\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = formatter => Layer.succeed(Formatter)(formatter);\n/**\n * Creates a default formatter with configurable options.\n *\n * **Example** (Creating default formatters)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { CliError, CliOutput } from \"effect/unstable/cli\"\n *\n * // Create a formatter without colors for tests or CI environments\n * const noColorFormatter = CliOutput.defaultFormatter({ colors: false })\n *\n * // Create a formatter with colors forced on\n * const colorFormatter = CliOutput.defaultFormatter({ colors: true })\n *\n * // Auto-detect colors based on terminal support (default behavior)\n * const autoFormatter = CliOutput.defaultFormatter()\n *\n * const program = Effect.gen(function*() {\n * const formatter = colorFormatter\n *\n * // Format an error with proper styling\n * const error = new CliError.InvalidValue({\n * option: \"foo\",\n * value: \"bar\",\n * expected: \"baz\",\n * kind: \"flag\"\n * })\n * const errorText = formatter.formatError(error)\n * console.log(errorText)\n *\n * // Format version information\n * const versionText = formatter.formatVersion(\"my-tool\", \"1.2.3\")\n * console.log(versionText)\n * })\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const defaultFormatter = options => {\n const globalProcess = globalThis.process;\n const hasProcess = typeof globalProcess === \"object\" && globalProcess !== null;\n const useColor = options?.colors !== undefined ? options.colors\n // Auto-detect based on environment\n : hasProcess && typeof globalProcess.stdout === \"object\" && globalProcess.stdout !== null && globalProcess.stdout.isTTY === true && globalProcess.env?.NO_COLOR !== \"1\";\n // Color palette using ANSI escape codes\n const colors = useColor ? {\n bold: text => `\\x1b[1m${text}\\x1b[0m`,\n dim: text => `\\x1b[2m${text}\\x1b[0m`,\n cyan: text => `\\x1b[36m${text}\\x1b[0m`,\n green: text => `\\x1b[32m${text}\\x1b[0m`,\n blue: text => `\\x1b[34m${text}\\x1b[0m`,\n yellow: text => `\\x1b[33m${text}\\x1b[0m`,\n magenta: text => `\\x1b[35m${text}\\x1b[0m`\n } : {\n bold: text => text,\n dim: text => text,\n cyan: text => text,\n green: text => text,\n blue: text => text,\n yellow: text => text,\n magenta: text => text\n };\n const reset = useColor ? \"\\x1b[0m\" : \"\";\n const red = useColor ? \"\\x1b[31m\" : \"\";\n const bold = useColor ? \"\\x1b[1m\" : \"\";\n return {\n formatHelpDoc: doc => formatHelpDocImpl(doc, colors),\n formatCliError: error => error.message,\n formatError: error => {\n return `\\n${bold}${red}ERROR${reset}\\n ${error.message}${reset}`;\n },\n formatErrors: errors => {\n if (errors.length === 0) return \"\";\n if (errors.length === 1) {\n return `\\n${bold}${red}ERROR${reset}\\n ${errors[0].message}${reset}`;\n }\n // Group errors by _tag\n const grouped = new Map();\n for (const error of errors) {\n const tag = error._tag ?? \"Error\";\n const group = grouped.get(tag) ?? [];\n group.push(error);\n grouped.set(tag, group);\n }\n const sections = [];\n sections.push(`\\n${bold}${red}ERRORS${reset}`);\n for (const [, group] of grouped) {\n for (const error of group) {\n sections.push(` ${error.message}${reset}`);\n }\n }\n return sections.join(\"\\n\");\n },\n formatVersion: (name, version) => `${colors.bold(name)} ${colors.dim(\"v\")}${colors.bold(version)}`\n };\n};\n/**\n * Strips ANSI escape codes from a string to calculate visual width.\n * @internal\n */\nconst stripAnsi = text => {\n // oxlint-disable-next-line no-control-regex\n return text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n};\n/**\n * Gets the visual length of a string (excluding ANSI codes).\n * @internal\n */\nconst visualLength = text => stripAnsi(text).length;\n/**\n * Helper function to pad strings to a specified width.\n * @internal\n */\nconst pad = (s, width) => {\n const actualLength = visualLength(s);\n const padding = Math.max(0, width - actualLength);\n return s + \" \".repeat(padding);\n};\n/**\n * Renders a table with aligned columns.\n * @internal\n */\nconst renderTable = (rows, widthCap) => {\n const maxColumn = Math.max(...rows.map(r => visualLength(r.left))) + 4;\n const col = widthCap === undefined ? maxColumn : Math.min(maxColumn, widthCap);\n return rows.map(({\n left,\n right\n }) => ` ${pad(left, col)}${right}`).join(\"\\n\");\n};\nconst formatSubcommandName = (name, alias) => alias ? `${name}, ${alias}` : name;\n/**\n * Internal implementation of help formatting that accepts configurable color functions.\n * @internal\n */\nconst formatHelpDocImpl = (doc, colors) => {\n const sections = [];\n // Description section\n if (doc.description) {\n sections.push(colors.bold(\"DESCRIPTION\"));\n sections.push(` ${doc.description}`);\n sections.push(\"\");\n }\n // Usage section\n sections.push(colors.bold(\"USAGE\"));\n sections.push(` ${colors.cyan(doc.usage)}`);\n sections.push(\"\");\n // Arguments section\n if (doc.args && doc.args.length > 0) {\n sections.push(colors.bold(\"ARGUMENTS\"));\n const argRows = doc.args.map(arg => {\n let name = arg.name;\n if (arg.variadic) {\n name += \"...\";\n }\n const coloredName = colors.green(name);\n const coloredType = colors.dim(arg.type);\n const nameType = `${coloredName} ${coloredType}`;\n const optionalSuffix = arg.required ? \"\" : colors.dim(\" (optional)\");\n const description = Option.getOrElse(arg.description, () => \"\") + optionalSuffix;\n return {\n left: nameType,\n right: description\n };\n });\n sections.push(renderTable(argRows, 25));\n sections.push(\"\");\n }\n // Flags section\n if (doc.flags.length > 0) {\n sections.push(colors.bold(\"FLAGS\"));\n const flagRows = doc.flags.map(flag => {\n const names = [];\n // Add main name with -- prefix first\n names.push(colors.green(`--${flag.name}`));\n // Add aliases after (like -f) to match expected ordering\n for (const alias of flag.aliases) {\n names.push(colors.green(alias));\n }\n const namesPart = names.join(\", \");\n const typePart = flag.type !== \"boolean\" ? ` ${colors.dim(flag.type)}` : \"\";\n return {\n left: namesPart + typePart,\n right: Option.getOrElse(flag.description, () => \"\")\n };\n });\n sections.push(renderTable(flagRows));\n sections.push(\"\");\n }\n // Global Flags section\n if (doc.globalFlags && doc.globalFlags.length > 0) {\n sections.push(colors.bold(\"GLOBAL FLAGS\"));\n const globalFlagRows = doc.globalFlags.map(flag => {\n const names = [];\n // Add main name with -- prefix first\n names.push(colors.green(`--${flag.name}`));\n // Add aliases after (like -f) to match expected ordering\n for (const alias of flag.aliases) {\n names.push(colors.green(alias));\n }\n const namesPart = names.join(\", \");\n const typePart = flag.type !== \"boolean\" ? ` ${colors.dim(flag.type)}` : \"\";\n return {\n left: namesPart + typePart,\n right: Option.getOrElse(flag.description, () => \"\")\n };\n });\n sections.push(renderTable(globalFlagRows));\n sections.push(\"\");\n }\n // Subcommands section\n if (doc.subcommands && doc.subcommands.length > 0) {\n const ungrouped = doc.subcommands.find(group => group.group === undefined);\n if (ungrouped) {\n sections.push(colors.bold(\"SUBCOMMANDS\"));\n sections.push(renderTable(ungrouped.commands.map(sub => ({\n left: colors.cyan(formatSubcommandName(sub.name, sub.alias)),\n right: sub.shortDescription ?? sub.description\n })), 20));\n if (doc.subcommands.length > 1) {\n sections.push(\"\");\n }\n }\n for (const group of doc.subcommands) {\n if (group.group === undefined) continue;\n sections.push(colors.bold(`${group.group}:`));\n sections.push(renderTable(group.commands.map(sub => ({\n left: colors.cyan(formatSubcommandName(sub.name, sub.alias)),\n right: sub.shortDescription ?? sub.description\n })), 20));\n sections.push(\"\");\n }\n }\n // Examples section\n if (doc.examples && doc.examples.length > 0) {\n sections.push(colors.bold(\"EXAMPLES\"));\n let first = true;\n let previousHadDescription = false;\n for (const example of doc.examples) {\n if (example.description) {\n if (!first) sections.push(\"\");\n sections.push(` ${colors.dim(`# ${example.description}`)}`);\n } else if (previousHadDescription) {\n sections.push(\"\");\n }\n sections.push(` ${colors.cyan(example.command)}`);\n first = false;\n previousHadDescription = !!example.description;\n }\n sections.push(\"\");\n }\n // Remove trailing empty line if present\n if (sections[sections.length - 1] === \"\") {\n sections.pop();\n }\n return sections.join(\"\\n\");\n};\n//# sourceMappingURL=CliOutput.js.map",
|
|
93
|
+
"// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\nconst escapeForBash = s => s.replace(/'/g, \"'\\\\''\");\nconst sanitizeFunctionName = s => s.replace(/[^a-zA-Z0-9_]/g, \"_\");\nconst flagNamesForWordlist = flag => {\n const names = [`--${flag.name}`];\n for (const alias of flag.aliases) {\n names.push(alias.length === 1 ? `-${alias}` : `--${alias}`);\n }\n if (flag.type._tag === \"Boolean\") {\n names.push(`--no-${flag.name}`);\n }\n return names;\n};\n/**\n * Build an associative array mapping each flag form to a group index.\n * At completion time, if any form in a group appears in COMP_WORDS,\n * all forms in that group are removed from the candidate list.\n */\nconst buildFlagGroupDeclarations = (flags, lines) => {\n if (flags.length === 0) return;\n lines.push(` # Build used-flag filter`);\n lines.push(` local -A _flag_groups`);\n let groupIdx = 0;\n for (const flag of flags) {\n const forms = flagNamesForWordlist(flag);\n for (const form of forms) {\n lines.push(` _flag_groups[${form}]=${groupIdx}`);\n }\n groupIdx++;\n }\n lines.push(` local -A _used_groups`);\n lines.push(` for ((i = 1; i < cword; i++)); do`);\n lines.push(` local _g=\"\\${_flag_groups[\\${words[i]}]:-}\"`);\n lines.push(` [[ -n \"$_g\" ]] && _used_groups[$_g]=1`);\n lines.push(` done`);\n lines.push(` local _filtered_flags=\"\"`);\n lines.push(` for _f in ${flags.flatMap(flagNamesForWordlist).join(\" \")}; do`);\n lines.push(` local _g=\"\\${_flag_groups[$_f]:-}\"`);\n lines.push(` [[ -z \"$_g\" || -z \"\\${_used_groups[$_g]:-}\" ]] && _filtered_flags+=\" $_f\"`);\n lines.push(` done`);\n lines.push(``);\n};\nconst flagValueCompletion = type => {\n switch (type._tag) {\n case \"Boolean\":\n return undefined;\n case \"Choice\":\n return `COMPREPLY=( $(compgen -W '${type.values.join(\" \")}' -- \"$cur\") )`;\n case \"Path\":\n if (type.pathType === \"directory\") return `COMPREPLY=( $(compgen -d -- \"$cur\") )`;\n return `COMPREPLY=( $(compgen -f -- \"$cur\") )`;\n default:\n return undefined;\n }\n};\nconst argCompletion = type => {\n switch (type._tag) {\n case \"Choice\":\n return `COMPREPLY=( $(compgen -W '${type.values.join(\" \")}' -- \"$cur\") )`;\n case \"Path\":\n if (type.pathType === \"directory\") return `COMPREPLY=( $(compgen -d -- \"$cur\") )`;\n return `COMPREPLY=( $(compgen -f -- \"$cur\") )`;\n default:\n return undefined;\n }\n};\n// ---------------------------------------------------------------------------\n// Generator\n// ---------------------------------------------------------------------------\nconst generateFunction = (descriptor, parentPath, lines) => {\n const currentPath = [...parentPath, descriptor.name];\n const funcName = `_${currentPath.map(sanitizeFunctionName).join(\"_\")}`;\n lines.push(`${funcName}()`);\n lines.push(`{`);\n lines.push(` local cur prev words cword`);\n lines.push(` _init_completion || return`);\n lines.push(``);\n // Build flag-value dispatch\n const flagsWithValues = descriptor.flags.filter(f => f.type._tag !== \"Boolean\");\n if (flagsWithValues.length > 0) {\n lines.push(` # Flag value completions`);\n lines.push(` case \"$prev\" in`);\n for (const flag of flagsWithValues) {\n const longNames = [`--${flag.name}`];\n for (const alias of flag.aliases) {\n longNames.push(alias.length === 1 ? `-${alias}` : `--${alias}`);\n }\n const completion = flagValueCompletion(flag.type);\n if (completion) {\n lines.push(` ${longNames.join(\"|\")})`);\n lines.push(` ${completion}`);\n lines.push(` return`);\n lines.push(` ;;`);\n }\n }\n lines.push(` esac`);\n lines.push(``);\n }\n // Subcommand dispatch\n if (descriptor.subcommands.length > 0) {\n lines.push(` # Subcommand dispatch`);\n lines.push(` local i cmd`);\n lines.push(` for ((i = 1; i < cword; i++)); do`);\n lines.push(` case \"\\${words[i]}\" in`);\n for (const sub of descriptor.subcommands) {\n const subFuncName = `_${[...currentPath, sub.name].map(sanitizeFunctionName).join(\"_\")}`;\n lines.push(` ${sub.name})`);\n lines.push(` ${subFuncName}`);\n lines.push(` return`);\n lines.push(` ;;`);\n }\n lines.push(` esac`);\n lines.push(` done`);\n lines.push(``);\n }\n // Filter already-used flags (entire alias group removed when any form is used)\n buildFlagGroupDeclarations(descriptor.flags, lines);\n if (descriptor.flags.length > 0 || descriptor.subcommands.length > 0) {\n lines.push(` # Complete flags (filtered) and subcommands`);\n lines.push(` if [[ \"$cur\" == -* ]]; then`);\n if (descriptor.flags.length > 0) {\n lines.push(` COMPREPLY=( $(compgen -W \"$_filtered_flags\" -- \"$cur\") )`);\n }\n lines.push(` return`);\n lines.push(` fi`);\n lines.push(``);\n }\n // Positional argument completion\n const argsWithCompletions = descriptor.arguments.filter(a => argCompletion(a.type) !== undefined);\n if (argsWithCompletions.length > 0) {\n lines.push(` # Positional argument completions`);\n for (const arg of argsWithCompletions) {\n const comp = argCompletion(arg.type);\n lines.push(` ${comp}`);\n lines.push(` return`);\n }\n } else if (descriptor.subcommands.length > 0) {\n const subNames = descriptor.subcommands.map(s => s.name);\n lines.push(` COMPREPLY=( $(compgen -W '${subNames.join(\" \")}' -- \"$cur\") )`);\n }\n lines.push(`}`);\n lines.push(``);\n // Recurse into subcommands\n for (const sub of descriptor.subcommands) {\n generateFunction(sub, currentPath, lines);\n }\n};\n/** @internal */\nexport const generate = (executableName, descriptor) => {\n const lines = [];\n const safeName = sanitizeFunctionName(executableName);\n lines.push(`###-begin-${escapeForBash(executableName)}-completions-###`);\n lines.push(`#`);\n lines.push(`# Static completion script for Bash`);\n lines.push(`#`);\n lines.push(`# Installation:`);\n lines.push(`# ${escapeForBash(executableName)} --completions bash >> ~/.bashrc`);\n lines.push(`#`);\n lines.push(``);\n // Inline minimal _init_completion fallback for environments without\n // bash-completion installed. The real _init_completion handles edge cases\n // (= in options, redirections, etc.) but this covers the common path.\n lines.push(`if ! type _init_completion &>/dev/null; then`);\n lines.push(` _init_completion()`);\n lines.push(` {`);\n lines.push(` COMPREPLY=()`);\n lines.push(` cur=\"\\${COMP_WORDS[COMP_CWORD]}\"`);\n lines.push(` prev=\"\\${COMP_WORDS[COMP_CWORD-1]}\"`);\n lines.push(` words=(\"\\${COMP_WORDS[@]}\")`);\n lines.push(` cword=$COMP_CWORD`);\n lines.push(` }`);\n lines.push(`fi`);\n lines.push(``);\n generateFunction(descriptor, [], lines);\n lines.push(`complete -F _${safeName} ${escapeForBash(executableName)}`);\n lines.push(`###-end-${escapeForBash(executableName)}-completions-###`);\n return lines.join(\"\\n\");\n};\n//# sourceMappingURL=bash.js.map",
|
|
94
|
+
"// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\nconst escapeFishString = s => s.replace(/'/g, \"\\\\'\");\n/**\n * Build a Fish condition that checks the current subcommand context.\n *\n * For root-level completions with subcommands: `__fish_use_subcommand`\n * For nested commands: verify the parent subcommand is active AND none of its\n * child subcommands have been entered yet.\n */\nconst subcommandCondition = (parentPath, childSubcommandNames) => {\n if (parentPath.length === 0) {\n if (childSubcommandNames.length > 0) {\n return `__fish_use_subcommand`;\n }\n return ``;\n }\n const parent = parentPath[parentPath.length - 1];\n if (childSubcommandNames.length > 0) {\n // Show only when parent is active but no child subcommand has been entered\n return `__fish_seen_subcommand_from ${parent}; and not __fish_seen_subcommand_from ${childSubcommandNames.join(\" \")}`;\n }\n return `__fish_seen_subcommand_from ${parent}`;\n};\n/**\n * Build a __fish_contains_opt condition that checks whether any form of this\n * flag has already been typed. Returns the condition string without wrapping\n * quotes (the caller adds those).\n */\nconst flagContainsOptCondition = flag => {\n const optArgs = [];\n for (const alias of flag.aliases) {\n if (alias.length === 1) {\n optArgs.push(`-s ${alias}`);\n }\n }\n // Long names (fish __fish_contains_opt uses bare words for long opts)\n optArgs.push(flag.name);\n for (const alias of flag.aliases) {\n if (alias.length > 1) {\n optArgs.push(alias);\n }\n }\n if (flag.type._tag === \"Boolean\") {\n optArgs.push(`no-${flag.name}`);\n }\n return `not __fish_contains_opt ${optArgs.join(\" \")}`;\n};\nconst flagCompletionArgs = flag => {\n const args = [`-l ${flag.name}`];\n for (const alias of flag.aliases) {\n if (alias.length === 1) {\n args.push(`-s ${alias}`);\n } else {\n args.push(`-l ${alias}`);\n }\n }\n if (flag.description) {\n args.push(`-d '${escapeFishString(flag.description)}'`);\n }\n const valueArgs = flagValueArgs(flag.type);\n if (valueArgs) {\n args.push(valueArgs);\n }\n return args;\n};\nconst flagValueArgs = type => {\n switch (type._tag) {\n case \"Boolean\":\n return undefined;\n case \"Choice\":\n return `-r -f -a '${type.values.join(\" \")}'`;\n case \"Path\":\n if (type.pathType === \"directory\") return `-r -F`;\n return `-r -F`;\n default:\n // -r: requires a value, -f: don't fall back to file completion\n return `-r -f`;\n }\n};\nconst argValueArgs = type => {\n switch (type._tag) {\n case \"Choice\":\n return `-r -f -a '${type.values.join(\" \")}'`;\n case \"Path\":\n return `-r -F`;\n default:\n return undefined;\n }\n};\n// ---------------------------------------------------------------------------\n// Generator\n// ---------------------------------------------------------------------------\nconst generateCompletions = (executableName, descriptor, parentPath, lines) => {\n const allSubNames = descriptor.subcommands.map(s => s.name);\n const condition = subcommandCondition(parentPath, allSubNames);\n const conditionArg = condition ? `-n '${condition}'` : ``;\n // Suppress default file completion unless the command has path-type\n // positional arguments. Without this, fish falls back to listing files\n // even when only flags are valid.\n const hasPathArgs = descriptor.arguments.some(a => a.type._tag === \"Path\");\n if (!hasPathArgs) {\n const parts = [`complete -c ${executableName}`];\n if (conditionArg) parts.push(conditionArg);\n parts.push(`-f`);\n lines.push(parts.join(\" \"));\n }\n // Subcommand completions\n for (const sub of descriptor.subcommands) {\n const parts = [`complete -c ${executableName}`];\n if (conditionArg) parts.push(conditionArg);\n parts.push(`-f -a '${escapeFishString(sub.name)}'`);\n if (sub.description) {\n parts.push(`-d '${escapeFishString(sub.description)}'`);\n }\n lines.push(parts.join(\" \"));\n }\n // Flag completions\n for (const flag of descriptor.flags) {\n // Only apply __fish_contains_opt dedup for boolean flags. For value-taking\n // flags, the dedup condition would suppress the entry while fish is waiting\n // for a value (e.g. typing `--env <TAB>` wouldn't show choices).\n const isBoolean = flag.type._tag === \"Boolean\";\n const flagCondition = isBoolean ? condition ? `${condition}; and ${flagContainsOptCondition(flag)}` : flagContainsOptCondition(flag) : condition;\n const flagCondArg = flagCondition ? `-n '${flagCondition}'` : ``;\n const parts = [`complete -c ${executableName}`];\n if (flagCondArg) parts.push(flagCondArg);\n parts.push(...flagCompletionArgs(flag));\n lines.push(parts.join(\" \"));\n // Boolean negation\n if (isBoolean) {\n const negParts = [`complete -c ${executableName}`];\n if (flagCondArg) negParts.push(flagCondArg);\n negParts.push(`-l no-${flag.name}`);\n if (flag.description) {\n negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);\n }\n lines.push(negParts.join(\" \"));\n }\n }\n // Flags as -a entries for bare <TAB> visibility.\n // Fish only shows -l/-s entries when the current word starts with -, so\n // without this, flags are invisible on bare <TAB>. Guarded to only show\n // when NOT already typing an option (avoids duplication with -l/-s above)\n // and hidden once a flag has been used (__fish_contains_opt).\n if (descriptor.flags.length > 0) {\n const notDash = `not string match -q -- \"-*\" (commandline -ct)`;\n const bareBase = condition ? `${condition}; and ${notDash}` : notDash;\n for (const flag of descriptor.flags) {\n const bareCondition = `${bareBase}; and ${flagContainsOptCondition(flag)}`;\n const isBoolean = flag.type._tag === \"Boolean\";\n const parts = [`complete -c ${executableName}`];\n parts.push(`-n '${bareCondition}'`);\n parts.push(`-f -a '--${flag.name}'`);\n if (flag.description) {\n parts.push(`-d '${escapeFishString(flag.description)}'`);\n }\n lines.push(parts.join(\" \"));\n if (isBoolean) {\n const negParts = [`complete -c ${executableName}`];\n negParts.push(`-n '${bareCondition}'`);\n negParts.push(`-f -a '--no-${flag.name}'`);\n if (flag.description) {\n negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);\n }\n lines.push(negParts.join(\" \"));\n }\n }\n }\n // Argument completions (type hints only)\n for (const arg of descriptor.arguments) {\n const valueArg = argValueArgs(arg.type);\n if (valueArg) {\n const parts = [`complete -c ${executableName}`];\n if (conditionArg) parts.push(conditionArg);\n parts.push(valueArg);\n if (arg.description) {\n parts.push(`-d '${escapeFishString(arg.description)}'`);\n }\n lines.push(parts.join(\" \"));\n }\n }\n // Recurse into subcommands\n for (const sub of descriptor.subcommands) {\n generateCompletions(executableName, sub, [...parentPath, sub.name], lines);\n }\n};\n/** @internal */\nexport const generate = (executableName, descriptor) => {\n const lines = [];\n lines.push(`###-begin-${executableName}-completions-###`);\n lines.push(`#`);\n lines.push(`# Static completion script for Fish`);\n lines.push(`#`);\n lines.push(`# Installation:`);\n lines.push(`# ${executableName} --completions fish > ~/.config/fish/completions/${executableName}.fish`);\n lines.push(`#`);\n lines.push(``);\n generateCompletions(executableName, descriptor, [], lines);\n lines.push(``);\n lines.push(`###-end-${executableName}-completions-###`);\n return lines.join(\"\\n\");\n};\n//# sourceMappingURL=fish.js.map",
|
|
95
|
+
"// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\nconst escapeZsh = s => s.replace(/\\\\/g, \"\\\\\\\\\").replace(/'/g, \"'\\\\''\").replace(/:/g, \"\\\\:\");\nconst sanitize = s => s.replace(/[^a-zA-Z0-9_]/g, \"_\");\n/**\n * All forms of a flag (--name, -alias, --no-name) for the exclusion group.\n */\nconst allForms = flag => {\n const forms = [`--${flag.name}`];\n for (const alias of flag.aliases) {\n forms.push(alias.length === 1 ? `-${alias}` : `--${alias}`);\n }\n if (flag.type._tag === \"Boolean\") {\n forms.push(`--no-${flag.name}`);\n }\n return forms;\n};\nconst valueAction = type => {\n switch (type._tag) {\n case \"Boolean\":\n return \"\";\n case \"Choice\":\n return `:value:(${type.values.join(\" \")})`;\n case \"Path\":\n return type.pathType === \"directory\" ? `:directory:_directories` : `:file:_files`;\n case \"Integer\":\n return `:integer:`;\n case \"Float\":\n return `:float:`;\n case \"Date\":\n return `:date:`;\n default:\n return `:value:`;\n }\n};\nconst argAction = type => {\n switch (type._tag) {\n case \"Choice\":\n return `(${type.values.join(\" \")})`;\n case \"Path\":\n return type.pathType === \"directory\" ? `_directories` : `_files`;\n default:\n return ``;\n }\n};\n/**\n * Produce _arguments optspecs for a single flag. Each spec is a complete,\n * single-quoted string — no brace expansion, no line continuations.\n */\nconst flagSpecs = flag => {\n const specs = [];\n const desc = flag.description ? `[${escapeZsh(flag.description)}]` : \"\";\n const action = valueAction(flag.type);\n const excl = `(${allForms(flag).join(\" \")})`;\n // Primary long name\n specs.push(`'${excl}--${flag.name}${desc}${action}'`);\n // Aliases\n for (const alias of flag.aliases) {\n const prefix = alias.length === 1 ? \"-\" : \"--\";\n specs.push(`'${excl}${prefix}${alias}${desc}${action}'`);\n }\n // Boolean negation\n if (flag.type._tag === \"Boolean\") {\n const negDesc = flag.description ? `[${escapeZsh(`Disable ${flag.name}`)}]` : \"\";\n specs.push(`'${excl}--no-${flag.name}${negDesc}'`);\n }\n return specs;\n};\nconst argSpec = arg => {\n const desc = arg.description ? escapeZsh(arg.description) : arg.name;\n const action = argAction(arg.type);\n const prefix = arg.variadic ? \"*\" : \"\";\n return `'${prefix}:${desc}:${action}'`;\n};\n// ---------------------------------------------------------------------------\n// Generator\n// ---------------------------------------------------------------------------\nconst generateFunction = (descriptor, parentPath, lines) => {\n const currentPath = [...parentPath, descriptor.name];\n const funcName = `_${currentPath.map(sanitize).join(\"_\")}`;\n lines.push(`${funcName}() {`);\n if (descriptor.subcommands.length > 0) {\n // _arguments -C requires these locals for the state machine\n lines.push(` local context state state_descr line`);\n lines.push(` typeset -A opt_args`);\n lines.push(``);\n // Subcommand list\n lines.push(` local -a commands`);\n lines.push(` commands=(`);\n for (const sub of descriptor.subcommands) {\n const desc = sub.description ? escapeZsh(sub.description) : \"\";\n lines.push(` '${sub.name}:${desc}'`);\n }\n lines.push(` )`);\n lines.push(``);\n // Build specs array to avoid brace expansion / line continuation issues\n lines.push(` local -a specs`);\n lines.push(` specs=(`);\n for (const flag of descriptor.flags) {\n for (const spec of flagSpecs(flag)) {\n lines.push(` ${spec}`);\n }\n }\n for (const arg of descriptor.arguments) {\n lines.push(` ${argSpec(arg)}`);\n }\n lines.push(` '1:command:->command'`);\n lines.push(` '*::arg:->args'`);\n lines.push(` )`);\n lines.push(``);\n lines.push(` _arguments -C \"\\${specs[@]}\"`);\n lines.push(``);\n // State dispatch\n lines.push(` case \"$state\" in`);\n lines.push(` command)`);\n lines.push(` _describe -t commands 'commands' commands`);\n lines.push(` ;;`);\n lines.push(` args)`);\n lines.push(` case \"$words[1]\" in`);\n for (const sub of descriptor.subcommands) {\n const subFunc = `_${[...currentPath, sub.name].map(sanitize).join(\"_\")}`;\n lines.push(` ${sub.name})`);\n lines.push(` ${subFunc}`);\n lines.push(` ;;`);\n }\n lines.push(` esac`);\n lines.push(` ;;`);\n lines.push(` esac`);\n } else {\n // Leaf command — no subcommands\n const allSpecs = [];\n for (const flag of descriptor.flags) {\n allSpecs.push(...flagSpecs(flag));\n }\n for (const arg of descriptor.arguments) {\n allSpecs.push(argSpec(arg));\n }\n if (allSpecs.length > 0) {\n lines.push(` local -a specs`);\n lines.push(` specs=(`);\n for (const spec of allSpecs) {\n lines.push(` ${spec}`);\n }\n lines.push(` )`);\n lines.push(` _arguments \"\\${specs[@]}\"`);\n }\n }\n lines.push(`}`);\n lines.push(``);\n for (const sub of descriptor.subcommands) {\n generateFunction(sub, currentPath, lines);\n }\n};\n/** @internal */\nexport const generate = (executableName, descriptor) => {\n const lines = [];\n const safeName = sanitize(executableName);\n lines.push(`#compdef ${executableName}`);\n lines.push(`###-begin-${executableName}-completions-###`);\n lines.push(`#`);\n lines.push(`# Static completion script for Zsh`);\n lines.push(`#`);\n lines.push(`# Installation:`);\n lines.push(`# ${executableName} --completions zsh > ~/.zsh/completions/_${executableName}`);\n lines.push(`# then add ~/.zsh/completions to your fpath`);\n lines.push(`#`);\n lines.push(``);\n generateFunction(descriptor, [], lines);\n lines.push(`# Handle both direct invocation and autoload`);\n lines.push(`if [[ \"\\${zsh_eval_context[-1]}\" == \"loadautofunc\" ]]; then`);\n lines.push(` _${safeName} \"$@\"`);\n lines.push(`else`);\n lines.push(` compdef _${safeName} ${executableName}`);\n lines.push(`fi`);\n lines.push(`###-end-${executableName}-completions-###`);\n return lines.join(\"\\n\");\n};\n//# sourceMappingURL=zsh.js.map",
|
|
96
|
+
"/**\n * The `Completions` module turns a plain description of an Effect CLI command\n * tree into shell completion scripts for Bash, Zsh, and Fish. It is the\n * low-level script generation surface used by the unstable CLI package and by\n * the built-in completions global flag.\n *\n * **Mental model**\n *\n * - {@link CommandDescriptor} is a shell-agnostic tree of commands,\n * subcommands, flags, and positional arguments.\n * - {@link FlagDescriptor} and {@link ArgumentDescriptor} carry just enough\n * metadata for shells to complete names, choices, paths, and value-shaped\n * arguments.\n * - {@link generate} selects the shell-specific generator and returns a static\n * script string for one executable name.\n *\n * **Common tasks**\n *\n * - Generate an installable completion script with {@link generate}.\n * - Preserve help text in completions by filling descriptor descriptions.\n * - Use `Choice` descriptors for finite values and `Path` descriptors when the\n * shell should complete files or directories.\n *\n * **Gotchas**\n *\n * - This module does not inspect a `Command` directly; it consumes an already\n * built {@link CommandDescriptor}.\n * - Generated scripts are returned as strings. Printing, installing, or caching\n * those scripts is handled by the caller.\n *\n * @since 4.0.0\n */\nimport * as Bash from \"./internal/completions/bash.js\";\nimport * as Fish from \"./internal/completions/fish.js\";\nimport * as Zsh from \"./internal/completions/zsh.js\";\n/**\n * Generates a shell completion script for a command descriptor.\n *\n * **When to use**\n *\n * Use to produce an installable completion script when you already have a\n * `CommandDescriptor`.\n *\n * **Details**\n *\n * Dispatches by `shell` to Bash, Zsh, or Fish generation and returns a static\n * script string for `executableName`.\n *\n * @see {@link Shell} for supported shell names\n * @see {@link CommandDescriptor} for the command shape used by completion generation\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const generate = (executableName, shell, descriptor) => {\n switch (shell) {\n case \"bash\":\n return Bash.generate(executableName, descriptor);\n case \"zsh\":\n return Zsh.generate(executableName, descriptor);\n case \"fish\":\n return Fish.generate(executableName, descriptor);\n }\n};\n//# sourceMappingURL=Completions.js.map",
|
|
97
|
+
"/**\n * Config Internal\n * ================\n *\n * The processed internal representation of a Command.Config declaration.\n * Separates the user's declared config shape from the flat parsing representation.\n *\n * Key concepts:\n * - ConfigInternal: The full processed form (flags, arguments, tree)\n * - ConfigInternal.Tree: Maps declaration keys to nodes\n * - ConfigInternal.Node: Param reference, Array, or Nested subtree\n *\n * Example transformation from Command.Config to Command.Config.Internal:\n *\n * ```ts\n * // User declares:\n * const config = {\n * verbose: Flag.boolean(\"verbose\"),\n * server: {\n * host: Flag.string(\"host\"),\n * port: Flag.integer(\"port\")\n * },\n * files: Argument.string(\"files\").pipe(Argument.variadic)\n * }\n *\n * // Becomes Config.Internal:\n * {\n * arguments: [filesParam], // Flat array of arguments\n * flags: [verboseParam, hostParam, portParam], // Flat array of flags\n * orderedParams: [verboseParam, hostParam, portParam, filesParam],\n * tree: { // Preserves nested structure\n * verbose: { _tag: \"Param\", index: 0 },\n * server: {\n * _tag: \"Nested\",\n * tree: {\n * host: { _tag: \"Param\", index: 1 },\n * port: { _tag: \"Param\", index: 2 }\n * }\n * },\n * files: { _tag: \"Param\", index: 3 }\n * }\n * }\n * ```\n *\n * This separation allows:\n * 1. Flat iteration over all params for parsing/validation\n * 2. Reconstruction of original nested shape for handler input\n */\nimport * as Predicate from \"../../../Predicate.js\";\nimport * as Param from \"../Param.js\";\n/* ========================================================================== */\n/* Type ID */\n/* ========================================================================== */\nconst ConfigInternalTypeId = \"~effect/cli/Command/Config/Internal\";\n/* ========================================================================== */\n/* Guards */\n/* ========================================================================== */\n/** @internal */\nexport const isConfigInternal = u => Predicate.hasProperty(u, ConfigInternalTypeId);\n/**\n * Parses a Command.Config into a ConfigInternal.\n *\n * Walks the config structure and:\n * 1. Extracts all Params into flat arrays (flags, arguments, orderedParams)\n * 2. Builds a tree that remembers the original nested structure\n * 3. Assigns each Param an index to link parsed values back\n *\n * @internal\n */\nexport const parseConfig = config => {\n const orderedParams = [];\n const flags = [];\n const args = [];\n function parse(config) {\n const tree = {};\n for (const key in config) {\n tree[key] = parseValue(config[key]);\n }\n return tree;\n }\n function parseValue(value) {\n if (Array.isArray(value)) {\n return {\n _tag: \"Array\",\n children: value.map(v => parseValue(v))\n };\n } else if (Param.isParam(value)) {\n const index = orderedParams.length;\n orderedParams.push(value);\n if (value.kind === \"argument\") {\n args.push(value);\n } else {\n flags.push(value);\n }\n return {\n _tag: \"Param\",\n index\n };\n } else {\n return {\n _tag: \"Nested\",\n tree: parse(value)\n };\n }\n }\n return {\n [ConfigInternalTypeId]: ConfigInternalTypeId,\n flags,\n arguments: args,\n orderedParams,\n tree: parse(config)\n };\n};\n/** @internal */\nexport const emptyConfig = /*#__PURE__*/parseConfig({});\nconst shiftNodeIndexes = (node, offset) => {\n switch (node._tag) {\n case \"Param\":\n return {\n _tag: \"Param\",\n index: node.index + offset\n };\n case \"Array\":\n return {\n _tag: \"Array\",\n children: node.children.map(child => shiftNodeIndexes(child, offset))\n };\n case \"Nested\":\n return {\n _tag: \"Nested\",\n tree: shiftTreeIndexes(node.tree, offset)\n };\n }\n};\nconst shiftTreeIndexes = (tree, offset) => {\n const output = {};\n for (const key in tree) {\n output[key] = shiftNodeIndexes(tree[key], offset);\n }\n return output;\n};\n/** @internal */\nexport const mergeConfig = (left, right) => {\n const offset = left.orderedParams.length;\n return {\n [ConfigInternalTypeId]: ConfigInternalTypeId,\n flags: [...left.flags, ...right.flags],\n arguments: [...left.arguments, ...right.arguments],\n orderedParams: [...left.orderedParams, ...right.orderedParams],\n tree: {\n ...left.tree,\n ...shiftTreeIndexes(right.tree, offset)\n }\n };\n};\n/* ========================================================================== */\n/* Reconstruction */\n/* ========================================================================== */\n/**\n * Reconstructs the original nested config shape from parsed values.\n *\n * Uses the tree as a blueprint to place each parsed value back into\n * its original position in the nested structure.\n *\n * @internal\n */\nexport const reconstructTree = (tree, results) => {\n const output = {};\n for (const key in tree) {\n output[key] = nodeValue(tree[key]);\n }\n return output;\n function nodeValue(node) {\n switch (node._tag) {\n case \"Param\":\n return results[node.index];\n case \"Array\":\n return node.children.map(child => nodeValue(child));\n case \"Nested\":\n return reconstructTree(node.tree, results);\n }\n }\n};\n//# sourceMappingURL=config.js.map",
|
|
98
|
+
"/**\n * Command Implementation\n * ======================\n *\n * Internal implementation details for CLI commands.\n * Public API is in ../Command.ts\n */\nimport * as Arr from \"../../../Array.js\";\nimport * as Context from \"../../../Context.js\";\nimport * as Effect from \"../../../Effect.js\";\nimport * as Effectable from \"../../../Effectable.js\";\nimport * as Option from \"../../../Option.js\";\nimport * as Predicate from \"../../../Predicate.js\";\nimport * as CliError from \"../CliError.js\";\nimport * as Param from \"../Param.js\";\nimport * as Primitive from \"../Primitive.js\";\nimport { emptyConfig, reconstructTree } from \"./config.js\";\n/* ========================================================================== */\n/* Type ID */\n/* ========================================================================== */\nexport const TypeId = \"~effect/cli/Command\";\n/* ========================================================================== */\n/* Casting */\n/* ========================================================================== */\n/**\n * Casts a Command to its internal implementation.\n * For use by internal modules that need access to config, parse, handle, etc.\n */\nexport const toImpl = self => self;\n/* ========================================================================== */\n/* Proto */\n/* ========================================================================== */\nexport const Proto = {\n ... /*#__PURE__*/Effectable.Prototype({\n label: \"Command\",\n evaluate() {\n return toImpl(this).service;\n }\n })\n};\n/* ========================================================================== */\n/* Constructor */\n/* ========================================================================== */\n/**\n * Internal command constructor. Only accepts already-parsed ConfigInternal.\n */\nexport const makeCommand = options => {\n const config = options.config;\n const contextConfig = options.contextConfig ?? emptyConfig;\n const service = options.service ?? Context.Service(`${TypeId}/${options.name}`);\n const annotations = options.annotations ?? Context.empty();\n const globalFlags = options.globalFlags ?? [];\n const subcommands = options.subcommands ?? [];\n const handle = (input, commandPath) => Predicate.isNotUndefined(options.handle) ? options.handle(input, commandPath) : Effect.fail(new CliError.ShowHelp({\n commandPath,\n errors: []\n }));\n const parse = options.parse ?? makeParser(config);\n const parseContext = options.parseContext ?? makeParser(contextConfig);\n const buildHelpDoc = commandPath => {\n const args = [];\n const flags = [];\n for (const arg of config.arguments) {\n const singles = Param.extractSingleParams(arg);\n const metadata = Param.getParamMetadata(arg);\n for (const single of singles) {\n args.push({\n name: single.name,\n type: single.typeName ?? Primitive.getTypeName(single.primitiveType),\n description: single.description,\n required: !metadata.isOptional,\n variadic: metadata.isVariadic\n });\n }\n }\n let usage = commandPath.length > 0 ? commandPath.join(\" \") : options.name;\n // Only render `<subcommand>` in usage when at least one visible subcommand\n // exists; an all-hidden subcommand tree should look like a leaf command.\n if (subcommands.some(group => group.commands.some(c => !c.hidden))) {\n usage += \" <subcommand>\";\n }\n usage += \" [flags]\";\n for (const arg of args) {\n const argName = arg.variadic ? `<${arg.name}...>` : `<${arg.name}>`;\n usage += ` ${arg.required ? argName : `[${argName}]`}`;\n }\n for (const option of config.flags) {\n const singles = Param.extractSingleParams(option);\n for (const single of singles) {\n // Hidden flags still parse on the command line but are omitted from\n // generated --help output.\n if (single.hidden) continue;\n flags.push(toFlagDoc(single));\n }\n }\n const subcommandDocs = [];\n for (const group of subcommands) {\n // Hidden subcommands still parse on the command line but are omitted\n // from --help. Drop the whole group when nothing visible remains so we\n // don't render an empty heading.\n const visible = group.commands.filter(c => !c.hidden);\n if (visible.length === 0) continue;\n subcommandDocs.push({\n group: group.group,\n commands: Arr.map(visible, subcommand => ({\n name: subcommand.name,\n alias: subcommand.alias,\n shortDescription: subcommand.shortDescription,\n description: subcommand.description ?? \"\"\n }))\n });\n }\n const examples = options.examples ?? [];\n return {\n description: options.description ?? \"\",\n usage,\n flags,\n annotations,\n ...(args.length > 0 && {\n args\n }),\n ...(subcommandDocs.length > 0 && {\n subcommands: subcommandDocs\n }),\n ...(examples.length > 0 && {\n examples\n })\n };\n };\n return Object.assign(Object.create(Proto), {\n [TypeId]: TypeId,\n name: options.name,\n examples: options.examples ?? [],\n annotations,\n globalFlags,\n subcommands,\n hidden: options.hidden ?? false,\n config,\n contextConfig,\n service,\n parse,\n parseContext,\n handle,\n buildHelpDoc,\n ...(Predicate.isNotUndefined(options.description) ? {\n description: options.description\n } : {}),\n ...(Predicate.isNotUndefined(options.shortDescription) ? {\n shortDescription: options.shortDescription\n } : {}),\n ...(Predicate.isNotUndefined(options.alias) ? {\n alias: options.alias\n } : {})\n });\n};\n/* ========================================================================== */\n/* Helpers */\n/* ========================================================================== */\n/**\n * Converts a single flag param into a FlagDoc for help display.\n */\nexport const toFlagDoc = single => {\n const formattedAliases = single.aliases.map(alias => alias.length === 1 ? `-${alias}` : `--${alias}`);\n return {\n name: single.name,\n aliases: formattedAliases,\n type: single.typeName ?? Primitive.getTypeName(single.primitiveType),\n description: appendChoiceKeys(single.description, Primitive.getChoiceKeys(single.primitiveType)),\n required: single.primitiveType._tag !== \"Boolean\"\n };\n};\nconst appendChoiceKeys = (description, choiceKeys) => {\n if (choiceKeys === undefined || choiceKeys.length === 0) {\n return description;\n }\n const choiceSuffix = `(choices: ${choiceKeys.join(\", \")})`;\n return Option.match(description, {\n onNone: () => Option.some(choiceSuffix),\n onSome: value => Option.some(`${value} ${choiceSuffix}`)\n });\n};\n/**\n * Creates a parser for a given config. Used as the default for both `parse`\n * and `parseContext`, and also by `withSharedFlags` to avoid constructing a\n * full throwaway command.\n */\nexport const makeParser = cfg => Effect.fnUntraced(function* (input) {\n const parsedArgs = {\n flags: input.flags,\n arguments: input.arguments\n };\n const values = yield* parseParams(parsedArgs, cfg.orderedParams);\n return reconstructTree(cfg.tree, values);\n});\n/**\n * Parses param values from parsed command arguments into their typed\n * representations.\n */\nconst parseParams = /*#__PURE__*/Effect.fnUntraced(function* (parsedArgs, params) {\n const results = [];\n let currentArguments = parsedArgs.arguments;\n for (const option of params) {\n const [remainingArguments, parsed] = yield* option.parse({\n flags: parsedArgs.flags,\n arguments: currentArguments\n });\n results.push(parsed);\n currentArguments = remainingArguments;\n }\n return results;\n});\n/**\n * Checks that inherited parent context flags do not reuse names declared by\n * child command flags.\n *\n * When `contextConfig` is supplied, it is used as the inherited flag set;\n * otherwise the parent's current context config is checked.\n */\nexport const checkForDuplicateFlags = (parent, subcommands, options) => {\n const parentImpl = toImpl(parent);\n const parentOptionNames = new Set();\n const extractNames = flags => {\n for (const option of flags) {\n const singles = Param.extractSingleParams(option);\n for (const single of singles) {\n parentOptionNames.add(single.name);\n }\n }\n };\n extractNames((options?.contextConfig ?? parentImpl.contextConfig).flags);\n for (const subcommand of subcommands) {\n const subImpl = toImpl(subcommand);\n for (const option of subImpl.config.flags) {\n const singles = Param.extractSingleParams(option);\n for (const single of singles) {\n if (parentOptionNames.has(single.name)) {\n throw new CliError.DuplicateOption({\n option: single.name,\n parentCommand: parent.name,\n childCommand: subcommand.name\n });\n }\n }\n }\n }\n};\n//# sourceMappingURL=command.js.map",
|
|
99
|
+
"/**\n * CommandDescriptor — pure-data representation of a command tree for\n * shell completion generation.\n *\n * @internal\n */\nimport * as Option from \"../../../../Option.js\";\nimport * as Param from \"../../Param.js\";\nimport * as Primitive from \"../../Primitive.js\";\nimport { toImpl } from \"../command.js\";\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\nconst toFlagType = single => {\n const tag = single.primitiveType._tag;\n switch (tag) {\n case \"Boolean\":\n return {\n _tag: \"Boolean\"\n };\n case \"Integer\":\n return {\n _tag: \"Integer\"\n };\n case \"Float\":\n return {\n _tag: \"Float\"\n };\n case \"Date\":\n return {\n _tag: \"Date\"\n };\n case \"Choice\":\n {\n const keys = Primitive.getChoiceKeys(single.primitiveType);\n return {\n _tag: \"Choice\",\n values: keys ?? []\n };\n }\n case \"Path\":\n {\n const typeName = single.typeName;\n const pathType = typeName === \"file\" ? \"file\" : typeName === \"directory\" ? \"directory\" : \"either\";\n return {\n _tag: \"Path\",\n pathType\n };\n }\n default:\n return {\n _tag: \"String\"\n };\n }\n};\nconst toArgumentType = single => {\n const tag = single.primitiveType._tag;\n switch (tag) {\n case \"Integer\":\n return {\n _tag: \"Integer\"\n };\n case \"Float\":\n return {\n _tag: \"Float\"\n };\n case \"Date\":\n return {\n _tag: \"Date\"\n };\n case \"Choice\":\n {\n const keys = Primitive.getChoiceKeys(single.primitiveType);\n return {\n _tag: \"Choice\",\n values: keys ?? []\n };\n }\n case \"Path\":\n {\n const typeName = single.typeName;\n const pathType = typeName === \"file\" ? \"file\" : typeName === \"directory\" ? \"directory\" : \"either\";\n return {\n _tag: \"Path\",\n pathType\n };\n }\n default:\n return {\n _tag: \"String\"\n };\n }\n};\n// ---------------------------------------------------------------------------\n// Extraction\n// ---------------------------------------------------------------------------\n/** @internal */\nexport const fromCommand = cmd => {\n const impl = toImpl(cmd);\n const config = impl.config;\n const flags = [];\n for (const flag of config.flags) {\n const singles = Param.extractSingleParams(flag);\n for (const single of singles) {\n if (single.kind !== \"flag\") continue;\n // Omit hidden flags from completion scripts so tab-completion in the\n // shell does not advertise flags that are absent from --help.\n if (single.hidden) continue;\n flags.push({\n name: single.name,\n aliases: single.aliases,\n description: Option.getOrUndefined(single.description),\n type: toFlagType(single)\n });\n }\n }\n const args = [];\n for (const arg of config.arguments) {\n const singles = Param.extractSingleParams(arg);\n const metadata = Param.getParamMetadata(arg);\n for (const single of singles) {\n if (single.kind !== \"argument\") continue;\n args.push({\n name: single.name,\n description: Option.getOrUndefined(single.description),\n required: !metadata.isOptional,\n variadic: metadata.isVariadic,\n type: toArgumentType(single)\n });\n }\n }\n const subcommands = [];\n for (const group of cmd.subcommands) {\n for (const subcommand of group.commands) {\n // Omit hidden subcommands from completion scripts so tab-completion in\n // the shell does not advertise commands that are absent from --help.\n if (subcommand.hidden) continue;\n subcommands.push(fromCommand(subcommand));\n }\n }\n return {\n name: cmd.name,\n description: cmd.shortDescription ?? cmd.description,\n flags,\n arguments: args,\n subcommands\n };\n};\n//# sourceMappingURL=descriptor.js.map",
|
|
100
|
+
"/**\n * Help Documentation\n * ================\n *\n * Internal helpers for generating help documentation.\n * Extracted from command.ts to avoid circular dependencies.\n */\nimport * as Effect from \"../../../Effect.js\";\nimport * as Param from \"../Param.js\";\nimport { toFlagDoc, toImpl } from \"./command.js\";\nconst dedupeGlobalFlags = flags => {\n const seen = new Set();\n const deduped = [];\n for (const flag of flags) {\n if (seen.has(flag)) {\n continue;\n }\n seen.add(flag);\n deduped.push(flag);\n }\n return deduped;\n};\n/**\n * Returns the resolved command lineage for the provided path.\n * Includes the root command as the first element.\n */\nexport const getCommandsForCommandPath = (command, commandPath) => {\n const commands = [command];\n let currentCommand = command;\n for (let i = 1; i < commandPath.length; i++) {\n const subcommandName = commandPath[i];\n let subcommand = undefined;\n for (const group of currentCommand.subcommands) {\n subcommand = group.commands.find(sub => sub.name === subcommandName);\n if (subcommand) {\n break;\n }\n }\n if (!subcommand) {\n break;\n }\n commands.push(subcommand);\n currentCommand = subcommand;\n }\n return commands;\n};\n/**\n * Returns active global flags for a command path.\n * Built-ins are prepended and declarations are collected root -> leaf.\n */\nexport const getGlobalFlagsForCommandPath = (command, commandPath, builtIns) => {\n const commands = getCommandsForCommandPath(command, commandPath);\n const declared = commands.flatMap(current => toImpl(current).globalFlags);\n return dedupeGlobalFlags([...builtIns, ...declared]);\n};\nconst collectDeclaredGlobalFlags = command => {\n const collected = [];\n const visit = current => {\n const impl = toImpl(current);\n for (const flag of impl.globalFlags) {\n collected.push(flag);\n }\n for (const group of current.subcommands) {\n for (const subcommand of group.commands) {\n visit(subcommand);\n }\n }\n };\n visit(command);\n return dedupeGlobalFlags(collected);\n};\nconst getSharedFlagsForCommandPath = (commands, currentFlags) => {\n if (commands.length <= 1) {\n return [];\n }\n const seen = new Set(currentFlags.map(flag => flag.name));\n const sharedFlags = [];\n for (const ancestor of commands.slice(0, -1)) {\n const ancestorImpl = toImpl(ancestor);\n for (const flag of ancestorImpl.contextConfig.flags) {\n const singles = Param.extractSingleParams(flag);\n for (const single of singles) {\n if (seen.has(single.name)) {\n continue;\n }\n // Hidden ancestor flags are excluded from the shared-flags section\n // of subcommand help, the same way they're excluded from the owning\n // command's own help output.\n if (single.hidden) {\n continue;\n }\n seen.add(single.name);\n sharedFlags.push(toFlagDoc(single));\n }\n }\n }\n return sharedFlags;\n};\n/**\n * Returns all global flags declared in a command tree.\n * Built-ins are prepended and command declarations are deduplicated by identity.\n */\nexport const getGlobalFlagsForCommandTree = (command, builtIns) => dedupeGlobalFlags([...builtIns, ...collectDeclaredGlobalFlags(command)]);\n/**\n * Helper function to get help documentation for a specific command path.\n * Navigates through the command hierarchy to find the right command.\n * Reads active global flags for the path and includes them in the help doc.\n */\nexport const getHelpForCommandPath = (command, commandPath, builtIns) => Effect.gen(function* () {\n const commands = getCommandsForCommandPath(command, commandPath);\n const currentCommand = commands.length > 0 ? commands[commands.length - 1] : command;\n const baseDoc = toImpl(currentCommand).buildHelpDoc(commandPath);\n const sharedFlags = getSharedFlagsForCommandPath(commands, baseDoc.flags);\n const flags = getGlobalFlagsForCommandPath(command, commandPath, builtIns);\n const globalFlagDocs = [];\n for (const flag of flags) {\n const singles = Param.extractSingleParams(flag.flag);\n for (const single of singles) {\n // Same rule as command-local flags: hidden globals are still parsed\n // and still trigger their handlers, they just don't appear under\n // \"GLOBAL FLAGS\" in --help.\n if (single.hidden) continue;\n globalFlagDocs.push({\n ...toFlagDoc(single),\n required: false\n });\n }\n }\n return {\n ...baseDoc,\n flags: [...sharedFlags, ...baseDoc.flags],\n globalFlags: globalFlagDocs\n };\n});\n//# sourceMappingURL=help.js.map",
|
|
101
|
+
"/**\n * The `GlobalFlag` module defines flags that are available to every command in\n * an Effect CLI application. Global flags are useful for cross-cutting command\n * line behavior such as printing help, showing the application version,\n * generating shell completions, or configuring shared handler settings like the\n * minimum log level.\n *\n * **Common tasks**\n *\n * - Create an action flag with {@link action} for side effects that should run\n * before the selected command, such as `--help` or `--version`\n * - Create a setting flag with {@link setting} for values that should be made\n * available to command handlers through the Effect context\n * - Reuse the built-in {@link Help}, {@link Version}, {@link Completions}, and\n * {@link LogLevel} flags when constructing command runners\n *\n * **Gotchas**\n *\n * - Action flags are intended to perform their effect and exit instead of\n * continuing into the command handler\n * - Setting flags allocate a distinct context service for each call to\n * {@link setting}, so reuse exported settings when handlers need to read the\n * same parsed global value\n *\n * @since 4.0.0\n */\nimport * as Console from \"../../Console.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Option from \"../../Option.js\";\nimport * as CliOutput from \"./CliOutput.js\";\nimport * as Completions_ from \"./Completions.js\";\nimport * as Flag from \"./Flag.js\";\nimport * as CommandDescriptor from \"./internal/completions/descriptor.js\";\nimport * as HelpInternal from \"./internal/help.js\";\n/* ========================================================================== */\n/* Constructors */\n/* ========================================================================== */\n/**\n * Creates an Action flag that performs a side effect and exits.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const action = options => ({\n _tag: \"Action\",\n flag: options.flag,\n run: options.run\n});\n/**\n * Creates a Setting flag that configures the command handler's environment.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const setting = id => options => {\n settingIdCounter += 1;\n const ref = Context.Service(`effect/unstable/cli/GlobalFlag/${id}/${settingIdCounter}`);\n return Object.assign(ref, {\n _tag: \"Setting\",\n id,\n flag: options.flag\n });\n};\nlet settingIdCounter = 0;\n/* ========================================================================== */\n/* Built-in Flag References */\n/* ========================================================================== */\n/**\n * Defines the `--help` / `-h` global flag, which shows help documentation for the\n * active command path.\n *\n * @see {@link BuiltIns} for the default list containing this flag\n * @see {@link action} for defining custom action global flags\n *\n * @category references\n * @since 4.0.0\n */\nexport const Help = /*#__PURE__*/action({\n flag: /*#__PURE__*/Flag.boolean(\"help\").pipe(/*#__PURE__*/Flag.withAlias(\"h\"), /*#__PURE__*/Flag.withDescription(\"Show help information\")),\n run: (_, {\n command,\n commandPath\n }) => Effect.gen(function* () {\n const formatter = yield* CliOutput.Formatter;\n const helpDoc = yield* HelpInternal.getHelpForCommandPath(command, commandPath, BuiltIns);\n yield* Console.log(formatter.formatHelpDoc(helpDoc));\n })\n});\n/**\n * Defines the global action flag for showing command version information.\n *\n * **When to use**\n *\n * Use to add a built-in `--version` flag to a command runner.\n *\n * @category references\n * @since 4.0.0\n */\nexport const Version = /*#__PURE__*/action({\n flag: /*#__PURE__*/Flag.boolean(\"version\").pipe(/*#__PURE__*/Flag.withDescription(\"Show version information\")),\n run: (_, {\n command,\n version\n }) => Effect.gen(function* () {\n const formatter = yield* CliOutput.Formatter;\n yield* Console.log(formatter.formatVersion(command.name, version));\n })\n});\n/**\n * Defines the `--completions` global flag, which prints a shell completion script for\n * the given shell.\n *\n * **Details**\n *\n * Accepted values are `bash`, `zsh`, `fish`, and `sh`; `sh` is normalized to\n * `bash`.\n *\n * @category references\n * @since 4.0.0\n */\nexport const Completions = /*#__PURE__*/action({\n flag: /*#__PURE__*/Flag.choice(\"completions\", [\"bash\", \"zsh\", \"fish\", \"sh\"]).pipe(Flag.optional, /*#__PURE__*/Flag.map(v => Option.map(v, s => s === \"sh\" ? \"bash\" : s)), /*#__PURE__*/Flag.withDescription(\"Print shell completion script\")),\n run: (shell, {\n command\n }) => Effect.gen(function* () {\n if (Option.isNone(shell)) return;\n const descriptor = CommandDescriptor.fromCommand(command);\n yield* Console.log(Completions_.generate(command.name, shell.value, descriptor));\n })\n});\n/**\n * Defines the global setting flag for command log level.\n *\n * **When to use**\n *\n * Use to add a built-in `--log-level` option that configures the minimum log\n * level for the command.\n *\n * @category references\n * @since 4.0.0\n */\nexport const LogLevel = /*#__PURE__*/setting(\"log-level\")({\n flag: /*#__PURE__*/Flag.choiceWithValue(\"log-level\", [[\"all\", \"All\"], [\"trace\", \"Trace\"], [\"debug\", \"Debug\"], [\"info\", \"Info\"], [\"warn\", \"Warn\"], [\"warning\", \"Warn\"], [\"error\", \"Error\"], [\"fatal\", \"Fatal\"], [\"none\", \"None\"]]).pipe(Flag.optional, /*#__PURE__*/Flag.withDescription(\"Sets the minimum log level\"))\n});\n/* ========================================================================== */\n/* References */\n/* ========================================================================== */\n/**\n * Built-in global flags in default precedence order.\n *\n * **Details**\n *\n * The built-ins are `Help`, `Version`, `Completions`, and `LogLevel`.\n * `Command.runWith` prepends these built-ins when collecting and parsing global\n * flags.\n *\n * **Gotchas**\n *\n * Action flags are processed in active flag order and the first present action\n * exits, so this array controls built-in action precedence.\n *\n * @see {@link Help} for the help action flag\n * @see {@link Version} for the version action flag\n * @see {@link Completions} for the shell-completions action flag\n * @see {@link LogLevel} for the built-in log-level setting flag\n *\n * @category references\n * @since 4.0.0\n */\nexport const BuiltIns = [Help, Version, Completions, LogLevel];\n//# sourceMappingURL=GlobalFlag.js.map",
|
|
102
|
+
"/** @internal */\nexport function lex(argv) {\n const endIndex = argv.indexOf(\"--\");\n if (endIndex === -1) {\n // No -- delimiter, lex everything normally\n return {\n tokens: lexTokens(argv),\n trailingOperands: []\n };\n }\n // Split at -- delimiter\n return {\n tokens: lexTokens(argv.slice(0, endIndex)),\n trailingOperands: argv.slice(endIndex + 1)\n };\n}\nconst lexTokens = args => {\n const tokens = [];\n for (const arg of args) {\n if (!arg.startsWith(\"-\")) {\n tokens.push({\n _tag: \"Value\",\n value: arg\n });\n } else if (arg.startsWith(\"--\")) {\n const [name, value] = arg.slice(2).split(\"=\", 2);\n tokens.push({\n _tag: \"LongOption\",\n name,\n raw: arg,\n value\n });\n } else if (arg.length > 1) {\n const flags = arg.slice(1);\n const equalIndex = flags.indexOf(\"=\");\n if (equalIndex !== -1) {\n const flag = flags.slice(0, equalIndex);\n const value = flags.slice(equalIndex + 1);\n tokens.push({\n _tag: \"ShortOption\",\n flag,\n raw: `-${flag}`,\n value\n });\n } else {\n for (const ch of flags) {\n tokens.push({\n _tag: \"ShortOption\",\n flag: ch,\n raw: `-${ch}`\n });\n }\n }\n } else {\n tokens.push({\n _tag: \"Value\",\n value: arg\n });\n }\n }\n return tokens;\n};\n//# sourceMappingURL=lexer.js.map",
|
|
103
|
+
"/**\n * Simple Levenshtein distance implementation (small N, no perf worries)\n */\nconst levenshtein = (a, b) => {\n const m = a.length;\n const n = b.length;\n const dp = Array.from({\n length: m + 1\n }, () => new Array(n + 1).fill(0));\n for (let i = 0; i <= m; i++) dp[i][0] = i;\n for (let j = 0; j <= n; j++) dp[0][j] = j;\n for (let i = 1; i <= m; i++) {\n for (let j = 1; j <= n; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);\n }\n }\n return dp[m][n];\n};\n/**\n * Return suggestions with minimum distance found, up to distance 2.\n *\n * @internal\n */\nexport const suggest = (input, candidates) => {\n const distances = candidates.map(c => [levenshtein(input, c), c]).filter(([d]) => d <= 2) // Stricter threshold\n .sort(([a], [b]) => a - b);\n if (distances.length === 0) return [];\n // Only return suggestions with the minimum distance found\n const minDistance = distances[0][0];\n return distances.filter(([d]) => d === minDistance).map(([, c]) => c);\n};\n//# sourceMappingURL=auto-suggest.js.map",
|
|
104
|
+
"/**\n * Parsing Pipeline for CLI Commands\n * ==================================\n *\n * The parser transforms raw argv tokens into structured command input through\n * three main phases:\n *\n * 1. **Lexer** (external): Converts argv strings into typed tokens\n * - LongOption: --name or --name=value\n * - ShortOption: -n or -n=value (also handles -abc as three flags)\n * - Value: positional arguments\n *\n * 2. **Built-in Extraction**: Peels off built-in flags (help/version/completions)\n * before command-specific parsing begins.\n *\n * 3. **Command Parsing**: Recursively processes command levels:\n * - Collects flags defined at this level\n * - Detects subcommand from first value token\n * - Forwards remaining tokens to child command\n *\n * Key Behaviors\n * -------------\n * - Inherited parent flags may appear before OR after the subcommand name (npm-style)\n * - Only the first Value token can open a subcommand\n * - Errors accumulate rather than throwing exceptions\n */\nimport * as Effect from \"../../../Effect.js\";\nimport * as Option from \"../../../Option.js\";\nimport * as CliError from \"../CliError.js\";\nimport * as Param from \"../Param.js\";\nimport * as Primitive from \"../Primitive.js\";\nimport { suggest } from \"./auto-suggest.js\";\nimport { toImpl } from \"./command.js\";\n/* ========================================================================== */\n/* Public API */\n/* ========================================================================== */\n/** @internal */\nexport const getCommandPath = parsedInput => Option.match(parsedInput.subcommand, {\n onNone: () => [],\n onSome: subcommand => [subcommand.name, ...getCommandPath(subcommand.parsedInput)]\n});\n/** @internal */\nexport const parseArgs = (lexResult, command, commandPath = []) => Effect.gen(function* () {\n const {\n tokens,\n trailingOperands: afterEndOfOptions\n } = lexResult;\n const newCommandPath = [...commandPath, command.name];\n const commandImpl = toImpl(command);\n const singles = commandImpl.config.flags.flatMap(Param.extractSingleParams);\n const flagParams = singles.filter(Param.isFlagParam);\n const flagRegistry = createFlagRegistry(flagParams);\n const inheritedSingles = commandImpl.contextConfig.flags.flatMap(Param.extractSingleParams);\n const inheritedFlagParams = inheritedSingles.filter(Param.isFlagParam);\n const inheritedFlagRegistry = createFlagRegistry(inheritedFlagParams);\n const inheritedNames = new Set(inheritedFlagParams.map(param => param.name));\n const context = {\n command,\n commandPath: newCommandPath,\n flagRegistry,\n inheritedFlagRegistry,\n localFlagNames: flagParams.filter(param => !inheritedNames.has(param.name)).map(param => param.name)\n };\n const result = scanCommandLevel(tokens, context);\n if (result._tag === \"Leaf\") {\n return {\n flags: result.flags,\n arguments: [...result.arguments, ...afterEndOfOptions],\n subcommand: Option.none(),\n ...(result.errors.length > 0 && {\n errors: result.errors\n })\n };\n }\n const subLex = {\n tokens: result.childTokens,\n trailingOperands: []\n };\n const subParsed = yield* parseArgs(subLex, result.sub, newCommandPath);\n const allErrors = [...result.errors, ...(subParsed.errors ?? [])];\n return {\n flags: result.flags,\n arguments: afterEndOfOptions,\n subcommand: Option.some({\n name: result.sub.name,\n parsedInput: subParsed\n }),\n ...(allErrors.length > 0 && {\n errors: allErrors\n })\n };\n});\nconst makeCursor = tokens => {\n let i = 0;\n return {\n peek: () => tokens[i],\n take: () => tokens[i++],\n rest: () => tokens.slice(i)\n };\n};\n/* ========================================================================== */\n/* Flag Registry */\n/* ========================================================================== */\n/**\n * Creates a registry for O(1) flag lookup by name or alias.\n * @internal\n */\nexport const createFlagRegistry = params => {\n const index = new Map();\n for (const param of params) {\n if (index.has(param.name)) {\n throw new Error(`Duplicate flag name \"${param.name}\" in command definition`);\n }\n index.set(param.name, param);\n for (const alias of param.aliases) {\n if (index.has(alias)) {\n throw new Error(`Duplicate flag/alias \"${alias}\" in command definition (conflicts with \"${index.get(alias).name}\")`);\n }\n index.set(alias, param);\n }\n }\n return {\n params,\n index\n };\n};\nconst buildSubcommandIndex = subcommands => {\n const index = new Map();\n const setKey = (key, command) => {\n const existing = index.get(key);\n if (existing && existing !== command) {\n throw new Error(`Duplicate subcommand name/alias \"${key}\" in command definition (conflicts with \"${existing.name}\")`);\n }\n index.set(key, command);\n };\n for (const group of subcommands) {\n for (const subcommand of group.commands) {\n setKey(subcommand.name, subcommand);\n if (subcommand.alias && subcommand.alias !== subcommand.name) {\n setKey(subcommand.alias, subcommand);\n }\n }\n }\n return index;\n};\n/* ========================================================================== */\n/* Flag Accumulator */\n/* ========================================================================== */\n/** Creates an empty flag map with all known flag names initialized to [].\n * @internal\n */\nexport const createEmptyFlagMap = params => Object.fromEntries(params.map(p => [p.name, []]));\n/**\n * Creates a mutable accumulator for collecting flag values.\n * Pre-initializes empty arrays for all known flags.\n */\nconst createFlagAccumulator = params => {\n const map = createEmptyFlagMap(params);\n return {\n add: (name, raw) => {\n if (raw !== undefined) map[name].push(raw);\n },\n merge: from => {\n for (const key in from) {\n const values = from[key];\n if (values?.length) {\n for (let i = 0; i < values.length; i++) {\n map[key].push(values[i]);\n }\n }\n }\n },\n snapshot: () => map\n };\n};\nconst isFlagToken = t => t._tag === \"LongOption\" || t._tag === \"ShortOption\";\nconst getFlagName = t => t._tag === \"LongOption\" ? t.name : t.flag;\nconst resolveFlag = (token, registry) => {\n const tokenName = getFlagName(token);\n const direct = registry.index.get(tokenName);\n if (direct && direct.name === tokenName) {\n return {\n param: direct,\n negated: false\n };\n }\n if (token._tag === \"LongOption\" && token.name.startsWith(\"no-\")) {\n const canonicalName = token.name.slice(3);\n const param = registry.index.get(canonicalName);\n if (param && param.name === canonicalName && Primitive.isBoolean(param.primitiveType)) {\n return {\n param,\n negated: true\n };\n }\n }\n if (direct) {\n return {\n param: direct,\n negated: false\n };\n }\n return undefined;\n};\nconst invalidNegatedFlagValue = (token, spec, value) => new CliError.InvalidValue({\n option: spec.name,\n value,\n expected: `omit the value and use ${token.raw} by itself to set --${spec.name} to false`,\n kind: \"flag\"\n});\n/**\n * Checks whether a token is a boolean literal value.\n * Recognizes: true/false, yes/no, on/off, 1/0\n */\nconst asBooleanLiteral = token => token?._tag === \"Value\" && (Primitive.isTrueValue(token.value) || Primitive.isFalseValue(token.value)) ? token.value : undefined;\n/* ========================================================================== */\n/* Flag Value Consumption */\n/* ========================================================================== */\n/**\n * Reads a flag's value from the token stream.\n *\n * Value resolution order:\n * 1. Inline value: --flag=value or -f=value\n * 2. Boolean special case: implicit \"true\" or explicit boolean literal\n * 3. Next token: consume following Value token if present\n */\nconst consumeFlagValue = (cursor, token, spec, negated = false) => {\n const consumed = consumeFlagValueWithTokens(cursor, token, spec, negated);\n switch (consumed._tag) {\n case \"Value\":\n return {\n _tag: \"Value\",\n value: consumed.value\n };\n case \"Error\":\n return {\n _tag: \"Error\",\n error: consumed.error\n };\n }\n};\nconst consumeFlagValueWithTokens = (cursor, token, spec, negated = false) => {\n // Inline value has highest priority\n if (negated) {\n if (token.value !== undefined) {\n return {\n _tag: \"Error\",\n error: invalidNegatedFlagValue(token, spec, token.value),\n tokens: []\n };\n }\n const literal = asBooleanLiteral(cursor.peek());\n if (literal !== undefined) {\n const literalToken = cursor.take();\n return {\n _tag: \"Error\",\n error: invalidNegatedFlagValue(token, spec, literal),\n tokens: literalToken === undefined ? [] : [literalToken]\n };\n }\n return {\n _tag: \"Value\",\n value: \"false\",\n tokens: []\n };\n }\n if (token.value !== undefined) {\n return {\n _tag: \"Value\",\n value: token.value,\n tokens: []\n };\n }\n // Boolean flags: check for explicit literal or default to \"true\"\n if (Primitive.isBoolean(spec.primitiveType)) {\n const literal = asBooleanLiteral(cursor.peek());\n const literalToken = literal !== undefined ? cursor.take() : undefined;\n return {\n _tag: \"Value\",\n value: literal ?? \"true\",\n tokens: literalToken === undefined ? [] : [literalToken]\n };\n }\n // Non-boolean: try to consume next Value token\n const next = cursor.peek();\n if (next?._tag === \"Value\") {\n const valueToken = cursor.take();\n return {\n _tag: \"Value\",\n value: next.value,\n tokens: valueToken === undefined ? [] : [valueToken]\n };\n }\n return {\n _tag: \"Value\",\n value: undefined,\n tokens: []\n };\n};\n/**\n * Consumes known flags from a token stream.\n * Unrecognized tokens are passed through to remainder.\n * Used for both global flag extraction and npm-style parent flag collection.\n * @internal\n */\nexport const consumeKnownFlags = (tokens, registry) => {\n const flagMap = createEmptyFlagMap(registry.params);\n const remainder = [];\n const errors = [];\n const cursor = makeCursor(tokens);\n for (let t = cursor.take(); t; t = cursor.take()) {\n if (!isFlagToken(t)) {\n remainder.push(t);\n continue;\n }\n const resolved = resolveFlag(t, registry);\n if (!resolved) {\n remainder.push(t);\n continue;\n }\n const consumed = consumeFlagValue(cursor, t, resolved.param, resolved.negated);\n if (consumed._tag === \"Error\") {\n errors.push(consumed.error);\n continue;\n }\n if (consumed.value !== undefined) {\n flagMap[resolved.param.name].push(consumed.value);\n }\n }\n return {\n flagMap,\n remainder,\n errors\n };\n};\nconst extractFlagParams = command => {\n const commandImpl = toImpl(command);\n const singles = commandImpl.config.flags.flatMap(Param.extractSingleParams);\n return singles.filter(Param.isFlagParam);\n};\nconst extractContextFlagParams = command => {\n const commandImpl = toImpl(command);\n const singles = commandImpl.contextConfig.flags.flatMap(Param.extractSingleParams);\n return singles.filter(Param.isFlagParam);\n};\nconst resolveFromRegistries = (token, registries) => {\n for (const registry of registries) {\n const resolved = resolveFlag(token, registry);\n if (resolved !== undefined) {\n return resolved;\n }\n }\n return undefined;\n};\nconst preserveFlag = (remainder, cursor, token, resolved) => {\n remainder.push(token);\n const consumed = consumeFlagValueWithTokens(cursor, token, resolved.param, resolved.negated);\n remainder.push(...consumed.tokens);\n};\nconst localFlagWouldPrecedeSubcommand = (token, remainingTokens, resolved, subIndex, registries) => {\n const cursor = makeCursor(remainingTokens);\n consumeFlagValueWithTokens(cursor, token, resolved.param, resolved.negated);\n for (let token = cursor.take(); token; token = cursor.take()) {\n if (isFlagToken(token)) {\n const known = resolveFromRegistries(token, registries);\n if (known !== undefined) {\n consumeFlagValueWithTokens(cursor, token, known.param, known.negated);\n }\n continue;\n }\n if (token._tag === \"Value\") {\n return subIndex.has(token.value);\n }\n }\n return false;\n};\n/**\n * Consumes global flags while walking the command tree.\n *\n * Command-local flags take precedence over global flags at the selected command\n * level. This lets commands reuse a global flag name, for example a subcommand\n * with its own `--version <value>` flag overriding the built-in global\n * `--version` action.\n * @internal\n */\nexport const consumeGlobalFlags = (tokens, command, registry) => {\n const flagMap = createEmptyFlagMap(registry.params);\n const errors = [];\n const consumeLevel = (tokens, command, ignoredRegistries) => {\n const localRegistry = createFlagRegistry(extractFlagParams(command));\n const inheritedRegistry = createFlagRegistry(extractContextFlagParams(command));\n const subIndex = buildSubcommandIndex(command.subcommands);\n const cursor = makeCursor(tokens);\n const remainder = [];\n let awaitingFirstValue = true;\n for (let token = cursor.take(); token; token = cursor.take()) {\n if (isFlagToken(token)) {\n const ignored = resolveFromRegistries(token, ignoredRegistries);\n if (ignored !== undefined) {\n preserveFlag(remainder, cursor, token, ignored);\n continue;\n }\n const inherited = resolveFlag(token, inheritedRegistry);\n if (inherited !== undefined) {\n preserveFlag(remainder, cursor, token, inherited);\n continue;\n }\n const local = resolveFlag(token, localRegistry);\n const global = resolveFlag(token, registry);\n if (local !== undefined) {\n if (global === undefined || !awaitingFirstValue || !localFlagWouldPrecedeSubcommand(token, cursor.rest(), local, subIndex, [localRegistry, inheritedRegistry, registry])) {\n preserveFlag(remainder, cursor, token, local);\n continue;\n }\n }\n if (global !== undefined) {\n const consumed = consumeFlagValueWithTokens(cursor, token, global.param, global.negated);\n if (consumed._tag === \"Error\") {\n errors.push(consumed.error);\n continue;\n }\n if (consumed.value !== undefined) {\n flagMap[global.param.name].push(consumed.value);\n }\n continue;\n }\n remainder.push(token);\n continue;\n }\n if (token._tag === \"Value\" && awaitingFirstValue) {\n const sub = subIndex.get(token.value);\n if (sub !== undefined) {\n remainder.push(token);\n remainder.push(...consumeLevel(cursor.rest(), sub, [...ignoredRegistries, inheritedRegistry]));\n return remainder;\n }\n awaitingFirstValue = false;\n }\n remainder.push(token);\n }\n return remainder;\n };\n return {\n flagMap,\n remainder: consumeLevel(tokens, command, []),\n errors\n };\n};\n/* ========================================================================== */\n/* Error Creation */\n/* ========================================================================== */\nconst createUnrecognizedFlagError = (token, params, commandPath) => {\n const printable = token._tag === \"LongOption\" ? `--${token.name}` : `-${token.flag}`;\n const validNames = [];\n for (const p of params) {\n // Exclude hidden flags so a near-miss typo cannot reveal a flag name\n // that was intentionally kept out of --help.\n if (p.hidden) continue;\n validNames.push(p.name);\n if (Primitive.isBoolean(p.primitiveType)) {\n validNames.push(`no-${p.name}`);\n }\n for (const alias of p.aliases) {\n validNames.push(alias);\n }\n }\n const suggestions = suggest(getFlagName(token), validNames).map(n => n.length === 1 ? `-${n}` : `--${n}`);\n return new CliError.UnrecognizedOption({\n option: printable,\n suggestions,\n command: commandPath\n });\n};\n/* ========================================================================== */\n/* Parse State */\n/* ========================================================================== */\nconst createParseState = registry => ({\n flags: createFlagAccumulator(registry.params),\n arguments: [],\n errors: [],\n mode: {\n _tag: \"AwaitingFirstValue\"\n }\n});\nconst toLeafResult = state => ({\n _tag: \"Leaf\",\n flags: state.flags.snapshot(),\n arguments: state.arguments,\n errors: state.errors\n});\n/* ========================================================================== */\n/* First Value Resolution */\n/* ========================================================================== */\n/**\n * Determines how to handle the first value token.\n *\n * If it matches a known subcommand:\n * - Collect inherited parent flags from remaining tokens (npm-style)\n * - Return SubcommandResult with child tokens\n *\n * Otherwise:\n * - Return Argument to treat it as a positional argument\n * - Report error if command expects subcommand but got unknown value\n */\nconst resolveFirstValue = (value, cursor, context, state) => {\n const {\n command,\n commandPath,\n inheritedFlagRegistry,\n localFlagNames\n } = context;\n const subIndex = buildSubcommandIndex(command.subcommands);\n const sub = subIndex.get(value);\n if (sub) {\n const selectedPath = [...commandPath, sub.name];\n // Local flags are not inherited by subcommands.\n const parentFlags = state.flags.snapshot();\n for (const localFlagName of localFlagNames) {\n const values = parentFlags[localFlagName];\n if (values !== undefined && values.length > 0) {\n state.errors.push(new CliError.UnrecognizedOption({\n option: `--${localFlagName}`,\n suggestions: [],\n command: selectedPath\n }));\n }\n }\n // npm-style: inherited parent flags can appear after subcommand name\n const tail = consumeKnownFlags(cursor.rest(), inheritedFlagRegistry);\n state.flags.merge(tail.flagMap);\n state.errors.push(...tail.errors);\n return {\n _tag: \"Subcommand\",\n result: {\n _tag: \"Sub\",\n flags: state.flags.snapshot(),\n sub,\n childTokens: tail.remainder,\n errors: state.errors\n }\n };\n }\n // Not a subcommand. Check if this looks like a typo.\n const expectsArgs = toImpl(command).config.arguments.length > 0;\n if (!expectsArgs && subIndex.size > 0) {\n // Exclude hidden subcommands so a typo cannot reveal a subcommand name\n // that was intentionally kept out of --help. Hidden commands still\n // resolve via subIndex when invoked by exact name.\n const visibleKeys = [];\n for (const [key, sub] of subIndex) {\n if (!sub.hidden) visibleKeys.push(key);\n }\n const suggestions = suggest(value, visibleKeys);\n state.errors.push(new CliError.UnknownSubcommand({\n subcommand: value,\n parent: commandPath,\n suggestions\n }));\n }\n return {\n _tag: \"Argument\"\n };\n};\n/* ========================================================================== */\n/* Token Processing */\n/* ========================================================================== */\n/**\n * Processes a flag token: looks up in registry, consumes value, records it.\n * Reports unrecognized flags as errors.\n */\nconst processFlag = (token, cursor, context, state) => {\n const {\n commandPath,\n flagRegistry\n } = context;\n const resolved = resolveFlag(token, flagRegistry);\n if (!resolved) {\n state.errors.push(createUnrecognizedFlagError(token, flagRegistry.params, commandPath));\n return;\n }\n const consumed = consumeFlagValue(cursor, token, resolved.param, resolved.negated);\n if (consumed._tag === \"Error\") {\n state.errors.push(consumed.error);\n return;\n }\n state.flags.add(resolved.param.name, consumed.value);\n};\n/**\n * Processes a value token based on current parsing mode.\n *\n * In AwaitingFirstValue mode:\n * - Check if value is a subcommand\n * - If so, return SubcommandResult to exit scanning\n * - If not, switch to CollectingArguments mode\n *\n * In CollectingArguments mode:\n * - Simply add value to arguments list\n */\nconst processValue = (value, cursor, context, state) => {\n if (state.mode._tag === \"AwaitingFirstValue\") {\n const result = resolveFirstValue(value, cursor, context, state);\n if (result._tag === \"Subcommand\") {\n return result.result;\n }\n state.mode = {\n _tag: \"CollectingArguments\"\n };\n }\n state.arguments.push(value);\n return undefined;\n};\n/* ========================================================================== */\n/* Command Level Scanning */\n/* ========================================================================== */\n/**\n * Scans a single command level, processing all tokens.\n *\n * For each token:\n * - Flags: Look up, consume value, record in accumulator\n * - Values: Check for subcommand (first value only), then collect as arguments\n *\n * Returns LeafResult if no subcommand detected, SubcommandResult otherwise.\n */\nconst scanCommandLevel = (tokens, context) => {\n const cursor = makeCursor(tokens);\n const state = createParseState(context.flagRegistry);\n for (let token = cursor.take(); token; token = cursor.take()) {\n if (isFlagToken(token)) {\n processFlag(token, cursor, context, state);\n continue;\n }\n if (token._tag === \"Value\") {\n const subResult = processValue(token.value, cursor, context, state);\n if (subResult) return subResult;\n }\n }\n return toLeafResult(state);\n};\n//# sourceMappingURL=parser.js.map",
|
|
105
|
+
"import * as Console from \"../../Console.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as References from \"../../References.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Stdio from \"../../Stdio.js\";\nimport * as Terminal from \"../../Terminal.js\";\nimport * as CliError from \"./CliError.js\";\nimport * as CliOutput from \"./CliOutput.js\";\nimport * as GlobalFlag from \"./GlobalFlag.js\";\nimport { checkForDuplicateFlags, makeCommand, makeParser, toImpl, TypeId } from \"./internal/command.js\";\nimport { mergeConfig, parseConfig } from \"./internal/config.js\";\nimport { getGlobalFlagsForCommandPath, getGlobalFlagsForCommandTree, getHelpForCommandPath } from \"./internal/help.js\";\nimport * as Lexer from \"./internal/lexer.js\";\nimport * as Parser from \"./internal/parser.js\";\nimport * as Param from \"./Param.js\";\n/**\n * Returns `true` if the provided value is a `Command`.\n *\n * **Gotchas**\n *\n * This checks for the `Command` type-id property; it does not validate the full\n * command shape.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCommand = u => Predicate.hasProperty(u, TypeId);\n/* ========================================================================== */\n/* Constructors */\n/* ========================================================================== */\n/**\n * Creates a `Command` from a name, an optional configuration, and an optional\n * handler.\n *\n * **Details**\n *\n * Use `withDescription` and related metadata combinators to add help text. The\n * overloads support simple commands, configured commands, and commands with\n * effectful handlers.\n *\n * **Example** (Creating commands)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n * import { Argument, Command, Flag } from \"effect/unstable/cli\"\n *\n * // Simple command with no configuration\n * const version = Command.make(\"version\")\n *\n * // Command with simple flags\n * const greet = Command.make(\"greet\", {\n * name: Flag.string(\"name\"),\n * count: Flag.integer(\"count\").pipe(Flag.withDefault(1))\n * })\n *\n * // Command with nested configuration\n * const deploy = Command.make(\"deploy\", {\n * environment: Flag.string(\"env\").pipe(\n * Flag.withDescription(\"Target environment\")\n * ),\n * server: {\n * host: Flag.string(\"host\").pipe(Flag.withDefault(\"localhost\")),\n * port: Flag.integer(\"port\").pipe(Flag.withDefault(3000))\n * },\n * files: Argument.string(\"files\").pipe(Argument.variadic),\n * force: Flag.boolean(\"force\").pipe(Flag.withDescription(\"Force deployment\"))\n * })\n *\n * // Command with handler\n * const deployWithHandler = Command.make(\"deploy\", {\n * environment: Flag.string(\"env\"),\n * force: Flag.boolean(\"force\")\n * }, (config) =>\n * Effect.gen(function*() {\n * yield* Console.log(`Starting deployment to ${config.environment}`)\n *\n * if (!config.force && config.environment === \"production\") {\n * return yield* Effect.fail(\"Production deployments require --force flag\")\n * }\n *\n * yield* Console.log(\"Deployment completed successfully\")\n * }))\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = (name, config, handler) => {\n const parsedConfig = parseConfig(config ?? {});\n return makeCommand({\n name,\n config: parsedConfig,\n ...(Predicate.isNotUndefined(handler) ? {\n handle: handler\n } : {})\n });\n};\n/* ========================================================================== */\n/* Combinators */\n/* ========================================================================== */\n/**\n * Adds or replaces the handler for a command.\n *\n * **Example** (Adding command handlers)\n *\n * ```ts\n * import { Console } from \"effect\"\n * import { Command, Flag } from \"effect/unstable/cli\"\n *\n * // Command without initial handler\n * const greet = Command.make(\"greet\", {\n * name: Flag.string(\"name\")\n * })\n *\n * // Add handler later\n * const greetWithHandler = greet.pipe(\n * Command.withHandler((config: { readonly name: string }) =>\n * Console.log(`Hello, ${config.name}!`)\n * )\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withHandler = /*#__PURE__*/dual(2, (self, handler) => makeCommand({\n ...toImpl(self),\n handle: handler\n}));\nconst normalizeSubcommandEntries = entries => {\n const flat = [];\n const grouped = new Map();\n const addToGroup = (group, command) => {\n flat.push(command);\n const existing = grouped.get(group);\n if (existing) {\n existing.push(command);\n } else {\n grouped.set(group, [command]);\n }\n };\n for (const entry of entries) {\n if (isCommand(entry)) {\n addToGroup(undefined, entry);\n continue;\n }\n for (const command of entry.commands) {\n addToGroup(entry.group, command);\n }\n }\n const groups = [];\n const ungroupedCommands = grouped.get(undefined);\n if (ungroupedCommands && ungroupedCommands.length > 0) {\n groups.push({\n group: undefined,\n commands: ungroupedCommands\n });\n }\n for (const [group, commands] of grouped) {\n if (group === undefined) {\n continue;\n }\n groups.push({\n group,\n commands\n });\n }\n return {\n flat,\n groups\n };\n};\n/**\n * Adds subcommands to a command, creating a hierarchical command structure.\n *\n * **Details**\n *\n * Subcommands can access their parent's parsed configuration by yielding the parent\n * command within their handler. This enables shared parent flags that affect\n * all subcommands.\n *\n * **Example** (Adding subcommands)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n * import { Command, Flag } from \"effect/unstable/cli\"\n *\n * // Parent command with shared flags\n * const git = Command.make(\"git\").pipe(\n * Command.withSharedFlags({\n * verbose: Flag.boolean(\"verbose\")\n * })\n * )\n *\n * // Subcommand that accesses parent config\n * const clone = Command.make(\"clone\", {\n * repository: Flag.string(\"repo\")\n * }, (config) =>\n * Effect.gen(function*() {\n * const parent = yield* git // Access parent's parsed config\n * if (parent.verbose) {\n * yield* Console.log(\"Verbose mode enabled\")\n * }\n * yield* Console.log(`Cloning ${config.repository}`)\n * }))\n *\n * const app = git.pipe(Command.withSubcommands([clone]))\n * // Usage: git --verbose clone --repo github.com/foo/bar\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withSubcommands = /*#__PURE__*/dual(2, (self, subcommands) => {\n const normalized = normalizeSubcommandEntries(subcommands);\n checkForDuplicateFlags(self, normalized.flat);\n const impl = toImpl(self);\n const byName = new Map(normalized.flat.map(s => [s.name, toImpl(s)]));\n const SubcommandStateSymbol = Symbol(\"effect/cli/SubcommandState\");\n const parse = Effect.fnUntraced(function* (raw) {\n if (Option.isNone(raw.subcommand)) {\n return yield* impl.parse(raw);\n }\n const sub = byName.get(raw.subcommand.value.name);\n if (!sub) {\n return yield* impl.parse(raw);\n }\n const context = yield* impl.parseContext(raw);\n const result = yield* sub.parse(raw.subcommand.value.parsedInput);\n return Object.assign({}, context, {\n [SubcommandStateSymbol]: {\n name: sub.name,\n result\n }\n });\n });\n const handle = Effect.fnUntraced(function* (input, path) {\n const internal = input;\n const selectedSubcommand = internal[SubcommandStateSymbol];\n if (selectedSubcommand) {\n const child = byName.get(selectedSubcommand.name);\n if (!child) {\n return yield* new CliError.ShowHelp({\n commandPath: path,\n errors: []\n });\n }\n return yield* child.handle(selectedSubcommand.result, [...path, child.name]).pipe(Effect.provideService(impl.service, input));\n }\n return yield* impl.handle(input, path);\n });\n return makeCommand({\n name: impl.name,\n config: impl.config,\n contextConfig: impl.contextConfig,\n description: impl.description,\n shortDescription: impl.shortDescription,\n alias: impl.alias,\n annotations: impl.annotations,\n globalFlags: impl.globalFlags,\n examples: impl.examples,\n service: impl.service,\n subcommands: normalized.groups,\n parse,\n parseContext: impl.parseContext,\n handle\n });\n});\n/**\n * Adds flags that are inherited by subcommands.\n *\n * **Details**\n *\n * Shared flags are available to this command's handler and to descendant\n * handlers via `yield* parentCommand`. Shared flags are accepted both before\n * and after a selected subcommand name (npm-style).\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withSharedFlags = /*#__PURE__*/dual(2, (self, sharedFlags) => {\n const impl = toImpl(self);\n const sharedConfig = parseConfig(sharedFlags);\n const mergedConfig = mergeConfig(impl.config, sharedConfig);\n const mergedContextConfig = mergeConfig(impl.contextConfig, sharedConfig);\n if (impl.subcommands.length > 0) {\n const flatSubcommands = impl.subcommands.flatMap(group => group.commands);\n checkForDuplicateFlags(self, flatSubcommands, {\n contextConfig: mergedContextConfig\n });\n }\n const parseShared = makeParser(sharedConfig);\n const parse = Effect.fnUntraced(function* (raw) {\n const base = yield* impl.parse(raw);\n const shared = yield* parseShared(raw);\n return Object.assign({}, base, shared);\n });\n const parseContext = Effect.fnUntraced(function* (raw) {\n const base = yield* impl.parseContext(raw);\n const shared = yield* parseShared(raw);\n return Object.assign({}, base, shared);\n });\n const handle = (input, commandPath) => impl.handle(input, commandPath);\n return makeCommand({\n name: impl.name,\n config: mergedConfig,\n contextConfig: mergedContextConfig,\n description: impl.description,\n shortDescription: impl.shortDescription,\n alias: impl.alias,\n annotations: impl.annotations,\n globalFlags: impl.globalFlags,\n examples: impl.examples,\n service: impl.service,\n subcommands: impl.subcommands,\n parse,\n parseContext,\n handle\n });\n});\n/**\n * Adds global flags to a command scope.\n *\n * **Details**\n *\n * Declared global flags apply to the command and all of its descendants.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withGlobalFlags = /*#__PURE__*/dual(2, (self, globalFlags) => {\n const impl = toImpl(self);\n const next = Array.from(new Set([...impl.globalFlags, ...globalFlags]));\n return makeCommand({\n ...impl,\n globalFlags: next\n });\n});\n/**\n * Sets the description for a command.\n *\n * **Details**\n *\n * Descriptions provide users with information about what the command does\n * when they view help documentation.\n *\n * **Example** (Setting descriptions)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n * import { Command, Flag } from \"effect/unstable/cli\"\n *\n * const deploy = Command.make(\"deploy\", {\n * environment: Flag.string(\"env\")\n * }, (config) =>\n * Effect.gen(function*() {\n * yield* Console.log(`Deploying to ${config.environment}`)\n * })).pipe(\n * Command.withDescription(\"Deploy the application to a specified environment\")\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withDescription = /*#__PURE__*/dual(2, (self, description) => makeCommand({\n ...toImpl(self),\n description\n}));\n/**\n * Sets a short description for a command.\n *\n * **Details**\n *\n * Short descriptions are used when listing subcommands in help output and\n * shell completions. If no short description is provided, the full\n * `description` is used as a fallback.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withShortDescription = /*#__PURE__*/dual(2, (self, shortDescription) => makeCommand({\n ...toImpl(self),\n shortDescription\n}));\n/**\n * Sets an alias for a command.\n *\n * **Details**\n *\n * Aliases are accepted as alternate subcommand names during parsing and are\n * shown in help output as `name, alias`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withAlias = /*#__PURE__*/dual(2, (self, alias) => makeCommand({\n ...toImpl(self),\n alias\n}));\n/**\n * Hides a subcommand from parent help output, shell completions, and\n * \"did you mean?\" suggestions while keeping it fully invocable by exact name.\n *\n * **When to use**\n *\n * Use when you use this for experimental or internal subcommands that should be accepted but\n * not advertised on the public CLI surface.\n *\n * **Example** (Hiding a subcommand)\n *\n * ```ts\n * import { Command } from \"effect/unstable/cli\"\n *\n * // `experimental` still runs when invoked as `mycli experimental`,\n * // but it does not appear under SUBCOMMANDS in `mycli --help`.\n * const experimental = Command.make(\"experimental\").pipe(\n * Command.withHidden\n * )\n *\n * const root = Command.make(\"mycli\").pipe(\n * Command.withSubcommands([experimental])\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withHidden = self => makeCommand({\n ...toImpl(self),\n hidden: true\n});\n/**\n * Adds a custom annotation to a command.\n *\n * **When to use**\n *\n * Use to attach one command-scoped metadata value under a `Context.Key`,\n * especially for consumers such as custom help formatters.\n *\n * **Details**\n *\n * Annotations are stored on the command's annotation context and flow into\n * generated help document annotations.\n *\n * **Gotchas**\n *\n * Adding the same `Context.Key` again replaces the earlier value.\n *\n * @see {@link annotateMerge} for merging an existing annotation context\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const annotate = /*#__PURE__*/dual(3, (self, service, value) => {\n const impl = toImpl(self);\n return makeCommand({\n ...impl,\n annotations: Context.add(impl.annotations, service, value)\n });\n});\n/**\n * Merges a Context of annotations into a command.\n *\n * **When to use**\n *\n * Use when attaching an already-built `Context.Context` of command annotations.\n *\n * **Details**\n *\n * Merged annotations are stored on the command and exposed through generated\n * help document annotations.\n *\n * **Gotchas**\n *\n * If both contexts contain the same `Context.Key`, the incoming annotations\n * context wins.\n *\n * @see {@link annotate} for adding a single annotation without constructing a `Context`\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const annotateMerge = /*#__PURE__*/dual(2, (self, annotations) => {\n const impl = toImpl(self);\n return makeCommand({\n ...impl,\n annotations: Context.merge(impl.annotations, annotations)\n });\n});\n/**\n * Sets usage examples for a command.\n *\n * **Details**\n *\n * Examples are exposed in structured `HelpDoc` data and rendered by the\n * default formatter in an `EXAMPLES` section.\n *\n * **Example** (Adding usage examples)\n *\n * ```ts\n * import { Command } from \"effect/unstable/cli\"\n *\n * const login = Command.make(\"login\").pipe(\n * Command.withExamples([\n * { command: \"myapp login\", description: \"Log in with browser OAuth\" },\n * { command: \"myapp login --token sbp_abc123\", description: \"Log in with a token\" }\n * ])\n * )\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const withExamples = /*#__PURE__*/dual(2, (self, examples) => makeCommand({\n ...toImpl(self),\n examples\n}));\n/* ========================================================================== */\n/* Providing Services */\n/* ========================================================================== */\n// Internal helper: transforms a command's handler while preserving other properties\nconst mapHandler = (self, f) => {\n const impl = toImpl(self);\n return makeCommand({\n ...impl,\n handle: (input, path) => f(impl.handle(input, path), input)\n });\n};\n/**\n * Provides the handler of a command with the services produced by a layer\n * that optionally depends on the command-line input to be created.\n *\n * **Example** (Providing command services)\n *\n * ```ts\n * import { Effect, FileSystem, PlatformError } from \"effect\"\n * import { Command, Flag } from \"effect/unstable/cli\"\n *\n * const deploy = Command.make(\"deploy\", {\n * env: Flag.string(\"env\")\n * }, (config) =>\n * Effect.gen(function*() {\n * const fs = yield* FileSystem.FileSystem\n * // Use fs...\n * })).pipe(\n * // Provide FileSystem based on the --env flag\n * Command.provide((config) =>\n * config.env === \"local\"\n * ? FileSystem.layerNoop({})\n * : FileSystem.layerNoop({\n * access: () =>\n * Effect.fail(\n * PlatformError.badArgument({\n * module: \"FileSystem\",\n * method: \"access\"\n * })\n * )\n * })\n * )\n * )\n * ```\n *\n * @category providing services\n * @since 4.0.0\n */\nexport const provide = /*#__PURE__*/dual(args => isCommand(args[0]), (self, layer, options) => mapHandler(self, (handler, input) => Effect.provide(handler, typeof layer === \"function\" ? layer(input) : layer, options)));\n/**\n * Provides the handler of a command with the implementation of a service that\n * optionally depends on the command-line input to be constructed.\n *\n * @category providing services\n * @since 4.0.0\n */\nexport const provideSync = /*#__PURE__*/dual(3, (self, service, implementation) => mapHandler(self, (handler, input) => Effect.provideService(handler, service, typeof implementation === \"function\" ? implementation(input) : implementation)));\n/**\n * Provides the handler of a command with the service produced by an effect\n * that optionally depends on the command-line input to be created.\n *\n * **When to use**\n *\n * Use to acquire a service effectfully for each command run, optionally using\n * parsed command input.\n *\n * @see {@link provideSync} for synchronous service acquisition\n * @see {@link provide} for providing an already-available service\n * @see {@link provideEffectDiscard} for running an effect before the handler without providing a service\n *\n * @category providing services\n * @since 4.0.0\n */\nexport const provideEffect = /*#__PURE__*/dual(3, (self, service, effect) => mapHandler(self, (handler, input) => Effect.provideServiceEffect(handler, service, typeof effect === \"function\" ? effect(input) : effect)));\n/**\n * Allows for execution of an effect, which optionally depends on command-line\n * input to be created, prior to executing the handler of a command.\n *\n * @category providing services\n * @since 4.0.0\n */\nexport const provideEffectDiscard = /*#__PURE__*/dual(2, (self, effect) => mapHandler(self, (handler, input) => Effect.andThen(typeof effect === \"function\" ? effect(input) : effect, handler)));\n/* ========================================================================== */\n/* Execution */\n/* ========================================================================== */\nconst getOutOfScopeGlobalFlagErrors = (allFlags, activeFlags, flagMap, commandPath) => {\n const activeSet = new Set(activeFlags);\n const errors = [];\n const seen = new Set();\n for (const flag of allFlags) {\n if (activeSet.has(flag)) {\n continue;\n }\n const singles = Param.extractSingleParams(flag.flag);\n for (const single of singles) {\n const entries = flagMap[single.name];\n if (!entries || entries.length === 0) {\n continue;\n }\n const option = `--${single.name}`;\n if (seen.has(option)) {\n continue;\n }\n seen.add(option);\n errors.push(new CliError.UnrecognizedOption({\n option,\n suggestions: [],\n command: commandPath\n }));\n }\n }\n return errors;\n};\nconst showHelp = (command, error) => Effect.gen(function* () {\n const formatter = yield* CliOutput.Formatter;\n const helpDoc = yield* getHelpForCommandPath(command, error.commandPath, GlobalFlag.BuiltIns);\n yield* Console.log(formatter.formatHelpDoc(helpDoc));\n if (error.errors.length > 0) {\n yield* Console.error(formatter.formatErrors(error.errors));\n }\n});\n/**\n * Runs a command using the arguments supplied by the `Stdio` service.\n *\n * **When to use**\n *\n * Use when you use `run` at an application entry point when arguments should come from\n * `Stdio`; use `runWith` when you need an explicit argument array, such as in\n * tests.\n *\n * **Example** (Running commands with standard input)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n * import { Command, Flag } from \"effect/unstable/cli\"\n *\n * const greetCommand = Command.make(\"greet\", {\n * name: Flag.string(\"name\")\n * }, (config) =>\n * Effect.gen(function*() {\n * yield* Console.log(`Hello, ${config.name}!`)\n * }))\n *\n * // Automatically gets args from the Stdio service\n * const program = Command.run(greetCommand, {\n * version: \"1.0.0\"\n * })\n * ```\n *\n * @category command execution\n * @since 4.0.0\n */\nexport const run = /*#__PURE__*/dual(2, (command, config) => Stdio.Stdio.use(({\n args\n}) => Effect.flatMap(args, args => runWith(command, config)(args))));\n/**\n * Runs a command with explicitly provided arguments instead of using arguments from `Stdio`.\n *\n * **When to use**\n *\n * Use when you use this function for testing CLI applications or when you want to\n * programmatically execute commands with specific arguments.\n *\n * **Example** (Running commands with explicit arguments)\n *\n * ```ts\n * import { Console, Effect } from \"effect\"\n * import { Command, Flag } from \"effect/unstable/cli\"\n *\n * const greet = Command.make(\"greet\", {\n * name: Flag.string(\"name\"),\n * count: Flag.integer(\"count\").pipe(Flag.withDefault(1))\n * }, (config) =>\n * Effect.gen(function*() {\n * for (let i = 0; i < config.count; i++) {\n * yield* Console.log(`Hello, ${config.name}!`)\n * }\n * }))\n *\n * // Test with specific arguments\n * const testProgram = Effect.gen(function*() {\n * const runCommand = Command.runWith(greet, { version: \"1.0.0\" })\n *\n * // Test normal execution\n * yield* runCommand([\"--name\", \"Alice\", \"--count\", \"2\"])\n *\n * // Test help display\n * yield* runCommand([\"--help\"])\n *\n * // Test version display\n * yield* runCommand([\"--version\"])\n * })\n * ```\n *\n * @category command execution\n * @since 4.0.0\n */\nexport const runWith = (command, config) => {\n const commandImpl = toImpl(command);\n return Effect.fnUntraced(function* (args) {\n const {\n tokens,\n trailingOperands\n } = Lexer.lex(args);\n // 1. Collect known global flags from the command tree\n const allFlags = getGlobalFlagsForCommandTree(command, GlobalFlag.BuiltIns);\n // 2. Extract global flag tokens\n const allFlagParams = allFlags.flatMap(f => Param.extractSingleParams(f.flag));\n const globalRegistry = Parser.createFlagRegistry(allFlagParams.filter(Param.isFlagParam));\n const {\n flagMap,\n remainder,\n errors: globalFlagErrors\n } = Parser.consumeGlobalFlags(tokens, command, globalRegistry);\n const emptyArgs = {\n flags: flagMap,\n arguments: []\n };\n // 3. Parse command arguments from remaining tokens\n const parsedArgs = yield* Parser.parseArgs({\n tokens: remainder,\n trailingOperands\n }, command);\n const commandPath = [command.name, ...Parser.getCommandPath(parsedArgs)];\n const handlerCtx = {\n command,\n commandPath,\n version: config.version\n };\n const activeFlags = getGlobalFlagsForCommandPath(command, commandPath, GlobalFlag.BuiltIns);\n // 4. Reject globals that were passed outside the active command scope\n const outOfScopeErrors = getOutOfScopeGlobalFlagErrors(allFlags, activeFlags, flagMap, commandPath);\n if (outOfScopeErrors.length > 0 || globalFlagErrors.length > 0) {\n const parseErrors = parsedArgs.errors ?? [];\n return yield* new CliError.ShowHelp({\n commandPath,\n errors: [...globalFlagErrors, ...outOfScopeErrors, ...parseErrors]\n });\n }\n // 5. Process action flags — first present action wins, then exit\n for (const flag of activeFlags) {\n if (flag._tag !== \"Action\") continue;\n const singles = Param.extractSingleParams(flag.flag);\n const hasEntry = singles.some(s => {\n const entries = flagMap[s.name];\n return entries !== undefined && entries.length > 0;\n });\n if (!hasEntry) continue;\n const [, value] = yield* flag.flag.parse(emptyArgs);\n yield* flag.run(value, handlerCtx);\n return;\n }\n // 6. Handle parsing errors\n if (parsedArgs.errors && parsedArgs.errors.length > 0) {\n return yield* new CliError.ShowHelp({\n commandPath,\n errors: parsedArgs.errors\n });\n }\n const parseResult = yield* Effect.result(commandImpl.parse(parsedArgs));\n if (parseResult._tag === \"Failure\") {\n return yield* new CliError.ShowHelp({\n commandPath,\n errors: [parseResult.failure]\n });\n }\n // 7. Provide setting values\n let program = commandImpl.handle(parseResult.success, [command.name]);\n for (const flag of activeFlags) {\n if (flag._tag !== \"Setting\") continue;\n const [, value] = yield* flag.flag.parse(emptyArgs);\n program = Effect.provideService(program, flag, value);\n }\n const [, logLevel] = yield* GlobalFlag.LogLevel.flag.parse(emptyArgs);\n program = Effect.provideService(program, GlobalFlag.LogLevel, logLevel);\n // 8. Apply built-in setting behavior\n const services = Option.match(logLevel, {\n onNone: () => Context.empty(),\n onSome: level => Context.make(References.MinimumLogLevel, level)\n });\n // 9. Run command handler with composed context\n yield* Effect.provideContext(program, services);\n }, Effect.catchFilter(error => CliError.isCliError(error) && error._tag === \"ShowHelp\" ? Result.succeed(error) : Result.fail(error), error => Effect.andThen(showHelp(command, error), Effect.fail(error))), Effect.catchFilter(e => Terminal.isQuitError(e) ? Result.succeed(e) : Result.fail(e), _ => Effect.interrupt));\n};\n//# sourceMappingURL=Command.js.map",
|
|
106
|
+
"import * as Command from \"effect/unstable/cli/Command\"\n\ntype Options<Config extends Command.Command.Config, Commands extends ReadonlyArray<Any>> = {\n readonly description?: string\n readonly params?: Config\n readonly commands?: Commands\n}\n\nexport interface Node<\n Name extends string,\n Spec extends Command.Command<Name, any, any, any, any>,\n Commands extends Children,\n> {\n readonly name: Name\n readonly spec: Spec\n readonly commands: Commands\n}\n\nexport type Any = Node<string, Command.Command<any, any, any, any, any>, Children>\nexport type Children = Readonly<Record<string, Any>>\n\nexport function make<\n const Name extends string,\n const Config extends Command.Command.Config = {},\n const Commands extends ReadonlyArray<Any> = [],\n>(name: Name, options: Options<Config, Commands> = {}) {\n const command = Command.make(name, options.params ?? ({} as Config))\n const spec = options.description ? command.pipe(Command.withDescription(options.description)) : command\n return {\n name,\n spec,\n commands: Object.fromEntries(\n (options.commands ?? []).map((command) => [command.name, command]),\n ) as ChildrenOf<Commands>,\n }\n}\n\ntype ChildrenOf<Commands extends ReadonlyArray<Any>> = {\n readonly [Node in Commands[number] as Node[\"name\"]]: Node\n}\n\nexport * as Spec from \"./spec\"\n",
|
|
107
|
+
"import { Argument, Flag } from \"effect/unstable/cli\"\nimport { Spec } from \"../framework/spec\"\n\ndeclare const OPENCODE_CLI_NAME: string | undefined\n\nexport const Commands = Spec.make(typeof OPENCODE_CLI_NAME === \"string\" ? OPENCODE_CLI_NAME : \"opencode\", {\n description: \"OpenCode 2.0 preview command line interface\",\n commands: [\n Spec.make(\"debug\", {\n description: \"Debugging and troubleshooting tools\",\n commands: [Spec.make(\"agents\", { description: \"List all agents\" })],\n }),\n Spec.make(\"migrate\", { description: \"Migrate v1 data to v2\" }),\n Spec.make(\"service\", {\n description: \"Manage the background server\",\n commands: [\n Spec.make(\"start\", { description: \"Start the background server\" }),\n Spec.make(\"restart\", { description: \"Restart the background server\" }),\n Spec.make(\"status\", { description: \"Show background server status\" }),\n Spec.make(\"stop\", { description: \"Stop the background server\" }),\n Spec.make(\"password\", {\n description: \"Get or set the server password\",\n params: { value: Argument.string(\"value\").pipe(Argument.optional) },\n }),\n ],\n }),\n Spec.make(\"serve\", {\n description: \"Start the v2 API server\",\n params: {\n hostname: Flag.string(\"hostname\").pipe(Flag.withDefault(\"127.0.0.1\")),\n port: Flag.integer(\"port\").pipe(Flag.optional),\n register: Flag.boolean(\"register\").pipe(Flag.withDefault(false)),\n },\n }),\n ],\n})\n",
|
|
108
|
+
"/**\n * HTTP entity tag values and metadata-based generator layers.\n *\n * ETags are validators for a specific representation of a resource. Servers put\n * them in `ETag` response headers so clients and intermediaries can revalidate\n * cached content with `If-None-Match`, or protect writes with preconditions such\n * as `If-Match`.\n *\n * **Mental model**\n *\n * A strong ETag represents byte-for-byte identity for the selected\n * representation. A weak ETag represents a validator that is useful for cache\n * revalidation but not for operations that require exact byte identity. The\n * `Weak` and `Strong` models store the raw tag value; `toString` adds the\n * required quotes and the `W/` prefix for weak tags.\n *\n * **Common tasks**\n *\n * - Format an `Etag` value for an HTTP header with `toString`.\n * - Provide a `Generator` service with `layer` for strong metadata-derived tags.\n * - Use `layerWeak` when size and modification time are good cache validators\n * but not a byte-for-byte guarantee.\n *\n * **Gotchas**\n *\n * The built-in generator derives tags only from file size and modification time.\n * Choose the strong layer only when that metadata changes for every byte-level\n * content change. This module formats ETags but does not parse incoming ETag\n * headers or implement conditional request logic.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\n/**\n * Formats an `Etag` as an HTTP header value, including quotes and the `W/` prefix for weak tags.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = self => {\n switch (self._tag) {\n case \"Weak\":\n return `W/\"${self.value}\"`;\n case \"Strong\":\n return `\"${self.value}\"`;\n }\n};\n/**\n * Service for generating ETags from filesystem file information or Web `File`-like metadata.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Generator extends /*#__PURE__*/Context.Service()(\"effect/http/Etag/Generator\") {}\nconst fromFileInfo = info => {\n const mtime = Option.match(info.mtime, {\n onNone: () => \"0\",\n onSome: mtime => mtime.getTime().toString(16)\n });\n return `${info.size.toString(16)}-${mtime}`;\n};\nconst fromFileWeb = file => {\n return `${file.size.toString(16)}-${file.lastModified.toString(16)}`;\n};\n/**\n * Layer that provides a `Generator` which produces strong ETags from file size\n * and modification time metadata.\n *\n * **When to use**\n *\n * Use when file size and modification time reliably change for every byte-level\n * change and the consuming HTTP code needs strong ETags from the `Generator`\n * service.\n *\n * **Gotchas**\n *\n * This layer marks metadata-derived tags as strong. If the underlying storage\n * can update file contents without changing the recorded size or modification\n * time, those tags can stop representing byte-for-byte identity.\n *\n * @see {@link layerWeak} for weak metadata-derived ETags when byte-for-byte identity is not required\n * @see {@link Generator} for the service provided by this layer\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.succeed(Generator)({\n fromFileInfo(info) {\n return Effect.sync(() => ({\n _tag: \"Strong\",\n value: fromFileInfo(info)\n }));\n },\n fromFileWeb(file) {\n return Effect.sync(() => ({\n _tag: \"Strong\",\n value: fromFileWeb(file)\n }));\n }\n});\n/**\n * Layer that provides a `Generator` which produces weak ETags from file size and modification time metadata.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWeak = /*#__PURE__*/Layer.succeed(Generator)({\n fromFileInfo(info) {\n return Effect.sync(() => ({\n _tag: \"Weak\",\n value: fromFileInfo(info)\n }));\n },\n fromFileWeb(file) {\n return Effect.sync(() => ({\n _tag: \"Weak\",\n value: fromFileWeb(file)\n }));\n }\n});\n//# sourceMappingURL=Etag.js.map",
|
|
109
|
+
"/**\n * Immutable HTTP cookie values and collections for request and response\n * workflows.\n *\n * The module models a validated {@link Cookie}, an immutable {@link Cookies}\n * collection keyed by cookie name, and the conversions needed around HTTP\n * headers. Use it to read request `Cookie` headers, build cookies with standard\n * attributes, merge or remove cookies immutably, expire cookies, and emit\n * response `Set-Cookie` headers.\n *\n * **Mental model**\n *\n * - A `Cookie` stores both the decoded `value` and the encoded `valueEncoded`\n * used in headers\n * - A `Cookies` collection contains at most one cookie per name; later writes,\n * merges, and iterable inputs replace earlier cookies with the same name\n * - `Cookie` request headers carry name/value pairs, while `Set-Cookie`\n * response headers carry one cookie plus optional attributes\n * - Safe constructors return `Result` failures for invalid names, values,\n * domains, paths, or infinite `Max-Age` values\n *\n * **Common tasks**\n *\n * - Create cookies: {@link makeCookie}, {@link makeCookieUnsafe}\n * - Build collections: {@link empty}, {@link fromIterable},\n * {@link fromSetCookie}, {@link fromReadonlyRecord}\n * - Read values: {@link get}, {@link getValue}, {@link toRecord},\n * {@link isEmpty}\n * - Update collections: {@link set}, {@link setUnsafe}, {@link setAll},\n * {@link setCookie}, {@link setAllCookie}, {@link remove}, {@link merge}\n * - Expire cookies: {@link expireCookie}, {@link expireCookieUnsafe}\n * - Encode and decode headers: {@link toCookieHeader},\n * {@link toSetCookieHeaders}, {@link serializeCookie}, {@link parseHeader}\n *\n * **Gotchas**\n *\n * - Use {@link toCookieHeader} for an outbound request `Cookie` header and\n * {@link toSetCookieHeaders} for response `Set-Cookie` headers.\n * - Parsing is intentionally tolerant: malformed `Set-Cookie` input can be\n * ignored, unsupported attributes are skipped, and percent-decoding falls\n * back to the original text.\n * - Security attributes such as `HttpOnly`, `Secure`, `SameSite`, and\n * `Partitioned` are serialized when present, but browser policy enforces\n * their final behavior.\n *\n * **Example** (Serializing a session cookie)\n *\n * ```ts\n * import { Cookies } from \"effect/unstable/http\"\n *\n * const cookies = Cookies.setUnsafe(Cookies.empty, \"session\", \"abc123\", {\n * httpOnly: true,\n * path: \"/\",\n * sameSite: \"lax\",\n * secure: true\n * })\n *\n * console.log(Cookies.toSetCookieHeaders(cookies))\n * // [\"session=abc123; Path=/; HttpOnly; Secure; SameSite=Lax\"]\n * ```\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Duration from \"../../Duration.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\nconst TypeId = \"~effect/http/Cookies\";\n/**\n * Returns `true` when a value is a `Cookies` collection.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isCookies = u => Predicate.hasProperty(u, TypeId);\n/**\n * Schema for `Cookies` collections.\n *\n * **Details**\n *\n * JSON encoding uses `Set-Cookie` header strings, while isomorphic encoding uses\n * a readonly record of cookie values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const CookiesSchema = /*#__PURE__*/Schema.declare(isCookies, {\n typeConstructor: {\n _tag: \"effect/http/Cookies\"\n },\n generation: {\n runtime: `Cookies.CookiesSchema`,\n Type: `Cookies.Cookies`,\n Encoded: `typeof Cookies.CookiesSchema[\"Encoded\"]`,\n importDeclaration: `import * as Cookies from \"effect/unstable/http/Cookies\"`\n },\n expected: \"Cookies\",\n toCodecJson: () => Schema.link()(Schema.Array(Schema.String), Transformation.transform({\n decode: input => fromSetCookie(input),\n encode: cookies => toSetCookieHeaders(cookies)\n })),\n toCodecIso: () => Schema.link()(Schema.Record(Schema.String, CookieSchema), Transformation.transform({\n decode: input => fromReadonlyRecord(input),\n encode: cookies => cookies.cookies\n }))\n});\nconst CookieTypeId = \"~effect/http/Cookies/Cookie\";\n/**\n * Returns `true` when a value is a `Cookie`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCookie = u => Predicate.hasProperty(u, CookieTypeId);\n/**\n * Schema for `Cookie` values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const CookieSchema = /*#__PURE__*/Schema.declare(isCookie, {\n typeConstructor: {\n _tag: \"effect/http/Cookie\"\n },\n generation: {\n runtime: `Cookies.CookieSchema`,\n Type: `Cookies.Cookie`,\n importDeclaration: `import * as Cookie from \"effect/unstable/http/Cookies\"`\n },\n expected: \"Cookie\"\n});\nconst CookieErrorTypeId = \"~effect/http/Cookies/CookieError\";\n/**\n * Error reason describing why cookie construction failed, such as invalid name,\n * value, domain, path, or infinite max-age.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesErrorReason extends Data.Error {}\n/**\n * Error returned when a cookie name, value, domain, path, or max-age option is invalid.\n *\n * **Details**\n *\n * Inspect `reason` to determine the specific validation failure.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesError extends /*#__PURE__*/Data.TaggedError(\"CookieError\") {\n /**\n * Creates a cookie error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new CookiesError({\n reason: new CookiesErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a cookie validation error for runtime guards.\n *\n * @since 4.0.0\n */\n [CookieErrorTypeId] = CookieErrorTypeId;\n /**\n * Uses the concrete cookie error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies\",\n cookies: Record.map(this.cookies, cookie => cookie.toJSON())\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Creates a `Cookies` collection from an existing readonly record of cookies keyed by cookie name.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromReadonlyRecord = cookies => {\n const self = Object.create(Proto);\n self.cookies = cookies;\n return self;\n};\n/**\n * Create a Cookies object from an Iterable\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromIterable = cookies => {\n const record = {};\n for (const cookie of cookies) {\n record[cookie.name] = cookie;\n }\n return fromReadonlyRecord(record);\n};\n/**\n * Create a Cookies object from a set of Set-Cookie headers\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromSetCookie = headers => {\n const arrayHeaders = typeof headers === \"string\" ? [headers] : headers;\n const cookies = [];\n for (const header of arrayHeaders) {\n const cookie = parseSetCookie(header.trim());\n if (cookie) {\n cookies.push(cookie);\n }\n }\n return fromIterable(cookies);\n};\nfunction parseSetCookie(header) {\n const parts = header.split(\";\").map(_ => _.trim()).filter(_ => _ !== \"\");\n if (parts.length === 0) {\n return undefined;\n }\n const firstEqual = parts[0].indexOf(\"=\");\n if (firstEqual === -1) {\n return undefined;\n }\n const name = parts[0].slice(0, firstEqual);\n if (!fieldContentRegExp.test(name)) {\n return undefined;\n }\n const valueEncoded = parts[0].slice(firstEqual + 1);\n const value = tryDecodeURIComponent(valueEncoded);\n if (parts.length === 1) {\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded\n });\n }\n const options = {};\n for (let i = 1; i < parts.length; i++) {\n const part = parts[i];\n const equalIndex = part.indexOf(\"=\");\n const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();\n const value = equalIndex === -1 ? undefined : part.slice(equalIndex + 1).trim();\n switch (key.toLowerCase()) {\n case \"domain\":\n {\n if (value === undefined) {\n break;\n }\n const domain = value.trim().replace(/^\\./, \"\");\n if (domain) {\n options.domain = domain;\n }\n break;\n }\n case \"expires\":\n {\n if (value === undefined) {\n break;\n }\n const date = new Date(value);\n if (!isNaN(date.getTime())) {\n options.expires = date;\n }\n break;\n }\n case \"max-age\":\n {\n if (value === undefined) {\n break;\n }\n const maxAge = parseInt(value, 10);\n if (!isNaN(maxAge)) {\n options.maxAge = Duration.seconds(maxAge);\n }\n break;\n }\n case \"path\":\n {\n if (value === undefined) {\n break;\n }\n if (value[0] === \"/\") {\n options.path = value;\n }\n break;\n }\n case \"priority\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"low\":\n options.priority = \"low\";\n break;\n case \"medium\":\n options.priority = \"medium\";\n break;\n case \"high\":\n options.priority = \"high\";\n break;\n }\n break;\n }\n case \"httponly\":\n {\n options.httpOnly = true;\n break;\n }\n case \"secure\":\n {\n options.secure = true;\n break;\n }\n case \"partitioned\":\n {\n options.partitioned = true;\n break;\n }\n case \"samesite\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"lax\":\n options.sameSite = \"lax\";\n break;\n case \"strict\":\n options.sameSite = \"strict\";\n break;\n case \"none\":\n options.sameSite = \"none\";\n break;\n }\n break;\n }\n }\n }\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded,\n options: Object.keys(options).length > 0 ? options : undefined\n });\n}\n/**\n * An empty Cookies object\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/fromIterable([]);\n/**\n * Returns `true` when the `Cookies` collection contains no cookies.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isEmpty = self => Record.isEmptyRecord(self.cookies);\n// oxlint-disable-next-line no-control-regex\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\nconst CookieProto = {\n [CookieTypeId]: CookieTypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies/Cookie\",\n name: this.name,\n value: this.value,\n options: this.options\n };\n }\n};\n/**\n * Creates a cookie, validating the name, encoded value, domain, path, and finite `maxAge`.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when validation fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeCookie(name, value, options) {\n if (!fieldContentRegExp.test(name)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookieName\"));\n }\n const encodedValue = encodeURIComponent(value);\n if (encodedValue && !fieldContentRegExp.test(encodedValue)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookieValue\"));\n }\n if (options !== undefined) {\n if (options.domain !== undefined && !fieldContentRegExp.test(options.domain)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookieDomain\"));\n }\n if (options.path !== undefined && !fieldContentRegExp.test(options.path)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookiePath\"));\n }\n if (options.maxAge !== undefined && !Duration.isFinite(Duration.fromInputUnsafe(options.maxAge))) {\n return Result.fail(CookiesError.fromReason(\"CookieInfinityMaxAge\"));\n }\n }\n return Result.succeed(Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded: encodedValue,\n options\n }));\n}\n/**\n * Create a new cookie, throwing an error if invalid\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeCookieUnsafe = (name, value, options) => Result.getOrThrow(makeCookie(name, value, options));\n/**\n * Adds a cookie to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(2, (self, cookie) => fromReadonlyRecord(Record.set(self.cookies, cookie.name, cookie)));\n/**\n * Adds multiple cookies to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllCookie = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const cookie of cookies) {\n record[cookie.name] = cookie;\n }\n return fromReadonlyRecord(record);\n});\n/**\n * Combines two Cookies objects, removing duplicates from the first\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, that) => fromReadonlyRecord({\n ...self.cookies,\n ...that.cookies\n}));\n/**\n * Removes a cookie by name\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, name) => fromReadonlyRecord(Record.remove(self.cookies, name)));\n/**\n * Gets a cookie from a Cookies object safely.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.fromUndefinedOr(self.cookies[name]));\n/**\n * Gets the decoded value of a cookie by name safely.\n *\n * **Details**\n *\n * Returns `Option.none()` when the cookie is not present.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getValue = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.map(get(self, name), cookie => cookie.value));\n/**\n * Creates and adds a cookie safely by name and value.\n *\n * **Details**\n *\n * The cookie fields are validated first; invalid input returns a `CookiesError` in the `Result` failure channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => Result.map(makeCookie(name, value, options), cookie => fromReadonlyRecord(Record.set(self.cookies, name, cookie))));\n/**\n * Creates and adds a cookie by name and value, throwing if the cookie fields are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => fromReadonlyRecord(Record.set(self.cookies, name, makeCookieUnsafe(name, value, options))));\n/**\n * Adds an expired cookie safely with an empty value, `Max-Age=0`, and an epoch `Expires` value.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when the name or options are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => set(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Adds an expired cookie to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => setUnsafe(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Creates and adds multiple cookies safely from name/value/options tuples.\n *\n * **Details**\n *\n * If any tuple is invalid, returns the first `CookiesError` and leaves the original collection unchanged.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const [name, value, options] of cookies) {\n const result = makeCookie(name, value, options);\n if (Result.isFailure(result)) {\n return result;\n }\n record[name] = result.success;\n }\n return Result.succeed(fromReadonlyRecord(record));\n});\n/**\n * Adds multiple cookies to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllUnsafe = /*#__PURE__*/dual(2, (self, cookies) => Result.getOrThrow(setAll(self, cookies)));\n/**\n * Serializes a cookie into a string.\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function serializeCookie(self) {\n let str = self.name + \"=\" + self.valueEncoded;\n if (self.options === undefined) {\n return str;\n }\n const options = self.options;\n if (options.maxAge !== undefined) {\n const maxAge = Duration.toSeconds(Duration.fromInputUnsafe(options.maxAge));\n str += \"; Max-Age=\" + Math.trunc(maxAge);\n }\n if (options.domain !== undefined) {\n str += \"; Domain=\" + options.domain;\n }\n if (options.path !== undefined) {\n str += \"; Path=\" + options.path;\n }\n if (options.priority !== undefined) {\n switch (options.priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n }\n }\n if (options.expires !== undefined) {\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n if (options.secure) {\n str += \"; Secure\";\n }\n // Draft implementation to support Chrome from 2024-Q1 forward.\n // See https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n if (options.sameSite !== undefined) {\n switch (options.sameSite) {\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n }\n }\n return str;\n}\n/**\n * Serializes a `Cookies` object into a Cookie header.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toCookieHeader = self => Object.values(self.cookies).map(cookie => `${cookie.name}=${cookie.valueEncoded}`).join(\"; \");\n/**\n * Converts a `Cookies` collection to a record of decoded cookie values keyed by cookie name.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const record = {};\n const cookies = Object.values(self.cookies);\n for (let index = 0; index < cookies.length; index++) {\n const cookie = cookies[index];\n record[cookie.name] = cookie.value;\n }\n return record;\n};\n/**\n * Schema for transforming `Cookies` into records of decoded string values keyed\n * by cookie name.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaRecord = /*#__PURE__*/CookiesSchema.pipe(/*#__PURE__*/Schema.decodeTo(/*#__PURE__*/Schema.Record(Schema.String, Schema.String), /*#__PURE__*/Transformation.transform({\n decode: toRecord,\n encode: self => fromIterable(Object.entries(self).map(([name, value]) => makeCookieUnsafe(name, value)))\n})));\n/**\n * Serializes a `Cookies` collection into an array of `Set-Cookie` header values.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toSetCookieHeaders = self => Object.values(self.cookies).map(serializeCookie);\n/**\n * Parses a cookie header into a record of key-value pairs\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function parseHeader(header) {\n const result = {};\n const strLen = header.length;\n let pos = 0;\n let terminatorPos = 0;\n while (true) {\n if (terminatorPos === strLen) break;\n terminatorPos = header.indexOf(\";\", pos);\n if (terminatorPos === -1) terminatorPos = strLen; // This is the last pair\n let eqIdx = header.indexOf(\"=\", pos);\n if (eqIdx === -1) break; // No key-value pairs left\n if (eqIdx > terminatorPos) {\n // Malformed key-value pair\n pos = terminatorPos + 1;\n continue;\n }\n const key = header.substring(pos, eqIdx++).trim();\n if (result[key] === undefined) {\n const val = header.charCodeAt(eqIdx) === 0x22 ? header.substring(eqIdx + 1, terminatorPos - 1).trim() : header.substring(eqIdx, terminatorPos).trim();\n result[key] = !(val.indexOf(\"%\") === -1) ? tryDecodeURIComponent(val) : val;\n }\n pos = terminatorPos + 1;\n }\n return result;\n}\nconst tryDecodeURIComponent = str => {\n try {\n return decodeURIComponent(str);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n return str;\n }\n};\n//# sourceMappingURL=Cookies.js.map",
|
|
110
|
+
"/**\n * Immutable HTTP header collections for the unstable HTTP modules.\n *\n * This module defines the `Headers` data type used by HTTP client and server\n * request / response models. It converts records or iterables into a\n * predictable lowercase map, provides pipeable operations for reading and\n * updating header values, and integrates with inspection redaction so sensitive\n * header names can be masked before logging or serialization.\n *\n * ## Mental model\n *\n * A `Headers` value is a plain immutable record whose keys are normalized\n * header names and whose values are strings. Safe constructors and lookups\n * lowercase names because HTTP header names are case-insensitive, and\n * combinators return new `Headers` values instead of mutating the original\n * collection.\n *\n * ## Common tasks\n *\n * - Build headers from records or entry iterables with {@link fromInput}.\n * - Read values with {@link get} or check presence with {@link has}.\n * - Add, replace, merge, or remove headers with {@link set}, {@link setAll},\n * {@link merge}, {@link remove}, and {@link removeMany}.\n * - Mask sensitive names before inspection with {@link redact} and\n * {@link CurrentRedactedNames}.\n *\n * ## Gotchas\n *\n * Each lowercase header name stores one string. Record array values are joined\n * with `\", \"`, iterable input keeps the last value for duplicate names, and\n * later set / merge operations replace earlier values. This is convenient for\n * most headers but does not preserve repeated field lines such as `Set-Cookie`;\n * use cookie-specific HTTP modules when cookie multiplicity matters.\n *\n * **Example** (Normalize and update headers)\n *\n * ```ts\n * import { Option } from \"effect\"\n * import { Headers } from \"effect/unstable/http\"\n *\n * const headers = Headers.fromInput({\n * \"Content-Type\": \"application/json\",\n * accept: [\"application/json\", \"text/plain\"]\n * })\n *\n * const contentType = Headers.get(headers, \"content-type\")\n * if (Option.isSome(contentType)) {\n * console.log(contentType.value)\n * }\n *\n * const next = Headers.set(headers, \"authorization\", \"Bearer token\")\n * console.log(Headers.has(next, \"Authorization\")) // true\n * ```\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Redactable from \"../../Redactable.js\";\nimport * as Redacted from \"../../Redacted.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\n/**\n * Runtime type identifier for `Headers` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = /*#__PURE__*/Symbol.for(\"~effect/http/Headers\");\n/**\n * Returns `true` if the provided value is a `Headers` value.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isHeaders = u => Predicate.hasProperty(u, TypeId);\nconst Proto = /*#__PURE__*/Object.create(null);\nObject.defineProperties(Proto, {\n [TypeId]: {\n value: TypeId\n },\n [Redactable.symbolRedactable]: {\n value(context) {\n return redact(this, Context.get(context, CurrentRedactedNames));\n }\n },\n toJSON: {\n value() {\n return Redactable.redact(this);\n }\n },\n [Equal.symbol]: {\n value(that) {\n return Equivalence(this, that);\n }\n },\n [Hash.symbol]: {\n value() {\n return Hash.structure(this);\n }\n },\n toString: {\n value: Inspectable.BaseProto.toString\n },\n [Inspectable.NodeInspectSymbol]: {\n value: Inspectable.BaseProto[Inspectable.NodeInspectSymbol]\n }\n});\nconst make = input => Object.assign(Object.create(Proto), input);\n/**\n * Provides an `Equivalence` instance that compares `Headers` by header names\n * and string values.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Record.makeEquivalence(/*#__PURE__*/Equ.strictEqual());\n/**\n * Schema for `Headers` values encoded as records of string header values.\n *\n * **Details**\n *\n * Decoding normalizes header names through `fromInput`; encoding returns a plain record.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const HeadersSchema = /*#__PURE__*/Schema.declare(isHeaders, {\n typeConstructor: {\n _tag: \"effect/http/Headers\"\n },\n generation: {\n runtime: `Headers.HeadersSchema`,\n Type: `Headers.Headers`,\n Encoded: `typeof Headers.HeadersSchema[\"Encoded\"]`,\n importDeclaration: `import * as Headers from \"effect/unstable/http/Headers\"`\n },\n expected: \"Headers\",\n toEquivalence: () => Equivalence,\n toCodec: () => Schema.link()(Schema.Record(Schema.String, Schema.String), Transformation.transform({\n decode: input => fromInput(input),\n encode: headers => ({\n ...headers\n })\n }))\n});\n/**\n * An empty `Headers` collection.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/Object.create(Proto);\n/**\n * Creates `Headers` from a record or iterable of header entries.\n *\n * **Details**\n *\n * Header names are normalized to lowercase. Array values in record input are joined with `\", \"`, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n if (input === undefined) {\n return empty;\n } else if (Symbol.iterator in input) {\n const out = Object.create(Proto);\n for (const [k, v] of input) {\n out[k.toLowerCase()] = v;\n }\n return out;\n }\n const out = Object.create(Proto);\n for (const [k, v] of Object.entries(input)) {\n if (Array.isArray(v)) {\n out[k.toLowerCase()] = v.join(\", \");\n } else if (v !== undefined) {\n out[k.toLowerCase()] = v;\n }\n }\n return out;\n};\n/**\n * Treats an existing record as `Headers` unsafely.\n *\n * **Gotchas**\n *\n * This mutates the record's prototype and does not normalize header names; callers must provide the expected lowercase keys.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromRecordUnsafe = input => Object.setPrototypeOf(input, Proto);\n/**\n * Returns `true` when a header with the given name is present.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const has = /*#__PURE__*/dual(2, (self, key) => key.toLowerCase() in self);\n/**\n * Gets a header value by name safely.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name and returns `Option.none()` when absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, key) => Option.fromUndefinedOr(self[key.toLowerCase()]));\n/**\n * Returns a new `Headers` collection with the given header set.\n *\n * **Details**\n *\n * The header name is normalized to lowercase.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => {\n const out = make(self);\n out[key.toLowerCase()] = value;\n return out;\n});\n/**\n * Returns a new `Headers` collection with all provided headers set.\n *\n * **Details**\n *\n * Input headers are normalized with `fromInput` and override existing headers with the same lowercase name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, headers) => make({\n ...self,\n ...fromInput(headers)\n}));\n/**\n * Returns a new `Headers` collection containing headers from both collections.\n *\n * **Details**\n *\n * Headers from the second collection override headers from the first collection with the same name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, headers) => {\n const out = make(self);\n Object.assign(out, headers);\n return out;\n});\n/**\n * Returns a new `Headers` collection with the named header removed.\n *\n * **Details**\n *\n * The provided header name is normalized to lowercase before removal.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => {\n const out = make(self);\n delete out[key.toLowerCase()];\n return out;\n});\n/**\n * Returns a new `Headers` collection with each named header removed.\n *\n * **Details**\n *\n * Each provided header name is normalized to lowercase before removal.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeMany = /*#__PURE__*/dual(2, (self, keys) => {\n const out = make(self);\n for (const key of keys) {\n delete out[key.toLowerCase()];\n }\n return out;\n});\n/**\n * Returns a plain record with selected header values wrapped in `Redacted`.\n *\n * **Details**\n *\n * String keys are normalized to lowercase before matching; regular expressions are tested against the stored header names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const redact = /*#__PURE__*/dual(2, (self, key) => {\n const out = {\n ...self\n };\n const modify = key => {\n if (typeof key === \"string\") {\n const k = key.toLowerCase();\n if (k in self) {\n out[k] = Redacted.make(self[k]);\n }\n } else {\n for (const name in self) {\n if (key.test(name)) {\n out[name] = Redacted.make(self[name]);\n }\n }\n }\n };\n if (Array.isArray(key)) {\n for (let i = 0; i < key.length; i++) {\n modify(key[i]);\n }\n } else {\n modify(key);\n }\n return out;\n});\n/**\n * Context reference listing header names or patterns that should be redacted when `Headers` are inspected or rendered.\n *\n * **Details**\n *\n * Defaults include `authorization`, `cookie`, `set-cookie`, and `x-api-key`.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const CurrentRedactedNames = /*#__PURE__*/Context.Reference(\"effect/Headers/CurrentRedactedNames\", {\n defaultValue: () => [\"authorization\", \"cookie\", \"set-cookie\", \"x-api-key\"]\n});\n//# sourceMappingURL=Headers.js.map",
|
|
111
|
+
"/**\n * Typed failure model for Effect HTTP client operations.\n *\n * HTTP clients wrap request construction, transport, status-code validation, and\n * response decoding failures in `HttpClientError`. The wrapper keeps the failed\n * request and the specific failure reason together, so callers can handle client\n * failures uniformly while still matching on the reason `_tag` for retry\n * policy, logging, metrics, and user-facing messages.\n *\n * **Mental model**\n *\n * A client error reason belongs to one of two families. Request errors happen\n * before a response exists: `TransportError`, `EncodeError`, and\n * `InvalidUrlError`. Response errors include the response that triggered them:\n * `StatusCodeError`, `DecodeError`, and `EmptyBodyError`.\n *\n * **Common tasks**\n *\n * - Use `isHttpClientError` at untyped boundaries.\n * - Read `request` for the method and URL associated with any client failure.\n * - Match on `reason._tag` when different failures need different recovery.\n * - Read `response` only for response errors or after checking that it exists.\n *\n * **Gotchas**\n *\n * `response` is `undefined` for transport, encoding, and invalid URL failures.\n * Preserve the original `cause` when constructing reason classes so lower-level\n * platform or decoding details are not lost.\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nconst TypeId = \"~effect/http/HttpClientError\";\n/**\n * Returns `true` when a value is an `HttpClientError`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClientError = u => hasProperty(u, TypeId);\n/**\n * Error wrapper for HTTP client failures, exposing the failed request and the optional response through its `reason`.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpClientError extends /*#__PURE__*/Data.TaggedError(\"HttpClientError\") {\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n /**\n * Marks this value as an HTTP client error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * HTTP request associated with the client failure.\n *\n * @since 4.0.0\n */\n get request() {\n return this.reason.request;\n }\n /**\n * HTTP response associated with the client failure, when one was received.\n *\n * @since 4.0.0\n */\n get response() {\n return \"response\" in this.reason ? this.reason.response : undefined;\n }\n get message() {\n return this.reason.message;\n }\n}\nconst formatReason = tag => tag.endsWith(\"Error\") ? tag.slice(0, -5) : tag;\nconst formatMessage = (reason, description, info) => description ? `${reason}: ${description} (${info})` : `${reason} error (${info})`;\n/**\n * Error describing transport-level failures that occur while sending an HTTP request.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class TransportError extends /*#__PURE__*/Data.TaggedError(\"TransportError\") {\n /**\n * Formats the request method and URL for transport error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the transport error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing failures while encoding an HTTP request body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class EncodeError extends /*#__PURE__*/Data.TaggedError(\"EncodeError\") {\n /**\n * Formats the request method and URL for request encoding error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the request encoding error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing failures while constructing a URL from an HTTP client request.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class InvalidUrlError extends /*#__PURE__*/Data.TaggedError(\"InvalidUrlError\") {\n /**\n * Formats the request method and URL for invalid URL error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the invalid URL error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Response error for HTTP responses rejected because of their status code.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class StatusCodeError extends /*#__PURE__*/Data.TaggedError(\"StatusCodeError\") {\n /**\n * Formats the request method and URL for status code error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the status code error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Response error for failures while decoding an HTTP response body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class DecodeError extends /*#__PURE__*/Data.TaggedError(\"DecodeError\") {\n /**\n * Formats the request method and URL for response decoding error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the response decoding error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Response error for operations that expected a response body but received an empty body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class EmptyBodyError extends /*#__PURE__*/Data.TaggedError(\"EmptyBodyError\") {\n /**\n * Formats the request method and URL for empty response body error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the empty body error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Schema for serializable HTTP client errors, preserving the specific error kind\n * and cause.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport class HttpClientErrorSchema extends /*#__PURE__*/Schema.ErrorClass(TypeId)({\n _tag: /*#__PURE__*/Schema.tag(\"HttpError\"),\n kind: /*#__PURE__*/Schema.Literals([\"EncodeError\", \"DecodeError\", \"TransportError\", \"InvalidUrlError\", \"StatusCodeError\", \"EmptyBodyError\"]),\n cause: /*#__PURE__*/Schema.optional(Schema.Defect)\n}) {\n /**\n * Builds the serializable schema representation for an HTTP client error.\n *\n * @since 4.0.0\n */\n static fromHttpClientError(error) {\n return new HttpClientErrorSchema({\n _tag: \"HttpError\",\n kind: error.reason._tag,\n cause: error.reason\n });\n }\n}\n//# sourceMappingURL=HttpClientError.js.map",
|
|
112
|
+
"/**\n * Immutable URL query parameters represented as ordered string pairs.\n *\n * This module is the shared query-parameter model for HTTP client request\n * queries, URL-encoded form bodies, and server-side decoding. A `UrlParams`\n * value can be built from records, iterables, or native `URLSearchParams`, then\n * inspected, appended, replaced, removed, serialized, converted to a `URL`, or\n * decoded with schemas.\n *\n * **Mental model**\n *\n * The core representation is a list of `[key, value]` string pairs. Duplicate\n * keys and pair order are preserved by `make`, `fromInput`, iteration, and\n * append-style operations. Record input is a convenience layer: primitive values\n * become strings, arrays become repeated parameters, nested records use bracket\n * notation, and `undefined` fields are skipped.\n *\n * **Common tasks**\n *\n * - Build query parameters from plain records, tuples, or `URLSearchParams`.\n * - Read the first, last, or all values for a key.\n * - Replace, append, transform, or remove keys without mutating the original.\n * - Serialize a query string, merge parameters into a URL, or decode records and\n * JSON fields with schemas.\n *\n * **Gotchas**\n *\n * Use `getAll` when every duplicate value matters. `set` and `setAll` replace\n * existing values for matching keys, while `append` and `appendAll` preserve\n * them. Serialization through `toString` and `makeUrl` delegates to the platform\n * `URLSearchParams` / `URL` implementations, so pass decoded strings rather\n * than pre-encoded query fragments. Record-based and schema-based conversions\n * collapse repeated keys into string arrays and do not preserve the full global\n * pair ordering; `schemaJsonField` reads the first matching value for the\n * selected field.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Issue from \"../../SchemaIssue.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\nimport * as Tuple from \"../../Tuple.js\";\nconst TypeId = \"~effect/http/UrlParams\";\n/**\n * Returns `true` when a value is a `UrlParams` instance.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isUrlParams = u => hasProperty(u, TypeId);\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [Symbol.iterator]() {\n return this.params[Symbol.iterator]();\n },\n toJSON() {\n return {\n _id: \"UrlParams\",\n params: Object.fromEntries(this.params)\n };\n },\n [Equal.symbol](that) {\n return Equivalence(this, that);\n },\n [Hash.symbol]() {\n return Hash.array(this.params.flat());\n }\n};\n/**\n * Creates `UrlParams` from ordered string key-value pairs.\n *\n * **Details**\n *\n * The input pairs are used as-is and are not coerced or normalized.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = params => {\n const self = Object.create(Proto);\n self.params = params;\n return self;\n};\n/**\n * Creates `UrlParams` from a supported input shape.\n *\n * **Details**\n *\n * Primitive values are converted to strings, arrays produce repeated parameters,\n * nested records use bracket notation, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n const parsed = fromInputNested(input);\n const out = [];\n for (let i = 0; i < parsed.length; i++) {\n if (Array.isArray(parsed[i][0])) {\n const [keys, value] = parsed[i];\n out.push([`${keys[0]}[${keys.slice(1).join(\"][\")}]`, value]);\n } else {\n out.push(parsed[i]);\n }\n }\n return make(out);\n};\nconst fromInputNested = input => {\n const entries = typeof input[Symbol.iterator] === \"function\" ? Arr.fromIterable(input) : Object.entries(input);\n const out = [];\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n if (value[i] !== undefined) {\n out.push([key, String(value[i])]);\n }\n }\n } else if (typeof value === \"object\") {\n const nested = fromInputNested(value);\n for (const [k, v] of nested) {\n out.push([[key, ...(typeof k === \"string\" ? [k] : k)], v]);\n }\n } else if (value !== undefined) {\n out.push([key, String(value)]);\n }\n }\n return out;\n};\n/**\n * Provides an order-sensitive `Equivalence` instance for `UrlParams`.\n *\n * **Details**\n *\n * Two values are equivalent when they contain the same key-value pairs in the same\n * order.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Equ.make((a, b) => arrayEquivalence(a.params, b.params));\nconst arrayEquivalence = /*#__PURE__*/Arr.makeEquivalence(/*#__PURE__*/Tuple.makeEquivalence([/*#__PURE__*/Equ.strictEqual(), /*#__PURE__*/Equ.strictEqual()]));\n/**\n * Schema for `UrlParams`.\n *\n * **Details**\n *\n * The encoded representation is an array of string key-value tuples.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const UrlParamsSchema = /*#__PURE__*/Schema.declare(isUrlParams, {\n typeConstructor: {\n _tag: \"effect/http/UrlParams\"\n },\n generation: {\n runtime: `UrlParams.UrlParamsSchema`,\n Type: `UrlParams.UrlParams`,\n Encoded: `typeof UrlParams.UrlParamsSchema[\"Encoded\"]`,\n importDeclaration: `import * as UrlParams from \"effect/unstable/http/UrlParams\"`\n },\n expected: \"UrlParams\",\n toEquivalence: () => Equivalence,\n toCodec: () => Schema.link()(Schema.Array(Schema.Tuple([Schema.String, Schema.String])), Transformation.transform({\n decode: make,\n encode: self => self.params\n }))\n});\n/**\n * An empty `UrlParams` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/make([]);\n/**\n * Returns all values for a query parameter key in insertion order.\n *\n * **Details**\n *\n * Returns an empty array when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getAll = /*#__PURE__*/dual(2, (self, key) => Arr.reduce(self.params, [], (acc, [k, value]) => {\n if (k === key) {\n acc.push(value);\n }\n return acc;\n}));\n/**\n * Returns the first value for a query parameter key safely.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getFirst = /*#__PURE__*/dual(2, (self, key) => Arr.findFirst(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Returns the last value for a query parameter key safely.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getLast = /*#__PURE__*/dual(2, (self, key) => Arr.findLast(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Sets a query parameter to a single value.\n *\n * **Details**\n *\n * Existing values for the same key are removed, and the new value is appended to\n * the end.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(Arr.filter(self.params, ([k]) => k !== key), [key, String(value)])));\n/**\n * Transforms the underlying ordered key-value pairs of `UrlParams`.\n *\n * **Details**\n *\n * The result is wrapped in a new `UrlParams` value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => make(f(self.params)));\n/**\n * Sets multiple query parameters from input.\n *\n * **Details**\n *\n * Keys present in the input replace existing values for those keys, while\n * unmentioned existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, input) => {\n const out = fromInput(input);\n const params = out.params;\n const keys = new Set();\n for (let i = 0; i < params.length; i++) {\n keys.add(params[i][0]);\n }\n for (let i = 0; i < self.params.length; i++) {\n if (keys.has(self.params[i][0])) continue;\n params.push(self.params[i]);\n }\n return out;\n});\n/**\n * Appends a query parameter value without removing existing values for the key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const append = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(self.params, [key, String(value)])));\n/**\n * Appends all query parameters produced from the supplied input.\n *\n * **Details**\n *\n * Existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendAll = /*#__PURE__*/dual(2, (self, input) => transform(self, Arr.appendAll(fromInput(input).params)));\n/**\n * Removes all query parameter values for the specified key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => transform(self, Arr.filter(([k]) => k !== key)));\n/**\n * Error returned when constructing a `URL` from `UrlParams` fails.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class UrlParamsError extends /*#__PURE__*/Data.TaggedError(\"UrlParamsError\") {}\n/**\n * Creates a `URL` safely by appending `UrlParams` and an optional hash to a URL string.\n *\n * **Details**\n *\n * Returns a `Result` that fails with `UrlParamsError` if the URL cannot be\n * constructed.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const makeUrl = (url, params, hash) => {\n try {\n const urlInstance = new URL(url, baseUrl());\n for (let i = 0; i < params.params.length; i++) {\n const [key, value] = params.params[i];\n if (value !== undefined) {\n urlInstance.searchParams.append(key, value);\n }\n }\n if (hash !== undefined) {\n urlInstance.hash = hash;\n }\n return Result.succeed(urlInstance);\n } catch (e) {\n return Result.fail(new UrlParamsError({\n cause: e\n }));\n }\n};\n/**\n * Serializes `UrlParams` to a URL query string without a leading question mark.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = self => new URLSearchParams(self.params).toString();\nconst baseUrl = () => {\n if (\"location\" in globalThis && globalThis.location !== undefined && globalThis.location.origin !== undefined && globalThis.location.pathname !== undefined) {\n return location.origin + location.pathname;\n }\n return undefined;\n};\n/**\n * Builds a `Record` containing all the key-value pairs in the given `UrlParams`\n * as `string` (if only one value for a key) or a `NonEmptyArray<string>`\n * (when more than one value for a key)\n *\n * **Example** (Converting parameters to a record)\n *\n * ```ts\n * import { UrlParams } from \"effect/unstable/http\"\n * import * as assert from \"node:assert\"\n *\n * const urlParams = UrlParams.fromInput({\n * a: 1,\n * b: true,\n * c: \"string\",\n * e: [1, 2, 3]\n * })\n * const result = UrlParams.toRecord(urlParams)\n *\n * assert.deepStrictEqual(\n * result,\n * { \"a\": \"1\", \"b\": \"true\", \"c\": \"string\", \"e\": [\"1\", \"2\", \"3\"] }\n * )\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const out = {};\n for (const [k, value] of self.params) {\n const curr = out[k];\n if (curr === undefined) {\n out[k] = value;\n } else if (typeof curr === \"string\") {\n out[k] = [curr, value];\n } else {\n curr.push(value);\n }\n }\n return out;\n};\n/**\n * Builds a readonly record from `UrlParams`.\n *\n * **Details**\n *\n * Keys with one value map to a string, and keys with multiple values map to a\n * non-empty readonly array of strings.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toReadonlyRecord = toRecord;\n/**\n * Extracts a JSON value from the first occurrence of the given `field` in the\n * `UrlParams`.\n *\n * **Example** (Decoding JSON parameter fields)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const extractFoo = UrlParams.schemaJsonField(\"foo\").pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.Number\n * }))\n * )\n *\n * console.log(\n * Schema.decodeSync(extractFoo)(UrlParams.fromInput({\n * foo: JSON.stringify({ some: \"bar\", number: 42 }),\n * baz: \"qux\"\n * }))\n * )\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJsonField = field => UrlParamsSchema.pipe(Schema.decodeTo(Schema.UnknownFromJsonString, Transformation.transformOrFail({\n decode: params => Option.match(getFirst(params, field), {\n onNone: () => Effect.fail(new Issue.Pointer([field], new Issue.MissingKey(undefined))),\n onSome: Effect.succeed\n }),\n encode: value => Effect.succeed(make([[field, value]]))\n})));\n/**\n * Schema that decodes `UrlParams` into a record of key-value pairs.\n *\n * **Details**\n *\n * Keys with one value decode to a string, and keys with multiple values decode to\n * a non-empty readonly array of strings.\n *\n * **Example** (Decoding URL parameters to a record)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const toStruct = UrlParams.schemaRecord.pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.FiniteFromString\n * }))\n * )\n *\n * console.log(\n * Schema.decodeSync(toStruct)(UrlParams.fromInput({\n * some: \"value\",\n * number: 42\n * }))\n * )\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaRecord = /*#__PURE__*/UrlParamsSchema.pipe(/*#__PURE__*/Schema.decodeTo(/*#__PURE__*/Schema.Record(Schema.String, /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.NonEmptyArray(Schema.String)])), /*#__PURE__*/Transformation.transform({\n decode: toReadonlyRecord,\n encode: fromInput\n})));\n//# sourceMappingURL=UrlParams.js.map",
|
|
113
|
+
"/**\n * Describes the body attached to outgoing HTTP requests and server responses.\n *\n * `HttpBody` is the transport-facing representation used by the HTTP modules\n * before a platform adapter turns a request or response into a concrete Web,\n * Node, or other runtime value. Each body variant carries the payload plus the\n * metadata an adapter can safely know ahead of time, such as `contentType` and\n * `contentLength`.\n *\n * **Mental model**\n *\n * - {@link empty} represents an absent body.\n * - {@link uint8Array}, {@link text}, {@link jsonUnsafe}, {@link json}, and\n * {@link urlParams} build in-memory byte bodies with content metadata.\n * - {@link formData} and {@link formDataRecord} keep multipart data as\n * `FormData` so the runtime can generate the boundary.\n * - {@link stream} represents a stream of `Uint8Array` chunks and may omit the\n * content length when the final size is not known.\n * - {@link raw} is the escape hatch for platform-specific body values that an\n * adapter already knows how to send.\n *\n * **Common tasks**\n *\n * - Send text, bytes, JSON, URL-encoded data, multipart forms, or files.\n * - Use {@link json} or {@link jsonSchema} when JSON encoding failures should\n * be represented as `HttpBodyError` values.\n * - Use {@link file} or {@link fileFromInfo} when file metadata should become\n * `contentType` / `contentLength` metadata for the adapter.\n * - Use {@link isHttpBody} when accepting unknown values at an integration\n * boundary.\n *\n * **Gotchas**\n *\n * - {@link jsonUnsafe} calls `JSON.stringify` directly and can throw; prefer\n * {@link json} in effectful code.\n * - `FormData` bodies intentionally leave `contentType` unset because setting a\n * multipart header without the generated boundary produces invalid requests.\n * - Stream bodies may not have a `contentLength`; code that requires one must\n * provide it explicitly when constructing the stream body.\n *\n * **Example** (Creating common body variants)\n *\n * ```ts\n * import { HttpBody, UrlParams } from \"effect/unstable/http\"\n * import * as assert from \"node:assert\"\n *\n * const textBody = HttpBody.text(\"hello\")\n * const jsonBody = HttpBody.jsonUnsafe({ name: \"Ada\" })\n * const formBody = HttpBody.urlParams(UrlParams.fromInput({ q: \"effect\" }))\n *\n * assert.equal(textBody.contentType, \"text/plain\")\n * assert.equal(jsonBody.contentType, \"application/json\")\n * assert.equal(formBody.contentType, \"application/x-www-form-urlencoded\")\n * ```\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { format } from \"../../Formatter.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Parser from \"../../SchemaParser.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpBody\";\n/**\n * Returns `true` if the provided value is an `HttpBody`.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isHttpBody = u => Predicate.hasProperty(u, TypeId);\nconst HttpBodyErrorTypeId = \"~effect/http/HttpBody/HttpBodyError\";\n/**\n * Error produced while constructing an HTTP body from JSON or schema-encoded input.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpBodyError extends /*#__PURE__*/Data.TaggedError(\"HttpBodyError\") {\n /**\n * Marks this value as an HTTP body error for runtime guards.\n *\n * @since 4.0.0\n */\n [HttpBodyErrorTypeId] = HttpBodyErrorTypeId;\n}\nclass Proto {\n [TypeId];\n constructor() {\n this[TypeId] = TypeId;\n }\n [Inspectable.NodeInspectSymbol]() {\n return this.toJSON();\n }\n toString() {\n return format(this, {\n ignoreToString: true\n });\n }\n}\n/**\n * HTTP body variant representing the absence of request content.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Empty extends Proto {\n _tag = \"Empty\";\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Empty\"\n };\n }\n}\n/**\n * Provides the singleton empty HTTP body.\n *\n * **When to use**\n *\n * Use when you need an HTTP body value that represents no body content.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/new Empty();\n/**\n * HTTP body variant containing an arbitrary runtime body value with optional content metadata.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Raw extends Proto {\n _tag = \"Raw\";\n body;\n contentType;\n contentLength;\n constructor(body, contentType, contentLength) {\n super();\n this.body = body;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Raw\",\n body: this.body,\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a raw HTTP body from an arbitrary value and optional `contentType` and `contentLength` metadata.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const raw = (body, options) => new Raw(body, options?.contentType, options?.contentLength);\n/**\n * HTTP body variant backed by a `Uint8Array`.\n *\n * **Details**\n *\n * It stores the bytes, content type, and byte length.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Uint8Array extends Proto {\n _tag = \"Uint8Array\";\n body;\n contentType;\n contentLength;\n constructor(body, contentType, contentLength) {\n super();\n this.body = body;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n const toString = this.contentType.startsWith(\"text/\") || this.contentType.endsWith(\"json\");\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Uint8Array\",\n body: toString ? new TextDecoder().decode(this.body) : `Uint8Array(${this.body.length})`,\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a byte-array HTTP body.\n *\n * **Details**\n *\n * The content type defaults to `application/octet-stream`, and the content length is the byte array length.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const uint8Array = (body, contentType) => new Uint8Array(body, contentType ?? \"application/octet-stream\", body.length);\nconst encoder = /*#__PURE__*/new TextEncoder();\n/**\n * Creates a UTF-8 encoded text HTTP body.\n *\n * **Details**\n *\n * The content type defaults to `text/plain`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = (body, contentType) => uint8Array(encoder.encode(body), contentType ?? \"text/plain\");\n/**\n * Creates a JSON HTTP body using `JSON.stringify`, throwing if serialization fails.\n *\n * **Details**\n *\n * The content type defaults to `application/json`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?? \"application/json\");\n/**\n * Creates a JSON HTTP body in an `Effect`.\n *\n * **Details**\n *\n * `JSON.stringify` failures are captured as `HttpBodyError` values, and the content type defaults to `application/json`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const json = (body, contentType) => Effect.try({\n try: () => text(JSON.stringify(body), contentType ?? \"application/json\"),\n catch: cause => new HttpBodyError({\n reason: {\n _tag: \"JsonError\"\n },\n cause\n })\n});\n/**\n * Creates a JSON body constructor that first encodes values with the schema's JSON codec.\n *\n * **Details**\n *\n * Schema encoding issues and JSON serialization failures are returned as `HttpBodyError` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonSchema = (schema, options) => {\n const encode = Parser.encodeUnknownEffect(Schema.toCodecJson(schema));\n return (body, contentType) => encode(body, options).pipe(Effect.mapError(issue => new HttpBodyError({\n reason: {\n _tag: \"SchemaError\",\n issue\n },\n cause: issue\n })), Effect.flatMap(body => json(body, contentType)));\n};\n/**\n * Creates an `application/x-www-form-urlencoded` HTTP body from `UrlParams`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const urlParams = (urlParams, contentType) => text(UrlParams.toString(urlParams), contentType ?? \"application/x-www-form-urlencoded\");\n/**\n * HTTP body variant backed by Web `FormData`.\n *\n * **Details**\n *\n * The content type and content length are left unset so the runtime can supply multipart boundaries.\n *\n * @category models\n * @since 4.0.0\n */\nexport class FormData extends Proto {\n _tag = \"FormData\";\n contentType = undefined;\n contentLength = undefined;\n formData;\n constructor(formData) {\n super();\n this.formData = formData;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"FormData\",\n formData: this.formData\n };\n }\n}\n/**\n * Wraps a Web `FormData` value as an HTTP body.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formData = body => new FormData(body);\nconst appendFormDataValue = (formData, key, value) => {\n if (value == null) {\n return;\n }\n if (typeof value === \"object\") {\n formData.append(key, value);\n return;\n }\n formData.append(key, String(value));\n};\n/**\n * Creates a `FormData` HTTP body from a record.\n *\n * **Details**\n *\n * Array fields append each item under the same key; primitive values are stringified, `File` and `Blob` values are appended directly, and nullish values are skipped.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formDataRecord = entries => {\n const data = new globalThis.FormData();\n for (const [key, value] of Object.entries(entries)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n appendFormDataValue(data, key, item);\n }\n } else {\n appendFormDataValue(data, key, value);\n }\n }\n return formData(data);\n};\n/**\n * HTTP body variant backed by a stream of `Uint8Array` chunks.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Stream extends Proto {\n _tag = \"Stream\";\n stream;\n contentType;\n contentLength;\n constructor(stream, contentType, contentLength) {\n super();\n this.stream = stream;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Stream\",\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a streaming HTTP body from a stream of byte chunks.\n *\n * **Details**\n *\n * The content type defaults to `application/octet-stream`; content length is optional.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const stream = (body, contentType, contentLength) => new Stream(body, contentType ?? \"application/octet-stream\", contentLength);\n/**\n * Creates a streaming HTTP body for a file path.\n *\n * **Details**\n *\n * The effect requires `FileSystem`, stats the file to set the content length, and can fail with `PlatformError`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (path, options) => Effect.flatMap(FileSystem.FileSystem, fs => Effect.map(fs.stat(path), info => stream(fs.stream(path, options), options?.contentType, Number(info.size))));\n/**\n * Creates a streaming HTTP body for a file path using already-known file information.\n *\n * **Details**\n *\n * The effect requires `FileSystem`, uses the provided file size as the content length, and can fail with `PlatformError`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileFromInfo = (path, info, options) => Effect.map(FileSystem.FileSystem, fs => stream(fs.stream(path, options), options?.contentType, Number(info.size)));\n//# sourceMappingURL=HttpBody.js.map",
|
|
114
|
+
"/**\n * HTTP method literals and helpers shared by the unstable HTTP client, server,\n * and routing APIs.\n *\n * This module keeps the supported method vocabulary in one place: the\n * {@link HttpMethod} union, {@link all} set, {@link allShort} mapping,\n * {@link hasBody} body classification helper, and {@link isHttpMethod} runtime\n * refinement. Values are uppercase string literals such as `\"GET\"` and\n * `\"POST\"`, matching the method tokens used by the HTTP APIs in this package.\n *\n * **Mental model**\n *\n * {@link HttpMethod} is the complete set this module recognizes.\n * {@link HttpMethod.NoBody} is the subset treated as bodyless (`GET`, `HEAD`,\n * `OPTIONS`, and `TRACE`), and {@link HttpMethod.WithBody} is the remaining\n * subset accepted by request builders that can carry a body.\n *\n * **Common tasks**\n *\n * Use {@link isHttpMethod} before accepting an unknown value as an HTTP method,\n * {@link hasBody} to narrow a method before attaching a body, {@link all} for\n * membership checks or iteration, and {@link allShort} when deriving the short\n * constructor names used by request helpers.\n *\n * **Gotchas**\n *\n * Lowercase method names are not valid {@link HttpMethod} values. The body\n * split is a typed helper convention, not a full statement of every\n * wire-protocol edge case: `DELETE` is treated as able to carry a body, while\n * `GET` helpers are treated as bodyless even though some systems may send a\n * body on the wire.\n *\n * @since 4.0.0\n */\n/**\n * Returns `true` when a method can carry a request body and narrows it to `HttpMethod.WithBody`.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const hasBody = method => method !== \"GET\" && method !== \"HEAD\" && method !== \"OPTIONS\" && method !== \"TRACE\";\n/**\n * Provides a readonly set containing every supported `HttpMethod` literal.\n *\n * **When to use**\n *\n * Use when you need to iterate over or test membership against every supported\n * HTTP method literal.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const all = /*#__PURE__*/new Set([\"GET\", \"POST\", \"PUT\", \"DELETE\", \"PATCH\", \"HEAD\", \"OPTIONS\", \"TRACE\"]);\n/**\n * Provides tuples mapping each supported HTTP method to its short\n * request-constructor name.\n *\n * **When to use**\n *\n * Use when you need the mapping from supported HTTP method literals to their\n * short request-constructor names.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const allShort = [[\"GET\", \"get\"], [\"POST\", \"post\"], [\"PUT\", \"put\"], [\"DELETE\", \"del\"], [\"PATCH\", \"patch\"], [\"HEAD\", \"head\"], [\"OPTIONS\", \"options\"], [\"TRACE\", \"trace\"]];\n/**\n * Checks whether a value is a `HttpMethod`.\n *\n * **Example** (Checking HTTP method values)\n *\n * ```ts\n * import { HttpMethod } from \"effect/unstable/http\"\n *\n * console.log(HttpMethod.isHttpMethod(\"GET\"))\n * // true\n * console.log(HttpMethod.isHttpMethod(\"get\"))\n * // false\n * console.log(HttpMethod.isHttpMethod(1))\n * // false\n * ```\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isHttpMethod = u => all.has(u);\n//# sourceMappingURL=HttpMethod.js.map",
|
|
115
|
+
"/**\n * Immutable outgoing HTTP client requests.\n *\n * `HttpClientRequest` is the request model shared by Effect HTTP clients and\n * platform adapters. A request stores its method, URL, query parameters, hash,\n * headers, and body as structured data, and this module provides constructors,\n * pipeable update helpers, body encoders, and Web `Request` conversions.\n *\n * **Mental model**\n *\n * Request builders start from {@link empty} and return a new request for every\n * change. The base URL, query parameters, and hash stay separate until\n * conversion, so code can update them independently before calling\n * {@link toUrl}, {@link toWebResult}, or {@link toWeb}. Body helpers delegate to\n * `HttpBody` and update `Content-Type` and `Content-Length` when the selected\n * body carries that metadata.\n *\n * **Common tasks**\n *\n * - Start a request with {@link get}, {@link post}, {@link put},\n * {@link patch}, or another method constructor.\n * - Add authentication or accepted media types with {@link basicAuth},\n * {@link bearerToken}, {@link accept}, or {@link acceptJson}.\n * - Change URL parts with {@link setUrl}, {@link prependUrl},\n * {@link appendUrl}, {@link setUrlParam}, {@link appendUrlParam}, and\n * {@link setHash}.\n * - Attach payloads with {@link bodyJson}, {@link bodyUrlParams},\n * {@link bodyFormData}, {@link bodyStream}, or {@link bodyFile}.\n * - Bridge Web platform values with {@link fromWeb}, {@link toWebResult}, and\n * {@link toWeb}.\n *\n * **Gotchas**\n *\n * Passing a `URL` extracts its search parameters and fragment into structured\n * fields, while a string URL is kept as provided. Use the `setUrlParam` helpers\n * to replace query values, and the `appendUrlParam` helpers when repeated keys\n * should be preserved. `FormData` bodies intentionally leave multipart boundary\n * headers to the runtime, so `setBody` removes explicit content headers for\n * them.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport { stringOrRedacted } from \"../../internal/redacted.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport { hasBody } from \"./HttpMethod.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpClientRequest\";\n/**\n * Returns `true` when a value is an `HttpClientRequest`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClientRequest = u => hasProperty(u, TypeId);\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"HttpClientRequest\",\n method: this.method,\n url: this.url,\n urlParams: this.urlParams,\n hash: this.hash,\n headers: redact(this.headers),\n body: this.body.toJSON()\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Constructs an `HttpClientRequest` from fully normalized request components.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeWith(method, url, urlParams, hash, headers, body) {\n const self = Object.create(Proto);\n self.method = method;\n self.url = url;\n self.urlParams = urlParams;\n self.hash = hash;\n self.headers = headers;\n self.body = body;\n return self;\n}\n/**\n * An empty `GET` request with no URL, query parameters, hash, headers, or body.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/makeWith(\"GET\", \"\", UrlParams.empty, /*#__PURE__*/Option.none(), Headers.empty, HttpBody.empty);\n/**\n * Creates a request constructor for the specified HTTP method.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = method => (url, options) => modify(empty, {\n method,\n url,\n ...(options ?? undefined)\n});\n/**\n * Creates a `GET` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/make(\"GET\");\n/**\n * Creates a `POST` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const post = /*#__PURE__*/make(\"POST\");\n/**\n * Creates a `PATCH` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const patch = /*#__PURE__*/make(\"PATCH\");\n/**\n * Creates a `PUT` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const put = /*#__PURE__*/make(\"PUT\");\nconst del = /*#__PURE__*/make(\"DELETE\");\nexport {\n/**\n * Creates a `DELETE` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\ndel as delete };\n/**\n * Creates a `HEAD` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const head = /*#__PURE__*/make(\"HEAD\");\n/**\n * Creates an `OPTIONS` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const options = /*#__PURE__*/make(\"OPTIONS\");\n/**\n * Creates a `TRACE` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const trace = /*#__PURE__*/make(\"TRACE\");\n/**\n * Applies request options to an `HttpClientRequest`, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const modify = /*#__PURE__*/dual(2, (self, options) => {\n let result = self;\n if (options.method) {\n result = setMethod(result, options.method);\n }\n if (options.url) {\n result = setUrl(result, options.url);\n }\n if (options.headers) {\n result = setHeaders(result, options.headers);\n }\n if (options.urlParams) {\n result = setUrlParams(result, options.urlParams);\n }\n if (options.hash) {\n result = setHash(result, options.hash);\n }\n if (options.body) {\n result = setBody(result, options.body);\n }\n if (options.accept) {\n result = accept(result, options.accept);\n }\n if (options.acceptJson) {\n result = acceptJson(result);\n }\n return result;\n});\n/**\n * Sets the HTTP method on a request, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setMethod = /*#__PURE__*/dual(2, (self, method) => makeWith(method, self.url, self.urlParams, self.hash, self.headers, self.body));\n/**\n * Sets a single request header, replacing any existing value for that header.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeader = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, self.urlParams, self.hash, Headers.set(self.headers, key, value), self.body));\n/**\n * Sets multiple request headers from an input collection, replacing existing values with matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeaders = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, self.urlParams, self.hash, Headers.setAll(self.headers, input), self.body));\n/**\n * Sets the `Authorization` header using HTTP Basic authentication credentials.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const basicAuth = /*#__PURE__*/dual(3, (self, username, password) => setHeader(self, \"Authorization\", `Basic ${btoa(`${stringOrRedacted(username)}:${stringOrRedacted(password)}`)}`));\n/**\n * Sets the `Authorization` header using a bearer token.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bearerToken = /*#__PURE__*/dual(2, (self, token) => setHeader(self, \"Authorization\", `Bearer ${stringOrRedacted(token)}`));\n/**\n * Sets the `Accept` header to the specified media type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const accept = /*#__PURE__*/dual(2, (self, mediaType) => setHeader(self, \"Accept\", mediaType));\n/**\n * Sets the `Accept` header to `application/json`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const acceptJson = /*#__PURE__*/accept(\"application/json\");\n/**\n * Sets the request URL. When given a `URL`, its search parameters and hash are extracted into the request's structured fields.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrl = /*#__PURE__*/dual(2, (self, url) => {\n if (typeof url === \"string\") {\n return makeWith(self.method, url, self.urlParams, self.hash, self.headers, self.body);\n }\n const clone = new URL(url.toString());\n const urlParams = UrlParams.fromInput(clone.searchParams);\n const hash = Option.fromNullishOr(clone.hash === \"\" ? undefined : clone.hash.slice(1));\n clone.search = \"\";\n clone.hash = \"\";\n return makeWith(self.method, clone.toString(), urlParams, hash, self.headers, self.body);\n});\n/**\n * Prepends a URL segment to the request URL, inserting or trimming one slash as needed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const prependUrl = /*#__PURE__*/dual(2, (self, path) => {\n if (path === \"\") return self;\n return makeWith(self.method, joinSegments(path, self.url), self.urlParams, self.hash, self.headers, self.body);\n});\n/**\n * Appends a URL segment to the request URL, inserting or trimming one slash as needed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrl = /*#__PURE__*/dual(2, (self, path) => {\n if (path === \"\") return self;\n return makeWith(self.method, joinSegments(self.url, path), self.urlParams, self.hash, self.headers, self.body);\n});\nconst joinSegments = (first, second) => {\n const endsWithSlash = first.endsWith(\"/\");\n const startsWithSlash = second.startsWith(\"/\");\n const needsTrim = endsWithSlash && startsWithSlash;\n const needsSlash = !endsWithSlash && !startsWithSlash;\n return needsTrim ? first + second.slice(1) : needsSlash ? first + \"/\" + second : first + second;\n};\n/**\n * Updates the request URL by applying a function to the current URL string.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateUrl = /*#__PURE__*/dual(2, (self, f) => makeWith(self.method, f(self.url), self.urlParams, self.hash, self.headers, self.body));\n/**\n * Sets one query parameter, replacing existing values for that parameter name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrlParam = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, UrlParams.set(self.urlParams, key, value), self.hash, self.headers, self.body));\n/**\n * Sets query parameters from an input collection, replacing existing values for matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrlParams = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, UrlParams.setAll(self.urlParams, input), self.hash, self.headers, self.body));\n/**\n * Appends one query parameter value without removing existing values for the same name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrlParam = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, UrlParams.append(self.urlParams, key, value), self.hash, self.headers, self.body));\n/**\n * Appends query parameters from an input collection without removing existing values for matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrlParams = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, UrlParams.appendAll(self.urlParams, input), self.hash, self.headers, self.body));\n/**\n * Sets the URL fragment on a request without the leading `#`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHash = /*#__PURE__*/dual(2, (self, hash) => makeWith(self.method, self.url, self.urlParams, Option.some(hash), self.headers, self.body));\n/**\n * Removes the URL fragment from a request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeHash = self => makeWith(self.method, self.url, self.urlParams, Option.none(), self.headers, self.body);\n/**\n * Sets the request body and updates `Content-Type` and `Content-Length` headers from the body metadata when available.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setBody = /*#__PURE__*/dual(2, (self, body) => {\n let headers = self.headers;\n if (body._tag === \"Empty\" || body._tag === \"FormData\") {\n headers = Headers.remove(Headers.remove(headers, \"Content-Type\"), \"Content-length\");\n } else {\n if (body.contentType) {\n headers = Headers.set(headers, \"content-type\", body.contentType);\n }\n if (body.contentLength !== undefined) {\n headers = Headers.set(headers, \"content-length\", body.contentLength.toString());\n }\n }\n return makeWith(self.method, self.url, self.urlParams, self.hash, headers, body);\n});\n/**\n * Sets a `Uint8Array` request body with an optional content type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyUint8Array = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, contentType) => setBody(self, HttpBody.uint8Array(body, contentType)));\n/**\n * Sets a text request body with an optional content type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyText = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, contentType) => setBody(self, HttpBody.text(body, contentType)));\n/**\n * Encodes a value as a JSON request body and sets it on the request, failing with `HttpBodyError` if encoding fails.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyJson = /*#__PURE__*/dual(2, (self, body) => Effect.map(HttpBody.json(body), body => setBody(self, body)));\n/**\n * Sets a JSON request body using unsafe JSON encoding, which may throw instead of failing in the Effect error channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyJsonUnsafe = /*#__PURE__*/dual(2, (self, body) => setBody(self, HttpBody.jsonUnsafe(body)));\n/**\n * Creates a schema-based JSON body encoder that sets the encoded value on a request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const encode = HttpBody.jsonSchema(schema, options);\n return dual(2, (self, body) => Effect.map(encode(body), body => setBody(self, body)));\n};\n/**\n * Sets an `application/x-www-form-urlencoded` request body from URL parameter input.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyUrlParams = /*#__PURE__*/dual(2, (self, input) => setBody(self, HttpBody.urlParams(UrlParams.fromInput(input))));\n/**\n * Sets a `FormData` request body.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFormData = /*#__PURE__*/dual(2, (self, body) => setBody(self, HttpBody.formData(body)));\n/**\n * Creates a `FormData` request body from record-style entries and sets it on the request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFormDataRecord = /*#__PURE__*/dual(2, (self, entries) => setBody(self, HttpBody.formDataRecord(entries)));\n/**\n * Sets a streaming `Uint8Array` request body with optional content type and content length metadata.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyStream = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, options) => setBody(self, HttpBody.stream(body, options?.contentType, options?.contentLength)));\n/**\n * Creates a file-backed request body from a filesystem path and sets it on the request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFile = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, path, options) => Effect.map(HttpBody.file(path, options), body => setBody(self, body)));\n/**\n * Builds a `URL` from the request URL, query parameters, and hash, returning `Option.none()` if the URL is invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport function toUrl(self) {\n const r = UrlParams.makeUrl(self.url, self.urlParams, Option.getOrUndefined(self.hash));\n if (Result.isSuccess(r)) {\n return Option.some(r.success);\n }\n return Option.none();\n}\n/**\n * Converts a Web `Request` into an `HttpClientRequest`, preserving method, URL, headers, and supported request bodies.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = request => {\n const method = request.method.toUpperCase();\n return modify(empty, {\n method,\n url: new URL(request.url),\n headers: request.headers,\n body: fromWebBody(request, method)\n });\n};\nconst fromWebBody = (request, method) => {\n if (!hasBody(method) || request.body === null) {\n return HttpBody.empty;\n }\n return HttpBody.raw(request.body, {\n contentType: request.headers.get(\"content-type\") ?? undefined,\n contentLength: parseContentLength(request.headers.get(\"content-length\"))\n });\n};\nconst parseContentLength = contentLength => {\n if (contentLength === null) {\n return undefined;\n }\n const parsed = Number.parseInt(contentLength, 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\n/**\n * Converts an `HttpClientRequest` safely to a Web `Request` as a `Result`, failing when the request URL is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebResult = (self, options) => {\n const url = UrlParams.makeUrl(self.url, self.urlParams, Option.getOrUndefined(self.hash));\n if (Result.isFailure(url)) {\n return Result.fail(url.failure);\n }\n const requestInit = {\n method: self.method,\n headers: self.headers\n };\n if (options?.signal) {\n requestInit.signal = options.signal;\n }\n if (hasBody(self.method)) {\n switch (self.body._tag) {\n case \"Empty\":\n {\n break;\n }\n case \"Raw\":\n {\n requestInit.body = self.body.body;\n if (isReadableStream(self.body.body)) {\n ;\n requestInit.duplex = \"half\";\n }\n break;\n }\n case \"Uint8Array\":\n {\n requestInit.body = self.body.body;\n break;\n }\n case \"FormData\":\n {\n requestInit.body = self.body.formData;\n break;\n }\n case \"Stream\":\n {\n requestInit.body = Stream.toReadableStreamWith(self.body.stream, options?.context ?? Context.empty());\n requestInit.duplex = \"half\";\n break;\n }\n }\n }\n return Result.try({\n try: () => new Request(url.success, requestInit),\n catch: cause => new UrlParams.UrlParamsError({\n cause\n })\n });\n};\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\n/**\n * Converts an `HttpClientRequest` to a Web `Request`, failing with `UrlParamsError` when the request URL is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (self, options) => Effect.contextWith(context => Effect.fromResult(toWebResult(self, {\n context: context,\n signal: options?.signal\n})));\n//# sourceMappingURL=HttpClientRequest.js.map",
|
|
116
|
+
"/**\n * Shared utilities for reading and decoding incoming HTTP messages.\n *\n * `HttpIncomingMessage` is the common body-and-header surface used by HTTP\n * server requests and client responses. It keeps transport-specific metadata in\n * the surrounding request and response modules while this module focuses on\n * headers, optional remote address information, byte streams, buffered body\n * views, and schema decoders for JSON bodies, URL-encoded bodies, and headers.\n *\n * Use these helpers in middleware, route handlers, client response processing,\n * and adapters when code should work with any incoming message instead of a\n * concrete request or response type. Body access is effectful because reading,\n * parsing, and decoding can fail; use `stream` when bytes should stay\n * streaming, and use `text`, `json`, `urlParamsBody`, or `arrayBuffer` when a\n * buffered view is appropriate. Some runtimes expose bodies as one-shot Web\n * streams, so prefer one body representation per message and let each\n * implementation's cached accessors handle repeated reads where available.\n *\n * Headers use the HTTP `Headers` module's lowercase, single-value map, so\n * repeated values may already have been combined or normalized by the adapter.\n * Decode headers with `schemaHeaders` when their shape matters. For form\n * bodies, `urlParamsBody` handles URL-encoded payloads; multipart support lives\n * on `HttpServerRequest`, with `MaxBodySize` providing the shared limit\n * reference used by multipart parsing.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as UrlParams from \"./UrlParams.js\";\n/**\n * Type identifier for `HttpIncomingMessage` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpIncomingMessage\";\n/**\n * Returns `true` when a value is an `HttpIncomingMessage`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpIncomingMessage = u => hasProperty(u, TypeId);\n/**\n * Creates a decoder that reads an incoming message's JSON body and decodes it with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const decode = Schema.decodeEffect(Schema.toCodecJson(schema));\n return self => Effect.flatMap(self.json, u => decode(u, options));\n};\n/**\n * Creates a decoder that reads an incoming message's URL-encoded body parameters and decodes them with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyUrlParams = (schema, options) => {\n const decode = UrlParams.schemaRecord.pipe(Schema.decodeTo(schema), Schema.decodeEffect);\n return self => Effect.flatMap(self.urlParamsBody, u => decode(u, options));\n};\n/**\n * Creates a decoder that validates and decodes an incoming message's headers with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaHeaders = (schema, options) => {\n const decode = Schema.decodeUnknownEffect(schema);\n return self => decode(self.headers, options);\n};\n/**\n * Context reference for the optional maximum size allowed when reading an incoming message body.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxBodySize = /*#__PURE__*/Context.Reference(\"effect/http/HttpIncomingMessage/MaxBodySize\", {\n defaultValue: () => undefined\n});\n/**\n * Builds an inspectable object for an incoming message, redacting headers and including a synchronously readable JSON or text body when available.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const inspect = (self, that) => {\n const contentType = self.headers[\"content-type\"] ?? \"\";\n let body;\n if (contentType.includes(\"application/json\")) {\n try {\n body = Effect.runSync(self.json);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n //\n }\n } else if (contentType.includes(\"text/\") || contentType.includes(\"urlencoded\")) {\n try {\n body = Effect.runSync(self.text);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n //\n }\n }\n const obj = {\n ...that,\n headers: redact(self.headers),\n remoteAddress: self.remoteAddress\n };\n if (body !== undefined) {\n obj.body = body;\n }\n return obj;\n};\n//# sourceMappingURL=HttpIncomingMessage.js.map",
|
|
117
|
+
"/**\n * HTTP client response values, status helpers, and body decoders.\n *\n * This module represents responses produced by the Effect HTTP client. An\n * {@link HttpClientResponse} keeps the original request together with the\n * response status, headers, cookies, and effectful body accessors inherited from\n * the shared incoming-message model.\n *\n * **Mental model**\n *\n * A response is a successful client result unless a status filter turns it into\n * a failure. {@link fromWeb} adapts a platform `Response`, body readers decode\n * the underlying Web response, and schema helpers combine status, headers, and\n * decoded body data when validating API-specific responses.\n *\n * **Common tasks**\n *\n * - Branch on exact or status-class handlers with {@link matchStatus}.\n * - Fail non-accepted statuses with {@link filterStatus} or\n * {@link filterStatusOk}.\n * - Decode JSON response envelopes with {@link schemaJson}.\n * - Decode status and headers without reading a body with {@link schemaNoBody}.\n * - Stream response bytes from an effect with {@link stream}.\n *\n * **Gotchas**\n *\n * HTTP status codes are data, not errors, until a filter is applied. `json`\n * parses an empty text body as `null`. Body readers fail with `HttpClientError`\n * when decoding fails, and the raw stream fails when no body is present.\n * Headers use the HTTP `Headers` module's lowercase, single-value map, while\n * response cookies are parsed separately from `Set-Cookie` headers.\n *\n * **See also**\n *\n * {@link HttpClientResponse}, {@link fromWeb}, {@link matchStatus},\n * {@link schemaJson}, {@link filterStatus}.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Error from \"./HttpClientError.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nexport {\n/**\n * Creates a decoder that reads a response JSON body and decodes it with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaBodyJson,\n/**\n * Creates a decoder that reads response URL-encoded body parameters and decodes them with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaBodyUrlParams,\n/**\n * Creates a decoder that validates and decodes response headers with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaHeaders } from \"./HttpIncomingMessage.js\";\n/**\n * Type identifier for `HttpClientResponse` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpClientResponse\";\n/**\n * Wraps a Web `Response` and its original `HttpClientRequest` as an `HttpClientResponse`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWeb = (request, source) => new WebHttpClientResponse(request, source);\n/**\n * Creates a decoder for a response's status, headers, and JSON body using the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const decode = Schema.decodeEffect(Schema.toCodecJson(schema).annotate({\n options\n }));\n return self => Effect.flatMap(self.json, body => decode({\n status: self.status,\n headers: self.headers,\n body\n }));\n};\n/**\n * Creates a decoder for a response's status and headers without reading a response body.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaNoBody = (schema, options) => {\n const decode = Schema.decodeEffect(schema.annotate({\n options\n }));\n return self => decode({\n status: self.status,\n headers: self.headers\n });\n};\n/**\n * Converts an effect producing an `HttpClientResponse` into a stream of response body bytes.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const stream = effect => Stream.unwrap(Effect.map(effect, self => self.stream));\n/**\n * Pattern matches on a response status, checking exact status handlers before status-class handlers and `orElse`.\n *\n * @category pattern matching\n * @since 4.0.0\n */\nexport const matchStatus = /*#__PURE__*/dual(2, (self, cases) => {\n const status = self.status;\n if (cases[status]) {\n return cases[status](self);\n } else if (status >= 200 && status < 300 && cases[\"2xx\"]) {\n return cases[\"2xx\"](self);\n } else if (status >= 300 && status < 400 && cases[\"3xx\"]) {\n return cases[\"3xx\"](self);\n } else if (status >= 400 && status < 500 && cases[\"4xx\"]) {\n return cases[\"4xx\"](self);\n } else if (status >= 500 && status < 600 && cases[\"5xx\"]) {\n return cases[\"5xx\"](self);\n }\n return cases.orElse(self);\n});\n/**\n * Succeeds with the response when its status satisfies the predicate, otherwise fails with `HttpClientError`.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatus = /*#__PURE__*/dual(2, (self, f) => Effect.suspend(() => f(self.status) ? Effect.succeed(self) : Effect.fail(new Error.HttpClientError({\n reason: new Error.StatusCodeError({\n response: self,\n request: self.request,\n description: \"invalid status code\"\n })\n}))));\n/**\n * Succeeds with the response only when its status is in the 2xx range, otherwise fails with `HttpClientError`.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatusOk = self => self.status >= 200 && self.status < 300 ? Effect.succeed(self) : Effect.fail(new Error.HttpClientError({\n reason: new Error.StatusCodeError({\n response: self,\n request: self.request,\n description: \"non 2xx status code\"\n })\n}));\n// -----------------------------------------------------------------------------\n// internal\n// -----------------------------------------------------------------------------\nclass WebHttpClientResponse extends Inspectable.Class {\n [HttpIncomingMessage.TypeId];\n [TypeId];\n request;\n source;\n constructor(request, source) {\n super();\n this.request = request;\n this.source = source;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this[TypeId] = TypeId;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpClientResponse\",\n request: this.request.toJSON(),\n status: this.status\n });\n }\n get status() {\n return this.source.status;\n }\n get headers() {\n return Headers.fromInput(this.source.headers);\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.fromSetCookie(this.source.headers.getSetCookie());\n }\n get remoteAddress() {\n return Option.none();\n }\n get stream() {\n return this.source.body ? Stream.fromReadableStream({\n evaluate: () => this.source.body,\n onError: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }) : Stream.fail(new Error.HttpClientError({\n reason: new Error.EmptyBodyError({\n request: this.request,\n response: this,\n description: \"can not create stream from empty body\"\n })\n }));\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n textBody;\n get text() {\n if (this.textBody) {\n return this.textBody;\n }\n this.textBody = Effect.tryPromise({\n try: () => this.source.text(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n this.arrayBufferBody = Effect.map(this.textBody, _ => new TextEncoder().encode(_).buffer);\n return this.textBody;\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n formDataBody;\n get formData() {\n return this.formDataBody ??= Effect.tryPromise({\n try: () => this.source.formData(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n }\n arrayBufferBody;\n get arrayBuffer() {\n if (this.arrayBufferBody) {\n return this.arrayBufferBody;\n }\n this.arrayBufferBody = Effect.tryPromise({\n try: () => this.source.arrayBuffer(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n this.textBody = Effect.map(this.arrayBufferBody, _ => new TextDecoder().decode(_));\n return this.arrayBufferBody;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\n//# sourceMappingURL=HttpClientResponse.js.map",
|
|
118
|
+
"/**\n * HTTP propagation helpers for Effect tracing context.\n *\n * This module converts Effect `Tracer.Span` values into outbound trace headers\n * and decodes inbound propagation headers into `Tracer.ExternalSpan` parents.\n * HTTP clients use it to continue the current span across outgoing requests, and\n * server middleware uses it to parent request spans from upstream services.\n *\n * **Mental model**\n *\n * Propagation is metadata, not tracing storage. {@link toHeaders} serializes the\n * current span into HTTP headers for the next service. {@link fromHeaders}\n * inspects incoming headers and returns an external parent span when a supported\n * propagation format is present.\n *\n * **Common tasks**\n *\n * - Add outbound propagation headers with {@link toHeaders}\n * - Decode an inbound parent span with {@link fromHeaders}\n * - Use {@link w3c}, {@link b3}, or {@link xb3} directly when an adapter needs a\n * specific propagation format\n *\n * **Gotchas**\n *\n * - Outbound propagation writes both W3C `traceparent` and compact B3 `b3`\n * headers\n * - Inbound decoding prefers W3C `traceparent`, then compact B3, then\n * multi-header B3 (`x-b3-*`)\n * - Header names in `Headers.Headers` are expected to be lowercase\n * - Missing or unsupported trace context decodes to `Option.none`, so callers\n * should start a new trace when no parent is returned\n *\n * @since 4.0.0\n */\nimport * as Option from \"../../Option.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as Headers from \"./Headers.js\";\n/**\n * Encodes a span into HTTP trace propagation headers.\n *\n * **Details**\n *\n * The generated headers include both compact B3 (`b3`) and W3C `traceparent`\n * formats.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toHeaders = span => Headers.fromRecordUnsafe({\n b3: `${span.traceId}-${span.spanId}-${span.sampled ? \"1\" : \"0\"}${Option.match(span.parent, {\n onNone: () => \"\",\n onSome: parent => `-${parent.spanId}`\n })}`,\n traceparent: `00-${span.traceId}-${span.spanId}-${span.sampled ? \"01\" : \"00\"}`\n});\n/**\n * Decodes an external span safely from HTTP trace propagation headers.\n *\n * **Details**\n *\n * W3C `traceparent` is tried first, followed by compact B3 (`b3`) and then\n * multi-header B3 (`x-b3-*`).\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const fromHeaders = headers => {\n let span = w3c(headers);\n if (Option.isSome(span)) {\n return span;\n }\n span = b3(headers);\n if (Option.isSome(span)) {\n return span;\n }\n return xb3(headers);\n};\n/**\n * Decodes an external span safely from the compact B3 `b3` header.\n *\n * **Details**\n *\n * Returns `Option.none` when the header is missing or does not contain trace and\n * span identifiers.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const b3 = headers => {\n if (!(\"b3\" in headers)) {\n return Option.none();\n }\n const parts = headers[\"b3\"].split(\"-\");\n if (parts.length < 2) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId: parts[0],\n spanId: parts[1],\n sampled: parts[2] ? parts[2] === \"1\" : true\n }));\n};\n/**\n * Decodes an external span safely from multi-header B3 propagation headers.\n *\n * **Details**\n *\n * The decoder reads `x-b3-traceid`, `x-b3-spanid`, and optional `x-b3-sampled`\n * headers.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const xb3 = headers => {\n if (!headers[\"x-b3-traceid\"] || !headers[\"x-b3-spanid\"]) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId: headers[\"x-b3-traceid\"],\n spanId: headers[\"x-b3-spanid\"],\n sampled: headers[\"x-b3-sampled\"] ? headers[\"x-b3-sampled\"] === \"1\" : true\n }));\n};\nconst w3cTraceId = /^[0-9a-f]{32}$/i;\nconst w3cSpanId = /^[0-9a-f]{16}$/i;\n/**\n * Decodes an external span safely from the W3C `traceparent` header.\n *\n * **Details**\n *\n * Only version `00` headers with valid trace and span identifiers are accepted.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const w3c = headers => {\n if (!headers[\"traceparent\"]) {\n return Option.none();\n }\n const parts = headers[\"traceparent\"].split(\"-\");\n if (parts.length !== 4) {\n return Option.none();\n }\n const [version, traceId, spanId, flags] = parts;\n switch (version) {\n case \"00\":\n {\n if (w3cTraceId.test(traceId) === false || w3cSpanId.test(spanId) === false) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId,\n spanId,\n sampled: (parseInt(flags, 16) & 1) === 1\n }));\n }\n default:\n {\n return Option.none();\n }\n }\n};\n//# sourceMappingURL=HttpTraceContext.js.map",
|
|
119
|
+
"import * as Cause from \"../../Cause.js\";\nimport { Clock } from \"../../Clock.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Duration from \"../../Duration.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport { constant, constFalse, constTrue, dual, flow, identity } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Ref from \"../../Ref.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schedule from \"../../Schedule.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Error from \"./HttpClientError.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as HttpMethod from \"./HttpMethod.js\";\nimport * as TraceContext from \"./HttpTraceContext.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpClient\";\n/**\n * Returns `true` if the provided value is an `HttpClient`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClient = u => Predicate.hasProperty(u, TypeId);\n/**\n * Service tag for the default outgoing HTTP client service.\n *\n * **When to use**\n *\n * Use to provide the HTTP client implementation consumed by the module's\n * request accessor functions.\n *\n * @category services\n * @since 4.0.0\n */\nexport const HttpClient = /*#__PURE__*/Context.Service(\"effect/HttpClient\");\nconst accessor = method => (...args) => Effect.flatMap(HttpClient, client => client[method](...args));\n/**\n * Executes a prebuilt `HttpClientRequest` using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const execute = /*#__PURE__*/accessor(\"execute\");\n/**\n * Executes a `GET` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/accessor(\"get\");\n/**\n * Executes a `HEAD` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const head = /*#__PURE__*/accessor(\"head\");\n/**\n * Executes a `POST` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const post = /*#__PURE__*/accessor(\"post\");\n/**\n * Executes a `PATCH` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const patch = /*#__PURE__*/accessor(\"patch\");\n/**\n * Executes a `PUT` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const put = /*#__PURE__*/accessor(\"put\");\n/**\n * Executes a `DELETE` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const del = /*#__PURE__*/accessor(\"del\");\n/**\n * Executes an `OPTIONS` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const options = /*#__PURE__*/accessor(\"options\");\n/**\n * Transforms a client by wrapping the response effect for each request.\n *\n * **Details**\n *\n * The transformation receives both the response effect and the original request, allowing it to change success, error, and environment behavior.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => makeWith(Effect.flatMap(request => f(self.postprocess(Effect.succeed(request)), request)), self.preprocess));\n/**\n * Transforms a client by applying an effectful transformation to each response effect.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const transformResponse = /*#__PURE__*/dual(2, (self, f) => makeWith(request => f(self.postprocess(request)), self.preprocess));\nconst catch_ = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.catch(f)));\nexport {\n/**\n * Handles all client failures with an effectful recovery function and returns a transformed client.\n *\n * @category error handling\n * @since 4.0.0\n */\ncatch_ as catch };\n/**\n * Handles client failures with one or more matching `_tag` values and returns a transformed client.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const catchTag = /*#__PURE__*/dual(3, (self, tag, f) => transformResponse(self, effect => Effect.catchTag(effect, tag, f)));\n/**\n * Handles client failures by matching their `_tag` values against a case map.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const catchTags = /*#__PURE__*/dual(2, (self, cases) => transformResponse(self, Effect.catchTags(cases)));\n/**\n * Filters the result of a response, or runs an alternative effect if the predicate fails.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterOrElse = /*#__PURE__*/dual(3, (self, f, orElse) => transformResponse(self, Effect.filterOrElse(f, orElse)));\n/**\n * Filters successful responses, or fails with the error produced by `orFailWith` when the predicate does not match.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterOrFail = /*#__PURE__*/dual(3, (self, f, orFailWith) => transformResponse(self, Effect.filterOrFail(f, orFailWith)));\n/**\n * Filters responses by HTTP status code.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatus = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.flatMap(HttpClientResponse.filterStatus(f))));\n/**\n * Filters responses that return a 2xx status code.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatusOk = /*#__PURE__*/transformResponse(/*#__PURE__*/Effect.flatMap(HttpClientResponse.filterStatusOk));\n/**\n * Constructs an `HttpClient.With` from a preprocessing function and a postprocessing function.\n *\n * **Details**\n *\n * `execute` applies preprocessing to the request and then passes the resulting request effect to postprocessing.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWith = (postprocess, preprocess) => {\n const self = Object.create(Proto);\n self.preprocess = preprocess;\n self.postprocess = postprocess;\n self.execute = function (request) {\n return postprocess(preprocess(request));\n };\n return self;\n};\nconst Proto = {\n [TypeId]: TypeId,\n pipe() {\n return pipeArguments(this, arguments);\n },\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/HttpClient\"\n };\n },\n ... /*#__PURE__*/Object.fromEntries(/*#__PURE__*/HttpMethod.allShort.map(([fullMethod, method]) => [method, function (url, options) {\n return this.execute(HttpClientRequest.make(fullMethod)(url, options));\n }]))\n};\n/**\n * Constructs an `HttpClient` from a low-level request runner.\n *\n * **Details**\n *\n * The runner receives the request, resolved URL, abort signal, and current fiber. The client wrapper handles URL construction failures, tracing and propagation, header redaction, and aborting non-scoped requests on interruption.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = f => makeWith(effect => Effect.flatMap(effect, request => Effect.withFiber(fiber => {\n const scopedController = scopedRequests.get(request);\n const controller = scopedController ?? new AbortController();\n const urlResult = UrlParams.makeUrl(request.url, request.urlParams, Option.getOrUndefined(request.hash));\n if (Result.isFailure(urlResult)) {\n return Effect.fail(new Error.HttpClientError({\n reason: new Error.InvalidUrlError({\n request,\n cause: urlResult.failure\n })\n }));\n }\n const url = urlResult.success;\n const tracerDisabled = fiber.getRef(Tracer.DisablePropagation) || fiber.getRef(TracerDisabledWhen)(request);\n if (tracerDisabled) {\n const effect = f(request, url, controller.signal, fiber);\n if (scopedController) return effect;\n return Effect.uninterruptibleMask(restore => Effect.matchCauseEffect(restore(effect), {\n onSuccess(response) {\n responseRegistry.register(response, controller);\n return Effect.succeed(new InterruptibleResponse(response, controller));\n },\n onFailure(cause) {\n if (Cause.hasInterrupts(cause)) {\n controller.abort();\n }\n return Effect.failCause(cause);\n }\n }));\n }\n return Effect.useSpan(fiber.getRef(SpanNameGenerator)(request), {\n kind: \"client\"\n }, span => {\n span.attribute(\"http.request.method\", request.method);\n span.attribute(\"server.address\", url.origin);\n if (url.port !== \"\") {\n span.attribute(\"server.port\", +url.port);\n }\n span.attribute(\"url.full\", url.toString());\n span.attribute(\"url.path\", url.pathname);\n span.attribute(\"url.scheme\", url.protocol.slice(0, -1));\n const query = url.search.slice(1);\n if (query !== \"\") {\n span.attribute(\"url.query\", query);\n }\n const redactedHeaderNames = fiber.getRef(Headers.CurrentRedactedNames);\n const redactedHeaders = Headers.redact(request.headers, redactedHeaderNames);\n for (const name in redactedHeaders) {\n span.attribute(`http.request.header.${name}`, String(redactedHeaders[name]));\n }\n request = fiber.getRef(TracerPropagationEnabled) ? HttpClientRequest.setHeaders(request, TraceContext.toHeaders(span)) : request;\n return Effect.uninterruptibleMask(restore => restore(f(request, url, controller.signal, fiber)).pipe(Effect.withParentSpan(span, {\n captureStackTrace: false\n }), Effect.matchCauseEffect({\n onSuccess: response => {\n span.attribute(\"http.response.status_code\", response.status);\n const redactedHeaders = Headers.redact(response.headers, redactedHeaderNames);\n for (const name in redactedHeaders) {\n span.attribute(`http.response.header.${name}`, String(redactedHeaders[name]));\n }\n if (scopedController) return Effect.succeed(response);\n responseRegistry.register(response, controller);\n return Effect.succeed(new InterruptibleResponse(response, controller));\n },\n onFailure(cause) {\n if (!scopedController && Cause.hasInterrupts(cause)) {\n controller.abort();\n }\n return Effect.failCause(cause);\n }\n })));\n });\n})), Effect.succeed);\n/**\n * Appends a transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequest = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.map(self.preprocess(request), f)));\n/**\n * Appends an effectful transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequestEffect = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.flatMap(self.preprocess(request), f)));\n/**\n * Prepends a transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequestInput = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => self.preprocess(f(request))));\n/**\n * Prepends an effectful transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequestInputEffect = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.flatMap(f(request), self.preprocess)));\n/**\n * Retries the request based on a provided schedule or policy.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const retry = /*#__PURE__*/dual(2, (self, policy) => transformResponse(self, Effect.retry(policy)));\n/**\n * Retries common transient errors, such as rate limiting, timeouts or network issues.\n *\n * **When to use**\n *\n * Use to focus on retrying errors, transient responses, or both.\n *\n * **Details**\n *\n * Specifying a `while` predicate allows you to consider other errors as\n * transient, and is ignored in \"response-only\" mode.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const retryTransient = /*#__PURE__*/dual(2, (self, options) => {\n const isOnlySchedule = Schedule.isSchedule(options);\n const retryOn = isOnlySchedule ? \"errors-and-responses\" : options.retryOn ?? \"errors-and-responses\";\n const schedule = isOnlySchedule ? options : options.schedule;\n const passthroughSchedule = schedule && Schedule.passthrough(schedule);\n const times = isOnlySchedule ? undefined : options.times;\n return transformResponse(self, flow(retryOn === \"errors-only\" ? identity : Effect.repeat({\n schedule: passthroughSchedule,\n times,\n while: isTransientResponse\n }), retryOn === \"response-only\" ? identity : Effect.retry({\n while: isOnlySchedule || options.while === undefined ? isTransientError : Predicate.or(isTransientError, options.while),\n schedule,\n times\n })));\n});\n/**\n * Applies request rate limiting using the `RateLimiter` service.\n *\n * **Details**\n *\n * It can update limits by inspecting common rate limit response headers and\n * automatically retries HTTP `429` responses (or `HttpClientError` values\n * wrapping a `429` response) by forcing the retry back through the limiter.\n *\n * @category rate limiting\n * @since 4.0.0\n */\nexport const withRateLimiter = /*#__PURE__*/dual(2, (self, options) => {\n const initialState = {\n initial: true,\n limit: options.limit,\n window: Duration.max(Duration.fromInputUnsafe(options.window), Duration.millis(1))\n };\n const states = new Map();\n const keyOption = options.key;\n const resolveKey = typeof keyOption === \"function\" ? keyOption : constant(keyOption);\n const tokensOption = options.tokens;\n const resolveTokens = typeof tokensOption === \"function\" ? tokensOption : constant(tokensOption ?? 1);\n const getState = key => {\n const current = states.get(key);\n if (current !== undefined) {\n return current;\n }\n states.set(key, initialState);\n return initialState;\n };\n const onResponse = options.disableResponseInspection ? undefined : (clock, key, headers, tokens) => {\n const current = getState(key);\n const next = parseRateLimiterState(current, clock, headers, tokens);\n if (next.limit !== current.limit || !Duration.equals(next.window, current.window)) {\n states.set(key, next);\n }\n };\n return transform(self, function loop(effect, request) {\n const fiber = Fiber.getCurrent();\n const clock = fiber.getRef(Clock);\n const key = resolveKey(request);\n const tokens = Math.max(resolveTokens(request), 1);\n const current = getState(key);\n function retry(response) {\n if (options.disableResponseInspection) return loop(effect, request);\n const retryAfter = parseRetryAfter(clock, getHeader(response.headers, \"retry-after\"));\n return retryAfter ? Effect.flatMap(Effect.sleep(retryAfter), () => loop(effect, request)) : loop(effect, request);\n }\n return Effect.flatMap(options.limiter.consume({\n algorithm: options.algorithm,\n onExceeded: \"delay\",\n key,\n limit: current.limit,\n window: current.window,\n tokens\n }), ({\n delay\n }) => {\n const run = Effect.matchEffect(effect, {\n onSuccess(response) {\n onResponse?.(clock, key, response.headers, tokens);\n if (response.status !== 429) return Effect.succeed(response);\n return retry(response);\n },\n onFailure(error) {\n if (isTooManyRequestsHttpClientError(error)) {\n onResponse?.(clock, key, error.reason.response.headers, tokens);\n return retry(error.reason.response);\n }\n return Effect.fail(error);\n }\n });\n return Duration.isZero(delay) ? run : Effect.delay(run, delay);\n });\n });\n});\nconst parseRateLimiterState = (state, clock, headers, tokens) => {\n const limit = parseRateLimitLimit(state, headers, tokens) ?? state.limit;\n const window = parseRateLimitWindow(clock, headers) ?? state.window;\n if (limit === state.limit && Duration.equals(window, state.window)) {\n return state;\n }\n return {\n limit,\n window,\n initial: false\n };\n};\nconst parseRateLimitLimit = (state, headers, tokens) => {\n const raw = getHeader(headers, \"ratelimit-limit\", \"x-ratelimit-limit\");\n const value = parseNumberHeader(raw);\n if (value !== undefined && value > 0) {\n return value;\n }\n const remaining = parseRateLimitRemaining(headers);\n if (remaining === undefined) {\n return undefined;\n }\n return state.initial ? remaining + tokens : Math.max(remaining + tokens, state.limit);\n};\nconst parseRateLimitRemaining = headers => {\n const raw = getHeader(headers, \"ratelimit-remaining\", \"x-ratelimit-remaining\");\n const value = parseNumberHeader(raw);\n return value !== undefined && value >= 0 ? value : undefined;\n};\nconst parseRateLimitWindow = (clock, headers) => {\n const retryAfter = parseRetryAfter(clock, getHeader(headers, \"retry-after\"));\n if (retryAfter !== undefined) {\n return retryAfter;\n }\n const resetAfter = parseResetAfter(getHeader(headers, \"ratelimit-reset-after\", \"x-ratelimit-reset-after\"));\n if (resetAfter !== undefined) {\n return resetAfter;\n }\n return parseResetHeader(clock, getHeader(headers, \"ratelimit-reset\", \"x-ratelimit-reset\"));\n};\nconst parseRetryAfter = (clock, value) => {\n if (value === undefined) {\n return undefined;\n }\n const numeric = parseNumberHeader(value);\n if (numeric !== undefined) {\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n }\n const parsedDate = Date.parse(value);\n if (Number.isNaN(parsedDate)) {\n return undefined;\n }\n const millis = parsedDate - clock.currentTimeMillisUnsafe();\n if (millis <= 0) {\n return Duration.millis(1);\n }\n return Duration.millis(millis);\n};\nconst parseResetAfter = value => {\n const numeric = parseNumberHeader(value);\n if (numeric === undefined || numeric <= 0) {\n return undefined;\n }\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n};\nconst parseResetHeader = (clock, value) => {\n const numeric = parseNumberHeader(value);\n if (numeric === undefined || numeric <= 0) {\n return undefined;\n }\n const nowMillis = clock.currentTimeMillisUnsafe();\n if (numeric > 1_000_000_000_000) {\n return Duration.millis(Math.max(numeric - nowMillis, 1));\n }\n if (numeric > 1_000_000_000) {\n return Duration.millis(Math.max(numeric * 1_000 - nowMillis, 1));\n }\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n};\nconst parseNumberHeader = value => {\n if (value === undefined) {\n return undefined;\n }\n const match = /-?\\d+(?:\\.\\d+)?/.exec(value);\n if (match === null) {\n return undefined;\n }\n const parsed = Number(match[0]);\n return Number.isFinite(parsed) ? parsed : undefined;\n};\nconst getHeader = (headers, ...keys) => {\n for (let i = 0; i < keys.length; i++) {\n const value = headers[keys[i]];\n if (value !== undefined) {\n return value;\n }\n }\n return undefined;\n};\n/**\n * Performs an additional effect after a successful request.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const tap = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.tap(f)));\n/**\n * Performs an additional effect after an unsuccessful request.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const tapError = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.tapError(f)));\n/**\n * Performs an additional effect on the request before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const tapRequest = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.tap(self.preprocess(request), f)));\n/**\n * Adds a `Ref` of cookies to the client for handling cookies across requests.\n *\n * **When to use**\n *\n * Use to add shared cookie storage to a client so response cookies are retained\n * and sent by later requests.\n *\n * @category cookies\n * @since 4.0.0\n */\nexport const withCookiesRef = /*#__PURE__*/dual(2, (self, ref) => makeWith(request => Effect.tap(self.postprocess(request), response => Ref.update(ref, cookies => Cookies.merge(cookies, response.cookies))), request => Effect.flatMap(self.preprocess(request), request => Effect.map(Ref.get(ref), cookies => Cookies.isEmpty(cookies) ? request : HttpClientRequest.setHeader(request, \"cookie\", Cookies.toCookieHeader(cookies))))));\n/**\n * Attaches the lifetime of the `HttpClientRequest` to a `Scope`.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const withScope = self => transform(self, (effect, request) => {\n const controller = new AbortController();\n scopedRequests.set(request, controller);\n return Effect.andThen(Effect.addFinalizer(() => Effect.sync(() => controller.abort())), effect);\n});\n/**\n * Enables following HTTP redirects up to a specified number of times.\n *\n * @category redirects\n * @since 4.0.0\n */\nexport const followRedirects = /*#__PURE__*/dual(args => isHttpClient(args[0]), (self, maxRedirects) => makeWith(request => {\n const loop = (request, redirects) => Effect.flatMap(self.postprocess(Effect.succeed(request)), response => response.status >= 300 && response.status < 400 && response.headers.location && redirects < (maxRedirects ?? 10) ? loop(HttpClientRequest.setUrl(request, new URL(response.headers.location, response.request.url)), redirects + 1) : Effect.succeed(response));\n return Effect.flatMap(request, request => loop(request, 0));\n}, self.preprocess));\n/**\n * Context reference for a predicate that disables client-side tracing for matching outgoing requests.\n *\n * @category references\n * @since 4.0.0\n */\nexport const TracerDisabledWhen = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/TracerDisabledWhen\", {\n defaultValue: () => constFalse\n});\n/**\n * Context reference that controls whether outgoing client spans are propagated to request headers.\n *\n * @category references\n * @since 4.0.0\n */\nexport const TracerPropagationEnabled = /*#__PURE__*/Context.Reference(\"effect/HttpClient/TracerPropagationEnabled\", {\n defaultValue: constTrue\n});\n/**\n * Context reference for generating the span name used for outgoing client request spans.\n *\n * @category references\n * @since 4.0.0\n */\nexport const SpanNameGenerator = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/SpanNameGenerator\", {\n defaultValue: () => request => `http.client ${request.method}`\n});\n/**\n * Creates an `HttpClient` layer and merges the layer construction context into client response effects.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerMergedContext = effect => Layer.effect(HttpClient)(Effect.contextWith(context => Effect.map(effect, client => transformResponse(client, Effect.updateContext(input => Context.merge(context, input))))));\n// -----------------------------------------------------------------------------\n// internal\n// -----------------------------------------------------------------------------\nconst responseRegistry = /*#__PURE__*/(() => {\n if (\"FinalizationRegistry\" in globalThis && globalThis.FinalizationRegistry) {\n const registry = /*#__PURE__*/new FinalizationRegistry(controller => {\n controller.abort();\n });\n return {\n register(response, controller) {\n registry.register(response, controller, response);\n },\n unregister(response) {\n registry.unregister(response);\n }\n };\n }\n const timers = /*#__PURE__*/new Map();\n return {\n register(response, controller) {\n timers.set(response, setTimeout(() => controller.abort(), 5000));\n },\n unregister(response) {\n const timer = timers.get(response);\n if (timer === undefined) return;\n clearTimeout(timer);\n timers.delete(response);\n }\n };\n})();\nconst scopedRequests = /*#__PURE__*/new WeakMap();\nclass InterruptibleResponse {\n original;\n controller;\n constructor(original, controller) {\n this.original = original;\n this.controller = controller;\n }\n [HttpClientResponse.TypeId] = HttpClientResponse.TypeId;\n [HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n applyInterrupt(effect) {\n return Effect.suspend(() => {\n responseRegistry.unregister(this.original);\n return Effect.onInterrupt(effect, () => Effect.sync(() => {\n this.controller.abort();\n }));\n });\n }\n get request() {\n return this.original.request;\n }\n get status() {\n return this.original.status;\n }\n get headers() {\n return this.original.headers;\n }\n get cookies() {\n return this.original.cookies;\n }\n get remoteAddress() {\n return this.original.remoteAddress;\n }\n get formData() {\n return this.applyInterrupt(this.original.formData);\n }\n get text() {\n return this.applyInterrupt(this.original.text);\n }\n get json() {\n return this.applyInterrupt(this.original.json);\n }\n get urlParamsBody() {\n return this.applyInterrupt(this.original.urlParamsBody);\n }\n get arrayBuffer() {\n return this.applyInterrupt(this.original.arrayBuffer);\n }\n get stream() {\n return Stream.suspend(() => {\n responseRegistry.unregister(this.original);\n return Stream.ensuring(this.original.stream, Effect.sync(() => {\n this.controller.abort();\n }));\n });\n }\n toJSON() {\n return this.original.toJSON();\n }\n [Inspectable.NodeInspectSymbol]() {\n return this.original[Inspectable.NodeInspectSymbol]();\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\nconst isTransientError = error => Cause.isTimeoutError(error) || isTransientHttpError(error);\nconst isTransientHttpError = error => Error.isHttpClientError(error) && (error.reason._tag === \"TransportError\" || error.reason._tag === \"StatusCodeError\" && isTransientResponse(error.reason.response));\nconst isTooManyRequestsHttpClientError = error => Error.isHttpClientError(error) && error.reason._tag === \"StatusCodeError\" && error.reason.response.status === 429;\nconst isTransientResponse = response => response.status === 408 || response.status === 429 || response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504;\n//# sourceMappingURL=HttpClient.js.map",
|
|
120
|
+
"import * as Effect from \"./Effect.js\";\nimport * as effect from \"./internal/effect.js\";\nimport * as references from \"./internal/references.js\";\nimport * as Layer from \"./Layer.js\";\nimport * as LogLevel from \"./LogLevel.js\";\n/**\n * Runtime type identifier attached to `ErrorReporter` values.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `ErrorReporter`\n * implementations. Most code should create reporters with `make` and register\n * them with `layer`.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/ErrorReporter\";\n/**\n * Creates an `ErrorReporter` from a callback.\n *\n * **When to use**\n *\n * Use to define how reported failures are forwarded to a logging, monitoring,\n * or error-tracking backend.\n *\n * **Details**\n *\n * The returned reporter automatically deduplicates causes and individual\n * errors (the same object is never reported twice), skips interruptions,\n * and resolves the `ignore`, `severity`, and `attributes` annotations on\n * each error before invoking your callback.\n *\n * **Example** (Forwarding errors to the console)\n *\n * ```ts\n * import { ErrorReporter } from \"effect\"\n *\n * // Forward every failure to the console\n * const consoleReporter = ErrorReporter.make(\n * ({ error, severity, attributes }) => {\n * console.error(`[${severity}]`, error.message, attributes)\n * }\n * )\n * ```\n *\n * @see {@link layer} for registering reporters in the environment\n * @see {@link report} for manually reporting a `Cause`\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = report => {\n const reported = new WeakSet();\n return {\n [TypeId]: TypeId,\n report(options) {\n if (reported.has(options.cause)) return;\n reported.add(options.cause);\n for (let i = 0; i < options.cause.reasons.length; i++) {\n const reason = options.cause.reasons[i];\n if (reason._tag === \"Interrupt\") continue;\n const original = reason._tag === \"Fail\" ? reason.error : reason.defect;\n const isObject = typeof original === \"object\" && original !== null;\n if (isObject) {\n if (reported.has(original)) continue;\n reported.add(original);\n }\n if (isIgnored(original)) continue;\n const pretty = effect.causePrettyError(original, reason.annotations);\n report({\n ...options,\n error: pretty,\n severity: isObject ? getSeverity(original) : \"Info\",\n attributes: isObject ? getAttributes(original) : emptyAttributes\n });\n }\n }\n };\n};\n/**\n * Context reference that holds the set of active error reporters for the\n * current fiber. Defaults to an empty set (no reporting).\n *\n * **When to use**\n *\n * Use when low-level code needs to read or replace the current set of reporters\n * directly.\n *\n * @category references\n * @since 4.0.0\n */\nexport const CurrentErrorReporters = references.CurrentErrorReporters;\n/**\n * Creates a `Layer` that registers one or more `ErrorReporter`s.\n *\n * **When to use**\n *\n * Use to provide one or more error reporters to effects that perform error\n * reporting.\n *\n * **Details**\n *\n * Reporters can be plain `ErrorReporter` values or effectful\n * `Effect<ErrorReporter>` values that are resolved when the layer is built. By\n * default the provided reporters **replace** any previously registered\n * reporters. Set `mergeWithExisting: true` to add them alongside existing ones.\n *\n * **Example** (Providing error reporters)\n *\n * ```ts\n * import { Effect, ErrorReporter } from \"effect\"\n *\n * const consoleReporter = ErrorReporter.make(({ error, severity }) => {\n * console.error(`[${severity}]`, error.message)\n * })\n *\n * const metricsReporter = ErrorReporter.make(({ severity }) => {\n * // increment an error counter by severity\n * })\n *\n * // Replace all existing reporters\n * const ReporterLive = ErrorReporter.layer([\n * consoleReporter,\n * metricsReporter\n * ])\n *\n * // Add to existing reporters instead of replacing\n * const ReporterMerged = ErrorReporter.layer(\n * [metricsReporter],\n * { mergeWithExisting: true }\n * )\n *\n * const program = Effect.fail(\"boom\").pipe(\n * Effect.withErrorReporting,\n * Effect.provide(ReporterLive)\n * )\n * ```\n *\n * @see {@link make} for creating an `ErrorReporter` from a callback\n * @see {@link CurrentErrorReporters} for low-level access to the current reporters\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = (reporters, options) => Layer.effect(CurrentErrorReporters, Effect.withFiber(Effect.fnUntraced(function* (fiber) {\n const currentReporters = new Set(options?.mergeWithExisting === true ? fiber.getRef(references.CurrentErrorReporters) : []);\n for (const reporter of reporters) {\n currentReporters.add(Effect.isEffect(reporter) ? yield* reporter : reporter);\n }\n return currentReporters;\n})));\n/**\n * Runs all registered error reporters on the current fiber for a `Cause`.\n *\n * **When to use**\n *\n * Use to report a failure for observability without failing the current fiber.\n *\n * **Example** (Reporting a cause manually)\n *\n * ```ts\n * import { Cause, Effect, ErrorReporter } from \"effect\"\n *\n * // Log the cause for monitoring, then continue with a fallback\n * const program = Effect.gen(function*() {\n * const cause = Cause.fail(\"something went wrong\")\n * yield* ErrorReporter.report(cause)\n * return \"fallback value\"\n * })\n * ```\n *\n * @category Reporting\n * @since 4.0.0\n */\nexport const report = cause => Effect.withFiber(fiber => {\n effect.reportCauseUnsafe(fiber, cause);\n return Effect.void;\n});\n/**\n * Defines the runtime property key used to mark an object error as ignored by error\n * reporting.\n *\n * **When to use**\n *\n * Use to suppress reporting for expected object errors, such as HTTP 404\n * responses.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.ignore]` to `true` to prevent the error from being\n * forwarded to reporters. This is useful for expected failures such as HTTP 404\n * responses.\n *\n * **Example** (Marking errors as ignored)\n *\n * ```ts\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class NotFoundError extends Data.TaggedError(\"NotFoundError\")<{}> {\n * readonly [ErrorReporter.ignore] = true\n * }\n * ```\n *\n * @see {@link isIgnored} for checking whether a value carries this annotation\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const ignore = \"~effect/ErrorReporter/ignore\";\n/**\n * Returns `true` if the given value has the `ErrorReporter.ignore` annotation\n * set to `true`.\n *\n * **When to use**\n *\n * Use to check whether an error value is annotated to be skipped before\n * forwarding it to error reporting code.\n *\n * @see {@link ignore} for the annotation key this predicate reads\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const isIgnored = u => typeof u === \"object\" && u !== null && ignore in u && u[ignore] === true;\n/**\n * Defines the runtime property key used to override the severity level of an object error.\n *\n * **When to use**\n *\n * Use to annotate object errors with the severity reporter callbacks should\n * receive.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.severity]` to a valid `LogLevel.Severity` value.\n * Missing or invalid values fall back to `\"Info\"`.\n *\n * **Example** (Setting error severity annotations)\n *\n * ```ts\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class DeprecationWarning extends Data.TaggedError(\"DeprecationWarning\")<{}> {\n * readonly [ErrorReporter.severity] = \"Warn\" as const\n * }\n * ```\n *\n * @see {@link getSeverity} for reading the severity stored under this key\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const severity = \"~effect/ErrorReporter/severity\";\n/**\n * Reads the `ErrorReporter.severity` annotation from an error object,\n * falling back to `\"Info\"` when the annotation is unset or invalid.\n *\n * **When to use**\n *\n * Use to inspect the severity that reporter callbacks will receive for an\n * object error.\n *\n * @see {@link severity} for the annotation key used to override severity\n * @see {@link Reportable} for the annotation properties recognized on object errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const getSeverity = error => {\n if (severity in error && LogLevel.values.includes(error[severity])) {\n return error[severity];\n }\n return \"Info\";\n};\n/**\n * Defines the runtime property key used to attach extra key/value metadata to an object\n * error report.\n *\n * **When to use**\n *\n * Use to attach domain metadata to object errors so reporter callbacks receive\n * it with the reported failure.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.attributes]` to a record of metadata that should be\n * forwarded to reporters alongside the error.\n *\n * **Example** (Setting error attributes)\n *\n * ```ts\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class PaymentError extends Data.TaggedError(\"PaymentError\")<{\n * readonly orderId: string\n * }> {\n * readonly [ErrorReporter.attributes] = {\n * orderId: this.orderId\n * }\n * }\n * ```\n *\n * @see {@link ignore} for suppressing reports for expected object errors\n * @see {@link severity} for overriding reporter severity\n * @see {@link getAttributes} for reading the metadata stored under this key\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const attributes = \"~effect/ErrorReporter/attributes\";\n/**\n * Reads the `ErrorReporter.attributes` annotation from an error object,\n * returning an empty record when unset.\n *\n * **When to use**\n *\n * Use to inspect the attributes that reporter callbacks will receive for an\n * object error.\n *\n * **Details**\n *\n * Returns the value stored under `ErrorReporter.attributes`, or the module's\n * shared empty record when the annotation is absent.\n *\n * **Gotchas**\n *\n * The annotation value is returned as-is; this helper does not validate or\n * clone it.\n *\n * @see {@link attributes} for the annotation key used to attach metadata\n * @see {@link Reportable} for the annotation properties recognized on object errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const getAttributes = error => {\n return attributes in error ? error[attributes] : emptyAttributes;\n};\nconst emptyAttributes = {};\n//# sourceMappingURL=ErrorReporter.js.map",
|
|
121
|
+
"/**\n * Effect-aware template literal rendering for HTTP response text.\n *\n * This module backs HTTP response helpers that accept template tags, especially\n * HTML responses assembled from plain values, optional values, effects, and\n * streams. It keeps template interpolation in the Effect type system so dynamic\n * fragments can contribute errors and service requirements to the final\n * response-producing program.\n *\n * **Mental model**\n *\n * `make` evaluates effectful interpolations and returns one complete string.\n * `stream` emits static template text together with effect and stream\n * interpolations as a `Stream`. Plain primitive values are converted to text,\n * arrays are concatenated without separators, and `Option.none`, `null`, and\n * `undefined` render as empty text.\n *\n * **Common tasks**\n *\n * Use `make` when the entire rendered body should be available before creating\n * the response. Use `stream` when a response can be emitted incrementally, for\n * example when part of an HTML page is produced by an existing stream.\n *\n * **Gotchas**\n *\n * Templates do not escape HTML, encode bytes, set content types, or compute\n * content lengths. Escape or encode untrusted values before interpolation and\n * choose the response constructor that matches the rendered body.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Stream from \"../../Stream.js\";\n/**\n * Creates an effectful string from a template literal.\n *\n * **Details**\n *\n * Primitive and `Option` interpolations are rendered immediately. Effect\n * interpolations are evaluated and rendered before the final string is produced.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function make(strings, ...args) {\n const argsLength = args.length;\n const values = new Array(argsLength);\n const effects = [];\n for (let i = 0; i < argsLength; i++) {\n const arg = args[i];\n if (Option.isOption(arg)) {\n values[i] = arg._tag === \"Some\" ? primitiveToString(arg.value) : \"\";\n } else if (isSuccess(arg)) {\n values[i] = primitiveToString(arg.value);\n } else if (Effect.isEffect(arg)) {\n effects.push([i, arg]);\n } else {\n values[i] = primitiveToString(arg);\n }\n }\n if (effects.length === 0) {\n return Effect.succeed(consolidate(strings, values));\n }\n return Effect.map(Effect.forEach(effects, ([index, effect]) => Effect.tap(effect, value => Effect.sync(() => {\n values[index] = primitiveToString(value);\n })), {\n concurrency: \"inherit\",\n discard: true\n }), _ => consolidate(strings, values));\n}\n/**\n * Creates a stream of strings from a template literal.\n *\n * **Details**\n *\n * Static text is emitted with interpolated values. Effect interpolations are\n * evaluated as stream chunks, and stream interpolations are flattened into the\n * output.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function stream(strings, ...args) {\n const chunks = [];\n let buffer = \"\";\n for (let i = 0, len = args.length; i < len; i++) {\n buffer += strings[i];\n const arg = args[i];\n if (Option.isOption(arg)) {\n buffer += arg._tag === \"Some\" ? primitiveToString(arg.value) : \"\";\n } else if (isSuccess(arg)) {\n buffer += primitiveToString(arg.value);\n } else if (Effect.isEffect(arg)) {\n if (buffer.length > 0) {\n chunks.push(buffer);\n buffer = \"\";\n }\n chunks.push(Effect.map(arg, primitiveToString));\n } else if (Stream.isStream(arg)) {\n if (buffer.length > 0) {\n chunks.push(buffer);\n buffer = \"\";\n }\n chunks.push(Stream.map(arg, primitiveToString));\n } else {\n buffer += primitiveToString(arg);\n }\n }\n buffer += strings[strings.length - 1];\n if (buffer.length > 0) {\n chunks.push(buffer);\n buffer = \"\";\n }\n return Stream.flatMap(Stream.fromIterable(chunks), chunk => typeof chunk === \"string\" ? Stream.succeed(chunk) : Effect.isEffect(chunk) ? Stream.fromEffect(chunk) : chunk, {\n concurrency: \"unbounded\"\n });\n}\nfunction primitiveToString(value) {\n if (Array.isArray(value)) {\n return value.map(primitiveToString).join(\"\");\n }\n switch (typeof value) {\n case \"string\":\n {\n return value;\n }\n case \"number\":\n case \"bigint\":\n {\n return value.toString();\n }\n case \"boolean\":\n {\n return value ? \"true\" : \"false\";\n }\n default:\n {\n return \"\";\n }\n }\n}\nfunction consolidate(strings, values) {\n let out = \"\";\n for (let i = 0, len = values.length; i < len; i++) {\n out += strings[i];\n out += values[i];\n }\n return out + strings[strings.length - 1];\n}\nfunction isSuccess(u) {\n return Exit.isExit(u) && u._tag === \"Success\";\n}\n//# sourceMappingURL=Template.js.map",
|
|
122
|
+
"/**\n * The `HttpServerResponse` module provides immutable response values for Effect\n * HTTP servers. Handlers return an {@link HttpServerResponse}, then the runtime\n * converts it to a platform response such as a Web `Response`.\n *\n * **Mental model**\n *\n * - A response is a status, optional status text, headers, cookies, and an HTTP\n * body.\n * - Constructors set practical defaults: {@link empty} uses `204`,\n * {@link redirect} uses `302`, and body constructors use `200`.\n * - Body metadata is reflected into headers when a response is created or when\n * the body is replaced.\n * - Cookies are stored separately from the normal header map and become\n * `Set-Cookie` headers during conversion.\n * - Constructors that encode data can return effects when encoding may fail.\n *\n * **Common tasks**\n *\n * - Create empty, redirect, text, HTML, JSON, or URL-encoded responses with\n * {@link empty}, {@link redirect}, {@link text}, {@link html}, {@link json},\n * {@link schemaJson}, or {@link urlParams}.\n * - Send binary, raw, form-data, stream, or file bodies with {@link uint8Array},\n * {@link raw}, {@link formData}, {@link stream}, {@link file}, or\n * {@link fileWeb}.\n * - Adjust status, headers, and bodies with {@link setStatus},\n * {@link setHeader}, {@link setHeaders}, and {@link setBody}.\n * - Manage cookies with {@link setCookie}, {@link expireCookie},\n * {@link removeCookie}, and their unsafe variants.\n * - Convert responses with {@link toWeb}, {@link fromWeb},\n * {@link toClientResponse}, and {@link fromClientResponse}.\n *\n * **Gotchas**\n *\n * - Body content type and content length override existing `content-type` and\n * `content-length` headers when body metadata is present.\n * - {@link json} and {@link schemaJson} capture encoding failures in the Effect\n * error channel; {@link jsonUnsafe} throws instead.\n * - {@link setCookie} and {@link expireCookie} validate cookie output in the\n * Effect error channel; unsafe cookie helpers throw on invalid cookies.\n * - `Set-Cookie` headers are produced from the response cookie collection, not\n * by manually editing the normal header map.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Body from \"./HttpBody.js\";\nimport * as HttpClientError from \"./HttpClientError.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as Template from \"./Template.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpServerResponse\";\n/**\n * Returns `true` when the supplied value is an `HttpServerResponse`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpServerResponse = u => hasProperty(u, TypeId);\n/**\n * Creates an empty HTTP response.\n *\n * **Details**\n *\n * The default status is `204`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = options => makeResponse({\n status: options?.status ?? 204,\n statusText: options?.statusText,\n headers: options?.headers ? Headers.fromInput(options.headers) : undefined,\n cookies: options?.cookies\n});\n/**\n * Creates a redirect response with a `Location` header.\n *\n * **Details**\n *\n * The default status is `302`; custom headers are merged with the generated\n * `Location` header.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redirect = (location, options) => {\n const headers = Headers.fromRecordUnsafe({\n location: location.toString()\n });\n return makeResponse({\n status: options?.status ?? 302,\n statusText: options?.statusText,\n headers: options?.headers ? Headers.merge(headers, Headers.fromInput(options.headers)) : headers,\n cookies: options?.cookies ?? Cookies.empty\n });\n};\n/**\n * Creates an HTTP response whose body is a `Uint8Array`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const uint8Array = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies ?? Cookies.empty,\n body: Body.uint8Array(body, getContentType(options, headers))\n });\n};\nconst getContentType = (options, headers) => {\n if (options?.contentType) {\n return options.contentType;\n } else if (options?.headers) {\n return headers[\"content-type\"];\n }\n};\n/**\n * Creates an HTTP response whose body is a string.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies ?? Cookies.empty,\n body: Body.text(body, getContentType(options, headers))\n });\n};\n/**\n * Creates an HTML response with the `text/html` content type.\n *\n * **Details**\n *\n * Passing a string returns a response directly. Using it as a template tag returns\n * an effect so interpolated values can be rendered with their required services\n * and errors.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const html = (strings, ...args) => {\n if (typeof strings === \"string\") {\n return text(strings, {\n contentType: \"text/html\"\n });\n }\n return Effect.map(Template.make(strings, ...args), _ => text(_, {\n contentType: \"text/html\"\n }));\n};\n/**\n * Creates a streaming HTML response from a template.\n *\n * **Details**\n *\n * The template is encoded as a byte stream and can use streaming interpolated\n * values from the current context.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const htmlStream = (strings, ...args) => Effect.map(Effect.context(), context => stream(Stream.provideContext(Stream.encodeText(Template.stream(strings, ...args)), context), {\n contentType: \"text/html\"\n}));\n/**\n * Creates a JSON HTTP response.\n *\n * **Details**\n *\n * The body is serialized with `JSON.stringify`; serialization errors are captured\n * as `HttpBodyError` failures.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const json = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return Effect.map(Body.json(body, getContentType(options, headers)), body => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body\n }));\n};\n/**\n * Creates a JSON response constructor backed by a schema encoder.\n *\n * **Details**\n *\n * The returned function encodes the value with the supplied schema before\n * serializing it as JSON, and can fail with `HttpBodyError` if schema encoding or\n * JSON serialization fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const encode = Body.jsonSchema(schema, options);\n return (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return Effect.map(encode(body, getContentType(options, headers)), body => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body\n }));\n };\n};\n/**\n * Creates a JSON HTTP response synchronously.\n *\n * **Gotchas**\n *\n * Unlike `json`, serialization errors from `JSON.stringify` are not captured in\n * `Effect`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonUnsafe = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.jsonUnsafe(body, getContentType(options, headers))\n });\n};\n/**\n * Creates a response from URL parameters using the\n * `application/x-www-form-urlencoded` content type by default.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const urlParams = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.text(UrlParams.toString(UrlParams.fromInput(body)), getContentType(options, headers) ?? \"application/x-www-form-urlencoded\")\n });\n};\n/**\n * Creates a response with a raw body value.\n *\n * **When to use**\n *\n * Use when the underlying runtime already understands the body value, such\n * as a Web `Response`, `Blob`, or `ReadableStream`; the body is passed through\n * for later platform conversion.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const raw = (body, options) => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers: options?.headers && Headers.fromInput(options.headers),\n cookies: options?.cookies,\n body: Body.raw(body, {\n contentType: options?.contentType,\n contentLength: options?.contentLength\n })\n});\n/**\n * Creates a response whose body is a Web `FormData` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formData = (body, options) => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers: options?.headers && Headers.fromInput(options.headers),\n cookies: options?.cookies,\n body: Body.formData(body)\n});\n/**\n * Creates a streaming response from a stream of byte chunks.\n *\n * **Details**\n *\n * Optional response metadata can supply the status, headers, content type, and\n * content length.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const stream = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.stream(body, getContentType(options, headers), options?.contentLength)\n });\n};\nconst HttpPlatformKey = /*#__PURE__*/Context.Service(\"effect/http/HttpPlatform\");\n/**\n * Creates a streamed file response for a file system path.\n *\n * **Details**\n *\n * The effect requires `HttpPlatform`, can fail with a platform error, and supports\n * options for status, headers, offset, and byte range.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (path, options) => Effect.flatMap(HttpPlatformKey, platform => platform.fileResponse(path, options));\n/**\n * Creates a streamed file response for a Web `File`-like value.\n *\n * **Details**\n *\n * The effect requires `HttpPlatform` and supports options for status, headers,\n * offset, and byte range.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileWeb = (file, options) => Effect.flatMap(HttpPlatformKey, platform => platform.fileWebResponse(file, options));\n/**\n * Returns a response with the specified header set to the supplied value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeader = /*#__PURE__*/dual(3, (self, key, value) => makeResponse({\n ...self,\n headers: Headers.set(self.headers, key, value)\n}));\n/**\n * Returns a response with all supplied headers set on the existing header map.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeaders = /*#__PURE__*/dual(2, (self, input) => makeResponse({\n ...self,\n headers: Headers.setAll(self.headers, input)\n}));\n/**\n * Returns a response with the cookie of the specified name removed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeCookie = /*#__PURE__*/dual(2, (self, name) => makeResponse({\n ...self,\n cookies: Cookies.remove(self.cookies, name)\n}));\n/**\n * Returns a response with its cookie collection replaced by the supplied cookies.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const replaceCookies = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies\n}));\n/**\n * Sets a cookie on the response.\n *\n * **Details**\n *\n * The effect fails with `CookiesError` if the cookie name, value, or options are\n * invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, value, options) => Effect.map(Effect.fromResult(Cookies.set(self.cookies, name, value, options)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets an expired cookie on an `HttpServerResponse`.\n *\n * **Details**\n *\n * Returns an effect because cookie encoding can fail. The original response is not\n * mutated; the effect succeeds with a response containing the updated cookie set.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, options) => Effect.map(Effect.fromResult(Cookies.expireCookie(self.cookies, name, options)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets a cookie on an `HttpServerResponse`, throwing if the cookie cannot be\n * encoded.\n *\n * **When to use**\n *\n * Use when setting one trusted cookie and encoding failures should throw\n * instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookieUnsafe = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, value, options) => makeResponse({\n ...self,\n cookies: Cookies.setUnsafe(self.cookies, name, value, options)\n}));\n/**\n * Sets an expired cookie on an `HttpServerResponse`, throwing if the expiration cookie\n * cannot be encoded.\n *\n * **When to use**\n *\n * Use when expiring one trusted cookie and encoding failures should throw\n * instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, options) => makeResponse({\n ...self,\n cookies: Cookies.expireCookieUnsafe(self.cookies, name, options)\n}));\n/**\n * Updates the cookies attached to an `HttpServerResponse` using the supplied\n * function.\n *\n * **Details**\n *\n * The original response is not mutated; a new response is returned with the\n * callback result as its cookie collection.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateCookies = /*#__PURE__*/dual(2, (self, f) => makeResponse({\n ...self,\n cookies: f(self.cookies)\n}));\n/**\n * Merges additional cookies into the cookies attached to an\n * `HttpServerResponse`.\n *\n * **Details**\n *\n * The original response is not mutated; a new response is returned with the merged\n * cookie collection.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mergeCookies = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies: Cookies.merge(self.cookies, cookies)\n}));\n/**\n * Sets multiple cookies on an `HttpServerResponse`.\n *\n * **Details**\n *\n * Each input entry contains a cookie name, value, and optional cookie options. The\n * returned effect fails with `CookiesError` if any cookie cannot be encoded.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookies = /*#__PURE__*/dual(2, (self, cookies) => Effect.map(Effect.fromResult(Cookies.setAll(self.cookies, cookies)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets multiple cookies on an `HttpServerResponse`, throwing if any cookie cannot\n * be encoded.\n *\n * **When to use**\n *\n * Use when setting multiple trusted cookies and encoding failures should throw\n * instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookiesUnsafe = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies: Cookies.setAllUnsafe(self.cookies, cookies)\n}));\n/**\n * Replaces the body of an `HttpServerResponse`.\n *\n * **Details**\n *\n * When the body carries a content type or content length, the returned response\n * includes the corresponding headers.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setBody = /*#__PURE__*/dual(2, (self, body) => makeResponse({\n ...self,\n body\n}));\n/**\n * Sets the HTTP status code of an `HttpServerResponse`.\n *\n * **Details**\n *\n * When `statusText` is omitted, the existing status text is preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setStatus = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, status, statusText) => makeResponse({\n ...self,\n status,\n statusText: statusText ?? self.statusText\n}));\n/**\n * Converts an `HttpServerResponse` to a Web `Response`.\n *\n * **Details**\n *\n * Cookies are appended as `Set-Cookie` headers. Stream bodies are converted using\n * the supplied context, and `withoutBody` can be used for responses such as HEAD\n * responses.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (response, options) => {\n const headers = new globalThis.Headers(response.headers);\n if (!Cookies.isEmpty(response.cookies)) {\n const toAdd = Cookies.toSetCookieHeaders(response.cookies);\n for (const header of toAdd) {\n headers.append(\"set-cookie\", header);\n }\n }\n if (options?.withoutBody) {\n return new Response(undefined, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n const body = response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return new Response(undefined, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"Uint8Array\":\n case \"Raw\":\n {\n if (body.body instanceof Response) {\n for (const [key, value] of headers) {\n body.body.headers.set(key, value);\n }\n return body.body;\n }\n return new Response(body.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"FormData\":\n {\n return new Response(body.formData, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"Stream\":\n {\n return new Response(Stream.toReadableStreamWith(body.stream, options?.context ?? Context.empty()), {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n }\n};\n/**\n * Wraps an `HttpServerResponse` as an `HttpClientResponse`.\n *\n * **Details**\n *\n * An optional request can be supplied for client-response metadata and decode\n * errors.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toClientResponse = (response, options) => new ServerHttpClientResponse(options?.request ?? HttpClientRequest.empty, response);\nclass ServerHttpClientResponse extends Inspectable.Class {\n [HttpIncomingMessage.TypeId];\n [HttpClientResponse.TypeId];\n request;\n response;\n constructor(request, response) {\n super();\n this.request = request;\n this.response = response;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this[HttpClientResponse.TypeId] = HttpClientResponse.TypeId;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpClientResponse\",\n request: this.request.toJSON(),\n status: this.status\n });\n }\n get status() {\n return this.response.status;\n }\n cachedHeaders;\n get headers() {\n return this.cachedHeaders ??= this.response.body._tag === \"FormData\" ? Headers.merge(this.response.headers, Headers.fromInput(this.getFormDataResponse().headers)) : this.response.headers;\n }\n get cookies() {\n return this.response.cookies;\n }\n get remoteAddress() {\n return Option.none();\n }\n get stream() {\n const body = this.response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Stream.empty;\n }\n case \"Stream\":\n {\n return Stream.mapError(body.stream, cause => this.decodeError(cause));\n }\n case \"Uint8Array\":\n {\n return Stream.succeed(body.body);\n }\n case \"Raw\":\n {\n const rawBody = body.body;\n if (rawBody instanceof Response) {\n return rawBody.body ? Stream.fromReadableStream({\n evaluate: () => rawBody.body,\n onError: cause => this.decodeError(cause)\n }) : Stream.empty;\n }\n if (isReadableStream(rawBody)) {\n return Stream.fromReadableStream({\n evaluate: () => rawBody,\n onError: cause => this.decodeError(cause)\n });\n }\n if (rawBody instanceof Blob) {\n return Stream.fromReadableStream({\n evaluate: () => rawBody.stream(),\n onError: cause => this.decodeError(cause)\n });\n }\n return Stream.unwrap(Effect.map(this.bytes, Stream.succeed));\n }\n case \"FormData\":\n {\n const response = this.getFormDataResponse();\n return Stream.fromReadableStream({\n evaluate: () => response.body,\n onError: cause => this.decodeError(cause)\n });\n }\n }\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n get bytes() {\n const body = this.response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Effect.succeed(new Uint8Array(0));\n }\n case \"Uint8Array\":\n {\n return Effect.succeed(body.body);\n }\n case \"Stream\":\n {\n return Stream.mkUint8Array(this.stream);\n }\n case \"Raw\":\n {\n const rawBody = body.body;\n if (rawBody instanceof Response) {\n return Effect.tryPromise({\n try: () => rawBody.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n return Effect.tryPromise({\n try: () => new Response(rawBody).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n case \"FormData\":\n {\n return Effect.tryPromise({\n try: () => new Response(body.formData).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n }\n }\n get text() {\n return Effect.map(this.bytes, bytes => textDecoder.decode(bytes));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n get formData() {\n const body = this.response.body;\n if (body._tag === \"FormData\") {\n return Effect.succeed(body.formData);\n }\n return Effect.contextWith(context => {\n const readableStream = Stream.toReadableStreamWith(this.stream, context);\n return Effect.tryPromise({\n try: () => new Response(readableStream, {\n headers: this.headers\n }).formData(),\n catch: cause => this.decodeError(cause)\n });\n });\n }\n get arrayBuffer() {\n return Effect.map(this.bytes, bytes => bytes.slice().buffer);\n }\n decodeError(cause) {\n return new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n });\n }\n formDataResponse;\n getFormDataResponse() {\n return this.formDataResponse ??= new Response(this.response.body.formData);\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\nconst textDecoder = /*#__PURE__*/new TextDecoder();\n/**\n * Converts an `HttpClientResponse` to an `HttpServerResponse`.\n *\n * **Details**\n *\n * The response body is streamed from the client response. `Set-Cookie` headers are\n * removed from the header map and represented in the response cookie collection.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromClientResponse = response => {\n const headers = Headers.remove(response.headers, \"set-cookie\");\n return makeResponse({\n status: response.status,\n headers,\n cookies: response.cookies,\n body: Body.stream(Stream.catchIf(response.stream, isEmptyBodyError, () => Stream.empty), Option.getOrUndefined(Headers.get(headers, \"content-type\")), getContentLength(headers))\n });\n};\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\nconst isEmptyBodyError = error => HttpClientError.isHttpClientError(error) && error.reason._tag === \"EmptyBodyError\";\nconst getContentLength = headers => {\n const contentLength = Option.getOrUndefined(Headers.get(headers, \"content-length\"));\n if (contentLength === undefined) {\n return undefined;\n }\n const parsed = Number(contentLength);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;\n};\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [ErrorReporter.ignore]: true,\n toJSON() {\n return {\n _id: \"HttpServerResponse\",\n status: this.status,\n statusText: this.statusText,\n headers: redact(this.headers),\n cookies: this.cookies.toJSON(),\n body: this.body.toJSON()\n };\n }\n};\nconst makeResponse = options => {\n const self = Object.create(Proto);\n self.status = options.status;\n self.statusText = options.statusText;\n self.cookies = options.cookies ?? Cookies.empty;\n self.body = options.body ?? Body.empty;\n if (self.body._tag !== \"Empty\" && (self.body.contentType || self.body.contentLength)) {\n const newHeaders = Headers.fromRecordUnsafe({\n ...options.headers\n });\n if (self.body.contentType) {\n newHeaders[\"content-type\"] = self.body.contentType;\n }\n if (self.body.contentLength) {\n newHeaders[\"content-length\"] = self.body.contentLength.toString();\n }\n self.headers = newHeaders;\n } else {\n self.headers = options.headers ?? Headers.empty;\n }\n return self;\n};\n/**\n * Converts a Web `Response` to an `HttpServerResponse`.\n *\n * **Details**\n *\n * `Set-Cookie` headers are parsed into the response cookie collection and removed\n * from the header map. A present Web body is exposed as a stream body.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = response => {\n const headers = new globalThis.Headers(response.headers);\n const setCookieHeaders = headers.getSetCookie();\n headers.delete(\"set-cookie\");\n let self = empty({\n status: response.status,\n statusText: response.statusText,\n headers: headers,\n cookies: Cookies.fromSetCookie(setCookieHeaders)\n });\n if (response.body) {\n const contentType = response.headers.get(\"content-type\");\n self = setBody(self, Body.stream(Stream.fromReadableStream({\n evaluate: () => response.body,\n onError: e => e\n }), contentType ?? undefined));\n }\n return self;\n};\n//# sourceMappingURL=HttpServerResponse.js.map",
|
|
123
|
+
"/**\n * Platform-specific support for serving files as HTTP server responses.\n *\n * `HttpPlatform` is the boundary between the portable HTTP response model and\n * the runtime that knows how to stream bytes from the host platform. Server\n * code uses this service when it needs to return local files, static assets,\n * downloads, byte ranges, or Web `File`-like values without constructing the\n * response body by hand.\n *\n * The helpers in this module enrich those responses with file metadata such as\n * `etag`, `last-modified`, and content length where available. Path-based\n * responses require `FileSystem` and can fail with `PlatformError` while\n * inspecting or streaming the file; `File`-like responses use the Web\n * `ReadableStream` and `lastModified` metadata exposed by the value.\n *\n * Provide `layer` when the default streaming implementation is suitable, or\n * use `make` to plug in a runtime-specific response constructor. The default\n * layer supplies weak ETag generation itself, but the surrounding runtime still\n * needs to provide the `FileSystem` service and run the resulting\n * `HttpServerResponse` on an HTTP server adapter that understands Effect\n * streams.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { identity } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Etag from \"./Etag.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Response from \"./HttpServerResponse.js\";\n/**\n * Service for platform-specific HTTP response helpers, including file-backed server responses.\n *\n * @category services\n * @since 4.0.0\n */\nexport class HttpPlatform extends /*#__PURE__*/Context.Service()(\"effect/http/HttpPlatform\") {}\n/**\n * Creates an `HttpPlatform` service from platform-specific file response constructors, using `FileSystem` and `Etag.Generator`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.fnUntraced(function* (impl) {\n const fs = yield* FileSystem.FileSystem;\n const etagGen = yield* Etag.Generator;\n return HttpPlatform.of({\n fileResponse: Effect.fnUntraced(function* (path, options) {\n const info = yield* fs.stat(path);\n const etag = yield* etagGen.fromFileInfo(info);\n const start = Number(options?.offset ?? 0);\n const end = options?.bytesToRead !== undefined ? start + Number(options.bytesToRead) : undefined;\n const headers = Headers.set(options?.headers ? Headers.fromInput(options.headers) : Headers.empty, \"etag\", Etag.toString(etag));\n if (Option.isSome(info.mtime)) {\n ;\n headers[\"last-modified\"] = info.mtime.value.toUTCString();\n }\n const contentLength = end !== undefined ? end - start : Number(info.size) - start;\n return impl.fileResponse(path, options?.status ?? 200, options?.statusText, headers, start, end, contentLength);\n }),\n fileWebResponse(file, options) {\n return Effect.map(etagGen.fromFileWeb(file), etag => {\n const headers = Headers.merge(options?.headers ? Headers.fromInput(options.headers) : Headers.empty, Headers.fromRecordUnsafe({\n etag: Etag.toString(etag),\n \"last-modified\": new Date(file.lastModified).toUTCString()\n }));\n return impl.fileWebResponse(file, options?.status ?? 200, options?.statusText, headers, options);\n });\n }\n });\n});\n/**\n * Provides the default `HttpPlatform` implementation for serving file paths and\n * `File`-like values as streamed HTTP responses.\n *\n * **Details**\n *\n * The layer uses the `FileSystem` and weak ETag services to add file metadata\n * headers such as `etag` and `last-modified`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(HttpPlatform)(Effect.flatMap(FileSystem.FileSystem, fs => make({\n fileResponse(path, status, statusText, headers, start, end, contentLength) {\n return Response.stream(fs.stream(path, {\n offset: start,\n bytesToRead: end !== undefined ? end - start : undefined\n }), {\n contentLength,\n headers,\n status,\n statusText\n });\n },\n fileWebResponse(file, status, statusText, headers, _options) {\n return Response.stream(Stream.fromReadableStream({\n evaluate: () => file.stream(),\n onError: identity\n }), {\n headers,\n status,\n statusText\n });\n }\n}))).pipe(/*#__PURE__*/Layer.provide(Etag.layerWeak));\n//# sourceMappingURL=HttpPlatform.js.map",
|
|
124
|
+
"/**\n * Runtime boundary for serving Effect HTTP responses on a concrete HTTP server.\n *\n * `HttpServer` is the service implemented by platform adapters and consumed by\n * routers, API layers, tests, and applications that start serving from a\n * `Layer`. It exposes the listening address and a `serve` operation that runs\n * an `HttpServerResponse` effect for each incoming request.\n *\n * **Mental model**\n *\n * The server owns the listener and supplies `HttpServerRequest` for every\n * request. The application effect only describes how to produce a response, so\n * request-scoped data comes from the server while the rest of the environment is\n * still provided by the surrounding layer graph. `serve` ties listener lifetime\n * to a layer scope, and `serveEffect` performs the same work inside an explicit\n * `Scope`.\n *\n * **Common tasks**\n *\n * - Build a server service from a platform adapter with `make`.\n * - Serve an HTTP app with `serve` or `serveEffect`.\n * - Format or log the listening address with `formatAddress`,\n * `addressFormattedWith`, `logAddress`, or `withLogAddress`.\n * - Create a test client that targets the running server with `makeTestClient`\n * or `layerTestClient`.\n *\n * **Gotchas**\n *\n * Middleware is applied at the server boundary, after the server has supplied\n * the request service. Test clients only support TCP addresses, and rewrite\n * `0.0.0.0` to `127.0.0.1` for local requests.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Etag from \"./Etag.js\";\nimport * as HttpClient from \"./HttpClient.js\";\nimport * as ClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpPlatform from \"./HttpPlatform.js\";\n/**\n * Service tag for an HTTP server runtime.\n *\n * **Details**\n *\n * The service can serve an HTTP response effect and exposes the address where the\n * server is listening.\n *\n * @category models\n * @since 4.0.0\n */\nexport class HttpServer extends /*#__PURE__*/Context.Service()(\"effect/http/HttpServer\") {}\n/**\n * Constructs an `HttpServer` service from a serving implementation and listening\n * address.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => options;\n/**\n * Creates a layer that starts serving an HTTP response effect with the current\n * `HttpServer`.\n *\n * **Details**\n *\n * The request service is supplied by the server for each request; the returned\n * layer still requires the server, a scope, and any non-request dependencies of\n * the response effect or middleware.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const serve = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (effect, middleware) => Layer.effectDiscard(HttpServer.use(server => server.serve(effect, middleware))));\n/**\n * Effect that starts serving an HTTP response effect with the current\n * `HttpServer`.\n *\n * **Details**\n *\n * The request service is supplied by the server for each request; the effect\n * requires a scope and any non-request dependencies of the response effect or\n * middleware.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const serveEffect = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (effect, middleware) => HttpServer.use(server => server.serve(effect, middleware)));\n/**\n * Formats a server address as a display string.\n *\n * **Details**\n *\n * TCP addresses are formatted as `http://host:port`; Unix socket addresses are\n * formatted as `unix://path`.\n *\n * @category address\n * @since 4.0.0\n */\nexport const formatAddress = address => {\n switch (address._tag) {\n case \"UnixAddress\":\n return `unix://${address.path}`;\n case \"TcpAddress\":\n return `http://${address.hostname}:${address.port}`;\n }\n};\n/**\n * Reads the current server address, formats it with `formatAddress`, and passes\n * the formatted address to the supplied effectful function.\n *\n * @category address\n * @since 4.0.0\n */\nexport const addressFormattedWith = f => Effect.flatMap(HttpServer, server => f(formatAddress(server.address)));\n/**\n * Logs the formatted address of the current HTTP server.\n *\n * @category address\n * @since 4.0.0\n */\nexport const logAddress = /*#__PURE__*/addressFormattedWith(_ => Effect.log(`Listening on ${_}`));\n/**\n * Adds address logging to a layer that provides an `HttpServer`.\n *\n * @category address\n * @since 4.0.0\n */\nexport const withLogAddress = layer => Layer.effectDiscard(logAddress).pipe(Layer.provideMerge(layer));\n/**\n * Builds an `HttpClient` that sends requests to the current test HTTP server.\n *\n * **Details**\n *\n * For TCP servers, requests are prefixed with the server URL and `0.0.0.0` is\n * rewritten to `127.0.0.1`.\n *\n * **Gotchas**\n *\n * Unix socket addresses are not supported.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const makeTestClient = /*#__PURE__*/Effect.gen(function* () {\n const server = yield* HttpServer;\n const client = yield* HttpClient.HttpClient;\n const address = server.address;\n if (address._tag === \"UnixAddress\") {\n return yield* Effect.die(new Error(\"HttpServer.layerTestClient: UnixAddress not supported\"));\n }\n const host = address.hostname === \"0.0.0.0\" ? \"127.0.0.1\" : address.hostname;\n const url = `http://${host}:${address.port}`;\n return HttpClient.mapRequest(client, ClientRequest.prependUrl(url));\n});\n/**\n * Layer that provides the test `HttpClient` created by `makeTestClient`.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const layerTestClient = /*#__PURE__*/Layer.effect(HttpClient.HttpClient)(makeTestClient);\n/**\n * Layer that provides the platform services commonly needed by HTTP\n * server tests.\n *\n * **Details**\n *\n * It includes `HttpPlatform`, `Path`, a weak ETag generator, and a no-op\n * `FileSystem`.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const layerServices = /*#__PURE__*/Layer.mergeAll(HttpPlatform.layer, Path.layer, Etag.layerWeak).pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/FileSystem.layerNoop({})));\n//# sourceMappingURL=HttpServer.js.map",
|
|
125
|
+
"/**\n * @since 1.0.0\n */\n// Taken from https://github.com/anonrig/fast-querystring under MIT License\nconst plusRegex = /\\+/g;\nconst Empty = function () {};\nEmpty.prototype = /*#__PURE__*/Object.create(null);\n/**\n * @category parsing\n * @since 1.0.0\n */\nexport function parse(input) {\n // Optimization: Use new Empty() instead of Object.create(null) for performance\n // v8 has a better optimization for initializing functions compared to Object\n const result = new Empty();\n if (typeof input !== \"string\") {\n return result;\n }\n const inputLength = input.length;\n let key = \"\";\n let value = \"\";\n let startingIndex = -1;\n let equalityIndex = -1;\n let shouldDecodeKey = false;\n let shouldDecodeValue = false;\n let keyHasPlus = false;\n let valueHasPlus = false;\n let hasBothKeyValuePair = false;\n let c = 0;\n // Have a boundary of input.length + 1 to access last pair inside the loop.\n for (let i = 0; i < inputLength + 1; i++) {\n c = i !== inputLength ? input.charCodeAt(i) : 38;\n // Handle '&' and end of line to pass the current values to result\n if (c === 38) {\n hasBothKeyValuePair = equalityIndex > startingIndex;\n // Optimization: Reuse equality index to store the end of key\n if (!hasBothKeyValuePair) {\n equalityIndex = i;\n }\n key = input.slice(startingIndex + 1, equalityIndex);\n // Add key/value pair only if the range size is greater than 1; a.k.a. contains at least \"=\"\n if (hasBothKeyValuePair || key.length > 0) {\n // Optimization: Replace '+' with space\n if (keyHasPlus) {\n key = key.replace(plusRegex, \" \");\n }\n // Optimization: Do not decode if it's not necessary.\n if (shouldDecodeKey) {\n try {\n key = decodeURIComponent(key) || key;\n } catch {}\n }\n if (hasBothKeyValuePair) {\n value = input.slice(equalityIndex + 1, i);\n if (valueHasPlus) {\n value = value.replace(plusRegex, \" \");\n }\n if (shouldDecodeValue) {\n try {\n value = decodeURIComponent(value) || value;\n } catch {}\n }\n }\n const currentValue = result[key];\n if (currentValue === undefined) {\n result[key] = value;\n } else {\n // Optimization: value.pop is faster than Array.isArray(value)\n if (currentValue.pop) {\n currentValue.push(value);\n } else {\n result[key] = [currentValue, value];\n }\n }\n }\n // Reset reading key value pairs\n value = \"\";\n startingIndex = i;\n equalityIndex = i;\n shouldDecodeKey = false;\n shouldDecodeValue = false;\n keyHasPlus = false;\n valueHasPlus = false;\n }\n // Check '='\n else if (c === 61) {\n if (equalityIndex <= startingIndex) {\n equalityIndex = i;\n }\n // If '=' character occurs again, we should decode the input.\n else {\n shouldDecodeValue = true;\n }\n }\n // Check '+', and remember to replace it with empty space.\n else if (c === 43) {\n if (equalityIndex > startingIndex) {\n valueHasPlus = true;\n } else {\n keyHasPlus = true;\n }\n }\n // Check '%' character for encoding\n else if (c === 37) {\n if (equalityIndex > startingIndex) {\n shouldDecodeValue = true;\n } else {\n shouldDecodeKey = true;\n }\n }\n }\n return result;\n}\nfunction getAsPrimitive(value) {\n const type = typeof value;\n if (type === \"string\") {\n // Length check is handled inside encodeString function\n return encodeString(value);\n } else if (type === \"bigint\" || type === \"boolean\") {\n return \"\" + value;\n } else if (type === \"number\" && Number.isFinite(value)) {\n return value < 1e21 ? \"\" + value : encodeString(\"\" + value);\n }\n return \"\";\n}\n/**\n * @category encoding\n * @since 1.0.0\n */\nexport function stringify(input) {\n let result = \"\";\n if (input === null || typeof input !== \"object\") {\n return result;\n }\n const separator = \"&\";\n const keys = Object.keys(input);\n const keyLength = keys.length;\n let valueLength = 0;\n for (let i = 0; i < keyLength; i++) {\n const key = keys[i];\n const value = input[key];\n const encodedKey = encodeString(key) + \"=\";\n if (i) {\n result += separator;\n }\n if (Array.isArray(value)) {\n valueLength = value.length;\n for (let j = 0; j < valueLength; j++) {\n if (j) {\n result += separator;\n }\n // Optimization: Dividing into multiple lines improves the performance.\n // Since v8 does not need to care about the '+' character if it was one-liner.\n result += encodedKey;\n result += getAsPrimitive(value[j]);\n }\n } else {\n result += encodedKey;\n result += getAsPrimitive(value);\n }\n }\n return result;\n}\n// -----------------------------------------------------------------------------\n// This has been taken from Node.js project.\n// Full implementation can be found from https://github.com/nodejs/node/blob/main/lib/internal/querystring.js\nconst hexTable = /*#__PURE__*/Array.from({\n length: 256\n}, (_, i) => \"%\" + ((i < 16 ? \"0\" : \"\") + i.toString(16)).toUpperCase());\n// These characters do not need escaping when generating query strings:\n// ! - . _ ~\n// ' ( ) *\n// digits\n// alpha (uppercase)\n// alpha (lowercase)\n// biome-ignore format: the array should not be formatted\nconst noEscape = /*#__PURE__*/new Int8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n// 0 - 15\n0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n// 16 - 31\n0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0,\n// 32 - 47\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,\n// 48 - 63\n0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n// 64 - 79\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,\n// 80 - 95\n0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n// 96 - 111\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 // 112 - 127\n]);\nfunction encodeString(str) {\n const len = str.length;\n if (len === 0) return \"\";\n let out = \"\";\n let lastPos = 0;\n let i = 0;\n outer: for (; i < len; i++) {\n let c = str.charCodeAt(i);\n // ASCII\n while (c < 0x80) {\n if (noEscape[c] !== 1) {\n if (lastPos < i) out += str.slice(lastPos, i);\n lastPos = i + 1;\n out += hexTable[c];\n }\n if (++i === len) break outer;\n c = str.charCodeAt(i);\n }\n if (lastPos < i) out += str.slice(lastPos, i);\n // Multi-byte characters ...\n if (c < 0x800) {\n lastPos = i + 1;\n out += hexTable[0xc0 | c >> 6] + hexTable[0x80 | c & 0x3f];\n continue;\n }\n if (c < 0xd800 || c >= 0xe000) {\n lastPos = i + 1;\n out += hexTable[0xe0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3f] + hexTable[0x80 | c & 0x3f];\n continue;\n }\n // Surrogate pair\n ++i;\n // This branch should never happen because all URLSearchParams entries\n // should already be converted to USVString. But, included for\n // completion's sake anyway.\n if (i >= len) {\n throw new Error(\"URI malformed\");\n }\n const c2 = str.charCodeAt(i) & 0x3ff;\n lastPos = i + 1;\n c = 0x10000 + ((c & 0x3ff) << 10 | c2);\n out += hexTable[0xf0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3f] + hexTable[0x80 | c >> 6 & 0x3f] + hexTable[0x80 | c & 0x3f];\n }\n if (lastPos === 0) return str;\n if (lastPos < len) return out + str.slice(lastPos);\n return out;\n}\n//# sourceMappingURL=QueryString.js.map",
|
|
126
|
+
"import * as QS from \"../QueryString.js\";\nconst FULL_PATH_REGEXP = /^https?:\\/\\/.*?\\//;\nconst OPTIONAL_PARAM_REGEXP = /(\\/:[^/()]*?)\\?(\\/?)/;\n/** @internal */\nexport const make = (options = {}) => new RouterImpl(options);\nclass RouterImpl {\n constructor(options = {}) {\n this.options = {\n ignoreTrailingSlash: true,\n ignoreDuplicateSlashes: true,\n caseSensitive: false,\n maxParamLength: 100,\n ...options\n };\n }\n options;\n routes = [];\n trees = {};\n on(method, path, handler) {\n const optionalParamMatch = path.match(OPTIONAL_PARAM_REGEXP);\n if (optionalParamMatch && optionalParamMatch.index !== undefined) {\n assert(path.length === optionalParamMatch.index + optionalParamMatch[0].length, \"Optional Parameter needs to be the last parameter of the path\");\n const pathFull = path.replace(OPTIONAL_PARAM_REGEXP, \"$1$2\");\n const pathOptional = path.replace(OPTIONAL_PARAM_REGEXP, \"$2\");\n this.on(method, pathFull, handler);\n this.on(method, pathOptional, handler);\n return;\n }\n if (this.options.ignoreDuplicateSlashes) {\n path = removeDuplicateSlashes(path);\n }\n if (this.options.ignoreTrailingSlash) {\n path = trimLastSlash(path);\n }\n const methods = typeof method === \"string\" ? [method] : method;\n for (const method of methods) {\n this._on(method, path, handler);\n }\n }\n all(path, handler) {\n this.on(httpMethods, path, handler);\n }\n _on(method, path, handler) {\n if (this.trees[method] === undefined) {\n this.trees[method] = new StaticNode(\"/\");\n }\n let pattern = path;\n if (pattern === \"*\" && this.trees[method].prefix.length !== 0) {\n const currentRoot = this.trees[method];\n this.trees[method] = new StaticNode(\"\");\n this.trees[method].staticChildren[\"/\"] = currentRoot;\n }\n let parentNodePathIndex = this.trees[method].prefix.length;\n let currentNode = this.trees[method];\n const params = [];\n for (let i = 0; i <= pattern.length; i++) {\n if (pattern.charCodeAt(i) === 58 && pattern.charCodeAt(i + 1) === 58) {\n // It's a double colon\n i++;\n continue;\n }\n const isParametricNode = pattern.charCodeAt(i) === 58 && pattern.charCodeAt(i + 1) !== 58;\n const isWildcardNode = pattern.charCodeAt(i) === 42;\n if (isParametricNode || isWildcardNode || i === pattern.length && i !== parentNodePathIndex) {\n let staticNodePath = pattern.slice(parentNodePathIndex, i);\n if (!this.options.caseSensitive) {\n staticNodePath = staticNodePath.toLowerCase();\n }\n staticNodePath = staticNodePath.split(\"::\").join(\":\");\n staticNodePath = staticNodePath.split(\"%\").join(\"%25\");\n // add the static part of the route to the tree\n currentNode = currentNode.createStaticChild(staticNodePath);\n }\n if (isParametricNode) {\n let isRegexNode = false;\n const regexps = [];\n let lastParamStartIndex = i + 1;\n for (let j = lastParamStartIndex;; j++) {\n const charCode = pattern.charCodeAt(j);\n const isRegexParam = charCode === 40;\n const isStaticPart = charCode === 45 || charCode === 46;\n const isEndOfNode = charCode === 47 || j === pattern.length;\n if (isRegexParam || isStaticPart || isEndOfNode) {\n const paramName = pattern.slice(lastParamStartIndex, j);\n params.push(paramName);\n isRegexNode = isRegexNode || isRegexParam || isStaticPart;\n if (isRegexParam) {\n const endOfRegexIndex = getClosingParenthensePosition(pattern, j);\n const regexString = pattern.slice(j, endOfRegexIndex + 1);\n regexps.push(trimRegExpStartAndEnd(regexString));\n j = endOfRegexIndex + 1;\n } else {\n regexps.push(\"(.*?)\");\n }\n const staticPartStartIndex = j;\n for (; j < pattern.length; j++) {\n const charCode = pattern.charCodeAt(j);\n if (charCode === 47) break;\n if (charCode === 58) {\n const nextCharCode = pattern.charCodeAt(j + 1);\n if (nextCharCode === 58) j++;else break;\n }\n }\n let staticPart = pattern.slice(staticPartStartIndex, j);\n if (staticPart) {\n staticPart = staticPart.split(\"::\").join(\":\");\n staticPart = staticPart.split(\"%\").join(\"%25\");\n regexps.push(escapeRegExp(staticPart));\n }\n lastParamStartIndex = j + 1;\n if (isEndOfNode || pattern.charCodeAt(j) === 47 || j === pattern.length) {\n const nodePattern = isRegexNode ? \"()\" + staticPart : staticPart;\n const nodePath = pattern.slice(i, j);\n pattern = pattern.slice(0, i + 1) + nodePattern + pattern.slice(j);\n i += nodePattern.length;\n const regex = isRegexNode ? new RegExp(\"^\" + regexps.join(\"\") + \"$\") : undefined;\n currentNode = currentNode.createParametricChild(regex, staticPart, nodePath);\n parentNodePathIndex = i + 1;\n break;\n }\n }\n }\n } else if (isWildcardNode) {\n // add the wildcard parameter\n params.push(\"*\");\n currentNode = currentNode.createWildcardChild();\n parentNodePathIndex = i + 1;\n if (i !== pattern.length - 1) {\n throw new Error(\"Wildcard must be the last character in the route\");\n }\n }\n }\n if (!this.options.caseSensitive) {\n pattern = pattern.toLowerCase();\n }\n if (pattern === \"*\") {\n pattern = \"/*\";\n }\n for (const existRoute of this.routes) {\n if (existRoute.method === method && existRoute.pattern === pattern) {\n throw new Error(`Method '${method}' already declared for route '${pattern}'`);\n }\n }\n const route = {\n method,\n path,\n pattern,\n params,\n handler\n };\n this.routes.push(route);\n currentNode.addRoute(route);\n }\n has(method, path) {\n const node = this.trees[method];\n if (node === undefined) {\n return false;\n }\n const staticNode = node.getStaticChild(path);\n if (staticNode === undefined) {\n return false;\n }\n return staticNode.isLeafNode;\n }\n find(method, path) {\n let currentNode = this.trees[method];\n if (currentNode === undefined) return undefined;\n if (path.charCodeAt(0) !== 47) {\n // 47 is '/'\n path = path.replace(FULL_PATH_REGEXP, \"/\");\n }\n // This must be run before sanitizeUrl as the resulting function\n // .sliceParameter must be constructed with same URL string used\n // throughout the rest of this function.\n if (this.options.ignoreDuplicateSlashes) {\n path = removeDuplicateSlashes(path);\n }\n let sanitizedUrl;\n let querystring;\n let shouldDecodeParam;\n try {\n sanitizedUrl = safeDecodeURI(path);\n path = sanitizedUrl.path;\n querystring = sanitizedUrl.querystring;\n shouldDecodeParam = sanitizedUrl.shouldDecodeParam;\n } catch (error) {\n return undefined;\n }\n if (this.options.ignoreTrailingSlash) {\n path = trimLastSlash(path);\n }\n const originPath = path;\n if (this.options.caseSensitive === false) {\n path = path.toLowerCase();\n }\n const maxParamLength = this.options.maxParamLength;\n let pathIndex = currentNode.prefix.length;\n const params = [];\n const pathLen = path.length;\n const brothersNodesStack = [];\n while (true) {\n if (pathIndex === pathLen && currentNode.isLeafNode) {\n const handle = currentNode.handlerStorage?.find();\n if (handle !== undefined) {\n return {\n handler: handle.handler,\n params: handle.createParams(params),\n searchParams: QS.parse(querystring)\n };\n }\n }\n let node = currentNode.getNextNode(path, pathIndex, brothersNodesStack, params.length);\n if (node === undefined) {\n if (brothersNodesStack.length === 0) {\n return undefined;\n }\n const brotherNodeState = brothersNodesStack.pop();\n pathIndex = brotherNodeState.brotherPathIndex;\n params.splice(brotherNodeState.paramsCount);\n node = brotherNodeState.brotherNode;\n }\n currentNode = node;\n // static route\n if (currentNode._tag === \"StaticNode\") {\n pathIndex += currentNode.prefix.length;\n continue;\n }\n if (currentNode._tag === \"WildcardNode\") {\n let param = originPath.slice(pathIndex);\n if (shouldDecodeParam) {\n param = safeDecodeURIComponent(param);\n }\n params.push(param);\n pathIndex = pathLen;\n continue;\n }\n if (currentNode._tag === \"ParametricNode\") {\n let paramEndIndex = originPath.indexOf(\"/\", pathIndex);\n if (paramEndIndex === -1) {\n paramEndIndex = pathLen;\n }\n let param = originPath.slice(pathIndex, paramEndIndex);\n if (shouldDecodeParam) {\n param = safeDecodeURIComponent(param);\n }\n if (currentNode.regex !== undefined) {\n const matchedParameters = currentNode.regex.exec(param);\n if (matchedParameters === null) continue;\n for (let i = 1; i < matchedParameters.length; i++) {\n const matchedParam = matchedParameters[i];\n if (matchedParam.length > maxParamLength) {\n return undefined;\n }\n params.push(matchedParam);\n }\n } else {\n if (param.length > maxParamLength) {\n return undefined;\n }\n params.push(param);\n }\n pathIndex = paramEndIndex;\n }\n }\n }\n}\nclass HandlerStorage {\n handlers = [];\n unconstrainedHandler;\n find() {\n return this.unconstrainedHandler;\n }\n add(route) {\n const handler = {\n params: route.params,\n handler: route.handler,\n createParams: compileCreateParams(route.params)\n };\n this.handlers.push(handler);\n this.unconstrainedHandler = this.handlers[0];\n }\n}\nclass NodeBase {\n isLeafNode = false;\n routes;\n handlerStorage;\n addRoute(route) {\n if (this.routes === undefined) {\n this.routes = [route];\n } else {\n this.routes.push(route);\n }\n if (this.handlerStorage === undefined) {\n this.handlerStorage = new HandlerStorage();\n }\n this.isLeafNode = true;\n this.handlerStorage.add(route);\n }\n}\nclass ParentNode extends NodeBase {\n staticChildren = {};\n findStaticMatchingChild(path, pathIndex) {\n const staticChild = this.staticChildren[path.charAt(pathIndex)];\n if (staticChild === undefined || !staticChild.matchPrefix(path, pathIndex)) {\n return undefined;\n }\n return staticChild;\n }\n getStaticChild(path, pathIndex = 0) {\n if (path.length === pathIndex) {\n return this;\n }\n const staticChild = this.findStaticMatchingChild(path, pathIndex);\n if (staticChild === undefined) {\n return undefined;\n }\n return staticChild.getStaticChild(path, pathIndex + staticChild.prefix.length);\n }\n createStaticChild(path) {\n if (path.length === 0) {\n return this;\n }\n let staticChild = this.staticChildren[path.charAt(0)];\n if (staticChild) {\n let i = 1;\n for (; i < staticChild.prefix.length; i++) {\n if (path.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {\n staticChild = staticChild.split(this, i);\n break;\n }\n }\n return staticChild.createStaticChild(path.slice(i));\n }\n const label = path.charAt(0);\n this.staticChildren[label] = new StaticNode(path);\n return this.staticChildren[label];\n }\n}\nclass StaticNode extends ParentNode {\n _tag = \"StaticNode\";\n constructor(prefix) {\n super();\n this.setPrefix(prefix);\n }\n prefix;\n matchPrefix;\n parametricChildren = [];\n wildcardChild;\n setPrefix(prefix) {\n this.prefix = prefix;\n if (prefix.length === 1) {\n this.matchPrefix = (_path, _pathIndex) => true;\n } else {\n const len = prefix.length;\n this.matchPrefix = function (path, pathIndex) {\n for (let i = 1; i < len; i++) {\n if (path.charCodeAt(pathIndex + i) !== this.prefix.charCodeAt(i)) {\n return false;\n }\n }\n return true;\n };\n }\n }\n getParametricChild(regex) {\n if (regex === undefined) {\n return this.parametricChildren.find(child => child.isRegex === false);\n }\n const source = regex.source;\n return this.parametricChildren.find(child => {\n if (child.regex === undefined) {\n return false;\n }\n return child.regex.source === source;\n });\n }\n createParametricChild(regex, staticSuffix, nodePath) {\n let child = this.getParametricChild(regex);\n if (child !== undefined) {\n child.nodePaths.add(nodePath);\n return child;\n }\n child = new ParametricNode(regex, staticSuffix, nodePath);\n this.parametricChildren.push(child);\n this.parametricChildren.sort((child1, child2) => {\n if (!child1.isRegex) return 1;\n if (!child2.isRegex) return -1;\n if (child1.staticSuffix === undefined) return 1;\n if (child2.staticSuffix === undefined) return -1;\n if (child2.staticSuffix.endsWith(child1.staticSuffix)) return 1;\n if (child1.staticSuffix.endsWith(child2.staticSuffix)) return -1;\n return 0;\n });\n return child;\n }\n createWildcardChild() {\n if (this.wildcardChild === undefined) {\n this.wildcardChild = new WildcardNode();\n }\n return this.wildcardChild;\n }\n split(parentNode, length) {\n const parentPrefix = this.prefix.slice(0, length);\n const childPrefix = this.prefix.slice(length);\n this.setPrefix(childPrefix);\n const staticNode = new StaticNode(parentPrefix);\n staticNode.staticChildren[childPrefix.charAt(0)] = this;\n parentNode.staticChildren[parentPrefix.charAt(0)] = staticNode;\n return staticNode;\n }\n getNextNode(path, pathIndex, nodeStack, paramsCount) {\n let node = this.findStaticMatchingChild(path, pathIndex);\n let parametricBrotherNodeIndex = 0;\n if (node === undefined) {\n if (this.parametricChildren.length === 0) {\n return this.wildcardChild;\n }\n node = this.parametricChildren[0];\n parametricBrotherNodeIndex = 1;\n }\n if (this.wildcardChild !== undefined) {\n nodeStack.push({\n paramsCount,\n brotherPathIndex: pathIndex,\n brotherNode: this.wildcardChild\n });\n }\n for (let i = this.parametricChildren.length - 1; i >= parametricBrotherNodeIndex; i--) {\n nodeStack.push({\n paramsCount,\n brotherPathIndex: pathIndex,\n brotherNode: this.parametricChildren[i]\n });\n }\n return node;\n }\n}\nclass ParametricNode extends ParentNode {\n regex;\n staticSuffix;\n _tag = \"ParametricNode\";\n constructor(regex, staticSuffix, nodePath) {\n super();\n this.regex = regex;\n this.staticSuffix = staticSuffix;\n this.isRegex = !!regex;\n this.nodePaths = new Set([nodePath]);\n }\n isRegex;\n nodePaths;\n getNextNode(path, pathIndex) {\n return this.findStaticMatchingChild(path, pathIndex);\n }\n}\nclass WildcardNode extends NodeBase {\n _tag = \"WildcardNode\";\n getNextNode(_path, _pathIndex, _nodeStack, _paramsCount) {\n return undefined;\n }\n}\nconst assert = (condition, message) => {\n if (!condition) {\n throw new Error(message);\n }\n};\nfunction removeDuplicateSlashes(path) {\n return path.replace(/\\/\\/+/g, \"/\");\n}\nfunction trimLastSlash(path) {\n if (path.length > 1 && path.charCodeAt(path.length - 1) === 47) {\n return path.slice(0, -1);\n }\n return path;\n}\nfunction compileCreateParams(params) {\n const len = params.length;\n return function (paramsArray) {\n const paramsObject = {};\n for (let i = 0; i < len; i++) {\n paramsObject[params[i]] = paramsArray[i];\n }\n return paramsObject;\n };\n}\nfunction getClosingParenthensePosition(path, idx) {\n // `path.indexOf()` will always return the first position of the closing parenthese,\n // but it's inefficient for grouped or wrong regexp expressions.\n // see issues #62 and #63 for more info\n let parentheses = 1;\n while (idx < path.length) {\n idx++;\n // ignore skipped chars\n if (path[idx] === \"\\\\\") {\n idx++;\n continue;\n }\n if (path[idx] === \")\") {\n parentheses--;\n } else if (path[idx] === \"(\") {\n parentheses++;\n }\n if (!parentheses) return idx;\n }\n throw new TypeError('Invalid regexp expression in \"' + path + '\"');\n}\nfunction trimRegExpStartAndEnd(regexString) {\n // removes chars that marks start \"^\" and end \"$\" of regexp\n if (regexString.charCodeAt(1) === 94) {\n regexString = regexString.slice(0, 1) + regexString.slice(2);\n }\n if (regexString.charCodeAt(regexString.length - 2) === 36) {\n regexString = regexString.slice(0, regexString.length - 2) + regexString.slice(regexString.length - 1);\n }\n return regexString;\n}\nfunction escapeRegExp(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n// It must spot all the chars where decodeURIComponent(x) !== decodeURI(x)\n// The chars are: # $ & + , / : ; = ? @\nfunction decodeComponentChar(highCharCode, lowCharCode) {\n if (highCharCode === 50) {\n if (lowCharCode === 53) return \"%\";\n if (lowCharCode === 51) return \"#\";\n if (lowCharCode === 52) return \"$\";\n if (lowCharCode === 54) return \"&\";\n if (lowCharCode === 66) return \"+\";\n if (lowCharCode === 98) return \"+\";\n if (lowCharCode === 67) return \",\";\n if (lowCharCode === 99) return \",\";\n if (lowCharCode === 70) return \"/\";\n if (lowCharCode === 102) return \"/\";\n return undefined;\n }\n if (highCharCode === 51) {\n if (lowCharCode === 65) return \":\";\n if (lowCharCode === 97) return \":\";\n if (lowCharCode === 66) return \";\";\n if (lowCharCode === 98) return \";\";\n if (lowCharCode === 68) return \"=\";\n if (lowCharCode === 100) return \"=\";\n if (lowCharCode === 70) return \"?\";\n if (lowCharCode === 102) return \"?\";\n return undefined;\n }\n if (highCharCode === 52 && lowCharCode === 48) {\n return \"@\";\n }\n return undefined;\n}\nfunction safeDecodeURI(path) {\n let shouldDecode = false;\n let shouldDecodeParam = false;\n let querystring = \"\";\n for (let i = 1; i < path.length; i++) {\n const charCode = path.charCodeAt(i);\n if (charCode === 37) {\n const highCharCode = path.charCodeAt(i + 1);\n const lowCharCode = path.charCodeAt(i + 2);\n if (decodeComponentChar(highCharCode, lowCharCode) === undefined) {\n shouldDecode = true;\n } else {\n shouldDecodeParam = true;\n // %25 - encoded % char. We need to encode one more time to prevent double decoding\n if (highCharCode === 50 && lowCharCode === 53) {\n shouldDecode = true;\n path = path.slice(0, i + 1) + \"25\" + path.slice(i + 1);\n i += 2;\n }\n i += 2;\n }\n // Some systems do not follow RFC and separate the path and query\n // string with a `;` character (code 59), e.g. `/foo;jsessionid=123456`.\n // Thus, we need to split on `;` as well as `?` and `#`.\n } else if (charCode === 63 || charCode === 59 || charCode === 35) {\n querystring = path.slice(i + 1);\n path = path.slice(0, i);\n break;\n }\n }\n const decodedPath = shouldDecode ? decodeURI(path) : path;\n return {\n path: decodedPath,\n querystring,\n shouldDecodeParam\n };\n}\nfunction safeDecodeURIComponent(uriComponent) {\n const startIndex = uriComponent.indexOf(\"%\");\n if (startIndex === -1) return uriComponent;\n let decoded = \"\";\n let lastIndex = startIndex;\n for (let i = startIndex; i < uriComponent.length; i++) {\n if (uriComponent.charCodeAt(i) === 37) {\n const highCharCode = uriComponent.charCodeAt(i + 1);\n const lowCharCode = uriComponent.charCodeAt(i + 2);\n const decodedChar = decodeComponentChar(highCharCode, lowCharCode);\n decoded += uriComponent.slice(lastIndex, i) + decodedChar;\n lastIndex = i + 3;\n }\n }\n return uriComponent.slice(0, startIndex) + decoded + uriComponent.slice(lastIndex);\n}\nconst httpMethods = [\"ACL\", \"BIND\", \"CHECKOUT\", \"CONNECT\", \"COPY\", \"DELETE\", \"GET\", \"HEAD\", \"LINK\", \"LOCK\", \"M-SEARCH\", \"MERGE\", \"MKACTIVITY\", \"MKCALENDAR\", \"MKCOL\", \"MOVE\", \"NOTIFY\", \"OPTIONS\", \"PATCH\", \"POST\", \"PROPFIND\", \"PROPPATCH\", \"PURGE\", \"PUT\", \"REBIND\", \"REPORT\", \"SEARCH\", \"SOURCE\", \"SUBSCRIBE\", \"TRACE\", \"UNBIND\", \"UNLINK\", \"UNLOCK\", \"UNSUBSCRIBE\"];\n//# sourceMappingURL=router.js.map",
|
|
127
|
+
"/**\n * @since 1.0.0\n */\nimport * as internal from \"./internal/router.js\";\n/**\n * @since 1.0.0\n * @category constructors\n */\nexport const make = internal.make;\n//# sourceMappingURL=index.js.map",
|
|
128
|
+
"/**\n * Protocol for values that can render themselves as HTTP server responses.\n *\n * This module lets server-side domain errors, HTTP API errors, and helper\n * values describe the response they should send to a client. Implement\n * `Respondable` when a value should choose its own status, headers, cookies, or\n * body during route error handling without forcing every call site to construct\n * an `HttpServerResponse` directly.\n *\n * **Mental model**\n *\n * A respondable value owns the last step from domain-level information to an\n * `HttpServerResponse`. Server error handling can ask the value for a response,\n * while unknown failures still go through a caller-provided fallback response.\n * Existing `HttpServerResponse` values are already respondable for conversion\n * purposes and are returned directly.\n *\n * **Common tasks**\n *\n * Use `toResponse` when the value is known to implement the protocol and\n * conversion failures should become defects. Use `toResponseOrElse` when\n * handling unknown failures from route effects and a fallback response should be\n * used when no conversion is available. Use `toResponseOrElseDefect` for defect\n * recovery, where only explicit response-like values receive special handling.\n *\n * **Gotchas**\n *\n * Fallback conversion is intentionally conservative. Schema errors become `400`\n * responses, no-such-element errors become `404` responses, and other values use\n * the supplied fallback. The fallback helpers also catch failures raised while\n * running a respondable conversion; `toResponse` does not.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Response from \"./HttpServerResponse.js\";\n/**\n * Protocol key used by values that can render themselves as\n * `HttpServerResponse` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const symbol = \"~effect/http/HttpServerRespondable\";\n/**\n * Returns `true` when the supplied value implements the `Respondable` protocol.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isRespondable = u => hasProperty(u, symbol);\nconst badRequest = /*#__PURE__*/Response.empty({\n status: 400\n});\nconst notFound = /*#__PURE__*/Response.empty({\n status: 404\n});\n/**\n * Converts a `Respondable` value into an `HttpServerResponse`.\n *\n * **Details**\n *\n * If the value is already an HTTP server response it is returned directly; errors\n * from the response conversion are converted to defects.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponse = self => {\n if (Response.isHttpServerResponse(self)) {\n return Effect.succeed(self);\n }\n return Effect.orDie(self[symbol]());\n};\n/**\n * Attempts to convert an unknown value into an `HttpServerResponse`, falling back\n * to the supplied response when no conversion is available.\n *\n * **Details**\n *\n * `HttpServerResponse` and `Respondable` values are used directly, schema errors\n * become `400` responses, and no-such-element errors become `404` responses.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponseOrElse = (u, orElse) => {\n if (Response.isHttpServerResponse(u)) {\n return Effect.succeed(u);\n } else if (isRespondable(u)) {\n return Effect.catchCause(u[symbol](), () => Effect.succeed(orElse));\n // add support for some commmon types\n } else if (Schema.isSchemaError(u)) {\n return Effect.succeed(badRequest);\n } else if (Cause.isNoSuchElementError(u)) {\n return Effect.succeed(notFound);\n }\n return Effect.succeed(orElse);\n};\n/**\n * Attempts to convert an unknown defect into an `HttpServerResponse`, falling\n * back to the supplied response when no conversion is available.\n *\n * **Details**\n *\n * Only `HttpServerResponse` and `Respondable` values receive special handling.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponseOrElseDefect = (u, orElse) => {\n if (Response.isHttpServerResponse(u)) {\n return Effect.succeed(u);\n } else if (isRespondable(u)) {\n return Effect.catchCause(u[symbol](), () => Effect.succeed(orElse));\n }\n return Effect.succeed(orElse);\n};\n//# sourceMappingURL=HttpServerRespondable.js.map",
|
|
129
|
+
"/**\n * Error model used by the unstable HTTP server runtime.\n *\n * This module defines the tagged failures that can occur while a server accepts\n * a request, matches a route, runs a handler, or builds and sends a response.\n * Request-scoped failures keep the request that caused them, and response\n * failures keep the response that was being produced, so applications can log,\n * report, or translate failures without reconstructing HTTP context.\n *\n * **Mental model**\n *\n * {@link HttpServerError} wraps a concrete {@link HttpServerErrorReason}.\n * {@link RequestParseError}, {@link RouteNotFound}, and {@link InternalError}\n * describe failures before or during request handling, while\n * {@link ResponseError} describes a failure tied to a response that was already\n * being built or sent. {@link ServeError} represents lower-level server\n * implementation failures outside an individual handler response.\n *\n * **Common tasks**\n *\n * Use {@link isHttpServerError} to refine unknown failures, inspect `request`\n * and `response` when reporting failures, and use {@link causeResponse} or\n * {@link exitResponse} when a handler cause or exit must be translated into the\n * HTTP response sent to the client.\n *\n * **Gotchas**\n *\n * The default response mapping is intentionally small: request parse errors\n * become `400`, route misses become ignored `404` failures, internal and\n * response errors become `500`, client aborts marked with {@link ClientAbort}\n * become `499`, and server-side interrupts become `503`. A\n * {@link ResponseError} does not reuse the failed response when converted; it\n * produces an empty `500` because that response may be invalid or partly sent.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport { constUndefined } from \"../../Function.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Respondable from \"./HttpServerRespondable.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nconst TypeId = \"~effect/http/HttpServerError\";\n/**\n * Tagged error for failures that occur while handling an HTTP server request.\n *\n * **Details**\n *\n * It wraps a `HttpServerErrorReason`, exposes the associated request and optional\n * response, and can be converted to an HTTP response through the `Respondable`\n * protocol.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpServerError extends /*#__PURE__*/Data.TaggedError(\"HttpServerError\") {\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n [TypeId] = TypeId;\n stack = `${this.name}: ${this.message}`;\n get request() {\n return this.reason.request;\n }\n get response() {\n return \"response\" in this.reason ? this.reason.response : undefined;\n }\n [Respondable.symbol]() {\n return this.reason[Respondable.symbol]();\n }\n get [ErrorReporter.ignore]() {\n return this.reason[ErrorReporter.ignore] ?? false;\n }\n get message() {\n return this.reason.message;\n }\n}\n/**\n * Error describing a failure to parse or read an incoming request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `400` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class RequestParseError extends /*#__PURE__*/Data.TaggedError(\"RequestParseError\") {\n /**\n * Converts the request error into a `400 Bad Request` response.\n *\n * @since 4.0.0\n */\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 400\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Error indicating that no route matched the incoming request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `404` response, and it is\n * ignored by the error reporter.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class RouteNotFound extends /*#__PURE__*/Data.TaggedError(\"RouteNotFound\") {\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 404\n }));\n }\n [ErrorReporter.ignore] = true;\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing an unexpected server-side failure while handling a request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `500` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class InternalError extends /*#__PURE__*/Data.TaggedError(\"InternalError\") {\n /**\n * Converts the server error into a `500 Internal Server Error` response.\n *\n * @since 4.0.0\n */\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 500\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Returns `true` when the supplied value is an `HttpServerError`.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isHttpServerError = u => hasProperty(u, TypeId);\n/**\n * Error describing a failure related to an HTTP response.\n *\n * **Details**\n *\n * It carries the request and response involved in the failure. When converted to\n * a response it produces an empty `500` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class ResponseError extends /*#__PURE__*/Data.TaggedError(\"ResponseError\") {\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 500\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n const info = `${this._tag} (${this.response.status} ${this.methodAndUrl})`;\n return this.description ? `${info}: ${this.description}` : info;\n }\n}\n/**\n * Error wrapping a low-level failure from the HTTP server implementation.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class ServeError extends /*#__PURE__*/Data.TaggedError(\"ServeError\") {}\n/**\n * Context annotation used to mark an interrupt as caused by the client aborting\n * the request.\n *\n * **Details**\n *\n * `causeResponse` uses this annotation to map a pure client abort to a `499`\n * response instead of a server abort response.\n *\n * @category annotations\n * @since 4.0.0\n */\nexport class ClientAbort extends /*#__PURE__*/Context.Service()(\"effect/http/HttpServerError/ClientAbort\") {\n static annotation = /*#__PURE__*/this.context(true).pipe(/*#__PURE__*/Context.add(Cause.StackTrace, {\n name: \"ClientAbort\",\n stack: constUndefined,\n parent: undefined\n }));\n}\nconst formatRequestMessage = (reason, description, info) => {\n const prefix = `${reason} (${info})`;\n return description ? `${prefix}: ${description}` : prefix;\n};\n/**\n * Converts a failed handler cause into the HTTP response that should be sent and\n * the cause that should be reported.\n *\n * **Details**\n *\n * Respondable failures and defects can choose their own response, defects that\n * are already `HttpServerResponse` values are used directly, and pure interrupts\n * produce either `499` for client aborts or `503` for server aborts.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const causeResponse = cause => {\n let response;\n let effect = succeedInternalServerError;\n const failures = [];\n let interrupts = [];\n let isClientInterrupt = false;\n for (let i = 0; i < cause.reasons.length; i++) {\n const reason = cause.reasons[i];\n switch (reason._tag) {\n case \"Fail\":\n {\n effect = Respondable.toResponseOrElse(reason.error, internalServerError);\n failures.push(reason);\n break;\n }\n case \"Die\":\n {\n if (Response.isHttpServerResponse(reason.defect)) {\n response = reason.defect;\n } else {\n effect = Respondable.toResponseOrElseDefect(reason.defect, internalServerError);\n failures.push(reason);\n }\n break;\n }\n case \"Interrupt\":\n {\n isClientInterrupt = reason.annotations.has(ClientAbort.key);\n if (failures.length > 0) break;\n interrupts.push(reason);\n break;\n }\n }\n }\n if (response) {\n return Effect.succeed([response, Cause.fromReasons(failures)]);\n } else if (interrupts.length > 0 && failures.length === 0) {\n failures.push(...interrupts);\n effect = isClientInterrupt ? clientAbortError : serverAbortError;\n }\n return Effect.mapEager(effect, response => {\n failures.push(Cause.makeDieReason(response));\n return [response, Cause.fromReasons(failures)];\n });\n};\n/**\n * Derives an HTTP response from a failed handler cause synchronously.\n *\n * **Details**\n *\n * If the cause contains a defect that is already an `HttpServerResponse`, that\n * response is used and removed from the remaining cause. Otherwise the response\n * defaults to `500`.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const causeResponseStripped = cause => {\n let response;\n const failures = cause.reasons.filter(f => {\n if (f._tag === \"Die\" && Response.isHttpServerResponse(f.defect)) {\n response = f.defect;\n return false;\n }\n return true;\n });\n return [response ?? internalServerError, failures.length > 0 ? Option.some(Cause.fromReasons(failures)) : Option.none()];\n};\nconst internalServerError = /*#__PURE__*/Response.empty({\n status: 500\n});\nconst succeedInternalServerError = /*#__PURE__*/Effect.succeed(internalServerError);\nconst clientAbortError = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Response.empty({\n status: 499\n}));\nconst serverAbortError = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Response.empty({\n status: 503\n}));\n/**\n * Extracts the response from a successful handler exit, or derives a response\n * from the failure cause.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const exitResponse = exit => {\n if (exit._tag === \"Success\") {\n return exit.value;\n }\n return causeResponseStripped(exit.cause)[0];\n};\n//# sourceMappingURL=HttpServerError.js.map",
|
|
130
|
+
"import * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Deferred from \"../../Deferred.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as FiberSet from \"../../FiberSet.js\";\nimport { constVoid, dual, flow } from \"../../Function.js\";\nimport * as Latch from \"../../Latch.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Pull from \"../../Pull.js\";\nimport * as Queue from \"../../Queue.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Scope from \"../../Scope.js\";\n/**\n * Runtime type identifier attached to `Socket` services.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/socket/Socket\";\n/**\n * Returns `true` when a value is a `Socket`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isSocket = u => Predicate.hasProperty(u, TypeId);\n/**\n * Service tag for bidirectional socket transports.\n *\n * **When to use**\n *\n * Use to access or provide the socket implementation used by programs that\n * read and write frames through the Effect environment.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Socket = /*#__PURE__*/Context.Service(\"effect/socket/Socket\");\n/**\n * Constructs a `Socket` from a raw read loop and scoped writer, deriving binary\n * and string read loops when they are not provided.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => Socket.of({\n [TypeId]: TypeId,\n runRaw: options.runRaw,\n run: options.run ?? ((handler, opts) => options.runRaw(data => typeof data === \"string\" ? handler(encoder.encode(data)) : data instanceof Uint8Array ? handler(data) : handler(new Uint8Array(data)), opts)),\n runString: options.runString ?? (options.run ? (handler, opts) => options.run(data => handler(decoder.decode(data)), opts) : (handler, opts) => options.runRaw(data => typeof data === \"string\" ? handler(data) : data instanceof Uint8Array ? handler(decoder.decode(data)) : handler(decoder.decode(new Uint8Array(data))), opts)),\n writer: options.writer\n});\nconst encoder = /*#__PURE__*/new TextEncoder();\nconst decoder = /*#__PURE__*/new TextDecoder();\nconst CloseEventTypeId = \"~effect/socket/Socket/CloseEvent\";\n/**\n * Represents a socket close event value carrying a close code and optional\n * reason.\n *\n * @category models\n * @since 4.0.0\n */\nexport class CloseEvent {\n /**\n * Marks this value as a socket close event for runtime guards.\n *\n * @since 4.0.0\n */\n [CloseEventTypeId];\n code;\n reason;\n constructor(code = 1000, reason) {\n this[CloseEventTypeId] = CloseEventTypeId;\n this.code = code;\n this.reason = reason;\n }\n /**\n * Formats the close code and optional reason for display.\n *\n * @since 4.0.0\n */\n toString() {\n return this.reason ? `${this.code}: ${this.reason}` : `${this.code}`;\n }\n}\n/**\n * Returns `true` when a value is a `CloseEvent`.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isCloseEvent = u => Predicate.hasProperty(u, CloseEventTypeId);\n/**\n * Runtime type identifier attached to `SocketError` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const SocketErrorTypeId = \"~effect/socket/Socket/SocketError\";\n/**\n * Returns `true` when a value is a `SocketError`.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isSocketError = u => Predicate.hasProperty(u, SocketErrorTypeId);\n/**\n * Typed error for failures that occur while reading from a socket.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketReadError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketReadError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketReadError\"),\n cause: Schema.Defect\n}) {\n /**\n * Default message used for socket read failures.\n *\n * @since 4.0.0\n */\n message = `An error occurred during Read`;\n}\n/**\n * Typed error for failures that occur while writing to a socket.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketWriteError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketWriteError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketWriteError\"),\n cause: Schema.Defect\n}) {\n /**\n * Default message used for socket write failures.\n *\n * @since 4.0.0\n */\n message = `An error occurred during Write`;\n}\n/**\n * Typed error for failures that occur while opening a socket, including\n * unknown open failures and open timeouts.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketOpenError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketOpenError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketOpenError\"),\n kind: /*#__PURE__*/Schema.Literals([\"Unknown\", \"Timeout\"]),\n cause: Schema.Defect\n}) {\n /**\n * Formats timeout and unknown open failures for display.\n *\n * @since 4.0.0\n */\n get message() {\n return this.kind === \"Timeout\" ? `timeout waiting for \"open\"` : `An error occurred during Open`;\n }\n}\n/**\n * Typed error for a socket close event, carrying the close code and optional\n * close reason.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketCloseError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketCloseError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketCloseError\"),\n code: Schema.Number,\n closeReason: /*#__PURE__*/Schema.optional(Schema.String)\n}) {\n /**\n * Separates clean socket close errors from errors that should remain failures.\n *\n * @since 4.0.0\n */\n static filterClean(isClean) {\n return function (u) {\n return SocketError.is(u) && u.reason._tag === \"SocketCloseError\" && isClean(u.reason.code) ? Result.succeed(u.reason) : Result.fail(u);\n };\n }\n get message() {\n if (this.closeReason) {\n return `${this.code}: ${this.closeReason}`;\n }\n return `${this.code}`;\n }\n}\n/**\n * Schema for all socket-specific error reasons.\n *\n * @category errors\n * @since 4.0.0\n */\nexport const SocketErrorReason = /*#__PURE__*/Schema.Union([SocketReadError, SocketWriteError, SocketOpenError, SocketCloseError]);\n/**\n * Tagged error that wraps socket read, write, open, and close failures while\n * preserving the underlying reason.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketError extends /*#__PURE__*/Schema.TaggedErrorClass(SocketErrorTypeId)(\"SocketError\", {\n _tag: /*#__PURE__*/Schema.tag(\"SocketError\"),\n reason: SocketErrorReason\n}) {\n // @effect-diagnostics-next-line overriddenSchemaConstructor:off\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n /**\n * Marks this value as a socket error wrapper for runtime guards.\n *\n * @since 4.0.0\n */\n [SocketErrorTypeId] = SocketErrorTypeId;\n /**\n * Returns `true` when the value is a `SocketError`.\n *\n * @since 4.0.0\n */\n static is(u) {\n return isSocketError(u);\n }\n message = this.reason.message;\n}\n/**\n * Converts a `Socket` into a bidirectional `Channel`, mapping incoming string\n * or binary frames and writing outgoing frame batches to the socket.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelMap = (self, f) => Channel.fromTransform(Effect.fnUntraced(function* (upstream, scope) {\n const queue = yield* Queue.make();\n const writeScope = yield* Scope.fork(scope);\n const write = yield* Scope.provide(self.writer, writeScope);\n let chunk;\n let index = 0;\n const writeChunk = Effect.whileLoop({\n while: () => index < chunk.length,\n body: () => write(chunk[index++]),\n step: constVoid\n });\n yield* upstream.pipe(Effect.flatMap(arr => {\n if (arr.length === 1) return write(arr[0]);\n chunk = arr;\n index = 0;\n return writeChunk;\n }), Effect.forever({\n disableYield: true\n }), Effect.catchCauseFilter(Pull.filterNoDone, cause => Queue.failCause(queue, cause)), Effect.ensuring(Scope.close(writeScope, Exit.void)), Effect.forkIn(scope));\n yield* self.runRaw(data => {\n Queue.offerUnsafe(queue, f(data));\n }).pipe(Queue.into(queue), Effect.forkIn(scope));\n // @effect-diagnostics-next-line returnEffectInGen:off\n return Queue.takeAll(queue);\n}));\n/**\n * Converts a `Socket` into a binary `Channel`, encoding incoming string frames\n * as UTF-8 bytes.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannel = self => {\n const encoder = new TextEncoder();\n return toChannelMap(self, data => typeof data === \"string\" ? encoder.encode(data) : data);\n};\n/**\n * Converts a `Socket` into a string `Channel`, decoding binary frames with the\n * optional text encoding.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelString = /*#__PURE__*/dual(args => isSocket(args[0]), (self, encoding) => {\n const decoder = new TextDecoder(encoding);\n return toChannelMap(self, data => typeof data === \"string\" ? data : decoder.decode(data));\n});\n/**\n * Creates a `Socket` to binary `Channel` adapter with a fixed upstream error\n * type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelWith = () => self => toChannel(self);\n/**\n * Creates a binary socket `Channel` from the `Socket` service in the\n * environment.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeChannel = () => Channel.unwrap(Effect.map(Socket, toChannelWith()));\n/**\n * Default close-code classifier that treats every socket close code as an\n * error.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const defaultCloseCodeIsError = _code => true;\n/**\n * Context service for the active `WebSocket` instance available while a\n * WebSocket-backed socket run is handling events.\n *\n * @category services\n * @since 4.0.0\n */\nexport class WebSocket extends /*#__PURE__*/Context.Service()(\"~effect/socket/Socket/WebSocket\") {}\n/**\n * Context service for constructing `WebSocket` instances from a URL and\n * optional protocols.\n *\n * @category services\n * @since 4.0.0\n */\nexport class WebSocketConstructor extends /*#__PURE__*/Context.Service()(\"@effect/platform/Socket/WebSocketConstructor\") {}\n/**\n * Layer that provides `WebSocketConstructor` using `globalThis.WebSocket`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocketConstructorGlobal = /*#__PURE__*/Layer.succeed(WebSocketConstructor)((url, protocols) => new globalThis.WebSocket(url, protocols));\n/**\n * Creates a `Socket` backed by a `WebSocketConstructor`, acquiring the\n * WebSocket for each run and using the close-code classifier to decide which\n * closes fail the run.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWebSocket = (url, options) => WebSocketConstructor.use(makeWs => fromWebSocket(Effect.acquireRelease((typeof url === \"string\" ? Effect.succeed(url) : url).pipe(Effect.map(url => makeWs(url, options?.protocols))), ws => Effect.sync(() => ws.close(1000))), options));\n/**\n * Builds a `Socket` from a scoped WebSocket acquisition effect, waiting for the\n * socket to open, dispatching message handlers in fibers, and translating\n * open, read, and close events into `SocketError` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWebSocket = (acquire, options) => Effect.withFiber(fiber => {\n let currentWS;\n const latch = Latch.makeUnsafe(false);\n const acquireContext = fiber.context;\n const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError;\n const runRaw = (handler, opts) => Effect.scopedWith(Effect.fnUntraced(function* (scope) {\n const fiberSet = yield* FiberSet.make().pipe(Scope.provide(scope));\n const ws = yield* Scope.provide(acquire, scope);\n const run = yield* Effect.provideService(FiberSet.runtime(fiberSet)(), WebSocket, ws);\n let open = false;\n function onMessage(event) {\n if (event.data instanceof Blob) {\n const effect = Effect.flatMap(Effect.promise(() => event.data.arrayBuffer()), buffer => {\n const result = handler(new Uint8Array(buffer));\n return Effect.isEffect(result) ? result : Effect.void;\n });\n return run(effect);\n }\n const result = handler(event.data);\n if (Effect.isEffect(result)) {\n run(result);\n }\n }\n function onError(cause) {\n ws.removeEventListener(\"message\", onMessage);\n ws.removeEventListener(\"close\", onClose);\n Deferred.doneUnsafe(fiberSet.deferred, Effect.fail(new SocketError({\n reason: open ? new SocketReadError({\n cause\n }) : new SocketOpenError({\n kind: \"Unknown\",\n cause\n })\n })));\n }\n function onClose(event) {\n const code = typeof event.code === \"number\" ? event.code : 1001;\n ws.removeEventListener(\"message\", onMessage);\n ws.removeEventListener(\"error\", onError);\n Deferred.doneUnsafe(fiberSet.deferred, Effect.fail(new SocketError({\n reason: new SocketCloseError({\n code,\n closeReason: event.reason\n })\n })));\n }\n ws.addEventListener(\"close\", onClose, {\n once: true\n });\n ws.addEventListener(\"error\", onError, {\n once: true\n });\n ws.addEventListener(\"message\", onMessage);\n if (ws.readyState !== 1) {\n const openDeferred = Deferred.makeUnsafe();\n ws.addEventListener(\"open\", () => {\n open = true;\n Deferred.doneUnsafe(openDeferred, Effect.void);\n }, {\n once: true\n });\n yield* Deferred.await(openDeferred).pipe(Effect.timeoutOrElse({\n duration: options?.openTimeout ?? 10000,\n orElse: () => Effect.fail(new SocketError({\n reason: new SocketOpenError({\n kind: \"Timeout\",\n cause: new Error(\"timeout waiting for \\\"open\\\"\")\n })\n }))\n }), Effect.raceFirst(FiberSet.join(fiberSet)));\n }\n open = true;\n currentWS = ws;\n latch.openUnsafe();\n if (opts?.onOpen) yield* opts.onOpen;\n return yield* Effect.catchFilter(FiberSet.join(fiberSet), SocketCloseError.filterClean(_ => !closeCodeIsError(_)), () => Effect.void);\n })).pipe(Effect.updateContext(input => Context.merge(acquireContext, input)), Effect.ensuring(Effect.sync(() => {\n latch.closeUnsafe();\n currentWS = undefined;\n })));\n const write = chunk => latch.whenOpen(Effect.sync(() => {\n const ws = currentWS;\n if (isCloseEvent(chunk)) {\n ws.close(chunk.code, chunk.reason);\n } else {\n ws.send(chunk);\n }\n }));\n const writer = Effect.succeed(write);\n return Effect.succeed(make({\n runRaw,\n writer\n }));\n});\n/**\n * Creates a binary `Channel` backed by a WebSocket URL, requiring a\n * `WebSocketConstructor` service.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWebSocketChannel = (url, options) => Channel.unwrap(Effect.map(makeWebSocket(url, options), toChannelWith()));\n/**\n * Layer that provides a `Socket` service backed by a WebSocket URL or URL\n * effect.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocket = /*#__PURE__*/flow(makeWebSocket, /*#__PURE__*/Layer.effect(Socket));\n/**\n * Context reference for socket send queue capacity, defaulting to `16`.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const SendQueueCapacity = /*#__PURE__*/Context.Reference(\"~effect/socket/Socket/SendQueueCapacity\", {\n defaultValue: () => 16\n});\n/**\n * Builds a `Socket` from a scoped `InputTransformStream`, reading incoming\n * chunks through socket handlers and writing outgoing chunks to the writable\n * stream, encoding strings as UTF-8 and using close-code classification for\n * `CloseEvent` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromTransformStream = (acquire, options) => Effect.withFiber(fiber => {\n const latch = Latch.makeUnsafe(false);\n let currentStream;\n const acquireServices = fiber.context;\n const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError;\n const runRaw = (handler, opts) => Effect.scopedWith(Effect.fnUntraced(function* (scope) {\n const stream = yield* Scope.provide(acquire, scope);\n const reader = stream.readable.getReader();\n yield* Scope.addFinalizer(scope, Effect.promise(() => reader.cancel()));\n const fiberSet = yield* FiberSet.make().pipe(Scope.provide(scope));\n const runFork = yield* FiberSet.runtime(fiberSet)();\n yield* Effect.tryPromise({\n try: async () => {\n while (true) {\n const {\n done,\n value\n } = await reader.read();\n if (done) {\n throw new SocketError({\n reason: new SocketCloseError({\n code: 1000\n })\n });\n }\n const result = handler(value);\n if (Effect.isEffect(result)) {\n runFork(result);\n }\n }\n },\n catch: cause => isSocketError(cause) ? cause : new SocketError({\n reason: new SocketReadError({\n cause\n })\n })\n }).pipe(FiberSet.run(fiberSet));\n currentStream = {\n stream,\n fiberSet\n };\n yield* latch.open;\n if (opts?.onOpen) yield* opts.onOpen;\n return yield* Effect.catchFilter(FiberSet.join(fiberSet), SocketCloseError.filterClean(_ => !closeCodeIsError(_)), () => Effect.void);\n })).pipe(_ => _, Effect.updateContext(input => Context.merge(acquireServices, input)), Effect.ensuring(Effect.sync(() => {\n latch.closeUnsafe();\n currentStream = undefined;\n })));\n const writers = new WeakMap();\n const getWriter = stream => {\n let writer = writers.get(stream);\n if (!writer) {\n writer = stream.writable.getWriter();\n writers.set(stream, writer);\n }\n return writer;\n };\n const write = chunk => latch.whenOpen(Effect.suspend(() => {\n const {\n fiberSet,\n stream\n } = currentStream;\n if (isCloseEvent(chunk)) {\n return Deferred.fail(fiberSet.deferred, new SocketError({\n reason: new SocketCloseError({\n code: chunk.code,\n closeReason: chunk.reason\n })\n }));\n }\n return Effect.promise(() => getWriter(stream).write(typeof chunk === \"string\" ? encoder.encode(chunk) : chunk));\n }));\n const writer = Effect.acquireRelease(Effect.succeed(write), () => Effect.promise(async () => {\n if (!currentStream) return;\n await getWriter(currentStream.stream).close();\n }));\n return Effect.succeed(make({\n runRaw,\n writer\n }));\n});\n//# sourceMappingURL=Socket.js.map",
|
|
131
|
+
"// taken from https://github.com/fastify/fast-content-type-parse\n// under the MIT license\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nconst paramRE = /; *([!#$%&'*+.^\\w`|~-]+)=(\"(?:[\\v\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\v\\u0020-\\u00ff])*\"|[!#$%&'*+.^\\w`|~-]+) */gu;\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nconst quotedPairRE = /\\\\([\\v\\u0020-\\u00ff])/gu;\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nconst mediaTypeRE = /^[!#$%&'*+.^\\w|~-]+\\/[!#$%&'*+.^\\w|~-]+$/u;\nconst mediaTypeRENoSlash = /^[!#$%&'*+.^\\w|~-]+$/u;\n// default ContentType to prevent repeated object creation\nconst defaultContentType = {\n value: \"\",\n parameters: /*#__PURE__*/Object.create(null)\n};\nexport function parse(header, withoutSlash = false) {\n if (typeof header !== \"string\") {\n return defaultContentType;\n }\n let index = header.indexOf(\";\");\n const type = index !== -1 ? header.slice(0, index).trim() : header.trim();\n const mediaRE = withoutSlash ? mediaTypeRENoSlash : mediaTypeRE;\n if (mediaRE.test(type) === false) {\n return defaultContentType;\n }\n const result = {\n value: type.toLowerCase(),\n parameters: Object.create(null)\n };\n // parse parameters\n if (index === -1) {\n return result;\n }\n let key;\n let match;\n let value;\n paramRE.lastIndex = index;\n while (match = paramRE.exec(header)) {\n if (match.index !== index) {\n return defaultContentType;\n }\n index += match[0].length;\n key = match[1].toLowerCase();\n value = match[2];\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value.slice(1, value.length - 1);\n !withoutSlash && quotedPairRE.test(value) && (value = value.replace(quotedPairRE, \"$1\"));\n }\n result.parameters[key] = value;\n }\n if (index !== header.length) {\n return defaultContentType;\n }\n return result;\n}\n//# sourceMappingURL=contentType.js.map",
|
|
132
|
+
"const constMaxPairs = 100;\nconst constMaxSize = 16 * 1024;\nvar State;\n(function (State) {\n State[State[\"key\"] = 0] = \"key\";\n State[State[\"whitespace\"] = 1] = \"whitespace\";\n State[State[\"value\"] = 2] = \"value\";\n})(State || (State = {}));\nconst constContinue = {\n _tag: \"Continue\"\n};\nconst constNameChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1];\nconst constValueChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];\nexport function make() {\n const decoder = new TextDecoder();\n const state = {\n state: State.key,\n headers: Object.create(null),\n key: \"\",\n value: undefined,\n crlf: 0,\n previousChunk: undefined,\n pairs: 0,\n size: 0\n };\n function reset(value) {\n state.state = State.key;\n state.headers = Object.create(null);\n state.key = \"\";\n state.value = undefined;\n state.crlf = 0;\n state.previousChunk = undefined;\n state.pairs = 0;\n state.size = 0;\n return value;\n }\n function concatUint8Array(a, b) {\n const newUint8Array = new Uint8Array(a.length + b.length);\n newUint8Array.set(a);\n newUint8Array.set(b, a.length);\n return newUint8Array;\n }\n function error(reason) {\n return reset({\n _tag: \"Failure\",\n reason,\n headers: state.headers\n });\n }\n return function write(chunk, start) {\n let endOffset = 0;\n let previousCursor;\n if (state.previousChunk !== undefined) {\n endOffset = state.previousChunk.length;\n previousCursor = endOffset;\n const newChunk = new Uint8Array(chunk.length + endOffset);\n newChunk.set(state.previousChunk);\n newChunk.set(chunk, endOffset);\n state.previousChunk = undefined;\n chunk = newChunk;\n }\n const end = chunk.length;\n outer: while (start < end) {\n if (state.state === State.key) {\n let i = start;\n for (; i < end; i++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[i] === 58) {\n state.key += decoder.decode(chunk.subarray(start, i)).toLowerCase();\n if (state.key.length === 0) {\n return error(\"InvalidHeaderName\");\n }\n if (chunk[i + 1] === 32 && chunk[i + 2] !== 32 && chunk[i + 2] !== 9) {\n start = i + 2;\n state.state = State.value;\n state.size++;\n } else if (chunk[i + 1] !== 32 && chunk[i + 1] !== 9) {\n start = i + 1;\n state.state = State.value;\n } else {\n start = i + 1;\n state.state = State.whitespace;\n }\n break;\n } else if (constNameChars[chunk[i]] !== 1) {\n return error(\"InvalidHeaderName\");\n }\n }\n if (i === end) {\n state.key += decoder.decode(chunk.subarray(start, end)).toLowerCase();\n return constContinue;\n }\n }\n if (state.state === State.whitespace) {\n for (; start < end; start++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[start] !== 32 && chunk[start] !== 9) {\n state.state = State.value;\n break;\n }\n }\n if (start === end) {\n return constContinue;\n }\n }\n if (state.state === State.value) {\n let i = start;\n if (previousCursor !== undefined) {\n i = previousCursor;\n previousCursor = undefined;\n }\n for (; i < end; i++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[i] === 13 || state.crlf > 0) {\n let byte = chunk[i];\n if (byte === 13 && state.crlf === 0) {\n state.crlf = 1;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 10 && state.crlf === 1) {\n state.crlf = 2;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 13 && state.crlf === 2) {\n state.crlf = 3;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 10 && state.crlf === 3) {\n state.crlf = 4;\n i++;\n state.size++;\n }\n if (state.crlf < 4 && i >= end) {\n state.previousChunk = chunk.subarray(start);\n return constContinue;\n } else if (state.crlf >= 2) {\n state.value = state.value === undefined ? chunk.subarray(start, i - state.crlf) : concatUint8Array(state.value, chunk.subarray(start, i - state.crlf));\n const value = decoder.decode(state.value);\n if (state.headers[state.key] === undefined) {\n state.headers[state.key] = value;\n } else if (typeof state.headers[state.key] === \"string\") {\n state.headers[state.key] = [state.headers[state.key], value];\n } else {\n ;\n state.headers[state.key].push(value);\n }\n start = i;\n state.size--;\n if (state.crlf !== 4 && state.pairs === constMaxPairs) {\n return error(\"TooManyHeaders\");\n } else if (state.crlf === 3) {\n return error(\"InvalidHeaderValue\");\n } else if (state.crlf === 4) {\n return reset({\n _tag: \"Headers\",\n headers: state.headers,\n endPosition: start - endOffset\n });\n }\n state.pairs++;\n state.key = \"\";\n state.value = undefined;\n state.crlf = 0;\n state.state = State.key;\n continue outer;\n }\n } else if (constValueChars[chunk[i]] !== 1) {\n return error(\"InvalidHeaderValue\");\n }\n }\n if (i === end) {\n state.value = state.value === undefined ? chunk.subarray(start, end) : concatUint8Array(state.value, chunk.subarray(start, end));\n return constContinue;\n }\n }\n }\n if (start > end) {\n state.size += end - start;\n }\n return constContinue;\n };\n}\n//# sourceMappingURL=headers.js.map",
|
|
133
|
+
"function makeState(needle_) {\n const needle = new TextEncoder().encode(needle_);\n const needleLength = needle.length;\n const indexes = {};\n for (let i = 0; i < needleLength; i++) {\n const b = needle[i];\n if (indexes[b] === undefined) indexes[b] = [];\n indexes[b].push(i);\n }\n return {\n needle,\n needleLength,\n indexes,\n firstByte: needle[0],\n previousChunk: undefined,\n previousChunkLength: 0,\n matchIndex: 0\n };\n}\nexport function make(needle, callback, seed) {\n const state = makeState(needle);\n if (seed !== undefined) {\n state.previousChunk = seed;\n state.previousChunkLength = seed.length;\n }\n function makeIndexOf() {\n // on node.js use the Buffer api\n if (\"Buffer\" in globalThis && !(\"Bun\" in globalThis || \"Deno\" in globalThis)) {\n return function (chunk, needle, fromIndex) {\n return Buffer.prototype.indexOf.call(chunk, needle, fromIndex);\n };\n }\n const skipTable = new Uint8Array(256).fill(state.needle.length);\n for (let i = 0, lastIndex = state.needle.length - 1; i < lastIndex; ++i) {\n skipTable[state.needle[i]] = lastIndex - i;\n }\n return function (chunk, needle, fromIndex) {\n const lengthTotal = chunk.length;\n let i = fromIndex + state.needleLength - 1;\n while (i < lengthTotal) {\n for (let j = state.needleLength - 1, k = i; j >= 0 && chunk[k] === needle[j]; j--, k--) {\n if (j === 0) return k;\n }\n i += skipTable[chunk[i]];\n }\n return -1;\n };\n }\n const indexOf = makeIndexOf();\n function write(chunk) {\n let chunkLength = chunk.length;\n if (state.previousChunk !== undefined) {\n const newChunk = new Uint8Array(state.previousChunkLength + chunkLength);\n newChunk.set(state.previousChunk);\n newChunk.set(chunk, state.previousChunkLength);\n chunk = newChunk;\n chunkLength = state.previousChunkLength + chunkLength;\n state.previousChunk = undefined;\n }\n if (chunkLength < state.needleLength) {\n state.previousChunk = chunk;\n state.previousChunkLength = chunkLength;\n return;\n }\n let pos = 0;\n while (pos < chunkLength) {\n const match = indexOf(chunk, state.needle, pos);\n if (match > -1) {\n if (match > pos) {\n callback(state.matchIndex, chunk.subarray(pos, match));\n }\n state.matchIndex += 1;\n pos = match + state.needleLength;\n continue;\n } else if (chunk[chunkLength - 1] in state.indexes) {\n const indexes = state.indexes[chunk[chunkLength - 1]];\n let earliestIndex = -1;\n for (let i = 0, len = indexes.length; i < len; i++) {\n const index = indexes[i];\n if (chunk[chunkLength - 1 - index] === state.firstByte && i > earliestIndex) {\n earliestIndex = index;\n }\n }\n if (earliestIndex === -1) {\n if (pos === 0) {\n callback(state.matchIndex, chunk);\n } else {\n callback(state.matchIndex, chunk.subarray(pos));\n }\n } else {\n if (chunkLength - 1 - earliestIndex > pos) {\n callback(state.matchIndex, chunk.subarray(pos, chunkLength - 1 - earliestIndex));\n }\n state.previousChunk = chunk.subarray(chunkLength - 1 - earliestIndex);\n state.previousChunkLength = earliestIndex + 1;\n }\n } else if (pos === 0) {\n callback(state.matchIndex, chunk);\n } else {\n callback(state.matchIndex, chunk.subarray(pos));\n }\n break;\n }\n }\n function end() {\n if (state.previousChunk !== undefined && state.previousChunk !== seed) {\n callback(state.matchIndex, state.previousChunk);\n }\n state.previousChunk = seed;\n state.previousChunkLength = seed?.length ?? 0;\n state.matchIndex = 0;\n }\n return {\n write,\n end\n };\n}\n//# sourceMappingURL=search.js.map",
|
|
134
|
+
"import * as CT from \"./contentType.js\";\nimport * as HP from \"./headers.js\";\nimport * as Search from \"./search.js\";\nvar State;\n(function (State) {\n State[State[\"headers\"] = 0] = \"headers\";\n State[State[\"body\"] = 1] = \"body\";\n})(State || (State = {}));\nconst errInvalidDisposition = {\n _tag: \"InvalidDisposition\"\n};\nconst errEndNotReached = {\n _tag: \"EndNotReached\"\n};\nconst errMaxParts = {\n _tag: \"ReachedLimit\",\n limit: \"MaxParts\"\n};\nconst errMaxTotalSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxTotalSize\"\n};\nconst errMaxPartSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxPartSize\"\n};\nconst errMaxFieldSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxFieldSize\"\n};\nconst constCR = /*#__PURE__*/new TextEncoder().encode(\"\\r\\n\");\nexport function defaultIsFile(info) {\n return info.filename !== undefined || info.contentType === \"application/octet-stream\";\n}\nfunction parseBoundary(headers) {\n const contentType = CT.parse(headers[\"content-type\"]);\n return contentType.parameters.boundary;\n}\nfunction noopOnChunk(_chunk) {}\nexport function make({\n headers,\n onFile: onPart,\n onField,\n onError,\n onDone,\n isFile = defaultIsFile,\n maxParts = Infinity,\n maxTotalSize = Infinity,\n maxPartSize = Infinity,\n maxFieldSize = 1024 * 1024\n}) {\n const boundary = parseBoundary(headers);\n if (boundary === undefined) {\n onError({\n _tag: \"InvalidBoundary\"\n });\n return {\n write: noopOnChunk,\n end() {}\n };\n }\n const state = {\n state: State.headers,\n index: 0,\n parts: 0,\n onChunk: noopOnChunk,\n info: undefined,\n headerSkip: 0,\n partSize: 0,\n totalSize: 0,\n isFile: false,\n fieldChunks: [],\n fieldSize: 0\n };\n function skipBody() {\n state.state = State.body;\n state.isFile = true;\n state.onChunk = noopOnChunk;\n }\n const headerParser = HP.make();\n const split = Search.make(`\\r\\n--${boundary}`, function (index, chunk) {\n if (index === 0) {\n // data before the first boundary\n skipBody();\n return;\n } else if (index !== state.index) {\n if (state.index > 0) {\n if (state.isFile) {\n state.onChunk(null);\n state.partSize = 0;\n } else {\n if (state.fieldChunks.length === 1) {\n onField(state.info, state.fieldChunks[0]);\n } else {\n const buf = new Uint8Array(state.fieldSize);\n let offset = 0;\n for (let i = 0; i < state.fieldChunks.length; i++) {\n const chunk = state.fieldChunks[i];\n buf.set(chunk, offset);\n offset += chunk.length;\n }\n onField(state.info, buf);\n }\n state.fieldSize = 0;\n state.fieldChunks = [];\n }\n }\n state.state = State.headers;\n state.index = index;\n state.headerSkip = 2; // skip the first \\r\\n\n // trailing --\n if (chunk[0] === 45 && chunk[1] === 45) {\n return onDone();\n }\n state.parts++;\n if (state.parts > maxParts) {\n onError(errMaxParts);\n }\n }\n if ((state.partSize += chunk.length) > maxPartSize) {\n onError(errMaxPartSize);\n }\n if (state.state === State.headers) {\n const result = headerParser(chunk, state.headerSkip);\n state.headerSkip = 0;\n if (result._tag === \"Continue\") {\n return;\n } else if (result._tag === \"Failure\") {\n skipBody();\n return onError({\n _tag: \"BadHeaders\",\n error: result\n });\n }\n const contentType = CT.parse(result.headers[\"content-type\"]);\n const contentDisposition = CT.parse(result.headers[\"content-disposition\"], true);\n if (\"form-data\" === contentDisposition.value && !(\"name\" in contentDisposition.parameters)) {\n skipBody();\n return onError(errInvalidDisposition);\n }\n let encodedFilename;\n if (\"filename*\" in contentDisposition.parameters) {\n const parts = contentDisposition.parameters[\"filename*\"].split(\"''\");\n if (parts.length === 2) {\n encodedFilename = decodeURIComponent(parts[1]);\n }\n }\n state.info = {\n name: contentDisposition.parameters.name ?? \"\",\n filename: encodedFilename ?? contentDisposition.parameters.filename,\n contentType: contentType.value === \"\" ? contentDisposition.parameters.filename !== undefined ? \"application/octet-stream\" : \"text/plain\" : contentType.value,\n contentTypeParameters: contentType.parameters,\n contentDisposition: contentDisposition.value,\n contentDispositionParameters: contentDisposition.parameters,\n headers: result.headers\n };\n state.state = State.body;\n state.isFile = isFile(state.info);\n if (state.isFile) {\n state.onChunk = onPart(state.info);\n }\n if (result.endPosition < chunk.length) {\n if (state.isFile) {\n state.onChunk(chunk.subarray(result.endPosition));\n } else {\n const buf = chunk.subarray(result.endPosition);\n if ((state.fieldSize += buf.length) > maxFieldSize) {\n onError(errMaxFieldSize);\n }\n state.fieldChunks.push(buf);\n }\n }\n } else if (state.isFile) {\n state.onChunk(chunk);\n } else {\n if ((state.fieldSize += chunk.length) > maxFieldSize) {\n onError(errMaxFieldSize);\n }\n state.fieldChunks.push(chunk);\n }\n }, constCR);\n return {\n write(chunk) {\n if ((state.totalSize += chunk.length) > maxTotalSize) {\n return onError(errMaxTotalSize);\n }\n return split.write(chunk);\n },\n end() {\n split.end();\n if (state.state === State.body) {\n onError(errEndNotReached);\n }\n state.state = State.headers;\n state.index = 0;\n state.parts = 0;\n state.onChunk = noopOnChunk;\n state.info = undefined;\n state.totalSize = 0;\n state.partSize = 0;\n state.fieldChunks = [];\n state.fieldSize = 0;\n }\n };\n}\nconst utf8Decoder = /*#__PURE__*/new TextDecoder(\"utf-8\");\nfunction getDecoder(charset) {\n if (charset === \"utf-8\" || charset === \"utf8\" || charset === \"\") {\n return utf8Decoder;\n }\n try {\n return new TextDecoder(charset);\n } catch (error) {\n return utf8Decoder;\n }\n}\nexport function decodeField(info, value) {\n return getDecoder(info.contentTypeParameters.charset ?? \"utf-8\").decode(value);\n}\n//# sourceMappingURL=multipart.js.map",
|
|
135
|
+
"import * as internal from \"./internal/multipart.js\";\nexport const make = internal.make;\nexport const defaultIsFile = internal.defaultIsFile;\nexport const decodeField = internal.decodeField;\n//# sourceMappingURL=index.js.map",
|
|
136
|
+
"/**\n * Parses and persists HTTP `multipart/form-data` request bodies.\n *\n * `Multipart` turns incoming byte streams into typed {@link Part} values. Text\n * parts become decoded {@link Field} values, while upload parts remain streamed\n * {@link File} values until they are collected or written to scoped temporary\n * files. The persisted representation can then be decoded with schemas for\n * request handlers that receive fields and uploaded files together.\n *\n * **Mental model**\n *\n * Multipart parsing is incremental. {@link makeChannel} consumes request body\n * chunks and emits fields or files as soon as the parser reaches each part. A\n * `File` owns a one-shot byte stream for that upload; {@link toPersisted}\n * drains those file streams into scoped paths and collects text fields into a\n * {@link Persisted} record.\n *\n * **Common tasks**\n *\n * - Parse a request body stream into {@link Part} values with {@link makeChannel}.\n * - Persist parsed parts with {@link toPersisted} before schema decoding.\n * - Decode persisted forms with {@link schemaPersisted}, {@link schemaJson},\n * {@link PersistedFileSchema}, or {@link SingleFileSchema}.\n * - Configure parser limits with {@link limitsServices} or the `Max*` context\n * references.\n *\n * **Gotchas**\n *\n * Multipart request bodies are usually one-shot streams. Read each file stream\n * once, and use `contentEffect` only when the file is small enough to hold in\n * memory. Paths produced by {@link toPersisted} are scoped resources and stop\n * being valid when the scope closes. Client-provided file names are metadata,\n * not trusted filesystem paths.\n *\n * **See also**\n *\n * {@link Part}, {@link Field}, {@link File}, {@link Persisted},\n * {@link makeChannel}, {@link toPersisted}.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Cause from \"../../Cause.js\";\nimport * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { constant, dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Pull from \"../../Pull.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as UndefinedOr from \"../../UndefinedOr.js\";\nimport * as IncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as MP from \"./Multipasta.js\";\n/**\n * Type identifier used to brand multipart part values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/Multipart\";\n/**\n * Returns `true` when a value is a multipart `Part`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPart = u => Predicate.hasProperty(u, TypeId);\n/**\n * Returns `true` when a value is a multipart text `Field`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isField = u => isPart(u) && u._tag === \"Field\";\n/**\n * Returns `true` when a value is a multipart `File`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isFile = u => isPart(u) && u._tag === \"File\";\n/**\n * Returns `true` when a value is a persisted multipart file.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPersistedFile = u => Predicate.hasProperty(u, TypeId) && Predicate.isTagged(u, \"PersistedFile\");\nconst MultipartErrorTypeId = \"~effect/http/Multipart/MultipartError\";\n/**\n * Error reason carried by a `MultipartError`.\n *\n * **Details**\n *\n * It identifies parser and limit failures such as oversized files or fields, too\n * many parts, total body size limits, parse errors, and internal errors.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class MultipartErrorReason extends Data.Error {}\n/**\n * Error raised while parsing, streaming, or persisting multipart form data.\n *\n * **Details**\n *\n * The `reason` field contains the concrete `MultipartErrorReason`.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class MultipartError extends /*#__PURE__*/Data.TaggedError(\"MultipartError\") {\n /**\n * Creates a multipart error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new MultipartError({\n reason: new MultipartErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a multipart error for runtime guards.\n *\n * @since 4.0.0\n */\n [MultipartErrorTypeId] = MultipartErrorTypeId;\n /**\n * Uses the concrete multipart error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\n/**\n * Schema for persisted multipart files.\n *\n * **Details**\n *\n * The encoded form contains the field key, original file name, content type, and\n * filesystem path.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const PersistedFileSchema = /*#__PURE__*/Schema.declare(isPersistedFile, {\n typeConstructor: {\n _tag: \"effect/http/PersistedFile\"\n },\n generation: {\n runtime: `Multipart.PersistedFileSchema`,\n Type: `Multipart.PersistedFile`,\n importDeclaration: `import * as Multipart from \"effect/unstable/http/Multipart\"`\n },\n expected: \"PersistedFile\",\n toCodecJson: () => Schema.link()(Schema.Struct({\n key: Schema.String,\n name: Schema.String,\n contentType: Schema.String.annotate({\n contentEncoding: \"binary\"\n }),\n path: Schema.String\n }), Transformation.transform({\n decode: ({\n contentType,\n key,\n name,\n path\n }) => new PersistedFileImpl(key, name, contentType, path),\n encode: file => ({\n key: file.key,\n name: file.name,\n contentType: file.contentType,\n path: file.path\n })\n }))\n});\n/**\n * Schema for an array of persisted multipart files.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const FilesSchema = /*#__PURE__*/Schema.Array(PersistedFileSchema);\n/**\n * Schema for exactly one persisted multipart file.\n *\n * **Details**\n *\n * The encoded form is a one-element file array, while the decoded value is the\n * single `PersistedFile`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const SingleFileSchema = /*#__PURE__*/FilesSchema.check(Schema.isLengthBetween(1, 1)).pipe(/*#__PURE__*/Schema.decodeTo(PersistedFileSchema, /*#__PURE__*/Transformation.transform({\n decode: ([file]) => file,\n encode: file => [file]\n})));\n/**\n * Creates a decoder for persisted multipart data using the supplied schema.\n *\n * **Details**\n *\n * The returned function decodes an unknown input into the schema output and fails\n * with `SchemaError` when validation fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaPersisted = schema => Schema.decodeUnknownEffect(schema);\n/**\n * Creates a decoder for a JSON-encoded field in persisted multipart data.\n *\n * **Details**\n *\n * The selected field is parsed from a JSON string and decoded with the supplied\n * schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const fromJson = Schema.fromJsonString(schema);\n return dual(2, (persisted, field) => Effect.map(Schema.decodeUnknownEffect(Schema.Struct({\n [field]: fromJson\n }))(persisted, options), _ => _[field]));\n};\n/**\n * Builds the low-level multipart parser configuration from request headers and\n * the current fiber context.\n *\n * **Details**\n *\n * Parser limits are read from the multipart references, including maximum parts,\n * field size, file size, total body size, and field MIME type overrides.\n *\n * @category configuration\n * @since 4.0.0\n */\nexport const makeConfig = headers => Effect.withFiber(fiber => {\n const mimeTypes = Context.get(fiber.context, FieldMimeTypes);\n return Effect.succeed({\n headers,\n maxParts: fiber.getRef(MaxParts),\n maxFieldSize: Number(fiber.getRef(MaxFieldSize)),\n maxPartSize: UndefinedOr.map(fiber.getRef(MaxFileSize), Number),\n maxTotalSize: UndefinedOr.map(fiber.getRef(IncomingMessage.MaxBodySize), Number),\n isFile: mimeTypes.length === 0 ? undefined : info => !mimeTypes.some(_ => info.contentType.includes(_)) && MP.defaultIsFile(info)\n });\n});\n/**\n * Creates a channel that parses multipart byte chunks into multipart parts.\n *\n * **Details**\n *\n * The channel consumes non-empty batches of `Uint8Array` chunks and emits\n * non-empty batches of parsed `Part` values, failing with `MultipartError` for\n * parser and limit failures.\n *\n * @category Parsers\n * @since 4.0.0\n */\nexport const makeChannel = headers => Channel.fromTransform(upstream => Effect.map(makeConfig(headers), config => {\n let partsBuffer = [];\n let exit = Option.none();\n const parser = MP.make({\n ...config,\n onField(info, value) {\n partsBuffer.push(new FieldImpl(info.name, info.contentType, MP.decodeField(info, value)));\n },\n onFile(info) {\n let chunks = [];\n let finished = false;\n const pullChunks = Channel.fromPull(Effect.succeed(Effect.suspend(function loop() {\n if (!Arr.isReadonlyArrayNonEmpty(chunks)) {\n return finished ? Cause.done() : Effect.flatMap(pump, loop);\n }\n const chunk = chunks;\n chunks = [];\n return Effect.succeed(chunk);\n })));\n partsBuffer.push(new FileImpl(info, pullChunks));\n return function (chunk) {\n if (chunk === null) {\n finished = true;\n } else {\n chunks.push(chunk);\n }\n };\n },\n onError(error_) {\n exit = Option.some(Exit.fail(convertError(error_)));\n },\n onDone() {\n exit = Option.some(Exit.fail(Cause.Done()));\n }\n });\n const pump = upstream.pipe(Effect.flatMap(chunk => {\n for (let i = 0; i < chunk.length; i++) {\n parser.write(chunk[i]);\n }\n return Effect.void;\n }), Effect.catchCause(cause => {\n if (Pull.isDoneCause(cause)) {\n parser.end();\n } else {\n exit = Option.some(Exit.failCause(cause));\n }\n return Effect.void;\n }));\n return pump.pipe(Effect.flatMap(function loop() {\n if (!Arr.isReadonlyArrayNonEmpty(partsBuffer)) {\n if (Option.isSome(exit)) {\n return exit.value;\n }\n return Effect.flatMap(pump, loop);\n }\n const parts = partsBuffer;\n partsBuffer = [];\n return Effect.succeed(parts);\n }));\n}));\nfunction convertError(cause) {\n switch (cause._tag) {\n case \"ReachedLimit\":\n {\n switch (cause.limit) {\n case \"MaxParts\":\n {\n return MultipartError.fromReason(\"TooManyParts\", cause);\n }\n case \"MaxFieldSize\":\n {\n return MultipartError.fromReason(\"FieldTooLarge\", cause);\n }\n case \"MaxPartSize\":\n {\n return MultipartError.fromReason(\"FileTooLarge\", cause);\n }\n case \"MaxTotalSize\":\n {\n return MultipartError.fromReason(\"BodyTooLarge\", cause);\n }\n }\n }\n default:\n {\n return MultipartError.fromReason(\"Parse\", cause);\n }\n }\n}\nclass PartBase extends Inspectable.Class {\n [TypeId];\n constructor() {\n super();\n this[TypeId] = TypeId;\n }\n}\nclass FieldImpl extends PartBase {\n _tag = \"Field\";\n key;\n contentType;\n value;\n constructor(key, contentType, value) {\n super();\n this.key = key;\n this.contentType = contentType;\n this.value = value;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"Field\",\n key: this.key,\n contentType: this.contentType,\n value: this.value\n };\n }\n}\nclass FileImpl extends PartBase {\n _tag = \"File\";\n key;\n name;\n contentType;\n content;\n contentEffect;\n constructor(info, channel) {\n super();\n this.key = info.name;\n this.name = info.filename ?? info.name;\n this.contentType = info.contentType;\n this.content = Stream.fromChannel(channel);\n this.contentEffect = channel.pipe(collectUint8Array, Effect.mapError(cause => MultipartError.fromReason(\"InternalError\", cause)));\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"File\",\n key: this.key,\n name: this.name,\n contentType: this.contentType\n };\n }\n}\nconst defaultWriteFile = (path, file) => Effect.flatMap(FileSystem.FileSystem, fs => Effect.mapError(Stream.run(file.content, fs.sink(path)), cause => MultipartError.fromReason(\"InternalError\", cause)));\n/**\n * Runs a channel of byte chunks and collects all output into a single\n * `Uint8Array`.\n *\n * **Gotchas**\n *\n * This materializes the full content in memory.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const collectUint8Array = self => Channel.runFold(self, constant(new Uint8Array(0)), (accumulator, chunk) => {\n const totalLength = chunk.reduce((sum, element) => sum + element.length, accumulator.length);\n const newAccumulator = new Uint8Array(totalLength);\n newAccumulator.set(accumulator, 0);\n let offset = accumulator.length;\n for (const element of chunk) {\n newAccumulator.set(element, offset);\n offset += element.length;\n }\n return newAccumulator;\n});\n/**\n * Persists a stream of multipart parts into a record.\n *\n * **Details**\n *\n * Text fields are collected as strings, and file parts are written to files in a\n * scoped temporary directory.\n *\n * **Gotchas**\n *\n * Persisted file paths remain valid for the lifetime of the scope.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toPersisted = (stream, writeFile = defaultWriteFile) => Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path_ = yield* Path.Path;\n const dir = yield* fs.makeTempDirectoryScoped();\n const persisted = Object.create(null);\n yield* Stream.runForEach(stream, part => {\n if (part._tag === \"Field\") {\n if (!(part.key in persisted)) {\n persisted[part.key] = part.value;\n } else if (typeof persisted[part.key] === \"string\") {\n persisted[part.key] = [persisted[part.key], part.value];\n } else {\n ;\n persisted[part.key].push(part.value);\n }\n return Effect.void;\n } else if (part.name === \"\") {\n return Effect.void;\n }\n const file = part;\n const path = path_.join(dir, path_.basename(file.name).slice(-128));\n const filePart = new PersistedFileImpl(file.key, file.name, file.contentType, path);\n if (Array.isArray(persisted[part.key])) {\n ;\n persisted[part.key].push(filePart);\n } else {\n persisted[part.key] = [filePart];\n }\n return writeFile(path, file);\n });\n return persisted;\n}).pipe(Effect.catchTag(\"PlatformError\", cause => Effect.fail(MultipartError.fromReason(\"InternalError\", cause))));\nclass PersistedFileImpl extends PartBase {\n _tag = \"PersistedFile\";\n key;\n name;\n contentType;\n path;\n constructor(key, name, contentType, path) {\n super();\n this.key = key;\n this.name = name;\n this.contentType = contentType;\n this.path = path;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"PersistedFile\",\n key: this.key,\n name: this.name,\n contentType: this.contentType,\n path: this.path\n };\n }\n}\n/**\n * Creates a context containing multipart parser limit settings.\n *\n * **Details**\n *\n * The context can provide maximum part count, field size, file size, total body\n * size, and MIME types that should be parsed as fields.\n *\n * @category references\n * @since 4.0.0\n */\nexport const limitsServices = options => {\n const map = new Map();\n if (options.maxParts !== undefined) {\n map.set(MaxParts.key, options.maxParts);\n }\n if (options.maxFieldSize !== undefined) {\n map.set(MaxFieldSize.key, FileSystem.Size(options.maxFieldSize));\n }\n if (options.maxFileSize !== undefined) {\n map.set(MaxFileSize.key, UndefinedOr.map(options.maxFileSize, FileSystem.Size));\n }\n if (options.maxTotalSize !== undefined) {\n map.set(IncomingMessage.MaxBodySize.key, UndefinedOr.map(options.maxTotalSize, FileSystem.Size));\n }\n if (options.fieldMimeTypes !== undefined) {\n map.set(FieldMimeTypes.key, options.fieldMimeTypes);\n }\n return Context.makeUnsafe(map);\n};\n/**\n * Context reference for the maximum number of multipart parts allowed.\n *\n * **Details**\n *\n * The default is `undefined`, meaning no explicit part-count limit.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxParts = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxParts\", {\n defaultValue: () => undefined\n});\n/**\n * Context reference for the maximum size of a multipart field value.\n *\n * **Details**\n *\n * The default limit is 10 MiB.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxFieldSize = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxFieldSize\", {\n defaultValue: /*#__PURE__*/constant(/*#__PURE__*/FileSystem.Size(10 * 1024 * 1024))\n});\n/**\n * Context reference for the maximum size of a multipart file part.\n *\n * **Details**\n *\n * The default is `undefined`, meaning no explicit per-file limit.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxFileSize = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxFileSize\", {\n defaultValue: () => undefined\n});\n/**\n * Context reference for MIME type fragments that should be parsed as multipart\n * fields instead of files.\n *\n * **Details**\n *\n * The default treats `application/json` parts as fields.\n *\n * @category references\n * @since 4.0.0\n */\nexport const FieldMimeTypes = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/FieldMimeTypes\", {\n defaultValue: /*#__PURE__*/constant([\"application/json\"])\n});\n//# sourceMappingURL=Multipart.js.map",
|
|
137
|
+
"import * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Socket from \"../socket/Socket.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport { hasBody } from \"./HttpMethod.js\";\nimport { HttpServerError, RequestParseError } from \"./HttpServerError.js\";\nimport * as Multipart from \"./Multipart.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nexport {\n/**\n * Provides the `MaxBodySize` fiber reference for configuring request body limits.\n *\n * **When to use**\n *\n * Use to configure the maximum body size accepted while reading server\n * request bodies.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nMaxBodySize } from \"./HttpIncomingMessage.js\";\n/**\n * Runtime type identifier for `HttpServerRequest` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpServerRequest\";\n/**\n * Service tag for the active server-side HTTP request.\n *\n * **When to use**\n *\n * Use to access the request currently being handled by HTTP server routes and\n * middleware.\n *\n * @category context\n * @since 4.0.0\n */\nexport const HttpServerRequest = /*#__PURE__*/Context.Service(\"effect/http/HttpServerRequest\");\n/**\n * Service that contains decoded URL query parameters for the current request.\n *\n * **When to use**\n *\n * Use to access query parameters that have already been parsed for the current\n * server request.\n *\n * **Details**\n *\n * Each key maps to a string value, or to an array when the parameter appears more\n * than once.\n *\n * @category search params\n * @since 4.0.0\n */\nexport class ParsedSearchParams extends /*#__PURE__*/Context.Service()(\"effect/http/ParsedSearchParams\") {}\n/**\n * Converts a `URL` object's search parameters into a record.\n *\n * **Details**\n *\n * Repeated parameters are represented as arrays in insertion order.\n *\n * @category search params\n * @since 4.0.0\n */\nexport const searchParamsFromURL = url => {\n const out = {};\n for (const [key, value] of url.searchParams.entries()) {\n const entry = out[key];\n if (entry !== undefined) {\n if (Array.isArray(entry)) {\n entry.push(value);\n } else {\n out[key] = [entry, value];\n }\n } else {\n out[key] = value;\n }\n }\n return out;\n};\n/**\n * Creates a channel backed by the current request's upgraded socket.\n *\n * **Details**\n *\n * The channel reads incoming socket messages and writes byte chunks to the\n * socket, failing if the request cannot be upgraded or the socket fails.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const upgradeChannel = () => HttpServerRequest.pipe(Effect.flatMap(_ => _.upgrade), Effect.map(Socket.toChannelWith()), Channel.unwrap);\n/**\n * Decodes a schema from the cookies of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaCookies = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(HttpServerRequest, req => parse(req.cookies, options));\n};\n/**\n * Decodes a schema from the headers of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaHeaders = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(HttpServerRequest, req => parse(req.headers, options));\n};\n/**\n * Decodes a schema from the parsed search parameters of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaSearchParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(ParsedSearchParams, params => parse(params, options));\n};\n/**\n * Reads the current request body as JSON and decodes it with the supplied schema.\n *\n * **Details**\n *\n * The effect can fail if the body cannot be read or parsed, or if schema decoding\n * fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const parse = HttpIncomingMessage.schemaBodyJson(schema, options);\n return Effect.flatMap(HttpServerRequest, parse);\n};\nconst isMultipart = request => request.headers[\"content-type\"]?.toLowerCase().includes(\"multipart/form-data\") === true || getFormDataBody(request) !== undefined;\n/**\n * Decodes the current request body as form data.\n *\n * **Details**\n *\n * Multipart requests are persisted and decoded as multipart data; other form\n * requests are decoded from URL-encoded body parameters.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyForm = (schema, options) => {\n const parseMultipart = Multipart.schemaPersisted(schema);\n const parseUrlParams = HttpIncomingMessage.schemaBodyUrlParams(schema, options);\n return Effect.flatMap(HttpServerRequest, request => {\n if (isMultipart(request)) {\n return Effect.flatMap(request.multipart, _ => parseMultipart(_, options));\n }\n return parseUrlParams(request);\n });\n};\n/**\n * Reads the current request body as URL-encoded parameters and decodes them with\n * the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyUrlParams = (schema, options) => {\n const parse = HttpIncomingMessage.schemaBodyUrlParams(schema, options);\n return Effect.flatMap(HttpServerRequest, parse);\n};\n/**\n * Persists the current multipart request body and decodes it with the supplied\n * schema.\n *\n * **Details**\n *\n * The effect requires the services needed to persist multipart files, including a\n * scope, file system, and path service.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyMultipart = (schema, options) => {\n const parse = Multipart.schemaPersisted(schema);\n return HttpServerRequest.pipe(Effect.flatMap(_ => _.multipart), Effect.flatMap(_ => parse(_, options)));\n};\n/**\n * Creates a decoder for a JSON value stored in a form field.\n *\n * **Details**\n *\n * For multipart requests, the named multipart field is decoded as JSON. For\n * URL-encoded requests, the named parameter is decoded as JSON and then decoded\n * with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyFormJson = (schema, options) => {\n const parseMultipart = Multipart.schemaJson(schema, options);\n return field => {\n const parseUrlParams = UrlParams.schemaJsonField(field).pipe(Schema.decodeTo(schema), Schema.decodeEffect);\n return Effect.flatMap(HttpServerRequest, request => {\n if (isMultipart(request)) {\n return Effect.flatMap(Effect.mapError(request.multipart, cause => new HttpServerError({\n reason: new RequestParseError({\n request,\n cause\n })\n })), parseMultipart(field));\n }\n return Effect.flatMap(request.urlParamsBody, _ => parseUrlParams(_, options));\n });\n };\n};\n/**\n * Creates an `HttpServerRequest` view of an `HttpClientRequest`.\n *\n * **Details**\n *\n * If the client request can be converted to an absolute URL, that URL is used as\n * the original URL.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromClientRequest = request => {\n const url = Option.match(HttpClientRequest.toUrl(request), {\n onNone: () => request.url,\n onSome: url => url.toString()\n });\n return new ClientRequestImpl(request, url);\n};\n/**\n * Wraps a Web `Request` as an `HttpServerRequest`.\n *\n * **Details**\n *\n * The request's current URL is stored without the scheme and host, while the\n * original Web URL remains available as `originalUrl`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = request => new ServerRequestImpl(request, removeHost(request.url));\n/**\n * Converts an `HttpServerRequest` into an `HttpClientRequest`.\n *\n * **Details**\n *\n * The converted request preserves the method, headers, body stream, and a URL\n * derived from the request when possible.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toClientRequest = request => HttpClientRequest.setUrl(HttpClientRequest.makeWith(request.method, \"\", UrlParams.empty, Option.none(), request.headers, toClientBody(request)), Option.getOrElse(toURL(request), () => request.url));\nconst toClientBody = request => hasBody(request.method) ? HttpBody.stream(request.stream, request.headers[\"content-type\"], parseContentLength(request.headers[\"content-length\"])) : HttpBody.empty;\nconst parseContentLength = contentLength => {\n if (contentLength === undefined) {\n return undefined;\n }\n const parsed = Number.parseInt(contentLength, 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\nconst removeHost = url => {\n if (url[0] === \"/\") {\n return url;\n }\n const index = url.indexOf(\"/\", url.indexOf(\"//\") + 2);\n return index === -1 ? \"/\" : url.slice(index);\n};\nclass ServerRequestImpl extends Inspectable.Class {\n [TypeId];\n [HttpIncomingMessage.TypeId];\n source;\n url;\n headersOverride;\n remoteAddressOverride;\n constructor(source, url, headersOverride, remoteAddressOverride) {\n super();\n this[TypeId] = TypeId;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this.source = source;\n this.url = url;\n this.headersOverride = headersOverride;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpServerRequest\",\n method: this.method,\n url: this.originalUrl\n });\n }\n modify(options) {\n return new ServerRequestImpl(this.source, options.url ?? this.url, options.headers ?? this.headersOverride, \"remoteAddress\" in options ? options.remoteAddress : this.remoteAddressOverride);\n }\n get method() {\n return this.source.method.toUpperCase();\n }\n get originalUrl() {\n return this.source.url;\n }\n get remoteAddress() {\n return this.remoteAddressOverride ?? Option.none();\n }\n get headers() {\n this.headersOverride ??= Headers.fromInput(this.source.headers);\n return this.headersOverride;\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? \"\");\n }\n get stream() {\n return this.source.body ? Stream.fromReadableStream({\n evaluate: () => this.source.body,\n onError: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }) : Stream.fail(new HttpServerError({\n reason: new RequestParseError({\n request: this,\n description: \"can not create stream from empty body\"\n })\n }));\n }\n textEffect;\n get text() {\n if (this.textEffect) {\n return this.textEffect;\n }\n this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({\n try: () => this.source.text(),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n })));\n return this.textEffect;\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => JSON.parse(text),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }));\n }\n multipartEffect;\n get multipart() {\n if (this.multipartEffect) {\n return this.multipartEffect;\n }\n this.multipartEffect = Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)));\n return this.multipartEffect;\n }\n get multipartStream() {\n return Stream.pipeThroughChannel(Stream.mapError(this.stream, cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)), Multipart.makeChannel(this.headers));\n }\n arrayBufferEffect;\n get arrayBuffer() {\n if (this.arrayBufferEffect) {\n return this.arrayBufferEffect;\n }\n this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({\n try: () => this.source.arrayBuffer(),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n })));\n return this.arrayBufferEffect;\n }\n get upgrade() {\n return Effect.fail(new HttpServerError({\n reason: new RequestParseError({\n request: this,\n description: \"Not an upgradeable ServerRequest\"\n })\n }));\n }\n}\nclass ClientRequestImpl extends Inspectable.Class {\n [TypeId];\n [HttpIncomingMessage.TypeId];\n source;\n originalUrl;\n headersOverride;\n remoteAddressOverride;\n urlOverride;\n constructor(source, originalUrl, urlOverride, headersOverride, remoteAddressOverride) {\n super();\n this[TypeId] = TypeId;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this.source = source;\n this.originalUrl = originalUrl;\n this.urlOverride = urlOverride;\n this.headersOverride = headersOverride;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpServerRequest\",\n method: this.method,\n url: this.originalUrl\n });\n }\n modify(options) {\n return new ClientRequestImpl(this.source, this.originalUrl, options.url ?? this.url, options.headers ?? this.headersOverride, \"remoteAddress\" in options ? options.remoteAddress : this.remoteAddressOverride);\n }\n get method() {\n return this.source.method;\n }\n get url() {\n return this.urlOverride ?? removeHost(this.originalUrl);\n }\n get remoteAddress() {\n return this.remoteAddressOverride ?? Option.none();\n }\n get headers() {\n return this.headersOverride ??= this.source.headers;\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? \"\");\n }\n get stream() {\n const body = this.source.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Stream.empty;\n }\n case \"Uint8Array\":\n {\n return Stream.succeed(body.body);\n }\n case \"Stream\":\n {\n return Stream.mapError(body.stream, cause => requestParseError(this, undefined, cause));\n }\n case \"FormData\":\n {\n return streamFromReadable(this, new Response(body.formData).body);\n }\n case \"Raw\":\n {\n return rawBodyStream(this, body.body);\n }\n }\n }\n bytesEffect;\n get bytes() {\n if (this.bytesEffect) {\n return this.bytesEffect;\n }\n const body = this.source.body;\n let effect;\n switch (body._tag) {\n case \"Empty\":\n {\n effect = Effect.succeed(new Uint8Array(0));\n break;\n }\n case \"Uint8Array\":\n {\n effect = Effect.succeed(body.body);\n break;\n }\n case \"FormData\":\n {\n effect = bytesFromBodyInit(this, body.formData);\n break;\n }\n case \"Stream\":\n {\n effect = Stream.mkUint8Array(this.stream);\n break;\n }\n case \"Raw\":\n {\n effect = rawBodyBytes(this, body.body);\n break;\n }\n }\n this.bytesEffect = Effect.runSync(Effect.cached(effect));\n return this.bytesEffect;\n }\n get text() {\n return Effect.map(this.bytes, bytes => textDecoder.decode(bytes));\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => requestParseError(this, undefined, cause)\n }));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => requestParseError(this, undefined, cause)\n }));\n }\n multipartEffect;\n get multipart() {\n if (this.multipartEffect) {\n return this.multipartEffect;\n }\n this.multipartEffect = Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)));\n return this.multipartEffect;\n }\n get multipartStream() {\n const formData = this.source.body._tag === \"FormData\" && this.source.body.formData;\n if (formData) {\n return Stream.fromIterable(formDataToParts(formData));\n }\n return Stream.pipeThroughChannel(Stream.mapError(this.stream, cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)), Multipart.makeChannel(this.headers));\n }\n get arrayBuffer() {\n return Effect.map(this.bytes, bytes => bytes.slice().buffer);\n }\n get upgrade() {\n return Effect.fail(requestParseError(this, \"Not an upgradeable ServerRequest\"));\n }\n}\nconst getFormDataBody = request => {\n if (!HttpClientRequest.isHttpClientRequest(request.source)) {\n return undefined;\n }\n const body = request.source.body;\n if (body._tag === \"FormData\") {\n return body.formData;\n }\n if (body._tag === \"Raw\" && isFormData(body.body)) {\n return body.body;\n }\n return undefined;\n};\nconst rawBodyStream = (request, body) => {\n if (body instanceof Request) {\n return streamFromReadable(request, body.body);\n }\n if (isFormData(body)) {\n return streamFromReadable(request, new Response(body).body);\n }\n if (isReadableStream(body)) {\n return streamFromReadable(request, body);\n }\n return Stream.fail(requestParseError(request, \"Unsupported body type\"));\n};\nconst rawBodyBytes = (request, body) => {\n if (body instanceof Blob) {\n return bytesFromBodyInit(request, body);\n }\n if (body instanceof Request) {\n return Effect.tryPromise({\n try: () => body.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => requestParseError(request, undefined, cause)\n });\n }\n return Effect.fail(requestParseError(request, \"Unsupported body type\"));\n};\nconst bytesFromBodyInit = (request, body) => Effect.tryPromise({\n try: () => new Response(body).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => requestParseError(request, undefined, cause)\n});\nconst streamFromReadable = (request, body) => body ? Stream.fromReadableStream({\n evaluate: () => body,\n onError: cause => requestParseError(request, undefined, cause)\n}) : Stream.empty;\nconst requestParseError = (request, description, cause) => new HttpServerError({\n reason: new RequestParseError({\n request,\n ...(description === undefined ? undefined : {\n description\n }),\n ...(cause === undefined ? undefined : {\n cause\n })\n })\n});\nconst formDataToParts = formData => {\n const parts = [];\n for (const [key, value] of formData.entries()) {\n parts.push(typeof value === \"string\" ? new MultipartFieldPart(key, value) : new MultipartFilePart(key, value));\n }\n return parts;\n};\nclass MultipartFieldPart extends Inspectable.Class {\n [Multipart.TypeId];\n _tag = \"Field\";\n contentType = \"text/plain\";\n key;\n value;\n constructor(key, value) {\n super();\n this[Multipart.TypeId] = Multipart.TypeId;\n this.key = key;\n this.value = value;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"Field\",\n key: this.key,\n contentType: this.contentType,\n value: this.value\n };\n }\n}\nclass MultipartFilePart extends Inspectable.Class {\n [Multipart.TypeId];\n _tag = \"File\";\n key;\n name;\n contentType;\n content;\n contentEffect;\n constructor(key, file) {\n super();\n this[Multipart.TypeId] = Multipart.TypeId;\n this.key = key;\n this.name = file.name;\n this.contentType = file.type;\n this.content = Stream.fromReadableStream({\n evaluate: () => file.stream(),\n onError: cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)\n });\n this.contentEffect = Effect.tryPromise({\n try: () => file.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)\n });\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"File\",\n key: this.key,\n name: this.name,\n contentType: this.contentType\n };\n }\n}\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\nconst isFormData = u => typeof FormData !== \"undefined\" && u instanceof FormData;\nconst textDecoder = /*#__PURE__*/new TextDecoder();\n/**\n * Attempts to construct an absolute `URL` for a server request safely.\n *\n * **Details**\n *\n * The host comes from the `host` header, defaulting to `localhost`, and the\n * protocol is `https` only when `x-forwarded-proto` is `https`; invalid URLs\n * return `Option.none`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toURL = self => {\n const host = self.headers.host ?? \"localhost\";\n const protocol = self.headers[\"x-forwarded-proto\"] === \"https\" ? \"https\" : \"http\";\n try {\n return Option.some(new URL(self.url, `${protocol}://${host}`));\n } catch {\n return Option.none();\n }\n};\n/**\n * Converts an `HttpServerRequest` safely to a Web `Request` as a `Result`.\n *\n * **Details**\n *\n * If the source is already a Web `Request`, it is returned unchanged. Otherwise\n * an absolute URL is derived from the request; invalid URLs fail with a\n * `RequestParseError`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebResult = (self, options) => {\n if (self.source instanceof Request) {\n return Result.succeed(self.source);\n }\n const url = toURL(self);\n if (Option.isNone(url)) {\n return Result.fail(new RequestParseError({\n request: self,\n description: \"Invalid URL\"\n }));\n }\n const requestInit = {\n method: self.method,\n headers: self.headers\n };\n if (options?.signal) {\n requestInit.signal = options.signal;\n }\n if (hasBody(self.method)) {\n requestInit.body = Stream.toReadableStreamWith(self.stream, options?.context ?? Context.empty());\n requestInit.duplex = \"half\";\n }\n return Result.succeed(new Request(url.value, requestInit));\n};\n/**\n * Converts an `HttpServerRequest` to a Web `Request` in `Effect`.\n *\n * **Details**\n *\n * The current context is used when streaming the request body into the Web\n * request.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (self, options) => Effect.contextWith(context => Effect.fromResult(toWebResult(self, {\n context,\n signal: options?.signal\n})));\n//# sourceMappingURL=HttpServerRequest.js.map",
|
|
138
|
+
"import * as Effect from \"../../../Effect.js\";\n/** @internal */\nexport const requestPreResponseHandlers = /*#__PURE__*/new WeakMap();\n/** @internal */\nexport const appendPreResponseHandlerUnsafe = (request, handler) => {\n const prev = requestPreResponseHandlers.get(request.source);\n const next = prev ? (request, response) => Effect.flatMap(prev(request, response), response => handler(request, response)) : handler;\n requestPreResponseHandlers.set(request.source, next);\n};\n//# sourceMappingURL=preResponseHandler.js.map",
|
|
139
|
+
"/**\n * Server-side HTTP middleware for wrapping `HttpServerResponse` effects with\n * cross-cutting request and response behavior.\n *\n * A middleware is a function from one HTTP server app effect to another. The app\n * is evaluated with the current `HttpServerRequest` service in its context, so\n * middleware in this module can inspect or rewrite the request, provide\n * request-scoped services, attach pre-response hooks, or observe the app exit\n * while preserving normal Effect error and interruption semantics.\n *\n * Use this module for common server concerns such as access logging, trace span\n * creation, trusting forwarded proxy headers, parsing search parameters, and\n * adding CORS handling. Middleware can be applied directly when serving an\n * `HttpServer` / `HttpEffect` app or registered through `HttpRouter.middleware`\n * for route-scoped or global behavior.\n *\n * Middleware composition is order-sensitive, and each middleware may change the\n * wrapped effect's requirements or error channel. These functions expect a\n * per-request `HttpServerRequest` to be present; context-providing middleware\n * should wrap handlers before they access the provided service, and\n * error-handling middleware should be installed where its transformed error type\n * matches the surrounding app or router registration.\n *\n * @since 4.0.0\n */\nimport { Clock } from \"../../Clock.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { constant, constFalse } from \"../../Function.js\";\nimport * as internalEffect from \"../../internal/effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport { TracerEnabled } from \"../../References.js\";\nimport { ParentSpan } from \"../../Tracer.js\";\nimport * as Headers from \"./Headers.js\";\nimport { causeResponseStripped, exitResponse } from \"./HttpServerError.js\";\nimport { HttpServerRequest } from \"./HttpServerRequest.js\";\nimport * as Request from \"./HttpServerRequest.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport * as TraceContext from \"./HttpTraceContext.js\";\nimport { appendPreResponseHandlerUnsafe } from \"./internal/preResponseHandler.js\";\n/**\n * Defines an `HttpMiddleware` while preserving its precise type.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = middleware => middleware;\nconst loggerDisabledRequests = /*#__PURE__*/new WeakSet();\nconst stripSearchAndHash = url => {\n const queryIndex = url.indexOf(\"?\");\n const hashIndex = url.indexOf(\"#\");\n if (queryIndex === -1) {\n return hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n if (hashIndex === -1) {\n return url.slice(0, queryIndex);\n }\n return url.slice(0, Math.min(queryIndex, hashIndex));\n};\n/**\n * Runs an effect with HTTP response logging disabled for the current server request.\n *\n * @category Logger\n * @since 4.0.0\n */\nexport const withLoggerDisabled = self => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n loggerDisabledRequests.add(request.source);\n return self;\n});\n/**\n * Context reference for a predicate that disables server-side tracing for matching requests.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const TracerDisabledWhen = /*#__PURE__*/Context.Reference(\"effect/http/HttpMiddleware/TracerDisabledWhen\", {\n defaultValue: () => constFalse\n});\n/**\n * Creates a layer that disables server-side tracing for requests whose URL exactly matches one of the supplied URLs.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const layerTracerDisabledForUrls = urls => Layer.succeed(TracerDisabledWhen)(req => urls.includes(req.url));\n/**\n * Context reference for generating server span names from HTTP server requests.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const SpanNameGenerator = /*#__PURE__*/Context.Reference(\"@effect/platform/HttpMiddleware/SpanNameGenerator\", {\n defaultValue: () => request => `http.server ${request.method}`\n});\n/**\n * Middleware that logs sent HTTP responses with request method, request URL, and response status annotations.\n *\n * @category Logger\n * @since 4.0.0\n */\nexport const logger = /*#__PURE__*/make(httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const path = stripSearchAndHash(request.url);\n return Effect.withLogSpan(Effect.flatMap(Effect.exit(httpApp), exit => {\n if (loggerDisabledRequests.has(request.source)) {\n return exit;\n } else if (exit._tag === \"Failure\") {\n const [response, cause] = causeResponseStripped(exit.cause);\n return Effect.andThen(Effect.annotateLogs(Effect.log(Option.getOrElse(cause, () => \"Sent HTTP Response\")), {\n \"http.method\": request.method,\n \"http.url\": path,\n \"http.status\": response.status\n }), exit);\n }\n return Effect.andThen(Effect.annotateLogs(Effect.log(\"Sent HTTP response\"), {\n \"http.method\": request.method,\n \"http.url\": path,\n \"http.status\": exit.value.status\n }), exit);\n }), \"http.span\");\n}));\n/**\n * Middleware that creates a server trace span for each request and records request and response HTTP attributes.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const tracer = /*#__PURE__*/make(httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const disabled = !fiber.getRef(TracerEnabled) || fiber.getRef(TracerDisabledWhen)(request);\n if (disabled) {\n return httpApp;\n }\n const nameGenerator = fiber.getRef(SpanNameGenerator);\n const span = internalEffect.makeSpanUnsafe(fiber, nameGenerator(request), {\n parent: Option.getOrUndefined(TraceContext.fromHeaders(request.headers)),\n kind: \"server\"\n });\n const prevServices = fiber.context;\n fiber.setContext(Context.add(fiber.context, ParentSpan, span));\n return Effect.onExitPrimitive(httpApp, exit => {\n fiber.setContext(prevServices);\n const endTime = fiber.getRef(Clock).currentTimeNanosUnsafe();\n fiber.currentDispatcher.scheduleTask(() => {\n const url = Request.toURL(request);\n if (Option.isSome(url) && (url.value.username !== \"\" || url.value.password !== \"\")) {\n url.value.username = \"REDACTED\";\n url.value.password = \"REDACTED\";\n }\n const redactedHeaderNames = fiber.getRef(Headers.CurrentRedactedNames);\n const requestHeaders = Headers.redact(request.headers, redactedHeaderNames);\n span.attribute(\"http.request.method\", request.method);\n if (Option.isSome(url)) {\n span.attribute(\"url.full\", url.value.toString());\n span.attribute(\"url.path\", url.value.pathname);\n const query = url.value.search.slice(1);\n if (query !== \"\") {\n span.attribute(\"url.query\", url.value.search.slice(1));\n }\n span.attribute(\"url.scheme\", url.value.protocol.slice(0, -1));\n }\n if (request.headers[\"user-agent\"] !== undefined) {\n span.attribute(\"user_agent.original\", request.headers[\"user-agent\"]);\n }\n for (const name in requestHeaders) {\n span.attribute(`http.request.header.${name}`, String(requestHeaders[name]));\n }\n if (Option.isSome(request.remoteAddress)) {\n span.attribute(\"client.address\", request.remoteAddress.value);\n }\n const response = exitResponse(exit);\n span.attribute(\"http.response.status_code\", response.status);\n const responseHeaders = Headers.redact(response.headers, redactedHeaderNames);\n for (const name in responseHeaders) {\n span.attribute(`http.response.header.${name}`, String(responseHeaders[name]));\n }\n span.end(endTime, exit);\n }, 0);\n return undefined;\n }, true);\n}));\n/**\n * Middleware that trusts `X-Forwarded-Host` and `X-Forwarded-For`, updating the request host header and remote address.\n *\n * @category Proxying\n * @since 4.0.0\n */\nexport const xForwardedHeaders = /*#__PURE__*/make(httpApp => Effect.updateService(httpApp, HttpServerRequest, request => request.headers[\"x-forwarded-host\"] ? request.modify({\n headers: Headers.set(request.headers, \"host\", request.headers[\"x-forwarded-host\"]),\n remoteAddress: Option.fromNullishOr(request.headers[\"x-forwarded-for\"]?.split(\",\")[0].trim())\n}) : request));\n/**\n * Middleware that parses the current request URL's search parameters and provides them as `ParsedSearchParams`.\n *\n * @category search params\n * @since 4.0.0\n */\nexport const searchParamsParser = httpApp => Effect.withFiber(fiber => {\n const services = fiber.context;\n const request = Context.getUnsafe(services, HttpServerRequest);\n const params = Request.searchParamsFromURL(new URL(request.originalUrl));\n return Effect.provideService(httpApp, Request.ParsedSearchParams, params);\n});\n/**\n * Middleware that handles CORS preflight requests and adds configured CORS headers to HTTP responses.\n *\n * @category CORS\n * @since 4.0.0\n */\nexport const cors = options => {\n const opts = {\n allowedOrigins: options?.allowedOrigins ?? [],\n allowedMethods: options?.allowedMethods ?? [\"GET\", \"HEAD\", \"PUT\", \"PATCH\", \"POST\", \"DELETE\"],\n allowedHeaders: options?.allowedHeaders ?? [],\n exposedHeaders: options?.exposedHeaders ?? [],\n credentials: options?.credentials ?? false,\n maxAge: options?.maxAge\n };\n const isAllowedOrigin = typeof opts.allowedOrigins === \"function\" ? opts.allowedOrigins : origin => opts.allowedOrigins.includes(origin);\n const allowOrigin = typeof opts.allowedOrigins === \"function\" || opts.allowedOrigins.length > 1 ? originHeader => {\n if (!isAllowedOrigin(originHeader)) return undefined;\n return {\n \"access-control-allow-origin\": originHeader,\n vary: \"Origin\"\n };\n } : opts.allowedOrigins.length === 0 ? constant({\n \"access-control-allow-origin\": \"*\"\n }) : constant({\n \"access-control-allow-origin\": opts.allowedOrigins[0],\n vary: \"Origin\"\n });\n const allowMethods = opts.allowedMethods.length > 0 ? {\n \"access-control-allow-methods\": opts.allowedMethods.join(\", \")\n } : undefined;\n const allowCredentials = opts.credentials ? {\n \"access-control-allow-credentials\": \"true\"\n } : undefined;\n const allowHeaders = accessControlRequestHeaders => {\n if (opts.allowedHeaders.length === 0 && accessControlRequestHeaders) {\n return {\n vary: \"Access-Control-Request-Headers\",\n \"access-control-allow-headers\": accessControlRequestHeaders\n };\n }\n if (opts.allowedHeaders) {\n return {\n \"access-control-allow-headers\": opts.allowedHeaders.join(\",\")\n };\n }\n return undefined;\n };\n const exposeHeaders = opts.exposedHeaders.length > 0 ? {\n \"access-control-expose-headers\": opts.exposedHeaders.join(\",\")\n } : undefined;\n const maxAge = opts.maxAge ? {\n \"access-control-max-age\": opts.maxAge.toString()\n } : undefined;\n const headersFromRequest = request => {\n const origin = request.headers[\"origin\"];\n return Headers.fromRecordUnsafe({\n ...allowOrigin(origin),\n ...allowCredentials,\n ...exposeHeaders\n });\n };\n const headersFromRequestOptions = request => {\n const origin = request.headers[\"origin\"];\n const accessControlRequestHeaders = request.headers[\"access-control-request-headers\"];\n return Headers.fromRecordUnsafe({\n ...allowOrigin(origin),\n ...allowCredentials,\n ...exposeHeaders,\n ...allowMethods,\n ...allowHeaders(accessControlRequestHeaders),\n ...maxAge\n });\n };\n const preResponseHandler = (request, response) => Effect.succeed(Response.setHeaders(response, headersFromRequest(request)));\n return httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n if (request.method === \"OPTIONS\") {\n return Effect.succeed(Response.empty({\n status: 204,\n headers: headersFromRequestOptions(request)\n }));\n }\n appendPreResponseHandlerUnsafe(request, preResponseHandler);\n return httpApp;\n });\n};\n//# sourceMappingURL=HttpMiddleware.js.map",
|
|
140
|
+
"import * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport { dual } from \"../../Function.js\";\nimport { reportCauseUnsafe } from \"../../internal/effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Scope from \"../../Scope.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport { tracer } from \"./HttpMiddleware.js\";\nimport { causeResponse, ClientAbort, HttpServerError, InternalError } from \"./HttpServerError.js\";\nimport { HttpServerRequest } from \"./HttpServerRequest.js\";\nimport * as Request from \"./HttpServerRequest.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport { appendPreResponseHandlerUnsafe, requestPreResponseHandlers } from \"./internal/preResponseHandler.js\";\n/**\n * Runs an HTTP server effect, sends the produced response with the supplied handler, and converts failures into HTTP responses.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toHandled = (self, handleResponse, middleware) => {\n const handleCause = cause => Effect.flatMapEager(causeResponse(cause), ([response, cause]) => {\n const fiber = Fiber.getCurrent();\n reportCauseUnsafe(fiber, cause);\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const handler = requestPreResponseHandlers.get(request.source);\n const cont = cause.reasons.length === 0 ? Effect.succeed(response) : Effect.failCause(cause);\n if (handler === undefined) {\n ;\n request[handledSymbol] = true;\n return Effect.flatMapEager(handleResponse(request, response), () => cont);\n }\n return Effect.flatMapEager(Effect.flatMapEager(handler(request, response), response => {\n ;\n request[handledSymbol] = true;\n return handleResponse(request, response);\n }), () => cont);\n });\n const responded = Effect.matchCauseEffect(self, {\n onSuccess: response => {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const handler = requestPreResponseHandlers.get(request.source);\n if (handler === undefined) {\n ;\n request[handledSymbol] = true;\n return Effect.mapEager(handleResponse(request, response), () => response);\n }\n return Effect.flatMapEager(handler(request, response), sentResponse => {\n ;\n request[handledSymbol] = true;\n return Effect.mapEager(handleResponse(request, sentResponse), () => response);\n });\n },\n onFailure: handleCause\n });\n const withMiddleware = middleware === undefined ? tracer(responded) : Effect.matchCauseEffect(tracer(middleware(responded)), {\n onFailure(cause) {\n const fiber = Fiber.getCurrent();\n reportCauseUnsafe(fiber, cause);\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n if (handledSymbol in request) return Effect.void;\n return Effect.matchCauseEffectEager(causeResponse(cause), {\n onFailure(_) {\n return handleResponse(request, Response.empty({\n status: 500\n }));\n },\n onSuccess([response]) {\n return handleResponse(request, response);\n }\n });\n },\n onSuccess(response) {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, Request.HttpServerRequest);\n return handledSymbol in request ? Effect.void : handleResponse(request, response);\n }\n });\n return Effect.uninterruptible(scoped(withMiddleware));\n};\nconst handledSymbol = /*#__PURE__*/Symbol.for(\"effect/http/HttpEffect/handled\");\n/**\n * Disables automatic closing for an HTTP request scope.\n *\n * **Gotchas**\n *\n * Use only when another owner will close the scope; otherwise resources attached\n * to the request scope can leak.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const scopeDisableClose = scope => {\n ;\n scope[scopeEjected] = true;\n};\n/**\n * Returns a streaming server response that closes the request scope when the body stream exits.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const scopeTransferToStream = response => {\n if (response.body._tag !== \"Stream\") {\n return response;\n }\n const fiber = Fiber.getCurrent();\n const scope = Context.getUnsafe(fiber.context, Scope.Scope);\n scopeDisableClose(scope);\n return Response.setBody(response, HttpBody.stream(Stream.onExit(response.body.stream, exit => Scope.close(scope, exit)), response.body.contentType, response.body.contentLength));\n};\nconst scopeEjected = /*#__PURE__*/Symbol.for(\"effect/http/HttpEffect/scopeEjected\");\nconst scoped = effect => Effect.withFiber(fiber => {\n const scope = Scope.makeUnsafe();\n const prevServices = fiber.context;\n fiber.setContext(Context.add(fiber.context, Scope.Scope, scope));\n return Effect.onExitPrimitive(effect, exit => {\n fiber.setContext(prevServices);\n if (scopeEjected in scope) return undefined;\n return Scope.closeUnsafe(scope, exit);\n }, true);\n});\n/**\n * Registers an additional pre-response handler for the current HTTP server request.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const appendPreResponseHandler = handler => HttpServerRequest.use(request => {\n appendPreResponseHandlerUnsafe(request, handler);\n return Effect.void;\n});\nexport {\n/**\n * Registers a pre-response handler for the supplied HTTP server request.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nappendPreResponseHandlerUnsafe };\n/**\n * Runs an effect after registering a pre-response handler for the current HTTP server request.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const withPreResponseHandler = /*#__PURE__*/dual(2, (self, handler) => HttpServerRequest.use(request => {\n appendPreResponseHandlerUnsafe(request, handler);\n return self;\n}));\n/**\n * Converts an HTTP server effect into a Web `Request` handler using the supplied base context and optional middleware.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerWith = context => (self, middleware) => {\n const resolveSymbol = Symbol.for(\"@effect/platform/HttpApp/resolve\");\n const httpApp = toHandled(self, (request, response) => {\n response = scopeTransferToStream(response);\n request[resolveSymbol](Response.toWeb(response, {\n withoutBody: request.method === \"HEAD\",\n context\n }));\n return Effect.void;\n }, middleware);\n return (request, reqContext) => new Promise(resolve => {\n const contextMap = new Map(context.mapUnsafe);\n if (Context.isContext(reqContext)) {\n for (const [key, value] of reqContext.mapUnsafe) {\n contextMap.set(key, value);\n }\n }\n const httpServerRequest = Request.fromWeb(request);\n contextMap.set(HttpServerRequest.key, httpServerRequest);\n httpServerRequest[resolveSymbol] = resolve;\n const fiber = Effect.runForkWith(Context.makeUnsafe(contextMap))(httpApp);\n request.signal?.addEventListener(\"abort\", () => {\n fiber.interruptUnsafe(undefined, ClientAbort.annotation);\n }, {\n once: true\n });\n });\n};\n/**\n * Converts an HTTP server effect into a Web `Request` handler using an empty base context.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandler = /*#__PURE__*/toWebHandlerWith(/*#__PURE__*/Context.empty());\n/**\n * Builds a Web `Request` handler from a layer and handler factory, returning the handler with a `dispose` function for the layer scope.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerLayerWith = (layer, options) => {\n const scope = Scope.makeUnsafe();\n const dispose = () => Effect.runPromise(Scope.close(scope, Exit.void));\n let handlerCache;\n let handlerPromise;\n function handler(request, context) {\n if (handlerCache) {\n return handlerCache(request, context);\n }\n handlerPromise ??= Effect.runPromise(Effect.gen(function* () {\n const context = yield* options.memoMap ? Layer.buildWithMemoMap(layer, options.memoMap, scope) : Layer.buildWithScope(layer, scope);\n return handlerCache = toWebHandlerWith(context)(yield* options.toHandler(context), options.middleware);\n }));\n return handlerPromise.then(f => f(request, context));\n }\n return {\n dispose,\n handler: handler\n };\n};\n/**\n * Builds a Web `Request` handler for an HTTP server effect using a layer to provide its services, returning the handler with a `dispose` function.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerLayer = (self, layer, options) => toWebHandlerLayerWith(layer, {\n ...options,\n toHandler: () => Effect.succeed(self)\n});\n/**\n * Adapts a Web `Request` handler into an HTTP server effect for the current `HttpServerRequest`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWebHandler = handler => Effect.callback((resume, signal) => {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const requestResult = Request.toWebResult(request, {\n signal,\n context: fiber.context\n });\n if (requestResult._tag === \"Failure\") {\n return resume(Effect.fail(new HttpServerError({\n reason: requestResult.failure\n })));\n }\n handler(requestResult.success).then(response => resume(Effect.succeed(Response.fromWeb(response))), cause => resume(Effect.fail(new HttpServerError({\n reason: new InternalError({\n cause,\n request,\n description: \"HttpApp.fromWebHandler: Error in handler\"\n })\n }))));\n});\n//# sourceMappingURL=HttpEffect.js.map",
|
|
141
|
+
"/**\n * Layer-based server-side routing for Effect HTTP applications.\n *\n * `HttpRouter` collects routes and router middleware while an application layer\n * is being built, then exposes the registered route table as an\n * `HttpServerResponse` effect for each incoming `HttpServerRequest`. Use it for\n * APIs, webhooks, and Fetch handlers that want request-scoped services, schema\n * decoding, and typed middleware to participate in the same `Layer` graph as\n * the rest of the application.\n *\n * **Mental model**\n *\n * Route layers do not handle requests immediately. They register `Route` values\n * into the current `HttpRouter`; `serve`, `toHttpEffect`, and `toWebHandler`\n * build the layer, read the completed router, and run the matching handler for\n * each request. During a request, the router provides `HttpServerRequest`,\n * `Scope`, parsed search parameters, and `RouteContext`, so handlers can decode\n * path, search, and body data or access services supplied by router middleware.\n *\n * **Common tasks**\n *\n * - Register individual routes with `add` or batches with `addAll`.\n * - Group routes under a prefix with `addAll(..., { prefix })` or\n * `router.prefixed`.\n * - Decode route, search, and JSON body data with `schemaPathParams`,\n * `schemaParams`, `schemaNoBody`, and `schemaJson`.\n * - Apply route-scoped middleware with `middleware(...).layer`, or install\n * global router middleware for all routes.\n * - Serve the layer with `serve` or create a Fetch-compatible handler with\n * `toWebHandler`.\n *\n * **Gotchas**\n *\n * Paths must be absolute `/` paths or the wildcard `*`. `HEAD` falls back to\n * `GET`, and wildcard paths ending in `/*` also match the prefix path itself.\n * For prefixed routes the matched prefix is removed from\n * `HttpServerRequest.url` before the handler sees it. Middleware passed to\n * `serve` wraps the wider server chain; use router middleware when you need to\n * provide request dependencies, handle configured route errors, or change the\n * response that will be sent.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { compose, dual, identity } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Scope from \"../../Scope.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as FindMyWay from \"./FindMyWay.js\";\nimport * as HttpEffect from \"./HttpEffect.js\";\nimport * as HttpMiddleware from \"./HttpMiddleware.js\";\nimport * as HttpServer from \"./HttpServer.js\";\nimport * as HttpServerError from \"./HttpServerError.js\";\nimport * as HttpServerRequest from \"./HttpServerRequest.js\";\nimport * as HttpServerResponse from \"./HttpServerResponse.js\";\nconst TypeId = \"~effect/http/HttpRouter\";\n/**\n * Service tag for the HTTP router used while constructing an HTTP application.\n * Route and middleware layers require this service to register themselves with\n * the router.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const HttpRouter = /*#__PURE__*/Context.Service(\"effect/http/HttpRouter\");\n/**\n * Constructs an empty `HttpRouter` service.\n *\n * **Details**\n *\n * The returned router accepts route and middleware registrations and later routes\n * the current `HttpServerRequest` to the matching `HttpServerResponse`.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.gen(function* () {\n const router = FindMyWay.make(yield* RouterConfig);\n const middleware = new Set();\n const addAll = routes => Effect.contextWith(context => {\n const middleware = getMiddleware(context);\n const applyMiddleware = effect => {\n for (let i = 0; i < middleware.length; i++) {\n effect = middleware[i](effect);\n }\n return effect;\n };\n for (let i = 0; i < routes.length; i++) {\n const route = middleware.length === 0 ? routes[i] : makeRoute({\n ...routes[i],\n handler: applyMiddleware(routes[i].handler)\n });\n if (route.method === \"*\") {\n if (route.path.endsWith(\"/*\")) {\n router.all(route.path, route);\n router.all(route.path.slice(0, -2), route);\n } else {\n router.all(route.path, route);\n }\n } else {\n if (route.path.endsWith(\"/*\")) {\n router.on(route.method, route.path, route);\n router.on(route.method, route.path.slice(0, -2), route);\n } else {\n router.on(route.method, route.path, route);\n }\n }\n }\n return Effect.void;\n });\n return HttpRouter.of({\n [TypeId]: TypeId,\n prefixed(prefix) {\n return HttpRouter.of({\n ...this,\n prefixed: newPrefix => this.prefixed(prefixPath(prefix, newPrefix)),\n addAll: routes => addAll(routes.map(prefixRoute(prefix))),\n add: (method, path, handler, options) => addAll([makeRoute({\n method,\n path: prefixPath(path, prefix),\n handler: HttpServerResponse.isHttpServerResponse(handler) ? Effect.succeed(handler) : Effect.isEffect(handler) ? handler : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),\n uninterruptible: options?.uninterruptible ?? false,\n prefix\n })])\n });\n },\n addAll,\n add: (method, path, handler, options) => addAll([route(method, path, handler, options)]),\n addGlobalMiddleware: middleware_ => Effect.sync(() => {\n middleware.add(middleware_);\n }),\n asHttpEffect() {\n let handler = Effect.withFiber(fiber => {\n const contextMap = new Map(fiber.context.mapUnsafe);\n const request = contextMap.get(HttpServerRequest.HttpServerRequest.key);\n let result = router.find(request.method, request.url);\n if (result === undefined && request.method === \"HEAD\") {\n result = router.find(\"GET\", request.url);\n }\n if (result === undefined) {\n return Effect.fail(new HttpServerError.HttpServerError({\n reason: new HttpServerError.RouteNotFound({\n request\n })\n }));\n }\n const route = result.handler;\n if (Option.isSome(route.prefix)) {\n contextMap.set(HttpServerRequest.HttpServerRequest.key, sliceRequestUrl(request, route.prefix.value));\n }\n contextMap.set(HttpServerRequest.ParsedSearchParams.key, result.searchParams);\n contextMap.set(RouteContext.key, {\n route,\n params: result.params\n });\n const span = contextMap.get(Tracer.ParentSpan.key);\n if (span && span._tag === \"Span\") {\n span.attribute(\"http.route\", route.path);\n }\n return Effect.provideContext(route.uninterruptible ? route.handler : Effect.interruptible(route.handler), Context.makeUnsafe(contextMap));\n });\n if (middleware.size === 0) return handler;\n for (const fn of Arr.reverse(middleware)) {\n handler = fn(handler);\n }\n return handler;\n }\n });\n});\nfunction sliceRequestUrl(request, prefix) {\n const prefexLen = prefix.length;\n return request.modify({\n url: request.url.length <= prefexLen ? \"/\" : request.url.slice(prefexLen)\n });\n}\n/**\n * Context reference for low-level router configuration.\n *\n * **Details**\n *\n * The value is passed to the route matcher when an `HttpRouter` is created and\n * defaults to an empty configuration.\n *\n * @category configuration\n * @since 4.0.0\n */\nexport const RouterConfig = /*#__PURE__*/Context.Reference(\"effect/http/HttpRouter/RouterConfig\", {\n defaultValue: () => ({})\n});\n/**\n * Service for the matched HTTP route in the current request.\n *\n * **When to use**\n *\n * Use to read captured path parameters and route metadata while handling a\n * request matched by the router.\n *\n * **Details**\n *\n * It provides the route definition and the path parameters captured by the route\n * matcher.\n *\n * @category services\n * @since 4.0.0\n */\nexport class RouteContext extends /*#__PURE__*/Context.Service()(\"effect/http/HttpRouter/RouteContext\") {}\n/**\n * Effect that returns the path parameters captured for the current matched route.\n *\n * @category getters\n * @since 4.0.0\n */\nexport const params = /*#__PURE__*/Effect.map(RouteContext, _ => _.params);\n/**\n * Decodes a schema from the current request and its JSON body.\n *\n * **Details**\n *\n * The input passed to the schema includes the request method, URL, headers,\n * cookies, path parameters, search parameters, and parsed JSON body. The effect\n * fails if the body cannot be parsed or the schema decode fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.contextWith(context => {\n const request = Context.get(context, HttpServerRequest.HttpServerRequest);\n const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams);\n const routeContext = Context.get(context, RouteContext);\n return Effect.flatMap(request.json, body => parse({\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies,\n pathParams: routeContext.params,\n searchParams,\n body\n }, options));\n });\n};\n/**\n * Decodes a schema from the current request without reading the request body.\n *\n * **Details**\n *\n * The input passed to the schema includes the request method, URL, headers,\n * cookies, path parameters, and search parameters.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaNoBody = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.contextWith(context => {\n const request = Context.get(context, HttpServerRequest.HttpServerRequest);\n const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams);\n const routeContext = Context.get(context, RouteContext);\n return parse({\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies,\n pathParams: routeContext.params,\n searchParams\n }, options);\n });\n};\n/**\n * Decodes a schema from the current route path parameters and search parameters.\n *\n * **Details**\n *\n * When the same key appears in both sources, the path parameter value is used.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.contextWith(context => {\n const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams);\n const routeContext = Context.get(context, RouteContext);\n return parse({\n ...searchParams,\n ...routeContext.params\n }, options);\n });\n};\n/**\n * Decodes a schema from the path parameters captured for the current matched\n * route.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaPathParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(params, _ => parse(_, options));\n};\n/**\n * Creates a layer that accesses the current `HttpRouter` service and runs the\n * supplied effect.\n *\n * **When to use**\n *\n * Use when you use it to register routes or middleware with the router during layer\n * construction.\n *\n * **Example** (Registering routes during layer construction)\n *\n * ```ts\n * import { Effect, Layer } from \"effect\"\n * import { HttpRouter } from \"effect/unstable/http\"\n *\n * const MyRoute = Layer.effectDiscard(Effect.gen(function*() {\n * const router = yield* HttpRouter.HttpRouter\n *\n * // then use `yield* router.add(...)` to add a route\n * }))\n * ```\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const use = f => Layer.effectDiscard(Effect.flatMap(HttpRouter, f));\n/**\n * Create a layer that adds a single route to the HTTP router.\n *\n * **Example** (Adding a GET route)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * const Route = HttpRouter.add(\n * \"GET\",\n * \"/hello\",\n * Effect.succeed(HttpServerResponse.text(\"Hello, World!\"))\n * )\n * ```\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const add = (method, path, handler, options) => use(router => router.add(method, path, handler, options));\n/**\n * Create a layer that adds multiple routes to the HTTP router.\n *\n * **Example** (Adding multiple routes)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * const Routes = HttpRouter.addAll([\n * HttpRouter.route(\n * \"GET\",\n * \"/hello\",\n * Effect.succeed(HttpServerResponse.text(\"Hello, World!\"))\n * )\n * ])\n * ```\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const addAll = (routes, options) => Layer.effectDiscard(Effect.gen(function* () {\n const toAdd = Effect.isEffect(routes) ? yield* routes : routes;\n let router = yield* HttpRouter;\n if (options?.prefix) {\n router = router.prefixed(options.prefix);\n }\n yield* router.addAll(toAdd);\n}));\n/**\n * Layer that provides a newly constructed `HttpRouter`.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(HttpRouter)(make);\n/**\n * Builds an application layer with a router and returns the router as an HTTP\n * handler effect.\n *\n * **Details**\n *\n * The returned effect handles the current `HttpServerRequest` in the current\n * `Scope`; route request markers are converted into the ordinary requirements of\n * the returned handler.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const toHttpEffect = appLayer => Effect.gen(function* () {\n const context = yield* Layer.build(Layer.provideMerge(appLayer, layer));\n const router = Context.get(context, HttpRouter);\n // @effect-diagnostics effect/returnEffectInGen:off\n return router.asHttpEffect();\n});\nconst RouteTypeId = \"~effect/http/HttpRouter/Route\";\nconst makeRoute = options => ({\n ...options,\n uninterruptible: options.uninterruptible ?? false,\n prefix: typeof options.prefix === \"string\" ? Option.some(options.prefix) : options.prefix ?? Option.none(),\n [RouteTypeId]: RouteTypeId\n});\n/**\n * Constructs a `Route` from an HTTP method, path, and handler.\n *\n * **Details**\n *\n * The handler may be a static response, an effect that produces a response, or a\n * function from the current request to a response effect. Set `uninterruptible` to\n * prevent the route handler from being made interruptible while it runs.\n *\n * @category Route\n * @since 4.0.0\n */\nexport const route = (method, path, handler, options) => makeRoute({\n ...options,\n method,\n path,\n handler: HttpServerResponse.isHttpServerResponse(handler) ? Effect.succeed(handler) : Effect.isEffect(handler) ? handler : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),\n uninterruptible: options?.uninterruptible ?? false\n});\nconst removeTrailingSlash = path => path.endsWith(\"/\") ? path.slice(0, -1) : path;\n/**\n * Adds a path prefix to a route path.\n *\n * **Details**\n *\n * Trailing slashes are removed from the prefix; `/` becomes the prefix itself and\n * `*` becomes a wildcard route under the prefix.\n *\n * @category PathInput\n * @since 4.0.0\n */\nexport const prefixPath = /*#__PURE__*/dual(2, (self, prefix) => {\n prefix = removeTrailingSlash(prefix);\n if (self === \"*\") return `${prefix}/*`;else if (self === \"/\") return prefix;\n return prefix + self;\n});\n/**\n * Returns a copy of a route with its path prefixed.\n *\n * **Details**\n *\n * The prefix is also tracked on the route so that, when the route handles a\n * request, the matched prefix can be removed from the request URL seen by the\n * handler.\n *\n * @category Route\n * @since 4.0.0\n */\nexport const prefixRoute = /*#__PURE__*/dual(2, (self, prefix) => makeRoute({\n ...self,\n path: prefixPath(self.path, prefix),\n prefix: Option.match(self.prefix, {\n onNone: () => prefix,\n onSome: existingPrefix => prefixPath(existingPrefix, prefix)\n })\n}));\nconst MiddlewareTypeId = \"~effect/http/HttpRouter/Middleware\";\n/**\n * Create a middleware layer that can be used to modify requests and responses.\n *\n * **Details**\n *\n * By default, the middleware only affects the routes that it is provided to.\n *\n * If you want to create a middleware that applies globally to all routes, pass\n * the `global` option as `true`.\n *\n * **Example** (Applying route and global middleware)\n *\n * ```ts\n * import { Context, Effect, Layer } from \"effect\"\n * import { HttpMiddleware, HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * // Here we are defining a CORS middleware\n * const CorsMiddleware = HttpRouter.middleware(HttpMiddleware.cors()).layer\n * // You can also use HttpRouter.cors() to create a CORS middleware\n *\n * class CurrentSession extends Context.Service<CurrentSession, {\n * readonly token: string\n * }>()(\"CurrentSession\") {}\n *\n * // You can create middleware that provides a service to the HTTP requests.\n * const SessionMiddleware = HttpRouter.middleware<{\n * provides: CurrentSession\n * }>()(\n * Effect.gen(function*() {\n * yield* Effect.log(\"SessionMiddleware initialized\")\n *\n * return (httpEffect) =>\n * Effect.provideService(httpEffect, CurrentSession, {\n * token: \"dummy-token\"\n * })\n * })\n * ).layer\n *\n * Effect.gen(function*() {\n * const router = yield* HttpRouter.HttpRouter\n * yield* router.add(\n * \"GET\",\n * \"/hello\",\n * Effect.gen(function*() {\n * // Requests can now access the current session\n * const session = yield* CurrentSession\n * return HttpServerResponse.text(\n * `Hello, World! Your token is ${session.token}`\n * )\n * })\n * )\n * }).pipe(\n * Layer.effectDiscard,\n * // Provide the SessionMiddleware & CorsMiddleware to some routes\n * Layer.provide([SessionMiddleware, CorsMiddleware])\n * )\n * ```\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const middleware = function () {\n if (arguments.length === 0) {\n return makeMiddleware;\n }\n return makeMiddleware(arguments[0], arguments[1]);\n};\nconst makeMiddleware = (middleware, options) => options?.global ? Layer.effectDiscard(Effect.gen(function* () {\n const router = yield* HttpRouter;\n const fn = Effect.isEffect(middleware) ? yield* middleware : middleware;\n yield* router.addGlobalMiddleware(fn);\n})) : new MiddlewareImpl(Effect.isEffect(middleware) ? Layer.effectContext(Effect.map(middleware, fn => Context.makeUnsafe(new Map([[fnContextKey, fn]])))) : Layer.succeedContext(Context.makeUnsafe(new Map([[fnContextKey, middleware]]))));\nlet middlewareId = 0;\nconst fnContextKey = \"effect/http/HttpRouter/MiddlewareFn\";\nclass MiddlewareImpl {\n [MiddlewareTypeId] = {};\n layerFn;\n dependencies;\n constructor(layerFn, dependencies) {\n this.layerFn = layerFn;\n this.dependencies = dependencies;\n const contextKey = `effect/http/HttpRouter/Middleware-${++middlewareId}`;\n this.layer = Layer.effectContext(Effect.gen({\n self: this\n }, function* () {\n const context = yield* Effect.context();\n const stack = [context.mapUnsafe.get(fnContextKey)];\n if (this.dependencies) {\n const memoMap = yield* Layer.CurrentMemoMap;\n const scope = Context.get(context, Scope.Scope);\n const depsContext = yield* Layer.buildWithMemoMap(this.dependencies, memoMap, scope);\n stack.push(...getMiddleware(depsContext));\n }\n return Context.makeUnsafe(new Map([[contextKey, stack]]));\n })).pipe(Layer.provide(this.layerFn));\n }\n layer;\n combine(other) {\n return new MiddlewareImpl(this.layerFn, this.dependencies ? Layer.provideMerge(this.dependencies, other.layer) : other.layer);\n }\n}\nconst middlewareCache = /*#__PURE__*/new WeakMap();\nconst getMiddleware = context => {\n let arr = middlewareCache.get(context);\n if (arr) return arr;\n const topLevel = Arr.empty();\n let maxLength = 0;\n for (const [key, value] of context.mapUnsafe) {\n if (key.startsWith(\"effect/http/HttpRouter/Middleware-\")) {\n topLevel.push(value);\n if (value.length > maxLength) {\n maxLength = value.length;\n }\n }\n }\n if (topLevel.length === 0) {\n arr = [];\n } else {\n const middleware = new Set();\n for (let i = maxLength - 1; i >= 0; i--) {\n for (const arr of topLevel) {\n if (i < arr.length) {\n middleware.add(arr[i]);\n }\n }\n }\n arr = Arr.fromIterable(middleware).reverse();\n }\n middlewareCache.set(context, arr);\n return arr;\n};\n/**\n * Middleware that applies CORS headers to the HTTP response.\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const cors = options => middleware(HttpMiddleware.cors(options), {\n global: true\n});\n/**\n * Middleware that disables the logger for some routes.\n *\n * **Example** (Disabling route logging)\n *\n * ```ts\n * import { Effect, Layer } from \"effect\"\n * import { HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * const Route = HttpRouter.add(\n * \"GET\",\n * \"/hello\",\n * Effect.succeed(HttpServerResponse.text(\"Hello, World!\"))\n * ).pipe(\n * // disable the logger for this route\n * Layer.provide(HttpRouter.disableLogger)\n * )\n * ```\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const disableLogger = /*#__PURE__*/middleware(HttpMiddleware.withLoggerDisabled).layer;\n/**\n * Provides request-level dependencies to some routes.\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const provideRequest = layer => self => Layer.provide(self, middleware()(Effect.gen(function* () {\n const services = yield* Layer.build(layer);\n return effect => Effect.provideContext(effect, services);\n})).layer);\n/**\n * Runs the provided application layer as an HTTP server.\n *\n * @category server\n * @since 4.0.0\n */\nexport const serve = (appLayer, options) => {\n let middleware = options?.middleware;\n if (options?.disableLogger !== true) {\n middleware = middleware ? compose(middleware, HttpMiddleware.logger) : HttpMiddleware.logger;\n }\n const RouterLayer = options?.routerConfig ? Layer.provide(layer, Layer.succeed(RouterConfig)(options.routerConfig)) : layer;\n return Effect.gen(function* () {\n const router = yield* HttpRouter;\n const handler = router.asHttpEffect();\n return middleware ? HttpServer.serve(handler, middleware) : HttpServer.serve(handler);\n }).pipe(Layer.unwrap, Layer.provideMerge(appLayer), Layer.provide(RouterLayer), options?.disableListenLog ? identity : HttpServer.withLogAddress);\n};\n/**\n * Builds a Fetch-compatible request handler from an HTTP router application\n * layer.\n *\n * **Details**\n *\n * The result contains a `handler` function that converts Web `Request` values to\n * Web `Response` values and a `dispose` function for releasing the layer\n * resources.\n *\n * @category server\n * @since 4.0.0\n */\nexport const toWebHandler = (appLayer, options) => {\n let middleware = options?.middleware;\n if (options?.disableLogger !== true) {\n middleware = middleware ? compose(middleware, HttpMiddleware.logger) : HttpMiddleware.logger;\n }\n const RouterLayer = options?.routerConfig ? Layer.provide(layer, Layer.succeed(RouterConfig)(options.routerConfig)) : layer;\n return HttpEffect.toWebHandlerLayerWith(Layer.provideMerge(appLayer, RouterLayer), {\n toHandler: s => Effect.succeed(Context.get(s, HttpRouter).asHttpEffect()),\n middleware,\n memoMap: options?.memoMap\n });\n};\n//# sourceMappingURL=HttpRouter.js.map",
|
|
142
|
+
"/**\n * Fetch-based implementation of the Effect HTTP client service.\n *\n * This module provides an `HttpClient` layer that executes requests through a\n * Web Fetch API implementation. It is the transport to use in browsers, edge\n * runtimes, and Node.js environments where `globalThis.fetch` is available, or\n * anywhere a compatible fetch function can be supplied.\n *\n * **Mental model**\n *\n * `layer` installs an `HttpClient` whose runtime boundary is a call to `fetch`.\n * The `Fetch` reference chooses the fetch function and defaults to\n * `globalThis.fetch`. The `RequestInit` service supplies default fetch options\n * such as credentials, redirects, cache behavior, or other platform-specific\n * settings. Request-specific method, headers, body, and abort signal are written\n * by the client for each call.\n *\n * **Common tasks**\n *\n * Provide `layer` when an Effect program should run outbound HTTP through the\n * current platform. Override `Fetch` in tests or custom runtimes to capture\n * requests or route them to a different implementation. Provide `RequestInit`\n * when all requests made by this client should share fetch defaults.\n *\n * **Gotchas**\n *\n * Fetch behavior is platform behavior: CORS, cookies, redirect handling, aborts,\n * and streaming support can differ across runtimes. Stream request bodies are\n * sent as Web streams with `duplex: \"half\"` for runtimes that require it, and\n * `content-length` is removed so fetch can manage body framing.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpClient from \"./HttpClient.js\";\nimport * as HttpClientError from \"./HttpClientError.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\n/**\n * Context reference for the `fetch` implementation used by the fetch-based HTTP client.\n *\n * **Details**\n *\n * Defaults to `globalThis.fetch`.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Fetch = /*#__PURE__*/Context.Reference(\"effect/http/FetchHttpClient/Fetch\", {\n defaultValue: () => globalThis.fetch\n});\n/**\n * Service that contains default fetch options for the fetch-based HTTP client.\n *\n * **When to use**\n *\n * Use to provide default credentials, cache, redirect, integrity, or other\n * fetch options for outgoing HTTP requests.\n *\n * **Details**\n *\n * Request-specific method, headers, body, and abort signal are supplied by the client when a request is executed.\n *\n * @category services\n * @since 4.0.0\n */\nexport class RequestInit extends /*#__PURE__*/Context.Service()(\"effect/http/FetchHttpClient/RequestInit\") {}\nconst fetch = /*#__PURE__*/HttpClient.make((request, url, signal, fiber) => {\n const fetch = fiber.getRef(Fetch);\n const options = fiber.context.mapUnsafe.get(RequestInit.key) ?? {};\n let headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers;\n if (headers[\"content-length\"]) {\n headers = Headers.remove(headers, \"content-length\");\n }\n const send = body => Effect.map(Effect.tryPromise({\n try: () => fetch(url, {\n ...options,\n method: request.method,\n headers,\n body,\n duplex: request.body._tag === \"Stream\" ? \"half\" : undefined,\n signal\n }),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n cause\n })\n })\n }), response => HttpClientResponse.fromWeb(request, response));\n switch (request.body._tag) {\n case \"Raw\":\n case \"Uint8Array\":\n return send(request.body.body);\n case \"FormData\":\n return send(request.body.formData);\n case \"Stream\":\n return Effect.flatMap(Stream.toReadableStreamEffect(request.body.stream), send);\n }\n return send(undefined);\n});\n/**\n * Layer that provides an `HttpClient` implementation backed by the configured\n * `Fetch` function.\n *\n * **When to use**\n *\n * Use when an Effect program should execute `HttpClient` requests through the\n * platform `fetch` implementation, especially in browser, edge, or Node.js\n * runtimes with `globalThis.fetch`.\n *\n * **Details**\n *\n * The layer uses the current `Fetch` reference and optional `RequestInit`\n * service for each request. Request-specific method, headers, body, and abort\n * signal are supplied by the client and override matching `RequestInit` fields.\n *\n * **Gotchas**\n *\n * Fetch behavior comes from the runtime's implementation, so CORS, cookies,\n * redirects, abort handling, and streaming support can vary by platform. Stream\n * request bodies are sent as Web streams with `duplex: \"half\"`, and any\n * `content-length` header is removed before calling `fetch`.\n *\n * @see {@link Fetch} for supplying the fetch implementation used by this layer\n * @see {@link RequestInit} for default `RequestInit` options applied before request-specific fields\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/HttpClient.layerMergedContext(/*#__PURE__*/Effect.succeed(fetch));\n//# sourceMappingURL=FetchHttpClient.js.map",
|
|
143
|
+
"import path from \"path\"\nimport fs from \"fs/promises\"\nimport { xdgData, xdgCache, xdgConfig, xdgState } from \"xdg-basedir\"\nimport os from \"os\"\nimport { Context, Effect, Layer } from \"effect\"\nimport { Flock } from \"./util/flock\"\nimport { Flag } from \"./flag/flag\"\n\nconst app = \"opencode\"\nconst data = path.join(xdgData!, app)\nconst cache = path.join(xdgCache!, app)\nconst config = path.join(xdgConfig!, app)\nconst state = path.join(xdgState!, app)\nconst tmp = path.join(os.tmpdir(), app)\n\nconst paths = {\n get home() {\n return process.env.OPENCODE_TEST_HOME ?? os.homedir()\n },\n data,\n bin: path.join(cache, \"bin\"),\n log: path.join(data, \"log\"),\n repos: path.join(data, \"repos\"),\n cache,\n config,\n state,\n tmp,\n}\n\nexport const Path = paths\n\nFlock.setGlobal({ state })\n\nawait Promise.all([\n fs.mkdir(Path.data, { recursive: true }),\n fs.mkdir(Path.config, { recursive: true }),\n fs.mkdir(Path.state, { recursive: true }),\n fs.mkdir(Path.tmp, { recursive: true }),\n fs.mkdir(Path.log, { recursive: true }),\n fs.mkdir(Path.bin, { recursive: true }),\n fs.mkdir(Path.repos, { recursive: true }),\n])\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/Global\") {}\n\nexport interface Interface {\n readonly home: string\n readonly data: string\n readonly cache: string\n readonly config: string\n readonly state: string\n readonly tmp: string\n readonly bin: string\n readonly log: string\n readonly repos: string\n}\n\nexport function make(input: Partial<Interface> = {}): Interface {\n return {\n home: Path.home,\n data: Path.data,\n cache: Path.cache,\n config: Flag.OPENCODE_CONFIG_DIR ?? Path.config,\n state: Path.state,\n tmp: Path.tmp,\n bin: Path.bin,\n log: Path.log,\n repos: Path.repos,\n ...input,\n }\n}\n\nexport const layer = Layer.effect(\n Service,\n Effect.sync(() => Service.of(make())),\n)\n\nexport const defaultLayer = layer\n\nexport const layerWith = (input: Partial<Interface>) =>\n Layer.effect(\n Service,\n Effect.sync(() => Service.of(make(input))),\n )\n\nexport * as Global from \"./global\"\n",
|
|
144
|
+
"import os from 'os';\nimport path from 'path';\n\nconst homeDirectory = os.homedir();\nconst {env} = process;\n\nexport const xdgData = env.XDG_DATA_HOME ||\n\t(homeDirectory ? path.join(homeDirectory, '.local', 'share') : undefined);\n\nexport const xdgConfig = env.XDG_CONFIG_HOME ||\n\t(homeDirectory ? path.join(homeDirectory, '.config') : undefined);\n\nexport const xdgState = env.XDG_STATE_HOME ||\n\t(homeDirectory ? path.join(homeDirectory, '.local', 'state') : undefined);\n\nexport const xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path.join(homeDirectory, '.cache') : undefined);\n\nexport const xdgRuntime = env.XDG_RUNTIME_DIR || undefined;\n\nexport const xdgDataDirectories = (env.XDG_DATA_DIRS || '/usr/local/share/:/usr/share/').split(':');\n\nif (xdgData) {\n\txdgDataDirectories.unshift(xdgData);\n}\n\nexport const xdgConfigDirectories = (env.XDG_CONFIG_DIRS || '/etc/xdg').split(':');\n\nif (xdgConfig) {\n\txdgConfigDirectories.unshift(xdgConfig);\n}\n",
|
|
145
|
+
"import path from \"path\"\nimport os from \"os\"\nimport { randomBytes, randomUUID } from \"crypto\"\nimport { mkdir, readFile, rm, stat, utimes, writeFile } from \"fs/promises\"\nimport { Hash } from \"./hash\"\nimport { Effect } from \"effect\"\n\nexport type FlockGlobal = {\n state: string\n}\n\nexport namespace Flock {\n let global: FlockGlobal | undefined\n\n export function setGlobal(g: FlockGlobal) {\n global = g\n }\n\n const root = () => {\n if (!global) throw new Error(\"Flock global not set\")\n return path.join(global.state, \"locks\")\n }\n\n // Defaults for callers that do not provide timing options.\n const defaultOpts = {\n staleMs: 60_000,\n timeoutMs: 5 * 60_000,\n baseDelayMs: 100,\n maxDelayMs: 2_000,\n }\n\n export interface WaitEvent {\n key: string\n attempt: number\n delay: number\n waited: number\n }\n\n export type Wait = (input: WaitEvent) => void | Promise<void>\n\n export interface Options {\n dir?: string\n signal?: AbortSignal\n staleMs?: number\n timeoutMs?: number\n baseDelayMs?: number\n maxDelayMs?: number\n onWait?: Wait\n }\n\n type Opts = {\n staleMs: number\n timeoutMs: number\n baseDelayMs: number\n maxDelayMs: number\n }\n\n type Owned = {\n acquired: true\n startHeartbeat: (intervalMs?: number) => void\n release: () => Promise<void>\n }\n\n export interface Lease {\n release: () => Promise<void>\n [Symbol.asyncDispose]: () => Promise<void>\n }\n\n function code(err: unknown) {\n if (typeof err !== \"object\" || err === null || !(\"code\" in err)) return\n const value = err.code\n if (typeof value !== \"string\") return\n return value\n }\n\n function sleep(ms: number, signal?: AbortSignal) {\n return new Promise<void>((resolve, reject) => {\n if (signal?.aborted) {\n reject(signal.reason ?? new Error(\"Aborted\"))\n return\n }\n\n let timer: NodeJS.Timeout | undefined\n\n const done = () => {\n signal?.removeEventListener(\"abort\", abort)\n resolve()\n }\n\n const abort = () => {\n if (timer) {\n clearTimeout(timer)\n }\n signal?.removeEventListener(\"abort\", abort)\n reject(signal?.reason ?? new Error(\"Aborted\"))\n }\n\n signal?.addEventListener(\"abort\", abort, { once: true })\n timer = setTimeout(done, ms)\n })\n }\n\n function jitter(ms: number) {\n const j = Math.floor(ms * 0.3)\n const d = Math.floor(Math.random() * (2 * j + 1)) - j\n return Math.max(0, ms + d)\n }\n\n function mono() {\n return performance.now()\n }\n\n function wall() {\n return performance.timeOrigin + mono()\n }\n\n async function stats(file: string) {\n try {\n return await stat(file)\n } catch (err) {\n const errCode = code(err)\n if (errCode === \"ENOENT\" || errCode === \"ENOTDIR\") return\n throw err\n }\n }\n\n async function stale(lockDir: string, heartbeatPath: string, metaPath: string, staleMs: number) {\n // Stale detection allows automatic recovery after crashed owners.\n const now = wall()\n const heartbeat = await stats(heartbeatPath)\n if (heartbeat) {\n return now - heartbeat.mtimeMs > staleMs\n }\n\n const meta = await stats(metaPath)\n if (meta) {\n return now - meta.mtimeMs > staleMs\n }\n\n const dir = await stats(lockDir)\n if (!dir) {\n return false\n }\n\n return now - dir.mtimeMs > staleMs\n }\n\n async function tryAcquireLockDir(lockDir: string, opts: Opts): Promise<Owned | { acquired: false }> {\n const token = randomUUID?.() ?? randomBytes(16).toString(\"hex\")\n const metaPath = path.join(lockDir, \"meta.json\")\n const heartbeatPath = path.join(lockDir, \"heartbeat\")\n\n try {\n await mkdir(lockDir, { mode: 0o700 })\n } catch (err) {\n if (code(err) !== \"EEXIST\") {\n throw err\n }\n\n if (!(await stale(lockDir, heartbeatPath, metaPath, opts.staleMs))) {\n return { acquired: false }\n }\n\n const breakerPath = lockDir + \".breaker\"\n try {\n await mkdir(breakerPath, { mode: 0o700 })\n } catch (claimErr) {\n const errCode = code(claimErr)\n if (errCode === \"EEXIST\") {\n const breaker = await stats(breakerPath)\n if (breaker && wall() - breaker.mtimeMs > opts.staleMs) {\n await rm(breakerPath, { recursive: true, force: true }).catch(() => undefined)\n }\n return { acquired: false }\n }\n\n if (errCode === \"ENOENT\" || errCode === \"ENOTDIR\") {\n return { acquired: false }\n }\n\n throw claimErr\n }\n\n try {\n // Breaker ownership ensures only one contender performs stale cleanup.\n if (!(await stale(lockDir, heartbeatPath, metaPath, opts.staleMs))) {\n return { acquired: false }\n }\n\n await rm(lockDir, { recursive: true, force: true })\n\n try {\n await mkdir(lockDir, { mode: 0o700 })\n } catch (retryErr) {\n const errCode = code(retryErr)\n if (errCode === \"EEXIST\" || errCode === \"ENOTEMPTY\") {\n return { acquired: false }\n }\n throw retryErr\n }\n } finally {\n await rm(breakerPath, { recursive: true, force: true }).catch(() => undefined)\n }\n }\n\n const meta = {\n token,\n pid: process.pid,\n hostname: os.hostname(),\n createdAt: new Date().toISOString(),\n }\n\n await writeFile(heartbeatPath, \"\", { flag: \"wx\" }).catch(async () => {\n await rm(lockDir, { recursive: true, force: true })\n throw new Error(\"Lock acquired but heartbeat already existed (possible compromise).\")\n })\n\n await writeFile(metaPath, JSON.stringify(meta, null, 2), { flag: \"wx\" }).catch(async () => {\n await rm(lockDir, { recursive: true, force: true })\n throw new Error(\"Lock acquired but meta.json already existed (possible compromise).\")\n })\n\n let timer: NodeJS.Timeout | undefined\n\n const startHeartbeat = (intervalMs = Math.max(100, Math.floor(opts.staleMs / 3))) => {\n if (timer) return\n // Heartbeat prevents long critical sections from being evicted as stale.\n timer = setInterval(() => {\n const t = new Date()\n void utimes(heartbeatPath, t, t).catch(() => undefined)\n }, intervalMs)\n timer.unref?.()\n }\n\n const release = async () => {\n if (timer) {\n clearInterval(timer)\n timer = undefined\n }\n\n const current = await readFile(metaPath, \"utf8\")\n .then((raw) => {\n const parsed = JSON.parse(raw)\n if (!parsed || typeof parsed !== \"object\") return {}\n return {\n token: \"token\" in parsed && typeof parsed.token === \"string\" ? parsed.token : undefined,\n }\n })\n .catch((err) => {\n const errCode = code(err)\n if (errCode === \"ENOENT\" || errCode === \"ENOTDIR\") {\n throw new Error(\"Refusing to release: lock is compromised (metadata missing).\")\n }\n if (err instanceof SyntaxError) {\n throw new Error(\"Refusing to release: lock is compromised (metadata invalid).\")\n }\n throw err\n })\n // Token check prevents deleting a lock that was re-acquired by another process.\n if (current.token !== token) {\n throw new Error(\"Refusing to release: lock token mismatch (not the owner).\")\n }\n\n await rm(lockDir, { recursive: true, force: true })\n }\n\n return {\n acquired: true,\n startHeartbeat,\n release,\n }\n }\n\n async function acquireLockDir(\n lockDir: string,\n input: { key: string; onWait?: Wait; signal?: AbortSignal },\n opts: Opts,\n ) {\n const stop = mono() + opts.timeoutMs\n let attempt = 0\n let waited = 0\n let delay = opts.baseDelayMs\n\n while (true) {\n input.signal?.throwIfAborted()\n\n const res = await tryAcquireLockDir(lockDir, opts)\n if (res.acquired) {\n return res\n }\n\n if (mono() > stop) {\n throw new Error(`Timed out waiting for lock: ${input.key}`)\n }\n\n attempt += 1\n const ms = jitter(delay)\n await input.onWait?.({\n key: input.key,\n attempt,\n delay: ms,\n waited,\n })\n await sleep(ms, input.signal)\n waited += ms\n delay = Math.min(opts.maxDelayMs, Math.floor(delay * 1.7))\n }\n }\n\n export async function acquire(key: string, input: Options = {}): Promise<Lease> {\n input.signal?.throwIfAborted()\n const cfg: Opts = {\n staleMs: input.staleMs ?? defaultOpts.staleMs,\n timeoutMs: input.timeoutMs ?? defaultOpts.timeoutMs,\n baseDelayMs: input.baseDelayMs ?? defaultOpts.baseDelayMs,\n maxDelayMs: input.maxDelayMs ?? defaultOpts.maxDelayMs,\n }\n const dir = input.dir ?? root()\n\n await mkdir(dir, { recursive: true })\n const lockfile = path.join(dir, Hash.fast(key) + \".lock\")\n const lock = await acquireLockDir(\n lockfile,\n {\n key,\n onWait: input.onWait,\n signal: input.signal,\n },\n cfg,\n )\n lock.startHeartbeat()\n\n const release = () => lock.release()\n return {\n release,\n [Symbol.asyncDispose]() {\n return release()\n },\n }\n }\n\n export async function withLock<T>(key: string, fn: () => Promise<T>, input: Options = {}) {\n await using _ = await acquire(key, input)\n input.signal?.throwIfAborted()\n return await fn()\n }\n\n export const effect = Effect.fn(\"Flock.effect\")(function* (key: string, input: Options = {}) {\n return yield* Effect.acquireRelease(\n Effect.promise((signal) => Flock.acquire(key, { ...input, signal })).pipe(\n Effect.withSpan(\"Flock.acquire\", {\n attributes: { key },\n }),\n ),\n (lock) => Effect.promise(() => lock.release()).pipe(Effect.withSpan(\"Flock.release\")),\n ).pipe(Effect.asVoid)\n })\n}\n",
|
|
146
|
+
"import { createHash } from \"crypto\"\n\nexport namespace Hash {\n export function fast(input: string | Buffer): string {\n return createHash(\"sha1\").update(input).digest(\"hex\")\n }\n\n export function sha256(input: string | Buffer): string {\n return createHash(\"sha256\").update(input).digest(\"hex\")\n }\n}\n",
|
|
147
|
+
"import { Config } from \"effect\"\n\nexport function truthy(key: string) {\n const value = process.env[key]?.toLowerCase()\n return value === \"true\" || value === \"1\"\n}\n\nconst copy = process.env[\"OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT\"]\n\nfunction enabledByExperimental(key: string) {\n return process.env[key] === undefined ? truthy(\"OPENCODE_EXPERIMENTAL\") : truthy(key)\n}\n\nexport const Flag = {\n OTEL_EXPORTER_OTLP_ENDPOINT: process.env[\"OTEL_EXPORTER_OTLP_ENDPOINT\"],\n OTEL_EXPORTER_OTLP_HEADERS: process.env[\"OTEL_EXPORTER_OTLP_HEADERS\"],\n\n OPENCODE_AUTO_HEAP_SNAPSHOT: truthy(\"OPENCODE_AUTO_HEAP_SNAPSHOT\"),\n OPENCODE_GIT_BASH_PATH: process.env[\"OPENCODE_GIT_BASH_PATH\"],\n OPENCODE_CONFIG: process.env[\"OPENCODE_CONFIG\"],\n OPENCODE_CONFIG_CONTENT: process.env[\"OPENCODE_CONFIG_CONTENT\"],\n OPENCODE_DISABLE_AUTOUPDATE: truthy(\"OPENCODE_DISABLE_AUTOUPDATE\"),\n OPENCODE_ALWAYS_NOTIFY_UPDATE: truthy(\"OPENCODE_ALWAYS_NOTIFY_UPDATE\"),\n OPENCODE_DISABLE_PRUNE: truthy(\"OPENCODE_DISABLE_PRUNE\"),\n OPENCODE_DISABLE_TERMINAL_TITLE: truthy(\"OPENCODE_DISABLE_TERMINAL_TITLE\"),\n OPENCODE_SHOW_TTFD: truthy(\"OPENCODE_SHOW_TTFD\"),\n OPENCODE_DISABLE_AUTOCOMPACT: truthy(\"OPENCODE_DISABLE_AUTOCOMPACT\"),\n OPENCODE_DISABLE_MODELS_FETCH: truthy(\"OPENCODE_DISABLE_MODELS_FETCH\"),\n OPENCODE_DISABLE_MOUSE: truthy(\"OPENCODE_DISABLE_MOUSE\"),\n OPENCODE_FAKE_VCS: process.env[\"OPENCODE_FAKE_VCS\"],\n OPENCODE_SERVER_PASSWORD: process.env[\"OPENCODE_SERVER_PASSWORD\"],\n OPENCODE_SERVER_USERNAME: process.env[\"OPENCODE_SERVER_USERNAME\"],\n\n // Experimental\n OPENCODE_EXPERIMENTAL_FILEWATCHER: Config.boolean(\"OPENCODE_EXPERIMENTAL_FILEWATCHER\").pipe(\n Config.withDefault(false),\n ),\n OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: Config.boolean(\"OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER\").pipe(\n Config.withDefault(false),\n ),\n OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT:\n copy === undefined ? process.platform === \"win32\" : truthy(\"OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT\"),\n OPENCODE_MODELS_URL: process.env[\"OPENCODE_MODELS_URL\"],\n OPENCODE_MODELS_PATH: process.env[\"OPENCODE_MODELS_PATH\"],\n OPENCODE_DB: process.env[\"OPENCODE_DB\"],\n\n OPENCODE_WORKSPACE_ID: process.env[\"OPENCODE_WORKSPACE_ID\"],\n OPENCODE_EXPERIMENTAL_WORKSPACES: enabledByExperimental(\"OPENCODE_EXPERIMENTAL_WORKSPACES\"),\n OPENCODE_EXPERIMENTAL_SESSION_SWITCHER: enabledByExperimental(\"OPENCODE_EXPERIMENTAL_SESSION_SWITCHER\"),\n\n // Evaluated at access time (not module load) because tests, the CLI, and\n // external tooling set these env vars at runtime.\n get OPENCODE_DISABLE_PROJECT_CONFIG() {\n return truthy(\"OPENCODE_DISABLE_PROJECT_CONFIG\")\n },\n get OPENCODE_EXPERIMENTAL_REFERENCES() {\n return enabledByExperimental(\"OPENCODE_EXPERIMENTAL_REFERENCES\")\n },\n get OPENCODE_TUI_CONFIG() {\n return process.env[\"OPENCODE_TUI_CONFIG\"]\n },\n get OPENCODE_CONFIG_DIR() {\n return process.env[\"OPENCODE_CONFIG_DIR\"]\n },\n get OPENCODE_PURE() {\n return truthy(\"OPENCODE_PURE\")\n },\n get OPENCODE_PERMISSION() {\n return process.env[\"OPENCODE_PERMISSION\"]\n },\n get OPENCODE_PLUGIN_META_FILE() {\n return process.env[\"OPENCODE_PLUGIN_META_FILE\"]\n },\n get OPENCODE_CLIENT() {\n return process.env[\"OPENCODE_CLIENT\"] ?? \"cli\"\n },\n}\n",
|
|
148
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Config } from \"./types.gen.js\"\n\nexport type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, \"method\"> &\n Pick<Config, \"method\" | \"responseTransformer\" | \"responseValidator\"> & {\n /**\n * Fetch API implementation. You can use this option to provide a custom\n * fetch instance.\n *\n * @default globalThis.fetch\n */\n fetch?: typeof fetch\n /**\n * Implementing clients can call request interceptors inside this hook.\n */\n onRequest?: (url: string, init: RequestInit) => Promise<Request>\n /**\n * Callback invoked when a network or parsing error occurs during streaming.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param error The error that occurred.\n */\n onSseError?: (error: unknown) => void\n /**\n * Callback invoked when an event is streamed from the server.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param event Event streamed from the server.\n * @returns Nothing (void).\n */\n onSseEvent?: (event: StreamEvent<TData>) => void\n serializedBody?: RequestInit[\"body\"]\n /**\n * Default retry delay in milliseconds.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 3000\n */\n sseDefaultRetryDelay?: number\n /**\n * Maximum number of retry attempts before giving up.\n */\n sseMaxRetryAttempts?: number\n /**\n * Maximum retry delay in milliseconds.\n *\n * Applies only when exponential backoff is used.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 30000\n */\n sseMaxRetryDelay?: number\n /**\n * Optional sleep function for retry backoff.\n *\n * Defaults to using `setTimeout`.\n */\n sseSleepFn?: (ms: number) => Promise<void>\n url: string\n }\n\nexport interface StreamEvent<TData = unknown> {\n data: TData\n event?: string\n id?: string\n retry?: number\n}\n\nexport type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {\n stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>\n}\n\nexport const createSseClient = <TData = unknown>({\n onRequest,\n onSseError,\n onSseEvent,\n responseTransformer,\n responseValidator,\n sseDefaultRetryDelay,\n sseMaxRetryAttempts,\n sseMaxRetryDelay,\n sseSleepFn,\n url,\n ...options\n}: ServerSentEventsOptions): ServerSentEventsResult<TData> => {\n let lastEventId: string | undefined\n\n const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)))\n\n const createStream = async function* () {\n let retryDelay: number = sseDefaultRetryDelay ?? 3000\n let attempt = 0\n const signal = options.signal ?? new AbortController().signal\n\n while (true) {\n if (signal.aborted) break\n\n attempt++\n\n const headers =\n options.headers instanceof Headers\n ? options.headers\n : new Headers(options.headers as Record<string, string> | undefined)\n\n if (lastEventId !== undefined) {\n headers.set(\"Last-Event-ID\", lastEventId)\n }\n\n try {\n const requestInit: RequestInit = {\n redirect: \"follow\",\n ...options,\n body: options.serializedBody,\n headers,\n signal,\n }\n let request = new Request(url, requestInit)\n if (onRequest) {\n request = await onRequest(url, requestInit)\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = options.fetch ?? globalThis.fetch\n const response = await _fetch(request)\n\n if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`)\n\n if (!response.body) throw new Error(\"No body in SSE response\")\n\n const reader = response.body.pipeThrough(new TextDecoderStream()).getReader()\n\n let buffer = \"\"\n\n const abortHandler = () => {\n try {\n reader.cancel()\n } catch {\n // noop\n }\n }\n\n signal.addEventListener(\"abort\", abortHandler)\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n buffer += value\n // Normalize line endings: CRLF -> LF, then CR -> LF\n buffer = buffer.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\")\n\n const chunks = buffer.split(\"\\n\\n\")\n buffer = chunks.pop() ?? \"\"\n\n for (const chunk of chunks) {\n const lines = chunk.split(\"\\n\")\n const dataLines: Array<string> = []\n let eventName: string | undefined\n\n for (const line of lines) {\n if (line.startsWith(\"data:\")) {\n dataLines.push(line.replace(/^data:\\s*/, \"\"))\n } else if (line.startsWith(\"event:\")) {\n eventName = line.replace(/^event:\\s*/, \"\")\n } else if (line.startsWith(\"id:\")) {\n lastEventId = line.replace(/^id:\\s*/, \"\")\n } else if (line.startsWith(\"retry:\")) {\n const parsed = Number.parseInt(line.replace(/^retry:\\s*/, \"\"), 10)\n if (!Number.isNaN(parsed)) {\n retryDelay = parsed\n }\n }\n }\n\n let data: unknown\n let parsedJson = false\n\n if (dataLines.length) {\n const rawData = dataLines.join(\"\\n\")\n try {\n data = JSON.parse(rawData)\n parsedJson = true\n } catch {\n data = rawData\n }\n }\n\n if (parsedJson) {\n if (responseValidator) {\n await responseValidator(data)\n }\n\n if (responseTransformer) {\n data = await responseTransformer(data)\n }\n }\n\n onSseEvent?.({\n data,\n event: eventName,\n id: lastEventId,\n retry: retryDelay,\n })\n\n if (dataLines.length) {\n yield data as any\n }\n }\n }\n } finally {\n signal.removeEventListener(\"abort\", abortHandler)\n reader.releaseLock()\n }\n\n break // exit loop on normal completion\n } catch (error) {\n // connection failed or aborted; retry after delay\n onSseError?.(error)\n\n if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {\n break // stop after firing error\n }\n\n // exponential backoff: double retry each attempt, cap at 30s\n const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000)\n await sleep(backoff)\n }\n }\n }\n\n const stream = createStream()\n\n return { stream }\n}\n",
|
|
149
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean\n name: string\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean\n style: T\n}\n\nexport type ArrayStyle = \"form\" | \"spaceDelimited\" | \"pipeDelimited\"\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle\ntype MatrixStyle = \"label\" | \"matrix\" | \"simple\"\nexport type ObjectStyle = \"form\" | \"deepObject\"\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case \"label\":\n return \".\"\n case \"matrix\":\n return \";\"\n case \"simple\":\n return \",\"\n default:\n return \"&\"\n }\n}\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case \"form\":\n return \",\"\n case \"pipeDelimited\":\n return \"|\"\n case \"spaceDelimited\":\n return \"%20\"\n default:\n return \",\"\n }\n}\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle) => {\n switch (style) {\n case \"label\":\n return \".\"\n case \"matrix\":\n return \";\"\n case \"simple\":\n return \",\"\n default:\n return \"&\"\n }\n}\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[]\n}) => {\n if (!explode) {\n const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v as string))).join(\n separatorArrayNoExplode(style),\n )\n switch (style) {\n case \"label\":\n return `.${joinedValues}`\n case \"matrix\":\n return `;${name}=${joinedValues}`\n case \"simple\":\n return joinedValues\n default:\n return `${name}=${joinedValues}`\n }\n }\n\n const separator = separatorArrayExplode(style)\n const joinedValues = value\n .map((v) => {\n if (style === \"label\" || style === \"simple\") {\n return allowReserved ? v : encodeURIComponent(v as string)\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n })\n })\n .join(separator)\n return style === \"label\" || style === \"matrix\" ? separator + joinedValues : joinedValues\n}\n\nexport const serializePrimitiveParam = ({ allowReserved, name, value }: SerializePrimitiveParam) => {\n if (value === undefined || value === null) {\n return \"\"\n }\n\n if (typeof value === \"object\") {\n throw new Error(\n \"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.\",\n )\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`\n}\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date\n valueOnly?: boolean\n}) => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`\n }\n\n if (style !== \"deepObject\" && !explode) {\n let values: string[] = []\n Object.entries(value).forEach(([key, v]) => {\n values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]\n })\n const joinedValues = values.join(\",\")\n switch (style) {\n case \"form\":\n return `${name}=${joinedValues}`\n case \"label\":\n return `.${joinedValues}`\n case \"matrix\":\n return `;${name}=${joinedValues}`\n default:\n return joinedValues\n }\n }\n\n const separator = separatorObjectExplode(style)\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === \"deepObject\" ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator)\n return style === \"label\" || style === \"matrix\" ? separator + joinedValues : joinedValues\n}\n",
|
|
150
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { BodySerializer, QuerySerializer } from \"./bodySerializer.gen.js\"\nimport {\n type ArraySeparatorStyle,\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from \"./pathSerializer.gen.js\"\n\nexport interface PathSerializer {\n path: Record<string, unknown>\n url: string\n}\n\nexport const PATH_PARAM_RE = /\\{[^{}]+\\}/g\n\nexport const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {\n let url = _url\n const matches = _url.match(PATH_PARAM_RE)\n if (matches) {\n for (const match of matches) {\n let explode = false\n let name = match.substring(1, match.length - 1)\n let style: ArraySeparatorStyle = \"simple\"\n\n if (name.endsWith(\"*\")) {\n explode = true\n name = name.substring(0, name.length - 1)\n }\n\n if (name.startsWith(\".\")) {\n name = name.substring(1)\n style = \"label\"\n } else if (name.startsWith(\";\")) {\n name = name.substring(1)\n style = \"matrix\"\n }\n\n const value = path[name]\n\n if (value === undefined || value === null) {\n continue\n }\n\n if (Array.isArray(value)) {\n url = url.replace(match, serializeArrayParam({ explode, name, style, value }))\n continue\n }\n\n if (typeof value === \"object\") {\n url = url.replace(\n match,\n serializeObjectParam({\n explode,\n name,\n style,\n value: value as Record<string, unknown>,\n valueOnly: true,\n }),\n )\n continue\n }\n\n if (style === \"matrix\") {\n url = url.replace(\n match,\n `;${serializePrimitiveParam({\n name,\n value: value as string,\n })}`,\n )\n continue\n }\n\n const replaceValue = encodeURIComponent(style === \"label\" ? `.${value as string}` : (value as string))\n url = url.replace(match, replaceValue)\n }\n }\n return url\n}\n\nexport const getUrl = ({\n baseUrl,\n path,\n query,\n querySerializer,\n url: _url,\n}: {\n baseUrl?: string\n path?: Record<string, unknown>\n query?: Record<string, unknown>\n querySerializer: QuerySerializer\n url: string\n}) => {\n const pathUrl = _url.startsWith(\"/\") ? _url : `/${_url}`\n let url = (baseUrl ?? \"\") + pathUrl\n if (path) {\n url = defaultPathSerializer({ path, url })\n }\n let search = query ? querySerializer(query) : \"\"\n if (search.startsWith(\"?\")) {\n search = search.substring(1)\n }\n if (search) {\n url += `?${search}`\n }\n return url\n}\n\nexport function getValidRequestBody(options: {\n body?: unknown\n bodySerializer?: BodySerializer | null\n serializedBody?: unknown\n}) {\n const hasBody = options.body !== undefined\n const isSerializedBody = hasBody && options.bodySerializer\n\n if (isSerializedBody) {\n if (\"serializedBody\" in options) {\n const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== \"\"\n\n return hasSerializedBody ? options.serializedBody : null\n }\n\n // not all clients implement a serializedBody property (i.e. client-axios)\n return options.body !== \"\" ? options.body : null\n }\n\n // plain/text body\n if (hasBody) {\n return options.body\n }\n\n // no body was provided\n return undefined\n}\n",
|
|
151
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nexport type AuthToken = string | undefined\n\nexport interface Auth {\n /**\n * Which part of the request do we use to send the auth?\n *\n * @default 'header'\n */\n in?: \"header\" | \"query\" | \"cookie\"\n /**\n * Header or query parameter name.\n *\n * @default 'Authorization'\n */\n name?: string\n scheme?: \"basic\" | \"bearer\"\n type: \"apiKey\" | \"http\"\n}\n\nexport const getAuthToken = async (\n auth: Auth,\n callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,\n): Promise<string | undefined> => {\n const token = typeof callback === \"function\" ? await callback(auth) : callback\n\n if (!token) {\n return\n }\n\n if (auth.scheme === \"bearer\") {\n return `Bearer ${token}`\n }\n\n if (auth.scheme === \"basic\") {\n return `Basic ${btoa(token)}`\n }\n\n return token\n}\n",
|
|
152
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ArrayStyle, ObjectStyle, SerializerOptions } from \"./pathSerializer.gen.js\"\n\nexport type QuerySerializer = (query: Record<string, unknown>) => string\n\nexport type BodySerializer = (body: any) => any\n\ntype QuerySerializerOptionsObject = {\n allowReserved?: boolean\n array?: Partial<SerializerOptions<ArrayStyle>>\n object?: Partial<SerializerOptions<ObjectStyle>>\n}\n\nexport type QuerySerializerOptions = QuerySerializerOptionsObject & {\n /**\n * Per-parameter serialization overrides. When provided, these settings\n * override the global array/object settings for specific parameter names.\n */\n parameters?: Record<string, QuerySerializerOptionsObject>\n}\n\nconst serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {\n if (typeof value === \"string\" || value instanceof Blob) {\n data.append(key, value)\n } else if (value instanceof Date) {\n data.append(key, value.toISOString())\n } else {\n data.append(key, JSON.stringify(value))\n }\n}\n\nconst serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => {\n if (typeof value === \"string\") {\n data.append(key, value)\n } else {\n data.append(key, JSON.stringify(value))\n }\n}\n\nexport const formDataBodySerializer = {\n bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): FormData => {\n const data = new FormData()\n\n Object.entries(body).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeFormDataPair(data, key, v))\n } else {\n serializeFormDataPair(data, key, value)\n }\n })\n\n return data\n },\n}\n\nexport const jsonBodySerializer = {\n bodySerializer: <T>(body: T): string =>\n JSON.stringify(body, (_key, value) => (typeof value === \"bigint\" ? value.toString() : value)),\n}\n\nexport const urlSearchParamsBodySerializer = {\n bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {\n const data = new URLSearchParams()\n\n Object.entries(body).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeUrlSearchParamsPair(data, key, v))\n } else {\n serializeUrlSearchParamsPair(data, key, value)\n }\n })\n\n return data.toString()\n },\n}\n",
|
|
153
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport { getAuthToken } from \"../core/auth.gen.js\"\nimport type { QuerySerializerOptions } from \"../core/bodySerializer.gen.js\"\nimport { jsonBodySerializer } from \"../core/bodySerializer.gen.js\"\nimport { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from \"../core/pathSerializer.gen.js\"\nimport { getUrl } from \"../core/utils.gen.js\"\nimport type { Client, ClientOptions, Config, RequestOptions } from \"./types.gen.js\"\n\nexport const createQuerySerializer = <T = unknown>({ parameters = {}, ...args }: QuerySerializerOptions = {}) => {\n const querySerializer = (queryParams: T) => {\n const search: string[] = []\n if (queryParams && typeof queryParams === \"object\") {\n for (const name in queryParams) {\n const value = queryParams[name]\n\n if (value === undefined || value === null) {\n continue\n }\n\n const options = parameters[name] || args\n\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: \"form\",\n value,\n ...options.array,\n })\n if (serializedArray) search.push(serializedArray)\n } else if (typeof value === \"object\") {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: \"deepObject\",\n value: value as Record<string, unknown>,\n ...options.object,\n })\n if (serializedObject) search.push(serializedObject)\n } else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value as string,\n })\n if (serializedPrimitive) search.push(serializedPrimitive)\n }\n }\n }\n return search.join(\"&\")\n }\n return querySerializer\n}\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (contentType: string | null): Exclude<Config[\"parseAs\"], \"auto\"> => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return \"stream\"\n }\n\n const cleanContent = contentType.split(\";\")[0]?.trim()\n\n if (!cleanContent) {\n return\n }\n\n if (cleanContent.startsWith(\"application/json\") || cleanContent.endsWith(\"+json\")) {\n return \"json\"\n }\n\n if (cleanContent === \"multipart/form-data\") {\n return \"formData\"\n }\n\n if ([\"application/\", \"audio/\", \"image/\", \"video/\"].some((type) => cleanContent.startsWith(type))) {\n return \"blob\"\n }\n\n if (cleanContent.startsWith(\"text/\")) {\n return \"text\"\n }\n\n return\n}\n\nconst checkForExistence = (\n options: Pick<RequestOptions, \"auth\" | \"query\"> & {\n headers: Headers\n },\n name?: string,\n): boolean => {\n if (!name) {\n return false\n }\n if (options.headers.has(name) || options.query?.[name] || options.headers.get(\"Cookie\")?.includes(`${name}=`)) {\n return true\n }\n return false\n}\n\nexport const setAuthParams = async ({\n security,\n ...options\n}: Pick<Required<RequestOptions>, \"security\"> &\n Pick<RequestOptions, \"auth\" | \"query\"> & {\n headers: Headers\n }) => {\n for (const auth of security) {\n if (checkForExistence(options, auth.name)) {\n continue\n }\n\n const token = await getAuthToken(auth, options.auth)\n\n if (!token) {\n continue\n }\n\n const name = auth.name ?? \"Authorization\"\n\n switch (auth.in) {\n case \"query\":\n if (!options.query) {\n options.query = {}\n }\n options.query[name] = token\n break\n case \"cookie\":\n options.headers.append(\"Cookie\", `${name}=${token}`)\n break\n case \"header\":\n default:\n options.headers.set(name, token)\n break\n }\n }\n}\n\nexport const buildUrl: Client[\"buildUrl\"] = (options) =>\n getUrl({\n baseUrl: options.baseUrl as string,\n path: options.path,\n query: options.query,\n querySerializer:\n typeof options.querySerializer === \"function\"\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n })\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n const config = { ...a, ...b }\n if (config.baseUrl?.endsWith(\"/\")) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1)\n }\n config.headers = mergeHeaders(a.headers, b.headers)\n return config\n}\n\nconst headersEntries = (headers: Headers): Array<[string, string]> => {\n const entries: Array<[string, string]> = []\n headers.forEach((value, key) => {\n entries.push([key, value])\n })\n return entries\n}\n\nexport const mergeHeaders = (...headers: Array<Required<Config>[\"headers\"] | undefined>): Headers => {\n const mergedHeaders = new Headers()\n for (const header of headers) {\n if (!header) {\n continue\n }\n\n const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header)\n\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key)\n } else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v as string)\n }\n } else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e. their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(key, typeof value === \"object\" ? JSON.stringify(value) : (value as string))\n }\n }\n }\n return mergedHeaders\n}\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n error: Err,\n response: Res,\n request: Req,\n options: Options,\n) => Err | Promise<Err>\n\ntype ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>\n\ntype ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>\n\nclass Interceptors<Interceptor> {\n fns: Array<Interceptor | null> = []\n\n clear(): void {\n this.fns = []\n }\n\n eject(id: number | Interceptor): void {\n const index = this.getInterceptorIndex(id)\n if (this.fns[index]) {\n this.fns[index] = null\n }\n }\n\n exists(id: number | Interceptor): boolean {\n const index = this.getInterceptorIndex(id)\n return Boolean(this.fns[index])\n }\n\n getInterceptorIndex(id: number | Interceptor): number {\n if (typeof id === \"number\") {\n return this.fns[id] ? id : -1\n }\n return this.fns.indexOf(id)\n }\n\n update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {\n const index = this.getInterceptorIndex(id)\n if (this.fns[index]) {\n this.fns[index] = fn\n return id\n }\n return false\n }\n\n use(fn: Interceptor): number {\n this.fns.push(fn)\n return this.fns.length - 1\n }\n}\n\nexport interface Middleware<Req, Res, Err, Options> {\n error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>\n request: Interceptors<ReqInterceptor<Req, Options>>\n response: Interceptors<ResInterceptor<Res, Req, Options>>\n}\n\nexport const createInterceptors = <Req, Res, Err, Options>(): Middleware<Req, Res, Err, Options> => ({\n error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n request: new Interceptors<ReqInterceptor<Req, Options>>(),\n response: new Interceptors<ResInterceptor<Res, Req, Options>>(),\n})\n\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: \"form\",\n },\n object: {\n explode: true,\n style: \"deepObject\",\n },\n})\n\nconst defaultHeaders = {\n \"Content-Type\": \"application/json\",\n}\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n override: Config<Omit<ClientOptions, keyof T> & T> = {},\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: \"auto\",\n querySerializer: defaultQuerySerializer,\n ...override,\n})\n",
|
|
154
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport { createSseClient } from \"../core/serverSentEvents.gen.js\"\nimport type { HttpMethod } from \"../core/types.gen.js\"\nimport { getValidRequestBody } from \"../core/utils.gen.js\"\nimport type { Client, Config, RequestOptions, ResolvedRequestOptions } from \"./types.gen.js\"\nimport {\n buildUrl,\n createConfig,\n createInterceptors,\n getParseAs,\n mergeConfigs,\n mergeHeaders,\n setAuthParams,\n} from \"./utils.gen.js\"\n\ntype ReqInit = Omit<RequestInit, \"body\" | \"headers\"> & {\n body?: any\n headers: ReturnType<typeof mergeHeaders>\n}\n\nexport const createClient = (config: Config = {}): Client => {\n let _config = mergeConfigs(createConfig(), config)\n\n const getConfig = (): Config => ({ ..._config })\n\n const setConfig = (config: Config): Config => {\n _config = mergeConfigs(_config, config)\n return getConfig()\n }\n\n const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>()\n\n const beforeRequest = async (options: RequestOptions) => {\n const opts = {\n ..._config,\n ...options,\n fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n headers: mergeHeaders(_config.headers, options.headers),\n serializedBody: undefined,\n }\n\n if (opts.security) {\n await setAuthParams({\n ...opts,\n security: opts.security,\n })\n }\n\n if (opts.requestValidator) {\n await opts.requestValidator(opts)\n }\n\n if (opts.body !== undefined && opts.bodySerializer) {\n opts.serializedBody = opts.bodySerializer(opts.body)\n }\n\n // remove Content-Type header if body is empty to avoid sending invalid requests\n if (opts.body === undefined || opts.serializedBody === \"\") {\n opts.headers.delete(\"Content-Type\")\n }\n\n const url = buildUrl(opts)\n\n return { opts, url }\n }\n\n const request: Client[\"request\"] = async (options) => {\n // @ts-expect-error\n const { opts, url } = await beforeRequest(options)\n const requestInit: ReqInit = {\n redirect: \"follow\",\n ...opts,\n body: getValidRequestBody(opts),\n }\n\n let request = new Request(url, requestInit)\n\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts)\n }\n }\n\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = opts.fetch!\n let response: Response\n\n try {\n response = await _fetch(request)\n } catch (error) {\n // Handle fetch exceptions (AbortError, network errors, etc.)\n let finalError = error\n\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = (await fn(error, undefined as any, request, opts)) as unknown\n }\n }\n\n finalError = finalError || ({} as unknown)\n\n if (opts.throwOnError) {\n throw finalError\n }\n\n // Return error response\n return opts.responseStyle === \"data\"\n ? undefined\n : {\n error: finalError,\n request,\n response: undefined as any,\n }\n }\n\n for (const fn of interceptors.response.fns) {\n if (fn) {\n response = await fn(response, request, opts)\n }\n }\n\n const result = {\n request,\n response,\n }\n\n if (response.ok) {\n const parseAs =\n (opts.parseAs === \"auto\" ? getParseAs(response.headers.get(\"Content-Type\")) : opts.parseAs) ?? \"json\"\n\n if (response.status === 204 || response.headers.get(\"Content-Length\") === \"0\") {\n let emptyData: any\n switch (parseAs) {\n case \"arrayBuffer\":\n case \"blob\":\n case \"text\":\n emptyData = await response[parseAs]()\n break\n case \"formData\":\n emptyData = new FormData()\n break\n case \"stream\":\n emptyData = response.body\n break\n case \"json\":\n default:\n emptyData = {}\n break\n }\n return opts.responseStyle === \"data\"\n ? emptyData\n : {\n data: emptyData,\n ...result,\n }\n }\n\n let data: any\n switch (parseAs) {\n case \"arrayBuffer\":\n case \"blob\":\n case \"formData\":\n case \"text\":\n data = await response[parseAs]()\n break\n case \"json\": {\n // Some servers return 200 with no Content-Length and empty body.\n // response.json() would throw; read as text and parse if non-empty.\n const text = await response.text()\n data = text ? JSON.parse(text) : {}\n break\n }\n case \"stream\":\n return opts.responseStyle === \"data\"\n ? response.body\n : {\n data: response.body,\n ...result,\n }\n }\n\n if (parseAs === \"json\") {\n if (opts.responseValidator) {\n await opts.responseValidator(data)\n }\n\n if (opts.responseTransformer) {\n data = await opts.responseTransformer(data)\n }\n }\n\n return opts.responseStyle === \"data\"\n ? data\n : {\n data,\n ...result,\n }\n }\n\n const textError = await response.text()\n let jsonError: unknown\n\n try {\n jsonError = JSON.parse(textError)\n } catch {\n // noop\n }\n\n const error = jsonError ?? textError\n let finalError = error\n\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = (await fn(error, response, request, opts)) as string\n }\n }\n\n finalError = finalError || ({} as string)\n\n if (opts.throwOnError) {\n throw finalError\n }\n\n // TODO: we probably want to return error and improve types\n return opts.responseStyle === \"data\"\n ? undefined\n : {\n error: finalError,\n ...result,\n }\n }\n\n const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) => request({ ...options, method })\n\n const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {\n const { opts, url } = await beforeRequest(options)\n return createSseClient({\n ...opts,\n body: opts.body as BodyInit | null | undefined,\n headers: opts.headers as unknown as Record<string, string>,\n method,\n onRequest: async (url, init) => {\n let request = new Request(url, init)\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts)\n }\n }\n return request\n },\n serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined,\n url,\n })\n }\n\n return {\n buildUrl,\n connect: makeMethodFn(\"CONNECT\"),\n delete: makeMethodFn(\"DELETE\"),\n get: makeMethodFn(\"GET\"),\n getConfig,\n head: makeMethodFn(\"HEAD\"),\n interceptors,\n options: makeMethodFn(\"OPTIONS\"),\n patch: makeMethodFn(\"PATCH\"),\n post: makeMethodFn(\"POST\"),\n put: makeMethodFn(\"PUT\"),\n request,\n setConfig,\n sse: {\n connect: makeSseFn(\"CONNECT\"),\n delete: makeSseFn(\"DELETE\"),\n get: makeSseFn(\"GET\"),\n head: makeSseFn(\"HEAD\"),\n options: makeSseFn(\"OPTIONS\"),\n patch: makeSseFn(\"PATCH\"),\n post: makeSseFn(\"POST\"),\n put: makeSseFn(\"PUT\"),\n trace: makeSseFn(\"TRACE\"),\n },\n trace: makeMethodFn(\"TRACE\"),\n } as Client\n}\n",
|
|
155
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\ntype Slot = \"body\" | \"headers\" | \"path\" | \"query\"\n\nexport type Field =\n | {\n in: Exclude<Slot, \"body\">\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If omitted, we use the same value as `key`.\n */\n map?: string\n }\n | {\n in: Extract<Slot, \"body\">\n /**\n * Key isn't required for bodies.\n */\n key?: string\n map?: string\n }\n | {\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If `in` is omitted, `map` aliases `key` to the transport layer.\n */\n map: Slot\n }\n\nexport interface Fields {\n allowExtra?: Partial<Record<Slot, boolean>>\n args?: ReadonlyArray<Field>\n}\n\nexport type FieldsConfig = ReadonlyArray<Field | Fields>\n\nconst extraPrefixesMap: Record<string, Slot> = {\n $body_: \"body\",\n $headers_: \"headers\",\n $path_: \"path\",\n $query_: \"query\",\n}\nconst extraPrefixes = Object.entries(extraPrefixesMap)\n\ntype KeyMap = Map<\n string,\n | {\n in: Slot\n map?: string\n }\n | {\n in?: never\n map: Slot\n }\n>\n\nconst buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {\n if (!map) {\n map = new Map()\n }\n\n for (const config of fields) {\n if (\"in\" in config) {\n if (config.key) {\n map.set(config.key, {\n in: config.in,\n map: config.map,\n })\n }\n } else if (\"key\" in config) {\n map.set(config.key, {\n map: config.map,\n })\n } else if (config.args) {\n buildKeyMap(config.args, map)\n }\n }\n\n return map\n}\n\ninterface Params {\n body: unknown\n headers: Record<string, unknown>\n path: Record<string, unknown>\n query: Record<string, unknown>\n}\n\nconst stripEmptySlots = (params: Params) => {\n for (const [slot, value] of Object.entries(params)) {\n if (value && typeof value === \"object\" && !Object.keys(value).length) {\n delete params[slot as Slot]\n }\n }\n}\n\nexport const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {\n const params: Params = {\n body: {},\n headers: {},\n path: {},\n query: {},\n }\n\n const map = buildKeyMap(fields)\n\n let config: FieldsConfig[number] | undefined\n\n for (const [index, arg] of args.entries()) {\n if (fields[index]) {\n config = fields[index]\n }\n\n if (!config) {\n continue\n }\n\n if (\"in\" in config) {\n if (config.key) {\n const field = map.get(config.key)!\n const name = field.map || config.key\n if (field.in) {\n ;(params[field.in] as Record<string, unknown>)[name] = arg\n }\n } else {\n params.body = arg\n }\n } else {\n for (const [key, value] of Object.entries(arg ?? {})) {\n const field = map.get(key)\n\n if (field) {\n if (field.in) {\n const name = field.map || key\n ;(params[field.in] as Record<string, unknown>)[name] = value\n } else {\n params[field.map] = value\n }\n } else {\n const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))\n\n if (extra) {\n const [prefix, slot] = extra\n ;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value\n } else if (\"allowExtra\" in config && config.allowExtra) {\n for (const [slot, allowed] of Object.entries(config.allowExtra)) {\n if (allowed) {\n ;(params[slot as Slot] as Record<string, unknown>)[key] = value\n break\n }\n }\n }\n }\n }\n }\n }\n\n stripEmptySlots(params)\n\n return params\n}\n",
|
|
156
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type ClientOptions, type Config, createClient, createConfig } from \"./client/index.js\"\nimport type { ClientOptions as ClientOptions2 } from \"./types.gen.js\"\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (\n override?: Config<ClientOptions & T>,\n) => Config<Required<ClientOptions> & T>\n\nexport const client = createClient(createConfig<ClientOptions2>({ baseUrl: \"http://localhost:4096\" }))\n",
|
|
157
|
+
"// This file is auto-generated by @hey-api/openapi-ts\n\nimport { client } from \"./client.gen.js\"\nimport { buildClientParams, type Client, type Options as Options2, type TDataShape } from \"./client/index.js\"\nimport type {\n AgentPartInput,\n AppAgentsErrors,\n AppAgentsResponses,\n AppLogErrors,\n AppLogResponses,\n AppSkillsErrors,\n AppSkillsResponses,\n Auth as Auth3,\n AuthRemoveErrors,\n AuthRemoveResponses,\n AuthSetErrors,\n AuthSetResponses,\n CommandListErrors,\n CommandListResponses,\n Config as Config3,\n ConfigGetErrors,\n ConfigGetResponses,\n ConfigProvidersErrors,\n ConfigProvidersResponses,\n ConfigUpdateErrors,\n ConfigUpdateResponses,\n EventSubscribeResponses,\n EventTuiCommandExecute,\n EventTuiPromptAppend,\n EventTuiSessionSelect,\n EventTuiToastShow,\n ExperimentalConsoleGetErrors,\n ExperimentalConsoleGetResponses,\n ExperimentalConsoleListOrgsErrors,\n ExperimentalConsoleListOrgsResponses,\n ExperimentalConsoleSwitchOrgResponses,\n ExperimentalControlPlaneMoveSessionErrors,\n ExperimentalControlPlaneMoveSessionResponses,\n ExperimentalProjectCopyCreateErrors,\n ExperimentalProjectCopyCreateResponses,\n ExperimentalProjectCopyRefreshErrors,\n ExperimentalProjectCopyRefreshResponses,\n ExperimentalProjectCopyRemoveErrors,\n ExperimentalProjectCopyRemoveResponses,\n ExperimentalResourceListErrors,\n ExperimentalResourceListResponses,\n ExperimentalSessionBackgroundErrors,\n ExperimentalSessionBackgroundResponses,\n ExperimentalSessionListErrors,\n ExperimentalSessionListResponses,\n ExperimentalWorkspaceAdapterListErrors,\n ExperimentalWorkspaceAdapterListResponses,\n ExperimentalWorkspaceCreateErrors,\n ExperimentalWorkspaceCreateResponses,\n ExperimentalWorkspaceListErrors,\n ExperimentalWorkspaceListResponses,\n ExperimentalWorkspaceRemoveErrors,\n ExperimentalWorkspaceRemoveResponses,\n ExperimentalWorkspaceStatusErrors,\n ExperimentalWorkspaceStatusResponses,\n ExperimentalWorkspaceSyncListErrors,\n ExperimentalWorkspaceSyncListResponses,\n ExperimentalWorkspaceWarpErrors,\n ExperimentalWorkspaceWarpResponses,\n FileListErrors,\n FileListResponses,\n FilePartInput,\n FilePartSource,\n FileReadErrors,\n FileReadResponses,\n FileStatusErrors,\n FileStatusResponses,\n FindFilesErrors,\n FindFilesResponses,\n FindSymbolsErrors,\n FindSymbolsResponses,\n FindTextErrors,\n FindTextResponses,\n FormatterStatusErrors,\n FormatterStatusResponses,\n GlobalConfigGetErrors,\n GlobalConfigGetResponses,\n GlobalConfigUpdateErrors,\n GlobalConfigUpdateResponses,\n GlobalDisposeErrors,\n GlobalDisposeResponses,\n GlobalEventErrors,\n GlobalEventResponses,\n GlobalHealthErrors,\n GlobalHealthResponses,\n GlobalUpgradeErrors,\n GlobalUpgradeResponses,\n InstanceDisposeErrors,\n InstanceDisposeResponses,\n LspStatusErrors,\n LspStatusResponses,\n McpAddErrors,\n McpAddResponses,\n McpAuthAuthenticateErrors,\n McpAuthAuthenticateResponses,\n McpAuthCallbackErrors,\n McpAuthCallbackResponses,\n McpAuthRemoveErrors,\n McpAuthRemoveResponses,\n McpAuthStartErrors,\n McpAuthStartResponses,\n McpConnectErrors,\n McpConnectResponses,\n McpDisconnectErrors,\n McpDisconnectResponses,\n McpLocalConfig,\n McpRemoteConfig,\n McpStatusErrors,\n McpStatusResponses,\n MoveSessionDestination,\n OutputFormat,\n Part as Part2,\n PartDeleteErrors,\n PartDeleteResponses,\n PartUpdateErrors,\n PartUpdateResponses,\n PathGetErrors,\n PathGetResponses,\n PermissionListErrors,\n PermissionListResponses,\n PermissionReplyErrors,\n PermissionReplyResponses,\n PermissionRespondErrors,\n PermissionRespondResponses,\n PermissionRuleset,\n PermissionV2Reply,\n ProjectCurrentErrors,\n ProjectCurrentResponses,\n ProjectDirectoriesErrors,\n ProjectDirectoriesResponses,\n ProjectInitGitErrors,\n ProjectInitGitResponses,\n ProjectListErrors,\n ProjectListResponses,\n ProjectUpdateErrors,\n ProjectUpdateResponses,\n Prompt,\n ProviderAuthErrors,\n ProviderAuthResponses,\n ProviderListErrors,\n ProviderListResponses,\n ProviderOauthAuthorizeErrors,\n ProviderOauthAuthorizeResponses,\n ProviderOauthCallbackErrors,\n ProviderOauthCallbackResponses,\n PtyConnectErrors,\n PtyConnectResponses,\n PtyConnectTokenErrors,\n PtyConnectTokenResponses,\n PtyCreateErrors,\n PtyCreateResponses,\n PtyGetErrors,\n PtyGetResponses,\n PtyListErrors,\n PtyListResponses,\n PtyRemoveErrors,\n PtyRemoveResponses,\n PtyShellsErrors,\n PtyShellsResponses,\n PtyUpdateErrors,\n PtyUpdateResponses,\n QuestionAnswer,\n QuestionListErrors,\n QuestionListResponses,\n QuestionRejectErrors,\n QuestionRejectResponses,\n QuestionReplyErrors,\n QuestionReplyResponses,\n QuestionV2Reply,\n SessionAbortErrors,\n SessionAbortResponses,\n SessionChildrenErrors,\n SessionChildrenResponses,\n SessionCommandErrors,\n SessionCommandResponses,\n SessionCreateErrors,\n SessionCreateResponses,\n SessionDeleteErrors,\n SessionDeleteMessageErrors,\n SessionDeleteMessageResponses,\n SessionDeleteResponses,\n SessionDiffErrors,\n SessionDiffResponses,\n SessionForkErrors,\n SessionForkResponses,\n SessionGetErrors,\n SessionGetResponses,\n SessionInitErrors,\n SessionInitResponses,\n SessionListErrors,\n SessionListResponses,\n SessionMessageErrors,\n SessionMessageResponses,\n SessionMessagesErrors,\n SessionMessagesResponses,\n SessionPromptAsyncErrors,\n SessionPromptAsyncResponses,\n SessionPromptErrors,\n SessionPromptResponses,\n SessionRevertErrors,\n SessionRevertResponses,\n SessionShareErrors,\n SessionShareResponses,\n SessionShellErrors,\n SessionShellResponses,\n SessionStatusErrors,\n SessionStatusResponses,\n SessionSummarizeErrors,\n SessionSummarizeResponses,\n SessionTodoErrors,\n SessionTodoResponses,\n SessionUnrevertErrors,\n SessionUnrevertResponses,\n SessionUnshareErrors,\n SessionUnshareResponses,\n SessionUpdateErrors,\n SessionUpdateResponses,\n SubtaskPartInput,\n SyncHistoryListErrors,\n SyncHistoryListResponses,\n SyncReplayErrors,\n SyncReplayResponses,\n SyncStartErrors,\n SyncStartResponses,\n SyncStealErrors,\n SyncStealResponses,\n TextPartInput,\n ToolIdsErrors,\n ToolIdsResponses,\n ToolListErrors,\n ToolListResponses,\n TuiAppendPromptErrors,\n TuiAppendPromptResponses,\n TuiClearPromptErrors,\n TuiClearPromptResponses,\n TuiControlNextErrors,\n TuiControlNextResponses,\n TuiControlResponseErrors,\n TuiControlResponseResponses,\n TuiExecuteCommandErrors,\n TuiExecuteCommandResponses,\n TuiOpenHelpErrors,\n TuiOpenHelpResponses,\n TuiOpenModelsErrors,\n TuiOpenModelsResponses,\n TuiOpenSessionsErrors,\n TuiOpenSessionsResponses,\n TuiOpenThemesErrors,\n TuiOpenThemesResponses,\n TuiPublishErrors,\n TuiPublishResponses,\n TuiSelectSessionErrors,\n TuiSelectSessionResponses,\n TuiShowToastErrors,\n TuiShowToastResponses,\n TuiSubmitPromptErrors,\n TuiSubmitPromptResponses,\n V2AgentListErrors,\n V2AgentListResponses,\n V2CommandListErrors,\n V2CommandListResponses,\n V2EventSubscribeErrors,\n V2EventSubscribeResponses,\n V2FsListErrors,\n V2FsListResponses,\n V2FsReadErrors,\n V2FsReadResponses,\n V2HealthGetErrors,\n V2HealthGetResponses,\n V2ModelListErrors,\n V2ModelListResponses,\n V2PermissionRequestListErrors,\n V2PermissionRequestListResponses,\n V2PermissionSavedListErrors,\n V2PermissionSavedListResponses,\n V2PermissionSavedRemoveErrors,\n V2PermissionSavedRemoveResponses,\n V2ProviderGetErrors,\n V2ProviderGetResponses,\n V2ProviderListErrors,\n V2ProviderListResponses,\n V2QuestionRequestListErrors,\n V2QuestionRequestListResponses,\n V2SessionCompactErrors,\n V2SessionCompactResponses,\n V2SessionContextErrors,\n V2SessionContextResponses,\n V2SessionListErrors,\n V2SessionListResponses,\n V2SessionMessagesErrors,\n V2SessionMessagesResponses,\n V2SessionPermissionListErrors,\n V2SessionPermissionListResponses,\n V2SessionPermissionReplyErrors,\n V2SessionPermissionReplyResponses,\n V2SessionPromptErrors,\n V2SessionPromptResponses,\n V2SessionQuestionRejectErrors,\n V2SessionQuestionRejectResponses,\n V2SessionQuestionReplyErrors,\n V2SessionQuestionReplyResponses,\n V2SessionWaitErrors,\n V2SessionWaitResponses,\n V2SkillListErrors,\n V2SkillListResponses,\n VcsApplyErrors,\n VcsApplyResponses,\n VcsDiffErrors,\n VcsDiffRawErrors,\n VcsDiffRawResponses,\n VcsDiffResponses,\n VcsGetErrors,\n VcsGetResponses,\n VcsStatusErrors,\n VcsStatusResponses,\n WorktreeCreateErrors,\n WorktreeCreateInput,\n WorktreeCreateResponses,\n WorktreeListErrors,\n WorktreeListResponses,\n WorktreeRemoveErrors,\n WorktreeRemoveInput,\n WorktreeRemoveResponses,\n WorktreeResetErrors,\n WorktreeResetInput,\n WorktreeResetResponses,\n} from \"./types.gen.js\"\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<\n TData,\n ThrowOnError\n> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>\n}\n\nclass HeyApiClient {\n protected client: Client\n\n constructor(args?: { client?: Client }) {\n this.client = args?.client ?? client\n }\n}\n\nclass HeyApiRegistry<T> {\n private readonly defaultKey = \"default\"\n\n private readonly instances: Map<string, T> = new Map()\n\n get(key?: string): T {\n const instance = this.instances.get(key ?? this.defaultKey)\n if (!instance) {\n throw new Error(`No SDK client found. Create one with \"new OpencodeClient()\" to fix this error.`)\n }\n return instance\n }\n\n set(value: T, key?: string): void {\n this.instances.set(key ?? this.defaultKey, value)\n }\n}\n\nexport class Auth extends HeyApiClient {\n /**\n * Remove auth credentials\n *\n * Remove authentication credentials\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters: {\n providerID: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"path\", key: \"providerID\" }] }])\n return (options?.client ?? this.client).delete<AuthRemoveResponses, AuthRemoveErrors, ThrowOnError>({\n url: \"/auth/{providerID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Set auth credentials\n *\n * Set authentication credentials\n */\n public set<ThrowOnError extends boolean = false>(\n parameters: {\n providerID: string\n auth?: Auth3\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"providerID\" },\n { key: \"auth\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({\n url: \"/auth/{providerID}\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class App extends HeyApiClient {\n /**\n * Write log\n *\n * Write a log entry to the server logs with specified level and metadata.\n */\n public log<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n service?: string\n level?: \"debug\" | \"info\" | \"error\" | \"warn\"\n message?: string\n extra?: {\n [key: string]: unknown\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"service\" },\n { in: \"body\", key: \"level\" },\n { in: \"body\", key: \"message\" },\n { in: \"body\", key: \"extra\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({\n url: \"/log\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * List agents\n *\n * Get a list of all available AI agents in the OpenCode system.\n */\n public agents<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<AppAgentsResponses, AppAgentsErrors, ThrowOnError>({\n url: \"/agent\",\n ...options,\n ...params,\n })\n }\n\n /**\n * List skills\n *\n * Get a list of all available skills in the OpenCode system.\n */\n public skills<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<AppSkillsResponses, AppSkillsErrors, ThrowOnError>({\n url: \"/skill\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class ControlPlane extends HeyApiClient {\n /**\n * Move session\n *\n * Move a session to another project directory, optionally transferring local changes.\n */\n public moveSession<ThrowOnError extends boolean = false>(\n parameters?: {\n sessionID?: string\n destination?: MoveSessionDestination\n moveChanges?: boolean\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"body\", key: \"sessionID\" },\n { in: \"body\", key: \"destination\" },\n { in: \"body\", key: \"moveChanges\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalControlPlaneMoveSessionResponses,\n ExperimentalControlPlaneMoveSessionErrors,\n ThrowOnError\n >({\n url: \"/experimental/control-plane/move-session\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Console extends HeyApiClient {\n /**\n * Get active Console provider metadata\n *\n * Get the active Console org name and the set of provider IDs managed by that Console org.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalConsoleGetResponses,\n ExperimentalConsoleGetErrors,\n ThrowOnError\n >({\n url: \"/experimental/console\",\n ...options,\n ...params,\n })\n }\n\n /**\n * List switchable Console orgs\n *\n * Get the available Console orgs across logged-in accounts, including the current active org.\n */\n public listOrgs<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalConsoleListOrgsResponses,\n ExperimentalConsoleListOrgsErrors,\n ThrowOnError\n >({\n url: \"/experimental/console/orgs\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Switch active Console org\n *\n * Persist a new active Console account/org selection for the current local OpenCode state.\n */\n public switchOrg<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n accountID?: string\n orgID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"accountID\" },\n { in: \"body\", key: \"orgID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<ExperimentalConsoleSwitchOrgResponses, unknown, ThrowOnError>({\n url: \"/experimental/console/switch\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Session extends HeyApiClient {\n /**\n * List sessions\n *\n * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n roots?: boolean | \"true\" | \"false\"\n start?: number\n cursor?: number\n search?: string\n limit?: number\n archived?: boolean | \"true\" | \"false\"\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"roots\" },\n { in: \"query\", key: \"start\" },\n { in: \"query\", key: \"cursor\" },\n { in: \"query\", key: \"search\" },\n { in: \"query\", key: \"limit\" },\n { in: \"query\", key: \"archived\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalSessionListResponses,\n ExperimentalSessionListErrors,\n ThrowOnError\n >({\n url: \"/experimental/session\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Background subagents\n *\n * Detach any synchronous subagents currently blocking the session and continue them in the background.\n */\n public background<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalSessionBackgroundResponses,\n ExperimentalSessionBackgroundErrors,\n ThrowOnError\n >({\n url: \"/experimental/session/{sessionID}/background\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Resource extends HeyApiClient {\n /**\n * Get MCP resources\n *\n * Get all available MCP resources from connected servers. Optionally filter by name.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalResourceListResponses,\n ExperimentalResourceListErrors,\n ThrowOnError\n >({\n url: \"/experimental/resource\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class ProjectCopy extends HeyApiClient {\n /**\n * Remove project copy\n *\n * Remove a local physical copy of a project using the selected strategy.\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters: {\n projectID: string\n query_directory?: string\n workspace?: string\n body_directory?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"projectID\" },\n {\n in: \"query\",\n key: \"query_directory\",\n map: \"directory\",\n },\n { in: \"query\", key: \"workspace\" },\n {\n in: \"body\",\n key: \"body_directory\",\n map: \"directory\",\n },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<\n ExperimentalProjectCopyRemoveResponses,\n ExperimentalProjectCopyRemoveErrors,\n ThrowOnError\n >({\n url: \"/experimental/project/{projectID}/copy\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Create project copy\n *\n * Create a local physical copy of a project using the selected strategy.\n */\n public create<ThrowOnError extends boolean = false>(\n parameters: {\n projectID: string\n workspace?: string\n strategy?: \"git_worktree\"\n directory?: string\n name?: string\n context?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"projectID\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"strategy\" },\n { in: \"body\", key: \"directory\" },\n { in: \"body\", key: \"name\" },\n { in: \"body\", key: \"context\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalProjectCopyCreateResponses,\n ExperimentalProjectCopyCreateErrors,\n ThrowOnError\n >({\n url: \"/experimental/project/{projectID}/copy\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Refresh project copies\n *\n * Discover local project copies using one or all configured strategies.\n */\n public refresh<ThrowOnError extends boolean = false>(\n parameters: {\n projectID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"projectID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalProjectCopyRefreshResponses,\n ExperimentalProjectCopyRefreshErrors,\n ThrowOnError\n >({\n url: \"/experimental/project/{projectID}/copy/refresh\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Adapter extends HeyApiClient {\n /**\n * List workspace adapters\n *\n * List all available workspace adapters for the current project.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalWorkspaceAdapterListResponses,\n ExperimentalWorkspaceAdapterListErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace/adapter\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Workspace extends HeyApiClient {\n /**\n * List workspaces\n *\n * List all workspaces.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalWorkspaceListResponses,\n ExperimentalWorkspaceListErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Create workspace\n *\n * Create a workspace for the current project.\n */\n public create<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n id?: string\n type?: string\n branch?: string | null\n extra?: unknown | null\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"id\" },\n { in: \"body\", key: \"type\" },\n { in: \"body\", key: \"branch\" },\n { in: \"body\", key: \"extra\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalWorkspaceCreateResponses,\n ExperimentalWorkspaceCreateErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Sync workspace list\n *\n * Register missing workspaces returned by workspace adapters.\n */\n public syncList<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalWorkspaceSyncListResponses,\n ExperimentalWorkspaceSyncListErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace/sync-list\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Workspace status\n *\n * Get connection status for workspaces in the current project.\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<\n ExperimentalWorkspaceStatusResponses,\n ExperimentalWorkspaceStatusErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace/status\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Remove workspace\n *\n * Remove an existing workspace.\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters: {\n id: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"id\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<\n ExperimentalWorkspaceRemoveResponses,\n ExperimentalWorkspaceRemoveErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace/{id}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Warp session into workspace\n *\n * Move a session's sync history into the target workspace, or detach it to the local project.\n */\n public warp<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n id?: string | null\n sessionID?: string\n copyChanges?: boolean\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"id\" },\n { in: \"body\", key: \"sessionID\" },\n { in: \"body\", key: \"copyChanges\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ExperimentalWorkspaceWarpResponses,\n ExperimentalWorkspaceWarpErrors,\n ThrowOnError\n >({\n url: \"/experimental/workspace/warp\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n private _adapter?: Adapter\n get adapter(): Adapter {\n return (this._adapter ??= new Adapter({ client: this.client }))\n }\n}\n\nexport class Experimental extends HeyApiClient {\n private _controlPlane?: ControlPlane\n get controlPlane(): ControlPlane {\n return (this._controlPlane ??= new ControlPlane({ client: this.client }))\n }\n\n private _console?: Console\n get console(): Console {\n return (this._console ??= new Console({ client: this.client }))\n }\n\n private _session?: Session\n get session(): Session {\n return (this._session ??= new Session({ client: this.client }))\n }\n\n private _resource?: Resource\n get resource(): Resource {\n return (this._resource ??= new Resource({ client: this.client }))\n }\n\n private _projectCopy?: ProjectCopy\n get projectCopy(): ProjectCopy {\n return (this._projectCopy ??= new ProjectCopy({ client: this.client }))\n }\n\n private _workspace?: Workspace\n get workspace(): Workspace {\n return (this._workspace ??= new Workspace({ client: this.client }))\n }\n}\n\nexport class Config extends HeyApiClient {\n /**\n * Get global configuration\n *\n * Retrieve the current global OpenCode configuration settings and preferences.\n */\n public get<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {\n return (options?.client ?? this.client).get<GlobalConfigGetResponses, GlobalConfigGetErrors, ThrowOnError>({\n url: \"/global/config\",\n ...options,\n })\n }\n\n /**\n * Update global configuration\n *\n * Update global OpenCode configuration settings and preferences.\n */\n public update<ThrowOnError extends boolean = false>(\n parameters?: {\n config?: Config3\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ key: \"config\", map: \"body\" }] }])\n return (options?.client ?? this.client).patch<GlobalConfigUpdateResponses, GlobalConfigUpdateErrors, ThrowOnError>({\n url: \"/global/config\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Global extends HeyApiClient {\n /**\n * Get health\n *\n * Get health information about the OpenCode server.\n */\n public health<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {\n return (options?.client ?? this.client).get<GlobalHealthResponses, GlobalHealthErrors, ThrowOnError>({\n url: \"/global/health\",\n ...options,\n })\n }\n\n /**\n * Get global events\n *\n * Subscribe to global events from the OpenCode system using server-sent events.\n */\n public event<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {\n return (options?.client ?? this.client).sse.get<GlobalEventResponses, GlobalEventErrors, ThrowOnError>({\n url: \"/global/event\",\n ...options,\n })\n }\n\n /**\n * Dispose instance\n *\n * Clean up and dispose all OpenCode instances, releasing all resources.\n */\n public dispose<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {\n return (options?.client ?? this.client).post<GlobalDisposeResponses, GlobalDisposeErrors, ThrowOnError>({\n url: \"/global/dispose\",\n ...options,\n })\n }\n\n /**\n * Upgrade opencode\n *\n * Upgrade opencode to the specified version or latest if not specified.\n */\n public upgrade<ThrowOnError extends boolean = false>(\n parameters?: {\n target?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"body\", key: \"target\" }] }])\n return (options?.client ?? this.client).post<GlobalUpgradeResponses, GlobalUpgradeErrors, ThrowOnError>({\n url: \"/global/upgrade\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n private _config?: Config\n get config(): Config {\n return (this._config ??= new Config({ client: this.client }))\n }\n}\n\nexport class Event extends HeyApiClient {\n /**\n * Subscribe to events\n *\n * Get events\n */\n public subscribe<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).sse.get<EventSubscribeResponses, unknown, ThrowOnError>({\n url: \"/event\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Config2 extends HeyApiClient {\n /**\n * Get configuration\n *\n * Retrieve the current OpenCode configuration settings and preferences.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ConfigGetResponses, ConfigGetErrors, ThrowOnError>({\n url: \"/config\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Update configuration\n *\n * Update OpenCode configuration settings and preferences.\n */\n public update<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n config?: Config3\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"config\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).patch<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({\n url: \"/config\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * List config providers\n *\n * Get a list of all configured AI providers and their default models.\n */\n public providers<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ConfigProvidersResponses, ConfigProvidersErrors, ThrowOnError>({\n url: \"/config/providers\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Tool extends HeyApiClient {\n /**\n * List tools\n *\n * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n provider: string\n model: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"provider\" },\n { in: \"query\", key: \"model\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ToolListResponses, ToolListErrors, ThrowOnError>({\n url: \"/experimental/tool\",\n ...options,\n ...params,\n })\n }\n\n /**\n * List tool IDs\n *\n * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.\n */\n public ids<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({\n url: \"/experimental/tool/ids\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Worktree extends HeyApiClient {\n /**\n * Remove worktree\n *\n * Remove a git worktree and delete its branch.\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n worktreeRemoveInput?: WorktreeRemoveInput\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"worktreeRemoveInput\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<WorktreeRemoveResponses, WorktreeRemoveErrors, ThrowOnError>({\n url: \"/experimental/worktree\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * List worktrees\n *\n * List all sandbox worktrees for the current project.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<WorktreeListResponses, WorktreeListErrors, ThrowOnError>({\n url: \"/experimental/worktree\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Create worktree\n *\n * Create a new git worktree for the current project and run any configured startup scripts.\n */\n public create<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n worktreeCreateInput?: WorktreeCreateInput\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"worktreeCreateInput\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<WorktreeCreateResponses, WorktreeCreateErrors, ThrowOnError>({\n url: \"/experimental/worktree\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Reset worktree\n *\n * Reset a worktree branch to the primary default branch.\n */\n public reset<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n worktreeResetInput?: WorktreeResetInput\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"worktreeResetInput\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<WorktreeResetResponses, WorktreeResetErrors, ThrowOnError>({\n url: \"/experimental/worktree/reset\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Find extends HeyApiClient {\n /**\n * Find text\n *\n * Search for text patterns across files in the project using ripgrep.\n */\n public text<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n pattern: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"pattern\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FindTextResponses, FindTextErrors, ThrowOnError>({\n url: \"/find\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Find files\n *\n * Search for files or directories by name or pattern in the project directory.\n */\n public files<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n query: string\n dirs?: \"true\" | \"false\"\n type?: \"file\" | \"directory\"\n limit?: number\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"query\" },\n { in: \"query\", key: \"dirs\" },\n { in: \"query\", key: \"type\" },\n { in: \"query\", key: \"limit\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FindFilesResponses, FindFilesErrors, ThrowOnError>({\n url: \"/find/file\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Find symbols\n *\n * Search for workspace symbols like functions, classes, and variables using LSP.\n */\n public symbols<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n query: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"query\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FindSymbolsResponses, FindSymbolsErrors, ThrowOnError>({\n url: \"/find/symbol\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class File extends HeyApiClient {\n /**\n * List files\n *\n * List files and directories in a specified path.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n path: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"path\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FileListResponses, FileListErrors, ThrowOnError>({\n url: \"/file\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Read file\n *\n * Read the content of a specified file.\n */\n public read<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n path: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"path\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FileReadResponses, FileReadErrors, ThrowOnError>({\n url: \"/file/content\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get file status\n *\n * Get the git status of all files in the project.\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FileStatusResponses, FileStatusErrors, ThrowOnError>({\n url: \"/file/status\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Instance extends HeyApiClient {\n /**\n * Dispose instance\n *\n * Clean up and dispose the current OpenCode instance, releasing all resources.\n */\n public dispose<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<InstanceDisposeResponses, InstanceDisposeErrors, ThrowOnError>({\n url: \"/instance/dispose\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Path extends HeyApiClient {\n /**\n * Get paths\n *\n * Retrieve the current working directory and related path information for the OpenCode instance.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<PathGetResponses, PathGetErrors, ThrowOnError>({\n url: \"/path\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Diff extends HeyApiClient {\n /**\n * Get raw VCS diff\n *\n * Retrieve a raw patch for current uncommitted changes.\n */\n public raw<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<VcsDiffRawResponses, VcsDiffRawErrors, ThrowOnError>({\n url: \"/vcs/diff/raw\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Vcs extends HeyApiClient {\n /**\n * Get VCS info\n *\n * Retrieve version control system (VCS) information for the current project, such as git branch.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<VcsGetResponses, VcsGetErrors, ThrowOnError>({\n url: \"/vcs\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get VCS status\n *\n * Retrieve changed files in the current working tree without patches.\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<VcsStatusResponses, VcsStatusErrors, ThrowOnError>({\n url: \"/vcs/status\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get VCS diff\n *\n * Retrieve the current git diff for the working tree or against the default branch.\n */\n public diff<ThrowOnError extends boolean = false>(\n parameters: {\n directory?: string\n workspace?: string\n mode: \"git\" | \"branch\"\n context?: number\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"mode\" },\n { in: \"query\", key: \"context\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<VcsDiffResponses, VcsDiffErrors, ThrowOnError>({\n url: \"/vcs/diff\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Apply VCS patch\n *\n * Apply a raw patch to the current working tree.\n */\n public apply<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n patch?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"patch\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<VcsApplyResponses, VcsApplyErrors, ThrowOnError>({\n url: \"/vcs/apply\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n private _diff?: Diff\n get diff2(): Diff {\n return (this._diff ??= new Diff({ client: this.client }))\n }\n}\n\nexport class Command extends HeyApiClient {\n /**\n * List commands\n *\n * Get a list of all available commands in the OpenCode system.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<CommandListResponses, CommandListErrors, ThrowOnError>({\n url: \"/command\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Lsp extends HeyApiClient {\n /**\n * Get LSP status\n *\n * Get LSP server status\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<LspStatusResponses, LspStatusErrors, ThrowOnError>({\n url: \"/lsp\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Formatter extends HeyApiClient {\n /**\n * Get formatter status\n *\n * Get formatter status\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<FormatterStatusResponses, FormatterStatusErrors, ThrowOnError>({\n url: \"/formatter\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Auth2 extends HeyApiClient {\n /**\n * Remove MCP OAuth\n *\n * Remove OAuth credentials for an MCP server.\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters: {\n name: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"name\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<McpAuthRemoveResponses, McpAuthRemoveErrors, ThrowOnError>({\n url: \"/mcp/{name}/auth\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Start MCP OAuth\n *\n * Start OAuth authentication flow for a Model Context Protocol (MCP) server.\n */\n public start<ThrowOnError extends boolean = false>(\n parameters: {\n name: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"name\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<McpAuthStartResponses, McpAuthStartErrors, ThrowOnError>({\n url: \"/mcp/{name}/auth\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Complete MCP OAuth\n *\n * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.\n */\n public callback<ThrowOnError extends boolean = false>(\n parameters: {\n name: string\n directory?: string\n workspace?: string\n code?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"name\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"code\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError>({\n url: \"/mcp/{name}/auth/callback\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Authenticate MCP OAuth\n *\n * Start OAuth flow and wait for callback (opens browser).\n */\n public authenticate<ThrowOnError extends boolean = false>(\n parameters: {\n name: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"name\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, ThrowOnError>(\n {\n url: \"/mcp/{name}/auth/authenticate\",\n ...options,\n ...params,\n },\n )\n }\n}\n\nexport class Mcp extends HeyApiClient {\n /**\n * Get MCP status\n *\n * Get the status of all Model Context Protocol (MCP) servers.\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<McpStatusResponses, McpStatusErrors, ThrowOnError>({\n url: \"/mcp\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Add MCP server\n *\n * Dynamically add a new Model Context Protocol (MCP) server to the system.\n */\n public add<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n name?: string\n config?: McpLocalConfig | McpRemoteConfig\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"name\" },\n { in: \"body\", key: \"config\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<McpAddResponses, McpAddErrors, ThrowOnError>({\n url: \"/mcp\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Connect an MCP server.\n */\n public connect<ThrowOnError extends boolean = false>(\n parameters: {\n name: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"name\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<McpConnectResponses, McpConnectErrors, ThrowOnError>({\n url: \"/mcp/{name}/connect\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Disconnect an MCP server.\n */\n public disconnect<ThrowOnError extends boolean = false>(\n parameters: {\n name: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"name\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<McpDisconnectResponses, McpDisconnectErrors, ThrowOnError>({\n url: \"/mcp/{name}/disconnect\",\n ...options,\n ...params,\n })\n }\n\n private _auth?: Auth2\n get auth(): Auth2 {\n return (this._auth ??= new Auth2({ client: this.client }))\n }\n}\n\nexport class Project extends HeyApiClient {\n /**\n * List all projects\n *\n * Get a list of projects that have been opened with OpenCode.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ProjectListResponses, ProjectListErrors, ThrowOnError>({\n url: \"/project\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get current project\n *\n * Retrieve the currently active project that OpenCode is working with.\n */\n public current<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ProjectCurrentResponses, ProjectCurrentErrors, ThrowOnError>({\n url: \"/project/current\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Initialize git repository\n *\n * Create a git repository for the current project and return the refreshed project info.\n */\n public initGit<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<ProjectInitGitResponses, ProjectInitGitErrors, ThrowOnError>({\n url: \"/project/git/init\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Update project\n *\n * Update project properties such as name, icon, and commands.\n */\n public update<ThrowOnError extends boolean = false>(\n parameters: {\n projectID: string\n directory?: string\n workspace?: string\n name?: string\n icon?: {\n url?: string\n override?: string\n color?: string\n }\n commands?: {\n /**\n * Startup script to run when creating a new workspace (worktree)\n */\n start?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"projectID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"name\" },\n { in: \"body\", key: \"icon\" },\n { in: \"body\", key: \"commands\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).patch<ProjectUpdateResponses, ProjectUpdateErrors, ThrowOnError>({\n url: \"/project/{projectID}\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * List project directories\n *\n * List known local absolute directories for a project.\n */\n public directories<ThrowOnError extends boolean = false>(\n parameters: {\n projectID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"projectID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ProjectDirectoriesResponses, ProjectDirectoriesErrors, ThrowOnError>({\n url: \"/project/{projectID}/directories\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Pty extends HeyApiClient {\n /**\n * List available shells\n *\n * Get a list of available shells on the system.\n */\n public shells<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<PtyShellsResponses, PtyShellsErrors, ThrowOnError>({\n url: \"/pty/shells\",\n ...options,\n ...params,\n })\n }\n\n /**\n * List PTY sessions\n *\n * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<PtyListResponses, PtyListErrors, ThrowOnError>({\n url: \"/pty\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Create PTY session\n *\n * Create a new pseudo-terminal (PTY) session for running shell commands and processes.\n */\n public create<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n command?: string\n args?: Array<string>\n cwd?: string\n title?: string\n env?: {\n [key: string]: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"command\" },\n { in: \"body\", key: \"args\" },\n { in: \"body\", key: \"cwd\" },\n { in: \"body\", key: \"title\" },\n { in: \"body\", key: \"env\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<PtyCreateResponses, PtyCreateErrors, ThrowOnError>({\n url: \"/pty\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Remove PTY session\n *\n * Remove and terminate a specific pseudo-terminal (PTY) session.\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters: {\n ptyID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"ptyID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<PtyRemoveResponses, PtyRemoveErrors, ThrowOnError>({\n url: \"/pty/{ptyID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get PTY session\n *\n * Retrieve detailed information about a specific pseudo-terminal (PTY) session.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters: {\n ptyID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"ptyID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<PtyGetResponses, PtyGetErrors, ThrowOnError>({\n url: \"/pty/{ptyID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Update PTY session\n *\n * Update properties of an existing pseudo-terminal (PTY) session.\n */\n public update<ThrowOnError extends boolean = false>(\n parameters: {\n ptyID: string\n directory?: string\n workspace?: string\n title?: string\n size?: {\n rows: number\n cols: number\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"ptyID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"title\" },\n { in: \"body\", key: \"size\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).put<PtyUpdateResponses, PtyUpdateErrors, ThrowOnError>({\n url: \"/pty/{ptyID}\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Create PTY WebSocket token\n *\n * Create a short-lived ticket for opening a PTY WebSocket connection.\n */\n public connectToken<ThrowOnError extends boolean = false>(\n parameters: {\n ptyID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"ptyID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<PtyConnectTokenResponses, PtyConnectTokenErrors, ThrowOnError>({\n url: \"/pty/{ptyID}/connect-token\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Connect to PTY session\n *\n * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.\n */\n public connect<ThrowOnError extends boolean = false>(\n parameters: {\n ptyID: string\n directory?: string\n workspace?: string\n cursor?: string\n ticket?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"ptyID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"cursor\" },\n { in: \"query\", key: \"ticket\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<PtyConnectResponses, PtyConnectErrors, ThrowOnError>({\n url: \"/pty/{ptyID}/connect\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Question extends HeyApiClient {\n /**\n * List pending questions\n *\n * Get all pending question requests across all sessions.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<QuestionListResponses, QuestionListErrors, ThrowOnError>({\n url: \"/question\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Reply to question request\n *\n * Provide answers to a question request from the AI assistant.\n */\n public reply<ThrowOnError extends boolean = false>(\n parameters: {\n requestID: string\n directory?: string\n workspace?: string\n answers?: Array<QuestionAnswer>\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"requestID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"answers\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<QuestionReplyResponses, QuestionReplyErrors, ThrowOnError>({\n url: \"/question/{requestID}/reply\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Reject question request\n *\n * Reject a question request from the AI assistant.\n */\n public reject<ThrowOnError extends boolean = false>(\n parameters: {\n requestID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"requestID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<QuestionRejectResponses, QuestionRejectErrors, ThrowOnError>({\n url: \"/question/{requestID}/reject\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Permission extends HeyApiClient {\n /**\n * List pending permissions\n *\n * Get all pending permission requests across all sessions.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<PermissionListResponses, PermissionListErrors, ThrowOnError>({\n url: \"/permission\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Respond to permission request\n *\n * Approve or deny a permission request from the AI assistant.\n */\n public reply<ThrowOnError extends boolean = false>(\n parameters: {\n requestID: string\n directory?: string\n workspace?: string\n reply?: \"once\" | \"always\" | \"reject\"\n message?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"requestID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"reply\" },\n { in: \"body\", key: \"message\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<PermissionReplyResponses, PermissionReplyErrors, ThrowOnError>({\n url: \"/permission/{requestID}/reply\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Respond to permission\n *\n * Approve or deny a permission request from the AI assistant.\n *\n * @deprecated\n */\n public respond<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n permissionID: string\n directory?: string\n workspace?: string\n response?: \"once\" | \"always\" | \"reject\"\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"permissionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"response\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<PermissionRespondResponses, PermissionRespondErrors, ThrowOnError>({\n url: \"/session/{sessionID}/permissions/{permissionID}\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Oauth extends HeyApiClient {\n /**\n * Start OAuth authorization\n *\n * Start the OAuth authorization flow for a provider.\n */\n public authorize<ThrowOnError extends boolean = false>(\n parameters: {\n providerID: string\n directory?: string\n workspace?: string\n method?: number\n inputs?: {\n [key: string]: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"providerID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"method\" },\n { in: \"body\", key: \"inputs\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ProviderOauthAuthorizeResponses,\n ProviderOauthAuthorizeErrors,\n ThrowOnError\n >({\n url: \"/provider/{providerID}/oauth/authorize\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Handle OAuth callback\n *\n * Handle the OAuth callback from a provider after user authorization.\n */\n public callback<ThrowOnError extends boolean = false>(\n parameters: {\n providerID: string\n directory?: string\n workspace?: string\n method?: number\n code?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"providerID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"method\" },\n { in: \"body\", key: \"code\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n ProviderOauthCallbackResponses,\n ProviderOauthCallbackErrors,\n ThrowOnError\n >({\n url: \"/provider/{providerID}/oauth/callback\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Provider extends HeyApiClient {\n /**\n * List providers\n *\n * Get a list of all available AI providers, including both available and connected ones.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ProviderListResponses, ProviderListErrors, ThrowOnError>({\n url: \"/provider\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get provider auth methods\n *\n * Retrieve available authentication methods for all AI providers.\n */\n public auth<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<ProviderAuthResponses, ProviderAuthErrors, ThrowOnError>({\n url: \"/provider/auth\",\n ...options,\n ...params,\n })\n }\n\n private _oauth?: Oauth\n get oauth(): Oauth {\n return (this._oauth ??= new Oauth({ client: this.client }))\n }\n}\n\nexport class Session2 extends HeyApiClient {\n /**\n * List sessions\n *\n * Get a list of all OpenCode sessions, sorted by most recently updated.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n scope?: \"project\"\n path?: string\n roots?: boolean | \"true\" | \"false\"\n start?: number\n search?: string\n limit?: number\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"scope\" },\n { in: \"query\", key: \"path\" },\n { in: \"query\", key: \"roots\" },\n { in: \"query\", key: \"start\" },\n { in: \"query\", key: \"search\" },\n { in: \"query\", key: \"limit\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionListResponses, SessionListErrors, ThrowOnError>({\n url: \"/session\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Create session\n *\n * Create a new OpenCode session for interacting with AI assistants and managing conversations.\n */\n public create<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n parentID?: string\n title?: string\n agent?: string\n model?: {\n id: string\n providerID: string\n variant?: string\n }\n metadata?: {\n [key: string]: unknown\n }\n permission?: PermissionRuleset\n workspaceID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"parentID\" },\n { in: \"body\", key: \"title\" },\n { in: \"body\", key: \"agent\" },\n { in: \"body\", key: \"model\" },\n { in: \"body\", key: \"metadata\" },\n { in: \"body\", key: \"permission\" },\n { in: \"body\", key: \"workspaceID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({\n url: \"/session\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Get session status\n *\n * Retrieve the current status of all sessions, including active, idle, and completed states.\n */\n public status<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionStatusResponses, SessionStatusErrors, ThrowOnError>({\n url: \"/session/status\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Delete session\n *\n * Delete a session and permanently remove all associated data, including messages and history.\n */\n public delete<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<SessionDeleteResponses, SessionDeleteErrors, ThrowOnError>({\n url: \"/session/{sessionID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get session\n *\n * Retrieve detailed information about a specific OpenCode session.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionGetResponses, SessionGetErrors, ThrowOnError>({\n url: \"/session/{sessionID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Update session\n *\n * Update properties of an existing session, such as title or other metadata.\n */\n public update<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n title?: string\n metadata?: {\n [key: string]: unknown\n }\n permission?: PermissionRuleset\n time?: {\n archived?: number\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"title\" },\n { in: \"body\", key: \"metadata\" },\n { in: \"body\", key: \"permission\" },\n { in: \"body\", key: \"time\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).patch<SessionUpdateResponses, SessionUpdateErrors, ThrowOnError>({\n url: \"/session/{sessionID}\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Get session children\n *\n * Retrieve all child sessions that were forked from the specified parent session.\n */\n public children<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionChildrenResponses, SessionChildrenErrors, ThrowOnError>({\n url: \"/session/{sessionID}/children\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get session todos\n *\n * Retrieve the todo list associated with a specific session, showing tasks and action items.\n */\n public todo<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionTodoResponses, SessionTodoErrors, ThrowOnError>({\n url: \"/session/{sessionID}/todo\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get message diff\n *\n * Get the file changes (diff) that resulted from a specific user message in the session.\n */\n public diff<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"messageID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionDiffResponses, SessionDiffErrors, ThrowOnError>({\n url: \"/session/{sessionID}/diff\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get session messages\n *\n * Retrieve all messages in a session, including user prompts and AI responses.\n */\n public messages<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n limit?: number\n before?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"limit\" },\n { in: \"query\", key: \"before\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionMessagesResponses, SessionMessagesErrors, ThrowOnError>({\n url: \"/session/{sessionID}/message\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Send message\n *\n * Create and send a new message to a session, streaming the AI response.\n */\n public prompt<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n model?: {\n providerID: string\n modelID: string\n }\n agent?: string\n noReply?: boolean\n tools?: {\n [key: string]: boolean\n }\n format?: OutputFormat\n system?: string\n variant?: string\n parts?: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"messageID\" },\n { in: \"body\", key: \"model\" },\n { in: \"body\", key: \"agent\" },\n { in: \"body\", key: \"noReply\" },\n { in: \"body\", key: \"tools\" },\n { in: \"body\", key: \"format\" },\n { in: \"body\", key: \"system\" },\n { in: \"body\", key: \"variant\" },\n { in: \"body\", key: \"parts\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionPromptResponses, SessionPromptErrors, ThrowOnError>({\n url: \"/session/{sessionID}/message\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Delete message\n *\n * Permanently delete a specific message and all of its parts from a session without reverting file changes.\n */\n public deleteMessage<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n messageID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"messageID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<\n SessionDeleteMessageResponses,\n SessionDeleteMessageErrors,\n ThrowOnError\n >({\n url: \"/session/{sessionID}/message/{messageID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get message\n *\n * Retrieve a specific message from a session by its message ID.\n */\n public message<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n messageID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"messageID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<SessionMessageResponses, SessionMessageErrors, ThrowOnError>({\n url: \"/session/{sessionID}/message/{messageID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Fork session\n *\n * Create a new session by forking an existing session at a specific message point.\n */\n public fork<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"messageID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionForkResponses, SessionForkErrors, ThrowOnError>({\n url: \"/session/{sessionID}/fork\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Abort session\n *\n * Abort an active session and stop any ongoing AI processing or command execution.\n */\n public abort<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionAbortResponses, SessionAbortErrors, ThrowOnError>({\n url: \"/session/{sessionID}/abort\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Initialize session\n *\n * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.\n */\n public init<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n modelID?: string\n providerID?: string\n messageID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"modelID\" },\n { in: \"body\", key: \"providerID\" },\n { in: \"body\", key: \"messageID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionInitResponses, SessionInitErrors, ThrowOnError>({\n url: \"/session/{sessionID}/init\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Unshare session\n *\n * Remove the shareable link for a session, making it private again.\n */\n public unshare<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<SessionUnshareResponses, SessionUnshareErrors, ThrowOnError>({\n url: \"/session/{sessionID}/share\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Share session\n *\n * Create a shareable link for a session, allowing others to view the conversation.\n */\n public share<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionShareResponses, SessionShareErrors, ThrowOnError>({\n url: \"/session/{sessionID}/share\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Summarize session\n *\n * Generate a concise summary of the session using AI compaction to preserve key information.\n */\n public summarize<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n providerID?: string\n modelID?: string\n auto?: boolean\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"providerID\" },\n { in: \"body\", key: \"modelID\" },\n { in: \"body\", key: \"auto\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionSummarizeResponses, SessionSummarizeErrors, ThrowOnError>({\n url: \"/session/{sessionID}/summarize\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Send async message\n *\n * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.\n */\n public promptAsync<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n model?: {\n providerID: string\n modelID: string\n }\n agent?: string\n noReply?: boolean\n tools?: {\n [key: string]: boolean\n }\n format?: OutputFormat\n system?: string\n variant?: string\n parts?: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"messageID\" },\n { in: \"body\", key: \"model\" },\n { in: \"body\", key: \"agent\" },\n { in: \"body\", key: \"noReply\" },\n { in: \"body\", key: \"tools\" },\n { in: \"body\", key: \"format\" },\n { in: \"body\", key: \"system\" },\n { in: \"body\", key: \"variant\" },\n { in: \"body\", key: \"parts\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionPromptAsyncResponses, SessionPromptAsyncErrors, ThrowOnError>({\n url: \"/session/{sessionID}/prompt_async\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Send command\n *\n * Send a new command to a session for execution by the AI assistant.\n */\n public command<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n agent?: string\n model?: string\n arguments?: string\n command?: string\n variant?: string\n parts?: Array<{\n id?: string\n type: \"file\"\n mime: string\n filename?: string\n url: string\n source?: FilePartSource\n }>\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"messageID\" },\n { in: \"body\", key: \"agent\" },\n { in: \"body\", key: \"model\" },\n { in: \"body\", key: \"arguments\" },\n { in: \"body\", key: \"command\" },\n { in: \"body\", key: \"variant\" },\n { in: \"body\", key: \"parts\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionCommandResponses, SessionCommandErrors, ThrowOnError>({\n url: \"/session/{sessionID}/command\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Run shell command\n *\n * Execute a shell command within the session context and return the AI's response.\n */\n public shell<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n agent?: string\n model?: {\n providerID: string\n modelID: string\n }\n command?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"messageID\" },\n { in: \"body\", key: \"agent\" },\n { in: \"body\", key: \"model\" },\n { in: \"body\", key: \"command\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionShellResponses, SessionShellErrors, ThrowOnError>({\n url: \"/session/{sessionID}/shell\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Revert message\n *\n * Revert a specific message in a session, undoing its effects and restoring the previous state.\n */\n public revert<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n messageID?: string\n partID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"messageID\" },\n { in: \"body\", key: \"partID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionRevertResponses, SessionRevertErrors, ThrowOnError>({\n url: \"/session/{sessionID}/revert\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Restore reverted messages\n *\n * Restore all previously reverted messages in a session.\n */\n public unrevert<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SessionUnrevertResponses, SessionUnrevertErrors, ThrowOnError>({\n url: \"/session/{sessionID}/unrevert\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Part extends HeyApiClient {\n /**\n * Delete a part from a message.\n */\n public delete<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n messageID: string\n partID: string\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"messageID\" },\n { in: \"path\", key: \"partID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).delete<PartDeleteResponses, PartDeleteErrors, ThrowOnError>({\n url: \"/session/{sessionID}/message/{messageID}/part/{partID}\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Update a part in a message.\n */\n public update<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n messageID: string\n partID: string\n directory?: string\n workspace?: string\n part?: Part2\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"messageID\" },\n { in: \"path\", key: \"partID\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"part\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).patch<PartUpdateResponses, PartUpdateErrors, ThrowOnError>({\n url: \"/session/{sessionID}/message/{messageID}/part/{partID}\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class History extends HeyApiClient {\n /**\n * List sync events\n *\n * List sync events for all aggregates. Keys are aggregate IDs the client already knows about, values are the last known sequence ID. Events with seq > value are returned for those aggregates. Aggregates not listed in the input get their full history.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n body?: {\n [key: string]: number\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"body\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SyncHistoryListResponses, SyncHistoryListErrors, ThrowOnError>({\n url: \"/sync/history\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Sync extends HeyApiClient {\n /**\n * Start workspace sync\n *\n * Start sync loops for workspaces in the current project that have active sessions.\n */\n public start<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SyncStartResponses, SyncStartErrors, ThrowOnError>({\n url: \"/sync/start\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Replay sync events\n *\n * Validate and replay a complete sync event history.\n */\n public replay<ThrowOnError extends boolean = false>(\n parameters?: {\n query_directory?: string\n workspace?: string\n body_directory?: string\n events?: Array<{\n id: string\n aggregateID: string\n seq: number\n type: string\n data: {\n [key: string]: unknown\n }\n }>\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n {\n in: \"query\",\n key: \"query_directory\",\n map: \"directory\",\n },\n { in: \"query\", key: \"workspace\" },\n {\n in: \"body\",\n key: \"body_directory\",\n map: \"directory\",\n },\n { in: \"body\", key: \"events\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SyncReplayResponses, SyncReplayErrors, ThrowOnError>({\n url: \"/sync/replay\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Steal session into workspace\n *\n * Update a session to belong to the current workspace through the sync event system.\n */\n public steal<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n sessionID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"sessionID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<SyncStealResponses, SyncStealErrors, ThrowOnError>({\n url: \"/sync/steal\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n private _history?: History\n get history(): History {\n return (this._history ??= new History({ client: this.client }))\n }\n}\n\nexport class Control extends HeyApiClient {\n /**\n * Get next TUI request\n *\n * Retrieve the next TUI request from the queue for processing.\n */\n public next<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<TuiControlNextResponses, TuiControlNextErrors, ThrowOnError>({\n url: \"/tui/control/next\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Submit TUI response\n *\n * Submit a response to the TUI request queue to complete a pending request.\n */\n public response<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n body?: unknown\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"body\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiControlResponseResponses, TuiControlResponseErrors, ThrowOnError>({\n url: \"/tui/control/response\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Tui extends HeyApiClient {\n /**\n * Append TUI prompt\n *\n * Append prompt to the TUI.\n */\n public appendPrompt<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n text?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"text\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiAppendPromptResponses, TuiAppendPromptErrors, ThrowOnError>({\n url: \"/tui/append-prompt\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Open help dialog\n *\n * Open the help dialog in the TUI to display user assistance information.\n */\n public openHelp<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiOpenHelpResponses, TuiOpenHelpErrors, ThrowOnError>({\n url: \"/tui/open-help\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Open sessions dialog\n *\n * Open the session dialog.\n */\n public openSessions<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiOpenSessionsResponses, TuiOpenSessionsErrors, ThrowOnError>({\n url: \"/tui/open-sessions\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Open themes dialog\n *\n * Open the theme dialog.\n */\n public openThemes<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiOpenThemesResponses, TuiOpenThemesErrors, ThrowOnError>({\n url: \"/tui/open-themes\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Open models dialog\n *\n * Open the model dialog.\n */\n public openModels<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiOpenModelsResponses, TuiOpenModelsErrors, ThrowOnError>({\n url: \"/tui/open-models\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Submit TUI prompt\n *\n * Submit the prompt.\n */\n public submitPrompt<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiSubmitPromptResponses, TuiSubmitPromptErrors, ThrowOnError>({\n url: \"/tui/submit-prompt\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Clear TUI prompt\n *\n * Clear the prompt.\n */\n public clearPrompt<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiClearPromptResponses, TuiClearPromptErrors, ThrowOnError>({\n url: \"/tui/clear-prompt\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Execute TUI command\n *\n * Execute a TUI command.\n */\n public executeCommand<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n command?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"command\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiExecuteCommandResponses, TuiExecuteCommandErrors, ThrowOnError>({\n url: \"/tui/execute-command\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Show TUI toast\n *\n * Show a toast notification in the TUI.\n */\n public showToast<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n title?: string\n message?: string\n variant?: \"info\" | \"success\" | \"warning\" | \"error\"\n duration?: number\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"title\" },\n { in: \"body\", key: \"message\" },\n { in: \"body\", key: \"variant\" },\n { in: \"body\", key: \"duration\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiShowToastResponses, TuiShowToastErrors, ThrowOnError>({\n url: \"/tui/show-toast\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Publish TUI event\n *\n * Publish a TUI event.\n */\n public publish<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { key: \"body\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiPublishResponses, TuiPublishErrors, ThrowOnError>({\n url: \"/tui/publish\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Select session\n *\n * Navigate the TUI to display the specified session.\n */\n public selectSession<ThrowOnError extends boolean = false>(\n parameters?: {\n directory?: string\n workspace?: string\n sessionID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"workspace\" },\n { in: \"body\", key: \"sessionID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<TuiSelectSessionResponses, TuiSelectSessionErrors, ThrowOnError>({\n url: \"/tui/select-session\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n private _control?: Control\n get control(): Control {\n return (this._control ??= new Control({ client: this.client }))\n }\n}\n\nexport class Health extends HeyApiClient {\n /**\n * Check v2 server health\n *\n * Check whether the v2 API server is ready to accept requests.\n */\n public get<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {\n return (options?.client ?? this.client).get<V2HealthGetResponses, V2HealthGetErrors, ThrowOnError>({\n url: \"/api/health\",\n ...options,\n })\n }\n}\n\nexport class Agent extends HeyApiClient {\n /**\n * List v2 agents\n *\n * Retrieve currently registered v2 agents.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<V2AgentListResponses, V2AgentListErrors, ThrowOnError>({\n url: \"/api/agent\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Permission2 extends HeyApiClient {\n /**\n * List session permission requests\n *\n * Retrieve pending permission requests owned by a session.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"path\", key: \"sessionID\" }] }])\n return (options?.client ?? this.client).get<\n V2SessionPermissionListResponses,\n V2SessionPermissionListErrors,\n ThrowOnError\n >({\n url: \"/api/session/{sessionID}/permission/request\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Reply to pending permission request\n *\n * Respond to a pending permission request owned by a session.\n */\n public reply<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n requestID: string\n reply?: PermissionV2Reply\n message?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"requestID\" },\n { in: \"body\", key: \"reply\" },\n { in: \"body\", key: \"message\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n V2SessionPermissionReplyResponses,\n V2SessionPermissionReplyErrors,\n ThrowOnError\n >({\n url: \"/api/session/{sessionID}/permission/request/{requestID}/reply\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n}\n\nexport class Question2 extends HeyApiClient {\n /**\n * Reply to pending question request\n *\n * Answer a pending question request owned by a session.\n */\n public reply<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n requestID: string\n questionV2Reply: QuestionV2Reply\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"requestID\" },\n { key: \"questionV2Reply\", map: \"body\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n V2SessionQuestionReplyResponses,\n V2SessionQuestionReplyErrors,\n ThrowOnError\n >({\n url: \"/api/session/{sessionID}/question/request/{requestID}/reply\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Reject pending question request\n *\n * Reject a pending question request owned by a session.\n */\n public reject<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n requestID: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"path\", key: \"requestID\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<\n V2SessionQuestionRejectResponses,\n V2SessionQuestionRejectErrors,\n ThrowOnError\n >({\n url: \"/api/session/{sessionID}/question/request/{requestID}/reject\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Session3 extends HeyApiClient {\n /**\n * List v2 sessions\n *\n * Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n workspace?: string\n limit?: number\n order?: \"asc\" | \"desc\"\n search?: string\n directory?: string\n project?: string\n subpath?: string\n cursor?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"workspace\" },\n { in: \"query\", key: \"limit\" },\n { in: \"query\", key: \"order\" },\n { in: \"query\", key: \"search\" },\n { in: \"query\", key: \"directory\" },\n { in: \"query\", key: \"project\" },\n { in: \"query\", key: \"subpath\" },\n { in: \"query\", key: \"cursor\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<V2SessionListResponses, V2SessionListErrors, ThrowOnError>({\n url: \"/api/session\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Send v2 message\n *\n * Durably admit one v2 session input and schedule agent-loop execution unless resume is false.\n */\n public prompt<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n id?: string\n prompt?: Prompt\n delivery?: \"steer\" | \"queue\"\n resume?: boolean\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"body\", key: \"id\" },\n { in: \"body\", key: \"prompt\" },\n { in: \"body\", key: \"delivery\" },\n { in: \"body\", key: \"resume\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).post<V2SessionPromptResponses, V2SessionPromptErrors, ThrowOnError>({\n url: \"/api/session/{sessionID}/prompt\",\n ...options,\n ...params,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n ...params.headers,\n },\n })\n }\n\n /**\n * Compact v2 session\n *\n * Compact a v2 session conversation.\n */\n public compact<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"path\", key: \"sessionID\" }] }])\n return (options?.client ?? this.client).post<V2SessionCompactResponses, V2SessionCompactErrors, ThrowOnError>({\n url: \"/api/session/{sessionID}/compact\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Wait for v2 session\n *\n * Wait for a v2 session agent loop to become idle.\n */\n public wait<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"path\", key: \"sessionID\" }] }])\n return (options?.client ?? this.client).post<V2SessionWaitResponses, V2SessionWaitErrors, ThrowOnError>({\n url: \"/api/session/{sessionID}/wait\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get v2 session context\n *\n * Retrieve the active context messages for a v2 session (all messages after the last compaction).\n */\n public context<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"path\", key: \"sessionID\" }] }])\n return (options?.client ?? this.client).get<V2SessionContextResponses, V2SessionContextErrors, ThrowOnError>({\n url: \"/api/session/{sessionID}/context\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get v2 session messages\n *\n * Retrieve projected v2 messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline.\n */\n public messages<ThrowOnError extends boolean = false>(\n parameters: {\n sessionID: string\n limit?: number\n order?: \"asc\" | \"desc\"\n cursor?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"sessionID\" },\n { in: \"query\", key: \"limit\" },\n { in: \"query\", key: \"order\" },\n { in: \"query\", key: \"cursor\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<V2SessionMessagesResponses, V2SessionMessagesErrors, ThrowOnError>({\n url: \"/api/session/{sessionID}/message\",\n ...options,\n ...params,\n })\n }\n\n private _permission?: Permission2\n get permission(): Permission2 {\n return (this._permission ??= new Permission2({ client: this.client }))\n }\n\n private _question?: Question2\n get question(): Question2 {\n return (this._question ??= new Question2({ client: this.client }))\n }\n}\n\nexport class Model extends HeyApiClient {\n /**\n * List v2 models\n *\n * Retrieve available v2 models ordered by release date.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<V2ModelListResponses, V2ModelListErrors, ThrowOnError>({\n url: \"/api/model\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Provider2 extends HeyApiClient {\n /**\n * List v2 providers\n *\n * Retrieve active v2 AI providers so clients can show provider availability and configuration.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<V2ProviderListResponses, V2ProviderListErrors, ThrowOnError>({\n url: \"/api/provider\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Get v2 provider\n *\n * Retrieve a single v2 AI provider so clients can inspect its availability and endpoint settings.\n */\n public get<ThrowOnError extends boolean = false>(\n parameters: {\n providerID: string\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"path\", key: \"providerID\" },\n { in: \"query\", key: \"location\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<V2ProviderGetResponses, V2ProviderGetErrors, ThrowOnError>({\n url: \"/api/provider/{providerID}\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Request extends HeyApiClient {\n /**\n * List pending permission requests\n *\n * Retrieve pending permission requests for a location.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<\n V2PermissionRequestListResponses,\n V2PermissionRequestListErrors,\n ThrowOnError\n >({\n url: \"/api/permission/request\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Saved extends HeyApiClient {\n /**\n * List saved permissions\n *\n * Retrieve saved permissions, optionally filtered by project.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n projectID?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"projectID\" }] }])\n return (options?.client ?? this.client).get<\n V2PermissionSavedListResponses,\n V2PermissionSavedListErrors,\n ThrowOnError\n >({\n url: \"/api/permission/saved\",\n ...options,\n ...params,\n })\n }\n\n /**\n * Remove saved permission\n *\n * Remove a saved permission by ID.\n */\n public remove<ThrowOnError extends boolean = false>(\n parameters: {\n id: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"path\", key: \"id\" }] }])\n return (options?.client ?? this.client).delete<\n V2PermissionSavedRemoveResponses,\n V2PermissionSavedRemoveErrors,\n ThrowOnError\n >({\n url: \"/api/permission/saved/{id}\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Permission3 extends HeyApiClient {\n private _request?: Request\n get request(): Request {\n return (this._request ??= new Request({ client: this.client }))\n }\n\n private _saved?: Saved\n get saved(): Saved {\n return (this._saved ??= new Saved({ client: this.client }))\n }\n}\n\nexport class Fs extends HeyApiClient {\n /**\n * Read file\n *\n * Read one file relative to the requested location.\n */\n public read<ThrowOnError extends boolean = false>(\n parameters: {\n location?: {\n directory?: string\n workspace?: string\n }\n path: string\n reference?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"location\" },\n { in: \"query\", key: \"path\" },\n { in: \"query\", key: \"reference\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<V2FsReadResponses, V2FsReadErrors, ThrowOnError>({\n url: \"/api/fs/read\",\n ...options,\n ...params,\n })\n }\n\n /**\n * List directory\n *\n * List direct children of one directory relative to the requested location.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n path?: string\n reference?: string\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams(\n [parameters],\n [\n {\n args: [\n { in: \"query\", key: \"location\" },\n { in: \"query\", key: \"path\" },\n { in: \"query\", key: \"reference\" },\n ],\n },\n ],\n )\n return (options?.client ?? this.client).get<V2FsListResponses, V2FsListErrors, ThrowOnError>({\n url: \"/api/fs/list\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Command2 extends HeyApiClient {\n /**\n * List v2 commands\n *\n * Retrieve currently registered v2 commands.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<V2CommandListResponses, V2CommandListErrors, ThrowOnError>({\n url: \"/api/command\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Skill extends HeyApiClient {\n /**\n * List v2 skills\n *\n * Retrieve currently registered v2 skills.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<V2SkillListResponses, V2SkillListErrors, ThrowOnError>({\n url: \"/api/skill\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Event2 extends HeyApiClient {\n /**\n * Subscribe to v2 events\n *\n * Subscribe to native EventV2 payloads for a location.\n */\n public subscribe<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).sse.get<V2EventSubscribeResponses, V2EventSubscribeErrors, ThrowOnError>({\n url: \"/api/event\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Request2 extends HeyApiClient {\n /**\n * List pending question requests\n *\n * Retrieve pending question requests for a location.\n */\n public list<ThrowOnError extends boolean = false>(\n parameters?: {\n location?: {\n directory?: string\n workspace?: string\n }\n },\n options?: Options<never, ThrowOnError>,\n ) {\n const params = buildClientParams([parameters], [{ args: [{ in: \"query\", key: \"location\" }] }])\n return (options?.client ?? this.client).get<\n V2QuestionRequestListResponses,\n V2QuestionRequestListErrors,\n ThrowOnError\n >({\n url: \"/api/question/request\",\n ...options,\n ...params,\n })\n }\n}\n\nexport class Question3 extends HeyApiClient {\n private _request?: Request2\n get request(): Request2 {\n return (this._request ??= new Request2({ client: this.client }))\n }\n}\n\nexport class V2 extends HeyApiClient {\n private _health?: Health\n get health(): Health {\n return (this._health ??= new Health({ client: this.client }))\n }\n\n private _agent?: Agent\n get agent(): Agent {\n return (this._agent ??= new Agent({ client: this.client }))\n }\n\n private _session?: Session3\n get session(): Session3 {\n return (this._session ??= new Session3({ client: this.client }))\n }\n\n private _model?: Model\n get model(): Model {\n return (this._model ??= new Model({ client: this.client }))\n }\n\n private _provider?: Provider2\n get provider(): Provider2 {\n return (this._provider ??= new Provider2({ client: this.client }))\n }\n\n private _permission?: Permission3\n get permission(): Permission3 {\n return (this._permission ??= new Permission3({ client: this.client }))\n }\n\n private _fs?: Fs\n get fs(): Fs {\n return (this._fs ??= new Fs({ client: this.client }))\n }\n\n private _command?: Command2\n get command(): Command2 {\n return (this._command ??= new Command2({ client: this.client }))\n }\n\n private _skill?: Skill\n get skill(): Skill {\n return (this._skill ??= new Skill({ client: this.client }))\n }\n\n private _event?: Event2\n get event(): Event2 {\n return (this._event ??= new Event2({ client: this.client }))\n }\n\n private _question?: Question3\n get question(): Question3 {\n return (this._question ??= new Question3({ client: this.client }))\n }\n}\n\nexport class OpencodeClient extends HeyApiClient {\n public static readonly __registry = new HeyApiRegistry<OpencodeClient>()\n\n constructor(args?: { client?: Client; key?: string }) {\n super(args)\n OpencodeClient.__registry.set(this, args?.key)\n }\n\n private _auth?: Auth\n get auth(): Auth {\n return (this._auth ??= new Auth({ client: this.client }))\n }\n\n private _app?: App\n get app(): App {\n return (this._app ??= new App({ client: this.client }))\n }\n\n private _experimental?: Experimental\n get experimental(): Experimental {\n return (this._experimental ??= new Experimental({ client: this.client }))\n }\n\n private _global?: Global\n get global(): Global {\n return (this._global ??= new Global({ client: this.client }))\n }\n\n private _event?: Event\n get event(): Event {\n return (this._event ??= new Event({ client: this.client }))\n }\n\n private _config?: Config2\n get config(): Config2 {\n return (this._config ??= new Config2({ client: this.client }))\n }\n\n private _tool?: Tool\n get tool(): Tool {\n return (this._tool ??= new Tool({ client: this.client }))\n }\n\n private _worktree?: Worktree\n get worktree(): Worktree {\n return (this._worktree ??= new Worktree({ client: this.client }))\n }\n\n private _find?: Find\n get find(): Find {\n return (this._find ??= new Find({ client: this.client }))\n }\n\n private _file?: File\n get file(): File {\n return (this._file ??= new File({ client: this.client }))\n }\n\n private _instance?: Instance\n get instance(): Instance {\n return (this._instance ??= new Instance({ client: this.client }))\n }\n\n private _path?: Path\n get path(): Path {\n return (this._path ??= new Path({ client: this.client }))\n }\n\n private _vcs?: Vcs\n get vcs(): Vcs {\n return (this._vcs ??= new Vcs({ client: this.client }))\n }\n\n private _command?: Command\n get command(): Command {\n return (this._command ??= new Command({ client: this.client }))\n }\n\n private _lsp?: Lsp\n get lsp(): Lsp {\n return (this._lsp ??= new Lsp({ client: this.client }))\n }\n\n private _formatter?: Formatter\n get formatter(): Formatter {\n return (this._formatter ??= new Formatter({ client: this.client }))\n }\n\n private _mcp?: Mcp\n get mcp(): Mcp {\n return (this._mcp ??= new Mcp({ client: this.client }))\n }\n\n private _project?: Project\n get project(): Project {\n return (this._project ??= new Project({ client: this.client }))\n }\n\n private _pty?: Pty\n get pty(): Pty {\n return (this._pty ??= new Pty({ client: this.client }))\n }\n\n private _question?: Question\n get question(): Question {\n return (this._question ??= new Question({ client: this.client }))\n }\n\n private _permission?: Permission\n get permission(): Permission {\n return (this._permission ??= new Permission({ client: this.client }))\n }\n\n private _provider?: Provider\n get provider(): Provider {\n return (this._provider ??= new Provider({ client: this.client }))\n }\n\n private _session?: Session2\n get session(): Session2 {\n return (this._session ??= new Session2({ client: this.client }))\n }\n\n private _part?: Part\n get part(): Part {\n return (this._part ??= new Part({ client: this.client }))\n }\n\n private _sync?: Sync\n get sync(): Sync {\n return (this._sync ??= new Sync({ client: this.client }))\n }\n\n private _tui?: Tui\n get tui(): Tui {\n return (this._tui ??= new Tui({ client: this.client }))\n }\n\n private _v2?: V2\n get v2(): V2 {\n return (this._v2 ??= new V2({ client: this.client }))\n }\n}\n",
|
|
158
|
+
"/**\n * Wrap whatever the generated client decoded from a non-2xx error body\n * into a real `Error` so downstream formatters (TUI, plugins) get a\n * useful `.message` instead of `[object Object]` or blank. The original\n * parsed body and status live under `.cause` for callers that need\n * structured fields.\n *\n * Only fires when the caller used `{ throwOnError: true }`. Callers that\n * read `result.error` directly (the result-tuple path) get the parsed\n * body unchanged so existing field-level reads (`.error.name`,\n * `JSON.stringify(error)`, etc.) are byte-for-byte identical to before.\n */\nexport function wrapClientError(\n error: unknown,\n response: Response | undefined,\n request: Request | undefined,\n opts: { throwOnError?: boolean } | undefined,\n): unknown {\n if (!opts?.throwOnError) return error\n if (error instanceof Error) return error\n\n // NamedError-shaped responses (the common case for opencode 4xx) come\n // through as POJOs — extract a useful message first, then wrap.\n if (typeof error === \"object\" && error !== null && Object.keys(error).length > 0) {\n const obj = error as { data?: { message?: unknown }; message?: unknown; name?: unknown }\n const message =\n (typeof obj.data?.message === \"string\" && obj.data.message) ||\n (typeof obj.message === \"string\" && obj.message) ||\n (typeof obj.name === \"string\" && obj.name) ||\n describe(request, response)\n return new Error(message, { cause: { body: error, status: response?.status } })\n }\n\n if (typeof error === \"string\" && error.length > 0) {\n return new Error(error, { cause: { body: error, status: response?.status } })\n }\n\n // Empty body / network failure / undefined / null / empty object.\n const reason = response ? \"(empty response body)\" : \"network error (no response)\"\n return new Error(`opencode server ${describe(request, response)}: ${reason}`, {\n cause: { body: error, status: response?.status },\n })\n}\n\nfunction describe(request: Request | undefined, response: Response | undefined) {\n const method = request?.method ?? \"?\"\n const url = request?.url ?? \"?\"\n const status = response?.status\n const statusText = response?.statusText\n return `${method} ${url}${status ? \" → \" + status : \"\"}${statusText ? \" \" + statusText : \"\"}`\n}\n",
|
|
159
|
+
"export * from \"./gen/types.gen.js\"\nexport type {\n FileSystemBinaryContent as LocationFileSystemBinaryContent,\n FileSystemEntry as LocationFileSystemEntry,\n FileSystemTextContent as LocationFileSystemTextContent,\n} from \"./gen/types.gen.js\"\n\nimport { createClient } from \"./gen/client/client.gen.js\"\nimport { type Config } from \"./gen/client/types.gen.js\"\nimport { OpencodeClient } from \"./gen/sdk.gen.js\"\nimport { wrapClientError } from \"../error-interceptor.js\"\nexport { type Config as OpencodeClientConfig, OpencodeClient }\n\nfunction pick(value: string | null, fallback?: string, encode?: (value: string) => string) {\n if (!value) return\n if (!fallback) return value\n if (value === fallback) return fallback\n if (encode && value === encode(fallback)) return fallback\n return value\n}\n\nfunction rewrite(request: Request, values: { directory?: string; workspace?: string }) {\n if (request.method !== \"GET\" && request.method !== \"HEAD\") return request\n\n const url = new URL(request.url)\n let changed = false\n\n for (const [name, key] of [\n [\"x-opencode-directory\", \"directory\"],\n [\"x-opencode-workspace\", \"workspace\"],\n ] as const) {\n const value = pick(\n request.headers.get(name),\n key === \"directory\" ? values.directory : values.workspace,\n key === \"directory\" ? encodeURIComponent : undefined,\n )\n if (!value) continue\n for (const query of url.pathname.startsWith(\"/api/\") ? [key, `location[${key}]`] : [key]) {\n if (!url.searchParams.has(query)) {\n url.searchParams.set(query, value)\n }\n }\n changed = true\n }\n\n if (!changed) return request\n\n const next = new Request(url, request)\n next.headers.delete(\"x-opencode-directory\")\n next.headers.delete(\"x-opencode-workspace\")\n return next\n}\n\nexport function createOpencodeClient(config?: Config & { directory?: string; experimental_workspaceID?: string }) {\n if (!config?.fetch) {\n const customFetch: any = (req: any) => {\n // @ts-ignore\n req.timeout = false\n return fetch(req)\n }\n config = {\n ...config,\n fetch: customFetch,\n }\n }\n\n if (config?.directory) {\n config.headers = {\n ...config.headers,\n \"x-opencode-directory\": encodeURIComponent(config.directory),\n }\n }\n\n if (config?.experimental_workspaceID) {\n config.headers = {\n ...config.headers,\n \"x-opencode-workspace\": config.experimental_workspaceID,\n }\n }\n\n const client = createClient(config)\n client.interceptors.request.use((request) =>\n rewrite(request, {\n directory: config?.directory,\n workspace: config?.experimental_workspaceID,\n }),\n )\n client.interceptors.response.use((response) => {\n const contentType = response.headers.get(\"content-type\")\n if (contentType === \"text/html\")\n throw new Error(\"Request is not supported by this version of OpenCode Server (Server responded with text/html)\")\n\n return response\n })\n client.interceptors.error.use(wrapClientError)\n return new OpencodeClient({ client })\n}\n",
|
|
160
|
+
"export * as ServerAuth from \"./auth\"\n\nimport { Config as EffectConfig, Context, Effect, Layer, Option, Redacted } from \"effect\"\n\nexport type Credentials = {\n password?: string\n username?: string\n}\n\nexport type DecodedCredentials = {\n readonly username: string\n readonly password: Redacted.Redacted\n}\n\nexport type Info = {\n readonly password: Option.Option<string>\n readonly username: string\n}\n\nexport class Config extends Context.Service<Config, Info>()(\"@opencode/ServerAuthConfig\") {\n static layer(input: Info) {\n return Layer.succeed(this, this.of(input))\n }\n\n static get defaultLayer() {\n return Layer.effect(\n this,\n Effect.gen(function* () {\n return Config.of(\n yield* EffectConfig.all({\n password: EffectConfig.string(\"OPENCODE_SERVER_PASSWORD\").pipe(EffectConfig.option),\n username: EffectConfig.string(\"OPENCODE_SERVER_USERNAME\").pipe(EffectConfig.withDefault(\"opencode\")),\n }),\n )\n }),\n )\n }\n}\n\nexport function required(config: Info) {\n return Option.isSome(config.password) && config.password.value !== \"\"\n}\n\nexport function authorized(credentials: DecodedCredentials, config: Info) {\n return (\n Option.isSome(config.password) &&\n credentials.username === config.username &&\n Redacted.value(credentials.password) === config.password.value\n )\n}\n\nexport function header(credentials?: Credentials) {\n const password = credentials?.password ?? process.env.OPENCODE_SERVER_PASSWORD\n if (!password) return undefined\n\n return `Basic ${Buffer.from(`${credentials?.username ?? process.env.OPENCODE_SERVER_USERNAME ?? \"opencode\"}:${password}`).toString(\"base64\")}`\n}\n\nexport function headers(credentials?: Credentials) {\n const authorization = header(credentials)\n if (!authorization) return undefined\n return { Authorization: authorization }\n}\n",
|
|
161
|
+
"import { Global } from \"@opencode-ai/core/global\"\nimport { createOpencodeClient } from \"@opencode-ai/sdk/v2/client\"\nimport { ServerAuth } from \"@opencode-ai/server/auth\"\nimport { Context, Effect, FileSystem, Layer, Option, Schedule, Schema, Scope } from \"effect\"\nimport { HttpServer } from \"effect/unstable/http\"\nimport { randomBytes } from \"crypto\"\nimport path from \"path\"\n\nexport interface Interface {\n readonly client: () => Effect.Effect<ReturnType<typeof createOpencodeClient>, unknown>\n readonly start: () => Effect.Effect<string, Error>\n readonly status: () => Effect.Effect<string | undefined>\n readonly stop: () => Effect.Effect<void, unknown>\n readonly password: (value?: string) => Effect.Effect<string, unknown>\n readonly register: (address: HttpServer.Address) => Effect.Effect<void, unknown, Scope.Scope>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/cli/Daemon\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem\n const directory = Global.Path.state\n const file = path.join(directory, \"server.json\")\n const passwordFile = path.join(directory, \"password\")\n const decodeRegistration = Schema.decodeUnknownEffect(\n Schema.fromJsonString(Schema.Struct({ url: Schema.String, pid: Schema.Number })),\n )\n\n const password = Effect.fn(\"cli.daemon.password\")(function* (value?: string) {\n const existing = yield* fs.readFileString(passwordFile).pipe(Effect.catch(() => Effect.succeed(undefined)))\n if (value === undefined && existing) return existing\n\n // Keep one private credential across server restarts so discovered clients\n // can reconnect without exposing a password flag or environment variable.\n const generated = value ?? randomBytes(32).toString(\"base64url\")\n const temp = passwordFile + \".tmp\"\n yield* fs.makeDirectory(directory, { recursive: true })\n yield* fs.writeFileString(temp, generated, { mode: 0o600 })\n yield* fs.rename(temp, passwordFile)\n return generated\n })\n\n const registration = Effect.fnUntraced(function* () {\n return yield* fs.readFileString(file).pipe(Effect.flatMap(decodeRegistration))\n })\n\n const createClient = Effect.fnUntraced(function* (url: string) {\n return createOpencodeClient({ baseUrl: url, headers: ServerAuth.headers({ password: yield* password() }) })\n })\n\n const healthy = Effect.fnUntraced(function* () {\n const info = yield* registration()\n const client = yield* createClient(info.url)\n const response = yield* Effect.tryPromise(() => client.v2.health.get())\n if (response.data?.healthy === true) return info\n return yield* Effect.fail(new Error(\"Registered server is not healthy\"))\n })\n\n const start = Effect.fn(\"cli.daemon.start\")(function* () {\n const existing = yield* healthy().pipe(Effect.option)\n const found = Option.getOrUndefined(existing)\n if (found) return found.url\n\n yield* Effect.sync(() => {\n const compiled = path.basename(process.execPath).replace(/\\.exe$/, \"\") !== \"bun\"\n Bun.spawn([process.execPath, ...(compiled ? [] : [Bun.main]), \"serve\", \"--register\"], {\n stdin: \"ignore\",\n stdout: \"ignore\",\n stderr: \"ignore\",\n }).unref()\n })\n\n return yield* healthy().pipe(\n Effect.retry(Schedule.spaced(\"50 millis\").pipe(Schedule.both(Schedule.recurs(100)))),\n Effect.map((info) => info.url),\n Effect.mapError(() => new Error(\"Failed to start server\")),\n )\n })\n\n const client = Effect.fn(\"cli.daemon.client\")(function* () {\n return yield* createClient(yield* start())\n })\n\n const status = Effect.fn(\"cli.daemon.status\")(function* () {\n const existing = yield* healthy().pipe(Effect.option)\n const found = Option.getOrUndefined(existing)\n if (found) return found.url\n yield* fs.remove(file).pipe(Effect.ignore)\n return undefined\n })\n\n const signal = (pid: number, signal: NodeJS.Signals) =>\n Effect.try({ try: () => process.kill(pid, signal), catch: (cause) => cause }).pipe(Effect.ignore)\n\n const awaitStopped = Effect.fnUntraced(function* (pid: number) {\n const running = yield* Effect.try({ try: () => process.kill(pid, 0), catch: () => false }).pipe(\n Effect.orElseSucceed(() => false),\n )\n if (!running) return true\n return yield* Effect.fail(new Error(`Server process ${pid} is still running`))\n })\n\n const stop = Effect.fn(\"cli.daemon.stop\")(function* () {\n const existing = yield* healthy().pipe(Effect.option)\n // A stale registration may point at a PID that has since been reused by\n // another process. Only signal the PID after authenticating the server.\n if (Option.isNone(existing)) return yield* fs.remove(file).pipe(Effect.ignore)\n const pid = existing.value.pid\n yield* signal(pid, \"SIGTERM\")\n const stopped = yield* awaitStopped(pid).pipe(\n Effect.retry(Schedule.spaced(\"50 millis\").pipe(Schedule.both(Schedule.recurs(100)))),\n Effect.option,\n )\n if (Option.isNone(stopped)) {\n yield* signal(pid, \"SIGKILL\")\n yield* awaitStopped(pid).pipe(\n Effect.retry(Schedule.spaced(\"50 millis\").pipe(Schedule.both(Schedule.recurs(100)))),\n )\n }\n yield* fs.remove(file).pipe(Effect.ignore)\n })\n\n const register = Effect.fn(\"cli.daemon.register\")(function* (address: HttpServer.Address) {\n const temp = file + \".tmp\"\n yield* fs.makeDirectory(directory, { recursive: true })\n yield* fs.writeFileString(temp, JSON.stringify({ url: HttpServer.formatAddress(address), pid: process.pid }), {\n mode: 0o600,\n })\n yield* fs.rename(temp, file)\n // The metadata file represents this live listener, not persistent config.\n // Scope shutdown removes it when the server exits normally.\n yield* Effect.addFinalizer(() => fs.remove(file).pipe(Effect.ignore))\n })\n\n return Service.of({ client, start, status, stop, password, register })\n }),\n)\n\nexport const defaultLayer = layer\n\nexport * as Daemon from \"./daemon\"\n",
|
|
162
|
+
"import * as Effect from \"effect/Effect\"\nimport * as Command from \"effect/unstable/cli/Command\"\nimport { Spec } from \"./spec\"\nimport { Daemon } from \"../services/daemon\"\n\nexport type Input<Value> =\n Value extends Spec.Node<infer _Name, infer Command, infer _Commands>\n ? Input<Command>\n : Value extends Command.Command<infer _Name, infer Input, infer _Context, infer _Error, infer _Requirements>\n ? Input\n : never\n\ntype RuntimeHandler = (input: unknown) => Effect.Effect<void, unknown, Daemon.Service>\ntype Loader<Node extends Spec.Any> = () => Promise<{\n default: (input: Input<Node>) => Effect.Effect<void, any, Daemon.Service>\n}>\ntype ProvidedCommand = Command.Command<string, unknown, unknown, unknown, Daemon.Service>\n\nexport type Handlers<Node extends Spec.Any> = keyof Node[\"commands\"] extends never\n ? Loader<Node>\n : { readonly $?: Loader<Node> } & { readonly [Key in keyof Node[\"commands\"]]: Handlers<Node[\"commands\"][Key]> }\n\ninterface LazyHandler {\n readonly spec: Command.Command.Any\n readonly load: () => Promise<{ default: RuntimeHandler }>\n}\n\ntype RuntimeHandlers =\n | (() => Promise<{ default: RuntimeHandler }>)\n | {\n readonly $?: () => Promise<{ default: RuntimeHandler }>\n readonly [key: string]: RuntimeHandlers | (() => Promise<{ default: RuntimeHandler }>) | undefined\n }\n\nexport function handler<const Node extends Spec.Any, Error, Requirements>(\n _node: Node,\n run: (input: Input<Node>) => Effect.Effect<void, Error, Requirements>,\n) {\n return run\n}\n\nexport function handlers<const Root extends Spec.Any>(root: Root, handlers: Handlers<Root>) {\n const result: LazyHandler[] = []\n\n function add(node: Spec.Any, value: RuntimeHandlers) {\n if (typeof value === \"function\") {\n result.push({ spec: node.spec, load: value as () => Promise<{ default: RuntimeHandler }> })\n return\n }\n if (value.$) result.push({ spec: node.spec, load: value.$ as () => Promise<{ default: RuntimeHandler }> })\n for (const [name, child] of Object.entries(node.commands)) add(child, value[name] as RuntimeHandlers)\n }\n\n add(root, handlers as RuntimeHandlers)\n return result\n}\n\nexport function run(commands: Spec.Any, handlers: ReadonlyArray<LazyHandler>, options: { readonly version: string }) {\n return Command.run(provide(commands, handlers), options) as Effect.Effect<void, unknown, Command.Environment>\n}\n\nfunction provide(node: Spec.Any, handlers: ReadonlyArray<LazyHandler>): ProvidedCommand {\n const spec: Command.Command.Any = Object.keys(node.commands).length\n ? (node.spec as Command.Command<string, unknown>).pipe(\n Command.withSubcommands(Object.values(node.commands).map((child) => provide(child, handlers))),\n )\n : node.spec\n const handler = handlers.find((handler) => handler.spec === node.spec)\n if (!handler) return spec as ProvidedCommand\n return spec.pipe(\n Command.withHandler((input) =>\n Effect.gen(function* () {\n yield* Effect.flatMap(Effect.promise(handler.load), (module) => module.default(input))\n }),\n ),\n ) as ProvidedCommand\n}\n\nexport * as Runtime from \"./runtime\"\n"
|
|
163
|
+
],
|
|
164
|
+
"mappings": ";42FAAA,SAAQ,wBAAmB,OAAO,UAE5B,GAAS,CAAC,EAAK,EAAM,CAAC,IAAM,CAChC,GAAI,OAAO,IAAQ,SACjB,EAAM,CAAE,QAAS,CAAI,EAEvB,EAAI,MAAQ,EAAI,QAAU,GAC1B,EAAI,QAAU,EAAI,UAAY,GAC9B,EAAI,KAAO,EAAI,OAAS,GACxB,EAAI,WAAa,EAAI,aAAe,IAAQ,EAAI,QAAU,GAG1D,EAAI,SAAW,EAAI,UAAa,OAAO,QAAY,KAAe,QAClE,EAAI,eAAiB,EAAI,iBAAmB,GAG5C,IAAM,EAAM,EAAI,WAAa,QAAU;AAAA,EAAS;AAAA,EAC1C,EAAY,EAAI,WAAa,MAAQ,IACrC,EAAW,CAAC,EAEZ,EAAO,EAAI,KAAO,OAAO,KAAK,CAAG,EAAE,KAAK,EAAI,OAAO,KAAK,CAAG,EAE7D,EAAa,EAQjB,GAAI,EAAI,MACN,EAAa,GAET,EACG,OAAO,KAAK,EAAI,KAAO,MAAQ,MAAM,QAAQ,EAAI,EAAE,GAAK,OAAO,EAAI,KAAO,QAAQ,EAClF,IAAI,KAAK,MAAM,QAAQ,EAAI,EAAE,EAAI,GAAG,MAAQ,CAAC,EAE/C,OAAO,CAAC,EAAE,CAAC,EACX,OAAO,CAAC,EAAG,IAAM,GAAK,CAAC,EAAE,QAAU,GAAK,CAAC,EAAE,OAAS,EAAI,CAAC,CAC9D,EAAE,OAGJ,IAAI,EAAM,GACJ,EAAc,EA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