diff --git a/deno.jsonc b/deno.jsonc index 004f5c1..81ed43f 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -50,20 +50,20 @@ "@cosense/std/browser/websocket": "./websocket/mod.ts", "@cosense/std/rest": "./rest/mod.ts", "@cosense/std/websocket": "./websocket/mod.ts", - "@cosense/types": "jsr:@cosense/types@^0.11.3", + "@cosense/types": "jsr:@cosense/types@^0.11.7", "@deno/dnt": "jsr:@deno/dnt@^0.42.3", - "@progfay/scrapbox-parser": "jsr:@progfay/scrapbox-parser@^10.0.2", - "@std/assert": "jsr:@std/assert@^1.0.14", - "@std/async": "jsr:@std/async@^1.0.14", + "@progfay/scrapbox-parser": "jsr:@progfay/scrapbox-parser@^10.1.1", + "@std/assert": "jsr:@std/assert@^1.0.19", + "@std/async": "jsr:@std/async@^1.3.0", "@std/encoding": "jsr:@std/encoding@^1.0.10", - "@std/http": "jsr:@std/http@^1.0.20", - "@std/json": "jsr:@std/json@^1.0.2", + "@std/http": "jsr:@std/http@^1.1.0", + "@std/json": "jsr:@std/json@^1.1.0", "@std/jsonc": "jsr:@std/jsonc@^1.0.2", - "@std/testing": "jsr:@std/testing@^1.0.15", + "@std/testing": "jsr:@std/testing@^1.0.18", "@takker/md5": "jsr:@takker/md5@0.1", "@takker/onp": "./vendor/raw.githubusercontent.com/takker99/onp/0.0.1/mod.ts", - "option-t": "npm:option-t@53", - "socket.io-client": "npm:socket.io-client@^4.8.1" + "option-t": "npm:option-t@^56.1.2", + "socket.io-client": "npm:socket.io-client@^4.8.3" }, "lint": { "exclude": [ diff --git a/deno.lock b/deno.lock index 311204c..5e78404 100644 --- a/deno.lock +++ b/deno.lock @@ -3,38 +3,31 @@ "specifiers": { "jsr:@core/iterutil@0.9": "0.9.0", "jsr:@core/unknownutil@^4.3.0": "4.3.0", - "jsr:@cosense/types@~0.11.3": "0.11.3", + "jsr:@cosense/types@~0.11.7": "0.11.7", "jsr:@david/code-block-writer@^13.0.3": "13.0.3", "jsr:@deno/dnt@~0.42.3": "0.42.3", - "jsr:@progfay/scrapbox-parser@^10.0.2": "10.0.2", - "jsr:@std/assert@^1.0.13": "1.0.14", - "jsr:@std/assert@^1.0.14": "1.0.14", - "jsr:@std/async@^1.0.14": "1.0.14", - "jsr:@std/cli@^1.0.21": "1.0.22", - "jsr:@std/data-structures@^1.0.9": "1.0.9", + "jsr:@progfay/scrapbox-parser@^10.1.1": "10.1.1", + "jsr:@std/assert@^1.0.19": "1.0.19", + "jsr:@std/async@^1.3.0": "1.3.0", "jsr:@std/encoding@^1.0.10": "1.0.10", - "jsr:@std/fmt@1": "1.0.8", - "jsr:@std/fmt@^1.0.8": "1.0.8", - "jsr:@std/fs@1": "1.0.19", - "jsr:@std/fs@^1.0.19": "1.0.19", - "jsr:@std/html@^1.0.4": "1.0.4", - "jsr:@std/http@^1.0.20": "1.0.20", - "jsr:@std/internal@^1.0.10": "1.0.10", - "jsr:@std/internal@^1.0.9": "1.0.10", - "jsr:@std/json@^1.0.2": "1.0.2", + "jsr:@std/fmt@1": "1.0.10", + "jsr:@std/fs@1": "1.0.23", + "jsr:@std/fs@^1.0.23": "1.0.23", + "jsr:@std/http@^1.1.0": "1.1.0", + "jsr:@std/internal@^1.0.12": "1.0.13", + "jsr:@std/internal@^1.0.13": "1.0.13", + "jsr:@std/json@^1.0.2": "1.1.0", + "jsr:@std/json@^1.1.0": "1.1.0", "jsr:@std/jsonc@^1.0.2": "1.0.2", - "jsr:@std/media-types@^1.1.0": "1.1.0", - "jsr:@std/net@^1.0.4": "1.0.6", - "jsr:@std/path@1": "1.1.2", - "jsr:@std/path@^1.1.1": "1.1.2", - "jsr:@std/streams@^1.0.10": "1.0.11", - "jsr:@std/streams@^1.0.9": "1.0.11", - "jsr:@std/testing@^1.0.15": "1.0.15", + "jsr:@std/path@1": "1.1.4", + "jsr:@std/path@^1.1.4": "1.1.4", + "jsr:@std/streams@^1.1.0": "1.1.0", + "jsr:@std/testing@^1.0.18": "1.0.18", "jsr:@takker/md5@0.1": "0.1.0", "jsr:@ts-morph/bootstrap@0.27": "0.27.0", "jsr:@ts-morph/common@0.27": "0.27.0", - "npm:option-t@53": "53.0.0", - "npm:socket.io-client@^4.8.1": "4.8.1" + "npm:option-t@^56.1.2": "56.1.2", + "npm:socket.io-client@^4.8.3": "4.8.3" }, "jsr": { "@core/iterutil@0.9.0": { @@ -43,8 +36,8 @@ "@core/unknownutil@4.3.0": { "integrity": "538a3687ffa81028e91d148818047df219663d0da671d906cecd165581ae55cc" }, - "@cosense/types@0.11.3": { - "integrity": "de9af0bcf40978cb9ef5a2120971f6d1fc26f19ce4132aa938445ff2f00f514c" + "@cosense/types@0.11.7": { + "integrity": "78452bfb5d975865e3f4ced7bfe952b9254ec6f819b271077b1b1414dc9b69aa" }, "@david/code-block-writer@13.0.3": { "integrity": "f98c77d320f5957899a61bfb7a9bead7c6d83ad1515daee92dbacc861e13bb7f" @@ -53,98 +46,71 @@ "integrity": "62a917a0492f3c8af002dce90605bb0d41f7d29debc06aca40dba72ab65d8ae3", "dependencies": [ "jsr:@david/code-block-writer", - "jsr:@std/fmt@1", + "jsr:@std/fmt", "jsr:@std/fs@1", "jsr:@std/path@1", "jsr:@ts-morph/bootstrap" ] }, - "@progfay/scrapbox-parser@10.0.2": { - "integrity": "759db7c70c1f0bcc4e84853a3da59a6c248eaa87b54c927ea71382adbbfbf076" + "@progfay/scrapbox-parser@10.1.1": { + "integrity": "3ce4a99e49213055bf351f3539bc2bb26ab4bfaa83c77d1d782a6d740cd779e4" }, - "@std/assert@1.0.14": { - "integrity": "68d0d4a43b365abc927f45a9b85c639ea18a9fab96ad92281e493e4ed84abaa4", + "@std/assert@1.0.19": { + "integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e", "dependencies": [ - "jsr:@std/internal@^1.0.10" + "jsr:@std/internal@^1.0.12" ] }, - "@std/async@1.0.14": { - "integrity": "62e954a418652c704d37563a3e54a37d4cf0268a9dcaeac1660cc652880b5326" - }, - "@std/cli@1.0.22": { - "integrity": "50d1e4f87887cb8a8afa29b88505ab5081188f5cad3985460c3b471fa49ff21a" - }, - "@std/data-structures@1.0.9": { - "integrity": "033d6e17e64bf1f84a614e647c1b015fa2576ae3312305821e1a4cb20674bb4d" + "@std/async@1.3.0": { + "integrity": "80485538a4f7baaa46bfe2246168069e02ed142b9f9079cd164f43bb060ad9e9" }, "@std/encoding@1.0.10": { "integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1" }, - "@std/fmt@1.0.8": { - "integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7" + "@std/fmt@1.0.10": { + "integrity": "90dfba288802ac6de82fb31d0917eb9e4450b9925b954d5e51fc29ac07419db5" }, - "@std/fs@1.0.19": { - "integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06", + "@std/fs@1.0.23": { + "integrity": "3ecbae4ce4fee03b180fa710caff36bb5adb66631c46a6460aaad49515565a37", "dependencies": [ - "jsr:@std/internal@^1.0.9", - "jsr:@std/path@^1.1.1" + "jsr:@std/internal@^1.0.12", + "jsr:@std/path@^1.1.4" ] }, - "@std/html@1.0.4": { - "integrity": "eff3497c08164e6ada49b7f81a28b5108087033823153d065e3f89467dd3d50e" - }, - "@std/http@1.0.20": { - "integrity": "b5cc33fc001bccce65ed4c51815668c9891c69ccd908295997e983d8f56070a1", - "dependencies": [ - "jsr:@std/cli", - "jsr:@std/encoding", - "jsr:@std/fmt@^1.0.8", - "jsr:@std/fs@^1.0.19", - "jsr:@std/html", - "jsr:@std/media-types", - "jsr:@std/net", - "jsr:@std/path@^1.1.1", - "jsr:@std/streams@^1.0.10" - ] + "@std/http@1.1.0": { + "integrity": "265cd9a589fea924c5bb0bbed8bebb4bb2fa19129f760bd014e78dbd7a365a51" }, - "@std/internal@1.0.10": { - "integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7" + "@std/internal@1.0.13": { + "integrity": "2f9546691d4ac2d32859c82dff284aaeac980ddeca38430d07941e7e288725c0" }, - "@std/json@1.0.2": { - "integrity": "d9e5497801c15fb679f55a2c01c7794ad7a5dfda4dd1bebab5e409cb5e0d34d4", + "@std/json@1.1.0": { + "integrity": "93330d3ed4054d6b1ffe54b075432c80a5f671be77277b978931e018014cb1cc", "dependencies": [ - "jsr:@std/streams@^1.0.9" + "jsr:@std/streams" ] }, "@std/jsonc@1.0.2": { "integrity": "909605dae3af22bd75b1cbda8d64a32cf1fd2cf6efa3f9e224aba6d22c0f44c7", "dependencies": [ - "jsr:@std/json" + "jsr:@std/json@^1.0.2" ] }, - "@std/media-types@1.1.0": { - "integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4" - }, - "@std/net@1.0.6": { - "integrity": "110735f93e95bb9feb95790a8b1d1bf69ec0dc74f3f97a00a76ea5efea25500c" - }, - "@std/path@1.1.2": { - "integrity": "c0b13b97dfe06546d5e16bf3966b1cadf92e1cc83e56ba5476ad8b498d9e3038", + "@std/path@1.1.4": { + "integrity": "1d2d43f39efb1b42f0b1882a25486647cb851481862dc7313390b2bb044314b5", "dependencies": [ - "jsr:@std/internal@^1.0.10" + "jsr:@std/internal@^1.0.12" ] }, - "@std/streams@1.0.11": { - "integrity": "db583d27e28d133f389f1eec318cffdf4998305e5134c1d4b1c56b361cee6018" + "@std/streams@1.1.0": { + "integrity": "2f7024d841f343fd478afe0c958a3f0f068ef2a0d2bcc954f550f97ac1fa22e3" }, - "@std/testing@1.0.15": { - "integrity": "a490169f5ccb0f3ae9c94fbc69d2cd43603f2cffb41713a85f99bbb0e3087cbc", + "@std/testing@1.0.18": { + "integrity": "d3152f57b11666bf6358d0e127c7e3488e91178b0c2d8fbf0793e1c53cd13cb1", "dependencies": [ - "jsr:@std/assert@^1.0.13", - "jsr:@std/data-structures", - "jsr:@std/fs@^1.0.19", - "jsr:@std/internal@^1.0.10", - "jsr:@std/path@^1.1.1" + "jsr:@std/assert", + "jsr:@std/fs@^1.0.23", + "jsr:@std/internal@^1.0.13", + "jsr:@std/path@^1.1.4" ] }, "@takker/md5@0.1.0": { @@ -157,25 +123,21 @@ ] }, "@ts-morph/common@0.27.0": { - "integrity": "c7b73592d78ce8479b356fd4f3d6ec3c460d77753a8680ff196effea7a939052", - "dependencies": [ - "jsr:@std/fs@1", - "jsr:@std/path@1" - ] + "integrity": "c7b73592d78ce8479b356fd4f3d6ec3c460d77753a8680ff196effea7a939052" } }, "npm": { "@socket.io/component-emitter@3.1.2": { "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" }, - "debug@4.3.7": { - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "debug@4.4.3": { + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dependencies": [ "ms" ] }, - "engine.io-client@6.6.3": { - "integrity": "sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==", + "engine.io-client@6.6.4": { + "integrity": "sha512-+kjUJnZGwzewFDw951CDWcwj35vMNf2fcj7xQWOctq1F2i1jkDdVvdFG9kM/BEChymCH36KgjnW0NsL58JYRxw==", "dependencies": [ "@socket.io/component-emitter", "debug", @@ -190,11 +152,11 @@ "ms@2.1.3": { "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "option-t@53.0.0": { - "integrity": "sha512-qsyo1cFXfUN1MVnxTrpcy+V4tJYEBvEQmeiDkC6m5W/V2JiNfs4V/qXmDGZg4k9XRR1EWkv3jT8TXSZnhGPBLA==" + "option-t@56.1.2": { + "integrity": "sha512-FEEXXhblMiDmQbXC/mBUT9VTHKt2V7nIWXEgPPsBP8bZXq4w3sejmWGPdZ+zoKL6GzQLRyYUeV6ZQ1zWH8GIUw==" }, - "socket.io-client@4.8.1": { - "integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==", + "socket.io-client@4.8.3": { + "integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==", "dependencies": [ "@socket.io/component-emitter", "debug", @@ -202,15 +164,15 @@ "socket.io-parser" ] }, - "socket.io-parser@4.2.4": { - "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "socket.io-parser@4.2.6": { + "integrity": "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==", "dependencies": [ "@socket.io/component-emitter", "debug" ] }, - "ws@8.17.1": { - "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==" + "ws@8.18.3": { + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==" }, "xmlhttprequest-ssl@2.1.2": { "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==" @@ -220,19 +182,19 @@ "dependencies": [ "jsr:@core/iterutil@0.9", "jsr:@core/unknownutil@^4.3.0", - "jsr:@cosense/types@~0.11.3", + "jsr:@cosense/types@~0.11.7", "jsr:@deno/dnt@~0.42.3", - "jsr:@progfay/scrapbox-parser@^10.0.2", - "jsr:@std/assert@^1.0.14", - "jsr:@std/async@^1.0.14", + "jsr:@progfay/scrapbox-parser@^10.1.1", + "jsr:@std/assert@^1.0.19", + "jsr:@std/async@^1.3.0", "jsr:@std/encoding@^1.0.10", - "jsr:@std/http@^1.0.20", - "jsr:@std/json@^1.0.2", + "jsr:@std/http@^1.1.0", + "jsr:@std/json@^1.1.0", "jsr:@std/jsonc@^1.0.2", - "jsr:@std/testing@^1.0.15", + "jsr:@std/testing@^1.0.18", "jsr:@takker/md5@0.1", - "npm:option-t@53", - "npm:socket.io-client@^4.8.1" + "npm:option-t@^56.1.2", + "npm:socket.io-client@^4.8.3" ] } } diff --git a/parser/__snapshots__/youtube.test.ts.snap b/parser/__snapshots__/youtube.test.ts.snap index fca7c9a..bcfca1e 100644 --- a/parser/__snapshots__/youtube.test.ts.snap +++ b/parser/__snapshots__/youtube.test.ts.snap @@ -3,8 +3,14 @@ export const snapshot = {}; snapshot[`youtube links > is 1`] = ` { params: URLSearchParams { - [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]"), - [Symbol("url object")]: URL { + Symbol([[webidl.brand]]): Symbol("[[webidl.brand]]"), + Symbol(list): [ + [ + "v", + "LSvaOcaUQ3Y", + ], + ], + Symbol(url object): URL { hash: "", host: "www.youtube.com", hostname: "www.youtube.com", @@ -17,12 +23,6 @@ snapshot[`youtube links > is 1`] = ` search: "?v=LSvaOcaUQ3Y", username: "", }, - [Symbol(list)]: [ - [ - "v", - "LSvaOcaUQ3Y", - ], - ], }, pathType: "com", videoId: "LSvaOcaUQ3Y", @@ -33,14 +33,14 @@ snapshot[`youtube links > is 2`] = ` { listId: "PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs", params: URLSearchParams { - [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]"), - [Symbol("url object")]: null, - [Symbol(list)]: [ + Symbol([[webidl.brand]]): Symbol("[[webidl.brand]]"), + Symbol(list): [ [ "list", "PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs", ], ], + Symbol(url object): null, }, pathType: "list", } @@ -49,8 +49,18 @@ snapshot[`youtube links > is 2`] = ` snapshot[`youtube links > is 3`] = ` { params: URLSearchParams { - [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]"), - [Symbol("url object")]: URL { + Symbol([[webidl.brand]]): Symbol("[[webidl.brand]]"), + Symbol(list): [ + [ + "v", + "57rdbK4vmKE", + ], + [ + "list", + "PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs", + ], + ], + Symbol(url object): URL { hash: "", host: "www.youtube.com", hostname: "www.youtube.com", @@ -63,16 +73,6 @@ snapshot[`youtube links > is 3`] = ` search: "?v=57rdbK4vmKE&list=PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs", username: "", }, - [Symbol(list)]: [ - [ - "v", - "57rdbK4vmKE", - ], - [ - "list", - "PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs", - ], - ], }, pathType: "com", videoId: "57rdbK4vmKE", @@ -82,8 +82,14 @@ snapshot[`youtube links > is 3`] = ` snapshot[`youtube links > is 4`] = ` { params: URLSearchParams { - [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]"), - [Symbol("url object")]: URL { + Symbol([[webidl.brand]]): Symbol("[[webidl.brand]]"), + Symbol(list): [ + [ + "v", + "nj1cre2e6t0", + ], + ], + Symbol(url object): URL { hash: "", host: "music.youtube.com", hostname: "music.youtube.com", @@ -96,12 +102,6 @@ snapshot[`youtube links > is 4`] = ` search: "?v=nj1cre2e6t0", username: "", }, - [Symbol(list)]: [ - [ - "v", - "nj1cre2e6t0", - ], - ], }, pathType: "com", videoId: "nj1cre2e6t0", @@ -111,9 +111,9 @@ snapshot[`youtube links > is 4`] = ` snapshot[`youtube links > is 5`] = ` { params: URLSearchParams { - [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]"), - [Symbol("url object")]: null, - [Symbol(list)]: [], + Symbol([[webidl.brand]]): Symbol("[[webidl.brand]]"), + Symbol(list): [], + Symbol(url object): null, }, pathType: "dotbe", videoId: "nj1cre2e6t0", diff --git a/rest/auth.ts b/rest/auth.ts index bf9ac04..9da8056 100644 --- a/rest/auth.ts +++ b/rest/auth.ts @@ -1,4 +1,5 @@ -import { createOk, mapForResult, type Result } from "option-t/plain_result"; +import { createOk, type Result } from "option-t/plain_result"; +import { mapForResult } from "option-t/plain_result/map"; import { getProfile } from "./profile.ts"; import type { HTTPError } from "./responseIntoResult.ts"; import type { AbortError, NetworkError } from "./robustFetch.ts"; diff --git a/rest/getCodeBlock.ts b/rest/getCodeBlock.ts index fe9fc70..9afb07b 100644 --- a/rest/getCodeBlock.ts +++ b/rest/getCodeBlock.ts @@ -6,13 +6,9 @@ import type { import { cookie } from "./auth.ts"; import { encodeTitleURI } from "../title.ts"; import { type BaseOptions, setDefaults } from "./options.ts"; -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts"; import { parseHTTPError } from "./parseHTTPError.ts"; import type { FetchError } from "./mod.ts"; diff --git a/rest/getGyazoToken.ts b/rest/getGyazoToken.ts index ca094ef..197527e 100644 --- a/rest/getGyazoToken.ts +++ b/rest/getGyazoToken.ts @@ -1,10 +1,6 @@ -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { NotLoggedInError } from "@cosense/types/rest"; import { cookie } from "./auth.ts"; import { parseHTTPError } from "./parseHTTPError.ts"; diff --git a/rest/getTweetInfo.ts b/rest/getTweetInfo.ts index 1e2ee3e..adcf551 100644 --- a/rest/getTweetInfo.ts +++ b/rest/getTweetInfo.ts @@ -1,10 +1,6 @@ -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { BadRequestError, InvalidURLError, diff --git a/rest/getWebPageTitle.ts b/rest/getWebPageTitle.ts index 15d832f..036dc1e 100644 --- a/rest/getWebPageTitle.ts +++ b/rest/getWebPageTitle.ts @@ -1,10 +1,6 @@ -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { BadRequestError, InvalidURLError, diff --git a/rest/link.ts b/rest/link.ts index 7898bc4..87d088e 100644 --- a/rest/link.ts +++ b/rest/link.ts @@ -1,11 +1,6 @@ -import { - createOk, - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { createOk, isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { ErrorLike, NotFoundError, diff --git a/rest/page-data.ts b/rest/page-data.ts index 353dc85..d932051 100644 --- a/rest/page-data.ts +++ b/rest/page-data.ts @@ -1,11 +1,6 @@ -import { - createOk, - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { createOk, isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { ExportedData, ImportedData, diff --git a/rest/pages.ts b/rest/pages.ts index 80d0f57..cf5731d 100644 --- a/rest/pages.ts +++ b/rest/pages.ts @@ -11,13 +11,11 @@ import { cookie } from "./auth.ts"; import { parseHTTPError } from "./parseHTTPError.ts"; import { encodeTitleURI } from "../title.ts"; import { type BaseOptions, setDefaults } from "./options.ts"; -import { - andThenAsyncForResult, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, -} from "option-t/plain_result"; -import { unwrapOrForMaybe } from "option-t/maybe"; +import type { Result } from "option-t/plain_result"; +import { andThenAsyncForResult } from "option-t/plain_result/and_then_async"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; +import { unwrapOrForMaybe } from "option-t/maybe/unwrap_or"; import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts"; import type { FetchError } from "./robustFetch.ts"; diff --git a/rest/profile.ts b/rest/profile.ts index 6f47aec..a2eacf1 100644 --- a/rest/profile.ts +++ b/rest/profile.ts @@ -1,9 +1,5 @@ -import { - isErr, - mapAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; import type { GuestUser, MemberUser } from "@cosense/types/rest"; import { cookie } from "./auth.ts"; import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts"; diff --git a/rest/project.ts b/rest/project.ts index 963b93e..df1e098 100644 --- a/rest/project.ts +++ b/rest/project.ts @@ -1,10 +1,6 @@ -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { MemberProject, NotFoundError, diff --git a/rest/replaceLinks.ts b/rest/replaceLinks.ts index ecbe5dd..c5abb19 100644 --- a/rest/replaceLinks.ts +++ b/rest/replaceLinks.ts @@ -1,10 +1,6 @@ -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { NotFoundError, NotLoggedInError, diff --git a/rest/search.ts b/rest/search.ts index 4e64e31..07544c4 100644 --- a/rest/search.ts +++ b/rest/search.ts @@ -1,10 +1,6 @@ -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import type { NoQueryError, NotFoundError, diff --git a/rest/snapshot.ts b/rest/snapshot.ts index 37bd752..e770b72 100644 --- a/rest/snapshot.ts +++ b/rest/snapshot.ts @@ -9,13 +9,9 @@ import type { import { cookie } from "./auth.ts"; import { type BaseOptions, setDefaults } from "./options.ts"; import { parseHTTPError } from "./parseHTTPError.ts"; -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts"; import type { FetchError } from "./mod.ts"; diff --git a/rest/table.ts b/rest/table.ts index 45dc7b6..417cae1 100644 --- a/rest/table.ts +++ b/rest/table.ts @@ -6,13 +6,9 @@ import type { import { cookie } from "./auth.ts"; import { encodeTitleURI } from "../title.ts"; import { type BaseOptions, setDefaults } from "./options.ts"; -import { - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; +import { isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts"; import { parseHTTPError } from "./parseHTTPError.ts"; import type { FetchError } from "./mod.ts"; diff --git a/rest/uploadToGCS.ts b/rest/uploadToGCS.ts index 29f48c9..1cd1d53 100644 --- a/rest/uploadToGCS.ts +++ b/rest/uploadToGCS.ts @@ -7,17 +7,12 @@ import { import type { ErrorLike, NotFoundError } from "@cosense/types/rest"; import { md5 } from "@takker/md5"; import { encodeHex } from "@std/encoding/hex"; -import { - createOk, - isErr, - mapAsyncForResult, - mapErrAsyncForResult, - mapForResult, - orElseAsyncForResult, - type Result, - unwrapOk, -} from "option-t/plain_result"; -import { toResultOkFromMaybe } from "option-t/maybe"; +import { createOk, isErr, type Result, unwrapOk } from "option-t/plain_result"; +import { mapAsyncForResult } from "option-t/plain_result/map_async"; +import { mapErrAsyncForResult } from "option-t/plain_result/map_err_async"; +import { mapForResult } from "option-t/plain_result/map"; +import { orElseAsyncForResult } from "option-t/plain_result/or_else_async"; +import { toResultOkFromMaybe } from "option-t/maybe/to_plain_result"; import type { FetchError } from "./robustFetch.ts"; import { type HTTPError, responseIntoResult } from "./responseIntoResult.ts"; diff --git a/websocket/makeChanges.ts b/websocket/makeChanges.ts index 97859ac..5a15864 100644 --- a/websocket/makeChanges.ts +++ b/websocket/makeChanges.ts @@ -7,7 +7,7 @@ import { isString } from "@core/unknownutil/is/string"; import { getHelpfeels } from "./getHelpfeels.ts"; export function* makeChanges( - before: Page, + before: Page, after: (string | { text: string })[], userId: string, ): Generator { diff --git a/websocket/patch.ts b/websocket/patch.ts index 0a51c50..50d733f 100644 --- a/websocket/patch.ts +++ b/websocket/patch.ts @@ -7,7 +7,7 @@ import type { Result } from "option-t/plain_result"; import type { Socket } from "socket.io-client"; import { pinNumber } from "./pin.ts"; -export interface PatchMetadata extends Page { +export interface PatchMetadata extends Page { /** Number of retry attempts for page modification * * Starts at `0` for the first attempt and increments with each retry. diff --git a/websocket/pull.ts b/websocket/pull.ts index 1e21f7f..171138b 100644 --- a/websocket/pull.ts +++ b/websocket/pull.ts @@ -2,15 +2,14 @@ import { createErr, createOk, isErr, - mapForResult, type Result, unwrapOk, } from "option-t/plain_result"; +import { mapForResult } from "option-t/plain_result/map"; import type { NotFoundError, NotLoggedInError, NotMemberError, - Page, } from "@cosense/types/rest"; import { getPage, @@ -22,18 +21,7 @@ import { getProject } from "../rest/project.ts"; import type { HTTPError } from "../rest/responseIntoResult.ts"; import type { AbortError, NetworkError } from "../rest/robustFetch.ts"; import type { BaseOptions } from "../rest/options.ts"; - -/** Extended page metadata required for WebSocket operations - * - * This interface extends the basic {@linkcode Page} type with additional identifiers - * needed for real-time collaboration and page modifications. - */ -export interface PushMetadata extends Page { - /** Unique identifier of the project containing the page */ - projectId: string; - /** Unique identifier of the current user */ - userId: string; -} +import type { PushMetadata } from "./push.ts"; /** Comprehensive error type for page data retrieval operations * diff --git a/websocket/push.ts b/websocket/push.ts index 3ffef56..ac6cbc5 100644 --- a/websocket/push.ts +++ b/websocket/push.ts @@ -67,10 +67,10 @@ export interface RetryError { /** Extended page metadata required for WebSocket operations * - * This interface extends the basic Page type with additional identifiers + * This interface extends the basic {@linkcode Page} type with additional identifiers * needed for real-time collaboration and page modifications. */ -export interface PushMetadata extends Page { +export interface PushMetadata extends Page { /** Unique identifier of the project containing the page */ projectId: string; /** Unique identifier of the current user */