diff --git a/biome.json b/biome.json index 42e0386..5538d96 100644 --- a/biome.json +++ b/biome.json @@ -52,6 +52,7 @@ "useShorthandArrayType": "error" }, "suspicious": { + "noShadowRestrictedNames": "off", "noArrayIndexKey": "off", "noAssignInExpressions": "off", "noConfusingVoidType": "off", diff --git a/buf.gen.yaml b/buf.gen.yaml index 204af74..b2473bc 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -12,4 +12,4 @@ plugins: - target=ts - import_extension=js - json_types=true - out: src/Node/Internal/Protobufs + out: src/core/protobufs diff --git a/package.json b/package.json index e2e222d..b15b911 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,10 @@ "changeset:prepublish": "pnpm version:update && bun scripts/prepublishOnly.ts && pnpm build", "changeset:publish": "pnpm changeset:prepublish && changeset publish", "changeset:version": "changeset version && pnpm install --lockfile-only && pnpm version:update && pnpm format", + "docs:dev": "pnpm --filter site dev", + "docs:extract": "pnpm api-extractor run -c scripts/docgen/api-extractor.json && tsx scripts/docgen/build.ts", + "docs:gen": "pnpm clean && pnpm build:types && pnpm docs:extract", + "docs:build": "pnpm docs:gen && pnpm --filter site build", "clean": "rm -rf *.tsbuildinfo src/*.tsbuildinfo src/_esm src/_types", "format": "biome format --write", "lint": "biome check --fix", @@ -28,9 +32,14 @@ "@bufbuild/protoc-gen-es": "^2.2.0", "@changesets/changelog-github": "^0.5.0", "@changesets/cli": "^2.27.9", + "@microsoft/api-extractor": "^7.48.0", + "@microsoft/api-extractor-model": "^7.30.0", + "@microsoft/tsdoc": "^0.15.1", + "@microsoft/tsdoc-config": "^0.17.1", "@types/bun": "latest", "@types/node": "^22.7.4", "buf": "^0.1.1", + "fs-extra": "^11.2.0", "knip": "^5.33.3", "publint": "^0.2.11", "sherif": "^1.0.1", diff --git a/playground/package.json b/playground/package.json index 27e029a..35badf9 100644 --- a/playground/package.json +++ b/playground/package.json @@ -3,7 +3,7 @@ "type": "module", "private": true, "scripts": { - "dev": "node --import tsx src/index.ts", + "dev": "tsx src/index.ts", "typecheck": "tsc --noEmit" }, "dependencies": { diff --git a/playground/src/index.ts b/playground/src/index.ts index 6a24df1..9f6e569 100644 --- a/playground/src/index.ts +++ b/playground/src/index.ts @@ -1,5 +1,6 @@ -import { Actions, Client, Transport } from 'fhub' -// import { Actions as NodeActions } from 'fhub/Node' +import * as Fhub from 'fhub' +import * as FhubCore from 'fhub/core' +// import { NextPageToken } from 'fhub/_types/Node/Types' const RPC_URL = process.env.RPC_URL ?? 'https://hub-grpc.pinata.cloud' // const FID = (() => { @@ -12,108 +13,22 @@ const RPC_URL = process.env.RPC_URL ?? 'https://hub-grpc.pinata.cloud' // return process.env.PRIVATE_KEY as `0x${string}` // })() -const client = Client.create( - Transport.grpcNode({ +const client = Fhub.Client.create( + Fhub.Transport.grpcNode({ baseUrl: RPC_URL, httpVersion: '2', }), ) -// Actions.Cast.getCast(client, { -// fid: 3621n, -// hash: '880700eca6c454facaa9bd05ef15fa0b6996a0d2' as any, -// }).then((res) => console.log(res)) - -// console.time('casts') -// const casts = await Actions.Cast.getCastsByFid(client, { -// fid: 3n, -// pageSize: 2, -// }) -// console.timeEnd('casts') -// console.dir(casts, { depth: null }) -// -// console.time('bio') -// const myBio = await Actions.UserData.getUserDataBio(client, { fid: 11517n }) -// // biome-ignore lint/suspicious/noConsoleLog: -// console.log(myBio) -// console.timeEnd('bio') - -// const castWithReactions = await Actions.Cast.getCast(client, { -// hash: '0x62cda93dc3889a6f0c819cd4d9392b3af2cb452a', -// fid: 862185n, -// }) -// console.dir(castWithReactions, { depth: null }) -// // biome-ignore lint/suspicious/noConsoleLog: -// console.log('likes', castWithReactions.likes.length) -// // biome-ignore lint/suspicious/noConsoleLog: -// console.log('recasts', castWithReactions.recasts.length) - -// events subscriptions -// for await (const cast of Actions.Watch.watchCasts(client)) { -// // biome-ignore lint/suspicious/noConsoleLog: -// console.log(`${cast.fid} casted at ${cast.timestamp}: ${cast.text.value}`) -// } -// - -// const cast = await Actions.Cast.getCast(client, { -// fid: FID, -// hash: '0x388ec5079a518ca133ec87aac23e1c4743bcc860', -// }) - -//cast creation - -// const message = await Actions.Cast.create(client, { -// text: `I'm sending this cast from fhub. It contains mentions of @farcaster, @dalechyn.eth, @vladyslav. -// It also contains a cast embed (https://warpcast.com/dalechyn.eth/0x9c0a228b). I sent it using just a string. -// It also contains a cool cat pic at the end\nhttps://wrpcd.net/cdn-cgi/imagedelivery/BXluQx4ige9GuW0Ia56BHw/0cf0da74-9bf1-4d4a-4b96-2cb950801400/original`, -// account: { -// fid: FID, -// privateKey: PRIVATE_KEY, -// }, -// }) - -//follow creation - -// const message = await Actions.Follow.createByUsername(client, { -// follow: { -// username: 'compusophy', -// }, -// account: { -// fid: FID, -// privateKey: PRIVATE_KEY, -// }, -// }) - -// like cast - -// const message = await Actions.Like.create(client, { -// like: { -// hash: '0xcefbeba351b33fb62ca8c7a6ba75dd9a365f0254', -// fid: 616n, -// }, -// account: { -// fid: FID, -// privateKey: PRIVATE_KEY, -// }, -// }) - -//recast - -// const message = await Actions.Recast.create(client, { -// recast: { -// hash: '0xcefbeba351b33fb62ca8c7a6ba75dd9a365f0254', -// fid: 616n, -// }, -// account: { -// fid: FID, -// privateKey: PRIVATE_KEY, -// }, -// }) - -// console.dir(message) - -// for await (const cast of Actions.Watch.watchCastsMentioningUsername(client, { -// username: 'bleu.eth', -// })) -// console.dir(cast) -console.dir(await Actions.User.get(client, { fid: 11517n })) +console.dir( + await FhubCore.Actions.Cast.get(client, { + fid: 11517n, + hash: '0x11241be53fe76933e48e5d601a199ed3f5db254b', + }), +) +console.dir( + await Fhub.Actions.SuperCast.get(client, { + fid: 11517n, + hash: '0x11241be53fe76933e48e5d601a199ed3f5db254b', + }), +) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c0fd60..3dcf727 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '9.0' +lockfileVersion: '6.0' settings: autoInstallPeers: true @@ -10,43 +10,58 @@ importers: devDependencies: '@biomejs/biome': specifier: ^1.9.3 - version: 1.9.3 + version: 1.9.4 '@bufbuild/buf': specifier: ^1.44.0 - version: 1.44.0 + version: 1.47.2 '@bufbuild/protoc-gen-es': specifier: ^2.2.0 - version: 2.2.0(@bufbuild/protobuf@2.2.0) + version: 2.2.3 '@changesets/changelog-github': specifier: ^0.5.0 version: 0.5.0 '@changesets/cli': specifier: ^2.27.9 - version: 2.27.9 + version: 2.27.10 + '@microsoft/api-extractor': + specifier: ^7.48.0 + version: 7.48.0(@types/node@22.10.1) + '@microsoft/api-extractor-model': + specifier: ^7.30.0 + version: 7.30.0(@types/node@22.10.1) + '@microsoft/tsdoc': + specifier: ^0.15.1 + version: 0.15.1 + '@microsoft/tsdoc-config': + specifier: ^0.17.1 + version: 0.17.1 '@types/bun': specifier: latest - version: 1.1.13 + version: 1.1.14 '@types/node': specifier: ^22.7.4 - version: 22.7.4 + version: 22.10.1 buf: specifier: ^0.1.1 version: 0.1.1 + fs-extra: + specifier: ^11.2.0 + version: 11.2.0 knip: specifier: ^5.33.3 - version: 5.33.3(@types/node@22.7.4)(typescript@5.6.2) + version: 5.39.2(@types/node@22.10.1)(typescript@5.7.2) publint: specifier: ^0.2.11 - version: 0.2.11 + version: 0.2.12 sherif: specifier: ^1.0.1 - version: 1.0.1 + version: 1.1.0 simple-git-hooks: specifier: ^2.11.1 version: 2.11.1 typescript: specifier: ^5.6.2 - version: 5.6.2 + version: 5.7.2 playground: dependencies: @@ -56,34 +71,34 @@ importers: devDependencies: tsx: specifier: ^4.7.1 - version: 4.19.1 + version: 4.19.2 src: dependencies: '@bufbuild/protobuf': specifier: ^2.2.2 - version: 2.2.2 + version: 2.2.3 '@connectrpc/connect': specifier: beta - version: 2.0.0-beta.2(@bufbuild/protobuf@2.2.2) + version: 2.0.0-beta.2(@bufbuild/protobuf@2.2.3) '@connectrpc/connect-node': specifier: beta - version: 2.0.0-beta.2(@bufbuild/protobuf@2.2.2)(@connectrpc/connect@2.0.0-beta.2(@bufbuild/protobuf@2.2.2)) + version: 2.0.0-beta.2(@bufbuild/protobuf@2.2.3)(@connectrpc/connect@2.0.0-beta.2) '@connectrpc/connect-web': specifier: beta - version: 2.0.0-beta.2(@bufbuild/protobuf@2.2.2)(@connectrpc/connect@2.0.0-beta.2(@bufbuild/protobuf@2.2.2)) + version: 2.0.0-beta.2(@bufbuild/protobuf@2.2.3)(@connectrpc/connect@2.0.0-beta.2) '@farcaster/core': specifier: ^0.15.6 - version: 0.15.6(typescript@5.6.2)(zod@3.23.8) + version: 0.15.6(typescript@5.7.2)(zod@3.24.0) '@noble/ed25519': specifier: ^2.1.0 version: 2.1.0 '@noble/hashes': specifier: ^1.5.0 - version: 1.5.0 + version: 1.6.1 bundle-require: specifier: ^5.0.0 - version: 5.0.0(esbuild@0.23.1) + version: 5.0.0(esbuild@0.24.0) cac: specifier: ^6.7.14 version: 6.7.14 @@ -101,7 +116,7 @@ importers: version: 8.1.1 ox: specifier: 0.0.0-canary-20241006052626 - version: 0.0.0-canary-20241006052626(typescript@5.6.2)(zod@3.23.8) + version: 0.0.0-canary-20241006052626(typescript@5.7.2)(zod@3.24.0) pathe: specifier: ^1.1.2 version: 1.1.2 @@ -110,13 +125,13 @@ importers: version: 1.1.1 prettier: specifier: ^3.3.3 - version: 3.3.3 + version: 3.4.2 typescript: specifier: '>=5.0.4' - version: 5.6.2 + version: 5.7.2 zod: specifier: ^3.23.8 - version: 3.23.8 + version: 3.24.0 devDependencies: '@types/fs-extra': specifier: ^11.0.4 @@ -124,427 +139,1134 @@ importers: packages: - '@adraffy/ens-normalize@1.11.0': + /@adraffy/ens-normalize@1.11.0: resolution: {integrity: sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==} + dev: false - '@babel/runtime@7.25.7': - resolution: {integrity: sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==} + /@babel/runtime@7.26.0: + resolution: {integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==} engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.1 + dev: true - '@biomejs/biome@1.9.3': - resolution: {integrity: sha512-POjAPz0APAmX33WOQFGQrwLvlu7WLV4CFJMlB12b6ZSg+2q6fYu9kZwLCOA+x83zXfcPd1RpuWOKJW0GbBwLIQ==} + /@biomejs/biome@1.9.4: + resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==} engines: {node: '>=14.21.3'} hasBin: true - - '@biomejs/cli-darwin-arm64@1.9.3': - resolution: {integrity: sha512-QZzD2XrjJDUyIZK+aR2i5DDxCJfdwiYbUKu9GzkCUJpL78uSelAHAPy7m0GuPMVtF/Uo+OKv97W3P9nuWZangQ==} + requiresBuild: true + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.9.4 + '@biomejs/cli-darwin-x64': 1.9.4 + '@biomejs/cli-linux-arm64': 1.9.4 + '@biomejs/cli-linux-arm64-musl': 1.9.4 + '@biomejs/cli-linux-x64': 1.9.4 + '@biomejs/cli-linux-x64-musl': 1.9.4 + '@biomejs/cli-win32-arm64': 1.9.4 + '@biomejs/cli-win32-x64': 1.9.4 + dev: true + + /@biomejs/cli-darwin-arm64@1.9.4: + resolution: {integrity: sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-darwin-x64@1.9.3': - resolution: {integrity: sha512-vSCoIBJE0BN3SWDFuAY/tRavpUtNoqiceJ5PrU3xDfsLcm/U6N93JSM0M9OAiC/X7mPPfejtr6Yc9vSgWlEgVw==} + /@biomejs/cli-darwin-x64@1.9.4: + resolution: {integrity: sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-linux-arm64-musl@1.9.3': - resolution: {integrity: sha512-VBzyhaqqqwP3bAkkBrhVq50i3Uj9+RWuj+pYmXrMDgjS5+SKYGE56BwNw4l8hR3SmYbLSbEo15GcV043CDSk+Q==} + /@biomejs/cli-linux-arm64-musl@1.9.4: + resolution: {integrity: sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-linux-arm64@1.9.3': - resolution: {integrity: sha512-vJkAimD2+sVviNTbaWOGqEBy31cW0ZB52KtpVIbkuma7PlfII3tsLhFa+cwbRAcRBkobBBhqZ06hXoZAN8NODQ==} + /@biomejs/cli-linux-arm64@1.9.4: + resolution: {integrity: sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-linux-x64-musl@1.9.3': - resolution: {integrity: sha512-TJmnOG2+NOGM72mlczEsNki9UT+XAsMFAOo8J0me/N47EJ/vkLXxf481evfHLlxMejTY6IN8SdRSiPVLv6AHlA==} + /@biomejs/cli-linux-x64-musl@1.9.4: + resolution: {integrity: sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-linux-x64@1.9.3': - resolution: {integrity: sha512-x220V4c+romd26Mu1ptU+EudMXVS4xmzKxPVb9mgnfYlN4Yx9vD5NZraSx/onJnd3Gh/y8iPUdU5CDZJKg9COA==} + /@biomejs/cli-linux-x64@1.9.4: + resolution: {integrity: sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-win32-arm64@1.9.3': - resolution: {integrity: sha512-lg/yZis2HdQGsycUvHWSzo9kOvnGgvtrYRgoCEwPBwwAL8/6crOp3+f47tPwI/LI1dZrhSji7PNsGKGHbwyAhw==} + /@biomejs/cli-win32-arm64@1.9.4: + resolution: {integrity: sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] + requiresBuild: true + dev: true + optional: true - '@biomejs/cli-win32-x64@1.9.3': - resolution: {integrity: sha512-cQMy2zanBkVLpmmxXdK6YePzmZx0s5Z7KEnwmrW54rcXK3myCNbQa09SwGZ8i/8sLw0H9F3X7K4rxVNGU8/D4Q==} + /@biomejs/cli-win32-x64@1.9.4: + resolution: {integrity: sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf-darwin-arm64@1.44.0': - resolution: {integrity: sha512-TZIorkTCICvVKYukkWeUFOMceaGWBrmKVOkXDC1Lusw3bRAdotQRZcwUHEW+XhHjOFFrrqcow4e7UKmk3Qekiw==} + /@bufbuild/buf-darwin-arm64@1.47.2: + resolution: {integrity: sha512-74WerFn06y+azgVfsnzhfbI5wla/OLPDnIvaNJBWHaqya/3bfascJkDylW2GVNHmwG1K/cscpmcc/RJPaO7ntQ==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf-darwin-x64@1.44.0': - resolution: {integrity: sha512-0ygdEIYBUvvyJtNP7RWI1sgpsNaXX8f0JlMhG/y0IdozT+hQtDF9PSrw8+pz+ywpCJdiLzDwj4drZ+GuurQm8Q==} + /@bufbuild/buf-darwin-x64@1.47.2: + resolution: {integrity: sha512-adAiOacOQe8Ym/YXPCEiq9mrPeKRmDtF2TgqPWTcDy6mF7TqR7hMJINkEEuMd1EeACmXnzMOnXlm9ICtvdYgPg==} engines: {node: '>=12'} cpu: [x64] os: [darwin] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf-linux-aarch64@1.44.0': - resolution: {integrity: sha512-8NRfpF/x3G5S3fZ4/OIOewxYs2/gnmYMhd0U6gKPrGQz7XblZNfY3Hfmx/5sWv6kybJJ8Iz2P7IVRyKP8net/Q==} + /@bufbuild/buf-linux-aarch64@1.47.2: + resolution: {integrity: sha512-52vY+Owffr5diw2PyfQJqH+Fld6zW6NhNZak4zojvc2MjZKubWM0TfNyM9jXz2YrwyB+cyxkabE60nBI80m37w==} engines: {node: '>=12'} cpu: [arm64] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-linux-armv7@1.47.2: + resolution: {integrity: sha512-g9KtpObDeHZ/VG/0b5ZCieOao7L/WYZ0fPqFSs4N07D3APgEDhJG6vLyUcDgJMDgyLcgkNjNz0+XdYQb/tXyQw==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf-linux-x64@1.44.0': - resolution: {integrity: sha512-AjLw7WiqrzvJPA6NLLP3HIOv5bHAJB115qqOzVewsppBvtaCGDj6Du/cpccbSOJTuu88XUdVnJZa85+bnVxdIQ==} + /@bufbuild/buf-linux-x64@1.47.2: + resolution: {integrity: sha512-MODCK2BzD1Mgoyr+5Sp8xA8qMNdytj8hYheyhA5NnCGTkQf8sfqAjpBSAAmKk6Zar8HOlVXML6tzE/ioDFFGwQ==} engines: {node: '>=12'} cpu: [x64] os: [linux] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf-win32-arm64@1.44.0': - resolution: {integrity: sha512-jlS3zbDI6pFXo0VuK8oxIAfpulWBiEW/l5I4LPT0AR5+q1Pfkn004GKox8znypXCLDV/xNh4/ZqrpL3c4ZAwjg==} + /@bufbuild/buf-win32-arm64@1.47.2: + resolution: {integrity: sha512-563YKYWJl3LrCY3G3+zuhb8HwOs6DzWslwGPFkKV2hwHyWyvd1DR1JjiLvw9zX64IKNctQ0HempSqc3kcboaqQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf-win32-x64@1.44.0': - resolution: {integrity: sha512-CRCeVVFssfLlXDzSBlI2y9b+xL/qP6umDp77HWg3iQugqONqy2ccSsDJNyxRATqaE5mixK5++Em/kqbnuhbKEA==} + /@bufbuild/buf-win32-x64@1.47.2: + resolution: {integrity: sha512-Sqcdv7La2xBDh3bTdEYb2f4UTMMqCcYe/D0RELhvQ5wDn6I35V3/2YT1OF5fRuf0BZLCo0OdO37S9L47uHSz2g==} engines: {node: '>=12'} cpu: [x64] os: [win32] + requiresBuild: true + dev: true + optional: true - '@bufbuild/buf@1.44.0': - resolution: {integrity: sha512-5xdNiEUzI3Je5rFK9UzJl+gyKAv3fG1HdSlChqQXjTNZ3DZgeeuM7VdyHnr2QC/qgZfZ9L8PRKhJYbXZWYLVUg==} + /@bufbuild/buf@1.47.2: + resolution: {integrity: sha512-glY5kCAoO4+a7HvDb+BLOdoHSdCk4mdXdkp53H8JFz7maOnkxCiHHXgRX+taFyEu25N8ybn7NjZFrZSdRwq2sA==} engines: {node: '>=12'} hasBin: true - - '@bufbuild/protobuf@2.2.0': - resolution: {integrity: sha512-+imAQkHf7U/Rwvu0wk1XWgsP3WnpCWmK7B48f0XqSNzgk64+grljTKC7pnO/xBiEMUziF7vKRfbBnOQhg126qQ==} - - '@bufbuild/protobuf@2.2.2': - resolution: {integrity: sha512-UNtPCbrwrenpmrXuRwn9jYpPoweNXj8X5sMvYgsqYyaH8jQ6LfUJSk3dJLnBK+6sfYPrF4iAIo5sd5HQ+tg75A==} - - '@bufbuild/protoc-gen-es@2.2.0': - resolution: {integrity: sha512-PmUTtbJJfgcabTsoF59W0bsAr7xO5aGcMe69G8vOq0ogYV1aWmvFKhHKHDtn295pOLhTXmfrDSUNi/OTHuDdpw==} + requiresBuild: true + optionalDependencies: + '@bufbuild/buf-darwin-arm64': 1.47.2 + '@bufbuild/buf-darwin-x64': 1.47.2 + '@bufbuild/buf-linux-aarch64': 1.47.2 + '@bufbuild/buf-linux-armv7': 1.47.2 + '@bufbuild/buf-linux-x64': 1.47.2 + '@bufbuild/buf-win32-arm64': 1.47.2 + '@bufbuild/buf-win32-x64': 1.47.2 + dev: true + + /@bufbuild/protobuf@2.2.3: + resolution: {integrity: sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg==} + + /@bufbuild/protoc-gen-es@2.2.3: + resolution: {integrity: sha512-hdhIV9NmwXXy24DcbnArauv6L5Dv2PjkO9gz2DUhiZ9HPRpP+rmpT8zo5LohjJiuA7YIQGGKKWSKpRg+xcdLSQ==} engines: {node: '>=14'} hasBin: true peerDependencies: - '@bufbuild/protobuf': 2.2.0 + '@bufbuild/protobuf': 2.2.3 peerDependenciesMeta: '@bufbuild/protobuf': optional: true + dependencies: + '@bufbuild/protoplugin': 2.2.3 + transitivePeerDependencies: + - supports-color + dev: true - '@bufbuild/protoplugin@2.2.0': - resolution: {integrity: sha512-ijsCHuhtXbfTiffoBRve2uCPR7gy6cwJsMe8z5bYQtczGiZVVfiyAze55gk1J/1ruqkr40oZ9BwKAGOzz69f0g==} + /@bufbuild/protoplugin@2.2.3: + resolution: {integrity: sha512-UsV7mj6NJTZrqIYJK+jNFnnj5tOS7wgNXKyMjebFEpf+OX6pfXE+nx+QPjumOfu4GxdVPfEDnKuwISgqlXSQqw==} + dependencies: + '@bufbuild/protobuf': 2.2.3 + '@typescript/vfs': 1.6.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true - '@changesets/apply-release-plan@7.0.5': - resolution: {integrity: sha512-1cWCk+ZshEkSVEZrm2fSj1Gz8sYvxgUL4Q78+1ZZqeqfuevPTPk033/yUZ3df8BKMohkqqHfzj0HOOrG0KtXTw==} + /@changesets/apply-release-plan@7.0.6: + resolution: {integrity: sha512-TKhVLtiwtQOgMAC0fCJfmv93faiViKSDqr8oMEqrnNs99gtSC1sZh/aEMS9a+dseU1ESZRCK+ofLgGY7o0fw/Q==} + dependencies: + '@changesets/config': 3.0.4 + '@changesets/get-version-range-type': 0.4.0 + '@changesets/git': 3.0.2 + '@changesets/should-skip-package': 0.1.1 + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + detect-indent: 6.1.0 + fs-extra: 7.0.1 + lodash.startcase: 4.4.0 + outdent: 0.5.0 + prettier: 2.8.8 + resolve-from: 5.0.0 + semver: 7.6.3 + dev: true - '@changesets/assemble-release-plan@6.0.4': - resolution: {integrity: sha512-nqICnvmrwWj4w2x0fOhVj2QEGdlUuwVAwESrUo5HLzWMI1rE5SWfsr9ln+rDqWB6RQ2ZyaMZHUcU7/IRaUJS+Q==} + /@changesets/assemble-release-plan@6.0.5: + resolution: {integrity: sha512-IgvBWLNKZd6k4t72MBTBK3nkygi0j3t3zdC1zrfusYo0KpdsvnDjrMM9vPnTCLCMlfNs55jRL4gIMybxa64FCQ==} + dependencies: + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.1.2 + '@changesets/should-skip-package': 0.1.1 + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + semver: 7.6.3 + dev: true - '@changesets/changelog-git@0.2.0': + /@changesets/changelog-git@0.2.0: resolution: {integrity: sha512-bHOx97iFI4OClIT35Lok3sJAwM31VbUM++gnMBV16fdbtBhgYu4dxsphBF/0AZZsyAHMrnM0yFcj5gZM1py6uQ==} + dependencies: + '@changesets/types': 6.0.0 + dev: true - '@changesets/changelog-github@0.5.0': + /@changesets/changelog-github@0.5.0: resolution: {integrity: sha512-zoeq2LJJVcPJcIotHRJEEA2qCqX0AQIeFE+L21L8sRLPVqDhSXY8ZWAt2sohtBpFZkBwu+LUwMSKRr2lMy3LJA==} + dependencies: + '@changesets/get-github-info': 0.6.0 + '@changesets/types': 6.0.0 + dotenv: 8.6.0 + transitivePeerDependencies: + - encoding + dev: true - '@changesets/cli@2.27.9': - resolution: {integrity: sha512-q42a/ZbDnxPpCb5Wkm6tMVIxgeI9C/bexntzTeCFBrQEdpisQqk8kCHllYZMDjYtEc1ZzumbMJAG8H0Z4rdvjg==} + /@changesets/cli@2.27.10: + resolution: {integrity: sha512-PfeXjvs9OfQJV8QSFFHjwHX3QnUL9elPEQ47SgkiwzLgtKGyuikWjrdM+lO9MXzOE22FO9jEGkcs4b+B6D6X0Q==} hasBin: true + dependencies: + '@changesets/apply-release-plan': 7.0.6 + '@changesets/assemble-release-plan': 6.0.5 + '@changesets/changelog-git': 0.2.0 + '@changesets/config': 3.0.4 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.1.2 + '@changesets/get-release-plan': 4.0.5 + '@changesets/git': 3.0.2 + '@changesets/logger': 0.1.1 + '@changesets/pre': 2.0.1 + '@changesets/read': 0.6.2 + '@changesets/should-skip-package': 0.1.1 + '@changesets/types': 6.0.0 + '@changesets/write': 0.3.2 + '@manypkg/get-packages': 1.1.3 + ansi-colors: 4.1.3 + ci-info: 3.9.0 + enquirer: 2.4.1 + external-editor: 3.1.0 + fs-extra: 7.0.1 + mri: 1.2.0 + p-limit: 2.3.0 + package-manager-detector: 0.2.7 + picocolors: 1.1.1 + resolve-from: 5.0.0 + semver: 7.6.3 + spawndamnit: 3.0.1 + term-size: 2.2.1 + dev: true - '@changesets/config@3.0.3': - resolution: {integrity: sha512-vqgQZMyIcuIpw9nqFIpTSNyc/wgm/Lu1zKN5vECy74u95Qx/Wa9g27HdgO4NkVAaq+BGA8wUc/qvbvVNs93n6A==} + /@changesets/config@3.0.4: + resolution: {integrity: sha512-+DiIwtEBpvvv1z30f8bbOsUQGuccnZl9KRKMM/LxUHuDu5oEjmN+bJQ1RIBKNJjfYMQn8RZzoPiX0UgPaLQyXw==} + dependencies: + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.1.2 + '@changesets/logger': 0.1.1 + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + fs-extra: 7.0.1 + micromatch: 4.0.8 + dev: true - '@changesets/errors@0.2.0': + /@changesets/errors@0.2.0: resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==} + dependencies: + extendable-error: 0.1.7 + dev: true - '@changesets/get-dependents-graph@2.1.2': + /@changesets/get-dependents-graph@2.1.2: resolution: {integrity: sha512-sgcHRkiBY9i4zWYBwlVyAjEM9sAzs4wYVwJUdnbDLnVG3QwAaia1Mk5P8M7kraTOZN+vBET7n8KyB0YXCbFRLQ==} + dependencies: + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + picocolors: 1.1.1 + semver: 7.6.3 + dev: true - '@changesets/get-github-info@0.6.0': + /@changesets/get-github-info@0.6.0: resolution: {integrity: sha512-v/TSnFVXI8vzX9/w3DU2Ol+UlTZcu3m0kXTjTT4KlAdwSvwutcByYwyYn9hwerPWfPkT2JfpoX0KgvCEi8Q/SA==} + dependencies: + dataloader: 1.4.0 + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: true - '@changesets/get-release-plan@4.0.4': - resolution: {integrity: sha512-SicG/S67JmPTrdcc9Vpu0wSQt7IiuN0dc8iR5VScnnTVPfIaLvKmEGRvIaF0kcn8u5ZqLbormZNTO77bCEvyWw==} + /@changesets/get-release-plan@4.0.5: + resolution: {integrity: sha512-E6wW7JoSMcctdVakut0UB76FrrN3KIeJSXvB+DHMFo99CnC3ZVnNYDCVNClMlqAhYGmLmAj77QfApaI3ca4Fkw==} + dependencies: + '@changesets/assemble-release-plan': 6.0.5 + '@changesets/config': 3.0.4 + '@changesets/pre': 2.0.1 + '@changesets/read': 0.6.2 + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + dev: true - '@changesets/get-version-range-type@0.4.0': + /@changesets/get-version-range-type@0.4.0: resolution: {integrity: sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==} + dev: true - '@changesets/git@3.0.1': - resolution: {integrity: sha512-pdgHcYBLCPcLd82aRcuO0kxCDbw/yISlOtkmwmE8Odo1L6hSiZrBOsRl84eYG7DRCab/iHnOkWqExqc4wxk2LQ==} + /@changesets/git@3.0.2: + resolution: {integrity: sha512-r1/Kju9Y8OxRRdvna+nxpQIsMsRQn9dhhAZt94FLDeu0Hij2hnOozW8iqnHBgvu+KdnJppCveQwK4odwfw/aWQ==} + dependencies: + '@changesets/errors': 0.2.0 + '@manypkg/get-packages': 1.1.3 + is-subdir: 1.2.0 + micromatch: 4.0.8 + spawndamnit: 3.0.1 + dev: true - '@changesets/logger@0.1.1': + /@changesets/logger@0.1.1: resolution: {integrity: sha512-OQtR36ZlnuTxKqoW4Sv6x5YIhOmClRd5pWsjZsddYxpWs517R0HkyiefQPIytCVh4ZcC5x9XaG8KTdd5iRQUfg==} + dependencies: + picocolors: 1.1.1 + dev: true - '@changesets/parse@0.4.0': + /@changesets/parse@0.4.0: resolution: {integrity: sha512-TS/9KG2CdGXS27S+QxbZXgr8uPsP4yNJYb4BC2/NeFUj80Rni3TeD2qwWmabymxmrLo7JEsytXH1FbpKTbvivw==} + dependencies: + '@changesets/types': 6.0.0 + js-yaml: 3.14.1 + dev: true - '@changesets/pre@2.0.1': + /@changesets/pre@2.0.1: resolution: {integrity: sha512-vvBJ/If4jKM4tPz9JdY2kGOgWmCowUYOi5Ycv8dyLnEE8FgpYYUo1mgJZxcdtGGP3aG8rAQulGLyyXGSLkIMTQ==} + dependencies: + '@changesets/errors': 0.2.0 + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + fs-extra: 7.0.1 + dev: true - '@changesets/read@0.6.1': - resolution: {integrity: sha512-jYMbyXQk3nwP25nRzQQGa1nKLY0KfoOV7VLgwucI0bUO8t8ZLCr6LZmgjXsiKuRDc+5A6doKPr9w2d+FEJ55zQ==} + /@changesets/read@0.6.2: + resolution: {integrity: sha512-wjfQpJvryY3zD61p8jR87mJdyx2FIhEcdXhKUqkja87toMrP/3jtg/Yg29upN+N4Ckf525/uvV7a4tzBlpk6gg==} + dependencies: + '@changesets/git': 3.0.2 + '@changesets/logger': 0.1.1 + '@changesets/parse': 0.4.0 + '@changesets/types': 6.0.0 + fs-extra: 7.0.1 + p-filter: 2.1.0 + picocolors: 1.1.1 + dev: true - '@changesets/should-skip-package@0.1.1': + /@changesets/should-skip-package@0.1.1: resolution: {integrity: sha512-H9LjLbF6mMHLtJIc/eHR9Na+MifJ3VxtgP/Y+XLn4BF7tDTEN1HNYtH6QMcjP1uxp9sjaFYmW8xqloaCi/ckTg==} + dependencies: + '@changesets/types': 6.0.0 + '@manypkg/get-packages': 1.1.3 + dev: true - '@changesets/types@4.1.0': + /@changesets/types@4.1.0: resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} + dev: true - '@changesets/types@6.0.0': + /@changesets/types@6.0.0: resolution: {integrity: sha512-b1UkfNulgKoWfqyHtzKS5fOZYSJO+77adgL7DLRDr+/7jhChN+QcHnbjiQVOz/U+Ts3PGNySq7diAItzDgugfQ==} + dev: true - '@changesets/write@0.3.2': + /@changesets/write@0.3.2: resolution: {integrity: sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==} + dependencies: + '@changesets/types': 6.0.0 + fs-extra: 7.0.1 + human-id: 1.0.2 + prettier: 2.8.8 + dev: true - '@connectrpc/connect-node@2.0.0-beta.2': + /@connectrpc/connect-node@2.0.0-beta.2(@bufbuild/protobuf@2.2.3)(@connectrpc/connect@2.0.0-beta.2): resolution: {integrity: sha512-FYiPjkEA8mHvXW9z+tQjY3Q8KAq612yWWQRU9XJQiIJ5SdJWGpCJyOAe3ygopSxV+0jRJmwIwurJd9YftZ8dOQ==} engines: {node: '>=18.14.1'} peerDependencies: '@bufbuild/protobuf': ^2.2.0 '@connectrpc/connect': 2.0.0-beta.2 + dependencies: + '@bufbuild/protobuf': 2.2.3 + '@connectrpc/connect': 2.0.0-beta.2(@bufbuild/protobuf@2.2.3) + dev: false - '@connectrpc/connect-web@2.0.0-beta.2': + /@connectrpc/connect-web@2.0.0-beta.2(@bufbuild/protobuf@2.2.3)(@connectrpc/connect@2.0.0-beta.2): resolution: {integrity: sha512-d3xs/u95FRqQ2WsrOpMCiDQ3CbvRsI3kU4armnZ0WLS5k7vcHqVNY7N1pU5HRR4p1c1Hs/oSeM25hw6gGepVWg==} peerDependencies: '@bufbuild/protobuf': ^2.2.0 '@connectrpc/connect': 2.0.0-beta.2 + dependencies: + '@bufbuild/protobuf': 2.2.3 + '@connectrpc/connect': 2.0.0-beta.2(@bufbuild/protobuf@2.2.3) + dev: false - '@connectrpc/connect@2.0.0-beta.2': + /@connectrpc/connect@2.0.0-beta.2(@bufbuild/protobuf@2.2.3): resolution: {integrity: sha512-7Ok40XsVfFqeIXM2++hvDTQNqBJP8dv9mfj9YrAU3Z37vWQONmImImU6suIjy22x+qqyAZ9Y/zjbT+92DcwxYg==} peerDependencies: '@bufbuild/protobuf': ^2.2.0 + dependencies: + '@bufbuild/protobuf': 2.2.3 + dev: false - '@esbuild/aix-ppc64@0.23.1': + /@esbuild/aix-ppc64@0.23.1: resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/aix-ppc64@0.24.0: + resolution: {integrity: sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: false + optional: true - '@esbuild/android-arm64@0.23.1': + /@esbuild/android-arm64@0.23.1: resolution: {integrity: sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==} engines: {node: '>=18'} cpu: [arm64] os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.24.0: + resolution: {integrity: sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: false + optional: true - '@esbuild/android-arm@0.23.1': + /@esbuild/android-arm@0.23.1: resolution: {integrity: sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==} engines: {node: '>=18'} cpu: [arm] os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.24.0: + resolution: {integrity: sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: false + optional: true - '@esbuild/android-x64@0.23.1': + /@esbuild/android-x64@0.23.1: resolution: {integrity: sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==} engines: {node: '>=18'} cpu: [x64] os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.24.0: + resolution: {integrity: sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: false + optional: true - '@esbuild/darwin-arm64@0.23.1': + /@esbuild/darwin-arm64@0.23.1: resolution: {integrity: sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.24.0: + resolution: {integrity: sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true - '@esbuild/darwin-x64@0.23.1': + /@esbuild/darwin-x64@0.23.1: resolution: {integrity: sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==} engines: {node: '>=18'} cpu: [x64] os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.24.0: + resolution: {integrity: sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true - '@esbuild/freebsd-arm64@0.23.1': + /@esbuild/freebsd-arm64@0.23.1: resolution: {integrity: sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.24.0: + resolution: {integrity: sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: false + optional: true - '@esbuild/freebsd-x64@0.23.1': + /@esbuild/freebsd-x64@0.23.1: resolution: {integrity: sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.24.0: + resolution: {integrity: sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-arm64@0.23.1': + /@esbuild/linux-arm64@0.23.1: resolution: {integrity: sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==} engines: {node: '>=18'} cpu: [arm64] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.24.0: + resolution: {integrity: sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-arm@0.23.1': + /@esbuild/linux-arm@0.23.1: resolution: {integrity: sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==} engines: {node: '>=18'} cpu: [arm] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.24.0: + resolution: {integrity: sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-ia32@0.23.1': + /@esbuild/linux-ia32@0.23.1: resolution: {integrity: sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==} engines: {node: '>=18'} cpu: [ia32] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.24.0: + resolution: {integrity: sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-loong64@0.23.1': + /@esbuild/linux-loong64@0.23.1: resolution: {integrity: sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==} engines: {node: '>=18'} cpu: [loong64] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.24.0: + resolution: {integrity: sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-mips64el@0.23.1': + /@esbuild/linux-mips64el@0.23.1: resolution: {integrity: sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.24.0: + resolution: {integrity: sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-ppc64@0.23.1': + /@esbuild/linux-ppc64@0.23.1: resolution: {integrity: sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.24.0: + resolution: {integrity: sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-riscv64@0.23.1': + /@esbuild/linux-riscv64@0.23.1: resolution: {integrity: sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.24.0: + resolution: {integrity: sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-s390x@0.23.1': + /@esbuild/linux-s390x@0.23.1: resolution: {integrity: sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==} engines: {node: '>=18'} cpu: [s390x] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.24.0: + resolution: {integrity: sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/linux-x64@0.23.1': + /@esbuild/linux-x64@0.23.1: resolution: {integrity: sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==} engines: {node: '>=18'} cpu: [x64] os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.24.0: + resolution: {integrity: sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true - '@esbuild/netbsd-x64@0.23.1': + /@esbuild/netbsd-x64@0.23.1: resolution: {integrity: sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.24.0: + resolution: {integrity: sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: false + optional: true - '@esbuild/openbsd-arm64@0.23.1': + /@esbuild/openbsd-arm64@0.23.1: resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-arm64@0.24.0: + resolution: {integrity: sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + requiresBuild: true + dev: false + optional: true - '@esbuild/openbsd-x64@0.23.1': + /@esbuild/openbsd-x64@0.23.1: resolution: {integrity: sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] + requiresBuild: true + dev: true + optional: true - '@esbuild/sunos-x64@0.23.1': - resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} + /@esbuild/openbsd-x64@0.24.0: + resolution: {integrity: sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==} engines: {node: '>=18'} cpu: [x64] - os: [sunos] + os: [openbsd] + requiresBuild: true + dev: false + optional: true + + /@esbuild/sunos-x64@0.23.1: + resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true - '@esbuild/win32-arm64@0.23.1': + /@esbuild/sunos-x64@0.24.0: + resolution: {integrity: sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: false + optional: true + + /@esbuild/win32-arm64@0.23.1: resolution: {integrity: sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==} engines: {node: '>=18'} cpu: [arm64] os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.24.0: + resolution: {integrity: sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: false + optional: true - '@esbuild/win32-ia32@0.23.1': + /@esbuild/win32-ia32@0.23.1: resolution: {integrity: sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==} engines: {node: '>=18'} cpu: [ia32] os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.24.0: + resolution: {integrity: sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: false + optional: true - '@esbuild/win32-x64@0.23.1': + /@esbuild/win32-x64@0.23.1: resolution: {integrity: sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==} engines: {node: '>=18'} cpu: [x64] os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.24.0: + resolution: {integrity: sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false + optional: true - '@faker-js/faker@7.6.0': + /@faker-js/faker@7.6.0: resolution: {integrity: sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==} engines: {node: '>=14.0.0', npm: '>=6.0.0'} + dev: false - '@farcaster/core@0.15.6': + /@farcaster/core@0.15.6(typescript@5.7.2)(zod@3.24.0): resolution: {integrity: sha512-Vxq2JhqdZYEMjH4PIwPXQkalY46S4Mol2oCSHUafXenDx6WSoQJqF/4an4KyxGQbmA7Cf8+hl6zuNzkkHXEUyQ==} + dependencies: + '@faker-js/faker': 7.6.0 + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + bs58: 5.0.0 + neverthrow: 6.2.2 + viem: 2.21.54(typescript@5.7.2)(zod@3.24.0) + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + - zod + dev: false - '@manypkg/find-root@1.1.0': + /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} + dependencies: + '@babel/runtime': 7.26.0 + '@types/node': 12.20.55 + find-up: 4.1.0 + fs-extra: 8.1.0 + dev: true - '@manypkg/get-packages@1.1.3': + /@manypkg/get-packages@1.1.3: resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} + dependencies: + '@babel/runtime': 7.26.0 + '@changesets/types': 4.1.0 + '@manypkg/find-root': 1.1.0 + fs-extra: 8.1.0 + globby: 11.1.0 + read-yaml-file: 1.1.0 + dev: true + + /@microsoft/api-extractor-model@7.30.0(@types/node@22.10.1): + resolution: {integrity: sha512-26/LJZBrsWDKAkOWRiQbdVgcfd1F3nyJnAiJzsAgpouPk7LtOIj7PK9aJtBaw/pUXrkotEg27RrT+Jm/q0bbug==} + dependencies: + '@microsoft/tsdoc': 0.15.1 + '@microsoft/tsdoc-config': 0.17.1 + '@rushstack/node-core-library': 5.10.0(@types/node@22.10.1) + transitivePeerDependencies: + - '@types/node' + dev: true + + /@microsoft/api-extractor@7.48.0(@types/node@22.10.1): + resolution: {integrity: sha512-FMFgPjoilMUWeZXqYRlJ3gCVRhB7WU/HN88n8OLqEsmsG4zBdX/KQdtJfhq95LQTQ++zfu0Em1LLb73NqRCLYQ==} + hasBin: true + dependencies: + '@microsoft/api-extractor-model': 7.30.0(@types/node@22.10.1) + '@microsoft/tsdoc': 0.15.1 + '@microsoft/tsdoc-config': 0.17.1 + '@rushstack/node-core-library': 5.10.0(@types/node@22.10.1) + '@rushstack/rig-package': 0.5.3 + '@rushstack/terminal': 0.14.3(@types/node@22.10.1) + '@rushstack/ts-command-line': 4.23.1(@types/node@22.10.1) + lodash: 4.17.21 + minimatch: 3.0.8 + resolve: 1.22.8 + semver: 7.5.4 + source-map: 0.6.1 + typescript: 5.4.2 + transitivePeerDependencies: + - '@types/node' + dev: true + + /@microsoft/tsdoc-config@0.17.1: + resolution: {integrity: sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw==} + dependencies: + '@microsoft/tsdoc': 0.15.1 + ajv: 8.12.0 + jju: 1.4.0 + resolve: 1.22.8 + dev: true + + /@microsoft/tsdoc@0.15.1: + resolution: {integrity: sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==} + dev: true - '@noble/curves@1.6.0': - resolution: {integrity: sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==} + /@noble/curves@1.7.0: + resolution: {integrity: sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==} engines: {node: ^14.21.3 || >=16} + dependencies: + '@noble/hashes': 1.6.0 + dev: false - '@noble/ed25519@2.1.0': + /@noble/ed25519@2.1.0: resolution: {integrity: sha512-KM4qTyXPinyCgMzeYJH/UudpdL+paJXtY3CHtHYZQtBkS8MZoPr4rOikZllIutJe0d06QDQKisyn02gxZ8TcQA==} + dev: false + + /@noble/hashes@1.6.0: + resolution: {integrity: sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==} + engines: {node: ^14.21.3 || >=16} + dev: false - '@noble/hashes@1.5.0': - resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} + /@noble/hashes@1.6.1: + resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} engines: {node: ^14.21.3 || >=16} + dev: false - '@nodelib/fs.scandir@2.1.5': + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + dev: true - '@nodelib/fs.stat@2.0.5': + /@nodelib/fs.stat@2.0.5: resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} engines: {node: '>= 8'} + dev: true - '@nodelib/fs.walk@1.2.8': + /@nodelib/fs.walk@1.2.8: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.17.1 + dev: true + + /@rushstack/node-core-library@5.10.0(@types/node@22.10.1): + resolution: {integrity: sha512-2pPLCuS/3x7DCd7liZkqOewGM0OzLyCacdvOe8j6Yrx9LkETGnxul1t7603bIaB8nUAooORcct9fFDOQMbWAgw==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + dependencies: + '@types/node': 22.10.1 + ajv: 8.13.0 + ajv-draft-04: 1.0.0(ajv@8.13.0) + ajv-formats: 3.0.1(ajv@8.13.0) + fs-extra: 7.0.1 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.8 + semver: 7.5.4 + dev: true + + /@rushstack/rig-package@0.5.3: + resolution: {integrity: sha512-olzSSjYrvCNxUFZowevC3uz8gvKr3WTpHQ7BkpjtRpA3wK+T0ybep/SRUMfr195gBzJm5gaXw0ZMgjIyHqJUow==} + dependencies: + resolve: 1.22.8 + strip-json-comments: 3.1.1 + dev: true + + /@rushstack/terminal@0.14.3(@types/node@22.10.1): + resolution: {integrity: sha512-csXbZsAdab/v8DbU1sz7WC2aNaKArcdS/FPmXMOXEj/JBBZMvDK0+1b4Qao0kkG0ciB1Qe86/Mb68GjH6/TnMw==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + dependencies: + '@rushstack/node-core-library': 5.10.0(@types/node@22.10.1) + '@types/node': 22.10.1 + supports-color: 8.1.1 + dev: true + + /@rushstack/ts-command-line@4.23.1(@types/node@22.10.1): + resolution: {integrity: sha512-40jTmYoiu/xlIpkkRsVfENtBq4CW3R4azbL0Vmda+fMwHWqss6wwf/Cy/UJmMqIzpfYc2OTnjYP1ZLD3CmyeCA==} + dependencies: + '@rushstack/terminal': 0.14.3(@types/node@22.10.1) + '@types/argparse': 1.0.38 + argparse: 1.0.10 + string-argv: 0.3.2 + transitivePeerDependencies: + - '@types/node' + dev: true - '@scure/base@1.1.9': - resolution: {integrity: sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==} + /@scure/base@1.2.1: + resolution: {integrity: sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==} + dev: false - '@scure/bip32@1.5.0': - resolution: {integrity: sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==} + /@scure/bip32@1.6.0: + resolution: {integrity: sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA==} + dependencies: + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + '@scure/base': 1.2.1 + dev: false - '@scure/bip39@1.4.0': - resolution: {integrity: sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==} + /@scure/bip39@1.5.0: + resolution: {integrity: sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A==} + dependencies: + '@noble/hashes': 1.6.1 + '@scure/base': 1.2.1 + dev: false - '@snyk/github-codeowners@1.1.0': + /@snyk/github-codeowners@1.1.0: resolution: {integrity: sha512-lGFf08pbkEac0NYgVf4hdANpAgApRjNByLXB+WBip3qj1iendOIyAwP2GKkKbQMNVy2r1xxDf0ssfWscoiC+Vw==} engines: {node: '>=8.10'} hasBin: true + dependencies: + commander: 4.1.1 + ignore: 5.3.2 + p-map: 4.0.0 + dev: true - '@types/bun@1.1.13': - resolution: {integrity: sha512-KmQxSBgVWCl6RSuerlLGZlIWfdxkKqat0nxN61+qu4y1KDn0Ll3j7v1Pl8GnaL3a/U6GGWVTJh75ap62kR1E8Q==} + /@types/argparse@1.0.38: + resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} + dev: true + + /@types/bun@1.1.14: + resolution: {integrity: sha512-opVYiFGtO2af0dnWBdZWlioLBoxSdDO5qokaazLhq8XQtGZbY4pY3/JxY8Zdf/hEwGubbp7ErZXoN1+h2yesxA==} + dependencies: + bun-types: 1.1.37 + dev: true - '@types/fs-extra@11.0.4': + /@types/fs-extra@11.0.4: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} + dependencies: + '@types/jsonfile': 6.1.4 + '@types/node': 22.10.1 + dev: true - '@types/jsonfile@6.1.4': + /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + dependencies: + '@types/node': 22.10.1 + dev: true - '@types/node@12.20.55': + /@types/node@12.20.55: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + dev: true - '@types/node@20.12.14': + /@types/node@20.12.14: resolution: {integrity: sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg==} + dependencies: + undici-types: 5.26.5 + dev: true - '@types/node@22.7.4': - resolution: {integrity: sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==} + /@types/node@22.10.1: + resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} + dependencies: + undici-types: 6.20.0 + dev: true - '@types/ws@8.5.12': - resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} + /@types/ws@8.5.13: + resolution: {integrity: sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==} + dependencies: + '@types/node': 22.10.1 + dev: true - '@typescript/vfs@1.6.0': + /@typescript/vfs@1.6.0(typescript@5.4.5): resolution: {integrity: sha512-hvJUjNVeBMp77qPINuUvYXj4FyWeeMMKZkxEATEU3hqBAQ7qdTBCUFT7Sp0Zu0faeEtFf+ldXxMEDr/bk73ISg==} peerDependencies: typescript: '*' + dependencies: + debug: 4.4.0 + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true - abitype@1.0.6: - resolution: {integrity: sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==} + /abitype@1.0.7(typescript@5.7.2)(zod@3.24.0): + resolution: {integrity: sha512-ZfYYSktDQUwc2eduYu8C4wOs+RDPmnRYMh7zNfzeMtGGgb0U+6tLGjixUic6mXf5xKKCcgT5Qp6cv39tOARVFw==} peerDependencies: typescript: '>=5.0.4' zod: ^3 >=3.22.0 @@ -553,378 +1275,789 @@ packages: optional: true zod: optional: true + dependencies: + typescript: 5.7.2 + zod: 3.24.0 + dev: false - aggregate-error@3.1.0: + /aggregate-error@3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} + dependencies: + clean-stack: 2.2.0 + indent-string: 4.0.0 + dev: true + + /ajv-draft-04@1.0.0(ajv@8.13.0): + resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} + peerDependencies: + ajv: ^8.5.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.13.0 + dev: true + + /ajv-formats@3.0.1(ajv@8.13.0): + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.13.0 + dev: true + + /ajv@8.12.0: + resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true + + /ajv@8.13.0: + resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true - ansi-colors@4.1.3: + /ansi-colors@4.1.3: resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} + dev: true - ansi-regex@5.0.1: + /ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} + dev: true - ansi-regex@6.1.0: + /ansi-regex@6.1.0: resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} engines: {node: '>=12'} + dev: false - argparse@1.0.10: + /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + dependencies: + sprintf-js: 1.0.3 + dev: true - argparse@2.0.1: + /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true - array-union@2.1.0: + /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + dev: true - balanced-match@1.0.2: + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true - base-x@4.0.0: + /base-x@4.0.0: resolution: {integrity: sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==} + dev: false - better-path-resolve@1.0.0: + /better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} + dependencies: + is-windows: 1.0.2 + dev: true + + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + dev: true - brace-expansion@2.0.1: + /brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true - braces@3.0.3: + /braces@3.0.3: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + dependencies: + fill-range: 7.1.1 + dev: true - bs58@5.0.0: + /bs58@5.0.0: resolution: {integrity: sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==} + dependencies: + base-x: 4.0.0 + dev: false - buf@0.1.1: + /buf@0.1.1: resolution: {integrity: sha512-mhZY7GswAAd9ZJpBCsf2WaH2WMZwvxgsXD6rozflWgerE6gz2bCT/FvAfzcBXw55R18Jf8Fjzte7bw5xhwVhFg==} + dev: true - bun-types@1.1.34: - resolution: {integrity: sha512-br5QygTEL/TwB4uQOb96Ky22j4Gq2WxWH/8Oqv20fk5HagwKXo/akB+LiYgSfzexCt6kkcUaVm+bKiPl71xPvw==} + /bun-types@1.1.37: + resolution: {integrity: sha512-C65lv6eBr3LPJWFZ2gswyrGZ82ljnH8flVE03xeXxKhi2ZGtFiO4isRKTKnitbSqtRAcaqYSR6djt1whI66AbA==} + dependencies: + '@types/node': 20.12.14 + '@types/ws': 8.5.13 + dev: true - bundle-require@5.0.0: + /bundle-require@5.0.0(esbuild@0.24.0): resolution: {integrity: sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} peerDependencies: esbuild: '>=0.18' + dependencies: + esbuild: 0.24.0 + load-tsconfig: 0.2.5 + dev: false - cac@6.7.14: + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} + dev: false - chalk@5.3.0: + /chalk@5.3.0: resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + dev: false - chardet@0.7.0: + /chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + dev: true - ci-info@3.9.0: + /ci-info@3.9.0: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + dev: true - clean-stack@2.2.0: + /clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} + dev: true - cli-cursor@5.0.0: + /cli-cursor@5.0.0: resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==} engines: {node: '>=18'} + dependencies: + restore-cursor: 5.1.0 + dev: false - cli-spinners@2.9.2: + /cli-spinners@2.9.2: resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} engines: {node: '>=6'} + dev: false - clone@1.0.4: + /clone@1.0.4: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} + requiresBuild: true + dev: true + optional: true - commander@4.1.1: + /commander@4.1.1: resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} engines: {node: '>= 6'} + dev: true + + /concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + dev: true - cross-spawn@5.1.0: - resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} + /cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true - dataloader@1.4.0: + /dataloader@1.4.0: resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==} + dev: true - debug@4.3.7: - resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} + /debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' peerDependenciesMeta: supports-color: optional: true + dependencies: + ms: 2.1.3 + dev: true - dedent@1.5.3: + /dedent@1.5.3: resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} peerDependencies: babel-plugin-macros: ^3.1.0 peerDependenciesMeta: babel-plugin-macros: optional: true + dev: false - defaults@1.0.4: + /defaults@1.0.4: resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} + requiresBuild: true + dependencies: + clone: 1.0.4 + dev: true + optional: true - detect-indent@6.1.0: + /detect-indent@6.1.0: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} + dev: true - dir-glob@3.0.1: + /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} + dependencies: + path-type: 4.0.0 + dev: true - dotenv@8.6.0: + /dotenv@8.6.0: resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} engines: {node: '>=10'} + dev: true - easy-table@1.2.0: + /easy-table@1.2.0: resolution: {integrity: sha512-OFzVOv03YpvtcWGe5AayU5G2hgybsg3iqA6drU8UaoZyB9jLGMTrz9+asnLp/E+6qPh88yEI1gvyZFZ41dmgww==} + dependencies: + ansi-regex: 5.0.1 + optionalDependencies: + wcwidth: 1.0.1 + dev: true - emoji-regex@10.4.0: + /emoji-regex@10.4.0: resolution: {integrity: sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==} + dev: false - enhanced-resolve@5.17.1: + /enhanced-resolve@5.17.1: resolution: {integrity: sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==} engines: {node: '>=10.13.0'} + dependencies: + graceful-fs: 4.2.11 + tapable: 2.2.1 + dev: true - enquirer@2.4.1: + /enquirer@2.4.1: resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} engines: {node: '>=8.6'} + dependencies: + ansi-colors: 4.1.3 + strip-ansi: 6.0.1 + dev: true - esbuild@0.23.1: + /esbuild@0.23.1: resolution: {integrity: sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==} engines: {node: '>=18'} hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.23.1 + '@esbuild/android-arm': 0.23.1 + '@esbuild/android-arm64': 0.23.1 + '@esbuild/android-x64': 0.23.1 + '@esbuild/darwin-arm64': 0.23.1 + '@esbuild/darwin-x64': 0.23.1 + '@esbuild/freebsd-arm64': 0.23.1 + '@esbuild/freebsd-x64': 0.23.1 + '@esbuild/linux-arm': 0.23.1 + '@esbuild/linux-arm64': 0.23.1 + '@esbuild/linux-ia32': 0.23.1 + '@esbuild/linux-loong64': 0.23.1 + '@esbuild/linux-mips64el': 0.23.1 + '@esbuild/linux-ppc64': 0.23.1 + '@esbuild/linux-riscv64': 0.23.1 + '@esbuild/linux-s390x': 0.23.1 + '@esbuild/linux-x64': 0.23.1 + '@esbuild/netbsd-x64': 0.23.1 + '@esbuild/openbsd-arm64': 0.23.1 + '@esbuild/openbsd-x64': 0.23.1 + '@esbuild/sunos-x64': 0.23.1 + '@esbuild/win32-arm64': 0.23.1 + '@esbuild/win32-ia32': 0.23.1 + '@esbuild/win32-x64': 0.23.1 + dev: true - esprima@4.0.1: + /esbuild@0.24.0: + resolution: {integrity: sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==} + engines: {node: '>=18'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.24.0 + '@esbuild/android-arm': 0.24.0 + '@esbuild/android-arm64': 0.24.0 + '@esbuild/android-x64': 0.24.0 + '@esbuild/darwin-arm64': 0.24.0 + '@esbuild/darwin-x64': 0.24.0 + '@esbuild/freebsd-arm64': 0.24.0 + '@esbuild/freebsd-x64': 0.24.0 + '@esbuild/linux-arm': 0.24.0 + '@esbuild/linux-arm64': 0.24.0 + '@esbuild/linux-ia32': 0.24.0 + '@esbuild/linux-loong64': 0.24.0 + '@esbuild/linux-mips64el': 0.24.0 + '@esbuild/linux-ppc64': 0.24.0 + '@esbuild/linux-riscv64': 0.24.0 + '@esbuild/linux-s390x': 0.24.0 + '@esbuild/linux-x64': 0.24.0 + '@esbuild/netbsd-x64': 0.24.0 + '@esbuild/openbsd-arm64': 0.24.0 + '@esbuild/openbsd-x64': 0.24.0 + '@esbuild/sunos-x64': 0.24.0 + '@esbuild/win32-arm64': 0.24.0 + '@esbuild/win32-ia32': 0.24.0 + '@esbuild/win32-x64': 0.24.0 + dev: false + + /esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true + dev: true - eventemitter3@5.0.1: + /eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + dev: false - extendable-error@0.1.7: + /extendable-error@0.1.7: resolution: {integrity: sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==} + dev: true - external-editor@3.1.0: + /external-editor@3.1.0: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} + dependencies: + chardet: 0.7.0 + iconv-lite: 0.4.24 + tmp: 0.0.33 + dev: true + + /fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + dev: true - fast-glob@3.3.2: + /fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + dev: true - fastq@1.17.1: + /fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + dependencies: + reusify: 1.0.4 + dev: true - fill-range@7.1.1: + /fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true - find-up@4.1.0: + /find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + dev: true - find-up@7.0.0: + /find-up@7.0.0: resolution: {integrity: sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==} engines: {node: '>=18'} + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + unicorn-magic: 0.1.0 + dev: false - fs-extra@11.2.0: + /fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.1 - fs-extra@7.0.1: + /fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} engines: {node: '>=6 <7 || >=8'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 4.0.0 + universalify: 0.1.2 + dev: true - fs-extra@8.1.0: + /fs-extra@8.1.0: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 4.0.0 + universalify: 0.1.2 + dev: true - fs.realpath@1.0.0: + /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: true - fsevents@2.3.3: + /fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + requiresBuild: true + dev: true + optional: true - get-east-asian-width@1.3.0: + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + + /get-east-asian-width@1.3.0: resolution: {integrity: sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==} engines: {node: '>=18'} + dev: false - get-tsconfig@4.8.1: + /get-tsconfig@4.8.1: resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} + dependencies: + resolve-pkg-maps: 1.0.0 + dev: true - glob-parent@5.1.2: + /glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true - glob@8.1.0: + /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} deprecated: Glob versions prior to v9 are no longer supported + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + dev: true - globby@11.1.0: + /globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 3.0.0 + dev: true - graceful-fs@4.2.11: + /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - human-id@1.0.2: + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: true + + /hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + + /human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} + dev: true - iconv-lite@0.4.24: + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: true - ignore-walk@5.0.1: + /ignore-walk@5.0.1: resolution: {integrity: sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + dependencies: + minimatch: 5.1.6 + dev: true - ignore@5.3.2: + /ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} + dev: true + + /import-lazy@4.0.0: + resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==} + engines: {node: '>=8'} + dev: true - indent-string@4.0.0: + /indent-string@4.0.0: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} + dev: true - inflight@1.0.6: + /inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: true - inherits@2.0.4: + /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true + + /is-core-module@2.15.1: + resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} + engines: {node: '>= 0.4'} + dependencies: + hasown: 2.0.2 + dev: true - is-extglob@2.1.1: + /is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} + dev: true - is-glob@4.0.3: + /is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true - is-interactive@2.0.0: + /is-interactive@2.0.0: resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} engines: {node: '>=12'} + dev: false - is-number@7.0.0: + /is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} + dev: true - is-subdir@1.2.0: + /is-subdir@1.2.0: resolution: {integrity: sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==} engines: {node: '>=4'} + dependencies: + better-path-resolve: 1.0.0 + dev: true - is-unicode-supported@1.3.0: + /is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} + dev: false - is-unicode-supported@2.1.0: + /is-unicode-supported@2.1.0: resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} engines: {node: '>=18'} + dev: false - is-windows@1.0.2: + /is-windows@1.0.2: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} engines: {node: '>=0.10.0'} + dev: true - isexe@2.0.0: + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true - isows@1.0.6: + /isows@1.0.6(ws@8.18.0): resolution: {integrity: sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==} peerDependencies: ws: '*' + dependencies: + ws: 8.18.0 + dev: false - jiti@2.3.3: - resolution: {integrity: sha512-EX4oNDwcXSivPrw2qKH2LB5PoFxEvgtv2JgwW0bU858HoLQ+kutSvjLMUqBd0PeJYEinLWhoI9Ol0eYMqj/wNQ==} + /jiti@2.4.1: + resolution: {integrity: sha512-yPBThwecp1wS9DmoA4x4KR2h3QoslacnDR8ypuFM962kI4/456Iy1oHx2RAgh4jfZNdn0bctsdadceiBUgpU1g==} hasBin: true + dev: true + + /jju@1.4.0: + resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} + dev: true - js-yaml@3.14.1: + /js-yaml@3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} hasBin: true + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true - js-yaml@4.1.0: + /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + dependencies: + argparse: 2.0.1 + dev: true + + /json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + dev: true - jsonfile@4.0.0: + /jsonfile@4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} + optionalDependencies: + graceful-fs: 4.2.11 + dev: true - jsonfile@6.1.0: + /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} + dependencies: + universalify: 2.0.1 + optionalDependencies: + graceful-fs: 4.2.11 - knip@5.33.3: - resolution: {integrity: sha512-saUxedVDCa/8p3w445at66vLmYKretzYsX7+elMJ5ROWGzU+1aTRm3EmKELTaho1ue7BlwJB5BxLJROy43+LtQ==} + /knip@5.39.2(@types/node@22.10.1)(typescript@5.7.2): + resolution: {integrity: sha512-BuvuWRllLWV/r2G4m9ggNH+DZ6gouP/dhtJPXVlMbWNF++w9/EfrF6k2g7YBKCwjzCC+PXmYtpH8S2t8RjnY4Q==} engines: {node: '>=18.6.0'} hasBin: true peerDependencies: '@types/node': '>=18' typescript: '>=5.0.4' + dependencies: + '@nodelib/fs.walk': 1.2.8 + '@snyk/github-codeowners': 1.1.0 + '@types/node': 22.10.1 + easy-table: 1.2.0 + enhanced-resolve: 5.17.1 + fast-glob: 3.3.2 + jiti: 2.4.1 + js-yaml: 4.1.0 + minimist: 1.2.8 + picocolors: 1.1.1 + picomatch: 4.0.2 + pretty-ms: 9.2.0 + smol-toml: 1.3.1 + strip-json-comments: 5.0.1 + summary: 2.1.0 + typescript: 5.7.2 + zod: 3.24.0 + zod-validation-error: 3.4.0(zod@3.24.0) + dev: true - load-tsconfig@0.2.5: + /load-tsconfig@0.2.5: resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: false - locate-path@5.0.0: + /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} + dependencies: + p-locate: 4.1.0 + dev: true - locate-path@7.2.0: + /locate-path@7.2.0: resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-locate: 6.0.0 + dev: false - lodash.startcase@4.4.0: + /lodash.startcase@4.4.0: resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} + dev: true + + /lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: true - log-symbols@6.0.0: + /log-symbols@6.0.0: resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} engines: {node: '>=18'} + dependencies: + chalk: 5.3.0 + is-unicode-supported: 1.3.0 + dev: false - lru-cache@4.1.5: - resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} + /lru-cache@6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + dependencies: + yallist: 4.0.0 + dev: true - merge2@1.4.1: + /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} + dev: true - micromatch@4.0.8: + /micromatch@4.0.8: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + dev: true - mimic-function@5.0.1: + /mimic-function@5.0.1: resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} engines: {node: '>=18'} + dev: false - minimatch@5.1.6: + /minimatch@3.0.8: + resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} + dependencies: + brace-expansion: 1.1.11 + dev: true + + /minimatch@5.1.6: resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true - minimist@1.2.8: + /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true - mri@1.2.0: + /mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} + dev: true - ms@2.1.3: + /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: true - neverthrow@6.2.2: + /neverthrow@6.2.2: resolution: {integrity: sha512-POR1FACqdK9jH0S2kRPzaZEvzT11wsOxLW520PQV/+vKi9dQe+hXq19EiOvYx7lSRaF5VB9lYGsPInynrnN05w==} + dev: false - node-fetch@2.7.0: + /node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} peerDependencies: @@ -932,354 +2065,655 @@ packages: peerDependenciesMeta: encoding: optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true - npm-bundled@2.0.1: + /npm-bundled@2.0.1: resolution: {integrity: sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + dependencies: + npm-normalize-package-bin: 2.0.0 + dev: true - npm-normalize-package-bin@2.0.0: + /npm-normalize-package-bin@2.0.0: resolution: {integrity: sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + dev: true - npm-packlist@5.1.3: + /npm-packlist@5.1.3: resolution: {integrity: sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} hasBin: true + dependencies: + glob: 8.1.0 + ignore-walk: 5.0.1 + npm-bundled: 2.0.1 + npm-normalize-package-bin: 2.0.0 + dev: true - once@1.4.0: + /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: true - onetime@7.0.0: + /onetime@7.0.0: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} + dependencies: + mimic-function: 5.0.1 + dev: false - ora@8.1.1: + /ora@8.1.1: resolution: {integrity: sha512-YWielGi1XzG1UTvOaCFaNgEnuhZVMSHYkW/FQ7UX8O26PtlpdM84c0f7wLPlkvx2RfiQmnzd61d/MGxmpQeJPw==} engines: {node: '>=18'} + dependencies: + chalk: 5.3.0 + cli-cursor: 5.0.0 + cli-spinners: 2.9.2 + is-interactive: 2.0.0 + is-unicode-supported: 2.1.0 + log-symbols: 6.0.0 + stdin-discarder: 0.2.2 + string-width: 7.2.0 + strip-ansi: 7.1.0 + dev: false - os-tmpdir@1.0.2: + /os-tmpdir@1.0.2: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} + dev: true - outdent@0.5.0: + /outdent@0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} + dev: true - ox@0.0.0-canary-20241006052626: + /ox@0.0.0-canary-20241006052626(typescript@5.7.2)(zod@3.24.0): resolution: {integrity: sha512-a7xhcPJS6mhfeW1E2vt9l09NGe2bTLG5kzvNRLYFji8YWavbeCD4jqC25/rTx9rUUXcReKtwieX7yjGxigtTKw==} peerDependencies: typescript: '>=5.4.0' peerDependenciesMeta: typescript: optional: true + dependencies: + '@adraffy/ens-normalize': 1.11.0 + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + '@scure/bip32': 1.6.0 + '@scure/bip39': 1.5.0 + abitype: 1.0.7(typescript@5.7.2)(zod@3.24.0) + eventemitter3: 5.0.1 + typescript: 5.7.2 + transitivePeerDependencies: + - zod + dev: false + + /ox@0.1.2(typescript@5.7.2)(zod@3.24.0): + resolution: {integrity: sha512-ak/8K0Rtphg9vnRJlbOdaX9R7cmxD2MiSthjWGaQdMk3D7hrAlDoM+6Lxn7hN52Za3vrXfZ7enfke/5WjolDww==} + peerDependencies: + typescript: '>=5.4.0' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@adraffy/ens-normalize': 1.11.0 + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + '@scure/bip32': 1.6.0 + '@scure/bip39': 1.5.0 + abitype: 1.0.7(typescript@5.7.2)(zod@3.24.0) + eventemitter3: 5.0.1 + typescript: 5.7.2 + transitivePeerDependencies: + - zod + dev: false - p-filter@2.1.0: + /p-filter@2.1.0: resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} engines: {node: '>=8'} + dependencies: + p-map: 2.1.0 + dev: true - p-limit@2.3.0: + /p-limit@2.3.0: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} + dependencies: + p-try: 2.2.0 + dev: true - p-limit@4.0.0: + /p-limit@4.0.0: resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + yocto-queue: 1.1.1 + dev: false - p-locate@4.1.0: + /p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} + dependencies: + p-limit: 2.3.0 + dev: true - p-locate@6.0.0: + /p-locate@6.0.0: resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-limit: 4.0.0 + dev: false - p-map@2.1.0: + /p-map@2.1.0: resolution: {integrity: sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==} engines: {node: '>=6'} + dev: true - p-map@4.0.0: + /p-map@4.0.0: resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} engines: {node: '>=10'} + dependencies: + aggregate-error: 3.1.0 + dev: true - p-try@2.2.0: + /p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} + dev: true - package-manager-detector@0.2.1: - resolution: {integrity: sha512-/hVW2fZvAdEas+wyKh0SnlZ2mx0NIa1+j11YaQkogEJkcMErbwchHCuo8z7lEtajZJQZ6rgZNVTWMVVd71Bjng==} + /package-manager-detector@0.2.7: + resolution: {integrity: sha512-g4+387DXDKlZzHkP+9FLt8yKj8+/3tOkPv7DVTJGGRm00RkEWgqbFstX1mXJ4M0VDYhUqsTOiISqNOJnhAu3PQ==} + dev: true - parse-ms@4.0.0: + /parse-ms@4.0.0: resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==} engines: {node: '>=18'} + dev: true - path-exists@4.0.0: + /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} + dev: true - path-exists@5.0.0: + /path-exists@5.0.0: resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: false + + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + dev: true - path-type@4.0.0: + /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + dev: true - pathe@1.1.2: + /pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + dev: false - picocolors@1.1.0: - resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} - - picocolors@1.1.1: + /picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - picomatch@2.3.1: + /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + dev: true - picomatch@4.0.2: + /picomatch@4.0.2: resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} engines: {node: '>=12'} + dev: true - pify@4.0.1: + /pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} + dev: true - prettier@2.8.8: + /prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} hasBin: true + dev: true - prettier@3.3.3: - resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + /prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} engines: {node: '>=14'} hasBin: true + dev: false - pretty-ms@9.1.0: - resolution: {integrity: sha512-o1piW0n3tgKIKCwk2vpM/vOV13zjJzvP37Ioze54YlTHE06m4tjEbzg9WsKkvTuyYln2DHjo5pY4qrZGI0otpw==} + /pretty-ms@9.2.0: + resolution: {integrity: sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==} engines: {node: '>=18'} + dependencies: + parse-ms: 4.0.0 + dev: true - pseudomap@1.0.2: - resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} - - publint@0.2.11: - resolution: {integrity: sha512-/kxbd+sD/uEG515N/ZYpC6gYs8h89cQ4UIsAq1y6VT4qlNh8xmiSwcP2xU2MbzXFl8J0l2IdONKFweLfYoqhcA==} + /publint@0.2.12: + resolution: {integrity: sha512-YNeUtCVeM4j9nDiTT2OPczmlyzOkIXNtdDZnSuajAxS/nZ6j3t7Vs9SUB4euQNddiltIwu7Tdd3s+hr08fAsMw==} engines: {node: '>=16'} hasBin: true + dependencies: + npm-packlist: 5.1.3 + picocolors: 1.1.1 + sade: 1.8.1 + dev: true + + /punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + dev: true - queue-microtask@1.2.3: + /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true - read-yaml-file@1.1.0: + /read-yaml-file@1.1.0: resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==} engines: {node: '>=6'} + dependencies: + graceful-fs: 4.2.11 + js-yaml: 3.14.1 + pify: 4.0.1 + strip-bom: 3.0.0 + dev: true - regenerator-runtime@0.14.1: + /regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + dev: true - resolve-from@5.0.0: + /require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + dev: true + + /resolve-from@5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + dev: true - resolve-pkg-maps@1.0.0: + /resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true + dependencies: + is-core-module: 2.15.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + dev: true - restore-cursor@5.1.0: + /restore-cursor@5.1.0: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} + dependencies: + onetime: 7.0.0 + signal-exit: 4.1.0 + dev: false - reusify@1.0.4: + /reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true - run-parallel@1.2.0: + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + dependencies: + queue-microtask: 1.2.3 + dev: true - sade@1.8.1: + /sade@1.8.1: resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} engines: {node: '>=6'} + dependencies: + mri: 1.2.0 + dev: true - safer-buffer@2.1.2: + /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + dev: true + + /semver@7.5.4: + resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true - semver@7.6.3: + /semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} hasBin: true + dev: true - shebang-command@1.2.0: - resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} - engines: {node: '>=0.10.0'} + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true - shebang-regex@1.0.0: - resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} - engines: {node: '>=0.10.0'} + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true - sherif-darwin-arm64@1.0.1: - resolution: {integrity: sha512-eDYzUO6ksjYZF6swtoJ5F4AVa4og+sqrs0H7gGw57FoiMHEe5+4tD4M2ojTbVAaeeFtRS0gMbVZFGkhSAshQMw==} + /sherif-darwin-arm64@1.1.0: + resolution: {integrity: sha512-YKtE72i3SrsJdSGy3ZQbOk584rBJdcWo2vlxveXYQp13CXz/xtUGUOVAoyCrylM9BKOk+1AA6jKl2SJMv9n6Fw==} cpu: [arm64] os: [darwin] + requiresBuild: true + dev: true + optional: true - sherif-darwin-x64@1.0.1: - resolution: {integrity: sha512-lnNZTck5F2eZoB1nZFwixfFQe/DXt4HuOMNCTG+Iyzq8w7kdSXUr/IIPYk2p88L+d4AtPWApmKE6mpmQaDzOVg==} + /sherif-darwin-x64@1.1.0: + resolution: {integrity: sha512-VS7dhMLzc3Gbx6Mg1VoU94oFLiqXoAyF2EORHIjFe31SE5e/NDVZXpb5wUttX/tPxZuE/lEJsU3adtJkLquklg==} cpu: [x64] os: [darwin] + requiresBuild: true + dev: true + optional: true - sherif-linux-arm64@1.0.1: - resolution: {integrity: sha512-/fj3rJoSb26FA5wRlZpauLFaFeWCe9usIQAE+e9IEaC2751IU9I0d+nE7pmGmuOwTCR1/kPOlrDGfV4ucpP/ng==} + /sherif-linux-arm64@1.1.0: + resolution: {integrity: sha512-4K8mOa3eSctrwF8pvuFuVAsL/538unjmbJgQw+xrqaaQWOaoEdjGGZHM0SwSVO2FzQsNdt2MRBudmDTO38yX2w==} cpu: [arm64] os: [linux] + requiresBuild: true + dev: true + optional: true - sherif-linux-x64@1.0.1: - resolution: {integrity: sha512-I07H4VAPM0+N8rpIgxV47vBSKViJ3F/EiaUi4DnlhySivGg/6oOacHFOfzKeNPMaMK+3usMEmU+UVm6vEvtPYA==} + /sherif-linux-x64@1.1.0: + resolution: {integrity: sha512-x+i5lW2/tSGXdExqeCXcTyPc1HYYtw9dheVdZQ9u0JebFaHq2Ob68S8ry8XHiUOOe+RNMW1SzkgKYx4iGhkifQ==} cpu: [x64] os: [linux] + requiresBuild: true + dev: true + optional: true - sherif-windows-arm64@1.0.1: - resolution: {integrity: sha512-UfIYXDya60VmAcYuuKe6bwnBWiJHA6lof97rG2+EN8f3LiGyEx95/3qUdUoOn7qB5pl3xaeazMGcpc1O4FpExg==} + /sherif-windows-arm64@1.1.0: + resolution: {integrity: sha512-bd56dTRCyKt1HPLEVIsTPR/2mXsj2cZNRjgGTqR39MNUgb11pLspHuYYQXHbBJAnucr7uT0ae9VBjJ1M6fKpaA==} cpu: [arm64] os: [win32] + requiresBuild: true + dev: true + optional: true - sherif-windows-x64@1.0.1: - resolution: {integrity: sha512-ep+acRpTeIhU3BB7GL1NdedD9ubhcIO1lwOJ9uf3rOrmKIlbKd55LgmVRfl/Spy96qcCGx6izdyypMhDOoWa/Q==} + /sherif-windows-x64@1.1.0: + resolution: {integrity: sha512-mcs8cuBPB+FF173Q4YzyMvt1PhG2labPDmGv5hwgX5WLWc6+grOcGMmSM0er+SNnQNLMx1zS+R98QCaNrjRdww==} cpu: [x64] os: [win32] + requiresBuild: true + dev: true + optional: true - sherif@1.0.1: - resolution: {integrity: sha512-1zXt6XQHT3d7L2dMhmlAoWpPhQhqvxdjrYSOoGwnbbZA8nX4jrGrUPpryOe96XBSaG/d+DJtoDujujjydXICSg==} + /sherif@1.1.0: + resolution: {integrity: sha512-N2lliMvQKWdchMYFtIeNsPn6fJbqkjW07CKwRvBfy7YnG6a0oj6yks7LqEVqg3dTl+DWji5nVXHDmq0Cr/ExYA==} hasBin: true - - signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - - signal-exit@4.1.0: + optionalDependencies: + sherif-darwin-arm64: 1.1.0 + sherif-darwin-x64: 1.1.0 + sherif-linux-arm64: 1.1.0 + sherif-linux-x64: 1.1.0 + sherif-windows-arm64: 1.1.0 + sherif-windows-x64: 1.1.0 + dev: true + + /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - simple-git-hooks@2.11.1: + /simple-git-hooks@2.11.1: resolution: {integrity: sha512-tgqwPUMDcNDhuf1Xf6KTUsyeqGdgKMhzaH4PAZZuzguOgTl5uuyeYe/8mWgAr6IBxB5V06uqEf6Dy37gIWDtDg==} hasBin: true + requiresBuild: true + dev: true - slash@3.0.0: + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + dev: true - smol-toml@1.3.0: - resolution: {integrity: sha512-tWpi2TsODPScmi48b/OQZGi2lgUmBCHy6SZrhi/FdnnHiU1GwebbCfuQuxsC3nHaLwtYeJGPrDZDIeodDOc4pA==} + /smol-toml@1.3.1: + resolution: {integrity: sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ==} engines: {node: '>= 18'} + dev: true + + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true - spawndamnit@2.0.0: - resolution: {integrity: sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA==} + /spawndamnit@3.0.1: + resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==} + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + dev: true - sprintf-js@1.0.3: + /sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true - stdin-discarder@0.2.2: + /stdin-discarder@0.2.2: resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} engines: {node: '>=18'} + dev: false - string-width@7.2.0: + /string-argv@0.3.2: + resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} + engines: {node: '>=0.6.19'} + dev: true + + /string-width@7.2.0: resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} engines: {node: '>=18'} + dependencies: + emoji-regex: 10.4.0 + get-east-asian-width: 1.3.0 + strip-ansi: 7.1.0 + dev: false - strip-ansi@6.0.1: + /strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} + dependencies: + ansi-regex: 5.0.1 + dev: true - strip-ansi@7.1.0: + /strip-ansi@7.1.0: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} engines: {node: '>=12'} + dependencies: + ansi-regex: 6.1.0 + dev: false - strip-bom@3.0.0: + /strip-bom@3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} + dev: true + + /strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + dev: true - strip-json-comments@5.0.1: + /strip-json-comments@5.0.1: resolution: {integrity: sha512-0fk9zBqO67Nq5M/m45qHCJxylV/DhBlIOVExqgOMiCCrzrhU6tCibRXNqE3jwJLftzE9SNuZtYbpzcO+i9FiKw==} engines: {node: '>=14.16'} + dev: true - summary@2.1.0: + /summary@2.1.0: resolution: {integrity: sha512-nMIjMrd5Z2nuB2RZCKJfFMjgS3fygbeyGk9PxPPaJR1RIcyN9yn4A63Isovzm3ZtQuEkLBVgMdPup8UeLH7aQw==} + dev: true + + /supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + dependencies: + has-flag: 4.0.0 + dev: true - tapable@2.2.1: + /supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + dev: true + + /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} + dev: true - term-size@2.2.1: + /term-size@2.2.1: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} engines: {node: '>=8'} + dev: true - tmp@0.0.33: + /tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} + dependencies: + os-tmpdir: 1.0.2 + dev: true - to-regex-range@5.0.1: + /to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true - tr46@0.0.3: + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + dev: true - tsx@4.19.1: - resolution: {integrity: sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==} + /tsx@4.19.2: + resolution: {integrity: sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==} engines: {node: '>=18.0.0'} hasBin: true + dependencies: + esbuild: 0.23.1 + get-tsconfig: 4.8.1 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /typescript@5.4.2: + resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} + engines: {node: '>=14.17'} + hasBin: true + dev: true - typescript@5.4.5: + /typescript@5.4.5: resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} engines: {node: '>=14.17'} hasBin: true + dev: true - typescript@5.6.2: - resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} + /typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} hasBin: true - undici-types@5.26.5: + /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + dev: true - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + /undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + dev: true - unicorn-magic@0.1.0: + /unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} + dev: false - universalify@0.1.2: + /universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} + dev: true - universalify@2.0.1: + /universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} - viem@2.21.40: - resolution: {integrity: sha512-no/mE3l7B0mdUTtvO7z/cTLENttQ/M7+ombqFGXJqsQrxv9wrYsTIGpS3za+FA5a447hY+x9D8Wxny84q1zAaA==} + /uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + dependencies: + punycode: 2.3.1 + dev: true + + /viem@2.21.54(typescript@5.7.2)(zod@3.24.0): + resolution: {integrity: sha512-G9mmtbua3UtnVY9BqAtWdNp+3AO+oWhD0B9KaEsZb6gcrOWgmA4rz02yqEMg+qW9m6KgKGie7q3zcHqJIw6AqA==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: typescript: optional: true + dependencies: + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + '@scure/bip32': 1.6.0 + '@scure/bip39': 1.5.0 + abitype: 1.0.7(typescript@5.7.2)(zod@3.24.0) + isows: 1.0.6(ws@8.18.0) + ox: 0.1.2(typescript@5.7.2)(zod@3.24.0) + typescript: 5.7.2 + webauthn-p256: 0.0.10 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + dev: false - wcwidth@1.0.1: + /wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + requiresBuild: true + dependencies: + defaults: 1.0.4 + dev: true + optional: true - webauthn-p256@0.0.10: + /webauthn-p256@0.0.10: resolution: {integrity: sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==} + dependencies: + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + dev: false - webidl-conversions@3.0.1: + /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + dev: true - whatwg-url@5.0.0: + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + dev: true - which@1.3.1: - resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} hasBin: true + dependencies: + isexe: 2.0.0 + dev: true - wrappy@1.0.2: + /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true - ws@8.18.0: + /ws@8.18.0: resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} engines: {node: '>=10.0.0'} peerDependencies: @@ -1290,1144 +2724,25 @@ packages: optional: true utf-8-validate: optional: true + dev: false - yallist@2.1.2: - resolution: {integrity: sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==} + /yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: true - yocto-queue@1.1.1: + /yocto-queue@1.1.1: resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} engines: {node: '>=12.20'} + dev: false - zod-validation-error@3.4.0: + /zod-validation-error@3.4.0(zod@3.24.0): resolution: {integrity: sha512-ZOPR9SVY6Pb2qqO5XHt+MkkTRxGXb4EVtnjc9JpXUOtUB1T9Ru7mZOT361AN3MsetVe7R0a1KZshJDZdgp9miQ==} engines: {node: '>=18.0.0'} peerDependencies: zod: ^3.18.0 - - zod@3.23.8: - resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} - -snapshots: - - '@adraffy/ens-normalize@1.11.0': {} - - '@babel/runtime@7.25.7': - dependencies: - regenerator-runtime: 0.14.1 - - '@biomejs/biome@1.9.3': - optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.9.3 - '@biomejs/cli-darwin-x64': 1.9.3 - '@biomejs/cli-linux-arm64': 1.9.3 - '@biomejs/cli-linux-arm64-musl': 1.9.3 - '@biomejs/cli-linux-x64': 1.9.3 - '@biomejs/cli-linux-x64-musl': 1.9.3 - '@biomejs/cli-win32-arm64': 1.9.3 - '@biomejs/cli-win32-x64': 1.9.3 - - '@biomejs/cli-darwin-arm64@1.9.3': - optional: true - - '@biomejs/cli-darwin-x64@1.9.3': - optional: true - - '@biomejs/cli-linux-arm64-musl@1.9.3': - optional: true - - '@biomejs/cli-linux-arm64@1.9.3': - optional: true - - '@biomejs/cli-linux-x64-musl@1.9.3': - optional: true - - '@biomejs/cli-linux-x64@1.9.3': - optional: true - - '@biomejs/cli-win32-arm64@1.9.3': - optional: true - - '@biomejs/cli-win32-x64@1.9.3': - optional: true - - '@bufbuild/buf-darwin-arm64@1.44.0': - optional: true - - '@bufbuild/buf-darwin-x64@1.44.0': - optional: true - - '@bufbuild/buf-linux-aarch64@1.44.0': - optional: true - - '@bufbuild/buf-linux-x64@1.44.0': - optional: true - - '@bufbuild/buf-win32-arm64@1.44.0': - optional: true - - '@bufbuild/buf-win32-x64@1.44.0': - optional: true - - '@bufbuild/buf@1.44.0': - optionalDependencies: - '@bufbuild/buf-darwin-arm64': 1.44.0 - '@bufbuild/buf-darwin-x64': 1.44.0 - '@bufbuild/buf-linux-aarch64': 1.44.0 - '@bufbuild/buf-linux-x64': 1.44.0 - '@bufbuild/buf-win32-arm64': 1.44.0 - '@bufbuild/buf-win32-x64': 1.44.0 - - '@bufbuild/protobuf@2.2.0': {} - - '@bufbuild/protobuf@2.2.2': {} - - '@bufbuild/protoc-gen-es@2.2.0(@bufbuild/protobuf@2.2.0)': - dependencies: - '@bufbuild/protoplugin': 2.2.0 - optionalDependencies: - '@bufbuild/protobuf': 2.2.0 - transitivePeerDependencies: - - supports-color - - '@bufbuild/protoplugin@2.2.0': - dependencies: - '@bufbuild/protobuf': 2.2.0 - '@typescript/vfs': 1.6.0(typescript@5.4.5) - typescript: 5.4.5 - transitivePeerDependencies: - - supports-color - - '@changesets/apply-release-plan@7.0.5': - dependencies: - '@changesets/config': 3.0.3 - '@changesets/get-version-range-type': 0.4.0 - '@changesets/git': 3.0.1 - '@changesets/should-skip-package': 0.1.1 - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - detect-indent: 6.1.0 - fs-extra: 7.0.1 - lodash.startcase: 4.4.0 - outdent: 0.5.0 - prettier: 2.8.8 - resolve-from: 5.0.0 - semver: 7.6.3 - - '@changesets/assemble-release-plan@6.0.4': - dependencies: - '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.2 - '@changesets/should-skip-package': 0.1.1 - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - semver: 7.6.3 - - '@changesets/changelog-git@0.2.0': - dependencies: - '@changesets/types': 6.0.0 - - '@changesets/changelog-github@0.5.0': - dependencies: - '@changesets/get-github-info': 0.6.0 - '@changesets/types': 6.0.0 - dotenv: 8.6.0 - transitivePeerDependencies: - - encoding - - '@changesets/cli@2.27.9': - dependencies: - '@changesets/apply-release-plan': 7.0.5 - '@changesets/assemble-release-plan': 6.0.4 - '@changesets/changelog-git': 0.2.0 - '@changesets/config': 3.0.3 - '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.2 - '@changesets/get-release-plan': 4.0.4 - '@changesets/git': 3.0.1 - '@changesets/logger': 0.1.1 - '@changesets/pre': 2.0.1 - '@changesets/read': 0.6.1 - '@changesets/should-skip-package': 0.1.1 - '@changesets/types': 6.0.0 - '@changesets/write': 0.3.2 - '@manypkg/get-packages': 1.1.3 - ansi-colors: 4.1.3 - ci-info: 3.9.0 - enquirer: 2.4.1 - external-editor: 3.1.0 - fs-extra: 7.0.1 - mri: 1.2.0 - p-limit: 2.3.0 - package-manager-detector: 0.2.1 - picocolors: 1.1.0 - resolve-from: 5.0.0 - semver: 7.6.3 - spawndamnit: 2.0.0 - term-size: 2.2.1 - - '@changesets/config@3.0.3': - dependencies: - '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.2 - '@changesets/logger': 0.1.1 - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - fs-extra: 7.0.1 - micromatch: 4.0.8 - - '@changesets/errors@0.2.0': - dependencies: - extendable-error: 0.1.7 - - '@changesets/get-dependents-graph@2.1.2': - dependencies: - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - picocolors: 1.1.0 - semver: 7.6.3 - - '@changesets/get-github-info@0.6.0': - dependencies: - dataloader: 1.4.0 - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - - '@changesets/get-release-plan@4.0.4': - dependencies: - '@changesets/assemble-release-plan': 6.0.4 - '@changesets/config': 3.0.3 - '@changesets/pre': 2.0.1 - '@changesets/read': 0.6.1 - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - - '@changesets/get-version-range-type@0.4.0': {} - - '@changesets/git@3.0.1': - dependencies: - '@changesets/errors': 0.2.0 - '@manypkg/get-packages': 1.1.3 - is-subdir: 1.2.0 - micromatch: 4.0.8 - spawndamnit: 2.0.0 - - '@changesets/logger@0.1.1': - dependencies: - picocolors: 1.1.0 - - '@changesets/parse@0.4.0': - dependencies: - '@changesets/types': 6.0.0 - js-yaml: 3.14.1 - - '@changesets/pre@2.0.1': - dependencies: - '@changesets/errors': 0.2.0 - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - fs-extra: 7.0.1 - - '@changesets/read@0.6.1': - dependencies: - '@changesets/git': 3.0.1 - '@changesets/logger': 0.1.1 - '@changesets/parse': 0.4.0 - '@changesets/types': 6.0.0 - fs-extra: 7.0.1 - p-filter: 2.1.0 - picocolors: 1.1.0 - - '@changesets/should-skip-package@0.1.1': - dependencies: - '@changesets/types': 6.0.0 - '@manypkg/get-packages': 1.1.3 - - '@changesets/types@4.1.0': {} - - '@changesets/types@6.0.0': {} - - '@changesets/write@0.3.2': - dependencies: - '@changesets/types': 6.0.0 - fs-extra: 7.0.1 - human-id: 1.0.2 - prettier: 2.8.8 - - '@connectrpc/connect-node@2.0.0-beta.2(@bufbuild/protobuf@2.2.2)(@connectrpc/connect@2.0.0-beta.2(@bufbuild/protobuf@2.2.2))': - dependencies: - '@bufbuild/protobuf': 2.2.2 - '@connectrpc/connect': 2.0.0-beta.2(@bufbuild/protobuf@2.2.2) - - '@connectrpc/connect-web@2.0.0-beta.2(@bufbuild/protobuf@2.2.2)(@connectrpc/connect@2.0.0-beta.2(@bufbuild/protobuf@2.2.2))': - dependencies: - '@bufbuild/protobuf': 2.2.2 - '@connectrpc/connect': 2.0.0-beta.2(@bufbuild/protobuf@2.2.2) - - '@connectrpc/connect@2.0.0-beta.2(@bufbuild/protobuf@2.2.2)': - dependencies: - '@bufbuild/protobuf': 2.2.2 - - '@esbuild/aix-ppc64@0.23.1': - optional: true - - '@esbuild/android-arm64@0.23.1': - optional: true - - '@esbuild/android-arm@0.23.1': - optional: true - - '@esbuild/android-x64@0.23.1': - optional: true - - '@esbuild/darwin-arm64@0.23.1': - optional: true - - '@esbuild/darwin-x64@0.23.1': - optional: true - - '@esbuild/freebsd-arm64@0.23.1': - optional: true - - '@esbuild/freebsd-x64@0.23.1': - optional: true - - '@esbuild/linux-arm64@0.23.1': - optional: true - - '@esbuild/linux-arm@0.23.1': - optional: true - - '@esbuild/linux-ia32@0.23.1': - optional: true - - '@esbuild/linux-loong64@0.23.1': - optional: true - - '@esbuild/linux-mips64el@0.23.1': - optional: true - - '@esbuild/linux-ppc64@0.23.1': - optional: true - - '@esbuild/linux-riscv64@0.23.1': - optional: true - - '@esbuild/linux-s390x@0.23.1': - optional: true - - '@esbuild/linux-x64@0.23.1': - optional: true - - '@esbuild/netbsd-x64@0.23.1': - optional: true - - '@esbuild/openbsd-arm64@0.23.1': - optional: true - - '@esbuild/openbsd-x64@0.23.1': - optional: true - - '@esbuild/sunos-x64@0.23.1': - optional: true - - '@esbuild/win32-arm64@0.23.1': - optional: true - - '@esbuild/win32-ia32@0.23.1': - optional: true - - '@esbuild/win32-x64@0.23.1': - optional: true - - '@faker-js/faker@7.6.0': {} - - '@farcaster/core@0.15.6(typescript@5.6.2)(zod@3.23.8)': - dependencies: - '@faker-js/faker': 7.6.0 - '@noble/curves': 1.6.0 - '@noble/hashes': 1.5.0 - bs58: 5.0.0 - neverthrow: 6.2.2 - viem: 2.21.40(typescript@5.6.2)(zod@3.23.8) - transitivePeerDependencies: - - bufferutil - - typescript - - utf-8-validate - - zod - - '@manypkg/find-root@1.1.0': - dependencies: - '@babel/runtime': 7.25.7 - '@types/node': 12.20.55 - find-up: 4.1.0 - fs-extra: 8.1.0 - - '@manypkg/get-packages@1.1.3': - dependencies: - '@babel/runtime': 7.25.7 - '@changesets/types': 4.1.0 - '@manypkg/find-root': 1.1.0 - fs-extra: 8.1.0 - globby: 11.1.0 - read-yaml-file: 1.1.0 - - '@noble/curves@1.6.0': - dependencies: - '@noble/hashes': 1.5.0 - - '@noble/ed25519@2.1.0': {} - - '@noble/hashes@1.5.0': {} - - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.17.1 - - '@scure/base@1.1.9': {} - - '@scure/bip32@1.5.0': - dependencies: - '@noble/curves': 1.6.0 - '@noble/hashes': 1.5.0 - '@scure/base': 1.1.9 - - '@scure/bip39@1.4.0': - dependencies: - '@noble/hashes': 1.5.0 - '@scure/base': 1.1.9 - - '@snyk/github-codeowners@1.1.0': - dependencies: - commander: 4.1.1 - ignore: 5.3.2 - p-map: 4.0.0 - - '@types/bun@1.1.13': - dependencies: - bun-types: 1.1.34 - - '@types/fs-extra@11.0.4': - dependencies: - '@types/jsonfile': 6.1.4 - '@types/node': 22.7.4 - - '@types/jsonfile@6.1.4': - dependencies: - '@types/node': 22.7.4 - - '@types/node@12.20.55': {} - - '@types/node@20.12.14': - dependencies: - undici-types: 5.26.5 - - '@types/node@22.7.4': - dependencies: - undici-types: 6.19.8 - - '@types/ws@8.5.12': - dependencies: - '@types/node': 22.7.4 - - '@typescript/vfs@1.6.0(typescript@5.4.5)': - dependencies: - debug: 4.3.7 - typescript: 5.4.5 - transitivePeerDependencies: - - supports-color - - abitype@1.0.6(typescript@5.6.2)(zod@3.23.8): - optionalDependencies: - typescript: 5.6.2 - zod: 3.23.8 - - aggregate-error@3.1.0: - dependencies: - clean-stack: 2.2.0 - indent-string: 4.0.0 - - ansi-colors@4.1.3: {} - - ansi-regex@5.0.1: {} - - ansi-regex@6.1.0: {} - - argparse@1.0.10: - dependencies: - sprintf-js: 1.0.3 - - argparse@2.0.1: {} - - array-union@2.1.0: {} - - balanced-match@1.0.2: {} - - base-x@4.0.0: {} - - better-path-resolve@1.0.0: - dependencies: - is-windows: 1.0.2 - - brace-expansion@2.0.1: - dependencies: - balanced-match: 1.0.2 - - braces@3.0.3: - dependencies: - fill-range: 7.1.1 - - bs58@5.0.0: - dependencies: - base-x: 4.0.0 - - buf@0.1.1: {} - - bun-types@1.1.34: - dependencies: - '@types/node': 20.12.14 - '@types/ws': 8.5.12 - - bundle-require@5.0.0(esbuild@0.23.1): - dependencies: - esbuild: 0.23.1 - load-tsconfig: 0.2.5 - - cac@6.7.14: {} - - chalk@5.3.0: {} - - chardet@0.7.0: {} - - ci-info@3.9.0: {} - - clean-stack@2.2.0: {} - - cli-cursor@5.0.0: - dependencies: - restore-cursor: 5.1.0 - - cli-spinners@2.9.2: {} - - clone@1.0.4: - optional: true - - commander@4.1.1: {} - - cross-spawn@5.1.0: - dependencies: - lru-cache: 4.1.5 - shebang-command: 1.2.0 - which: 1.3.1 - - dataloader@1.4.0: {} - - debug@4.3.7: - dependencies: - ms: 2.1.3 - - dedent@1.5.3: {} - - defaults@1.0.4: - dependencies: - clone: 1.0.4 - optional: true - - detect-indent@6.1.0: {} - - dir-glob@3.0.1: - dependencies: - path-type: 4.0.0 - - dotenv@8.6.0: {} - - easy-table@1.2.0: - dependencies: - ansi-regex: 5.0.1 - optionalDependencies: - wcwidth: 1.0.1 - - emoji-regex@10.4.0: {} - - enhanced-resolve@5.17.1: - dependencies: - graceful-fs: 4.2.11 - tapable: 2.2.1 - - enquirer@2.4.1: - dependencies: - ansi-colors: 4.1.3 - strip-ansi: 6.0.1 - - esbuild@0.23.1: - optionalDependencies: - '@esbuild/aix-ppc64': 0.23.1 - '@esbuild/android-arm': 0.23.1 - '@esbuild/android-arm64': 0.23.1 - '@esbuild/android-x64': 0.23.1 - '@esbuild/darwin-arm64': 0.23.1 - '@esbuild/darwin-x64': 0.23.1 - '@esbuild/freebsd-arm64': 0.23.1 - '@esbuild/freebsd-x64': 0.23.1 - '@esbuild/linux-arm': 0.23.1 - '@esbuild/linux-arm64': 0.23.1 - '@esbuild/linux-ia32': 0.23.1 - '@esbuild/linux-loong64': 0.23.1 - '@esbuild/linux-mips64el': 0.23.1 - '@esbuild/linux-ppc64': 0.23.1 - '@esbuild/linux-riscv64': 0.23.1 - '@esbuild/linux-s390x': 0.23.1 - '@esbuild/linux-x64': 0.23.1 - '@esbuild/netbsd-x64': 0.23.1 - '@esbuild/openbsd-arm64': 0.23.1 - '@esbuild/openbsd-x64': 0.23.1 - '@esbuild/sunos-x64': 0.23.1 - '@esbuild/win32-arm64': 0.23.1 - '@esbuild/win32-ia32': 0.23.1 - '@esbuild/win32-x64': 0.23.1 - - esprima@4.0.1: {} - - eventemitter3@5.0.1: {} - - extendable-error@0.1.7: {} - - external-editor@3.1.0: - dependencies: - chardet: 0.7.0 - iconv-lite: 0.4.24 - tmp: 0.0.33 - - fast-glob@3.3.2: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 - - fastq@1.17.1: - dependencies: - reusify: 1.0.4 - - fill-range@7.1.1: - dependencies: - to-regex-range: 5.0.1 - - find-up@4.1.0: - dependencies: - locate-path: 5.0.0 - path-exists: 4.0.0 - - find-up@7.0.0: - dependencies: - locate-path: 7.2.0 - path-exists: 5.0.0 - unicorn-magic: 0.1.0 - - fs-extra@11.2.0: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 6.1.0 - universalify: 2.0.1 - - fs-extra@7.0.1: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 4.0.0 - universalify: 0.1.2 - - fs-extra@8.1.0: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 4.0.0 - universalify: 0.1.2 - - fs.realpath@1.0.0: {} - - fsevents@2.3.3: - optional: true - - get-east-asian-width@1.3.0: {} - - get-tsconfig@4.8.1: - dependencies: - resolve-pkg-maps: 1.0.0 - - glob-parent@5.1.2: - dependencies: - is-glob: 4.0.3 - - glob@8.1.0: - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.6 - once: 1.4.0 - - globby@11.1.0: - dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.3.2 - merge2: 1.4.1 - slash: 3.0.0 - - graceful-fs@4.2.11: {} - - human-id@1.0.2: {} - - iconv-lite@0.4.24: - dependencies: - safer-buffer: 2.1.2 - - ignore-walk@5.0.1: - dependencies: - minimatch: 5.1.6 - - ignore@5.3.2: {} - - indent-string@4.0.0: {} - - inflight@1.0.6: - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - - inherits@2.0.4: {} - - is-extglob@2.1.1: {} - - is-glob@4.0.3: - dependencies: - is-extglob: 2.1.1 - - is-interactive@2.0.0: {} - - is-number@7.0.0: {} - - is-subdir@1.2.0: - dependencies: - better-path-resolve: 1.0.0 - - is-unicode-supported@1.3.0: {} - - is-unicode-supported@2.1.0: {} - - is-windows@1.0.2: {} - - isexe@2.0.0: {} - - isows@1.0.6(ws@8.18.0): - dependencies: - ws: 8.18.0 - - jiti@2.3.3: {} - - js-yaml@3.14.1: - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - - js-yaml@4.1.0: - dependencies: - argparse: 2.0.1 - - jsonfile@4.0.0: - optionalDependencies: - graceful-fs: 4.2.11 - - jsonfile@6.1.0: - dependencies: - universalify: 2.0.1 - optionalDependencies: - graceful-fs: 4.2.11 - - knip@5.33.3(@types/node@22.7.4)(typescript@5.6.2): - dependencies: - '@nodelib/fs.walk': 1.2.8 - '@snyk/github-codeowners': 1.1.0 - '@types/node': 22.7.4 - easy-table: 1.2.0 - enhanced-resolve: 5.17.1 - fast-glob: 3.3.2 - jiti: 2.3.3 - js-yaml: 4.1.0 - minimist: 1.2.8 - picocolors: 1.1.0 - picomatch: 4.0.2 - pretty-ms: 9.1.0 - smol-toml: 1.3.0 - strip-json-comments: 5.0.1 - summary: 2.1.0 - typescript: 5.6.2 - zod: 3.23.8 - zod-validation-error: 3.4.0(zod@3.23.8) - - load-tsconfig@0.2.5: {} - - locate-path@5.0.0: - dependencies: - p-locate: 4.1.0 - - locate-path@7.2.0: - dependencies: - p-locate: 6.0.0 - - lodash.startcase@4.4.0: {} - - log-symbols@6.0.0: - dependencies: - chalk: 5.3.0 - is-unicode-supported: 1.3.0 - - lru-cache@4.1.5: - dependencies: - pseudomap: 1.0.2 - yallist: 2.1.2 - - merge2@1.4.1: {} - - micromatch@4.0.8: - dependencies: - braces: 3.0.3 - picomatch: 2.3.1 - - mimic-function@5.0.1: {} - - minimatch@5.1.6: - dependencies: - brace-expansion: 2.0.1 - - minimist@1.2.8: {} - - mri@1.2.0: {} - - ms@2.1.3: {} - - neverthrow@6.2.2: {} - - node-fetch@2.7.0: - dependencies: - whatwg-url: 5.0.0 - - npm-bundled@2.0.1: - dependencies: - npm-normalize-package-bin: 2.0.0 - - npm-normalize-package-bin@2.0.0: {} - - npm-packlist@5.1.3: - dependencies: - glob: 8.1.0 - ignore-walk: 5.0.1 - npm-bundled: 2.0.1 - npm-normalize-package-bin: 2.0.0 - - once@1.4.0: - dependencies: - wrappy: 1.0.2 - - onetime@7.0.0: - dependencies: - mimic-function: 5.0.1 - - ora@8.1.1: - dependencies: - chalk: 5.3.0 - cli-cursor: 5.0.0 - cli-spinners: 2.9.2 - is-interactive: 2.0.0 - is-unicode-supported: 2.1.0 - log-symbols: 6.0.0 - stdin-discarder: 0.2.2 - string-width: 7.2.0 - strip-ansi: 7.1.0 - - os-tmpdir@1.0.2: {} - - outdent@0.5.0: {} - - ox@0.0.0-canary-20241006052626(typescript@5.6.2)(zod@3.23.8): - dependencies: - '@adraffy/ens-normalize': 1.11.0 - '@noble/curves': 1.6.0 - '@noble/hashes': 1.5.0 - '@scure/bip32': 1.5.0 - '@scure/bip39': 1.4.0 - abitype: 1.0.6(typescript@5.6.2)(zod@3.23.8) - eventemitter3: 5.0.1 - optionalDependencies: - typescript: 5.6.2 - transitivePeerDependencies: - - zod - - p-filter@2.1.0: - dependencies: - p-map: 2.1.0 - - p-limit@2.3.0: - dependencies: - p-try: 2.2.0 - - p-limit@4.0.0: - dependencies: - yocto-queue: 1.1.1 - - p-locate@4.1.0: - dependencies: - p-limit: 2.3.0 - - p-locate@6.0.0: - dependencies: - p-limit: 4.0.0 - - p-map@2.1.0: {} - - p-map@4.0.0: - dependencies: - aggregate-error: 3.1.0 - - p-try@2.2.0: {} - - package-manager-detector@0.2.1: {} - - parse-ms@4.0.0: {} - - path-exists@4.0.0: {} - - path-exists@5.0.0: {} - - path-type@4.0.0: {} - - pathe@1.1.2: {} - - picocolors@1.1.0: {} - - picocolors@1.1.1: {} - - picomatch@2.3.1: {} - - picomatch@4.0.2: {} - - pify@4.0.1: {} - - prettier@2.8.8: {} - - prettier@3.3.3: {} - - pretty-ms@9.1.0: - dependencies: - parse-ms: 4.0.0 - - pseudomap@1.0.2: {} - - publint@0.2.11: - dependencies: - npm-packlist: 5.1.3 - picocolors: 1.1.0 - sade: 1.8.1 - - queue-microtask@1.2.3: {} - - read-yaml-file@1.1.0: - dependencies: - graceful-fs: 4.2.11 - js-yaml: 3.14.1 - pify: 4.0.1 - strip-bom: 3.0.0 - - regenerator-runtime@0.14.1: {} - - resolve-from@5.0.0: {} - - resolve-pkg-maps@1.0.0: {} - - restore-cursor@5.1.0: - dependencies: - onetime: 7.0.0 - signal-exit: 4.1.0 - - reusify@1.0.4: {} - - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - - sade@1.8.1: - dependencies: - mri: 1.2.0 - - safer-buffer@2.1.2: {} - - semver@7.6.3: {} - - shebang-command@1.2.0: - dependencies: - shebang-regex: 1.0.0 - - shebang-regex@1.0.0: {} - - sherif-darwin-arm64@1.0.1: - optional: true - - sherif-darwin-x64@1.0.1: - optional: true - - sherif-linux-arm64@1.0.1: - optional: true - - sherif-linux-x64@1.0.1: - optional: true - - sherif-windows-arm64@1.0.1: - optional: true - - sherif-windows-x64@1.0.1: - optional: true - - sherif@1.0.1: - optionalDependencies: - sherif-darwin-arm64: 1.0.1 - sherif-darwin-x64: 1.0.1 - sherif-linux-arm64: 1.0.1 - sherif-linux-x64: 1.0.1 - sherif-windows-arm64: 1.0.1 - sherif-windows-x64: 1.0.1 - - signal-exit@3.0.7: {} - - signal-exit@4.1.0: {} - - simple-git-hooks@2.11.1: {} - - slash@3.0.0: {} - - smol-toml@1.3.0: {} - - spawndamnit@2.0.0: - dependencies: - cross-spawn: 5.1.0 - signal-exit: 3.0.7 - - sprintf-js@1.0.3: {} - - stdin-discarder@0.2.2: {} - - string-width@7.2.0: - dependencies: - emoji-regex: 10.4.0 - get-east-asian-width: 1.3.0 - strip-ansi: 7.1.0 - - strip-ansi@6.0.1: - dependencies: - ansi-regex: 5.0.1 - - strip-ansi@7.1.0: - dependencies: - ansi-regex: 6.1.0 - - strip-bom@3.0.0: {} - - strip-json-comments@5.0.1: {} - - summary@2.1.0: {} - - tapable@2.2.1: {} - - term-size@2.2.1: {} - - tmp@0.0.33: - dependencies: - os-tmpdir: 1.0.2 - - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 - - tr46@0.0.3: {} - - tsx@4.19.1: - dependencies: - esbuild: 0.23.1 - get-tsconfig: 4.8.1 - optionalDependencies: - fsevents: 2.3.3 - - typescript@5.4.5: {} - - typescript@5.6.2: {} - - undici-types@5.26.5: {} - - undici-types@6.19.8: {} - - unicorn-magic@0.1.0: {} - - universalify@0.1.2: {} - - universalify@2.0.1: {} - - viem@2.21.40(typescript@5.6.2)(zod@3.23.8): - dependencies: - '@adraffy/ens-normalize': 1.11.0 - '@noble/curves': 1.6.0 - '@noble/hashes': 1.5.0 - '@scure/bip32': 1.5.0 - '@scure/bip39': 1.4.0 - abitype: 1.0.6(typescript@5.6.2)(zod@3.23.8) - isows: 1.0.6(ws@8.18.0) - webauthn-p256: 0.0.10 - ws: 8.18.0 - optionalDependencies: - typescript: 5.6.2 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod - - wcwidth@1.0.1: - dependencies: - defaults: 1.0.4 - optional: true - - webauthn-p256@0.0.10: - dependencies: - '@noble/curves': 1.6.0 - '@noble/hashes': 1.5.0 - - webidl-conversions@3.0.1: {} - - whatwg-url@5.0.0: - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - - which@1.3.1: - dependencies: - isexe: 2.0.0 - - wrappy@1.0.2: {} - - ws@8.18.0: {} - - yallist@2.1.2: {} - - yocto-queue@1.1.1: {} - - zod-validation-error@3.4.0(zod@3.23.8): dependencies: - zod: 3.23.8 + zod: 3.24.0 + dev: true - zod@3.23.8: {} + /zod@3.24.0: + resolution: {integrity: sha512-Hz+wiY8yD0VLA2k/+nsg2Abez674dDGTai33SwNvMPuf9uIrBC9eFgIMQxBBbHFxVXi8W+5nX9DcAh9YNSQm/w==} diff --git a/src/Actions.ts b/src/Actions.ts deleted file mode 100644 index f7d88eb..0000000 --- a/src/Actions.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * as Cast from './Actions/Cast.js' -export * as Watch from './Actions/Watch.js' -export * as Follow from './Actions/Follow.js' -export * as Like from './Actions/Like.js' -export * as Recast from './Actions/Recast.js' -export * as User from './Actions/User.js' diff --git a/src/Actions/Cast.ts b/src/Actions/Cast.ts deleted file mode 100644 index b708a84..0000000 --- a/src/Actions/Cast.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { Actions_Cast_get as get } from '../Internal/Actions/Cast/get.js' -export { Actions_Cast_create as create } from '../Internal/Actions/Cast/create.js' -export { Actions_Cast_fromString as fromString } from '../Internal/Actions/Cast/fromString.js' -export { Actions_Cast_toString as toString } from '../Internal/Actions/Cast/toString.js' diff --git a/src/Actions/Follow.ts b/src/Actions/Follow.ts deleted file mode 100644 index c2dd622..0000000 --- a/src/Actions/Follow.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Actions_Follow_create as create } from '../Internal/Actions/Follow/create.js' -export { Actions_Follow_createByUsername as createByUsername } from '../Internal/Actions/Follow/createByUsername.js' diff --git a/src/Actions/Like.ts b/src/Actions/Like.ts deleted file mode 100644 index 853958a..0000000 --- a/src/Actions/Like.ts +++ /dev/null @@ -1 +0,0 @@ -export { Actions_Like_create as create } from '../Internal/Actions/Like/create.js' diff --git a/src/Actions/Recast.ts b/src/Actions/Recast.ts deleted file mode 100644 index 7d51818..0000000 --- a/src/Actions/Recast.ts +++ /dev/null @@ -1 +0,0 @@ -export { Actions_Recast_create as create } from '../Internal/Actions/Recast/create.js' diff --git a/src/Actions/User.ts b/src/Actions/User.ts deleted file mode 100644 index 468a627..0000000 --- a/src/Actions/User.ts +++ /dev/null @@ -1 +0,0 @@ -export { Actions_User_get as get } from '../Internal/Actions/User/get.js' diff --git a/src/Actions/Watch.ts b/src/Actions/Watch.ts deleted file mode 100644 index 2154e69..0000000 --- a/src/Actions/Watch.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { Actions_Watch_watchCasts as watchCasts } from '../Internal/Actions/Watch/watchCasts.js' -export { Actions_Watch_watchCastsCompliantToRegexp as watchCastsCompliantToRegexp } from '../Internal/Actions/Watch/watchCastsCompliantToRegexp.js' -export { Actions_Watch_watchCastsMentioningFid as watchCastsMentioningFid } from '../Internal/Actions/Watch/watchCastsMentioningFid.js' -export { Actions_Watch_watchCastsMentioningUsername as watchCastsMentioningUsername } from '../Internal/Actions/Watch/watchCastsMentioningUsername.js' diff --git a/src/Cli/Bin.ts b/src/Cli/Bin.ts index 265a19e..25cfa58 100644 --- a/src/Cli/Bin.ts +++ b/src/Cli/Bin.ts @@ -2,9 +2,9 @@ import { cac } from 'cac' import { version } from '../version.js' -import { type Generate, generate } from './Commands/Generate.js' -import { type Init, init } from './Commands/Init.js' import * as Logger from './Logger.js' +import { type Generate, generate } from './commands/Generate.js' +import { type Init, init } from './commands/Init.js' const cli = cac('fhub') diff --git a/src/Cli/Commands/Generate.ts b/src/Cli/Commands/Generate.ts index de7d523..a234f30 100644 --- a/src/Cli/Commands/Generate.ts +++ b/src/Cli/Commands/Generate.ts @@ -7,10 +7,10 @@ import { z } from 'zod' import { fileURLToPath } from 'node:url' import { fromZodError } from '../Errors.js' import * as logger from '../Logger.js' -import { findConfig } from '../Utils/findConfig.js' -import { format } from '../Utils/format.js' -import { getIsUsingTypeScript } from '../Utils/getIsUsingTypeScript.js' -import { resolveConfig } from '../Utils/resolveConfig.js' +import { findConfig } from '../utils/findConfig.js' +import { format } from '../utils/format.js' +import { getIsUsingTypeScript } from '../utils/getIsUsingTypeScript.js' +import { resolveConfig } from '../utils/resolveConfig.js' const Generate = z.object({ /** Path to config file */ @@ -67,8 +67,10 @@ export async function generate(options: Generate = {}) { spinner.start('Generating fhub Action Hooks') const actionsPath = resolve( dirname(fileURLToPath(import.meta.url)), - '../..', - 'Actions', + '..', + '..', + 'fhub', + 'actions', ) const files = await fs.readdir(actionsPath) @@ -88,7 +90,9 @@ export async function generate(options: Generate = {}) { const functionNames = (() => { const matches = [ - ...fileContents.matchAll(/as (?.*) }/gm), + ...fileContents.matchAll( + /export async function (?.*)\(/gm, + ), ] return matches.map((match) => { const functionName = match.groups?.functionName diff --git a/src/Cli/Commands/Init.ts b/src/Cli/Commands/Init.ts index 627a3e4..051b44a 100644 --- a/src/Cli/Commands/Init.ts +++ b/src/Cli/Commands/Init.ts @@ -7,9 +7,9 @@ import { z } from 'zod' import { type Config, defaultConfig } from '../Config.js' import { fromZodError } from '../Errors.js' import * as logger from '../Logger.js' -import { findConfig } from '../Utils/findConfig.js' -import { format } from '../Utils/format.js' -import { getIsUsingTypeScript } from '../Utils/getIsUsingTypeScript.js' +import { findConfig } from '../utils/findConfig.js' +import { format } from '../utils/format.js' +import { getIsUsingTypeScript } from '../utils/getIsUsingTypeScript.js' export type Init = { /** Path to config file */ diff --git a/src/Cli/Config.ts b/src/Cli/Config.ts index 041e782..931c717 100644 --- a/src/Cli/Config.ts +++ b/src/Cli/Config.ts @@ -1,4 +1,4 @@ -import type { MaybeArray, MaybePromise } from '../Internal/types.js' +import type { MaybeArray, MaybePromise } from '../fhub/internal/types.js' export type Config = { /** Hub RPC url */ diff --git a/src/Cli/Utils/resolveConfig.ts b/src/Cli/Utils/resolveConfig.ts index 029a232..927d340 100644 --- a/src/Cli/Utils/resolveConfig.ts +++ b/src/Cli/Utils/resolveConfig.ts @@ -1,6 +1,6 @@ import { bundleRequire } from 'bundle-require' -import type { MaybeArray } from '../../Internal/types.js' +import type { MaybeArray } from '../../fhub/internal/types.js' import type { Config } from '../Config.js' type ResolveConfigParameters = { diff --git a/src/Client.ts b/src/Client.ts deleted file mode 100644 index c698c24..0000000 --- a/src/Client.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Client_create as create } from './Internal/Client/create.js' -export type { Client } from './Internal/Client/types.js' diff --git a/src/Client/package.json b/src/Client/package.json deleted file mode 100644 index 92bd5b0..0000000 --- a/src/Client/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "module", - "types": "../_types/Client.d.ts", - "module": "../_esm/Client.js", - "main": "../_cjs/Client.js" -} diff --git a/src/Internal/Account/fromString.ts b/src/Internal/Account/fromString.ts deleted file mode 100644 index 89978af..0000000 --- a/src/Internal/Account/fromString.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../Errors/error.js' -import type { Account } from './types.js' - -export function Account_fromString( - value: Account_fromString.ParametersType, -): Account_fromString.ReturnType { - const [fidRaw, privateKey] = value.split(':') - const fid = BigInt(fidRaw) - Hex.assert(privateKey) - return { - fid, - privateKey, - } as const -} - -export declare namespace Account_fromString { - type ParametersType = string - type ReturnType = Account - type ErrorType = Hex.InvalidHexValueError | GlobalErrorType -} - -Account_fromString.parseError = (error: unknown) => - error as Account_fromString.ErrorType diff --git a/src/Internal/Account/toString.ts b/src/Internal/Account/toString.ts deleted file mode 100644 index a7e9b2e..0000000 --- a/src/Internal/Account/toString.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { Types } from 'ox' -import type { GlobalErrorType } from '../Errors/error.js' -import type { Account } from './types.js' - -export function Account_toString( - account: Account_toString.ParametersType, -): Account_toString.ReturnType { - return `${account.fid}:${account.privateKey}` -} - -export declare namespace Account_toString { - type ParametersType = Account - type ReturnType = `${bigint}:${Types.Hex}` - type ErrorType = GlobalErrorType -} - -Account_toString.parseError = (error: unknown) => - error as Account_toString.ErrorType diff --git a/src/Internal/Account/types.ts b/src/Internal/Account/types.ts deleted file mode 100644 index cc59134..0000000 --- a/src/Internal/Account/types.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Types } from 'ox' - -export type Account = { - privateKey: Types.Hex - fid: bigint -} diff --git a/src/Internal/Actions/Cast/create.ts b/src/Internal/Actions/Cast/create.ts deleted file mode 100644 index b12f3ee..0000000 --- a/src/Internal/Actions/Cast/create.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { CastAdd_toMessageProtobuf } from '../../../Node/Internal/CastAdd/toMessageProtobuf.js' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Account } from '../../Account/types.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Cast_fromString } from './fromString.js' - -export declare namespace Actions_Cast_create { - type ParametersType = ( - | { - cast: Omit - } - | Actions_Cast_fromString.ParametersType - ) & { - account: Account - } - type ReturnType = NodeTypes.Message - type ErrorType = GlobalErrorType -} -export async function Actions_Cast_create( - client: Client, - parameters: Actions_Cast_create.ParametersType, - options?: CallOptions, -): Promise { - const cast = await (async () => { - if ('cast' in parameters) return parameters.cast - - return Actions_Cast_fromString(client, parameters, options) - })() - const message = CastAdd_toMessageProtobuf({ - cast: { - ...cast, - fid: parameters.account.fid, - timestamp: Math.floor(Date.now() / 1000), - }, - privateKey: parameters.account.privateKey, - }) - return NodeActions.Submit.submitMessage(client, message, options) -} - -Actions_Cast_create.parseError = (error: unknown) => - error as Actions_Cast_create.ErrorType diff --git a/src/Internal/Actions/Cast/fromString.ts b/src/Internal/Actions/Cast/fromString.ts deleted file mode 100644 index 7f8ca11..0000000 --- a/src/Internal/Actions/Cast/fromString.ts +++ /dev/null @@ -1,114 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Warpcast_getCastIdFromUrl } from '../Warpcast/getFullCastHash.js' - -export declare namespace Actions_Cast_fromString { - type ParametersType = { - text: string - embeds?: NodeTypes.Embed[] | undefined - } - type ReturnType = Pick - type ErrorType = GlobalErrorType -} -export async function Actions_Cast_fromString( - client: Client, - parameters: Actions_Cast_fromString.ParametersType, - options?: CallOptions, -): Promise { - const mentionsMatches = [...parameters.text.matchAll(/@\w+(?:.eth)?/gim)] - const embedsMatches = [ - ...parameters.text.matchAll( - /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/gim, - ), - ] - const mentions: { fid: bigint; position: number }[] = [] - const embeds: NodeTypes.Embed[] = [] - - for ( - let mentionsMatchIndex = 0; - mentionsMatchIndex < mentionsMatches.length; - ++mentionsMatchIndex - ) { - const mentionMatch = mentionsMatches[mentionsMatchIndex] - const mention = mentionMatch[0] - const position = - mentionMatch.index - - /* remove the delta*/ - mentionsMatches - .slice(0, mentionsMatchIndex) - .reduce((delta, prevMentionMatch) => { - return delta + prevMentionMatch[0].length - }, 0) - - try { - const proof = await NodeActions.UsernameProof.getUsernameProof(client, { - name: mention.slice(1), - }) - - mentions.push({ - fid: proof.fid, - position, - }) - // @TODO: better error narrowing - } catch {} - } - - for (const embedMatch of embedsMatches) { - const url = embedMatch[0] - - // @TODO: supercast and other urls that resolve to castId embed - - // Need to refine the url for specific warpcast format since it can have ).( or other symbols at the end - const refinedWarpcastCastUrl = url.match( - /https:\/\/warpcast\.com\/\S+\/0x[0-9a-f]{8,}/i, - )?.[0] - - if (refinedWarpcastCastUrl) { - const castId = await Actions_Warpcast_getCastIdFromUrl( - client, - { url: refinedWarpcastCastUrl }, - options, - ) - embeds.push({ type: 'cast', ...castId }) - } else - embeds.push({ - type: 'url', - url: url, - }) - } - - let strippedText = parameters.text - // if the last embed was at the end of the cast we strip it just like warpcast does - if ( - embedsMatches.length !== 0 && - embedsMatches[embedsMatches.length - 1].index + - embedsMatches[embedsMatches.length - 1][0].length === - parameters.text.length - ) { - strippedText = strippedText.slice( - 0, - embedsMatches[embedsMatches.length - 1].index, - ) - } - - for (const mention of mentionsMatches.reverse()) { - strippedText = `${strippedText.slice(0, mention.index)}${strippedText.slice(mention.index + mention[0].length)}` - } - - return { - text: { - value: strippedText, - embeds: [...embeds, ...(parameters.embeds ?? [])], - mentions, - }, - isLong: strippedText.length > 320, - } -} - -Actions_Cast_fromString.parseError = (error: unknown) => - error as Actions_Cast_fromString.ErrorType diff --git a/src/Internal/Actions/Cast/get.ts b/src/Internal/Actions/Cast/get.ts deleted file mode 100644 index f8793a9..0000000 --- a/src/Internal/Actions/Cast/get.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Types } from 'ox' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Cast_toString } from './toString.js' - -export declare namespace Actions_Cast_get { - type ParametersType = NodeActions.Cast.getCast.ParametersType - type ReturnType = NodeTypes.Cast & { - recasts: NodeTypes.Reaction[] - likes: NodeTypes.Reaction[] - text: { - unwrapped: string - } - } - type ErrorType = NodeActions.Cast.getCast.ErrorType | GlobalErrorType -} -export async function Actions_Cast_get( - client: Client, - parameters: Actions_Cast_get.ParametersType, - options?: CallOptions, -): Promise { - const cast = await NodeActions.Cast.getCast(client, parameters, options) - - const reactions = await (async () => { - const reactions: NodeTypes.Reaction[] = [] - let reactionsPageToken: Types.Hex | null = null - do { - const { nextPageToken, messages } = - await NodeActions.Reaction.getReactionsByCast(client, { - ...parameters, - pageToken: reactionsPageToken ? reactionsPageToken : undefined, - }) - reactionsPageToken = nextPageToken as any - reactions.push(...messages) - } while (reactionsPageToken) - return reactions - })() - - const likes = reactions.filter((reaction) => reaction.type === 'like') - const recasts = reactions.filter((reaction) => reaction.type === 'recast') - - return { - ...cast, - text: { - ...cast.text, - unwrapped: await Actions_Cast_toString(client, cast), - }, - likes, - recasts, - } -} - -Actions_Cast_get.parseError = (error: unknown) => - error as Actions_Cast_get.ErrorType diff --git a/src/Internal/Actions/Cast/toString.ts b/src/Internal/Actions/Cast/toString.ts deleted file mode 100644 index 36126c6..0000000 --- a/src/Internal/Actions/Cast/toString.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' - -export declare namespace Actions_Cast_toString { - type ParametersType = NodeTypes.Cast - type ReturnType = string - type ErrorType = GlobalErrorType -} -export async function Actions_Cast_toString( - client: Client, - cast: Actions_Cast_toString.ParametersType, -): Promise { - const unwrappedText = await (async () => { - let text = cast.text.value - if (!cast.text.mentions) return text - for (const mention of cast.text.mentions.reverse()) { - const mentionUsername = await NodeActions.UserData.getUserDataUsername( - client, - { fid: mention.fid }, - ) - text = `${text.slice(0, mention.position)}@${mentionUsername}${text.slice(mention.position)}` - } - return text - })() - - return unwrappedText -} - -Actions_Cast_toString.parseError = (error: unknown) => - error as Actions_Cast_toString.ErrorType diff --git a/src/Internal/Actions/Follow/create.ts b/src/Internal/Actions/Follow/create.ts deleted file mode 100644 index 8c9f821..0000000 --- a/src/Internal/Actions/Follow/create.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { LinkAdd_toMessageProtobuf } from '../../../Node/Internal/LinkAdd/toMessageProtobuf.js' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Account } from '../../Account/types.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' - -export declare namespace Actions_Follow_create { - type ParametersType = { - follow: Omit - account: Account - } - type ReturnType = NodeTypes.Message - type ErrorType = GlobalErrorType -} -export async function Actions_Follow_create( - client: Client, - parameters: Actions_Follow_create.ParametersType, - options?: CallOptions, -): Promise { - const message = LinkAdd_toMessageProtobuf({ - link: { - type: 'follow', - ...parameters.follow, - fid: parameters.account.fid, - timestamp: Math.floor(Date.now() / 1000), - }, - privateKey: parameters.account.privateKey, - }) - return NodeActions.Submit.submitMessage(client, message, options) -} - -Actions_Follow_create.parseError = (error: unknown) => - error as Actions_Follow_create.ErrorType diff --git a/src/Internal/Actions/Follow/createByUsername.ts b/src/Internal/Actions/Follow/createByUsername.ts deleted file mode 100644 index ea255c5..0000000 --- a/src/Internal/Actions/Follow/createByUsername.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { Actions as NodeActions } from '../../../Node/index.js' -import type { Account } from '../../Account/types.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Follow_create } from './create.js' - -export declare namespace Actions_Follow_createByUsername { - type ParametersType = { - follow: Omit< - Actions_Follow_create.ParametersType['follow'], - 'targetFid' - > & { username: string } - - account: Account - } - type ReturnType = Actions_Follow_create.ReturnType - type ErrorType = Actions_Follow_create.ErrorType | GlobalErrorType -} -export async function Actions_Follow_createByUsername( - client: Client, - parameters: Actions_Follow_createByUsername.ParametersType, - options?: CallOptions, -): Promise { - const { fid } = await NodeActions.UsernameProof.getUsernameProof(client, { - name: parameters.follow.username, - }) - return Actions_Follow_create( - client, - { - follow: { ...parameters.follow, targetFid: fid }, - account: parameters.account, - }, - options, - ) -} - -Actions_Follow_createByUsername.parseError = (error: unknown) => - error as Actions_Follow_createByUsername.ErrorType diff --git a/src/Internal/Actions/Like/create.ts b/src/Internal/Actions/Like/create.ts deleted file mode 100644 index 3276820..0000000 --- a/src/Internal/Actions/Like/create.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { ReactionAdd_toMessageProtobuf } from '../../../Node/Internal/ReactionAdd/toMessageProtobuf.js' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Account } from '../../Account/types.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' - -export declare namespace Actions_Like_create { - type ParametersType = { - like: Omit, 'type'> - account: Account - } - type ReturnType = NodeTypes.Message - type ErrorType = GlobalErrorType -} -export async function Actions_Like_create( - client: Client, - parameters: Actions_Like_create.ParametersType, - options?: CallOptions, -): Promise { - parameters.like - const message = ReactionAdd_toMessageProtobuf({ - reaction: { - type: 'like', - target: { - type: 'cast', - ...parameters.like, - }, - fid: parameters.account.fid, - timestamp: Math.floor(Date.now() / 1000), - }, - privateKey: parameters.account.privateKey, - }) - return NodeActions.Submit.submitMessage(client, message, options) -} - -Actions_Like_create.parseError = (error: unknown) => - error as Actions_Like_create.ErrorType diff --git a/src/Internal/Actions/Recast/create.ts b/src/Internal/Actions/Recast/create.ts deleted file mode 100644 index 8df27c6..0000000 --- a/src/Internal/Actions/Recast/create.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { ReactionAdd_toMessageProtobuf } from '../../../Node/Internal/ReactionAdd/toMessageProtobuf.js' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Account } from '../../Account/types.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' - -export declare namespace Actions_Recast_create { - type ParametersType = { - recast: Omit, 'type'> - account: Account - } - type ReturnType = NodeTypes.Message - type ErrorType = GlobalErrorType -} -export async function Actions_Recast_create( - client: Client, - parameters: Actions_Recast_create.ParametersType, - options?: CallOptions, -): Promise { - parameters.recast - const message = ReactionAdd_toMessageProtobuf({ - reaction: { - type: 'recast', - target: { - type: 'cast', - ...parameters.recast, - }, - fid: parameters.account.fid, - timestamp: Math.floor(Date.now() / 1000), - }, - privateKey: parameters.account.privateKey, - }) - return NodeActions.Submit.submitMessage(client, message, options) -} - -Actions_Recast_create.parseError = (error: unknown) => - error as Actions_Recast_create.ErrorType diff --git a/src/Internal/Actions/Watch/watchCasts.ts b/src/Internal/Actions/Watch/watchCasts.ts deleted file mode 100644 index 2f01bd0..0000000 --- a/src/Internal/Actions/Watch/watchCasts.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' - -export declare namespace Actions_Watch_watchCasts { - type ReturnType = AsyncGenerator - type ErrorType = NodeActions.Cast.getCast.ErrorType | GlobalErrorType -} -export async function* Actions_Watch_watchCasts( - client: Client, - options?: CallOptions, -): Actions_Watch_watchCasts.ReturnType { - for await (const event of NodeActions.Event.subscribe( - client, - { - eventTypes: ['mergeMessage'], - }, - options, - )) { - if (event.message === undefined || event.message.type !== 'castAdd') - continue - yield event.message.data - } -} - -Actions_Watch_watchCasts.parseError = (error: unknown) => - error as Actions_Watch_watchCasts.ErrorType diff --git a/src/Internal/Actions/Watch/watchCastsCompliantToRegexp.ts b/src/Internal/Actions/Watch/watchCastsCompliantToRegexp.ts deleted file mode 100644 index 7bee189..0000000 --- a/src/Internal/Actions/Watch/watchCastsCompliantToRegexp.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Cast_toString } from '../Cast/toString.js' -import { Actions_Watch_watchCasts } from './watchCasts.js' - -export declare namespace Actions_Watch_watchCastsCompliantToRegexp { - type ParametersType = { regexp: RegExp } - type ReturnType = Actions_Watch_watchCasts.ReturnType - type ErrorType = Actions_Watch_watchCasts.ErrorType | GlobalErrorType -} -export async function* Actions_Watch_watchCastsCompliantToRegexp( - client: Client, - parameters: Actions_Watch_watchCastsCompliantToRegexp.ParametersType, - options?: CallOptions, -): Actions_Watch_watchCastsCompliantToRegexp.ReturnType { - for await (const cast of Actions_Watch_watchCasts(client, options)) { - if (parameters.regexp.test(await Actions_Cast_toString(client, cast))) - yield cast - } -} - -Actions_Watch_watchCastsCompliantToRegexp.parseError = (error: unknown) => - error as Actions_Watch_watchCastsCompliantToRegexp.ErrorType diff --git a/src/Internal/Actions/Watch/watchCastsMentioningFid.ts b/src/Internal/Actions/Watch/watchCastsMentioningFid.ts deleted file mode 100644 index 272b2db..0000000 --- a/src/Internal/Actions/Watch/watchCastsMentioningFid.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Watch_watchCasts } from './watchCasts.js' - -export declare namespace Actions_Watch_watchCastsMentioningFid { - type ParametersType = { fid: bigint } - type ReturnType = Actions_Watch_watchCasts.ReturnType - type ErrorType = Actions_Watch_watchCasts.ErrorType | GlobalErrorType -} -export async function* Actions_Watch_watchCastsMentioningFid( - client: Client, - parameters: Actions_Watch_watchCastsMentioningFid.ParametersType, - options?: CallOptions, -): Actions_Watch_watchCastsMentioningFid.ReturnType { - for await (const cast of Actions_Watch_watchCasts(client, options)) { - if (!cast.text.mentions) continue - if (cast.text.mentions.some((mention) => mention.fid === parameters.fid)) - yield cast - } -} - -Actions_Watch_watchCastsMentioningFid.parseError = (error: unknown) => - error as Actions_Watch_watchCastsMentioningFid.ErrorType diff --git a/src/Internal/Actions/Watch/watchCastsMentioningUsername.ts b/src/Internal/Actions/Watch/watchCastsMentioningUsername.ts deleted file mode 100644 index 86f3c08..0000000 --- a/src/Internal/Actions/Watch/watchCastsMentioningUsername.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { Actions as NodeActions } from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' -import { Actions_Watch_watchCastsMentioningFid } from './watchCastsMentioningFid.js' - -export declare namespace Actions_Watch_watchCastsMentioningUsername { - type ParametersType = { username: string } - type ReturnType = Actions_Watch_watchCastsMentioningFid.ReturnType - type ErrorType = - | Actions_Watch_watchCastsMentioningFid.ErrorType - | GlobalErrorType -} -export async function* Actions_Watch_watchCastsMentioningUsername( - client: Client, - parameters: Actions_Watch_watchCastsMentioningUsername.ParametersType, - options?: CallOptions, -): Actions_Watch_watchCastsMentioningUsername.ReturnType { - const { fid } = await NodeActions.UsernameProof.getUsernameProof( - client, - { name: parameters.username }, - options, - ) - - for await (const cast of Actions_Watch_watchCastsMentioningFid( - client, - { fid }, - options, - )) { - yield cast - } -} - -Actions_Watch_watchCastsMentioningUsername.parseError = (error: unknown) => - error as Actions_Watch_watchCastsMentioningUsername.ErrorType diff --git a/src/Internal/Cast/unwrapText.ts b/src/Internal/Cast/unwrapText.ts deleted file mode 100644 index 6bd3b16..0000000 --- a/src/Internal/Cast/unwrapText.ts +++ /dev/null @@ -1 +0,0 @@ -export function Cast_unwrapText() {} diff --git a/src/Internal/Client/create.ts b/src/Internal/Client/create.ts deleted file mode 100644 index 552c1c7..0000000 --- a/src/Internal/Client/create.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - type Transport, - createClient as connectRpc_createClient, -} from '@connectrpc/connect' -import { HubService } from '../../Node/Internal/Protobufs/rpc_pb.js' -import type { GlobalErrorType } from '../Errors/error.js' -import type { Client } from './types.js' - -export function Client_create(transport: Transport): Client { - const connectRpcClient = connectRpc_createClient(HubService, transport) - - return { - connectRpcClient, - transport, - } -} - -export declare namespace Client_create { - type ErrorType = GlobalErrorType -} - -Client_create.parseError = (error: unknown) => error as Client_create.ErrorType diff --git a/src/Internal/Client/types.ts b/src/Internal/Client/types.ts deleted file mode 100644 index 5f6daf2..0000000 --- a/src/Internal/Client/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { - Transport, - Client as connectRpc_Client, -} from '@connectrpc/connect' -import type { HubService } from '../../Node/Internal/Protobufs/rpc_pb.js' - -export type Client = { - connectRpcClient: connectRpc_Client - /** The gRPC transport */ - transport: Transport -} diff --git a/src/Internal/Errors/utils.ts b/src/Internal/Errors/utils.ts deleted file mode 100644 index 6715d39..0000000 --- a/src/Internal/Errors/utils.ts +++ /dev/null @@ -1 +0,0 @@ -export type ErrorType = Error & { name: name } diff --git a/src/Internal/Errors/version.ts b/src/Internal/Errors/version.ts deleted file mode 100644 index d5a5614..0000000 --- a/src/Internal/Errors/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const version = '0.0.0' diff --git a/src/Internal/Transport/connectNode.ts b/src/Internal/Transport/connectNode.ts deleted file mode 100644 index af87220..0000000 --- a/src/Internal/Transport/connectNode.ts +++ /dev/null @@ -1 +0,0 @@ -export { createConnectTransport as Transport_connectNode } from '@connectrpc/connect-node' diff --git a/src/Internal/Transport/connectWeb.ts b/src/Internal/Transport/connectWeb.ts deleted file mode 100644 index 2b158fc..0000000 --- a/src/Internal/Transport/connectWeb.ts +++ /dev/null @@ -1 +0,0 @@ -export { createConnectTransport as Transport_connectWeb } from '@connectrpc/connect-web' diff --git a/src/Internal/Transport/grpcNode.ts b/src/Internal/Transport/grpcNode.ts deleted file mode 100644 index d827b82..0000000 --- a/src/Internal/Transport/grpcNode.ts +++ /dev/null @@ -1 +0,0 @@ -export { createGrpcTransport as Transport_grpcNode } from '@connectrpc/connect-node' diff --git a/src/Internal/Transport/grpcWeb.ts b/src/Internal/Transport/grpcWeb.ts deleted file mode 100644 index c38b741..0000000 --- a/src/Internal/Transport/grpcWeb.ts +++ /dev/null @@ -1 +0,0 @@ -export { createGrpcWebTransport as Transport_grpcWeb } from '@connectrpc/connect-web' diff --git a/src/Node/Actions.ts b/src/Node/Actions.ts deleted file mode 100644 index 5e78742..0000000 --- a/src/Node/Actions.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * as Cast from './Actions/Cast.js' -export * as Event from './Actions/Event.js' -export * as Link from './Actions/Link.js' -export * as OnChainEvents from './Actions/OnChainEvents.js' -export * as Reaction from './Actions/Reaction.js' -export * as Submit from './Actions/Submit.js' -export * as Sync from './Actions/Sync.js' -export * as UserData from './Actions/UserData.js' -export * as UsernameProof from './Actions/UsernameProof.js' -export * as Verification from './Actions/Verification.js' diff --git a/src/Node/Actions/Cast.ts b/src/Node/Actions/Cast.ts deleted file mode 100644 index af0e7a0..0000000 --- a/src/Node/Actions/Cast.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { Actions_Cast_getCast as getCast } from '../Internal/Actions/Cast/getCast.js' -export { Actions_Cast_getCastsByFid as getCastsByFid } from '../Internal/Actions/Cast/getCastsByFid.js' -export { Actions_Cast_getCastsByParent as getCastsByParent } from '../Internal/Actions/Cast/getCastsByParent.js' -export { Actions_Cast_getCastsByMention as getCastsByMention } from '../Internal/Actions/Cast/getCastsByMention.js' -export { Actions_Cast_getAllCastMessagesByFid as getAllCastMessagesByFid } from '../Internal/Actions/Cast/getAllCastMessagesByFid.js' diff --git a/src/Node/Actions/Event.ts b/src/Node/Actions/Event.ts deleted file mode 100644 index d621f33..0000000 --- a/src/Node/Actions/Event.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Actions_Event_getEvent as getEvent } from '../Internal/Actions/Event/getEvent.js' -export { Actions_Event_subscribe as subscribe } from '../Internal/Actions/Event/subscribe.js' diff --git a/src/Node/Actions/Link.ts b/src/Node/Actions/Link.ts deleted file mode 100644 index f2f9e72..0000000 --- a/src/Node/Actions/Link.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { Actions_Link_getLink as getLink } from '../Internal/Actions/Link/getLink.js' -export { Actions_Link_getLinksByFid as getLinksByFid } from '../Internal/Actions/Link/getLinksByFid.js' -export { Actions_Link_getLinksByTarget as getLinksByTarget } from '../Internal/Actions/Link/getLinksByTarget.js' -export { Actions_Link_getLinkCompactStateMessageByFid as getLinkCompactStateMessageByFid } from '../Internal/Actions/Link/getLinkCompactStateMessageByFid.js' -export { Actions_Link_getAllLinkMessagesByFid as getAllLinkMessagesByFid } from '../Internal/Actions/Link/getAllLinkMessagesByFid.js' diff --git a/src/Node/Actions/OnChainEvents.ts b/src/Node/Actions/OnChainEvents.ts deleted file mode 100644 index 0a5fb54..0000000 --- a/src/Node/Actions/OnChainEvents.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { Actions_OnChainEvents_getOnChainEvents as getOnChainEvents } from '../Internal/Actions/OnChainEvents/getOnChainEvents.js' -export { Actions_OnChainEvents_getOnChainSigner as getOnChainSigner } from '../Internal/Actions/OnChainEvents/getOnChainSigner.js' -export { Actions_OnChainEvents_getOnChainSignersByFid as getOnChainSignersByFid } from '../Internal/Actions/OnChainEvents/getOnChainSignersByFid.js' -export { Actions_OnChainEvents_getFids as getFids } from '../Internal/Actions/OnChainEvents/getFids.js' -export { Actions_OnChainEvents_getIdRegistryOnChainEvent as getIdRegistryOnChainEvent } from '../Internal/Actions/OnChainEvents/getIdRegistryOnChainEvent.js' -export { Actions_OnChainEvents_getIdRegistryOnChainEventByAddress as getIdRegistryOnChainEventByAddress } from '../Internal/Actions/OnChainEvents/getIdRegistryOnChainEventByAddress.js' -export { Actions_OnChainEvents_getCurrentStorageLimitsByFid as getCurrentStorageLimitsByFid } from '../Internal/Actions/OnChainEvents/getCurrentStorageLimitsByFid.js' diff --git a/src/Node/Actions/Reaction.ts b/src/Node/Actions/Reaction.ts deleted file mode 100644 index 28d3508..0000000 --- a/src/Node/Actions/Reaction.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { Actions_Reaction_getReaction as getReaction } from '../Internal/Actions/Reaction/getReaction.js' -export { Actions_Reaction_getReactionsByFid as getReactionsByFid } from '../Internal/Actions/Reaction/getReactionsByFid.js' -export { Actions_Reaction_getReactionsByCast as getReactionsByCast } from '../Internal/Actions/Reaction/getReactionsByCast.js' -export { Actions_Reaction_getReactionsByTarget as getReactionsByTarget } from '../Internal/Actions/Reaction/getReactionsByTarget.js' -export { Actions_Reaction_getAllReactionMessagesByFid as getAllReactionMessagesByFid } from '../Internal/Actions/Reaction/getAllReactionMessagesByFid.js' diff --git a/src/Node/Actions/Submit.ts b/src/Node/Actions/Submit.ts deleted file mode 100644 index 75b030e..0000000 --- a/src/Node/Actions/Submit.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Actions_Submit_submitMessage as submitMessage } from '../Internal/Actions/Submit/submitMessage.js' -export { Actions_Submit_submitBulkMessages as submitBulkMessages } from '../Internal/Actions/Submit/submitBulkMessages.js' diff --git a/src/Node/Actions/Sync.ts b/src/Node/Actions/Sync.ts deleted file mode 100644 index c552d3a..0000000 --- a/src/Node/Actions/Sync.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { Actions_Sync_getAllMessagesBySyncIds as getAllMessagesBySyncIds } from '../Internal/Actions/Sync/getAllMessagesBySyncIds.js' -export { Actions_Sync_getAllSyncIdsByPrefix as getAllSyncIdsByPrefix } from '../Internal/Actions/Sync/getAllSyncIdsByPrefix.js' -export { Actions_Sync_getSyncMetadataByPrefix as getSyncMetadataByPrefix } from '../Internal/Actions/Sync/getSyncMetadataByPrefix.js' -export { Actions_Sync_getSyncSnapshotByPrefix as getSyncSnapshotByPrefix } from '../Internal/Actions/Sync/getSyncSnapshotByPrefix.js' -export { Actions_Sync_getSyncStatus as getSyncStatus } from '../Internal/Actions/Sync/getSyncStatus.js' -export { Actions_Sync_getInfo as getInfo } from '../Internal/Actions/Sync/getInfo.js' diff --git a/src/Node/Actions/UserData.ts b/src/Node/Actions/UserData.ts deleted file mode 100644 index 0034339..0000000 --- a/src/Node/Actions/UserData.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { Actions_UserData_getAllUserDataMessagesByFid as getAllUserDataMessagesByFid } from '../Internal/Actions/UserData/getAllUserDataMessagesByFid.js' -export { Actions_UserData_getUserData as getUserData } from '../Internal/Actions/UserData/getUserData.js' -export { Actions_UserData_getUserDataPfp as getUserDataPfp } from '../Internal/Actions/UserData/getUserDataPfp.js' -export { Actions_UserData_getUserDataDisplay as getUserDataDisplay } from '../Internal/Actions/UserData/getUserDataDisplay.js' -export { Actions_UserData_getUserDataBio as getUserDataBio } from '../Internal/Actions/UserData/getUserDataBio.js' -export { Actions_UserData_getUserDataUrl as getUserDataUrl } from '../Internal/Actions/UserData/getUserDataUrl.js' -export { Actions_UserData_getUserDataUsername as getUserDataUsername } from '../Internal/Actions/UserData/getUserDataUsername.js' -export { Actions_UserData_getUserDataLocation as getUserDataLocation } from '../Internal/Actions/UserData/getUserDataLocation.js' -export { Actions_UserData_getUserDataByFid as getUserDataByFid } from '../Internal/Actions/UserData/getUserDataByFid.js' diff --git a/src/Node/Actions/UsernameProof.ts b/src/Node/Actions/UsernameProof.ts deleted file mode 100644 index fd31459..0000000 --- a/src/Node/Actions/UsernameProof.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Actions_UsernameProof_getUsernameProof as getUsernameProof } from '../Internal/Actions/UsernameProof/getUsernameProof.js' -export { Actions_UsernameProof_getUserNameProofsByFid as getUserNameProofsByFid } from '../Internal/Actions/UsernameProof/getUserNameProofsByFid.js' diff --git a/src/Node/Actions/Verification.ts b/src/Node/Actions/Verification.ts deleted file mode 100644 index 9cd1442..0000000 --- a/src/Node/Actions/Verification.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { Actions_Verification_getVerification as getVerification } from '../Internal/Actions/Verification/getVerification.js' -export { Actions_Verification_getVerificationsByFid as getVerificationsByFid } from '../Internal/Actions/Verification/getVerificationsByFid.js' -export { Actions_Verification_getAllVerificationMessagesByFid as getAllVerificationMessagesByFid } from '../Internal/Actions/Verification/getAllVerificationMessagesByFid.js' diff --git a/src/Node/Actions/package.json b/src/Node/Actions/package.json deleted file mode 100644 index b2e0d55..0000000 --- a/src/Node/Actions/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "module", - "types": "../_types/Actions.d.ts", - "module": "../_esm/Actions.js", - "main": "../_cjs/Actions.js" -} diff --git a/src/Node/Constants.ts b/src/Node/Constants.ts deleted file mode 100644 index f734a21..0000000 --- a/src/Node/Constants.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Internal/Constants.js' diff --git a/src/Node/Internal/Actions/Cast/getAllCastMessagesByFid.ts b/src/Node/Internal/Actions/Cast/getAllCastMessagesByFid.ts deleted file mode 100644 index b03de87..0000000 --- a/src/Node/Internal/Actions/Cast/getAllCastMessagesByFid.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { Cast } from '../../Cast/types.js' -import { CastAdd_fromMessageProtobuf } from '../../CastAdd/fromMessageProtobuf.js' -import { CastRemove_fromMessageProtobuf } from '../../CastRemove/fromMessageProtobuf.js' -import type { CastRemove } from '../../CastRemove/types.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { MessageType } from '../../Protobufs/message_pb.js' - -export declare namespace Actions_Cast_getAllCastMessagesByFid { - type ParametersType = { - fid: bigint - } & Pagination - type ReturnType = { - messages: ( - | { type: 'casted'; cast: Cast } - | { type: 'removed'; cast: CastRemove } - )[] - nextPageToken: NextPageToken - } - type ErrorType = CastAdd_fromMessageProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_Cast_getAllCastMessagesByFid( - client: Client, - parameters: Actions_Cast_getAllCastMessagesByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllCastMessagesByFid( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - - return { - messages: message.messages.map((message) => { - if ( - message.data?.type === MessageType.CAST_REMOVE && - message.data.body.case === 'castRemoveBody' - ) - return { - type: 'removed' as const, - cast: CastRemove_fromMessageProtobuf(message), - } - return { type: 'casted', cast: CastAdd_fromMessageProtobuf(message) } - }), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} -Actions_Cast_getAllCastMessagesByFid.parseError = (error: unknown) => - error as Actions_Cast_getAllCastMessagesByFid.ErrorType diff --git a/src/Node/Internal/Actions/Cast/getCast.ts b/src/Node/Internal/Actions/Cast/getCast.ts deleted file mode 100644 index 91b8552..0000000 --- a/src/Node/Internal/Actions/Cast/getCast.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import { Hex } from 'ox' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { Cast } from '../../Cast/types.js' -import { CastAdd_fromMessageProtobuf } from '../../CastAdd/fromMessageProtobuf.js' -import type { CastId } from '../../CastId/types.js' - -export declare namespace Actions_Cast_getCast { - type ParametersType = CastId - type ReturnType = Cast - type ErrorType = CastAdd_fromMessageProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_Cast_getCast( - client: Client, - parameters: Actions_Cast_getCast.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getCast( - { fid: parameters.fid, hash: Hex.toBytes(parameters.hash) }, - options, - ) - - return CastAdd_fromMessageProtobuf(message) -} - -Actions_Cast_getCast.parseError = (error: unknown) => - error as Actions_Cast_getCast.ErrorType diff --git a/src/Node/Internal/Actions/Cast/getCastsByFid.ts b/src/Node/Internal/Actions/Cast/getCastsByFid.ts deleted file mode 100644 index c1f17bc..0000000 --- a/src/Node/Internal/Actions/Cast/getCastsByFid.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { Cast } from '../../Cast/types.js' -import { CastAdd_fromMessageProtobuf } from '../../CastAdd/fromMessageProtobuf.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { - NextPageToken, - PaginationWithTimestamps, -} from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' - -export declare namespace Actions_Cast_getCastsByFid { - type ParametersType = { - fid: bigint - } & PaginationWithTimestamps - type ReturnType = { - casts: Cast[] - nextPageToken: NextPageToken - } - type ErrorType = CastAdd_fromMessageProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_Cast_getCastsByFid( - client: Client, - parameters: Actions_Cast_getCastsByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getCastsByFid( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - casts: message.messages.map((message) => - CastAdd_fromMessageProtobuf(message), - ), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} -Actions_Cast_getCastsByFid.parseError = (error: unknown) => - error as Actions_Cast_getCastsByFid.ErrorType diff --git a/src/Node/Internal/Actions/Cast/getCastsByMention.ts b/src/Node/Internal/Actions/Cast/getCastsByMention.ts deleted file mode 100644 index d6ac6e7..0000000 --- a/src/Node/Internal/Actions/Cast/getCastsByMention.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { Cast } from '../../Cast/types.js' -import { CastAdd_fromMessageProtobuf } from '../../CastAdd/fromMessageProtobuf.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' - -export declare namespace Actions_Cast_getCastsByMention { - type ParametersType = { - fid: bigint - } & Pagination - type ReturnType = { - casts: Cast[] - nextPageToken: NextPageToken - } - type ErrorType = CastAdd_fromMessageProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_Cast_getCastsByMention( - client: Client, - parameters: Actions_Cast_getCastsByMention.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getCastsByMention( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - - return { - casts: message.messages.map((message) => - CastAdd_fromMessageProtobuf(message), - ), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} -Actions_Cast_getCastsByMention.parseError = (error: unknown) => - error as Actions_Cast_getCastsByMention.ErrorType diff --git a/src/Node/Internal/Actions/Cast/getCastsByParent.ts b/src/Node/Internal/Actions/Cast/getCastsByParent.ts deleted file mode 100644 index 04cf8e5..0000000 --- a/src/Node/Internal/Actions/Cast/getCastsByParent.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { Cast } from '../../Cast/types.js' -import { CastAdd_fromMessageProtobuf } from '../../CastAdd/fromMessageProtobuf.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { Parent_toProtobuf } from '../../Parent/toProtobuf.js' -import type { Parent } from '../../Parent/types.js' - -export declare namespace Actions_Cast_getCastsByParent { - type ParametersType = { - parent: Parent - } & Pagination - type ReturnType = { - casts: Cast[] - nextPageToken: NextPageToken - } - type ErrorType = - | CastAdd_fromMessageProtobuf.ErrorType - | Parent_toProtobuf.ErrorType - | GlobalErrorType -} -export async function Actions_Cast_getCastsByParent( - client: Client, - parameters: Actions_Cast_getCastsByParent.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getCastsByParent( - { - parent: Parent_toProtobuf(parameters.parent), - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - casts: message.messages.map((message) => - CastAdd_fromMessageProtobuf(message), - ), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} -Actions_Cast_getCastsByParent.parseError = (error: unknown) => - error as Actions_Cast_getCastsByParent.ErrorType diff --git a/src/Node/Internal/Actions/Event/getEvent.ts b/src/Node/Internal/Actions/Event/getEvent.ts deleted file mode 100644 index 5a0cd49..0000000 --- a/src/Node/Internal/Actions/Event/getEvent.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { HubEventSchema } from '../../Protobufs/hub_event_pb.js' -import { - type EventRequestJson, - EventRequestSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Event_getEvent { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Event_getEvent( - client: Client, - parameters: Actions_Event_getEvent.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getEvent( - fromJson(EventRequestSchema, parameters), - options, - ) - return toJson(HubEventSchema, message) -} - -Actions_Event_getEvent.parseError = (error: unknown) => - error as Actions_Event_getEvent.ErrorType diff --git a/src/Node/Internal/Actions/Event/subscribe.ts b/src/Node/Internal/Actions/Event/subscribe.ts deleted file mode 100644 index 912565d..0000000 --- a/src/Node/Internal/Actions/Event/subscribe.ts +++ /dev/null @@ -1,48 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { HubEvent_fromProtobuf } from '../../HubEvent/fromProtobuf.js' -import type { HubEvent } from '../../HubEvent/types.js' - -export declare namespace Actions_Event_subscribe { - type ParametersType = { - eventTypes: ('mergeMessage' | 'pruneMessage' | 'revokeMessage')[] - fromId?: bigint | undefined - totalShards?: bigint | undefined - shardIndex?: bigint | undefined - } - type ReturnType = AsyncGenerator - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function* Actions_Event_subscribe( - client: Client, - parameters: Actions_Event_subscribe.ParametersType, - options?: CallOptions, -): Actions_Event_subscribe.ReturnType { - const eventTypesNumbers = parameters.eventTypes.map((eventType) => { - if (eventType === 'mergeMessage') return 1 - if (eventType === 'pruneMessage') return 2 - if (eventType === 'revokeMessage') return 3 - if (eventType === 'mergeUsernameProof') return 6 - if (eventType === 'mergeOnChainEvent') return 9 - return 0 - }) - - for await (const message of client.connectRpcClient.subscribe( - { - eventTypes: eventTypesNumbers, - ...(parameters.fromId ? { fromId: parameters.fromId } : {}), - ...(parameters.totalShards - ? { totalShards: parameters.totalShards } - : {}), - ...(parameters.shardIndex ? { shardIndex: parameters.shardIndex } : {}), - }, - options, - )) { - yield HubEvent_fromProtobuf(message) - } -} - -Actions_Event_subscribe.parseError = (error: unknown) => - error as Actions_Event_subscribe.ErrorType diff --git a/src/Node/Internal/Actions/Link/getAllLinkMessagesByFid.ts b/src/Node/Internal/Actions/Link/getAllLinkMessagesByFid.ts deleted file mode 100644 index 048d6da..0000000 --- a/src/Node/Internal/Actions/Link/getAllLinkMessagesByFid.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Link_fromMessageProtobuf } from '../../Link/fromMessageProtobuf.js' -import type { Link } from '../../Link/types.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { - NextPageToken, - PaginationWithTimestamps, -} from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' - -export declare namespace Actions_Link_getAllLinkMessagesByFid { - type ParametersType = { sourceFid: bigint } & PaginationWithTimestamps - type ReturnType = { links: Link[]; nextPageToken: NextPageToken } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Link_getAllLinkMessagesByFid( - client: Client, - parameters: Actions_Link_getAllLinkMessagesByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllLinkMessagesByFid( - { fid: parameters.sourceFid, ...Pagination_unwrap(parameters) }, - options, - ) - return { - links: message.messages.map(Link_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Link_getAllLinkMessagesByFid.parseError = (error: unknown) => - error as Actions_Link_getAllLinkMessagesByFid.ErrorType diff --git a/src/Node/Internal/Actions/Link/getLink.ts b/src/Node/Internal/Actions/Link/getLink.ts deleted file mode 100644 index 4933048..0000000 --- a/src/Node/Internal/Actions/Link/getLink.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Link_fromMessageProtobuf } from '../../Link/fromMessageProtobuf.js' -import type { Link } from '../../Link/types.js' - -export declare namespace Actions_Link_getLink { - type ParametersType = { - sourceFid: bigint - targetFid: bigint - type: string - } - type ReturnType = Link - type ErrorType = Link_fromMessageProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_Link_getLink( - client: Client, - parameters: Actions_Link_getLink.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getLink( - { - linkType: parameters.type, - fid: parameters.sourceFid, - target: { - case: 'targetFid', - value: parameters.targetFid, - }, - }, - options, - ) - return Link_fromMessageProtobuf(message) -} - -Actions_Link_getLink.parseError = (error: unknown) => - error as Actions_Link_getLink.ErrorType diff --git a/src/Node/Internal/Actions/Link/getLinkCompactStateMessageByFid.ts b/src/Node/Internal/Actions/Link/getLinkCompactStateMessageByFid.ts deleted file mode 100644 index 2988132..0000000 --- a/src/Node/Internal/Actions/Link/getLinkCompactStateMessageByFid.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { LinkCompactState_fromMessageProtobuf } from '../../LinkCompactState/fromMessageProtobuf.js' -import type { LinkCompactState } from '../../LinkCompactState/types.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' - -export declare namespace Actions_Link_getLinkCompactStateMessageByFid { - type ParametersType = { - fid: bigint - } & Pagination - type ReturnType = { links: LinkCompactState[]; nextPageToken: NextPageToken } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Link_getLinkCompactStateMessageByFid( - client: Client, - parameters: Actions_Link_getLinkCompactStateMessageByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getLinkCompactStateMessageByFid( - { fid: parameters.fid, ...Pagination_unwrap(parameters) }, - options, - ) - return { - links: message.messages.map(LinkCompactState_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Link_getLinkCompactStateMessageByFid.parseError = (error: unknown) => - error as Actions_Link_getLinkCompactStateMessageByFid.ErrorType diff --git a/src/Node/Internal/Actions/Link/getLinksByFid.ts b/src/Node/Internal/Actions/Link/getLinksByFid.ts deleted file mode 100644 index ff75489..0000000 --- a/src/Node/Internal/Actions/Link/getLinksByFid.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Link_fromMessageProtobuf } from '../../Link/fromMessageProtobuf.js' -import type { Link } from '../../Link/types.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' - -export declare namespace Actions_Link_getLinksByFid { - type ParametersType = { - sourceFid: bigint - type: string - } & Pagination - type ReturnType = { links: Link[]; nextPageToken: NextPageToken } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Link_getLinksByFid( - client: Client, - parameters: Actions_Link_getLinksByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getLinksByFid( - { - fid: parameters.sourceFid, - linkType: parameters.type, - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - links: message.messages.map(Link_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Link_getLinksByFid.parseError = (error: unknown) => - error as Actions_Link_getLinksByFid.ErrorType diff --git a/src/Node/Internal/Actions/Link/getLinksByTarget.ts b/src/Node/Internal/Actions/Link/getLinksByTarget.ts deleted file mode 100644 index 01805e2..0000000 --- a/src/Node/Internal/Actions/Link/getLinksByTarget.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Link_fromMessageProtobuf } from '../../Link/fromMessageProtobuf.js' -import type { Link } from '../../Link/types.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' - -export declare namespace Actions_Link_getLinksByTarget { - type ParametersType = { - targetFid: bigint - type: string - } & Pagination - type ReturnType = { links: Link[]; nextPageToken: NextPageToken } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Link_getLinksByTarget( - client: Client, - parameters: Actions_Link_getLinksByTarget.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getLinksByTarget( - { - target: { case: 'targetFid', value: parameters.targetFid }, - linkType: parameters.type, - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - links: message.messages.map(Link_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Link_getLinksByTarget.parseError = (error: unknown) => - error as Actions_Link_getLinksByTarget.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getCurrentStorageLimitsByFid.ts b/src/Node/Internal/Actions/OnChainEvents/getCurrentStorageLimitsByFid.ts deleted file mode 100644 index e062ccc..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getCurrentStorageLimitsByFid.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type FidRequestJson, - FidRequestSchema, - StorageLimitsResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getCurrentStorageLimitsByFid { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getCurrentStorageLimitsByFid( - client: Client, - parameters: Actions_OnChainEvents_getCurrentStorageLimitsByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getCurrentStorageLimitsByFid( - fromJson(FidRequestSchema, parameters), - options, - ) - return toJson(StorageLimitsResponseSchema, message) -} - -Actions_OnChainEvents_getCurrentStorageLimitsByFid.parseError = ( - error: unknown, -) => error as Actions_OnChainEvents_getCurrentStorageLimitsByFid.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getFids.ts b/src/Node/Internal/Actions/OnChainEvents/getFids.ts deleted file mode 100644 index 3492fad..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getFids.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type FidsRequestJson, - FidsRequestSchema, - FidsResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getFids { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getFids( - client: Client, - parameters: Actions_OnChainEvents_getFids.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getFids( - fromJson(FidsRequestSchema, parameters), - options, - ) - return toJson(FidsResponseSchema, message) -} - -Actions_OnChainEvents_getFids.parseError = (error: unknown) => - error as Actions_OnChainEvents_getFids.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getIdRegistryOnChainEvent.ts b/src/Node/Internal/Actions/OnChainEvents/getIdRegistryOnChainEvent.ts deleted file mode 100644 index 1ee1e6e..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getIdRegistryOnChainEvent.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { OnChainEventSchema } from '../../Protobufs/onchain_event_pb.js' -import { - type FidRequestJson, - FidRequestSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getIdRegistryOnChainEvent { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getIdRegistryOnChainEvent( - client: Client, - parameters: Actions_OnChainEvents_getIdRegistryOnChainEvent.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getIdRegistryOnChainEvent( - fromJson(FidRequestSchema, parameters), - options, - ) - return toJson(OnChainEventSchema, message) -} - -Actions_OnChainEvents_getIdRegistryOnChainEvent.parseError = (error: unknown) => - error as Actions_OnChainEvents_getIdRegistryOnChainEvent.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getIdRegistryOnChainEventByAddress.ts b/src/Node/Internal/Actions/OnChainEvents/getIdRegistryOnChainEventByAddress.ts deleted file mode 100644 index 608b68f..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getIdRegistryOnChainEventByAddress.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { OnChainEventSchema } from '../../Protobufs/onchain_event_pb.js' -import { - type IdRegistryEventByAddressRequestJson, - IdRegistryEventByAddressRequestSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getIdRegistryOnChainEventByAddress { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getIdRegistryOnChainEventByAddress( - client: Client, - parameters: Actions_OnChainEvents_getIdRegistryOnChainEventByAddress.ParametersType, - options?: CallOptions, -): Promise { - const message = - await client.connectRpcClient.getIdRegistryOnChainEventByAddress( - fromJson(IdRegistryEventByAddressRequestSchema, parameters), - options, - ) - return toJson(OnChainEventSchema, message) -} - -Actions_OnChainEvents_getIdRegistryOnChainEventByAddress.parseError = ( - error: unknown, -) => error as Actions_OnChainEvents_getIdRegistryOnChainEventByAddress.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getOnChainEvents.ts b/src/Node/Internal/Actions/OnChainEvents/getOnChainEvents.ts deleted file mode 100644 index 8b55be3..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getOnChainEvents.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type OnChainEventRequestJson, - OnChainEventRequestSchema, - OnChainEventResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getOnChainEvents { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getOnChainEvents( - client: Client, - parameters: Actions_OnChainEvents_getOnChainEvents.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getOnChainEvents( - fromJson(OnChainEventRequestSchema, parameters), - options, - ) - return toJson(OnChainEventResponseSchema, message) -} - -Actions_OnChainEvents_getOnChainEvents.parseError = (error: unknown) => - error as Actions_OnChainEvents_getOnChainEvents.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getOnChainSigner.ts b/src/Node/Internal/Actions/OnChainEvents/getOnChainSigner.ts deleted file mode 100644 index 727bd81..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getOnChainSigner.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { OnChainEventSchema } from '../../Protobufs/onchain_event_pb.js' -import { - type SignerRequestJson, - SignerRequestSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getOnChainSigner { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getOnChainSigner( - client: Client, - parameters: Actions_OnChainEvents_getOnChainSigner.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getOnChainSigner( - fromJson(SignerRequestSchema, parameters), - options, - ) - return toJson(OnChainEventSchema, message) -} - -Actions_OnChainEvents_getOnChainSigner.parseError = (error: unknown) => - error as Actions_OnChainEvents_getOnChainSigner.ErrorType diff --git a/src/Node/Internal/Actions/OnChainEvents/getOnChainSignersByFid.ts b/src/Node/Internal/Actions/OnChainEvents/getOnChainSignersByFid.ts deleted file mode 100644 index a17b5b4..0000000 --- a/src/Node/Internal/Actions/OnChainEvents/getOnChainSignersByFid.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type FidRequestJson, - FidRequestSchema, - OnChainEventResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_OnChainEvents_getOnChainSignersByFid { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_OnChainEvents_getOnChainSignersByFid( - client: Client, - parameters: Actions_OnChainEvents_getOnChainSignersByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getOnChainSignersByFid( - fromJson(FidRequestSchema, parameters), - options, - ) - return toJson(OnChainEventResponseSchema, message) -} - -Actions_OnChainEvents_getOnChainSignersByFid.parseError = (error: unknown) => - error as Actions_OnChainEvents_getOnChainSignersByFid.ErrorType diff --git a/src/Node/Internal/Actions/Reaction/getAllReactionMessagesByFid.ts b/src/Node/Internal/Actions/Reaction/getAllReactionMessagesByFid.ts deleted file mode 100644 index 19c104d..0000000 --- a/src/Node/Internal/Actions/Reaction/getAllReactionMessagesByFid.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { Reaction_fromMessageProtobuf } from '../../Reaction/fromMessageProtobuf.js' -import type { Reaction } from '../../Reaction/types.js' - -export declare namespace Actions_Reaction_getAllReactionMessagesByFid { - type ParametersType = { - fid: bigint - } & Pagination - type ReturnType = { - messages: Reaction[] - nextPageToken: NextPageToken - } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Reaction_getAllReactionMessagesByFid( - client: Client, - parameters: Actions_Reaction_getAllReactionMessagesByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllReactionMessagesByFid( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - - return { - messages: message.messages.map(Reaction_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Reaction_getAllReactionMessagesByFid.parseError = (error: unknown) => - error as Actions_Reaction_getAllReactionMessagesByFid.ErrorType diff --git a/src/Node/Internal/Actions/Reaction/getReaction.ts b/src/Node/Internal/Actions/Reaction/getReaction.ts deleted file mode 100644 index 7e8d7b9..0000000 --- a/src/Node/Internal/Actions/Reaction/getReaction.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Reaction_fromMessageProtobuf } from '../../Reaction/fromMessageProtobuf.js' -import type { Reaction } from '../../Reaction/types.js' -import { ReactionTarget_toProtobuf } from '../../ReactionTarget/toProtobuf.js' -import type { ReactionTarget } from '../../ReactionTarget/types.js' -import { ReactionType_toProtobuf } from '../../ReactionType/toProtobuf.js' -import type { ReactionType } from '../../ReactionType/types.js' - -export declare namespace Actions_Reaction_getReaction { - type ParametersType = { - fid: bigint - reactionType: ReactionType - target: ReactionTarget - } - type ReturnType = Reaction - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Reaction_getReaction( - client: Client, - parameters: Actions_Reaction_getReaction.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getReaction( - { - fid: parameters.fid, - reactionType: ReactionType_toProtobuf(parameters.reactionType), - target: ReactionTarget_toProtobuf(parameters.target), - }, - options, - ) - return Reaction_fromMessageProtobuf(message) -} - -Actions_Reaction_getReaction.parseError = (error: unknown) => - error as Actions_Reaction_getReaction.ErrorType diff --git a/src/Node/Internal/Actions/Reaction/getReactionsByCast.ts b/src/Node/Internal/Actions/Reaction/getReactionsByCast.ts deleted file mode 100644 index 3da787c..0000000 --- a/src/Node/Internal/Actions/Reaction/getReactionsByCast.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { CastId } from '../../CastId/types.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { Reaction_fromMessageProtobuf } from '../../Reaction/fromMessageProtobuf.js' -import type { Reaction } from '../../Reaction/types.js' -import { ReactionTarget_toProtobuf } from '../../ReactionTarget/toProtobuf.js' - -export declare namespace Actions_Reaction_getReactionsByCast { - type ParametersType = CastId & Pagination - type ReturnType = { - messages: Reaction[] - nextPageToken: NextPageToken - } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Reaction_getReactionsByCast( - client: Client, - parameters: Actions_Reaction_getReactionsByCast.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getReactionsByCast( - { - target: ReactionTarget_toProtobuf({ type: 'cast', ...parameters }), - ...Pagination_unwrap(parameters), - }, - options, - ) - - return { - messages: message.messages.map(Reaction_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Reaction_getReactionsByCast.parseError = (error: unknown) => - error as Actions_Reaction_getReactionsByCast.ErrorType diff --git a/src/Node/Internal/Actions/Reaction/getReactionsByFid.ts b/src/Node/Internal/Actions/Reaction/getReactionsByFid.ts deleted file mode 100644 index 86e4cd0..0000000 --- a/src/Node/Internal/Actions/Reaction/getReactionsByFid.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { Reaction_fromMessageProtobuf } from '../../Reaction/fromMessageProtobuf.js' -import type { Reaction } from '../../Reaction/types.js' -import type { ReactionType } from '../../ReactionType/types.js' - -export declare namespace Actions_Reaction_getReactionsByFid { - type ParametersType = { - fid: bigint - type?: ReactionType - } & Pagination - type ReturnType = { - messages: Reaction[] - nextPageToken: NextPageToken - } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Reaction_getReactionsByFid( - client: Client, - parameters: Actions_Reaction_getReactionsByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getReactionsByFid( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - - return { - messages: message.messages.map(Reaction_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Reaction_getReactionsByFid.parseError = (error: unknown) => - error as Actions_Reaction_getReactionsByFid.ErrorType diff --git a/src/Node/Internal/Actions/Reaction/getReactionsByTarget.ts b/src/Node/Internal/Actions/Reaction/getReactionsByTarget.ts deleted file mode 100644 index fb3128a..0000000 --- a/src/Node/Internal/Actions/Reaction/getReactionsByTarget.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { Reaction_fromMessageProtobuf } from '../../Reaction/fromMessageProtobuf.js' -import type { Reaction } from '../../Reaction/types.js' -import { ReactionTarget_toProtobuf } from '../../ReactionTarget/toProtobuf.js' -import type { ReactionTarget } from '../../ReactionTarget/types.js' - -export declare namespace Actions_Reaction_getReactionsByTarget { - type ReturnType = { - messages: Reaction[] - nextPageToken: NextPageToken - } - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Reaction_getReactionsByTarget( - client: Client, - parameters: ReactionTarget & Pagination, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getReactionsByTarget( - { - ...ReactionTarget_toProtobuf(parameters), - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - messages: message.messages.map(Reaction_fromMessageProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_Reaction_getReactionsByTarget.parseError = (error: unknown) => - error as Actions_Reaction_getReactionsByTarget.ErrorType diff --git a/src/Node/Internal/Actions/Submit/submitBulkMessages.ts b/src/Node/Internal/Actions/Submit/submitBulkMessages.ts deleted file mode 100644 index 3cbd3d0..0000000 --- a/src/Node/Internal/Actions/Submit/submitBulkMessages.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type SubmitBulkMessagesRequestJson, - SubmitBulkMessagesRequestSchema, - SubmitBulkMessagesResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Submit_submitBulkMessages { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Submit_submitBulkMessages( - client: Client, - parameters: Actions_Submit_submitBulkMessages.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.submitBulkMessages( - fromJson(SubmitBulkMessagesRequestSchema, parameters), - options, - ) - return toJson(SubmitBulkMessagesResponseSchema, message) -} - -Actions_Submit_submitBulkMessages.parseError = (error: unknown) => - error as Actions_Submit_submitBulkMessages.ErrorType diff --git a/src/Node/Internal/Actions/Submit/submitMessage.ts b/src/Node/Internal/Actions/Submit/submitMessage.ts deleted file mode 100644 index 39455f6..0000000 --- a/src/Node/Internal/Actions/Submit/submitMessage.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Message_fromProtobuf } from '../../Message/fromProtobuf.js' -import type { Message } from '../../Message/types.js' -import type * as MessageProtobuf from '../../Protobufs/message_pb.js' - -export declare namespace Actions_Submit_submitMessage { - type ParametersType = MessageProtobuf.Message - type ReturnType = Message - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Submit_submitMessage( - client: Client, - parameters: Actions_Submit_submitMessage.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.submitMessage( - parameters, - options, - ) - return Message_fromProtobuf(message) -} - -Actions_Submit_submitMessage.parseError = (error: unknown) => - error as Actions_Submit_submitMessage.ErrorType diff --git a/src/Node/Internal/Actions/Sync/getAllMessagesBySyncIds.ts b/src/Node/Internal/Actions/Sync/getAllMessagesBySyncIds.ts deleted file mode 100644 index 247d4aa..0000000 --- a/src/Node/Internal/Actions/Sync/getAllMessagesBySyncIds.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - MessagesResponseSchema, - type SyncIdsJson, - SyncIdsSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Sync_getAllMessagesBySyncIds { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Sync_getAllMessagesBySyncIds( - client: Client, - parameters: Actions_Sync_getAllMessagesBySyncIds.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllMessagesBySyncIds( - fromJson(SyncIdsSchema, parameters), - options, - ) - return toJson(MessagesResponseSchema, message) -} - -Actions_Sync_getAllMessagesBySyncIds.parseError = (error: unknown) => - error as Actions_Sync_getAllMessagesBySyncIds.ErrorType diff --git a/src/Node/Internal/Actions/Sync/getAllSyncIdsByPrefix.ts b/src/Node/Internal/Actions/Sync/getAllSyncIdsByPrefix.ts deleted file mode 100644 index 60ce175..0000000 --- a/src/Node/Internal/Actions/Sync/getAllSyncIdsByPrefix.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - SyncIdsSchema, - type TrieNodePrefixJson, - TrieNodePrefixSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Sync_getAllSyncIdsByPrefix { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Sync_getAllSyncIdsByPrefix( - client: Client, - parameters: Actions_Sync_getAllSyncIdsByPrefix.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllSyncIdsByPrefix( - fromJson(TrieNodePrefixSchema, parameters), - options, - ) - return toJson(SyncIdsSchema, message) -} - -Actions_Sync_getAllSyncIdsByPrefix.parseError = (error: unknown) => - error as Actions_Sync_getAllSyncIdsByPrefix.ErrorType diff --git a/src/Node/Internal/Actions/Sync/getInfo.ts b/src/Node/Internal/Actions/Sync/getInfo.ts deleted file mode 100644 index 8b4fdb4..0000000 --- a/src/Node/Internal/Actions/Sync/getInfo.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type HubInfoRequestJson, - HubInfoRequestSchema, - HubInfoResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Sync_getInfo { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Sync_getInfo( - client: Client, - parameters: Actions_Sync_getInfo.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getInfo( - fromJson(HubInfoRequestSchema, parameters), - options, - ) - return toJson(HubInfoResponseSchema, message) -} - -Actions_Sync_getInfo.parseError = (error: unknown) => - error as Actions_Sync_getInfo.ErrorType diff --git a/src/Node/Internal/Actions/Sync/getSyncMetadataByPrefix.ts b/src/Node/Internal/Actions/Sync/getSyncMetadataByPrefix.ts deleted file mode 100644 index 8ce447c..0000000 --- a/src/Node/Internal/Actions/Sync/getSyncMetadataByPrefix.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - TrieNodeMetadataResponseSchema, - type TrieNodePrefixJson, - TrieNodePrefixSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Sync_getSyncMetadataByPrefix { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Sync_getSyncMetadataByPrefix( - client: Client, - parameters: Actions_Sync_getSyncMetadataByPrefix.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getSyncMetadataByPrefix( - fromJson(TrieNodePrefixSchema, parameters), - options, - ) - return toJson(TrieNodeMetadataResponseSchema, message) -} - -Actions_Sync_getSyncMetadataByPrefix.parseError = (error: unknown) => - error as Actions_Sync_getSyncMetadataByPrefix.ErrorType diff --git a/src/Node/Internal/Actions/Sync/getSyncSnapshotByPrefix.ts b/src/Node/Internal/Actions/Sync/getSyncSnapshotByPrefix.ts deleted file mode 100644 index db20658..0000000 --- a/src/Node/Internal/Actions/Sync/getSyncSnapshotByPrefix.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type TrieNodePrefixJson, - TrieNodePrefixSchema, - TrieNodeSnapshotResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Sync_getSyncSnapshotByPrefix { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Sync_getSyncSnapshotByPrefix( - client: Client, - parameters: Actions_Sync_getSyncSnapshotByPrefix.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getSyncSnapshotByPrefix( - fromJson(TrieNodePrefixSchema, parameters), - options, - ) - return toJson(TrieNodeSnapshotResponseSchema, message) -} - -Actions_Sync_getSyncSnapshotByPrefix.parseError = (error: unknown) => - error as Actions_Sync_getSyncSnapshotByPrefix.ErrorType diff --git a/src/Node/Internal/Actions/Sync/getSyncStatus.ts b/src/Node/Internal/Actions/Sync/getSyncStatus.ts deleted file mode 100644 index 4f4b261..0000000 --- a/src/Node/Internal/Actions/Sync/getSyncStatus.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type SyncStatusRequestJson, - SyncStatusRequestSchema, - SyncStatusResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Sync_getSyncStatus { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Sync_getSyncStatus( - client: Client, - parameters: Actions_Sync_getSyncStatus.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getSyncStatus( - fromJson(SyncStatusRequestSchema, parameters), - options, - ) - return toJson(SyncStatusResponseSchema, message) -} - -Actions_Sync_getSyncStatus.parseError = (error: unknown) => - error as Actions_Sync_getSyncStatus.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getAllUserDataMessagesByFid.ts b/src/Node/Internal/Actions/UserData/getAllUserDataMessagesByFid.ts deleted file mode 100644 index 0d83331..0000000 --- a/src/Node/Internal/Actions/UserData/getAllUserDataMessagesByFid.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { NextPageToken, Pagination } from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { UserData_fromProtobuf } from '../../UserData/fromProtobuf.js' -import type { UserData } from '../../UserData/types.js' - -export declare namespace Actions_UserData_getAllUserDataMessagesByFid { - type ParametersType = { - fid: bigint - } & Pagination - type ReturnType = { datas: UserData[]; nextPageToken: NextPageToken } - // @TODO: proper error handling - type ErrorType = UserData_fromProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_UserData_getAllUserDataMessagesByFid( - client: Client, - parameters: Actions_UserData_getAllUserDataMessagesByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllUserDataMessagesByFid( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - datas: message.messages.map(UserData_fromProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_UserData_getAllUserDataMessagesByFid.parseError = (error: unknown) => - error as Actions_UserData_getAllUserDataMessagesByFid.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserData.ts b/src/Node/Internal/Actions/UserData/getUserData.ts deleted file mode 100644 index 5fa3b71..0000000 --- a/src/Node/Internal/Actions/UserData/getUserData.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import type { UserDataType } from '../../Protobufs/message_pb.js' -import { UserData_fromProtobuf } from '../../UserData/fromProtobuf.js' -import type { UserData } from '../../UserData/types.js' - -export declare namespace Actions_UserData_getUserData { - type ParametersType = { - fid: bigint - userDataType: UserDataType - } - type ReturnType = UserData - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} - -export async function Actions_UserData_getUserData( - client: Client, - parameters: Actions_UserData_getUserData.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getUserData(parameters, options) - return UserData_fromProtobuf(message) -} - -Actions_UserData_getUserData.parseError = (error: unknown) => - error as Actions_UserData_getUserData.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataBio.ts b/src/Node/Internal/Actions/UserData/getUserDataBio.ts deleted file mode 100644 index 1feb7b7..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataBio.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { UserDataType } from '../../Protobufs/message_pb.js' -import { Actions_UserData_getUserData } from './getUserData.js' - -export declare namespace Actions_UserData_getUserDataBio { - type ParametersType = { fid: bigint } - type ReturnType = Actions_UserData_getUserData.ReturnType['value'] - // @TODO: proper error handling - type ErrorType = Actions_UserData_getUserData.ErrorType | GlobalErrorType -} - -export async function Actions_UserData_getUserDataBio( - client: Client, - parameters: Actions_UserData_getUserDataBio.ParametersType, - options?: CallOptions, -): Promise { - const data = await Actions_UserData_getUserData( - client, - { - ...parameters, - userDataType: UserDataType.BIO, - }, - options, - ) - return data.value -} - -Actions_UserData_getUserDataBio.parseError = (error: unknown) => - error as Actions_UserData_getUserDataBio.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataByFid.ts b/src/Node/Internal/Actions/UserData/getUserDataByFid.ts deleted file mode 100644 index 9c09825..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataByFid.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { Pagination_getPageToken } from '../../Pagination/getPageToken.js' -import type { - NextPageToken, - PaginationWithTimestamps, -} from '../../Pagination/types.js' -import { Pagination_unwrap } from '../../Pagination/unwrap.js' -import { UserData_fromProtobuf } from '../../UserData/fromProtobuf.js' -import type { UserData } from '../../UserData/types.js' - -export declare namespace Actions_UserData_getUserDataByFid { - type ParametersType = { - fid: bigint - } & PaginationWithTimestamps - type ReturnType = { datas: UserData[]; nextPageToken: NextPageToken } - type ErrorType = UserData_fromProtobuf.ErrorType | GlobalErrorType -} -export async function Actions_UserData_getUserDataByFid( - client: Client, - parameters: Actions_UserData_getUserDataByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getUserDataByFid( - { - fid: parameters.fid, - ...Pagination_unwrap(parameters), - }, - options, - ) - return { - datas: message.messages.map(UserData_fromProtobuf), - nextPageToken: Pagination_getPageToken(message.nextPageToken), - } -} - -Actions_UserData_getUserDataByFid.parseError = (error: unknown) => - error as Actions_UserData_getUserDataByFid.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataDisplay.ts b/src/Node/Internal/Actions/UserData/getUserDataDisplay.ts deleted file mode 100644 index 41ea9d6..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataDisplay.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { UserDataType } from '../../Protobufs/message_pb.js' -import { Actions_UserData_getUserData } from './getUserData.js' - -export declare namespace Actions_UserData_getUserDataDisplay { - type ParametersType = { fid: bigint } - type ReturnType = Actions_UserData_getUserData.ReturnType['value'] - type ErrorType = Actions_UserData_getUserData.ErrorType | GlobalErrorType -} - -export async function Actions_UserData_getUserDataDisplay( - client: Client, - parameters: Actions_UserData_getUserDataDisplay.ParametersType, - options?: CallOptions, -): Promise { - const data = await Actions_UserData_getUserData( - client, - { - ...parameters, - userDataType: UserDataType.DISPLAY, - }, - options, - ) - return data.value -} - -Actions_UserData_getUserDataDisplay.parseError = (error: unknown) => - error as Actions_UserData_getUserDataDisplay.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataLocation.ts b/src/Node/Internal/Actions/UserData/getUserDataLocation.ts deleted file mode 100644 index e1c2ee2..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataLocation.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { UserDataType } from '../../Protobufs/message_pb.js' -import { Actions_UserData_getUserData } from './getUserData.js' - -export declare namespace Actions_UserData_getUserDataLocation { - type ParametersType = { fid: bigint } - type ReturnType = Actions_UserData_getUserData.ReturnType['value'] - type ErrorType = Actions_UserData_getUserData.ErrorType | GlobalErrorType -} - -export async function Actions_UserData_getUserDataLocation( - client: Client, - parameters: Actions_UserData_getUserDataLocation.ParametersType, - options?: CallOptions, -): Promise { - const data = await Actions_UserData_getUserData( - client, - { - ...parameters, - userDataType: UserDataType.LOCATION, - }, - options, - ) - return data.value -} - -Actions_UserData_getUserDataLocation.parseError = (error: unknown) => - error as Actions_UserData_getUserDataLocation.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataPfp.ts b/src/Node/Internal/Actions/UserData/getUserDataPfp.ts deleted file mode 100644 index 2fa0f93..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataPfp.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { UserDataType } from '../../Protobufs/message_pb.js' -import { Actions_UserData_getUserData } from './getUserData.js' - -export declare namespace Actions_UserData_getUserDataPfp { - type ParametersType = { fid: bigint } - type ReturnType = Actions_UserData_getUserData.ReturnType['value'] - type ErrorType = Actions_UserData_getUserData.ErrorType | GlobalErrorType -} - -export async function Actions_UserData_getUserDataPfp( - client: Client, - parameters: Actions_UserData_getUserDataPfp.ParametersType, - options?: CallOptions, -): Promise { - const data = await Actions_UserData_getUserData( - client, - { - ...parameters, - userDataType: UserDataType.PFP, - }, - options, - ) - return data.value -} - -Actions_UserData_getUserDataPfp.parseError = (error: unknown) => - error as Actions_UserData_getUserDataPfp.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataUrl.ts b/src/Node/Internal/Actions/UserData/getUserDataUrl.ts deleted file mode 100644 index 307fbdd..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataUrl.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { UserDataType } from '../../Protobufs/message_pb.js' -import { Actions_UserData_getUserData } from './getUserData.js' - -export declare namespace Actions_UserData_getUserDataUrl { - type ParametersType = { fid: bigint } - type ReturnType = Actions_UserData_getUserData.ReturnType['value'] - type ErrorType = Actions_UserData_getUserData.ErrorType | GlobalErrorType -} - -export async function Actions_UserData_getUserDataUrl( - client: Client, - parameters: Actions_UserData_getUserDataUrl.ParametersType, - options?: CallOptions, -): Promise { - const data = await Actions_UserData_getUserData( - client, - { - ...parameters, - userDataType: UserDataType.URL, - }, - options, - ) - return data.value -} - -Actions_UserData_getUserDataUrl.parseError = (error: unknown) => - error as Actions_UserData_getUserDataUrl.ErrorType diff --git a/src/Node/Internal/Actions/UserData/getUserDataUsername.ts b/src/Node/Internal/Actions/UserData/getUserDataUsername.ts deleted file mode 100644 index 083b062..0000000 --- a/src/Node/Internal/Actions/UserData/getUserDataUsername.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { UserDataType } from '../../Protobufs/message_pb.js' -import { Actions_UserData_getUserData } from './getUserData.js' - -export declare namespace Actions_UserData_getUserDataUsername { - type ParametersType = { fid: bigint } - type ReturnType = Actions_UserData_getUserData.ReturnType['value'] - type ErrorType = Actions_UserData_getUserData.ErrorType | GlobalErrorType -} - -export async function Actions_UserData_getUserDataUsername( - client: Client, - parameters: Actions_UserData_getUserDataUsername.ParametersType, - options?: CallOptions, -): Promise { - const data = await Actions_UserData_getUserData( - client, - { - ...parameters, - userDataType: UserDataType.USERNAME, - }, - options, - ) - return data.value -} - -Actions_UserData_getUserDataUsername.parseError = (error: unknown) => - error as Actions_UserData_getUserDataUsername.ErrorType diff --git a/src/Node/Internal/Actions/UsernameProof/getUserNameProofsByFid.ts b/src/Node/Internal/Actions/UsernameProof/getUserNameProofsByFid.ts deleted file mode 100644 index d31c95e..0000000 --- a/src/Node/Internal/Actions/UsernameProof/getUserNameProofsByFid.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type FidRequestJson, - FidRequestSchema, - UsernameProofsResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_UsernameProof_getUserNameProofsByFid { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_UsernameProof_getUserNameProofsByFid( - client: Client, - parameters: Actions_UsernameProof_getUserNameProofsByFid.ParametersType, - options?: CallOptions, -): Promise { - const proofs = await client.connectRpcClient.getUserNameProofsByFid( - fromJson(FidRequestSchema, parameters), - options, - ) - return toJson(UsernameProofsResponseSchema, proofs) -} - -Actions_UsernameProof_getUserNameProofsByFid.parseError = (error: unknown) => - error as Actions_UsernameProof_getUserNameProofsByFid.ErrorType diff --git a/src/Node/Internal/Actions/UsernameProof/getUsernameProof.ts b/src/Node/Internal/Actions/UsernameProof/getUsernameProof.ts deleted file mode 100644 index 2c5b556..0000000 --- a/src/Node/Internal/Actions/UsernameProof/getUsernameProof.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import * as RequestResponseProtobuf from '../../Protobufs/request_response_pb.js' -import { UsernameProof_fromProtobuf } from '../../UsernameProof/fromProtobuf.js' -import type { UsernameProof } from '../../UsernameProof/types.js' - -export declare namespace Actions_UsernameProof_getUsernameProof { - type ParametersType = { name: string } - type ReturnType = Omit - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_UsernameProof_getUsernameProof( - client: Client, - parameters: Actions_UsernameProof_getUsernameProof.ParametersType, - options?: CallOptions, -): Promise { - const proof = await client.connectRpcClient.getUsernameProof( - create(RequestResponseProtobuf.UsernameProofRequestSchema, { - name: Uint8Array.from(Buffer.from(parameters.name)), - }), - options, - ) - return UsernameProof_fromProtobuf(proof) -} - -Actions_UsernameProof_getUsernameProof.parseError = (error: unknown) => - error as Actions_UsernameProof_getUsernameProof.ErrorType diff --git a/src/Node/Internal/Actions/Verification/getAllVerificationMessagesByFid.ts b/src/Node/Internal/Actions/Verification/getAllVerificationMessagesByFid.ts deleted file mode 100644 index 4bf2440..0000000 --- a/src/Node/Internal/Actions/Verification/getAllVerificationMessagesByFid.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type FidTimestampRequestJson, - FidTimestampRequestSchema, - MessagesResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Verification_getAllVerificationMessagesByFid { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Verification_getAllVerificationMessagesByFid( - client: Client, - parameters: Actions_Verification_getAllVerificationMessagesByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getAllVerificationMessagesByFid( - fromJson(FidTimestampRequestSchema, parameters), - options, - ) - return toJson(MessagesResponseSchema, message) -} - -Actions_Verification_getAllVerificationMessagesByFid.parseError = ( - error: unknown, -) => error as Actions_Verification_getAllVerificationMessagesByFid.ErrorType diff --git a/src/Node/Internal/Actions/Verification/getVerification.ts b/src/Node/Internal/Actions/Verification/getVerification.ts deleted file mode 100644 index 602c333..0000000 --- a/src/Node/Internal/Actions/Verification/getVerification.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { MessageSchema } from '../../Protobufs/message_pb.js' -import { - type VerificationRequestJson, - VerificationRequestSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Verification_getVerification { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Verification_getVerification( - client: Client, - parameters: Actions_Verification_getVerification.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getVerification( - fromJson(VerificationRequestSchema, parameters), - options, - ) - return toJson(MessageSchema, message) -} - -Actions_Verification_getVerification.parseError = (error: unknown) => - error as Actions_Verification_getVerification.ErrorType diff --git a/src/Node/Internal/Actions/Verification/getVerificationsByFid.ts b/src/Node/Internal/Actions/Verification/getVerificationsByFid.ts deleted file mode 100644 index 4ea2d1d..0000000 --- a/src/Node/Internal/Actions/Verification/getVerificationsByFid.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' -import type { CallOptions } from '@connectrpc/connect' -import type { Client } from '../../../../Internal/Client/types.js' -import type { GlobalErrorType } from '../../../../Internal/Errors/error.js' -import { - type FidRequestJson, - FidRequestSchema, - MessagesResponseSchema, -} from '../../Protobufs/request_response_pb.js' - -export declare namespace Actions_Verification_getVerificationsByFid { - type ParametersType = Required - type ReturnType = MessageJsonType - // @TODO: proper error handling - type ErrorType = GlobalErrorType -} -export async function Actions_Verification_getVerificationsByFid( - client: Client, - parameters: Actions_Verification_getVerificationsByFid.ParametersType, - options?: CallOptions, -): Promise { - const message = await client.connectRpcClient.getVerificationsByFid( - fromJson(FidRequestSchema, parameters), - options, - ) - return toJson(MessagesResponseSchema, message) -} - -Actions_Verification_getVerificationsByFid.parseError = (error: unknown) => - error as Actions_Verification_getVerificationsByFid.ErrorType diff --git a/src/Node/Internal/Cast/errors.ts b/src/Node/Internal/Cast/errors.ts deleted file mode 100644 index b95bad6..0000000 --- a/src/Node/Internal/Cast/errors.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseError } from 'ox/Errors' - -export class Cast_InvalidEmbedsError extends BaseError { - override readonly name = 'Cast.InvalidEmbedsError' - - constructor({ hash }: { hash: string }) { - super(`Embeds "${hash}" has undefined.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/Cast/fromProtobuf.ts b/src/Node/Internal/Cast/fromProtobuf.ts deleted file mode 100644 index da6ed73..0000000 --- a/src/Node/Internal/Cast/fromProtobuf.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import { Embed_fromProtobuf } from '../Embed/fromProtobuf.js' -import type { Embed } from '../Embed/types.js' -import type { Meta } from '../Meta/types.js' -import { Parent_fromProtobuf } from '../Parent/fromProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Cast_InvalidEmbedsError } from './errors.js' -import type { Cast } from './types.js' - -export function Cast_fromProtobuf( - parameters: Cast_fromProtobuf.ParametersType, -): Cast_fromProtobuf.ReturnType { - const isLong = parameters.body.type === MessageProtobuf.CastType.LONG_CAST - const mentions = (() => { - if (parameters.body.mentions.length === 0) return undefined - const mentions = [] - for (let i = 0; i < parameters.body.mentions.length; i++) { - mentions.push({ - fid: parameters.body.mentions[i], - position: parameters.body.mentionsPositions[i], - }) - } - return mentions - })() - - const embeds = (() => { - if (parameters.body.embeds.length === 0) return undefined - const embedsOrUndefineds = parameters.body.embeds.map(({ embed }) => - Embed_fromProtobuf(embed), - ) - if (embedsOrUndefineds.indexOf(undefined) !== -1) - throw new Cast_InvalidEmbedsError({ hash: parameters.meta.hash }) - return embedsOrUndefineds as Embed[] - })() - const parent = Parent_fromProtobuf(parameters.body.parent) - - return { - meta: parameters.meta, - isLong, - text: { - mentions, - embeds, - value: parameters.body.text, - }, - fid: parameters.fid, - timestamp: FARCASTER_EPOCH_TIMESTAMP + parameters.timestamp, - parent, - } -} - -export declare namespace Cast_fromProtobuf { - type ParametersType = { - body: MessageProtobuf.CastAddBody - meta: Meta - fid: bigint - timestamp: number - } - type ReturnType = Cast - type ErrorType = - | Embed_fromProtobuf.ErrorType - | Parent_fromProtobuf.ErrorType - | GlobalErrorType -} - -Cast_fromProtobuf.parseError = (error: unknown) => - error as Cast_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Cast/toProtobuf.ts b/src/Node/Internal/Cast/toProtobuf.ts deleted file mode 100644 index 54aadf6..0000000 --- a/src/Node/Internal/Cast/toProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Embed_toProtobuf } from '../Embed/toProtobuf.js' -import { Parent_toProtobuf } from '../Parent/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Cast } from './types.js' - -export function Cast_toProtobuf( - cast: Cast_toProtobuf.ParametersType, -): Cast_toProtobuf.ReturnType { - return create(MessageProtobuf.CastAddBodySchema, { - type: cast.isLong - ? MessageProtobuf.CastType.LONG_CAST - : MessageProtobuf.CastType.CAST, - embedsDeprecated: [], - embeds: cast.text.embeds ? cast.text.embeds.map(Embed_toProtobuf) : [], - mentions: cast.text.mentions - ? cast.text.mentions.map((mention) => mention.fid) - : [], - mentionsPositions: cast.text.mentions - ? cast.text.mentions.map((mention) => mention.position) - : [], - parent: cast.parent - ? Parent_toProtobuf(cast.parent) - : { case: undefined, value: undefined }, - text: cast.text.value, - }) -} - -export declare namespace Cast_toProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.CastAddBody - - type ErrorType = GlobalErrorType -} - -Cast_toProtobuf.parseError = (error: unknown) => - error as Cast_toProtobuf.ErrorType diff --git a/src/Node/Internal/Cast/types.ts b/src/Node/Internal/Cast/types.ts deleted file mode 100644 index a9cb2ab..0000000 --- a/src/Node/Internal/Cast/types.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Embed } from '../Embed/types.js' -import type { Meta } from '../Meta/types.js' -import type { Parent } from '../Parent/types.js' - -export type Cast = { - meta: Meta - fid: bigint - timestamp: number - parent?: Parent | undefined - text: { - value: string - embeds?: Embed[] | undefined - mentions?: - | { - fid: bigint - position: number - }[] - | undefined - } - isLong: boolean -} diff --git a/src/Node/Internal/CastAdd/errors.ts b/src/Node/Internal/CastAdd/errors.ts deleted file mode 100644 index 65874fd..0000000 --- a/src/Node/Internal/CastAdd/errors.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseError } from 'ox/Errors' - -// @TODO: replace by our own BaseError -export class CastAdd_InvalidMessageTypeError extends BaseError { - override readonly name = 'CastAdd.InvalidMessageTypeError' - - constructor({ hash }: { hash: string }) { - super(`Message "${hash}" has type other than CAST_ADD.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/CastAdd/fromMessageProtobuf.ts b/src/Node/Internal/CastAdd/fromMessageProtobuf.ts deleted file mode 100644 index 6f5a79c..0000000 --- a/src/Node/Internal/CastAdd/fromMessageProtobuf.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Cast_fromProtobuf } from '../Cast/fromProtobuf.js' -import type { Cast } from '../Cast/types.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { CastAdd_InvalidMessageTypeError } from './errors.js' - -export function CastAdd_fromMessageProtobuf( - message: CastAdd_fromMessageProtobuf.ParametersType, -): CastAdd_fromMessageProtobuf.ReturnType { - const meta = Meta_fromProtobuf(message) - // @TODO: separate error here - if (!message.data) - throw new Error('`data` must be defined in CastAdd message.') - if (message.data.body.case !== 'castAddBody') - throw new CastAdd_InvalidMessageTypeError({ hash: meta.hash }) - return Cast_fromProtobuf({ - body: message.data.body.value, - meta, - fid: message.data.fid, - timestamp: message.data.timestamp, - }) -} - -export declare namespace CastAdd_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = Cast - type ErrorType = - | CastAdd_InvalidMessageTypeError - | Meta_fromProtobuf.ErrorType - | GlobalErrorType -} - -CastAdd_fromMessageProtobuf.parseError = (error: unknown) => - error as CastAdd_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/CastAdd/toHex.ts b/src/Node/Internal/CastAdd/toHex.ts deleted file mode 100644 index 709421a..0000000 --- a/src/Node/Internal/CastAdd/toHex.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Cast } from '../Cast/types.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import { CastAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function CastAdd_toHex( - cast: CastAdd_toHex.ParametersType, -): CastAdd_toHex.ReturnType { - return Hex.fromBytes( - toBinary(Protobuf.MessageDataSchema, CastAdd_toMessageDataProtobuf(cast)), - ) -} - -export declare namespace CastAdd_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -CastAdd_toHex.parseError = (error: unknown) => error as CastAdd_toHex.ErrorType diff --git a/src/Node/Internal/CastAdd/toMessageDataProtobuf.ts b/src/Node/Internal/CastAdd/toMessageDataProtobuf.ts deleted file mode 100644 index 775bddf..0000000 --- a/src/Node/Internal/CastAdd/toMessageDataProtobuf.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Cast_toProtobuf } from '../Cast/toProtobuf.js' -import type { Cast } from '../Cast/types.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' - -// RECEIVED -// body: { -// case: 'castAddBody', -// value: { -// '$typeName': 'CastAddBody', -// embedsDeprecated: [], -// mentions: [], -// parent: { case: undefined }, -// text: 'my TODO list after buying my own place 🏡:\n' + -// '- basic mattress (~100$)\n' + -// '- fridge (~200$)\n' + -// '- data rack with 10TB SSD, NVIDIA H200, 10Gb/s optics, 512GB ram, AMD EPYC 7502P (~100,000$)\n' + -// '\n' + -// 'did I miss anything?', -// mentionsPositions: [], -// embeds: [], -// type: 0 -// } -// } - -// CONSTRUICTED -// { -// '$typeName': 'MessageData', -// type: 1, -// fid: 11517n, -// timestamp: 121142222, -// network: 1, -// body: { -// case: 'castAddBody', -// value: { -// '$typeName': 'CastAddBody', -// embedsDeprecated: [], -// mentions: [], -// parent: { case: undefined }, -// text: 'my TODO list after buying my own place 🏡:\n' + -// '- basic mattress (~100$)\n' + -// '- fridge (~200$)\n' + -// '- data rack with 10TB SSD, NVIDIA H200, 10Gb/s optics, 512GB ram, AMD EPYC 7502P (~100,000$)\n' + -// '\n' + -// 'did I miss anything?', -// mentionsPositions: [], -// embeds: [], -// type: 0 -// } -// } -// } - -export function CastAdd_toMessageDataProtobuf( - cast: CastAdd_toMessageDataProtobuf.ParametersType, -): CastAdd_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: cast.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.CAST_ADD, - fid: cast.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'castAddBody', - value: Cast_toProtobuf(cast), - }, - }) -} - -export declare namespace CastAdd_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -CastAdd_toMessageDataProtobuf.parseError = (error: unknown) => - error as CastAdd_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/CastAdd/toMessageProtobuf.ts b/src/Node/Internal/CastAdd/toMessageProtobuf.ts deleted file mode 100644 index fcf3d11..0000000 --- a/src/Node/Internal/CastAdd/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Cast } from '../Cast/types.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { CastAdd_toHex } from './toHex.js' -import { CastAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function CastAdd_toMessageProtobuf( - parameters: CastAdd_toMessageProtobuf.ParametersType, -): CastAdd_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: CastAdd_toHex(parameters.cast), - privateKey: parameters.privateKey, - }), - ), - data: CastAdd_toMessageDataProtobuf(parameters.cast), - }) -} - -export declare namespace CastAdd_toMessageProtobuf { - type ParametersType = { - cast: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -CastAdd_toMessageProtobuf.parseError = (error: unknown) => - error as CastAdd_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/CastId/fromProtobuf.ts b/src/Node/Internal/CastId/fromProtobuf.ts deleted file mode 100644 index cd18a94..0000000 --- a/src/Node/Internal/CastId/fromProtobuf.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { CastId } from './types.js' - -export function CastId_fromProtobuf( - castId: CastId_fromProtobuf.ParametersType, -): CastId_fromProtobuf.ReturnType { - return { - fid: castId.fid, - hash: Hex.fromBytes(castId.hash), - } as const -} - -export declare namespace CastId_fromProtobuf { - type ParametersType = MessageProtobuf.CastId - type ReturnType = CastId - type ErrorType = GlobalErrorType -} - -CastId_fromProtobuf.parseError = (error: unknown) => - error as CastId_fromProtobuf.ErrorType diff --git a/src/Node/Internal/CastId/toProtobuf.ts b/src/Node/Internal/CastId/toProtobuf.ts deleted file mode 100644 index 9c7c441..0000000 --- a/src/Node/Internal/CastId/toProtobuf.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { CastId } from './types.js' - -export function CastId_toProtobuf( - castId: CastId_toProtobuf.ParametersType, -): CastId_toProtobuf.ReturnType { - return create(MessageProtobuf.CastIdSchema, { - fid: castId.fid, - hash: Hex.toBytes(castId.hash), - }) -} - -export declare namespace CastId_toProtobuf { - type ParametersType = CastId - type ReturnType = MessageProtobuf.CastId - type ErrorType = GlobalErrorType -} - -CastId_toProtobuf.parseError = (error: unknown) => - error as CastId_toProtobuf.ErrorType diff --git a/src/Node/Internal/CastId/types.ts b/src/Node/Internal/CastId/types.ts deleted file mode 100644 index 9ccf721..0000000 --- a/src/Node/Internal/CastId/types.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Types } from 'ox' - -export type CastId = { - fid: bigint - hash: Types.Hex -} diff --git a/src/Node/Internal/CastRemove/fromMessageProtobuf.ts b/src/Node/Internal/CastRemove/fromMessageProtobuf.ts deleted file mode 100644 index 83333b0..0000000 --- a/src/Node/Internal/CastRemove/fromMessageProtobuf.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { CastRemove } from './types.js' - -export function CastRemove_fromMessageProtobuf( - message: CastRemove_fromMessageProtobuf.ParametersType, -): CastRemove_fromMessageProtobuf.ReturnType { - const meta = Meta_fromProtobuf(message) - - // @TODO: separate error here - if (!message.data) throw new Error('`data` must be defined in Cast message.') - if (message.data.body.case !== 'castRemoveBody') - throw new Error('no cast remove body') - - return { - meta, - hash: Hex.fromBytes(message.data.body.value.targetHash), - fid: message.data.fid, - timestamp: FARCASTER_EPOCH_TIMESTAMP + message.data.timestamp, - } -} - -export declare namespace CastRemove_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = CastRemove - type ErrorType = Meta_fromProtobuf.ErrorType | GlobalErrorType -} - -CastRemove_fromMessageProtobuf.parseError = (error: unknown) => - error as CastRemove_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/CastRemove/toHex.ts b/src/Node/Internal/CastRemove/toHex.ts deleted file mode 100644 index 0db0f7c..0000000 --- a/src/Node/Internal/CastRemove/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import { CastRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' -import type { CastRemove } from './types.js' - -export function CastRemove_toHex( - cast: CastRemove_toHex.ParametersType, -): CastRemove_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - CastRemove_toMessageDataProtobuf(cast), - ), - ) -} - -export declare namespace CastRemove_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -CastRemove_toHex.parseError = (error: unknown) => - error as CastRemove_toHex.ErrorType diff --git a/src/Node/Internal/CastRemove/toMessageDataProtobuf.ts b/src/Node/Internal/CastRemove/toMessageDataProtobuf.ts deleted file mode 100644 index 57d3a34..0000000 --- a/src/Node/Internal/CastRemove/toMessageDataProtobuf.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { CastRemove } from './types.js' - -export function CastRemove_toMessageDataProtobuf( - castRemoval: CastRemove_toMessageDataProtobuf.ParametersType, -): CastRemove_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: castRemoval.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.CAST_REMOVE, - fid: castRemoval.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'castRemoveBody', - value: create(MessageProtobuf.CastRemoveBodySchema, { - targetHash: Hex.toBytes(castRemoval.hash), - }), - }, - }) -} - -export declare namespace CastRemove_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -CastRemove_toMessageDataProtobuf.parseError = (error: unknown) => - error as CastRemove_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/CastRemove/toMessageProtobuf.ts b/src/Node/Internal/CastRemove/toMessageProtobuf.ts deleted file mode 100644 index 0b3ca5f..0000000 --- a/src/Node/Internal/CastRemove/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { CastRemove_toHex } from './toHex.js' -import { CastRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' -import type { CastRemove } from './types.js' - -export function CastRemove_toMessageProtobuf( - parameters: CastRemove_toMessageProtobuf.ParametersType, -): CastRemove_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: CastRemove_toHex(parameters.castRemove), - privateKey: parameters.privateKey, - }), - ), - data: CastRemove_toMessageDataProtobuf(parameters.castRemove), - }) -} - -export declare namespace CastRemove_toMessageProtobuf { - type ParametersType = { - castRemove: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -CastRemove_toMessageProtobuf.parseError = (error: unknown) => - error as CastRemove_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/CastRemove/types.ts b/src/Node/Internal/CastRemove/types.ts deleted file mode 100644 index 8aff0e1..0000000 --- a/src/Node/Internal/CastRemove/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Types } from 'ox' -import type { Meta } from '../Meta/types.js' - -export type CastRemove = { - meta: Meta - hash: Types.Hex - fid: bigint - timestamp: number -} diff --git a/src/Node/Internal/Embed/errors.ts b/src/Node/Internal/Embed/errors.ts deleted file mode 100644 index f60143c..0000000 --- a/src/Node/Internal/Embed/errors.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseError } from 'ox/Errors' - -export class Embed_InvalidEmbedTypeError extends BaseError { - override readonly name = 'Embed.InvalidEmbedTypeError' - - constructor({ embed }: { embed: any }) { - super(`Embed is invalid: ${JSON.stringify(embed, null, 2)}`, { - docsPath: '/errors#invalidembedtypeerror', - }) - } -} diff --git a/src/Node/Internal/Embed/fromProtobuf.ts b/src/Node/Internal/Embed/fromProtobuf.ts deleted file mode 100644 index 1ac24d1..0000000 --- a/src/Node/Internal/Embed/fromProtobuf.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_fromProtobuf } from '../CastId/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Embed_InvalidEmbedTypeError } from './errors.js' -import type { Embed } from './types.js' - -export function Embed_fromProtobuf( - embed: Embed_fromProtobuf.ParametersType, -): Embed_fromProtobuf.ReturnType { - if (typeof embed.case === 'undefined') return undefined - if (embed.case === 'url') return { type: 'url', url: embed.value } as const - if (embed.case === 'castId') - return { - type: 'cast', - ...CastId_fromProtobuf(embed.value), - } as const - - throw new Embed_InvalidEmbedTypeError({ embed }) -} - -export declare namespace Embed_fromProtobuf { - type ParametersType = MessageProtobuf.Embed['embed'] - type ReturnType = Embed | undefined - type ErrorType = - | Embed_InvalidEmbedTypeError - | CastId_fromProtobuf.ErrorType - | GlobalErrorType -} -Embed_fromProtobuf.parseError = (error: unknown) => - error as Embed_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Embed/toProtobuf.ts b/src/Node/Internal/Embed/toProtobuf.ts deleted file mode 100644 index dd5444b..0000000 --- a/src/Node/Internal/Embed/toProtobuf.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_toProtobuf } from '../CastId/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Embed } from './types.js' - -export function Embed_toProtobuf( - embed: Embed_toProtobuf.ParametersType, -): Embed_toProtobuf.ReturnType { - if (embed.type === 'cast') - return create(MessageProtobuf.EmbedSchema, { - embed: { - case: 'castId', - value: CastId_toProtobuf(embed), - }, - }) - if (embed.type === 'url') - return create(MessageProtobuf.EmbedSchema, { - embed: { - case: 'url', - value: embed.url, - }, - }) - throw new Error() -} - -export declare namespace Embed_toProtobuf { - type ParametersType = Embed - type ReturnType = MessageProtobuf.Embed - - type ErrorType = GlobalErrorType -} -Embed_toProtobuf.parseError = (error: unknown) => - error as Embed_toProtobuf.ErrorType diff --git a/src/Node/Internal/Embed/types.ts b/src/Node/Internal/Embed/types.ts deleted file mode 100644 index bdab6b6..0000000 --- a/src/Node/Internal/Embed/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { CastId } from '../CastId/types.js' - -export type Embed = - | ({ - type: 'cast' - } & CastId) - | { - type: 'url' - url: string - } diff --git a/src/Node/Internal/FrameActionBody/fromProtobuf.ts b/src/Node/Internal/FrameActionBody/fromProtobuf.ts deleted file mode 100644 index e80eb5f..0000000 --- a/src/Node/Internal/FrameActionBody/fromProtobuf.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_fromProtobuf } from '../CastId/fromProtobuf.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { FrameActionBody } from './types.js' - -export function FrameActionBody_fromProtobuf( - message: FrameActionBody_fromProtobuf.ParametersType, -): FrameActionBody_fromProtobuf.ReturnType { - //@TODO: errors - if (!message.data) throw new Error('no data') - if (message.data.body.case !== 'frameActionBody') throw new Error('bad case') - - return { - meta: Meta_fromProtobuf(message), - url: message.data.body.value.url.toString(), - buttonIndex: message.data.body.value.buttonIndex as 1 | 2 | 3 | 4, - castId: message.data.body.value.castId - ? CastId_fromProtobuf(message.data.body.value.castId) - : undefined, - inputText: message.data.body.value.inputText.toString(), - state: message.data.body.value.state.toString(), - transactionId: message.data.body.value.transactionId.toString(), - address: message.data.body.value.address.toString(), - } as const -} - -export declare namespace FrameActionBody_fromProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = FrameActionBody - type ErrorType = GlobalErrorType -} - -FrameActionBody_fromProtobuf.parseError = (error: unknown) => - error as FrameActionBody_fromProtobuf.ErrorType diff --git a/src/Node/Internal/FrameActionBody/types.ts b/src/Node/Internal/FrameActionBody/types.ts deleted file mode 100644 index 416013f..0000000 --- a/src/Node/Internal/FrameActionBody/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { CastId } from '../CastId/types.js' -import type { Meta } from '../Meta/types.js' - -export type FrameActionBody = { - meta: Meta - url: string - buttonIndex: 1 | 2 | 3 | 4 - castId: CastId | undefined - inputText: string - state: string - transactionId: string - address: string -} diff --git a/src/Node/Internal/HubEvent/fromProtobuf.ts b/src/Node/Internal/HubEvent/fromProtobuf.ts deleted file mode 100644 index d50ecdd..0000000 --- a/src/Node/Internal/HubEvent/fromProtobuf.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Message_fromProtobuf } from '../Message/fromProtobuf.js' -import * as HubEventProtobuf from '../Protobufs/hub_event_pb.js' -import type { HubEvent } from './types.js' - -export function HubEvent_fromProtobuf( - hubEvent: HubEvent_fromProtobuf.ParametersType, -): HubEvent_fromProtobuf.ReturnType { - if ( - hubEvent.type === HubEventProtobuf.HubEventType.MERGE_MESSAGE && - hubEvent.body.case === 'mergeMessageBody' - ) { - return { - type: 'mergeMessage', - id: hubEvent.id, - message: hubEvent.body.value.message - ? Message_fromProtobuf(hubEvent.body.value.message) - : undefined, - deletedMesssages: - hubEvent.body.value.deletedMessages.map(Message_fromProtobuf), - } - } - - if ( - hubEvent.type === HubEventProtobuf.HubEventType.PRUNE_MESSAGE && - hubEvent.body.case === 'pruneMessageBody' - ) { - return { - type: 'pruneMessage', - id: hubEvent.id, - message: hubEvent.body.value.message - ? Message_fromProtobuf(hubEvent.body.value.message) - : undefined, - } - } - - if ( - hubEvent.type === HubEventProtobuf.HubEventType.REVOKE_MESSAGE && - hubEvent.body.case === 'revokeMessageBody' - ) { - return { - type: 'revokeMessage', - id: hubEvent.id, - message: hubEvent.body.value.message - ? Message_fromProtobuf(hubEvent.body.value.message) - : undefined, - } - } - throw new Error('Not implemented') -} - -export declare namespace HubEvent_fromProtobuf { - type ParametersType = HubEventProtobuf.HubEvent - type ReturnType = HubEvent - type ErrorType = GlobalErrorType -} - -HubEvent_fromProtobuf.parseError = (error: unknown) => - error as HubEvent_fromProtobuf.ErrorType diff --git a/src/Node/Internal/HubEvent/types.ts b/src/Node/Internal/HubEvent/types.ts deleted file mode 100644 index 5477915..0000000 --- a/src/Node/Internal/HubEvent/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Message } from '../Message/types.js' - -export type HubEventType = 'mergeMessage' | 'pruneMessage' | 'revokeMessage' - -export type HubEvent = { - id: bigint -} & ( - | { - type: Exclude - message: Message | undefined - } - | { - type: Extract - message: Message | undefined - deletedMesssages: Message[] - } -) diff --git a/src/Node/Internal/Link/errors.ts b/src/Node/Internal/Link/errors.ts deleted file mode 100644 index 1cc4243..0000000 --- a/src/Node/Internal/Link/errors.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseError } from 'ox/Errors' - -export class Link_InvalidMessageTypeError extends BaseError { - override readonly name = 'Link.InvalidMessageTypeError' - - constructor({ hash }: { hash: string }) { - super(`Message "${hash}" has type other than CAST_ADD.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/Link/fromMessageProtobuf.ts b/src/Node/Internal/Link/fromMessageProtobuf.ts deleted file mode 100644 index e049fdf..0000000 --- a/src/Node/Internal/Link/fromMessageProtobuf.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Link_fromProtobuf } from '../Link/fromProtobuf.js' -import type { Link } from '../Link/types.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Link_InvalidMessageTypeError } from './errors.js' - -export function Link_fromMessageProtobuf( - message: Link_fromMessageProtobuf.ParametersType, -): Link_fromMessageProtobuf.ReturnType { - const meta = Meta_fromProtobuf(message) - // @TODO: separate error here - if (!message.data) throw new Error('`data` must be defined in Link message.') - if (message.data.body.case !== 'linkBody') - throw new Link_InvalidMessageTypeError({ hash: meta.hash }) - return Link_fromProtobuf({ - body: message.data.body.value, - meta, - fid: message.data.fid, - timestamp: message.data.timestamp, - }) -} - -export declare namespace Link_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = Link - type ErrorType = - | Link_InvalidMessageTypeError - | Meta_fromProtobuf.ErrorType - | GlobalErrorType -} - -Link_fromMessageProtobuf.parseError = (error: unknown) => - error as Link_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/Link/fromProtobuf.ts b/src/Node/Internal/Link/fromProtobuf.ts deleted file mode 100644 index 311c2e6..0000000 --- a/src/Node/Internal/Link/fromProtobuf.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Meta } from '../Meta/types.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Link } from './types.js' - -//@TODO: errors -export function Link_fromProtobuf( - parameters: Link_fromProtobuf.ParametersType, -): Link_fromProtobuf.ReturnType { - if (parameters.body.target.case !== 'targetFid') - throw new Error('Invalid target') - - return { - meta: parameters.meta, - type: parameters.body.type, - displayTimestamp: parameters.body.displayTimestamp, - targetFid: parameters.body.target.value, - fid: parameters.fid, - timestamp: parameters.timestamp, - } -} - -export declare namespace Link_fromProtobuf { - type ParametersType = { - body: MessageProtobuf.LinkBody - meta: Meta - fid: bigint - timestamp: number - } - type ReturnType = Link - type ErrorType = GlobalErrorType -} -Link_fromProtobuf.parseError = (error: unknown) => - error as Link_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Link/toProtobuf.ts b/src/Node/Internal/Link/toProtobuf.ts deleted file mode 100644 index 8e9e85d..0000000 --- a/src/Node/Internal/Link/toProtobuf.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Link } from './types.js' - -export function Link_toProtobuf( - link: Link_toProtobuf.ParametersType, -): Link_toProtobuf.ReturnType { - return create(MessageProtobuf.LinkBodySchema, { - type: link.type, - ...(link.displayTimestamp - ? { displayTimestamp: link.displayTimestamp } - : {}), - target: { case: 'targetFid', value: link.targetFid }, - }) -} - -export declare namespace Link_toProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.LinkBody - - type ErrorType = GlobalErrorType -} - -Link_toProtobuf.parseError = (error: unknown) => - error as Link_toProtobuf.ErrorType diff --git a/src/Node/Internal/Link/types.ts b/src/Node/Internal/Link/types.ts deleted file mode 100644 index 77e711b..0000000 --- a/src/Node/Internal/Link/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Meta } from '../Meta/types.js' - -export type Link = { - meta: Meta - type: string - displayTimestamp?: number | undefined - timestamp: number - targetFid: bigint - fid: bigint -} diff --git a/src/Node/Internal/LinkAdd/toHex.ts b/src/Node/Internal/LinkAdd/toHex.ts deleted file mode 100644 index 9122045..0000000 --- a/src/Node/Internal/LinkAdd/toHex.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Link } from '../Link/types.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import { LinkAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function LinkAdd_toHex( - link: LinkAdd_toHex.ParametersType, -): LinkAdd_toHex.ReturnType { - return Hex.fromBytes( - toBinary(Protobuf.MessageDataSchema, LinkAdd_toMessageDataProtobuf(link)), - ) -} - -export declare namespace LinkAdd_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -LinkAdd_toHex.parseError = (error: unknown) => error as LinkAdd_toHex.ErrorType diff --git a/src/Node/Internal/LinkAdd/toMessageDataProtobuf.ts b/src/Node/Internal/LinkAdd/toMessageDataProtobuf.ts deleted file mode 100644 index 88d3dc0..0000000 --- a/src/Node/Internal/LinkAdd/toMessageDataProtobuf.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import { Link_toProtobuf } from '../Link/toProtobuf.js' -import type { Link } from '../Link/types.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' - -export function LinkAdd_toMessageDataProtobuf( - link: LinkAdd_toMessageDataProtobuf.ParametersType, -): LinkAdd_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: link.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.LINK_ADD, - fid: link.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'linkBody', - value: Link_toProtobuf(link), - }, - }) -} - -export declare namespace LinkAdd_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -LinkAdd_toMessageDataProtobuf.parseError = (error: unknown) => - error as LinkAdd_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/LinkAdd/toMessageProtobuf.ts b/src/Node/Internal/LinkAdd/toMessageProtobuf.ts deleted file mode 100644 index 727a0f1..0000000 --- a/src/Node/Internal/LinkAdd/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Link } from '../Link/types.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { LinkAdd_toHex } from './toHex.js' -import { LinkAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function LinkAdd_toMessageProtobuf( - parameters: LinkAdd_toMessageProtobuf.ParametersType, -): LinkAdd_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: LinkAdd_toHex(parameters.link), - privateKey: parameters.privateKey, - }), - ), - data: LinkAdd_toMessageDataProtobuf(parameters.link), - }) -} - -export declare namespace LinkAdd_toMessageProtobuf { - type ParametersType = { - link: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -LinkAdd_toMessageProtobuf.parseError = (error: unknown) => - error as LinkAdd_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/LinkCompactState/fromMessageProtobuf.ts b/src/Node/Internal/LinkCompactState/fromMessageProtobuf.ts deleted file mode 100644 index 74e766b..0000000 --- a/src/Node/Internal/LinkCompactState/fromMessageProtobuf.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { LinkCompactState } from './types.js' - -//@TODO: errors -export function LinkCompactState_fromMessageProtobuf( - message: LinkCompactState_fromMessageProtobuf.ParametersType, -): LinkCompactState_fromMessageProtobuf.ReturnType { - if (!message.data) throw new Error('Link must have data') - - if (message.data.body.case !== 'linkCompactStateBody') - throw new Error('Not linkCompactStateBody message') - - return { - meta: Meta_fromProtobuf(message), - type: message.data.body.value.type, - fids: message.data.body.value.targetFids, - fid: message.data.fid, - timestamp: message.data.timestamp, - } -} - -export declare namespace LinkCompactState_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = LinkCompactState - type ErrorType = GlobalErrorType -} -LinkCompactState_fromMessageProtobuf.parseError = (error: unknown) => - error as LinkCompactState_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/LinkCompactState/toHex.ts b/src/Node/Internal/LinkCompactState/toHex.ts deleted file mode 100644 index 3c50e5d..0000000 --- a/src/Node/Internal/LinkCompactState/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { LinkCompactState } from '../LinkCompactState/types.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import { LinkCompactStateAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function LinkCompactStateAdd_toHex( - link: LinkCompactStateAdd_toHex.ParametersType, -): LinkCompactStateAdd_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - LinkCompactStateAdd_toMessageDataProtobuf(link), - ), - ) -} - -export declare namespace LinkCompactStateAdd_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -LinkCompactStateAdd_toHex.parseError = (error: unknown) => - error as LinkCompactStateAdd_toHex.ErrorType diff --git a/src/Node/Internal/LinkCompactState/toMessageDataProtobuf.ts b/src/Node/Internal/LinkCompactState/toMessageDataProtobuf.ts deleted file mode 100644 index 32a1b1c..0000000 --- a/src/Node/Internal/LinkCompactState/toMessageDataProtobuf.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import type { LinkCompactState } from '../LinkCompactState/types.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' - -export function LinkCompactStateAdd_toMessageDataProtobuf( - link: LinkCompactStateAdd_toMessageDataProtobuf.ParametersType, -): LinkCompactStateAdd_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: link.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.LINK_COMPACT_STATE, - fid: link.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'linkCompactStateBody', - value: create(MessageProtobuf.LinkCompactStateBodySchema, { - type: link.type, - targetFids: link.fids, - }), - }, - }) -} - -export declare namespace LinkCompactStateAdd_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -LinkCompactStateAdd_toMessageDataProtobuf.parseError = (error: unknown) => - error as LinkCompactStateAdd_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/LinkCompactState/toMessageProtobuf.ts b/src/Node/Internal/LinkCompactState/toMessageProtobuf.ts deleted file mode 100644 index 6230a08..0000000 --- a/src/Node/Internal/LinkCompactState/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { LinkCompactState } from '../LinkCompactState/types.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { LinkCompactStateAdd_toHex } from './toHex.js' -import { LinkCompactStateAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function LinkCompactStateAdd_toMessageProtobuf( - parameters: LinkCompactStateAdd_toMessageProtobuf.ParametersType, -): LinkCompactStateAdd_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: LinkCompactStateAdd_toHex(parameters.link), - privateKey: parameters.privateKey, - }), - ), - data: LinkCompactStateAdd_toMessageDataProtobuf(parameters.link), - }) -} - -export declare namespace LinkCompactStateAdd_toMessageProtobuf { - type ParametersType = { - link: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -LinkCompactStateAdd_toMessageProtobuf.parseError = (error: unknown) => - error as LinkCompactStateAdd_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/LinkCompactState/types.ts b/src/Node/Internal/LinkCompactState/types.ts deleted file mode 100644 index 26ed8d2..0000000 --- a/src/Node/Internal/LinkCompactState/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Meta } from '../Meta/types.js' - -export type LinkCompactState = { - meta: Meta - type: string - fids: bigint[] - fid: bigint - timestamp: number -} diff --git a/src/Node/Internal/LinkRemove/toHex.ts b/src/Node/Internal/LinkRemove/toHex.ts deleted file mode 100644 index be8d739..0000000 --- a/src/Node/Internal/LinkRemove/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Link } from '../Link/types.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import { LinkRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function LinkRemove_toHex( - link: LinkRemove_toHex.ParametersType, -): LinkRemove_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - LinkRemove_toMessageDataProtobuf(link), - ), - ) -} - -export declare namespace LinkRemove_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -LinkRemove_toHex.parseError = (error: unknown) => - error as LinkRemove_toHex.ErrorType diff --git a/src/Node/Internal/LinkRemove/toMessageDataProtobuf.ts b/src/Node/Internal/LinkRemove/toMessageDataProtobuf.ts deleted file mode 100644 index 14a3e23..0000000 --- a/src/Node/Internal/LinkRemove/toMessageDataProtobuf.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import { Link_toProtobuf } from '../Link/toProtobuf.js' -import type { Link } from '../Link/types.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' - -export function LinkRemove_toMessageDataProtobuf( - link: LinkRemove_toMessageDataProtobuf.ParametersType, -): LinkRemove_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: link.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.LINK_REMOVE, - fid: link.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'linkBody', - value: Link_toProtobuf(link), - }, - }) -} - -export declare namespace LinkRemove_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -LinkRemove_toMessageDataProtobuf.parseError = (error: unknown) => - error as LinkRemove_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/LinkRemove/toMessageProtobuf.ts b/src/Node/Internal/LinkRemove/toMessageProtobuf.ts deleted file mode 100644 index d4a6c39..0000000 --- a/src/Node/Internal/LinkRemove/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Link } from '../Link/types.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { LinkRemove_toHex } from './toHex.js' -import { LinkRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function LinkRemove_toMessageProtobuf( - parameters: LinkRemove_toMessageProtobuf.ParametersType, -): LinkRemove_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: LinkRemove_toHex(parameters.link), - privateKey: parameters.privateKey, - }), - ), - data: LinkRemove_toMessageDataProtobuf(parameters.link), - }) -} - -export declare namespace LinkRemove_toMessageProtobuf { - type ParametersType = { - link: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -LinkRemove_toMessageProtobuf.parseError = (error: unknown) => - error as LinkRemove_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/Message/fromProtobuf.ts b/src/Node/Internal/Message/fromProtobuf.ts deleted file mode 100644 index 4234f30..0000000 --- a/src/Node/Internal/Message/fromProtobuf.ts +++ /dev/null @@ -1,97 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastAdd_fromMessageProtobuf } from '../CastAdd/fromMessageProtobuf.js' -import { CastRemove_fromMessageProtobuf } from '../CastRemove/fromMessageProtobuf.js' -import { FrameActionBody_fromProtobuf } from '../FrameActionBody/fromProtobuf.js' -import { Link_fromMessageProtobuf } from '../Link/fromMessageProtobuf.js' -import { LinkCompactState_fromMessageProtobuf } from '../LinkCompactState/fromMessageProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Reaction_fromMessageProtobuf } from '../Reaction/fromMessageProtobuf.js' -import { UserData_fromProtobuf } from '../UserData/fromProtobuf.js' -import { UsernameProof_fromMessageProtobuf } from '../UsernameProof/fromMessageProtobuf.js' -import { VerificationAdd_fromMessageProtobuf } from '../VerificationAdd/fromMessageProtobuf.js' -import { VerificationRemove_fromMessageProtobuf } from '../VerificationRemoval/fromMessageProtobuf.js' -import type { Message } from './types.js' - -export function Message_fromProtobuf( - message: Message_fromProtobuf.ParametersType, -): Message_fromProtobuf.ReturnType { - // @TODO: separate error here - if (!message.data) - throw new Error('`data` must be defined in Message message.') - if (message.data.type === MessageProtobuf.MessageType.CAST_ADD) - return { type: 'castAdd', data: CastAdd_fromMessageProtobuf(message) } - if ( - message.data.type === MessageProtobuf.MessageType.CAST_REMOVE && - message.data.body.case === 'castRemoveBody' - ) - return { - type: 'castRemove', - data: CastRemove_fromMessageProtobuf(message), - } - - if (message.data.type === MessageProtobuf.MessageType.REACTION_ADD) - return { - type: 'reactionAdd', - data: Reaction_fromMessageProtobuf(message), - } - if (message.data.type === MessageProtobuf.MessageType.REACTION_REMOVE) - return { - type: 'reactionRemove', - data: Reaction_fromMessageProtobuf(message), - } - if (message.data.type === MessageProtobuf.MessageType.LINK_ADD) - return { type: 'linkAdd', data: Link_fromMessageProtobuf(message) } - if (message.data.type === MessageProtobuf.MessageType.LINK_REMOVE) - return { type: 'linkRemove', data: Link_fromMessageProtobuf(message) } - if ( - message.data.type === - MessageProtobuf.MessageType.VERIFICATION_ADD_ETH_ADDRESS - ) { - return { - type: 'verificationAdd', - data: VerificationAdd_fromMessageProtobuf(message), - } - } - if (message.data.type === MessageProtobuf.MessageType.VERIFICATION_REMOVE) { - return { - type: 'verificationRemove', - data: VerificationRemove_fromMessageProtobuf(message), - } - } - // TODO: REFACTOR - - /// - /// - /// - if (message.data.type === MessageProtobuf.MessageType.USER_DATA_ADD) - return { type: 'userDataAdd', data: UserData_fromProtobuf(message) } - if (message.data.type === MessageProtobuf.MessageType.USERNAME_PROOF) - return { - type: 'usernameProof', - data: UsernameProof_fromMessageProtobuf(message), - } - if (message.data.type === MessageProtobuf.MessageType.FRAME_ACTION) - return { type: 'frameAction', data: FrameActionBody_fromProtobuf(message) } - - /// - ///// - ///// - ///// - ///// - if (message.data.type === MessageProtobuf.MessageType.LINK_COMPACT_STATE) - return { - type: 'linkCompactState', - data: LinkCompactState_fromMessageProtobuf(message), - } - throw new Error('Not expected') -} - -export declare namespace Message_fromProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = Message - // @TODO: errors - type ErrorType = GlobalErrorType -} - -Message_fromProtobuf.parseError = (error: unknown) => - error as Message_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Message/types.ts b/src/Node/Internal/Message/types.ts deleted file mode 100644 index cb4a19b..0000000 --- a/src/Node/Internal/Message/types.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type { Cast } from '../Cast/types.js' -import type { CastRemove } from '../CastRemove/types.js' -import type { FrameActionBody } from '../FrameActionBody/types.js' -import type { Link } from '../Link/types.js' -import type { LinkCompactState } from '../LinkCompactState/types.js' -import type { Reaction } from '../Reaction/types.js' -import type { UserData } from '../UserData/types.js' -import type { UsernameProof } from '../UsernameProof/types.js' -import type { Verification } from '../Verification/types.js' -import type { VerificationRemove } from '../VerificationRemoval/types.js' - -export type Message = - | { - type: 'castAdd' - data: Cast - } - | { - type: 'castRemove' - data: CastRemove - } - | { - type: 'reactionAdd' | 'reactionRemove' - data: Reaction - } - | { - type: 'userDataAdd' - data: UserData - } - | { - type: 'linkAdd' | 'linkRemove' - data: Link - } - | { - type: 'verificationAdd' - data: Verification - } - | { - type: 'verificationRemove' - data: VerificationRemove - } - | { - type: 'usernameProof' - data: UsernameProof - } - | { - type: 'frameAction' - data: FrameActionBody - } - | { - type: 'linkCompactState' - data: LinkCompactState - } diff --git a/src/Node/Internal/Meta/create.ts b/src/Node/Internal/Meta/create.ts deleted file mode 100644 index 5f47668..0000000 --- a/src/Node/Internal/Meta/create.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as ed from '@noble/ed25519' -import { blake3 } from '@noble/hashes/blake3' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Meta } from './types.js' - -export function Meta_create( - parameters: Meta_create.ParametersType, -): Meta_create.ReturnType { - const hash = blake3(Hex.toBytes(parameters.dataBytes), { dkLen: 20 }) - const signature = ed.sign(hash, parameters.privateKey.slice(2)) - return { - hash: Hex.fromBytes(hash), - hashScheme: 'blake3', - signature: Hex.fromBytes(signature), - signatureScheme: 'ed25519', - signer: Hex.fromBytes(ed.getPublicKey(parameters.privateKey.slice(2))), - dataBytes: parameters.dataBytes, - } as const -} - -export declare namespace Meta_create { - type ParametersType = { - dataBytes: Types.Hex - privateKey: Types.Hex - } - type ReturnType = Meta - - type ErrorType = GlobalErrorType -} - -Meta_create.parseError = (error: unknown) => error as Meta_create.ErrorType diff --git a/src/Node/Internal/Meta/errors.ts b/src/Node/Internal/Meta/errors.ts deleted file mode 100644 index bb5033f..0000000 --- a/src/Node/Internal/Meta/errors.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { BaseError } from 'ox/Errors' - -// @TODO: replace by our own BaseError -export class Meta_InvalidHashSchemeTypeError extends BaseError { - override readonly name = 'Meta.InvalidHashSchemeTypeError' - - constructor({ hash }: { hash: string }) { - super(`HashScheme of "${hash}" is invalid.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} - -export class Meta_InvalidSignatureSchemeTypeError extends BaseError { - override readonly name = 'Meta.InvalidSignatureSchemeTypeError' - - constructor({ hash }: { hash: string }) { - super(`SignatureScheme of "${hash}" is invalid.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} - -export class Meta_InvalidSignatureError extends BaseError { - override readonly name = 'Meta.InvalidSignatureTypeError' - - constructor({ hash }: { hash: string }) { - super(`Signature of "${hash}" is invalid.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/Meta/fromProtobuf.ts b/src/Node/Internal/Meta/fromProtobuf.ts deleted file mode 100644 index b29d2c2..0000000 --- a/src/Node/Internal/Meta/fromProtobuf.ts +++ /dev/null @@ -1,73 +0,0 @@ -import * as ed from '@noble/ed25519' -import * as sha from '@noble/hashes/sha512' -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { - Meta_InvalidHashSchemeTypeError, - Meta_InvalidSignatureError, - Meta_InvalidSignatureSchemeTypeError, -} from './errors.js' -import type { Meta } from './types.js' - -ed.etc.sha512Sync = (...m) => sha.sha512(ed.etc.concatBytes(...m)) - -export function Meta_fromProtobuf( - message: Meta_fromProtobuf.ParametersType, -): Meta_fromProtobuf.ReturnType { - //@TODO: error - if (!message.data) throw new Error('') - const hash = Hex.fromBytes(message.hash) - const signer = Hex.fromBytes(message.signer) - const signature = Hex.fromBytes(message.signature) - const hashScheme = (() => { - if (message.hashScheme === MessageProtobuf.HashScheme.BLAKE3) - return 'blake3' as const - throw new Meta_InvalidHashSchemeTypeError({ hash }) - })() - const signatureScheme = (() => { - if (message.signatureScheme === MessageProtobuf.SignatureScheme.EIP712) - return 'eip712' - if (message.signatureScheme === MessageProtobuf.SignatureScheme.ED25519) - return 'ed25519' - - throw new Meta_InvalidSignatureSchemeTypeError({ hash }) - })() - - const verified = (() => { - if (!signatureScheme) return null - if (signatureScheme === 'ed25519') - return ed.verify(message.signature, message.hash, message.signer) - if (signatureScheme === 'eip712') throw new Error('not implemented') - throw new Meta_InvalidSignatureSchemeTypeError({ hash }) - })() - - if (verified === false) throw new Meta_InvalidSignatureError({ hash }) - - const dataBytes = message.dataBytes - ? Hex.fromBytes(message.dataBytes) - : undefined - - return { - hash, - signer, - signature, - hashScheme, - signatureScheme, - dataBytes, - } as const -} - -export declare namespace Meta_fromProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = Meta - - type ErrorType = - | Meta_InvalidHashSchemeTypeError - | Meta_InvalidSignatureSchemeTypeError - | Meta_InvalidSignatureError - | GlobalErrorType -} - -Meta_fromProtobuf.parseError = (error: unknown) => - error as Meta_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Meta/toProtobuf.ts b/src/Node/Internal/Meta/toProtobuf.ts deleted file mode 100644 index ceb7019..0000000 --- a/src/Node/Internal/Meta/toProtobuf.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as ed from '@noble/ed25519' -import * as sha from '@noble/hashes/sha512' -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Meta } from './types.js' - -ed.etc.sha512Sync = (...m) => sha.sha512(ed.etc.concatBytes(...m)) - -export function Meta_toProtobuf( - meta: Meta_toProtobuf.ParametersType, -): Meta_toProtobuf.ReturnType { - return { - hash: Hex.toBytes(meta.hash), - signer: Hex.toBytes(meta.signer), - signature: Hex.toBytes(meta.signature), - hashScheme: MessageProtobuf.HashScheme.BLAKE3, - signatureScheme: MessageProtobuf.SignatureScheme.ED25519, - ...(meta.dataBytes ? { dataBytes: Hex.toBytes(meta.dataBytes) } : {}), - } as const -} - -export declare namespace Meta_toProtobuf { - type ParametersType = Meta - type ReturnType = Pick< - MessageProtobuf.Message, - | 'hash' - | 'hashScheme' - | 'dataBytes' - | 'signatureScheme' - | 'signature' - | 'signer' - > - - type ErrorType = GlobalErrorType -} - -Meta_toProtobuf.parseError = (error: unknown) => - error as Meta_toProtobuf.ErrorType diff --git a/src/Node/Internal/Meta/types.ts b/src/Node/Internal/Meta/types.ts deleted file mode 100644 index fa5564e..0000000 --- a/src/Node/Internal/Meta/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Types } from 'ox' - -export type Meta = { - hash: Types.Hex - signer: Types.Hex - signature: Types.Hex - hashScheme: 'blake3' - signatureScheme: 'ed25519' | 'eip712' - dataBytes: Types.Hex | undefined -} diff --git a/src/Node/Internal/Pagination/getPageToken.ts b/src/Node/Internal/Pagination/getPageToken.ts deleted file mode 100644 index f0b0a9c..0000000 --- a/src/Node/Internal/Pagination/getPageToken.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { NextPageToken } from './types.js' - -export function Pagination_getPageToken( - pageToken: Pagination_getPageToken.ParametersType, -): Pagination_getPageToken.ReturnType { - if (!pageToken) return null - const hex = Hex.fromBytes(pageToken) - if (hex === '0x') return null - return hex -} - -export declare namespace Pagination_getPageToken { - type ParametersType = Uint8Array | undefined - type ReturnType = NextPageToken - type ErrorType = GlobalErrorType -} diff --git a/src/Node/Internal/Pagination/types.ts b/src/Node/Internal/Pagination/types.ts deleted file mode 100644 index 17185ca..0000000 --- a/src/Node/Internal/Pagination/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Types } from 'ox' - -export type Pagination = { - pageSize?: number | undefined - pageToken?: Types.Hex | undefined - reverse?: boolean | undefined -} - -export type PaginationWithTimestamps = Pagination & { - startTimestamp?: bigint | undefined - stopTimestamp?: bigint | undefined -} - -export type NextPageToken = Types.Hex | null diff --git a/src/Node/Internal/Pagination/unwrap.ts b/src/Node/Internal/Pagination/unwrap.ts deleted file mode 100644 index 10deb3d..0000000 --- a/src/Node/Internal/Pagination/unwrap.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { PaginationWithTimestamps } from './types.js' - -export function Pagination_unwrap( - parameters: Pagination_unwrap.ParametersType, -): Pagination_unwrap.ReturnType { - return { - ...(parameters.pageSize ? { pageSize: parameters.pageSize } : {}), - ...(parameters.pageToken - ? { pageToken: Hex.toBytes(parameters.pageToken) } - : {}), - ...(parameters.reverse ? { reverse: parameters.reverse } : {}), - ...(parameters.startTimestamp - ? { startTimestamp: parameters.startTimestamp } - : {}), - ...(parameters.stopTimestamp - ? { stopTimestamp: parameters.stopTimestamp } - : {}), - } -} - -export declare namespace Pagination_unwrap { - type ParametersType = PaginationWithTimestamps - type ReturnType = { - stopTimestamp?: bigint - startTimestamp?: bigint - reverse?: true - pageToken?: any - pageSize?: number - } - type ErrorType = GlobalErrorType -} diff --git a/src/Node/Internal/Parent/errors.ts b/src/Node/Internal/Parent/errors.ts deleted file mode 100644 index be42d9a..0000000 --- a/src/Node/Internal/Parent/errors.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseError } from 'ox/Errors' - -export class Parent_InvalidParentTypeError extends BaseError { - override readonly name = 'Parent.InvalidParentTypeError' - - constructor({ parent }: { parent: any }) { - super(`Parent is invalid: ${JSON.stringify(parent, null, 2)}`, { - docsPath: '/errors#invalidparenttypeerror', - }) - } -} diff --git a/src/Node/Internal/Parent/fromProtobuf.ts b/src/Node/Internal/Parent/fromProtobuf.ts deleted file mode 100644 index 174bead..0000000 --- a/src/Node/Internal/Parent/fromProtobuf.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_fromProtobuf } from '../CastId/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Parent_InvalidParentTypeError } from './errors.js' -import type { Parent } from './types.js' - -export function Parent_fromProtobuf( - parent: Parent_fromProtobuf.ParametersType, -): Parent_fromProtobuf.ReturnType { - if (typeof parent.case === 'undefined') return undefined - if (parent.case === 'parentUrl') - return { type: 'url', url: parent.value } as const - if (parent.case === 'parentCastId') - return { - type: 'cast', - ...CastId_fromProtobuf(parent.value), - } as const - - throw new Parent_InvalidParentTypeError({ parent }) -} - -export declare namespace Parent_fromProtobuf { - type ParametersType = MessageProtobuf.CastAddBody['parent'] - type ReturnType = Parent | undefined - - type ErrorType = - | Parent_InvalidParentTypeError - | CastId_fromProtobuf.ErrorType - | GlobalErrorType -} -Parent_fromProtobuf.parseError = (error: unknown) => - error as Parent_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Parent/toProtobuf.ts b/src/Node/Internal/Parent/toProtobuf.ts deleted file mode 100644 index cfdd781..0000000 --- a/src/Node/Internal/Parent/toProtobuf.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_toProtobuf } from '../CastId/toProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Parent_InvalidParentTypeError } from './errors.js' -import type { Parent } from './types.js' - -export function Parent_toProtobuf( - parent: Parent_toProtobuf.ParametersType, -): Parent_toProtobuf.ReturnType { - if (typeof parent === 'undefined') - return { - case: undefined, - value: undefined, - } - if (parent.type === 'url') - return { case: 'parentUrl', value: parent.url } as const - if (parent.type === 'cast') - return { - case: 'parentCastId', - value: CastId_toProtobuf(parent), - } as const - - throw new Parent_InvalidParentTypeError({ parent }) -} - -export declare namespace Parent_toProtobuf { - type ParametersType = Parent | undefined - type ReturnType = MessageProtobuf.CastAddBody['parent'] - - type ErrorType = - | Parent_InvalidParentTypeError - | CastId_toProtobuf.ErrorType - | GlobalErrorType -} -Parent_toProtobuf.parseError = (error: unknown) => - error as Parent_toProtobuf.ErrorType diff --git a/src/Node/Internal/Parent/types.ts b/src/Node/Internal/Parent/types.ts deleted file mode 100644 index 02a09ff..0000000 --- a/src/Node/Internal/Parent/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { CastId } from '../CastId/types.js' - -export type Parent = - | ({ - type: 'cast' - } & CastId) - | { - type: 'url' - url: string - } diff --git a/src/Node/Internal/Reaction/errors.ts b/src/Node/Internal/Reaction/errors.ts deleted file mode 100644 index 0af6425..0000000 --- a/src/Node/Internal/Reaction/errors.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseError } from 'ox/Errors' - -// @TODO: replace by our own BaseError -export class Reaction_InvalidMessageTypeError extends BaseError { - override readonly name = 'Reaction.InvalidMessageTypeError' - - constructor({ hash }: { hash: string }) { - super(`Message "${hash}" has type other than CAST_ADD.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/Reaction/fromMessageProtobuf.ts b/src/Node/Internal/Reaction/fromMessageProtobuf.ts deleted file mode 100644 index 80bbf19..0000000 --- a/src/Node/Internal/Reaction/fromMessageProtobuf.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Reaction_InvalidMessageTypeError } from '../Reaction/errors.js' -import { Reaction_fromProtobuf } from './fromProtobuf.js' -import type { Reaction } from './types.js' - -export function Reaction_fromMessageProtobuf( - message: Reaction_fromMessageProtobuf.ParametersType, -): Reaction_fromMessageProtobuf.ReturnType { - const meta = Meta_fromProtobuf(message) - // @TODO: separate error here - if (!message.data) - throw new Error('`data` must be defined in Reaction message.') - if (message.data.body.case !== 'reactionBody') - throw new Reaction_InvalidMessageTypeError({ hash: meta.hash }) - return Reaction_fromProtobuf({ - body: message.data.body.value, - meta, - fid: message.data.fid, - timestamp: message.data.timestamp, - }) -} - -export declare namespace Reaction_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = Reaction - type ErrorType = - | Reaction_InvalidMessageTypeError - | Meta_fromProtobuf.ErrorType - | GlobalErrorType -} - -Reaction_fromMessageProtobuf.parseError = (error: unknown) => - error as Reaction_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/Reaction/fromProtobuf.ts b/src/Node/Internal/Reaction/fromProtobuf.ts deleted file mode 100644 index f2d7aa2..0000000 --- a/src/Node/Internal/Reaction/fromProtobuf.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Meta } from '../Meta/types.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { ReactionTarget_fromProtobuf } from '../ReactionTarget/fromProtobuf.js' -import { ReactionType_fromProtobuf } from '../ReactionType/fromProtobuf.js' -import type { Reaction } from './types.js' - -export function Reaction_fromProtobuf( - parameters: Reaction_fromProtobuf.ParametersType, -): Reaction_fromProtobuf.ReturnType { - return { - meta: parameters.meta, - fid: parameters.fid, - timestamp: parameters.timestamp, - type: ReactionType_fromProtobuf(parameters.body.type), - target: ReactionTarget_fromProtobuf(parameters.body.target), - } as const -} - -export declare namespace Reaction_fromProtobuf { - type ParametersType = { - body: MessageProtobuf.ReactionBody - meta: Meta - fid: bigint - timestamp: number - } - type ReturnType = Reaction - type ErrorType = GlobalErrorType -} - -Reaction_fromProtobuf.parseError = (error: unknown) => - error as Reaction_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Reaction/toProtobuf.ts b/src/Node/Internal/Reaction/toProtobuf.ts deleted file mode 100644 index 93e6a9a..0000000 --- a/src/Node/Internal/Reaction/toProtobuf.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { ReactionTarget_toProtobuf } from '../ReactionTarget/toProtobuf.js' -import { ReactionType_toProtobuf } from '../ReactionType/toProtobuf.js' -import type { Reaction } from './types.js' - -export function Reaction_toProtobuf( - reaction: Reaction_toProtobuf.ParametersType, -): Reaction_toProtobuf.ReturnType { - return create(MessageProtobuf.ReactionBodySchema, { - type: ReactionType_toProtobuf(reaction.type), - target: ReactionTarget_toProtobuf(reaction.target), - }) -} - -export declare namespace Reaction_toProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.ReactionBody - - type ErrorType = GlobalErrorType -} - -Reaction_toProtobuf.parseError = (error: unknown) => - error as Reaction_toProtobuf.ErrorType diff --git a/src/Node/Internal/Reaction/types.ts b/src/Node/Internal/Reaction/types.ts deleted file mode 100644 index 1b620cc..0000000 --- a/src/Node/Internal/Reaction/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Meta } from '../Meta/types.js' -import type { ReactionTarget } from '../ReactionTarget//types.js' -import type { ReactionType } from '../ReactionType//types.js' - -export type Reaction = { - meta: Meta - fid: bigint - timestamp: number - type: ReactionType - target: ReactionTarget -} diff --git a/src/Node/Internal/ReactionAdd/toHex.ts b/src/Node/Internal/ReactionAdd/toHex.ts deleted file mode 100644 index 2c81613..0000000 --- a/src/Node/Internal/ReactionAdd/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import type { Reaction } from '../Reaction/types.js' -import { ReactionAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function ReactionAdd_toHex( - cast: ReactionAdd_toHex.ParametersType, -): ReactionAdd_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - ReactionAdd_toMessageDataProtobuf(cast), - ), - ) -} - -export declare namespace ReactionAdd_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -ReactionAdd_toHex.parseError = (error: unknown) => - error as ReactionAdd_toHex.ErrorType diff --git a/src/Node/Internal/ReactionAdd/toMessageDataProtobuf.ts b/src/Node/Internal/ReactionAdd/toMessageDataProtobuf.ts deleted file mode 100644 index dfe111d..0000000 --- a/src/Node/Internal/ReactionAdd/toMessageDataProtobuf.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Reaction_toProtobuf } from '../Reaction/toProtobuf.js' -import type { Reaction } from '../Reaction/types.js' - -export function ReactionAdd_toMessageDataProtobuf( - cast: ReactionAdd_toMessageDataProtobuf.ParametersType, -): ReactionAdd_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: cast.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.REACTION_ADD, - fid: cast.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'reactionBody', - value: Reaction_toProtobuf(cast), - }, - }) -} - -export declare namespace ReactionAdd_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -ReactionAdd_toMessageDataProtobuf.parseError = (error: unknown) => - error as ReactionAdd_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionAdd/toMessageProtobuf.ts b/src/Node/Internal/ReactionAdd/toMessageProtobuf.ts deleted file mode 100644 index 4ec434f..0000000 --- a/src/Node/Internal/ReactionAdd/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Reaction } from '../Reaction/types.js' -import { ReactionAdd_toHex } from './toHex.js' -import { ReactionAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function ReactionAdd_toMessageProtobuf( - parameters: ReactionAdd_toMessageProtobuf.ParametersType, -): ReactionAdd_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: ReactionAdd_toHex(parameters.reaction), - privateKey: parameters.privateKey, - }), - ), - data: ReactionAdd_toMessageDataProtobuf(parameters.reaction), - }) -} - -export declare namespace ReactionAdd_toMessageProtobuf { - type ParametersType = { - reaction: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -ReactionAdd_toMessageProtobuf.parseError = (error: unknown) => - error as ReactionAdd_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionRemove/toHex.ts b/src/Node/Internal/ReactionRemove/toHex.ts deleted file mode 100644 index 7fd13bd..0000000 --- a/src/Node/Internal/ReactionRemove/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import type { Reaction } from '../Reaction/types.js' -import { ReactionRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function ReactionRemove_toHex( - cast: ReactionRemove_toHex.ParametersType, -): ReactionRemove_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - ReactionRemove_toMessageDataProtobuf(cast), - ), - ) -} - -export declare namespace ReactionRemove_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -ReactionRemove_toHex.parseError = (error: unknown) => - error as ReactionRemove_toHex.ErrorType diff --git a/src/Node/Internal/ReactionRemove/toMessageDataProtobuf.ts b/src/Node/Internal/ReactionRemove/toMessageDataProtobuf.ts deleted file mode 100644 index e13f846..0000000 --- a/src/Node/Internal/ReactionRemove/toMessageDataProtobuf.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Reaction_toProtobuf } from '../Reaction/toProtobuf.js' -import type { Reaction } from '../Reaction/types.js' - -export function ReactionRemove_toMessageDataProtobuf( - cast: ReactionRemove_toMessageDataProtobuf.ParametersType, -): ReactionRemove_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: cast.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.REACTION_REMOVE, - fid: cast.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'reactionBody', - value: Reaction_toProtobuf(cast), - }, - }) -} - -export declare namespace ReactionRemove_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -ReactionRemove_toMessageDataProtobuf.parseError = (error: unknown) => - error as ReactionRemove_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionRemove/toMessageProtobuf.ts b/src/Node/Internal/ReactionRemove/toMessageProtobuf.ts deleted file mode 100644 index d3fa33e..0000000 --- a/src/Node/Internal/ReactionRemove/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Reaction } from '../Reaction/types.js' -import { ReactionRemove_toHex } from './toHex.js' -import { ReactionRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function ReactionRemove_toMessageProtobuf( - parameters: ReactionRemove_toMessageProtobuf.ParametersType, -): ReactionRemove_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: ReactionRemove_toHex(parameters.reaction), - privateKey: parameters.privateKey, - }), - ), - data: ReactionRemove_toMessageDataProtobuf(parameters.reaction), - }) -} - -export declare namespace ReactionRemove_toMessageProtobuf { - type ParametersType = { - reaction: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -ReactionRemove_toMessageProtobuf.parseError = (error: unknown) => - error as ReactionRemove_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionTarget/fromProtobuf.ts b/src/Node/Internal/ReactionTarget/fromProtobuf.ts deleted file mode 100644 index 6e9096f..0000000 --- a/src/Node/Internal/ReactionTarget/fromProtobuf.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_fromProtobuf } from '../CastId/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { ReactionTarget } from './types.js' - -export function ReactionTarget_fromProtobuf( - target: MessageProtobuf.ReactionBody['target'], -): ReactionTarget_fromProtobuf.ReturnType { - return target.case === 'targetUrl' - ? { - type: 'url', - url: target.value, - } - : { - type: 'cast', - ...CastId_fromProtobuf(target.value!), - } -} - -export declare namespace ReactionTarget_fromProtobuf { - type ReturnType = ReactionTarget - - type ErrorType = GlobalErrorType -} - -ReactionTarget_fromProtobuf.parseError = (error: unknown) => - error as ReactionTarget_fromProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionTarget/toProtobuf.ts b/src/Node/Internal/ReactionTarget/toProtobuf.ts deleted file mode 100644 index b332ed0..0000000 --- a/src/Node/Internal/ReactionTarget/toProtobuf.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { CastId_toProtobuf } from '../CastId/toProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { ReactionTarget } from './types.js' - -export function ReactionTarget_toProtobuf( - target: ReactionTarget_toProtobuf.ParametersType, -): ReactionTarget_toProtobuf.ReturnType { - return target.type === 'cast' - ? { value: CastId_toProtobuf(target), case: 'targetCastId' } - : { value: target.url, case: 'targetUrl' } -} - -export declare namespace ReactionTarget_toProtobuf { - type ParametersType = ReactionTarget - type ReturnType = MessageProtobuf.ReactionBody['target'] - - type ErrorTarget = GlobalErrorType -} - -ReactionTarget_toProtobuf.parseError = (error: unknown) => - error as ReactionTarget_toProtobuf.ErrorTarget diff --git a/src/Node/Internal/ReactionTarget/types.ts b/src/Node/Internal/ReactionTarget/types.ts deleted file mode 100644 index 4ee6ba4..0000000 --- a/src/Node/Internal/ReactionTarget/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { CastId } from '../CastId/types.js' - -export type ReactionTarget = - | ({ - type: 'cast' - } & CastId) - | { - type: 'url' - url: string - } diff --git a/src/Node/Internal/ReactionType/fromProtobuf.ts b/src/Node/Internal/ReactionType/fromProtobuf.ts deleted file mode 100644 index 7341da5..0000000 --- a/src/Node/Internal/ReactionType/fromProtobuf.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { ReactionType } from './types.js' - -export function ReactionType_fromProtobuf( - reactionType: ReactionType_fromProtobuf.ParametersType, -): ReactionType_fromProtobuf.ReturnType { - return reactionType === MessageProtobuf.ReactionType.RECAST - ? ('recast' as const) - : ('like' as const) -} - -export declare namespace ReactionType_fromProtobuf { - type ParametersType = MessageProtobuf.ReactionType - type ReturnType = ReactionType - type ErrorType = GlobalErrorType -} - -ReactionType_fromProtobuf.parseError = (error: unknown) => - error as ReactionType_fromProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionType/toProtobuf.ts b/src/Node/Internal/ReactionType/toProtobuf.ts deleted file mode 100644 index fa8d3e1..0000000 --- a/src/Node/Internal/ReactionType/toProtobuf.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { ReactionType } from './types.js' - -export function ReactionType_toProtobuf( - type: ReactionType_toProtobuf.ParametersType, -): ReactionType_toProtobuf.ReturnType { - if (type === 'like') return MessageProtobuf.ReactionType.LIKE - if (type === 'recast') return MessageProtobuf.ReactionType.RECAST - // @TODO: error - throw new Error('unknwo tyep') -} - -export declare namespace ReactionType_toProtobuf { - type ParametersType = ReactionType - type ReturnType = MessageProtobuf.ReactionType - - type ErrorType = GlobalErrorType -} - -ReactionType_toProtobuf.parseError = (error: unknown) => - error as ReactionType_toProtobuf.ErrorType diff --git a/src/Node/Internal/ReactionType/types.ts b/src/Node/Internal/ReactionType/types.ts deleted file mode 100644 index dd94123..0000000 --- a/src/Node/Internal/ReactionType/types.ts +++ /dev/null @@ -1 +0,0 @@ -export type ReactionType = 'like' | 'recast' diff --git a/src/Node/Internal/UserData/errors.ts b/src/Node/Internal/UserData/errors.ts deleted file mode 100644 index e2de798..0000000 --- a/src/Node/Internal/UserData/errors.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseError } from 'ox/Errors' - -// @TODO: replace by our own BaseError -export class UserData_InvalidMessageTypeError extends BaseError { - override readonly name = 'UserData.InvalidMessageTypeError' - - constructor({ hash }: { hash: string }) { - super(`Message "${hash}" has type other than USER_DATA_ADD.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/UserData/types.ts b/src/Node/Internal/UserData/types.ts deleted file mode 100644 index cf9b62f..0000000 --- a/src/Node/Internal/UserData/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { Meta } from '../Meta/types.js' - -export type UserData = { - meta: Meta - type: 'none' | 'pfp' | 'display' | 'bio' | 'url' | 'username' | 'location' - value: string -} diff --git a/src/Node/Internal/UsernameProof/fromMessageProtobuf.ts b/src/Node/Internal/UsernameProof/fromMessageProtobuf.ts deleted file mode 100644 index 78456cb..0000000 --- a/src/Node/Internal/UsernameProof/fromMessageProtobuf.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { UsernameProof_fromProtobuf } from './fromProtobuf.js' -import type { UsernameProof } from './types.js' - -export function UsernameProof_fromMessageProtobuf( - message: UsernameProof_fromMessageProtobuf.ParametersType, -): UsernameProof_fromMessageProtobuf.ReturnType { - // @TODO: error here - if (message.data?.body.case !== 'usernameProofBody') - throw new Error('invalid type') - return { - meta: Meta_fromProtobuf(message), - ...UsernameProof_fromProtobuf(message.data.body.value), - } -} - -export declare namespace UsernameProof_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = UsernameProof - type ErrorType = GlobalErrorType -} - -UsernameProof_fromMessageProtobuf.parseError = (error: unknown) => - error as UsernameProof_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/UsernameProof/fromProtobuf.ts b/src/Node/Internal/UsernameProof/fromProtobuf.ts deleted file mode 100644 index 5e259e6..0000000 --- a/src/Node/Internal/UsernameProof/fromProtobuf.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as UsernameProofProtobuf from '../Protobufs/username_proof_pb.js' -import type { UsernameProof } from './types.js' - -export function UsernameProof_fromProtobuf( - message: UsernameProof_fromProtobuf.ParametersType, -): UsernameProof_fromProtobuf.ReturnType { - // @TODO: error here - return { - type: - message.type === UsernameProofProtobuf.UserNameType.USERNAME_TYPE_FNAME - ? 'fname' - : 'ensL1', - name: Buffer.from(message.name).toString(), - owner: Hex.fromBytes(message.owner).toString(), - signature: Hex.fromBytes(message.signature), - timestamp: message.timestamp, - fid: message.fid, - } -} - -export declare namespace UsernameProof_fromProtobuf { - type ParametersType = UsernameProofProtobuf.UserNameProof - type ReturnType = Omit - type ErrorType = GlobalErrorType -} - -UsernameProof_fromProtobuf.parseError = (error: unknown) => - error as UsernameProof_fromProtobuf.ErrorType diff --git a/src/Node/Internal/UsernameProof/types.ts b/src/Node/Internal/UsernameProof/types.ts deleted file mode 100644 index 08018de..0000000 --- a/src/Node/Internal/UsernameProof/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Types } from 'ox' -import type { Meta } from '../Meta/types.js' - -export type UsernameProof = { - meta: Meta - timestamp: bigint - name: string - owner: string - signature: Types.Hex - fid: bigint - type: 'fname' | 'ensL1' -} diff --git a/src/Node/Internal/Verification/fromProtobuf.ts b/src/Node/Internal/Verification/fromProtobuf.ts deleted file mode 100644 index b07437c..0000000 --- a/src/Node/Internal/Verification/fromProtobuf.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import type { Meta } from '../Meta/types.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Verification } from './types.js' - -export function Verification_fromProtobuf( - parameters: Verification_fromProtobuf.ParametersType, -): Verification_fromProtobuf.ReturnType { - return { - meta: parameters.meta, - fid: parameters.fid, - timestamp: parameters.timestamp, - type: parameters.body.verificationType === 0 ? 'eoa' : 'contract', - address: parameters.body.address.toString(), - claimSignature: Hex.fromBytes(parameters.body.claimSignature), - blockHash: Hex.fromBytes(parameters.body.blockHash), - chainId: parameters.body.chainId, - protocol: - parameters.body.protocol === MessageProtobuf.Protocol.SOLANA - ? 'solana' - : 'ethereum', - } as const -} - -export declare namespace Verification_fromProtobuf { - type ParametersType = { - body: MessageProtobuf.VerificationAddAddressBody - meta: Meta - fid: bigint - timestamp: number - } - type ReturnType = Verification - - type ErrorType = GlobalErrorType -} - -Verification_fromProtobuf.parseError = (error: unknown) => - error as Verification_fromProtobuf.ErrorType diff --git a/src/Node/Internal/Verification/toProtobuf.ts b/src/Node/Internal/Verification/toProtobuf.ts deleted file mode 100644 index 47fc9c9..0000000 --- a/src/Node/Internal/Verification/toProtobuf.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Verification } from './types.js' - -export function Verification_toProtobuf( - verification: Verification_toProtobuf.ParametersType, -): Verification_toProtobuf.ReturnType { - return create(MessageProtobuf.VerificationAddAddressBodySchema, { - verificationType: verification.type === 'eoa' ? 0 : 1, - address: Hex.toBytes(Hex.fromString(verification.address)), - claimSignature: Hex.toBytes(verification.claimSignature), - blockHash: Hex.toBytes(verification.blockHash), - chainId: verification.chainId, - protocol: - verification.protocol === 'ethereum' - ? MessageProtobuf.Protocol.ETHEREUM - : MessageProtobuf.Protocol.SOLANA, - }) -} - -export declare namespace Verification_toProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.VerificationAddAddressBody - - type ErrorType = GlobalErrorType -} - -Verification_toProtobuf.parseError = (error: unknown) => - error as Verification_toProtobuf.ErrorType diff --git a/src/Node/Internal/Verification/types.ts b/src/Node/Internal/Verification/types.ts deleted file mode 100644 index b8749e8..0000000 --- a/src/Node/Internal/Verification/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Types } from 'ox' -import type { Meta } from '../Meta/types.js' - -export type Verification = { - meta: Meta - address: string - claimSignature: Types.Hex - blockHash: Types.Hex - type: 'eoa' | 'contract' - chainId: number - protocol: 'ethereum' | 'solana' - fid: bigint - timestamp: number -} diff --git a/src/Node/Internal/VerificationAdd/errors.ts b/src/Node/Internal/VerificationAdd/errors.ts deleted file mode 100644 index fd14396..0000000 --- a/src/Node/Internal/VerificationAdd/errors.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseError } from 'ox/Errors' - -// @TODO: replace by our own BaseError -export class VerificationAdd_InvalidMessageTypeError extends BaseError { - override readonly name = 'VerificationAdd.InvalidMessageTypeError' - - constructor({ hash }: { hash: string }) { - super(`Message "${hash}" has type other than CAST_ADD.`, { - docsPath: '/errors#invalidmessagetypeerror', - }) - } -} diff --git a/src/Node/Internal/VerificationAdd/fromMessageProtobuf.ts b/src/Node/Internal/VerificationAdd/fromMessageProtobuf.ts deleted file mode 100644 index 05f42d3..0000000 --- a/src/Node/Internal/VerificationAdd/fromMessageProtobuf.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import type * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Verification_fromProtobuf } from '../Verification/fromProtobuf.js' -import type { Verification } from '../Verification/types.js' -import { VerificationAdd_InvalidMessageTypeError } from './errors.js' - -export function VerificationAdd_fromMessageProtobuf( - message: VerificationAdd_fromMessageProtobuf.ParametersType, -): VerificationAdd_fromMessageProtobuf.ReturnType { - const meta = Meta_fromProtobuf(message) - // @TODO: separate error here - if (!message.data) - throw new Error('`data` must be defined in VerificationAdd message.') - if (message.data.body.case !== 'verificationAddAddressBody') - throw new VerificationAdd_InvalidMessageTypeError({ hash: meta.hash }) - return Verification_fromProtobuf({ - body: message.data.body.value, - meta, - fid: message.data.fid, - timestamp: message.data.timestamp, - }) -} - -export declare namespace VerificationAdd_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = Verification - type ErrorType = - | VerificationAdd_InvalidMessageTypeError - | Meta_fromProtobuf.ErrorType - | GlobalErrorType -} - -VerificationAdd_fromMessageProtobuf.parseError = (error: unknown) => - error as VerificationAdd_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/VerificationAdd/toHex.ts b/src/Node/Internal/VerificationAdd/toHex.ts deleted file mode 100644 index 7550980..0000000 --- a/src/Node/Internal/VerificationAdd/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import type { Verification } from '../Verification/types.js' -import { VerificationAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function VerificationAdd_toHex( - cast: VerificationAdd_toHex.ParametersType, -): VerificationAdd_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - VerificationAdd_toMessageDataProtobuf(cast), - ), - ) -} - -export declare namespace VerificationAdd_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -VerificationAdd_toHex.parseError = (error: unknown) => - error as VerificationAdd_toHex.ErrorType diff --git a/src/Node/Internal/VerificationAdd/toMessageDataProtobuf.ts b/src/Node/Internal/VerificationAdd/toMessageDataProtobuf.ts deleted file mode 100644 index aff06fc..0000000 --- a/src/Node/Internal/VerificationAdd/toMessageDataProtobuf.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { Verification_toProtobuf } from '../Verification/toProtobuf.js' -import type { Verification } from '../Verification/types.js' - -export function VerificationAdd_toMessageDataProtobuf( - verification: VerificationAdd_toMessageDataProtobuf.ParametersType, -): VerificationAdd_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: verification.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.VERIFICATION_ADD_ETH_ADDRESS, - fid: verification.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'verificationAddAddressBody', - value: Verification_toProtobuf(verification), - }, - }) -} - -export declare namespace VerificationAdd_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -VerificationAdd_toMessageDataProtobuf.parseError = (error: unknown) => - error as VerificationAdd_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/VerificationAdd/toMessageProtobuf.ts b/src/Node/Internal/VerificationAdd/toMessageProtobuf.ts deleted file mode 100644 index 60365e3..0000000 --- a/src/Node/Internal/VerificationAdd/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { Verification } from '../Verification/types.js' -import { VerificationAdd_toHex } from './toHex.js' -import { VerificationAdd_toMessageDataProtobuf } from './toMessageDataProtobuf.js' - -export function VerificationAdd_toMessageProtobuf( - parameters: VerificationAdd_toMessageProtobuf.ParametersType, -): VerificationAdd_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: VerificationAdd_toHex(parameters.verification), - privateKey: parameters.privateKey, - }), - ), - data: VerificationAdd_toMessageDataProtobuf(parameters.verification), - }) -} - -export declare namespace VerificationAdd_toMessageProtobuf { - type ParametersType = { - verification: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -VerificationAdd_toMessageProtobuf.parseError = (error: unknown) => - error as VerificationAdd_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/VerificationRemoval/fromMessageProtobuf.ts b/src/Node/Internal/VerificationRemoval/fromMessageProtobuf.ts deleted file mode 100644 index cec390b..0000000 --- a/src/Node/Internal/VerificationRemoval/fromMessageProtobuf.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { VerificationRemove } from './types.js' - -export function VerificationRemove_fromMessageProtobuf( - message: VerificationRemove_fromMessageProtobuf.ParametersType, -): VerificationRemove_fromMessageProtobuf.ReturnType { - //@TODO: errors - if (!message.data) throw new Error('no data') - if (message.data.body.case !== 'verificationRemoveBody') - throw new Error('bad case') - - return { - fid: message.data.fid, - timestamp: message.data.timestamp, - meta: Meta_fromProtobuf(message), - address: message.data.body.value.address.toString(), - protocol: - message.data.body.value.protocol === MessageProtobuf.Protocol.SOLANA - ? 'solana' - : 'ethereum', - } as const -} - -export declare namespace VerificationRemove_fromMessageProtobuf { - type ParametersType = MessageProtobuf.Message - type ReturnType = VerificationRemove - type ErrorType = GlobalErrorType -} - -VerificationRemove_fromMessageProtobuf.parseError = (error: unknown) => - error as VerificationRemove_fromMessageProtobuf.ErrorType diff --git a/src/Node/Internal/VerificationRemoval/toHex.ts b/src/Node/Internal/VerificationRemoval/toHex.ts deleted file mode 100644 index 28d4fd9..0000000 --- a/src/Node/Internal/VerificationRemoval/toHex.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { toBinary } from '@bufbuild/protobuf' -import { Hex, type Types } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import * as Protobuf from '../Protobufs/message_pb.js' -import { VerificationRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' -import type { VerificationRemove } from './types.js' - -export function VerificationRemove_toHex( - cast: VerificationRemove_toHex.ParametersType, -): VerificationRemove_toHex.ReturnType { - return Hex.fromBytes( - toBinary( - Protobuf.MessageDataSchema, - VerificationRemove_toMessageDataProtobuf(cast), - ), - ) -} - -export declare namespace VerificationRemove_toHex { - type ParametersType = Omit - type ReturnType = Types.Hex - type ErrorType = GlobalErrorType -} - -VerificationRemove_toHex.parseError = (error: unknown) => - error as VerificationRemove_toHex.ErrorType diff --git a/src/Node/Internal/VerificationRemoval/toMessageDataProtobuf.ts b/src/Node/Internal/VerificationRemoval/toMessageDataProtobuf.ts deleted file mode 100644 index 31ecb2f..0000000 --- a/src/Node/Internal/VerificationRemoval/toMessageDataProtobuf.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { FARCASTER_EPOCH_TIMESTAMP } from '../Constants.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import type { VerificationRemove } from './types.js' - -export function VerificationRemove_toMessageDataProtobuf( - verificationRemove: VerificationRemove_toMessageDataProtobuf.ParametersType, -): VerificationRemove_toMessageDataProtobuf.ReturnType { - return create(MessageProtobuf.MessageDataSchema, { - timestamp: verificationRemove.timestamp - FARCASTER_EPOCH_TIMESTAMP, - type: MessageProtobuf.MessageType.VERIFICATION_REMOVE, - fid: verificationRemove.fid, - network: MessageProtobuf.FarcasterNetwork.MAINNET, - body: { - case: 'verificationRemoveBody', - value: create(MessageProtobuf.VerificationRemoveBodySchema, { - address: Hex.toBytes(Hex.fromString(verificationRemove.address)), - protocol: - verificationRemove.protocol === 'solana' - ? MessageProtobuf.Protocol.SOLANA - : MessageProtobuf.Protocol.ETHEREUM, - }), - }, - }) -} - -export declare namespace VerificationRemove_toMessageDataProtobuf { - type ParametersType = Omit - type ReturnType = MessageProtobuf.MessageData - - type ErrorType = GlobalErrorType -} - -VerificationRemove_toMessageDataProtobuf.parseError = (error: unknown) => - error as VerificationRemove_toMessageDataProtobuf.ErrorType diff --git a/src/Node/Internal/VerificationRemoval/toMessageProtobuf.ts b/src/Node/Internal/VerificationRemoval/toMessageProtobuf.ts deleted file mode 100644 index 116ef5b..0000000 --- a/src/Node/Internal/VerificationRemoval/toMessageProtobuf.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { create } from '@bufbuild/protobuf' -import type { Types } from 'ox' -import type { Omit } from 'ox/Internal' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_create } from '../Meta/create.js' -import { Meta_toProtobuf } from '../Meta/toProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { VerificationRemove_toHex } from './toHex.js' -import { VerificationRemove_toMessageDataProtobuf } from './toMessageDataProtobuf.js' -import type { VerificationRemove } from './types.js' - -export function VerificationRemove_toMessageProtobuf( - parameters: VerificationRemove_toMessageProtobuf.ParametersType, -): VerificationRemove_toMessageProtobuf.ReturnType { - return create(MessageProtobuf.MessageSchema, { - ...Meta_toProtobuf( - Meta_create({ - dataBytes: VerificationRemove_toHex(parameters.castRemove), - privateKey: parameters.privateKey, - }), - ), - data: VerificationRemove_toMessageDataProtobuf(parameters.castRemove), - }) -} - -export declare namespace VerificationRemove_toMessageProtobuf { - type ParametersType = { - castRemove: Omit - privateKey: Types.Hex - } - type ReturnType = MessageProtobuf.Message - - // @TODO: errors - type ErrorType = GlobalErrorType -} - -VerificationRemove_toMessageProtobuf.parseError = (error: unknown) => - error as VerificationRemove_toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/VerificationRemoval/types.ts b/src/Node/Internal/VerificationRemoval/types.ts deleted file mode 100644 index b3eeece..0000000 --- a/src/Node/Internal/VerificationRemoval/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Meta } from '../Meta/types.js' - -export type VerificationRemove = { - meta: Meta - address: string - protocol: 'ethereum' | 'solana' - fid: bigint - timestamp: number -} diff --git a/src/Node/Types.ts b/src/Node/Types.ts deleted file mode 100644 index 777b615..0000000 --- a/src/Node/Types.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type { Cast } from './Internal/Cast/types.js' -export type { CastId } from './Internal/CastId/types.js' -export type { Embed } from './Internal/Embed/types.js' -export type { Parent } from './Internal/Parent/types.js' -export type { Meta } from './Internal/Meta/types.js' -export type { Link } from './Internal/Link/types.js' -export type { Message } from './Internal/Message/types.js' -export type { UserData } from './Internal/UserData/types.js' -export type { Reaction } from './Internal/Reaction/types.js' -export type { ReactionTarget } from './Internal/ReactionTarget/types.js' -export type { NextPageToken } from './Internal/Pagination/types.js' diff --git a/src/Node/index.ts b/src/Node/index.ts deleted file mode 100644 index 7d0cb3b..0000000 --- a/src/Node/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * as Actions from './Actions.js' -export * as Types from './Types.js' -export * as Constants from './Constants.js' diff --git a/src/Node/package.json b/src/Node/package.json deleted file mode 100644 index 1695bce..0000000 --- a/src/Node/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "module", - "types": "../_types/Node/index.d.ts", - "module": "../_esm/Node/index.js", - "main": "../_cjs/Node/index.js" -} diff --git a/src/Transport.ts b/src/Transport.ts deleted file mode 100644 index f6dfb73..0000000 --- a/src/Transport.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { Transport_grpcWeb as grpcWeb } from './Internal/Transport/grpcWeb.js' -export { Transport_grpcNode as grpcNode } from './Internal/Transport/grpcNode.js' -export { Transport_connectNode as connectNode } from './Internal/Transport/connectNode.js' -export { Transport_connectWeb as connectWeb } from './Internal/Transport/connectWeb.js' diff --git a/src/Transport/package.json b/src/Transport/package.json deleted file mode 100644 index a947a3c..0000000 --- a/src/Transport/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "module", - "types": "../../_types/Transport.d.ts", - "module": "../../_esm/Transport.js", - "main": "../../_cjs/Transport.js" -} diff --git a/src/core/Actions.ts b/src/core/Actions.ts new file mode 100644 index 0000000..b4aa752 --- /dev/null +++ b/src/core/Actions.ts @@ -0,0 +1,10 @@ +export * as Cast from './actions/Cast.js' +export * as Event from './actions/Event.js' +export * as Link from './actions/Link.js' +export * as OnChainEvents from './actions/OnChainEvents.js' +export * as Reaction from './actions/Reaction.js' +export * as Submit from './actions/Submit.js' +export * as Sync from './actions/Sync.js' +export * as UserData from './actions/UserData.js' +export * as UsernameProof from './actions/UsernameProof.js' +export * as Verification from './actions/Verification.js' diff --git a/src/core/Cast.ts b/src/core/Cast.ts new file mode 100644 index 0000000..387a7ca --- /dev/null +++ b/src/core/Cast.ts @@ -0,0 +1,124 @@ +import { create } from '@bufbuild/protobuf' +import { BaseError } from 'ox/Errors' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import * as Embed from './Embed.js' +import type { GlobalErrorType } from './Error.js' +import type * as Meta from './Meta.js' +import * as Parent from './Parent.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type Cast = { + meta: Meta.Meta + fid: bigint + timestamp: number + parent?: Parent.Parent | undefined + text: { + value: string + embeds?: Embed.Embed[] | undefined + mentions?: + | { + fid: bigint + position: number + }[] + | undefined + } + isLong: boolean +} + +export class InvalidEmbedsError extends BaseError { + override readonly name = 'Cast.InvalidEmbedsError' + + constructor({ hash }: { hash: string }) { + super(`Embeds "${hash}" has undefined.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export function fromProtobuf( + parameters: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + const isLong = parameters.body.type === MessageProtobuf.CastType.LONG_CAST + const mentions = (() => { + if (parameters.body.mentions.length === 0) return undefined + const mentions = [] + for (let i = 0; i < parameters.body.mentions.length; i++) { + mentions.push({ + fid: parameters.body.mentions[i], + position: parameters.body.mentionsPositions[i], + }) + } + return mentions + })() + + const embeds = (() => { + if (parameters.body.embeds.length === 0) return undefined + const embedsOrUndefineds = parameters.body.embeds.map(({ embed }) => + Embed.fromProtobuf(embed), + ) + if (embedsOrUndefineds.indexOf(undefined) !== -1) + throw new InvalidEmbedsError({ hash: parameters.meta.hash }) + return embedsOrUndefineds as Embed.Embed[] + })() + const parent = Parent.fromProtobuf(parameters.body.parent) + + return { + meta: parameters.meta, + isLong, + text: { + mentions, + embeds, + value: parameters.body.text, + }, + fid: parameters.fid, + timestamp: FARCASTER_EPOCH_TIMESTAMP + parameters.timestamp, + parent, + } +} + +export declare namespace fromProtobuf { + type ParametersType = { + body: MessageProtobuf.CastAddBody + meta: Meta.Meta + fid: bigint + timestamp: number + } + type ReturnType = Cast + type ErrorType = + | Embed.fromProtobuf.ErrorType + | Parent.fromProtobuf.ErrorType + | GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + cast: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return create(MessageProtobuf.CastAddBodySchema, { + type: cast.isLong + ? MessageProtobuf.CastType.LONG_CAST + : MessageProtobuf.CastType.CAST, + embedsDeprecated: [], + embeds: cast.text.embeds ? cast.text.embeds.map(Embed.toProtobuf) : [], + mentions: cast.text.mentions + ? cast.text.mentions.map((mention) => mention.fid) + : [], + mentionsPositions: cast.text.mentions + ? cast.text.mentions.map((mention) => mention.position) + : [], + parent: cast.parent + ? Parent.toProtobuf(cast.parent) + : { case: undefined, value: undefined }, + text: cast.text.value, + }) +} + +export declare namespace toProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.CastAddBody + + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/CastAdd.ts b/src/core/CastAdd.ts new file mode 100644 index 0000000..f43a824 --- /dev/null +++ b/src/core/CastAdd.ts @@ -0,0 +1,117 @@ +import { BaseError } from 'ox/Errors' + +import { create, toBinary } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import * as Cast from './Cast.js' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' +// +// @TODO: replace by our own BaseError +export class InvalidMessageTypeError extends BaseError { + override readonly name = 'CastAdd.InvalidMessageTypeError' + + constructor({ hash }: { hash: string }) { + super(`Message "${hash}" has type other than CAST_ADD.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + const meta = Meta.fromProtobuf(message) + // @TODO: separate error here + if (!message.data) + throw new Error('`data` must be defined in CastAdd message.') + if (message.data.body.case !== 'castAddBody') + throw new InvalidMessageTypeError({ hash: meta.hash }) + return Cast.fromProtobuf({ + body: message.data.body.value, + meta, + fid: message.data.fid, + timestamp: message.data.timestamp, + }) +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = Cast.Cast + type ErrorType = + | InvalidMessageTypeError + | Cast.fromProtobuf.ErrorType + | Meta.fromProtobuf.ErrorType + | GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function toHex(cast: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(cast)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageDataProtobuf( + cast: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: cast.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.CAST_ADD, + fid: cast.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'castAddBody', + value: Cast.toProtobuf(cast), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.cast), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.cast), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + cast: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/CastId.ts b/src/core/CastId.ts new file mode 100644 index 0000000..6eb122c --- /dev/null +++ b/src/core/CastId.ts @@ -0,0 +1,43 @@ +import { create } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import type { GlobalErrorType } from './Error.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type CastId = { + fid: bigint + hash: Types.Hex +} + +export function fromProtobuf( + castId: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + return { + fid: castId.fid, + hash: Hex.fromBytes(castId.hash), + } as const +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.CastId + type ReturnType = CastId + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + castId: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return create(MessageProtobuf.CastIdSchema, { + fid: castId.fid, + hash: Hex.toBytes(castId.hash), + }) +} + +export declare namespace toProtobuf { + type ParametersType = CastId + type ReturnType = MessageProtobuf.CastId + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/CastRemove.ts b/src/core/CastRemove.ts new file mode 100644 index 0000000..05825a9 --- /dev/null +++ b/src/core/CastRemove.ts @@ -0,0 +1,110 @@ +import { Hex, type Types } from 'ox' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +import { create, toBinary } from '@bufbuild/protobuf' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' + +export type CastRemove = { + meta: Meta.Meta + hash: Types.Hex + fid: bigint + timestamp: number +} + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + const meta = Meta.fromProtobuf(message) + + // @TODO: separate error here + if (!message.data) throw new Error('`data` must be defined in Cast message.') + if (message.data.body.case !== 'castRemoveBody') + throw new Error('no cast remove body') + + return { + meta, + hash: Hex.fromBytes(message.data.body.value.targetHash), + fid: message.data.fid, + timestamp: FARCASTER_EPOCH_TIMESTAMP + message.data.timestamp, + } +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = CastRemove + type ErrorType = Meta.fromProtobuf.ErrorType | GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function toHex(cast: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(cast)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageDataProtobuf( + castRemoval: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: castRemoval.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.CAST_REMOVE, + fid: castRemoval.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'castRemoveBody', + value: create(MessageProtobuf.CastRemoveBodySchema, { + targetHash: Hex.toBytes(castRemoval.hash), + }), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.castRemove), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.castRemove), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + castRemove: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/Node/Internal/Constants.ts b/src/core/Constants.ts similarity index 100% rename from src/Node/Internal/Constants.ts rename to src/core/Constants.ts diff --git a/src/core/Embed.ts b/src/core/Embed.ts new file mode 100644 index 0000000..72c4e9d --- /dev/null +++ b/src/core/Embed.ts @@ -0,0 +1,76 @@ +import { create } from '@bufbuild/protobuf' +import { BaseError } from 'ox/Errors' +import * as CastId from './CastId.js' +import type { GlobalErrorType } from './Error.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type Embed = + | ({ + type: 'cast' + } & CastId.CastId) + | { + type: 'url' + url: string + } + +export class InvalidEmbedTypeError extends BaseError { + override readonly name = 'Embed.InvalidEmbedTypeError' + + constructor({ embed }: { embed: any }) { + super(`Embed is invalid: ${JSON.stringify(embed, null, 2)}`, { + docsPath: '/errors#invalidembedtypeerror', + }) + } +} + +export function fromProtobuf( + embed: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + if (typeof embed.case === 'undefined') return undefined + if (embed.case === 'url') return { type: 'url', url: embed.value } as const + if (embed.case === 'castId') + return { + type: 'cast', + ...CastId.fromProtobuf(embed.value), + } as const + + throw new InvalidEmbedTypeError({ embed }) +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.Embed['embed'] + type ReturnType = Embed | undefined + type ErrorType = + | InvalidEmbedTypeError + | CastId.fromProtobuf.ErrorType + | GlobalErrorType +} +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + embed: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + if (embed.type === 'cast') + return create(MessageProtobuf.EmbedSchema, { + embed: { + case: 'castId', + value: CastId.toProtobuf(embed), + }, + }) + if (embed.type === 'url') + return create(MessageProtobuf.EmbedSchema, { + embed: { + case: 'url', + value: embed.url, + }, + }) + throw new Error() +} + +export declare namespace toProtobuf { + type ParametersType = Embed + type ReturnType = MessageProtobuf.Embed + + type ErrorType = GlobalErrorType +} +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/Internal/Errors/error.ts b/src/core/Error.ts similarity index 100% rename from src/Internal/Errors/error.ts rename to src/core/Error.ts diff --git a/src/core/FrameActionBody.ts b/src/core/FrameActionBody.ts new file mode 100644 index 0000000..4ec04a3 --- /dev/null +++ b/src/core/FrameActionBody.ts @@ -0,0 +1,44 @@ +import * as CastId from './CastId.js' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import type * as MessageProtobuf from './protobufs/message_pb.js' + +export type FrameActionBody = { + meta: Meta.Meta + url: string + buttonIndex: 1 | 2 | 3 | 4 + castId: CastId.CastId | undefined + inputText: string + state: string + transactionId: string + address: string +} + +export function fromProtobuf( + message: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + //@TODO: errors + if (!message.data) throw new Error('no data') + if (message.data.body.case !== 'frameActionBody') throw new Error('bad case') + + return { + meta: Meta.fromProtobuf(message), + url: message.data.body.value.url.toString(), + buttonIndex: message.data.body.value.buttonIndex as 1 | 2 | 3 | 4, + castId: message.data.body.value.castId + ? CastId.fromProtobuf(message.data.body.value.castId) + : undefined, + inputText: message.data.body.value.inputText.toString(), + state: message.data.body.value.state.toString(), + transactionId: message.data.body.value.transactionId.toString(), + address: message.data.body.value.address.toString(), + } as const +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = FrameActionBody + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType diff --git a/src/core/HubEvent.ts b/src/core/HubEvent.ts new file mode 100644 index 0000000..290a47c --- /dev/null +++ b/src/core/HubEvent.ts @@ -0,0 +1,74 @@ +import type { GlobalErrorType } from './Error.js' +import * as Message from './Message.js' +import * as HubEventProtobuf from './protobufs/hub_event_pb.js' + +export type HubEventType = 'mergeMessage' | 'pruneMessage' | 'revokeMessage' + +export type HubEvent = { + id: bigint +} & ( + | { + type: Exclude + message: Message.Message | undefined + } + | { + type: Extract + message: Message.Message | undefined + deletedMesssages: Message.Message[] + } +) + +export function fromProtobuf( + hubEvent: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + if ( + hubEvent.type === HubEventProtobuf.HubEventType.MERGE_MESSAGE && + hubEvent.body.case === 'mergeMessageBody' + ) { + return { + type: 'mergeMessage', + id: hubEvent.id, + message: hubEvent.body.value.message + ? Message.fromProtobuf(hubEvent.body.value.message) + : undefined, + deletedMesssages: hubEvent.body.value.deletedMessages.map( + Message.fromProtobuf, + ), + } + } + + if ( + hubEvent.type === HubEventProtobuf.HubEventType.PRUNE_MESSAGE && + hubEvent.body.case === 'pruneMessageBody' + ) { + return { + type: 'pruneMessage', + id: hubEvent.id, + message: hubEvent.body.value.message + ? Message.fromProtobuf(hubEvent.body.value.message) + : undefined, + } + } + + if ( + hubEvent.type === HubEventProtobuf.HubEventType.REVOKE_MESSAGE && + hubEvent.body.case === 'revokeMessageBody' + ) { + return { + type: 'revokeMessage', + id: hubEvent.id, + message: hubEvent.body.value.message + ? Message.fromProtobuf(hubEvent.body.value.message) + : undefined, + } + } + throw new Error('Not implemented') +} + +export declare namespace fromProtobuf { + type ParametersType = HubEventProtobuf.HubEvent + type ReturnType = HubEvent + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType diff --git a/src/core/Link.ts b/src/core/Link.ts new file mode 100644 index 0000000..f648c7f --- /dev/null +++ b/src/core/Link.ts @@ -0,0 +1,101 @@ +import { create } from '@bufbuild/protobuf' +import { BaseError } from 'ox/Errors' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type Link = { + meta: Meta.Meta + type: string + displayTimestamp?: number | undefined + timestamp: number + targetFid: bigint + fid: bigint +} + +export class InvalidMessageTypeError extends BaseError { + override readonly name = 'Link.InvalidMessageTypeError' + + constructor({ hash }: { hash: string }) { + super(`Message "${hash}" has type other than CAST_ADD.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + const meta = Meta.fromProtobuf(message) + // @TODO: separate error here + if (!message.data) throw new Error('`data` must be defined in Link message.') + if (message.data.body.case !== 'linkBody') + throw new InvalidMessageTypeError({ hash: meta.hash }) + return fromProtobuf({ + body: message.data.body.value, + meta, + fid: message.data.fid, + timestamp: message.data.timestamp, + }) +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = Link + type ErrorType = + | InvalidMessageTypeError + | Meta.fromProtobuf.ErrorType + | GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function fromProtobuf( + parameters: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + if (parameters.body.target.case !== 'targetFid') + throw new Error('Invalid target') + + return { + meta: parameters.meta, + type: parameters.body.type, + displayTimestamp: parameters.body.displayTimestamp, + targetFid: parameters.body.target.value, + fid: parameters.fid, + timestamp: parameters.timestamp, + } +} + +export declare namespace fromProtobuf { + type ParametersType = { + body: MessageProtobuf.LinkBody + meta: Meta.Meta + fid: bigint + timestamp: number + } + type ReturnType = Link + type ErrorType = GlobalErrorType +} +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + link: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return create(MessageProtobuf.LinkBodySchema, { + type: link.type, + ...(link.displayTimestamp + ? { displayTimestamp: link.displayTimestamp } + : {}), + target: { case: 'targetFid', value: link.targetFid }, + }) +} + +export declare namespace toProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.LinkBody + + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/LinkAdd.ts b/src/core/LinkAdd.ts new file mode 100644 index 0000000..d362e1d --- /dev/null +++ b/src/core/LinkAdd.ts @@ -0,0 +1,76 @@ +import { toBinary } from '@bufbuild/protobuf' +import { create } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import type { Omit } from 'ox/Internal' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' +import * as Link from './Link.js' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export function toMessageDataProtobuf( + link: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: link.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.LINK_ADD, + fid: link.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'linkBody', + value: Link.toProtobuf(link), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toHex(link: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(link)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.link), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.link), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + link: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/LinkCompactState.ts b/src/core/LinkCompactState.ts new file mode 100644 index 0000000..f564277 --- /dev/null +++ b/src/core/LinkCompactState.ts @@ -0,0 +1,111 @@ +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +import { create, toBinary } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' + +export type LinkCompactState = { + meta: Meta.Meta + type: string + fids: bigint[] + fid: bigint + timestamp: number +} + +//@TODO: errors +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + if (!message.data) throw new Error('Link must have data') + + if (message.data.body.case !== 'linkCompactStateBody') + throw new Error('Not linkCompactStateBody message') + + return { + meta: Meta.fromProtobuf(message), + type: message.data.body.value.type, + fids: message.data.body.value.targetFids, + fid: message.data.fid, + timestamp: message.data.timestamp, + } +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = LinkCompactState + type ErrorType = GlobalErrorType +} +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function toHex(link: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(link)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageDataProtobuf( + link: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: link.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.LINK_COMPACT_STATE, + fid: link.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'linkCompactStateBody', + value: create(MessageProtobuf.LinkCompactStateBodySchema, { + type: link.type, + targetFids: link.fids, + }), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.link), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.link), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + link: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/LinkRemove.ts b/src/core/LinkRemove.ts new file mode 100644 index 0000000..3fa6b65 --- /dev/null +++ b/src/core/LinkRemove.ts @@ -0,0 +1,76 @@ +import { toBinary } from '@bufbuild/protobuf' +import { create } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import type { Omit } from 'ox/Internal' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' +import * as Link from './Link.js' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export function toMessageDataProtobuf( + link: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: link.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.LINK_REMOVE, + fid: link.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'linkBody', + value: Link.toProtobuf(link), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toHex(link: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(link)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.link), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.link), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + link: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/Message.ts b/src/core/Message.ts new file mode 100644 index 0000000..92d968e --- /dev/null +++ b/src/core/Message.ts @@ -0,0 +1,139 @@ +import type * as Cast from './Cast.js' +import * as CastAdd from './CastAdd.js' +import * as CastRemove from './CastRemove.js' +import type { GlobalErrorType } from './Error.js' +import * as FrameActionBody from './FrameActionBody.js' +import * as Link from './Link.js' +import * as LinkCompactState from './LinkCompactState.js' +import * as Reaction from './Reaction.js' +import * as UserData from './UserData.js' +import * as UsernameProof from './UsernameProof.js' +import type * as Verification from './Verification.js' +import * as VerificationAdd from './VerificationAdd.js' +import * as VerificationRemove from './VerificationRemoval.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type Message = + | { + type: 'castAdd' + data: Cast.Cast + } + | { + type: 'castRemove' + data: CastRemove.CastRemove + } + | { + type: 'reactionAdd' | 'reactionRemove' + data: Reaction.Reaction + } + | { + type: 'userDataAdd' + data: UserData.UserData + } + | { + type: 'linkAdd' | 'linkRemove' + data: Link.Link + } + | { + type: 'verificationAdd' + data: Verification.Verification + } + | { + type: 'verificationRemove' + data: VerificationRemove.VerificationRemove + } + | { + type: 'usernameProof' + data: UsernameProof.UsernameProof + } + | { + type: 'frameAction' + data: FrameActionBody.FrameActionBody + } + | { + type: 'linkCompactState' + data: LinkCompactState.LinkCompactState + } + +export function fromProtobuf( + message: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + // @TODO: separate error here + if (!message.data) + throw new Error('`data` must be defined in Message message.') + if (message.data.type === MessageProtobuf.MessageType.CAST_ADD) + return { type: 'castAdd', data: CastAdd.fromMessageProtobuf(message) } + if ( + message.data.type === MessageProtobuf.MessageType.CAST_REMOVE && + message.data.body.case === 'castRemoveBody' + ) + return { + type: 'castRemove', + data: CastRemove.fromMessageProtobuf(message), + } + + if (message.data.type === MessageProtobuf.MessageType.REACTION_ADD) + return { + type: 'reactionAdd', + data: Reaction.fromMessageProtobuf(message), + } + if (message.data.type === MessageProtobuf.MessageType.REACTION_REMOVE) + return { + type: 'reactionRemove', + data: Reaction.fromMessageProtobuf(message), + } + if (message.data.type === MessageProtobuf.MessageType.LINK_ADD) + return { type: 'linkAdd', data: Link.fromMessageProtobuf(message) } + if (message.data.type === MessageProtobuf.MessageType.LINK_REMOVE) + return { type: 'linkRemove', data: Link.fromMessageProtobuf(message) } + if ( + message.data.type === + MessageProtobuf.MessageType.VERIFICATION_ADD_ETH_ADDRESS + ) { + return { + type: 'verificationAdd', + data: VerificationAdd.fromMessageProtobuf(message), + } + } + if (message.data.type === MessageProtobuf.MessageType.VERIFICATION_REMOVE) { + return { + type: 'verificationRemove', + data: VerificationRemove.fromMessageProtobuf(message), + } + } + // TODO: REFACTOR + + /// + /// + /// + if (message.data.type === MessageProtobuf.MessageType.USER_DATA_ADD) + return { type: 'userDataAdd', data: UserData.fromProtobuf(message) } + if (message.data.type === MessageProtobuf.MessageType.USERNAME_PROOF) + return { + type: 'usernameProof', + data: UsernameProof.fromMessageProtobuf(message), + } + if (message.data.type === MessageProtobuf.MessageType.FRAME_ACTION) + return { type: 'frameAction', data: FrameActionBody.fromProtobuf(message) } + + /// + ///// + ///// + ///// + ///// + if (message.data.type === MessageProtobuf.MessageType.LINK_COMPACT_STATE) + return { + type: 'linkCompactState', + data: LinkCompactState.fromMessageProtobuf(message), + } + throw new Error('Not expected') +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = Message + // @TODO: errors + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType diff --git a/src/core/Meta.ts b/src/core/Meta.ts new file mode 100644 index 0000000..8dffd3a --- /dev/null +++ b/src/core/Meta.ts @@ -0,0 +1,163 @@ +import * as ed from '@noble/ed25519' +import { blake3 } from '@noble/hashes/blake3' +import * as sha from '@noble/hashes/sha512' +import { Hex, type Types } from 'ox' +import { BaseError } from 'ox/Errors' +import type { GlobalErrorType } from './Error.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +// @TODO: replace by our own BaseError +export class InvalidHashSchemeTypeError extends BaseError { + override readonly name = 'Meta.InvalidHashSchemeTypeError' + + constructor({ hash }: { hash: string }) { + super(`HashScheme of "${hash}" is invalid.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export class InvalidSignatureSchemeTypeError extends BaseError { + override readonly name = 'Meta.InvalidSignatureSchemeTypeError' + + constructor({ hash }: { hash: string }) { + super(`SignatureScheme of "${hash}" is invalid.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export class InvalidSignatureError extends BaseError { + override readonly name = 'Meta.InvalidSignatureTypeError' + + constructor({ hash }: { hash: string }) { + super(`Signature of "${hash}" is invalid.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export type Meta = { + hash: Types.Hex + signer: Types.Hex + signature: Types.Hex + hashScheme: 'blake3' + signatureScheme: 'ed25519' | 'eip712' + dataBytes: Types.Hex | undefined +} + +export function create(parameters: create.ParametersType): create.ReturnType { + const hash = blake3(Hex.toBytes(parameters.dataBytes), { dkLen: 20 }) + const signature = ed.sign(hash, parameters.privateKey.slice(2)) + return { + hash: Hex.fromBytes(hash), + hashScheme: 'blake3', + signature: Hex.fromBytes(signature), + signatureScheme: 'ed25519', + signer: Hex.fromBytes(ed.getPublicKey(parameters.privateKey.slice(2))), + dataBytes: parameters.dataBytes, + } as const +} + +export declare namespace create { + type ParametersType = { + dataBytes: Types.Hex + privateKey: Types.Hex + } + type ReturnType = Meta + + type ErrorType = GlobalErrorType +} + +create.parseError = (error: unknown) => error as create.ErrorType + +ed.etc.sha512Sync = (...m) => sha.sha512(ed.etc.concatBytes(...m)) + +export function fromProtobuf( + message: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + //@TODO: error + if (!message.data) throw new Error('') + const hash = Hex.fromBytes(message.hash) + const signer = Hex.fromBytes(message.signer) + const signature = Hex.fromBytes(message.signature) + const hashScheme = (() => { + if (message.hashScheme === MessageProtobuf.HashScheme.BLAKE3) + return 'blake3' as const + throw new InvalidHashSchemeTypeError({ hash }) + })() + const signatureScheme = (() => { + if (message.signatureScheme === MessageProtobuf.SignatureScheme.EIP712) + return 'eip712' + if (message.signatureScheme === MessageProtobuf.SignatureScheme.ED25519) + return 'ed25519' + + throw new InvalidSignatureSchemeTypeError({ hash }) + })() + + const verified = (() => { + if (!signatureScheme) return null + if (signatureScheme === 'ed25519') + return ed.verify(message.signature, message.hash, message.signer) + if (signatureScheme === 'eip712') throw new Error('not implemented') + throw new InvalidSignatureSchemeTypeError({ hash }) + })() + + if (verified === false) throw new InvalidSignatureError({ hash }) + + const dataBytes = message.dataBytes + ? Hex.fromBytes(message.dataBytes) + : undefined + + return { + hash, + signer, + signature, + hashScheme, + signatureScheme, + dataBytes, + } as const +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = Meta + + type ErrorType = + | InvalidHashSchemeTypeError + | InvalidSignatureSchemeTypeError + | InvalidSignatureError + | GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + meta: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return { + hash: Hex.toBytes(meta.hash), + signer: Hex.toBytes(meta.signer), + signature: Hex.toBytes(meta.signature), + hashScheme: MessageProtobuf.HashScheme.BLAKE3, + signatureScheme: MessageProtobuf.SignatureScheme.ED25519, + ...(meta.dataBytes ? { dataBytes: Hex.toBytes(meta.dataBytes) } : {}), + } as const +} + +export declare namespace toProtobuf { + type ParametersType = Meta + type ReturnType = Pick< + MessageProtobuf.Message, + | 'hash' + | 'hashScheme' + | 'dataBytes' + | 'signatureScheme' + | 'signature' + | 'signer' + > + + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/Pagination.ts b/src/core/Pagination.ts new file mode 100644 index 0000000..6501c23 --- /dev/null +++ b/src/core/Pagination.ts @@ -0,0 +1,58 @@ +import { Hex, type Types } from 'ox' +import type { GlobalErrorType } from './Error.js' + +export type Pagination = { + pageSize?: number | undefined + pageToken?: Types.Hex | undefined + reverse?: boolean | undefined +} + +export type PaginationWithTimestamps = Pagination & { + startTimestamp?: bigint | undefined + stopTimestamp?: bigint | undefined +} + +export type NextPageToken = Types.Hex | null + +export function getPageToken( + pageToken: Pagination_getPageToken.ParametersType, +): Pagination_getPageToken.ReturnType { + if (!pageToken) return null + const hex = Hex.fromBytes(pageToken) + if (hex === '0x') return null + return hex +} + +export declare namespace Pagination_getPageToken { + type ParametersType = Uint8Array | undefined + type ReturnType = NextPageToken + type ErrorType = GlobalErrorType +} + +export function unwrap(parameters: unwrap.ParametersType): unwrap.ReturnType { + return { + ...(parameters.pageSize ? { pageSize: parameters.pageSize } : {}), + ...(parameters.pageToken + ? { pageToken: Hex.toBytes(parameters.pageToken) } + : {}), + ...(parameters.reverse ? { reverse: parameters.reverse } : {}), + ...(parameters.startTimestamp + ? { startTimestamp: parameters.startTimestamp } + : {}), + ...(parameters.stopTimestamp + ? { stopTimestamp: parameters.stopTimestamp } + : {}), + } +} + +export declare namespace unwrap { + type ParametersType = PaginationWithTimestamps + type ReturnType = { + stopTimestamp?: bigint + startTimestamp?: bigint + reverse?: true + pageToken?: any + pageSize?: number + } + type ErrorType = GlobalErrorType +} diff --git a/src/core/Parent.ts b/src/core/Parent.ts new file mode 100644 index 0000000..060e8bf --- /dev/null +++ b/src/core/Parent.ts @@ -0,0 +1,79 @@ +import { BaseError } from 'ox/Errors' +import * as CastId from './CastId.js' +import type { GlobalErrorType } from './Error.js' +import type * as MessageProtobuf from './protobufs/message_pb.js' + +export type Parent = + | ({ + type: 'cast' + } & CastId.CastId) + | { + type: 'url' + url: string + } + +export class InvalidParentTypeError extends BaseError { + override readonly name = 'Parent.InvalidParentTypeError' + + constructor({ parent }: { parent: any }) { + super(`Parent is invalid: ${JSON.stringify(parent, null, 2)}`, { + docsPath: '/errors#invalidparenttypeerror', + }) + } +} + +export function fromProtobuf( + parent: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + if (typeof parent.case === 'undefined') return undefined + if (parent.case === 'parentUrl') + return { type: 'url', url: parent.value } as const + if (parent.case === 'parentCastId') + return { + type: 'cast', + ...CastId.fromProtobuf(parent.value), + } as const + + throw new InvalidParentTypeError({ parent }) +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.CastAddBody['parent'] + type ReturnType = Parent | undefined + + type ErrorType = + | InvalidParentTypeError + | CastId.fromProtobuf.ErrorType + | GlobalErrorType +} +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + parent: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + if (typeof parent === 'undefined') + return { + case: undefined, + value: undefined, + } + if (parent.type === 'url') + return { case: 'parentUrl', value: parent.url } as const + if (parent.type === 'cast') + return { + case: 'parentCastId', + value: CastId.toProtobuf(parent), + } as const + + throw new InvalidParentTypeError({ parent }) +} + +export declare namespace toProtobuf { + type ParametersType = Parent | undefined + type ReturnType = MessageProtobuf.CastAddBody['parent'] + + type ErrorType = + | InvalidParentTypeError + | CastId.toProtobuf.ErrorType + | GlobalErrorType +} +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/Reaction.ts b/src/core/Reaction.ts new file mode 100644 index 0000000..2a391ec --- /dev/null +++ b/src/core/Reaction.ts @@ -0,0 +1,99 @@ +import { BaseError } from 'ox/Errors' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +import { create } from '@bufbuild/protobuf' +import type { GlobalErrorType } from './Error.js' +import * as ReactionTarget from './ReactionTarget.js' +import * as ReactionType from './ReactionType.js' + +export type Reaction = { + meta: Meta.Meta + fid: bigint + timestamp: number + type: ReactionType.ReactionType + target: ReactionTarget.ReactionTarget +} + +// @TODO: replace by our own BaseError +export class InvalidMessageTypeError extends BaseError { + override readonly name = 'Reaction.InvalidMessageTypeError' + + constructor({ hash }: { hash: string }) { + super(`Message "${hash}" has type other than CAST_ADD.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + const meta = Meta.fromProtobuf(message) + // @TODO: separate error here + if (!message.data) + throw new Error('`data` must be defined in Reaction message.') + if (message.data.body.case !== 'reactionBody') + throw new InvalidMessageTypeError({ hash: meta.hash }) + return fromProtobuf({ + body: message.data.body.value, + meta, + fid: message.data.fid, + timestamp: message.data.timestamp, + }) +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = Reaction + type ErrorType = + | InvalidMessageTypeError + | Meta.fromProtobuf.ErrorType + | GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function fromProtobuf( + parameters: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + return { + meta: parameters.meta, + fid: parameters.fid, + timestamp: parameters.timestamp, + type: ReactionType.fromProtobuf(parameters.body.type), + target: ReactionTarget.fromProtobuf(parameters.body.target), + } as const +} + +export declare namespace fromProtobuf { + type ParametersType = { + body: MessageProtobuf.ReactionBody + meta: Meta.Meta + fid: bigint + timestamp: number + } + type ReturnType = Reaction + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + reaction: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return create(MessageProtobuf.ReactionBodySchema, { + type: ReactionType.toProtobuf(reaction.type), + target: ReactionTarget.toProtobuf(reaction.target), + }) +} + +export declare namespace toProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.ReactionBody + + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/ReactionAdd.ts b/src/core/ReactionAdd.ts new file mode 100644 index 0000000..579367b --- /dev/null +++ b/src/core/ReactionAdd.ts @@ -0,0 +1,74 @@ +import { create, toBinary } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as Reaction from './Reaction.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export function toHex(cast: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(cast)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageDataProtobuf( + cast: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: cast.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.REACTION_ADD, + fid: cast.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'reactionBody', + value: Reaction.toProtobuf(cast), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.reaction), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.reaction), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + reaction: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/ReactionRemove.ts b/src/core/ReactionRemove.ts new file mode 100644 index 0000000..35c5339 --- /dev/null +++ b/src/core/ReactionRemove.ts @@ -0,0 +1,74 @@ +import { create, toBinary } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as Reaction from './Reaction.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export function toHex(cast: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(cast)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageDataProtobuf( + cast: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: cast.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.REACTION_REMOVE, + fid: cast.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'reactionBody', + value: Reaction.toProtobuf(cast), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.reaction), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.reaction), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + reaction: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/ReactionTarget.ts b/src/core/ReactionTarget.ts new file mode 100644 index 0000000..12eadb7 --- /dev/null +++ b/src/core/ReactionTarget.ts @@ -0,0 +1,51 @@ +import * as CastId from './CastId.js' +import type { GlobalErrorType } from './Error.js' +import type * as MessageProtobuf from './protobufs/message_pb.js' + +export type ReactionTarget = + | ({ + type: 'cast' + } & CastId.CastId) + | { + type: 'url' + url: string + } + +export function fromProtobuf( + target: MessageProtobuf.ReactionBody['target'], +): fromProtobuf.ReturnType { + return target.case === 'targetUrl' + ? { + type: 'url', + url: target.value, + } + : { + type: 'cast', + ...CastId.fromProtobuf(target.value!), + } +} + +export declare namespace fromProtobuf { + type ReturnType = ReactionTarget + + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + target: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return target.type === 'cast' + ? { value: CastId.toProtobuf(target), case: 'targetCastId' } + : { value: target.url, case: 'targetUrl' } +} + +export declare namespace toProtobuf { + type ParametersType = ReactionTarget + type ReturnType = MessageProtobuf.ReactionBody['target'] + + type ErrorTarget = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorTarget diff --git a/src/core/ReactionType.ts b/src/core/ReactionType.ts new file mode 100644 index 0000000..859c9b1 --- /dev/null +++ b/src/core/ReactionType.ts @@ -0,0 +1,37 @@ +export type ReactionType = 'like' | 'recast' +import type { GlobalErrorType } from './Error.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export function fromProtobuf( + reactionType: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + return reactionType === MessageProtobuf.ReactionType.RECAST + ? ('recast' as const) + : ('like' as const) +} + +export declare namespace fromProtobuf { + type ParametersType = MessageProtobuf.ReactionType + type ReturnType = ReactionType + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + type: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + if (type === 'like') return MessageProtobuf.ReactionType.LIKE + if (type === 'recast') return MessageProtobuf.ReactionType.RECAST + // @TODO: error + throw new Error('unknwo tyep') +} + +export declare namespace toProtobuf { + type ParametersType = ReactionType + type ReturnType = MessageProtobuf.ReactionType + + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/Types.ts b/src/core/Types.ts new file mode 100644 index 0000000..6751b0a --- /dev/null +++ b/src/core/Types.ts @@ -0,0 +1,18 @@ +export type { Cast } from './Cast.js' +export type { CastId } from './CastId.js' +export type { CastRemove } from './CastRemove.js' +export type { Embed } from './Embed.js' +export type { FrameActionBody } from './FrameActionBody.js' +export type { HubEvent } from './HubEvent.js' +export type { Link } from './Link.js' +export type { LinkCompactState } from './LinkCompactState.js' +export type { Message } from './Message.js' +export type { Meta } from './Meta.js' +export type { Parent } from './Parent.js' +export type { Reaction } from './Reaction.js' +export type { ReactionTarget } from './ReactionTarget.js' +export type { ReactionType } from './ReactionType.js' +export type { UserData } from './UserData.js' +export type { UsernameProof } from './UsernameProof.js' +export type { Verification } from './Verification.js' +export type * as Pagination from './Pagination.js' diff --git a/src/Node/Internal/UserData/fromProtobuf.ts b/src/core/UserData.ts similarity index 50% rename from src/Node/Internal/UserData/fromProtobuf.ts rename to src/core/UserData.ts index f79460e..b238ff3 100644 --- a/src/Node/Internal/UserData/fromProtobuf.ts +++ b/src/core/UserData.ts @@ -1,16 +1,32 @@ import { Hex } from 'ox' -import type { GlobalErrorType } from '../../../Internal/Errors/error.js' -import { Meta_fromProtobuf } from '../Meta/fromProtobuf.js' -import * as MessageProtobuf from '../Protobufs/message_pb.js' -import { UserData_InvalidMessageTypeError } from './errors.js' -import type { UserData } from './types.js' +import { BaseError } from 'ox/Errors' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' -export function UserData_fromProtobuf( - message: UserData_fromProtobuf.ParametersType, -): UserData_fromProtobuf.ReturnType { +export type UserData = { + meta: Meta.Meta + type: 'none' | 'pfp' | 'display' | 'bio' | 'url' | 'username' | 'location' + value: string +} + +// @TODO: replace by our own BaseError +export class InvalidMessageTypeError extends BaseError { + override readonly name = 'UserData.InvalidMessageTypeError' + + constructor({ hash }: { hash: string }) { + super(`Message "${hash}" has type other than USER_DATA_ADD.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export function fromProtobuf( + message: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { // @TODO: error here if (message.data?.body.case !== 'userDataBody') - throw new UserData_InvalidMessageTypeError({ + throw new InvalidMessageTypeError({ hash: Hex.fromBytes(message.hash), }) const type = (() => { @@ -40,18 +56,17 @@ export function UserData_fromProtobuf( })() // @TODO: handle unexpeded type here? return { - meta: Meta_fromProtobuf(message), + meta: Meta.fromProtobuf(message), type, value: message.data.body.value.value, } } -export declare namespace UserData_fromProtobuf { +export declare namespace fromProtobuf { type ParametersType = MessageProtobuf.Message type ReturnType = UserData - type ErrorType = UserData_InvalidMessageTypeError | GlobalErrorType + type ErrorType = InvalidMessageTypeError | GlobalErrorType } -UserData_fromProtobuf.parseError = (error: unknown) => - error as UserData_fromProtobuf.ErrorType +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType diff --git a/src/core/UsernameProof.ts b/src/core/UsernameProof.ts new file mode 100644 index 0000000..0c55bdd --- /dev/null +++ b/src/core/UsernameProof.ts @@ -0,0 +1,61 @@ +import { Hex, type Types } from 'ox' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import type * as MessageProtobuf from './protobufs/message_pb.js' +import * as UsernameProofProtobuf from './protobufs/username_proof_pb.js' + +export type UsernameProof = { + meta: Meta.Meta + timestamp: bigint + name: string + owner: string + signature: Types.Hex + fid: bigint + type: 'fname' | 'ensL1' +} + +export function fromProtobuf( + message: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + // @TODO: error here + return { + type: + message.type === UsernameProofProtobuf.UserNameType.USERNAME_TYPE_FNAME + ? 'fname' + : 'ensL1', + name: Buffer.from(message.name).toString(), + owner: Hex.fromBytes(message.owner).toString(), + signature: Hex.fromBytes(message.signature), + timestamp: message.timestamp, + fid: message.fid, + } +} + +export declare namespace fromProtobuf { + type ParametersType = UsernameProofProtobuf.UserNameProof + type ReturnType = Omit + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + // @TODO: error here + if (message.data?.body.case !== 'usernameProofBody') + throw new Error('invalid type') + return { + meta: Meta.fromProtobuf(message), + ...fromProtobuf(message.data.body.value), + } +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = UsernameProof + type ErrorType = GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType diff --git a/src/core/Verification.ts b/src/core/Verification.ts new file mode 100644 index 0000000..5ebcf3e --- /dev/null +++ b/src/core/Verification.ts @@ -0,0 +1,75 @@ +import { create } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import type { GlobalErrorType } from './Error.js' +import type * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type Verification = { + meta: Meta.Meta + address: string + claimSignature: Types.Hex + blockHash: Types.Hex + type: 'eoa' | 'contract' + chainId: number + protocol: 'ethereum' | 'solana' + fid: bigint + timestamp: number +} + +export function fromProtobuf( + parameters: fromProtobuf.ParametersType, +): fromProtobuf.ReturnType { + return { + meta: parameters.meta, + fid: parameters.fid, + timestamp: parameters.timestamp, + type: parameters.body.verificationType === 0 ? 'eoa' : 'contract', + address: parameters.body.address.toString(), + claimSignature: Hex.fromBytes(parameters.body.claimSignature), + blockHash: Hex.fromBytes(parameters.body.blockHash), + chainId: parameters.body.chainId, + protocol: + parameters.body.protocol === MessageProtobuf.Protocol.SOLANA + ? 'solana' + : 'ethereum', + } as const +} + +export declare namespace fromProtobuf { + type ParametersType = { + body: MessageProtobuf.VerificationAddAddressBody + meta: Meta.Meta + fid: bigint + timestamp: number + } + type ReturnType = Verification + + type ErrorType = GlobalErrorType +} + +fromProtobuf.parseError = (error: unknown) => error as fromProtobuf.ErrorType + +export function toProtobuf( + verification: toProtobuf.ParametersType, +): toProtobuf.ReturnType { + return create(MessageProtobuf.VerificationAddAddressBodySchema, { + verificationType: verification.type === 'eoa' ? 0 : 1, + address: Hex.toBytes(Hex.fromString(verification.address)), + claimSignature: Hex.toBytes(verification.claimSignature), + blockHash: Hex.toBytes(verification.blockHash), + chainId: verification.chainId, + protocol: + verification.protocol === 'ethereum' + ? MessageProtobuf.Protocol.ETHEREUM + : MessageProtobuf.Protocol.SOLANA, + }) +} + +export declare namespace toProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.VerificationAddAddressBody + + type ErrorType = GlobalErrorType +} + +toProtobuf.parseError = (error: unknown) => error as toProtobuf.ErrorType diff --git a/src/core/VerificationAdd.ts b/src/core/VerificationAdd.ts new file mode 100644 index 0000000..6814a76 --- /dev/null +++ b/src/core/VerificationAdd.ts @@ -0,0 +1,119 @@ +import { Hex, type Types } from 'ox' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as Verification from './Verification.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +import { create, toBinary } from '@bufbuild/protobuf' +import { BaseError } from 'ox/Errors' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' + +// @TODO: replace by our own BaseError +export class InvalidMessageTypeError extends BaseError { + override readonly name = 'VerificationAdd.InvalidMessageTypeError' + + constructor({ hash }: { hash: string }) { + super(`Message "${hash}" has type other than CAST_ADD.`, { + docsPath: '/errors#invalidmessagetypeerror', + }) + } +} + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + const meta = Meta.fromProtobuf(message) + // @TODO: separate error here + if (!message.data) + throw new Error('`data` must be defined in VerificationAdd message.') + if (message.data.body.case !== 'verificationAddAddressBody') + throw new InvalidMessageTypeError({ hash: meta.hash }) + return Verification.fromProtobuf({ + body: message.data.body.value, + meta, + fid: message.data.fid, + timestamp: message.data.timestamp, + }) +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = Verification.Verification + type ErrorType = + | InvalidMessageTypeError + | Meta.fromProtobuf.ErrorType + | GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function VerificationAdd_toHex( + cast: VerificationAdd_toHex.ParametersType, +): VerificationAdd_toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(cast)), + ) +} + +export declare namespace VerificationAdd_toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +VerificationAdd_toHex.parseError = (error: unknown) => + error as VerificationAdd_toHex.ErrorType + +export function toMessageDataProtobuf( + verification: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: verification.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.VERIFICATION_ADD_ETH_ADDRESS, + fid: verification.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'verificationAddAddressBody', + value: Verification.toProtobuf(verification), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: VerificationAdd_toHex(parameters.verification), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.verification), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + verification: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/VerificationRemoval.ts b/src/core/VerificationRemoval.ts new file mode 100644 index 0000000..47c96bb --- /dev/null +++ b/src/core/VerificationRemoval.ts @@ -0,0 +1,116 @@ +import { create, toBinary } from '@bufbuild/protobuf' +import { Hex, type Types } from 'ox' +import { FARCASTER_EPOCH_TIMESTAMP } from './Constants.js' +import type { GlobalErrorType } from './Error.js' +import * as Meta from './Meta.js' +import * as MessageProtobuf from './protobufs/message_pb.js' + +export type VerificationRemove = { + meta: Meta.Meta + address: string + protocol: 'ethereum' | 'solana' + fid: bigint + timestamp: number +} + +export function fromMessageProtobuf( + message: fromMessageProtobuf.ParametersType, +): fromMessageProtobuf.ReturnType { + //@TODO: errors + if (!message.data) throw new Error('no data') + if (message.data.body.case !== 'verificationRemoveBody') + throw new Error('bad case') + + return { + fid: message.data.fid, + timestamp: message.data.timestamp, + meta: Meta.fromProtobuf(message), + address: message.data.body.value.address.toString(), + protocol: + message.data.body.value.protocol === MessageProtobuf.Protocol.SOLANA + ? 'solana' + : 'ethereum', + } as const +} + +export declare namespace fromMessageProtobuf { + type ParametersType = MessageProtobuf.Message + type ReturnType = VerificationRemove + type ErrorType = GlobalErrorType +} + +fromMessageProtobuf.parseError = (error: unknown) => + error as fromMessageProtobuf.ErrorType + +export function toHex(cast: toHex.ParametersType): toHex.ReturnType { + return Hex.fromBytes( + toBinary(MessageProtobuf.MessageDataSchema, toMessageDataProtobuf(cast)), + ) +} + +export declare namespace toHex { + type ParametersType = Omit + type ReturnType = Types.Hex + type ErrorType = GlobalErrorType +} + +toHex.parseError = (error: unknown) => error as toHex.ErrorType + +export function toMessageDataProtobuf( + verificationRemove: toMessageDataProtobuf.ParametersType, +): toMessageDataProtobuf.ReturnType { + return create(MessageProtobuf.MessageDataSchema, { + timestamp: verificationRemove.timestamp - FARCASTER_EPOCH_TIMESTAMP, + type: MessageProtobuf.MessageType.VERIFICATION_REMOVE, + fid: verificationRemove.fid, + network: MessageProtobuf.FarcasterNetwork.MAINNET, + body: { + case: 'verificationRemoveBody', + value: create(MessageProtobuf.VerificationRemoveBodySchema, { + address: Hex.toBytes(Hex.fromString(verificationRemove.address)), + protocol: + verificationRemove.protocol === 'solana' + ? MessageProtobuf.Protocol.SOLANA + : MessageProtobuf.Protocol.ETHEREUM, + }), + }, + }) +} + +export declare namespace toMessageDataProtobuf { + type ParametersType = Omit + type ReturnType = MessageProtobuf.MessageData + + type ErrorType = GlobalErrorType +} + +toMessageDataProtobuf.parseError = (error: unknown) => + error as toMessageDataProtobuf.ErrorType + +export function toMessageProtobuf( + parameters: toMessageProtobuf.ParametersType, +): toMessageProtobuf.ReturnType { + return create(MessageProtobuf.MessageSchema, { + ...Meta.toProtobuf( + Meta.create({ + dataBytes: toHex(parameters.castRemove), + privateKey: parameters.privateKey, + }), + ), + data: toMessageDataProtobuf(parameters.castRemove), + }) +} + +export declare namespace toMessageProtobuf { + type ParametersType = { + castRemove: Omit + privateKey: Types.Hex + } + type ReturnType = MessageProtobuf.Message + + // @TODO: errors + type ErrorType = GlobalErrorType +} + +toMessageProtobuf.parseError = (error: unknown) => + error as toMessageProtobuf.ErrorType diff --git a/src/core/actions/Cast.ts b/src/core/actions/Cast.ts new file mode 100644 index 0000000..3596ac0 --- /dev/null +++ b/src/core/actions/Cast.ts @@ -0,0 +1,172 @@ +import type { CallOptions } from '@connectrpc/connect' +import { Hex } from 'ox' +import type * as Client from '../../fhub/Client.js' +import type * as Cast from '../Cast.js' +import * as CastAdd from '../CastAdd.js' +import type * as CastId from '../CastId.js' +import * as CastRemove from '../CastRemove.js' +import type { GlobalErrorType } from '../Error.js' +import * as Pagination from '../Pagination.js' +import * as Parent from '../Parent.js' +import * as MessageProtobuf from '../protobufs/message_pb.js' + +export declare namespace get { + type ParametersType = CastId.CastId + type ReturnType = Cast.Cast + type ErrorType = CastAdd.fromMessageProtobuf.ErrorType | GlobalErrorType +} +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getCast( + { fid: parameters.fid, hash: Hex.toBytes(parameters.hash) }, + options, + ) + + return CastAdd.fromMessageProtobuf(message) +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace getAllCastMessagesByFid { + type ParametersType = { + fid: bigint + } & Pagination.Pagination + type ReturnType = { + messages: ( + | { type: 'casted'; cast: Cast.Cast } + | { type: 'removed'; cast: CastRemove.CastRemove } + )[] + nextPageToken: Pagination.NextPageToken + } + type ErrorType = CastAdd.fromMessageProtobuf.ErrorType | GlobalErrorType +} +export async function getAllCastMessagesByFid( + client: Client.Client, + parameters: getAllCastMessagesByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllCastMessagesByFid( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + + return { + messages: message.messages.map((message) => { + if ( + message.data?.type === MessageProtobuf.MessageType.CAST_REMOVE && + message.data.body.case === 'castRemoveBody' + ) + return { + type: 'removed' as const, + cast: CastRemove.fromMessageProtobuf(message), + } + return { type: 'casted', cast: CastAdd.fromMessageProtobuf(message) } + }), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} +getAllCastMessagesByFid.parseError = (error: unknown) => + error as getAllCastMessagesByFid.ErrorType + +export declare namespace getByFid { + type ParametersType = { + fid: bigint + } & Pagination.PaginationWithTimestamps + type ReturnType = { + casts: Cast.Cast[] + nextPageToken: Pagination.NextPageToken + } + type ErrorType = CastAdd.fromMessageProtobuf.ErrorType | GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getCastsByFid( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + casts: message.messages.map((message) => + CastAdd.fromMessageProtobuf(message), + ), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType + +export declare namespace getByMention { + type ParametersType = { + fid: bigint + } & Pagination.Pagination + type ReturnType = { + casts: Cast.Cast[] + nextPageToken: Pagination.NextPageToken + } + type ErrorType = CastAdd.fromMessageProtobuf.ErrorType | GlobalErrorType +} +export async function getByMention( + client: Client.Client, + parameters: getByMention.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getCastsByMention( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + + return { + casts: message.messages.map((message) => + CastAdd.fromMessageProtobuf(message), + ), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} +getByMention.parseError = (error: unknown) => error as getByMention.ErrorType + +export declare namespace getByParent { + type ParametersType = { + parent: Parent.Parent + } & Pagination.Pagination + type ReturnType = { + casts: Cast.Cast[] + nextPageToken: Pagination.NextPageToken + } + type ErrorType = + | CastAdd.fromMessageProtobuf.ErrorType + | Parent.toProtobuf.ErrorType + | GlobalErrorType +} +export async function getByParent( + client: Client.Client, + parameters: getByParent.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getCastsByParent( + { + parent: Parent.toProtobuf(parameters.parent), + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + casts: message.messages.map((message) => + CastAdd.fromMessageProtobuf(message), + ), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} +getByParent.parseError = (error: unknown) => error as getByParent.ErrorType diff --git a/src/core/actions/Event.ts b/src/core/actions/Event.ts new file mode 100644 index 0000000..70c9628 --- /dev/null +++ b/src/core/actions/Event.ts @@ -0,0 +1,69 @@ +import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as HubEvent from '../HubEvent.js' +import * as HubEventProtobuf from '../protobufs/hub_event_pb.js' +import * as RequestResponseProtobuf from '../protobufs/request_response_pb.js' + +export declare namespace get { + type ParametersType = Required + type ReturnType = MessageJsonType + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getEvent( + fromJson(RequestResponseProtobuf.EventRequestSchema, parameters), + options, + ) + return toJson(HubEventProtobuf.HubEventSchema, message) +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace subscribe { + type ParametersType = { + eventTypes: ('mergeMessage' | 'pruneMessage' | 'revokeMessage')[] + fromId?: bigint | undefined + totalShards?: bigint | undefined + shardIndex?: bigint | undefined + } + type ReturnType = AsyncGenerator + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function* subscribe( + client: Client.Client, + parameters: subscribe.ParametersType, + options?: CallOptions, +): subscribe.ReturnType { + const eventTypesNumbers = parameters.eventTypes.map((eventType) => { + if (eventType === 'mergeMessage') return 1 + if (eventType === 'pruneMessage') return 2 + if (eventType === 'revokeMessage') return 3 + if (eventType === 'mergeUsernameProof') return 6 + if (eventType === 'mergeOnChainEvent') return 9 + return 0 + }) + + for await (const message of client.connectRpcClient.subscribe( + { + eventTypes: eventTypesNumbers, + ...(parameters.fromId ? { fromId: parameters.fromId } : {}), + ...(parameters.totalShards + ? { totalShards: parameters.totalShards } + : {}), + ...(parameters.shardIndex ? { shardIndex: parameters.shardIndex } : {}), + }, + options, + )) { + yield HubEvent.fromProtobuf(message) + } +} + +subscribe.parseError = (error: unknown) => error as subscribe.ErrorType diff --git a/src/core/actions/Link.ts b/src/core/actions/Link.ts new file mode 100644 index 0000000..00a96ee --- /dev/null +++ b/src/core/actions/Link.ts @@ -0,0 +1,160 @@ +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as Link from '../Link.js' +import * as LinkCompactState from '../LinkCompactState.js' +import * as Pagination from '../Pagination.js' + +export declare namespace get { + type ParametersType = { + sourceFid: bigint + targetFid: bigint + type: string + } + type ReturnType = Link.Link + type ErrorType = Link.fromMessageProtobuf.ErrorType | GlobalErrorType +} +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getLink( + { + linkType: parameters.type, + fid: parameters.sourceFid, + target: { + case: 'targetFid', + value: parameters.targetFid, + }, + }, + options, + ) + return Link.fromMessageProtobuf(message) +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace getAllLinkMessagesByFid { + type ParametersType = { + sourceFid: bigint + } & Pagination.PaginationWithTimestamps + type ReturnType = { + links: Link.Link[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getAllLinkMessagesByFid( + client: Client.Client, + parameters: getAllLinkMessagesByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllLinkMessagesByFid( + { fid: parameters.sourceFid, ...Pagination.unwrap(parameters) }, + options, + ) + return { + links: message.messages.map(Link.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getAllLinkMessagesByFid.parseError = (error: unknown) => + error as getAllLinkMessagesByFid.ErrorType + +export declare namespace getByFid { + type ParametersType = { + sourceFid: bigint + type: string + } & Pagination.Pagination + type ReturnType = { + links: Link.Link[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getLinksByFid( + { + fid: parameters.sourceFid, + linkType: parameters.type, + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + links: message.messages.map(Link.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType + +export declare namespace getByTarget { + type ParametersType = { + targetFid: bigint + type: string + } & Pagination.Pagination + type ReturnType = { + links: Link.Link[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getByTarget( + client: Client.Client, + parameters: getByTarget.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getLinksByTarget( + { + target: { case: 'targetFid', value: parameters.targetFid }, + linkType: parameters.type, + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + links: message.messages.map(Link.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getByTarget.parseError = (error: unknown) => error as getByTarget.ErrorType + +export declare namespace getCompactStateMessageByFid { + type ParametersType = { + fid: bigint + } & Pagination.Pagination + type ReturnType = { + links: LinkCompactState.LinkCompactState[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getCompactStateMessageByFid( + client: Client.Client, + parameters: getCompactStateMessageByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getLinkCompactStateMessageByFid( + { fid: parameters.fid, ...Pagination.unwrap(parameters) }, + options, + ) + return { + links: message.messages.map(LinkCompactState.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getCompactStateMessageByFid.parseError = (error: unknown) => + error as getCompactStateMessageByFid.ErrorType diff --git a/src/core/actions/OnChainEvents.ts b/src/core/actions/OnChainEvents.ts new file mode 100644 index 0000000..28a08ea --- /dev/null +++ b/src/core/actions/OnChainEvents.ts @@ -0,0 +1,172 @@ +import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as OnChainEventProtobuf from '../protobufs/onchain_event_pb.js' +import * as RequestResponseProtobuf from '../protobufs/request_response_pb.js' + +export declare namespace getCurrentStorageLimitsByFid { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.StorageLimitsResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getCurrentStorageLimitsByFid( + client: Client.Client, + parameters: getCurrentStorageLimitsByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getCurrentStorageLimitsByFid( + fromJson(RequestResponseProtobuf.FidRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.StorageLimitsResponseSchema, message) +} + +getCurrentStorageLimitsByFid.parseError = (error: unknown) => + error as getCurrentStorageLimitsByFid.ErrorType + +export declare namespace getFids { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.FidsResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getFids( + client: Client.Client, + parameters: getFids.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getFids( + fromJson(RequestResponseProtobuf.FidsRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.FidsResponseSchema, message) +} + +getFids.parseError = (error: unknown) => error as getFids.ErrorType + +export declare namespace getIdRegistryOnChainEvent { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof OnChainEventProtobuf.OnChainEventSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getIdRegistryOnChainEvent( + client: Client.Client, + parameters: getIdRegistryOnChainEvent.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getIdRegistryOnChainEvent( + fromJson(RequestResponseProtobuf.FidRequestSchema, parameters), + options, + ) + return toJson(OnChainEventProtobuf.OnChainEventSchema, message) +} + +getIdRegistryOnChainEvent.parseError = (error: unknown) => + error as getIdRegistryOnChainEvent.ErrorType + +export declare namespace getIdRegistryOnChainEventByAddress { + type ParametersType = + Required + type ReturnType = MessageJsonType< + typeof OnChainEventProtobuf.OnChainEventSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getIdRegistryOnChainEventByAddress( + client: Client.Client, + parameters: getIdRegistryOnChainEventByAddress.ParametersType, + options?: CallOptions, +): Promise { + const message = + await client.connectRpcClient.getIdRegistryOnChainEventByAddress( + fromJson( + RequestResponseProtobuf.IdRegistryEventByAddressRequestSchema, + parameters, + ), + options, + ) + return toJson(OnChainEventProtobuf.OnChainEventSchema, message) +} + +getIdRegistryOnChainEventByAddress.parseError = (error: unknown) => + error as getIdRegistryOnChainEventByAddress.ErrorType + +export declare namespace OnChainEvents_getOnChainEvents { + type ParametersType = + Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.OnChainEventResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function OnChainEvents_getOnChainEvents( + client: Client.Client, + parameters: OnChainEvents_getOnChainEvents.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getOnChainEvents( + fromJson(RequestResponseProtobuf.OnChainEventRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.OnChainEventResponseSchema, message) +} + +OnChainEvents_getOnChainEvents.parseError = (error: unknown) => + error as OnChainEvents_getOnChainEvents.ErrorType + +export declare namespace getOnChainSigner { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof OnChainEventProtobuf.OnChainEventSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getOnChainSigner( + client: Client.Client, + parameters: getOnChainSigner.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getOnChainSigner( + fromJson(RequestResponseProtobuf.SignerRequestSchema, parameters), + options, + ) + return toJson(OnChainEventProtobuf.OnChainEventSchema, message) +} + +getOnChainSigner.parseError = (error: unknown) => + error as getOnChainSigner.ErrorType + +export declare namespace getOnChainSignersByFid { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.OnChainEventResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getOnChainSignersByFid( + client: Client.Client, + parameters: getOnChainSignersByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getOnChainSignersByFid( + fromJson(RequestResponseProtobuf.FidRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.OnChainEventResponseSchema, message) +} + +getOnChainSignersByFid.parseError = (error: unknown) => + error as getOnChainSignersByFid.ErrorType diff --git a/src/core/actions/Reaction.ts b/src/core/actions/Reaction.ts new file mode 100644 index 0000000..d1ce9d2 --- /dev/null +++ b/src/core/actions/Reaction.ts @@ -0,0 +1,160 @@ +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type * as CastId from '../CastId.js' +import type { GlobalErrorType } from '../Error.js' +import * as Pagination from '../Pagination.js' +import * as Reaction from '../Reaction.js' +import * as ReactionTarget from '../ReactionTarget.js' +import * as ReactionType from '../ReactionType.js' + +export declare namespace getReaction { + type ParametersType = { + fid: bigint + reactionType: ReactionType.ReactionType + target: ReactionTarget.ReactionTarget + } + type ReturnType = Reaction.Reaction + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getReaction( + client: Client.Client, + parameters: getReaction.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getReaction( + { + fid: parameters.fid, + reactionType: ReactionType.toProtobuf(parameters.reactionType), + target: ReactionTarget.toProtobuf(parameters.target), + }, + options, + ) + return Reaction.fromMessageProtobuf(message) +} + +getReaction.parseError = (error: unknown) => error as getReaction.ErrorType + +export declare namespace getAllReactionMessagesByFid { + type ParametersType = { + fid: bigint + } & Pagination.Pagination + type ReturnType = { + messages: Reaction.Reaction[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getAllReactionMessagesByFid( + client: Client.Client, + parameters: getAllReactionMessagesByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllReactionMessagesByFid( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + + return { + messages: message.messages.map(Reaction.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getAllReactionMessagesByFid.parseError = (error: unknown) => + error as getAllReactionMessagesByFid.ErrorType + +export declare namespace getByCast { + type ParametersType = CastId.CastId & Pagination.Pagination + type ReturnType = { + messages: Reaction.Reaction[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getByCast( + client: Client.Client, + parameters: getByCast.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getReactionsByCast( + { + target: ReactionTarget.toProtobuf({ type: 'cast', ...parameters }), + ...Pagination.unwrap(parameters), + }, + options, + ) + + return { + messages: message.messages.map(Reaction.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getByCast.parseError = (error: unknown) => error as getByCast.ErrorType + +export declare namespace getByFid { + type ParametersType = { + fid: bigint + type?: ReactionType.ReactionType + } & Pagination.Pagination + type ReturnType = { + messages: Reaction.Reaction[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getReactionsByFid( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + + return { + messages: message.messages.map(Reaction.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType + +export declare namespace getByTarget { + type ReturnType = { + messages: Reaction.Reaction[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getByTarget( + client: Client.Client, + parameters: ReactionTarget.ReactionTarget & Pagination.Pagination, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getReactionsByTarget( + { + ...ReactionTarget.toProtobuf(parameters), + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + messages: message.messages.map(Reaction.fromMessageProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getByTarget.parseError = (error: unknown) => error as getByTarget.ErrorType diff --git a/src/core/actions/Submit.ts b/src/core/actions/Submit.ts new file mode 100644 index 0000000..a9c6306 --- /dev/null +++ b/src/core/actions/Submit.ts @@ -0,0 +1,57 @@ +import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as Message from '../Message.js' +import type * as MessageProtobuf from '../protobufs/message_pb.js' +import * as RequestResponseProtobuf from '../protobufs/request_response_pb.js' + +export declare namespace submitBulkMessages { + type ParametersType = + Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.SubmitBulkMessagesResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function submitBulkMessages( + client: Client.Client, + parameters: submitBulkMessages.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.submitBulkMessages( + fromJson( + RequestResponseProtobuf.SubmitBulkMessagesRequestSchema, + parameters, + ), + options, + ) + return toJson( + RequestResponseProtobuf.SubmitBulkMessagesResponseSchema, + message, + ) +} + +submitBulkMessages.parseError = (error: unknown) => + error as submitBulkMessages.ErrorType + +export declare namespace submitMessage { + type ParametersType = MessageProtobuf.Message + type ReturnType = Message.Message + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function submitMessage( + client: Client.Client, + parameters: submitMessage.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.submitMessage( + parameters, + options, + ) + return Message.fromProtobuf(message) +} + +submitMessage.parseError = (error: unknown) => error as submitMessage.ErrorType diff --git a/src/core/actions/Sync.ts b/src/core/actions/Sync.ts new file mode 100644 index 0000000..ac9331b --- /dev/null +++ b/src/core/actions/Sync.ts @@ -0,0 +1,141 @@ +import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as RequestResponseProtobuf from '../protobufs/request_response_pb.js' + +export declare namespace getAllMessagesBySyncIds { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.MessagesResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getAllMessagesBySyncIds( + client: Client.Client, + parameters: getAllMessagesBySyncIds.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllMessagesBySyncIds( + fromJson(RequestResponseProtobuf.SyncIdsSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.MessagesResponseSchema, message) +} + +getAllMessagesBySyncIds.parseError = (error: unknown) => + error as getAllMessagesBySyncIds.ErrorType + +export declare namespace getAllSyncIdsByPrefix { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.SyncIdsSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getAllSyncIdsByPrefix( + client: Client.Client, + parameters: getAllSyncIdsByPrefix.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllSyncIdsByPrefix( + fromJson(RequestResponseProtobuf.TrieNodePrefixSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.SyncIdsSchema, message) +} + +getAllSyncIdsByPrefix.parseError = (error: unknown) => + error as getAllSyncIdsByPrefix.ErrorType + +export declare namespace getInfo { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.HubInfoResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getInfo( + client: Client.Client, + parameters: getInfo.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getInfo( + fromJson(RequestResponseProtobuf.HubInfoRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.HubInfoResponseSchema, message) +} + +getInfo.parseError = (error: unknown) => error as getInfo.ErrorType + +export declare namespace getSyncMetadataByPrefix { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.TrieNodeMetadataResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getSyncMetadataByPrefix( + client: Client.Client, + parameters: getSyncMetadataByPrefix.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getSyncMetadataByPrefix( + fromJson(RequestResponseProtobuf.TrieNodePrefixSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.TrieNodeMetadataResponseSchema, message) +} + +getSyncMetadataByPrefix.parseError = (error: unknown) => + error as getSyncMetadataByPrefix.ErrorType + +export declare namespace getSyncSnapshotByPrefix { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.TrieNodeSnapshotResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getSyncSnapshotByPrefix( + client: Client.Client, + parameters: getSyncSnapshotByPrefix.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getSyncSnapshotByPrefix( + fromJson(RequestResponseProtobuf.TrieNodePrefixSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.TrieNodeSnapshotResponseSchema, message) +} + +getSyncSnapshotByPrefix.parseError = (error: unknown) => + error as getSyncSnapshotByPrefix.ErrorType + +export declare namespace getSyncStatus { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.SyncStatusResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getSyncStatus( + client: Client.Client, + parameters: getSyncStatus.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getSyncStatus( + fromJson(RequestResponseProtobuf.SyncStatusRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.SyncStatusResponseSchema, message) +} + +getSyncStatus.parseError = (error: unknown) => error as getSyncStatus.ErrorType diff --git a/src/core/actions/UserData.ts b/src/core/actions/UserData.ts new file mode 100644 index 0000000..0c41c6e --- /dev/null +++ b/src/core/actions/UserData.ts @@ -0,0 +1,234 @@ +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as Pagination from '../Pagination.js' +import * as UserData from '../UserData.js' +import * as MessageProtobuf from '../protobufs/message_pb.js' + +export declare namespace get { + type ParametersType = { + fid: bigint + userDataType: MessageProtobuf.UserDataType + } + type ReturnType = UserData.UserData + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} + +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getUserData(parameters, options) + return UserData.fromProtobuf(message) +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace getAllUserDataMessagesByFid { + type ParametersType = { + fid: bigint + } & Pagination.Pagination + type ReturnType = { + datas: UserData.UserData[] + nextPageToken: Pagination.NextPageToken + } + // @TODO: proper error handling + type ErrorType = UserData.fromProtobuf.ErrorType | GlobalErrorType +} +export async function getAllUserDataMessagesByFid( + client: Client.Client, + parameters: getAllUserDataMessagesByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllUserDataMessagesByFid( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + datas: message.messages.map(UserData.fromProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getAllUserDataMessagesByFid.parseError = (error: unknown) => + error as getAllUserDataMessagesByFid.ErrorType + +export declare namespace getBio { + type ParametersType = { fid: bigint } + type ReturnType = get.ReturnType['value'] + // @TODO: proper error handling + type ErrorType = get.ErrorType | GlobalErrorType +} + +export async function getBio( + client: Client.Client, + parameters: getBio.ParametersType, + options?: CallOptions, +): Promise { + const data = await get( + client, + { + ...parameters, + userDataType: MessageProtobuf.UserDataType.BIO, + }, + options, + ) + return data.value +} + +getBio.parseError = (error: unknown) => error as getBio.ErrorType + +export declare namespace getByFid { + type ParametersType = { + fid: bigint + } & Pagination.PaginationWithTimestamps + type ReturnType = { + datas: UserData.UserData[] + nextPageToken: Pagination.NextPageToken + } + type ErrorType = UserData.fromProtobuf.ErrorType | GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getUserDataByFid( + { + fid: parameters.fid, + ...Pagination.unwrap(parameters), + }, + options, + ) + return { + datas: message.messages.map(UserData.fromProtobuf), + nextPageToken: Pagination.getPageToken(message.nextPageToken), + } +} + +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType + +export declare namespace getDisplay { + type ParametersType = { fid: bigint } + type ReturnType = get.ReturnType['value'] + type ErrorType = get.ErrorType | GlobalErrorType +} + +export async function getDisplay( + client: Client.Client, + parameters: getDisplay.ParametersType, + options?: CallOptions, +): Promise { + const data = await get( + client, + { + ...parameters, + userDataType: MessageProtobuf.UserDataType.DISPLAY, + }, + options, + ) + return data.value +} + +getDisplay.parseError = (error: unknown) => error as getDisplay.ErrorType + +export declare namespace getLocation { + type ParametersType = { fid: bigint } + type ReturnType = get.ReturnType['value'] + type ErrorType = get.ErrorType | GlobalErrorType +} + +export async function getLocation( + client: Client.Client, + parameters: getLocation.ParametersType, + options?: CallOptions, +): Promise { + const data = await get( + client, + { + ...parameters, + userDataType: MessageProtobuf.UserDataType.LOCATION, + }, + options, + ) + return data.value +} + +getLocation.parseError = (error: unknown) => error as getLocation.ErrorType + +export declare namespace getPfp { + type ParametersType = { fid: bigint } + type ReturnType = get.ReturnType['value'] + type ErrorType = get.ErrorType | GlobalErrorType +} + +export async function getPfp( + client: Client.Client, + parameters: getPfp.ParametersType, + options?: CallOptions, +): Promise { + const data = await get( + client, + { + ...parameters, + userDataType: MessageProtobuf.UserDataType.PFP, + }, + options, + ) + return data.value +} + +getPfp.parseError = (error: unknown) => error as getPfp.ErrorType + +export declare namespace getUrl { + type ParametersType = { fid: bigint } + type ReturnType = get.ReturnType['value'] + type ErrorType = get.ErrorType | GlobalErrorType +} + +export async function getUrl( + client: Client.Client, + parameters: getUrl.ParametersType, + options?: CallOptions, +): Promise { + const data = await get( + client, + { + ...parameters, + userDataType: MessageProtobuf.UserDataType.URL, + }, + options, + ) + return data.value +} + +getUrl.parseError = (error: unknown) => error as getUrl.ErrorType + +export declare namespace getUsername { + type ParametersType = { fid: bigint } + type ReturnType = get.ReturnType['value'] + type ErrorType = get.ErrorType | GlobalErrorType +} + +export async function getUsername( + client: Client.Client, + parameters: getUsername.ParametersType, + options?: CallOptions, +): Promise { + const data = await get( + client, + { + ...parameters, + userDataType: MessageProtobuf.UserDataType.USERNAME, + }, + options, + ) + return data.value +} + +getUsername.parseError = (error: unknown) => error as getUsername.ErrorType diff --git a/src/core/actions/UsernameProof.ts b/src/core/actions/UsernameProof.ts new file mode 100644 index 0000000..07c9245 --- /dev/null +++ b/src/core/actions/UsernameProof.ts @@ -0,0 +1,55 @@ +import { + type MessageJsonType, + create, + fromJson, + toJson, +} from '@bufbuild/protobuf' +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as UsernameProof from '../UsernameProof.js' +import * as RequestResponseProtobuf from '../protobufs/request_response_pb.js' + +export declare namespace get { + type ParametersType = { name: string } + type ReturnType = Omit + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const proof = await client.connectRpcClient.getUsernameProof( + create(RequestResponseProtobuf.UsernameProofRequestSchema, { + name: Uint8Array.from(Buffer.from(parameters.name)), + }), + options, + ) + return UsernameProof.fromProtobuf(proof) +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace getByFid { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.UsernameProofsResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const proofs = await client.connectRpcClient.getUserNameProofsByFid( + fromJson(RequestResponseProtobuf.FidRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.UsernameProofsResponseSchema, proofs) +} + +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType diff --git a/src/core/actions/Verification.ts b/src/core/actions/Verification.ts new file mode 100644 index 0000000..e1e133a --- /dev/null +++ b/src/core/actions/Verification.ts @@ -0,0 +1,76 @@ +import { type MessageJsonType, fromJson, toJson } from '@bufbuild/protobuf' +import type { CallOptions } from '@connectrpc/connect' +import type * as Client from '../../fhub/Client.js' +import type { GlobalErrorType } from '../Error.js' +import * as MessageProtobuf from '../protobufs/message_pb.js' +import * as RequestResponseProtobuf from '../protobufs/request_response_pb.js' + +export declare namespace Actions_Verification_get { + type ParametersType = + Required + type ReturnType = MessageJsonType + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function Actions_Verification_get( + client: Client.Client, + parameters: Actions_Verification_get.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getVerification( + fromJson(RequestResponseProtobuf.VerificationRequestSchema, parameters), + options, + ) + return toJson(MessageProtobuf.MessageSchema, message) +} + +Actions_Verification_get.parseError = (error: unknown) => + error as Actions_Verification_get.ErrorType + +export declare namespace Actions_Verification_getAllVerificationMessagesByFid { + type ParametersType = + Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.MessagesResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function Actions_Verification_getAllVerificationMessagesByFid( + client: Client.Client, + parameters: Actions_Verification_getAllVerificationMessagesByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getAllVerificationMessagesByFid( + fromJson(RequestResponseProtobuf.FidTimestampRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.MessagesResponseSchema, message) +} + +Actions_Verification_getAllVerificationMessagesByFid.parseError = ( + error: unknown, +) => error as Actions_Verification_getAllVerificationMessagesByFid.ErrorType + +export declare namespace Actions_Verification_getByFid { + type ParametersType = Required + type ReturnType = MessageJsonType< + typeof RequestResponseProtobuf.MessagesResponseSchema + > + // @TODO: proper error handling + type ErrorType = GlobalErrorType +} +export async function Actions_Verification_getByFid( + client: Client.Client, + parameters: Actions_Verification_getByFid.ParametersType, + options?: CallOptions, +): Promise { + const message = await client.connectRpcClient.getVerificationsByFid( + fromJson(RequestResponseProtobuf.FidRequestSchema, parameters), + options, + ) + return toJson(RequestResponseProtobuf.MessagesResponseSchema, message) +} + +Actions_Verification_getByFid.parseError = (error: unknown) => + error as Actions_Verification_getByFid.ErrorType diff --git a/src/core/actions/package.json b/src/core/actions/package.json new file mode 100644 index 0000000..a41f933 --- /dev/null +++ b/src/core/actions/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "types": "../_types/core/Actions.d.ts", + "module": "../_esm/core/Actions.js", + "main": "../_cjs/core/Actions.js" +} diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..1be423f --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,29 @@ +export * as Actions from './Actions.js' +export * as Cast from './Cast.js' +export * as CastAdd from './CastAdd.js' +export * as CastId from './CastId.js' +export * as CastRemove from './CastRemove.js' +export * as Constants from './Constants.js' +export * as Embed from './Embed.js' +export * as Error from './Error.js' +export * as FrameActionBody from './FrameActionBody.js' +export * as HubEvent from './HubEvent.js' +export * as Link from './Link.js' +export * as LinkAdd from './LinkAdd.js' +export * as LinkCompactState from './LinkCompactState.js' +export * as LinkRemove from './LinkRemove.js' +export * as Message from './Message.js' +export * as Meta from './Meta.js' +export * as Pagination from './Pagination.js' +export * as Parent from './Parent.js' +export * as Reaction from './Reaction.js' +export * as ReactionAdd from './ReactionAdd.js' +export * as ReactionRemove from './ReactionRemove.js' +export * as ReactionTarget from './ReactionTarget.js' +export * as ReactionType from './ReactionType.js' +export * as Types from './Types.js' +export * as UserData from './UserData.js' +export * as UsernameProof from './UsernameProof.js' +export * as Verification from './Verification.js' +export * as VerificationAdd from './VerificationAdd.js' +export * as VerificationRemoval from './VerificationRemoval.js' diff --git a/src/core/package.json b/src/core/package.json new file mode 100644 index 0000000..60a72d5 --- /dev/null +++ b/src/core/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "types": "../_types/core/index.d.ts", + "module": "../_esm/core/index.js", + "main": "../_cjs/core/index.js" +} diff --git a/src/Node/Internal/Protobufs/gossip_pb.ts b/src/core/protobufs/gossip_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/gossip_pb.ts rename to src/core/protobufs/gossip_pb.ts diff --git a/src/Node/Internal/Protobufs/hub_event_pb.ts b/src/core/protobufs/hub_event_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/hub_event_pb.ts rename to src/core/protobufs/hub_event_pb.ts diff --git a/src/Node/Internal/Protobufs/hub_state_pb.ts b/src/core/protobufs/hub_state_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/hub_state_pb.ts rename to src/core/protobufs/hub_state_pb.ts diff --git a/src/Node/Internal/Protobufs/job_pb.ts b/src/core/protobufs/job_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/job_pb.ts rename to src/core/protobufs/job_pb.ts diff --git a/src/Node/Internal/Protobufs/message_pb.ts b/src/core/protobufs/message_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/message_pb.ts rename to src/core/protobufs/message_pb.ts diff --git a/src/Node/Internal/Protobufs/onchain_event_pb.ts b/src/core/protobufs/onchain_event_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/onchain_event_pb.ts rename to src/core/protobufs/onchain_event_pb.ts diff --git a/src/Node/Internal/Protobufs/request_response_pb.ts b/src/core/protobufs/request_response_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/request_response_pb.ts rename to src/core/protobufs/request_response_pb.ts diff --git a/src/Node/Internal/Protobufs/rpc_pb.ts b/src/core/protobufs/rpc_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/rpc_pb.ts rename to src/core/protobufs/rpc_pb.ts diff --git a/src/Node/Internal/Protobufs/sync_trie_pb.ts b/src/core/protobufs/sync_trie_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/sync_trie_pb.ts rename to src/core/protobufs/sync_trie_pb.ts diff --git a/src/Node/Internal/Protobufs/username_proof_pb.ts b/src/core/protobufs/username_proof_pb.ts similarity index 100% rename from src/Node/Internal/Protobufs/username_proof_pb.ts rename to src/core/protobufs/username_proof_pb.ts diff --git a/src/fhub/Account.ts b/src/fhub/Account.ts new file mode 100644 index 0000000..fe669a4 --- /dev/null +++ b/src/fhub/Account.ts @@ -0,0 +1,42 @@ +import { Hex } from 'ox' +import type { Types } from 'ox' +import type { GlobalErrorType } from '../core/Error.js' + +export type Account = { + privateKey: Types.Hex + fid: bigint +} + +export function fromString( + value: fromString.ParametersType, +): fromString.ReturnType { + const [fidRaw, privateKey] = value.split(':') + const fid = BigInt(fidRaw) + Hex.assert(privateKey) + return { + fid, + privateKey, + } as const +} + +export declare namespace fromString { + type ParametersType = string + type ReturnType = Account + type ErrorType = Hex.InvalidHexValueError | GlobalErrorType +} + +fromString.parseError = (error: unknown) => error as fromString.ErrorType + +export function toString( + account: toString.ParametersType, +): toString.ReturnType { + return `${account.fid}:${account.privateKey}` +} + +export declare namespace toString { + type ParametersType = Account + type ReturnType = `${bigint}:${Types.Hex}` + type ErrorType = GlobalErrorType +} + +toString.parseError = (error: unknown) => error as toString.ErrorType diff --git a/src/fhub/Actions.ts b/src/fhub/Actions.ts new file mode 100644 index 0000000..716e6a0 --- /dev/null +++ b/src/fhub/Actions.ts @@ -0,0 +1,9 @@ +export * as Cast from './actions/Cast.js' +export * as ConversationTree from './actions/ConversationTree.js' +export * as Follow from './actions/Follow.js' +export * as Like from './actions/Like.js' +export * as Recast from './actions/Recast.js' +export * as SuperCast from './actions/SuperCast.js' +export * as User from './actions/User.js' +export * as Warpcast from './actions/Warpcast.js' +export * as Watch from './actions/Watch.js' diff --git a/src/fhub/Client.ts b/src/fhub/Client.ts new file mode 100644 index 0000000..e66cea4 --- /dev/null +++ b/src/fhub/Client.ts @@ -0,0 +1,27 @@ +import * as Connect from '@connectrpc/connect' +import type { GlobalErrorType } from '../core/Error.js' +import * as RpcProtobuf from '../core/protobufs/rpc_pb.js' + +export type Client = { + connectRpcClient: Connect.Client + /** The gRPC transport */ + transport: Connect.Transport +} + +export function create(transport: Connect.Transport): Client { + const connectRpcClient = Connect.createClient( + RpcProtobuf.HubService, + transport, + ) + + return { + connectRpcClient, + transport, + } +} + +export declare namespace create { + type ErrorType = GlobalErrorType +} + +create.parseError = (error: unknown) => error as create.ErrorType diff --git a/src/fhub/Conversation.ts b/src/fhub/Conversation.ts new file mode 100644 index 0000000..ef98113 --- /dev/null +++ b/src/fhub/Conversation.ts @@ -0,0 +1,9 @@ +import type * as Core from '../core/index.js' + +/** + * Conversation is a type that represents a list of casts that are + * linked together via `parentUrl`s. + * Methods that return `Conversation` guarantee the ordering, + * meaning that the root cast comes first. + */ +export type Conversation = Core.Cast.Cast[] diff --git a/src/fhub/ConversationTree.ts b/src/fhub/ConversationTree.ts new file mode 100644 index 0000000..734ccf0 --- /dev/null +++ b/src/fhub/ConversationTree.ts @@ -0,0 +1,150 @@ +import type * as Core from '../core/index.js' + +/** + * `ConversationTree` is a type that represents a tree of conversations. + * It is different from `Conversation` in a way that it uses a tree-like + * structure. + */ +export type ConversationTree = { + parent?: ConversationTree | null + path: cast['meta']['hash'][] + node: cast + children: ConversationTree[] +} + +export function filter({ + tree, + fids, +}: filter.ParametersType): filter.ReturnType { + const newTree: ConversationTree = { + path: [...tree.path], + parent: null, + node: tree.node, + children: [], + } + + const uniquePaths = (() => { + const paths: `0x${string}`[][] = [] + ;(function recursivelyFindApplicablePaths(tree: ConversationTree) { + if (fids.includes(tree.node.fid)) { + paths.push(tree.path) + } + for (const child of tree.children) { + recursivelyFindApplicablePaths(child) + } + })(tree) + return paths.filter( + (pathA) => + // Keep pathA only if there isn't a longer path that contains it + !paths.some( + (pathB) => + pathB.length > pathA.length && + // Check if pathA is a subset of pathB + pathA.every((node, index) => node === pathB[index]), + ), + ) + })() + + for (const uniquePath of uniquePaths) { + let currentTree = newTree + let searchTree = tree + + // Skip first hash since it's the root + for (const hash of uniquePath.slice(1)) { + // Find matching subtree in original tree + const originalSubTree = searchTree.children.find( + (childTree) => childTree.node.meta.hash === hash, + )! + + // Update the search tree for next iteration + searchTree = originalSubTree + + // Check if branch already exists in new tree + let subTree = currentTree.children.find( + (childTree) => childTree.node.meta.hash === hash, + ) + + if (!subTree) { + // Create new branch if it doesn't exist + subTree = { + path: [...originalSubTree.path], + parent: currentTree, + node: originalSubTree.node, + children: [], + } + currentTree.children.push(subTree) + } + currentTree = subTree + } + } + + return newTree +} + +export declare namespace filter { + type ParametersType = { tree: ConversationTree; fids: bigint[] } + type ReturnType = ConversationTree +} + +export function linearize({ + tree, +}: linearize.ParametersType): linearize.ReturnType { + const result: Core.Cast.Cast[][] = [] + + function linearizeRecursively( + tree: ConversationTree, + currentPath: Core.Cast.Cast[] = [], + ) { + // Add current node to the path + currentPath.push(tree.node) + + if (tree.children.length === 0) { + // If it's a leaf node, add the complete path to results + result.push([...currentPath]) + } else { + // Process each child with a copy of the current path + for (const child of tree.children) { + linearizeRecursively(child, [...currentPath]) + } + } + } + + linearizeRecursively(tree, []) + return result +} + +export declare namespace linearize { + type ParametersType = { + tree: ConversationTree + } + type ReturnType = Core.Cast.Cast[][] +} + +export function log({ + tree, +}: log.ParametersType): log.ReturnType { + ;(function logConversation(value: ConversationTree) { + // biome-ignore lint/suspicious/noConsoleLog: + console.log( + '|\x1b[25m%s\x1b[0m: \x1b[35m%s\x1b[0m', + value.node.fid, + (() => { + if ('unwrapped' in value.node.text) + return (value.node.text.unwrapped as string).replaceAll('\n', ' ') + return value.node.text.value.replaceAll('\n', ' ') + })(), + ) + if (value.children.length > 0) console.group('|-|') + for (const child of value.children) { + logConversation(child) + } + if (value.children.length > 0) console.groupEnd() + })(tree) +} + +export declare namespace log { + type ParametersType = { + tree: ConversationTree + } + type ReturnType = void +} diff --git a/src/fhub/SuperCast.ts b/src/fhub/SuperCast.ts new file mode 100644 index 0000000..b5bf359 --- /dev/null +++ b/src/fhub/SuperCast.ts @@ -0,0 +1,13 @@ +import type * as Core from '../core/index.js' + +/** + * `SuperCast` is a cast that has the text with unwrapped mentions, + * recasts and relikes data + */ +export type SuperCast = Core.Cast.Cast & { + recasts: Core.Reaction.Reaction[] + likes: Core.Reaction.Reaction[] + text: { + unwrapped: string + } +} diff --git a/src/fhub/Transport.ts b/src/fhub/Transport.ts new file mode 100644 index 0000000..6329f0f --- /dev/null +++ b/src/fhub/Transport.ts @@ -0,0 +1,4 @@ +export { createConnectTransport as connectNode } from '@connectrpc/connect-node' +export { createConnectTransport as connectWeb } from '@connectrpc/connect-web' +export { createGrpcTransport as grpcNode } from '@connectrpc/connect-node' +export { createGrpcWebTransport as grpcWeb } from '@connectrpc/connect-web' diff --git a/src/fhub/Types.ts b/src/fhub/Types.ts new file mode 100644 index 0000000..956aa74 --- /dev/null +++ b/src/fhub/Types.ts @@ -0,0 +1,3 @@ +export type { Account } from './Account.js' +export type { Conversation } from './Conversation.js' +export type { ConversationTree } from './ConversationTree.js' diff --git a/src/fhub/Utils.ts b/src/fhub/Utils.ts new file mode 100644 index 0000000..2f880d8 --- /dev/null +++ b/src/fhub/Utils.ts @@ -0,0 +1 @@ +export * from './utils/LruSet.js' diff --git a/src/fhub/actions/Cast.ts b/src/fhub/actions/Cast.ts new file mode 100644 index 0000000..545f453 --- /dev/null +++ b/src/fhub/actions/Cast.ts @@ -0,0 +1,196 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Account from '../Account.js' +import type * as Client from '../Client.js' +import * as Warpcast from './Warpcast.js' + +export declare namespace create { + type ParametersType = ( + | { + cast: Omit + } + | getRoot.ParametersType + ) & { + account: Account.Account + } + type ReturnType = Core.Message.Message + type ErrorType = GlobalErrorType +} +export async function create( + client: Client.Client, + parameters: create.ParametersType, + options?: CallOptions, +): Promise { + const cast = await (async () => { + if ('cast' in parameters) return parameters.cast + + return getRoot(client, parameters, options) + })() + const message = Core.CastAdd.toMessageProtobuf({ + cast: { + ...cast, + fid: parameters.account.fid, + timestamp: Math.floor(Date.now() / 1000), + }, + privateKey: parameters.account.privateKey, + }) + return Core.Actions.Submit.submitMessage(client, message, options) +} + +create.parseError = (error: unknown) => error as create.ErrorType + +export declare namespace fromString { + type ParametersType = { + text: string + embeds?: Core.Embed.Embed[] | undefined + } + type ReturnType = Pick + type ErrorType = GlobalErrorType +} +export async function fromString( + client: Client.Client, + parameters: fromString.ParametersType, + options?: CallOptions, +): Promise { + const mentionsMatches = [...parameters.text.matchAll(/@\w+(?:.eth)?/gim)] + const embedsMatches = [ + ...parameters.text.matchAll( + /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/gim, + ), + ] + const mentions: { fid: bigint; position: number }[] = [] + const embeds: Core.Embed.Embed[] = [] + + for ( + let mentionsMatchIndex = 0; + mentionsMatchIndex < mentionsMatches.length; + ++mentionsMatchIndex + ) { + const mentionMatch = mentionsMatches[mentionsMatchIndex] + const mention = mentionMatch[0] + const position = + mentionMatch.index - + /* remove the delta*/ + mentionsMatches + .slice(0, mentionsMatchIndex) + .reduce((delta, prevMentionMatch) => { + return delta + prevMentionMatch[0].length + }, 0) + + try { + const proof = await Core.Actions.UsernameProof.get(client, { + name: mention.slice(1), + }) + + mentions.push({ + fid: proof.fid, + position, + }) + // @TODO: better error narrowing + } catch {} + } + + for (const embedMatch of embedsMatches) { + const url = embedMatch[0] + + // @TODO: supercast and other urls that resolve to castId embed + + // Need to refine the url for specific warpcast format since it can have ).( or other symbols at the end + const refinedWarpcastCastUrl = url.match( + /https:\/\/warpcast\.com\/\S+\/0x[0-9a-f]{8,}/i, + )?.[0] + + if (refinedWarpcastCastUrl) { + const castId = await Warpcast.getCastIdFromUrl( + client, + { url: refinedWarpcastCastUrl }, + options, + ) + embeds.push({ type: 'cast', ...castId }) + } else + embeds.push({ + type: 'url', + url: url, + }) + } + + let strippedText = parameters.text + // if the last embed was at the end of the cast we strip it just like warpcast does + if ( + embedsMatches.length !== 0 && + embedsMatches[embedsMatches.length - 1].index + + embedsMatches[embedsMatches.length - 1][0].length === + parameters.text.length + ) { + strippedText = strippedText.slice( + 0, + embedsMatches[embedsMatches.length - 1].index, + ) + } + + for (const mention of mentionsMatches.reverse()) { + strippedText = `${strippedText.slice(0, mention.index)}${strippedText.slice(mention.index + mention[0].length)}` + } + + return { + text: { + value: strippedText, + embeds: [...embeds, ...(parameters.embeds ?? [])], + mentions, + }, + isLong: strippedText.length > 320, + } +} + +fromString.parseError = (error: unknown) => error as fromString.ErrorType + +export declare namespace getRoot { + type ParametersType = + | Core.Actions.Cast.get.ParametersType + | Core.Actions.Cast.get.ReturnType + type ReturnType = Core.Actions.Cast.get.ReturnType + type ErrorType = GlobalErrorType +} +export async function getRoot( + client: Client.Client, + parameters: getRoot.ParametersType, + options?: CallOptions, +): Promise { + let cast = + 'meta' in parameters + ? parameters + : await Core.Actions.Cast.get(client, parameters, options) + while (cast.parent !== undefined && cast.parent.type === 'cast') { + cast = await Core.Actions.Cast.get(client, cast.parent, options) + } + return cast +} + +getRoot.parseError = (error: unknown) => error as getRoot.ErrorType + +export declare namespace toString { + type ParametersType = Core.Cast.Cast + type ReturnType = string + type ErrorType = GlobalErrorType +} +export async function toString( + client: Client.Client, + cast: toString.ParametersType, +): Promise { + const unwrappedText = await (async () => { + let text = cast.text.value + if (!cast.text.mentions) return text + for (const mention of cast.text.mentions.reverse()) { + const mentionUsername = await Core.Actions.UserData.getUsername(client, { + fid: mention.fid, + }) + text = `${text.slice(0, mention.position)}@${mentionUsername}${text.slice(mention.position)}` + } + return text + })() + + return unwrappedText +} + +toString.parseError = (error: unknown) => error as toString.ErrorType diff --git a/src/fhub/actions/ConversationTree.ts b/src/fhub/actions/ConversationTree.ts new file mode 100644 index 0000000..3ac2de1 --- /dev/null +++ b/src/fhub/actions/ConversationTree.ts @@ -0,0 +1,133 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Client from '../Client.js' +import type * as ConversationTree from '../ConversationTree.js' +import * as Cast from './Cast.js' + +export declare namespace get { + type ParametersType = Core.Actions.Cast.get.ParametersType + type ReturnType = ConversationTree.ConversationTree + type ErrorType = Core.Actions.Cast.get.ErrorType | GlobalErrorType +} +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const cast = await Core.Actions.Cast.get(client, parameters, options) + // @TODO: proper error + if (cast.parent !== undefined && cast.parent.type === 'cast') + throw new Error( + 'You can get conversations by only specifying root cast using this method.', + ) + + async function getChildren( + cast: Core.Cast.Cast, + parent: ConversationTree.ConversationTree | null, + ): Promise { + const children = await (async () => { + let nextPageToken: Core.Pagination.NextPageToken | undefined = undefined + const casts: Core.Cast.Cast[] = [] + + do { + const getByParentResult: Core.Actions.Cast.getByParent.ReturnType = + await Core.Actions.Cast.getByParent( + client, + { + parent: { type: 'cast', fid: cast.fid, hash: cast.meta.hash }, + // @TODO: consider exporting this as params + reverse: true, + pageSize: 100, + pageToken: nextPageToken, + }, + options, + ) + casts.push(...getByParentResult.casts) + nextPageToken = getByParentResult.nextPageToken + } while (nextPageToken !== null) + + return casts + })() + const tree = { + node: cast, + parent: parent, + path: [...(parent?.path ?? []), cast.meta.hash], + children: [], + } as ConversationTree.ConversationTree + tree.children = await Promise.all( + children.map((child) => getChildren(child, tree)), + ) + return tree + } + return getChildren(cast, null) +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace getByFid { + type ParametersType = { + fid: bigint + excludedRoots: Set + } & Core.Pagination.Pagination + type ReturnType = { + conversationsTrees: get.ReturnType[] + excludedRoots: Set + nextPageToken: Core.Pagination.NextPageToken + } + type ErrorType = Core.Actions.Cast.get.ErrorType | GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const getByFidResult = await Core.Actions.Cast.getByFid( + client, + parameters, + options, + ) + + const rootCasts = await (async () => { + const res = await Promise.all( + getByFidResult.casts.map(async (cast) => { + try { + return await Cast.getRoot(client, cast) + } catch { + return null + } + }), + ) + return res.filter( + (cast, i, casts): cast is Core.Cast.Cast => + cast !== null && + casts.findIndex( + (castToFind) => castToFind?.meta.hash === cast.meta.hash, + ) === i, + ) + })() + + const conversationsTrees = await Promise.all( + rootCasts + .filter((rootCast) => !parameters.excludedRoots.has(rootCast.meta.hash)) + .map((rootCast) => { + return get( + client, + { fid: rootCast.fid, hash: rootCast.meta.hash }, + options, + ) + }), + ) + + const excludedRoots = parameters.excludedRoots.union( + new Set([...rootCasts].map((cast) => cast.meta.hash)), + ) + + return { + conversationsTrees, + excludedRoots, + nextPageToken: getByFidResult.nextPageToken, + } +} + +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType diff --git a/src/fhub/actions/Follow.ts b/src/fhub/actions/Follow.ts new file mode 100644 index 0000000..e5c2127 --- /dev/null +++ b/src/fhub/actions/Follow.ts @@ -0,0 +1,64 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Account from '../Account.js' +import type * as Client from '../Client.js' + +export declare namespace create { + type ParametersType = { + follow: Omit + account: Account.Account + } + type ReturnType = Core.Message.Message + type ErrorType = GlobalErrorType +} +export async function create( + client: Client.Client, + parameters: create.ParametersType, + options?: CallOptions, +): Promise { + const message = Core.LinkAdd.toMessageProtobuf({ + link: { + type: 'follow', + ...parameters.follow, + fid: parameters.account.fid, + timestamp: Math.floor(Date.now() / 1000), + }, + privateKey: parameters.account.privateKey, + }) + return Core.Actions.Submit.submitMessage(client, message, options) +} + +create.parseError = (error: unknown) => error as create.ErrorType + +export declare namespace createByUsername { + type ParametersType = { + follow: Omit & { + username: string + } + + account: Account.Account + } + type ReturnType = create.ReturnType + type ErrorType = create.ErrorType | GlobalErrorType +} +export async function createByUsername( + client: Client.Client, + parameters: createByUsername.ParametersType, + options?: CallOptions, +): Promise { + const { fid } = await Core.Actions.UsernameProof.get(client, { + name: parameters.follow.username, + }) + return create( + client, + { + follow: { ...parameters.follow, targetFid: fid }, + account: parameters.account, + }, + options, + ) +} + +createByUsername.parseError = (error: unknown) => + error as createByUsername.ErrorType diff --git a/src/fhub/actions/Like.ts b/src/fhub/actions/Like.ts new file mode 100644 index 0000000..6ac99b4 --- /dev/null +++ b/src/fhub/actions/Like.ts @@ -0,0 +1,39 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Account from '../Account.js' +import type * as Client from '../Client.js' + +export declare namespace create { + type ParametersType = { + like: Omit< + Extract, + 'type' + > + account: Account.Account + } + type ReturnType = Core.Message.Message + type ErrorType = GlobalErrorType +} +export async function create( + client: Client.Client, + parameters: create.ParametersType, + options?: CallOptions, +): Promise { + parameters.like + const message = Core.ReactionAdd.toMessageProtobuf({ + reaction: { + type: 'like', + target: { + type: 'cast', + ...parameters.like, + }, + fid: parameters.account.fid, + timestamp: Math.floor(Date.now() / 1000), + }, + privateKey: parameters.account.privateKey, + }) + return Core.Actions.Submit.submitMessage(client, message, options) +} + +create.parseError = (error: unknown) => error as create.ErrorType diff --git a/src/fhub/actions/Recast.ts b/src/fhub/actions/Recast.ts new file mode 100644 index 0000000..9fbcfe0 --- /dev/null +++ b/src/fhub/actions/Recast.ts @@ -0,0 +1,39 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Account from '../Account.js' +import type * as Client from '../Client.js' + +export declare namespace create { + type ParametersType = { + recast: Omit< + Extract, + 'type' + > + account: Account.Account + } + type ReturnType = Core.Message.Message + type ErrorType = GlobalErrorType +} +export async function create( + client: Client.Client, + parameters: create.ParametersType, + options?: CallOptions, +): Promise { + parameters.recast + const message = Core.ReactionAdd.toMessageProtobuf({ + reaction: { + type: 'recast', + target: { + type: 'cast', + ...parameters.recast, + }, + fid: parameters.account.fid, + timestamp: Math.floor(Date.now() / 1000), + }, + privateKey: parameters.account.privateKey, + }) + return Core.Actions.Submit.submitMessage(client, message, options) +} + +create.parseError = (error: unknown) => error as create.ErrorType diff --git a/src/fhub/actions/SuperCast.ts b/src/fhub/actions/SuperCast.ts new file mode 100644 index 0000000..6f8a802 --- /dev/null +++ b/src/fhub/actions/SuperCast.ts @@ -0,0 +1,214 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { Types } from 'ox' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Account from '../Account.js' +import type * as Client from '../Client.js' +import type * as SuperCast from '../SuperCast.js' +import * as Cast from './Cast.js' + +export declare namespace create { + type ParametersType = ( + | { + cast: Omit + } + | Cast.getRoot.ParametersType + ) & { + account: Account.Account + } + type ReturnType = Core.Message.Message + type ErrorType = GlobalErrorType +} +export async function create( + client: Client.Client, + parameters: create.ParametersType, + options?: CallOptions, +): Promise { + const cast = await (async () => { + if ('cast' in parameters) return parameters.cast + + return Cast.getRoot(client, parameters, options) + })() + const message = Core.CastAdd.toMessageProtobuf({ + cast: { + ...cast, + fid: parameters.account.fid, + timestamp: Math.floor(Date.now() / 1000), + }, + privateKey: parameters.account.privateKey, + }) + return Core.Actions.Submit.submitMessage(client, message, options) +} + +create.parseError = (error: unknown) => error as create.ErrorType + +export declare namespace get { + type ParametersType = Core.Actions.Cast.get.ParametersType + type ReturnType = SuperCast.SuperCast + type ErrorType = Core.Actions.Cast.get.ErrorType | GlobalErrorType +} +export async function get( + client: Client.Client, + parameters: get.ParametersType, + options?: CallOptions, +): Promise { + const cast = await Core.Actions.Cast.get(client, parameters, options) + + const reactions = await (async () => { + const reactions: Core.Reaction.Reaction[] = [] + let reactionsPageToken: Types.Hex | null = null + do { + const { nextPageToken, messages } = await Core.Actions.Reaction.getByCast( + client, + { + ...parameters, + pageToken: reactionsPageToken ? reactionsPageToken : undefined, + }, + ) + reactionsPageToken = nextPageToken as any + reactions.push(...messages) + } while (reactionsPageToken) + return reactions + })() + + const likes = reactions.filter((reaction) => reaction.type === 'like') + const recasts = reactions.filter((reaction) => reaction.type === 'recast') + + return { + ...cast, + text: { + ...cast.text, + unwrapped: await Cast.toString(client, cast), + }, + likes, + recasts, + } +} + +get.parseError = (error: unknown) => error as get.ErrorType + +export declare namespace getByFid { + type ParametersType = Core.Actions.Cast.getByFid.ParametersType + type ReturnType = { + nextPageToken: Core.Pagination.NextPageToken + casts: SuperCast.SuperCast[] + } + type ErrorType = Core.Actions.Cast.get.ErrorType | GlobalErrorType +} +export async function getByFid( + client: Client.Client, + parameters: getByFid.ParametersType, + options?: CallOptions, +): Promise { + const casts: getByFid.ReturnType['casts'] = [] + const getCastsByFidResult: Core.Actions.Cast.getByFid.ReturnType = + await Core.Actions.Cast.getByFid(client, parameters, options) + + casts.push( + ...(await Promise.all( + getCastsByFidResult.casts.map(async (cast) => { + const reactions = await (async () => { + const reactions: Core.Reaction.Reaction[] = [] + let reactionsPageToken: Types.Hex | null = null + do { + const { nextPageToken, messages } = + await Core.Actions.Reaction.getByCast(client, { + fid: cast.fid, + hash: cast.meta.hash, + pageToken: reactionsPageToken ? reactionsPageToken : undefined, + }) + reactionsPageToken = nextPageToken as any + reactions.push(...messages) + } while (reactionsPageToken) + return reactions + })() + + const likes = reactions.filter((reaction) => reaction.type === 'like') + const recasts = reactions.filter( + (reaction) => reaction.type === 'recast', + ) + + return { + ...cast, + text: { + ...cast.text, + unwrapped: await Cast.toString(client, cast), + }, + likes, + recasts, + } + }), + )), + ) + return { ...getCastsByFidResult, casts } +} + +getByFid.parseError = (error: unknown) => error as getByFid.ErrorType + +export declare namespace Actions_SuperCast_getByParent { + type ParametersType = Core.Actions.Cast.getByParent.ParametersType + type ReturnType = SuperCast.SuperCast[] + type ErrorType = Core.Actions.Cast.get.ErrorType | GlobalErrorType +} +export async function Actions_SuperCast_getByParent( + client: Client.Client, + parameters: Actions_SuperCast_getByParent.ParametersType, + options?: CallOptions, +): Promise { + let castsPageToken: Types.Hex | null = null + const casts: Actions_SuperCast_getByParent.ReturnType = [] + do { + const getCastsByParentResult: Core.Actions.Cast.getByParent.ReturnType = + await Core.Actions.Cast.getByParent( + client, + { + pageToken: castsPageToken ?? undefined, + ...parameters, + }, + options, + ) + casts.push( + ...(await Promise.all( + getCastsByParentResult.casts.map(async (cast) => { + const reactions = await (async () => { + const reactions: Core.Reaction.Reaction[] = [] + let reactionsPageToken: Types.Hex | null = null + do { + const { nextPageToken, messages } = + await Core.Actions.Reaction.getByCast(client, { + fid: cast.fid, + hash: cast.meta.hash, + pageToken: reactionsPageToken + ? reactionsPageToken + : undefined, + }) + reactionsPageToken = nextPageToken as any + reactions.push(...messages) + } while (reactionsPageToken) + return reactions + })() + + const likes = reactions.filter((reaction) => reaction.type === 'like') + const recasts = reactions.filter( + (reaction) => reaction.type === 'recast', + ) + + return { + ...cast, + text: { + ...cast.text, + unwrapped: await Cast.toString(client, cast), + }, + likes, + recasts, + } + }), + )), + ) + castsPageToken = getCastsByParentResult.nextPageToken + } while (castsPageToken !== null) + return casts +} + +Actions_SuperCast_getByParent.parseError = (error: unknown) => + error as Actions_SuperCast_getByParent.ErrorType diff --git a/src/Internal/Actions/User/get.ts b/src/fhub/actions/User.ts similarity index 58% rename from src/Internal/Actions/User/get.ts rename to src/fhub/actions/User.ts index 875afc3..b1a9381 100644 --- a/src/Internal/Actions/User/get.ts +++ b/src/fhub/actions/User.ts @@ -1,12 +1,9 @@ import type { CallOptions } from '@connectrpc/connect' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import type { GlobalErrorType } from '../../Errors/error.js' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Client from '../Client.js' -export declare namespace Actions_User_get { +export declare namespace get { type ParametersType = { fid: bigint } type ReturnType = { pfp: string | null @@ -16,20 +13,18 @@ export declare namespace Actions_User_get { username: string | null location: string | null } - type ErrorType = - | NodeActions.UserData.getUserDataByFid.ErrorType - | GlobalErrorType + type ErrorType = Core.Actions.UserData.getByFid.ErrorType | GlobalErrorType } -export async function Actions_User_get( - client: Client, - parameters: Actions_User_get.ParametersType, +export async function get( + client: Client.Client, + parameters: get.ParametersType, options?: CallOptions, -): Promise { - let nextPageToken: NodeTypes.NextPageToken = null +): Promise { + let nextPageToken: Core.Pagination.NextPageToken = null const userDatas = await (async () => { - const datas: NodeTypes.UserData[] = [] + const datas: Core.UserData.UserData[] = [] do { - const result = await NodeActions.UserData.getUserDataByFid( + const result = await Core.Actions.UserData.getByFid( client, { fid: parameters.fid }, options, @@ -50,5 +45,4 @@ export async function Actions_User_get( } } -Actions_User_get.parseError = (error: unknown) => - error as Actions_User_get.ErrorType +get.parseError = (error: unknown) => error as get.ErrorType diff --git a/src/Internal/Actions/Warpcast/getFullCastHash.ts b/src/fhub/actions/Warpcast.ts similarity index 58% rename from src/Internal/Actions/Warpcast/getFullCastHash.ts rename to src/fhub/actions/Warpcast.ts index 1169f8f..ef89534 100644 --- a/src/Internal/Actions/Warpcast/getFullCastHash.ts +++ b/src/fhub/actions/Warpcast.ts @@ -1,22 +1,19 @@ import type { CallOptions } from '@connectrpc/connect' import type { Types } from 'ox' -import { - Actions as NodeActions, - type Types as NodeTypes, -} from '../../../Node/index.js' -import type { Client } from '../../Client/types.js' -import { type GlobalErrorType, UnexpectedError } from '../../Errors/error.js' +import { type GlobalErrorType, UnexpectedError } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Client from '../Client.js' -export declare namespace Actions_Warpcast_getCastIdFromUrl { +export declare namespace getCastIdFromUrl { type ParametersType = { url: string } - type ReturnType = NodeTypes.CastId + type ReturnType = Core.CastId.CastId type ErrorType = GlobalErrorType } -export async function Actions_Warpcast_getCastIdFromUrl( - client: Client, - parameters: Actions_Warpcast_getCastIdFromUrl.ParametersType, +export async function getCastIdFromUrl( + client: Client.Client, + parameters: getCastIdFromUrl.ParametersType, options?: CallOptions, -): Promise { +): Promise { const response = await fetch(parameters.url, { headers: { 'User-Agent': 'Twitter Bot', @@ -37,7 +34,7 @@ export async function Actions_Warpcast_getCastIdFromUrl( )?.groups?.username if (!username) throw new UnexpectedError('Expected url to have username.') - const proof = await NodeActions.UsernameProof.getUsernameProof( + const proof = await Core.Actions.UsernameProof.get( client, { name: username, @@ -48,5 +45,5 @@ export async function Actions_Warpcast_getCastIdFromUrl( return { hash: castHash as Types.Hex, fid: proof.fid } } -Actions_Warpcast_getCastIdFromUrl.parseError = (error: unknown) => - error as Actions_Warpcast_getCastIdFromUrl.ErrorType +getCastIdFromUrl.parseError = (error: unknown) => + error as getCastIdFromUrl.ErrorType diff --git a/src/fhub/actions/Watch.ts b/src/fhub/actions/Watch.ts new file mode 100644 index 0000000..ce997c2 --- /dev/null +++ b/src/fhub/actions/Watch.ts @@ -0,0 +1,90 @@ +import type { CallOptions } from '@connectrpc/connect' +import type { GlobalErrorType } from '../../core/Error.js' +import * as Core from '../../core/index.js' +import type * as Client from '../Client.js' +import * as Cast from './Cast.js' + +export declare namespace watchCasts { + type ReturnType = AsyncGenerator + type ErrorType = Core.Actions.Cast.get.ErrorType | GlobalErrorType +} +export async function* watchCasts( + client: Client.Client, + options?: CallOptions, +): watchCasts.ReturnType { + for await (const event of Core.Actions.Event.subscribe( + client, + { + eventTypes: ['mergeMessage'], + }, + options, + )) { + if (event.message === undefined || event.message.type !== 'castAdd') + continue + yield event.message.data + } +} + +watchCasts.parseError = (error: unknown) => error as watchCasts.ErrorType + +export declare namespace watchCastsCompliantToRegexp { + type ParametersType = { regexp: RegExp } + type ReturnType = watchCasts.ReturnType + type ErrorType = watchCasts.ErrorType | GlobalErrorType +} +export async function* watchCastsCompliantToRegexp( + client: Client.Client, + parameters: watchCastsCompliantToRegexp.ParametersType, + options?: CallOptions, +): watchCastsCompliantToRegexp.ReturnType { + for await (const cast of watchCasts(client, options)) { + if (parameters.regexp.test(await Cast.toString(client, cast))) yield cast + } +} + +watchCastsCompliantToRegexp.parseError = (error: unknown) => + error as watchCastsCompliantToRegexp.ErrorType + +export declare namespace watchCastsMentioningFid { + type ParametersType = { fid: bigint } + type ReturnType = watchCasts.ReturnType + type ErrorType = watchCasts.ErrorType | GlobalErrorType +} +export async function* watchCastsMentioningFid( + client: Client.Client, + parameters: watchCastsMentioningFid.ParametersType, + options?: CallOptions, +): watchCastsMentioningFid.ReturnType { + for await (const cast of watchCasts(client, options)) { + if (!cast.text.mentions) continue + if (cast.text.mentions.some((mention) => mention.fid === parameters.fid)) + yield cast + } +} + +watchCastsMentioningFid.parseError = (error: unknown) => + error as watchCastsMentioningFid.ErrorType + +export declare namespace watchCastsMentioningUsername { + type ParametersType = { username: string } + type ReturnType = watchCastsMentioningFid.ReturnType + type ErrorType = watchCastsMentioningFid.ErrorType | GlobalErrorType +} +export async function* watchCastsMentioningUsername( + client: Client.Client, + parameters: watchCastsMentioningUsername.ParametersType, + options?: CallOptions, +): watchCastsMentioningUsername.ReturnType { + const { fid } = await Core.Actions.UsernameProof.get( + client, + { name: parameters.username }, + options, + ) + + for await (const cast of watchCastsMentioningFid(client, { fid }, options)) { + yield cast + } +} + +watchCastsMentioningUsername.parseError = (error: unknown) => + error as watchCastsMentioningUsername.ErrorType diff --git a/src/fhub/index.ts b/src/fhub/index.ts new file mode 100644 index 0000000..110b4e9 --- /dev/null +++ b/src/fhub/index.ts @@ -0,0 +1,9 @@ +export * as Account from './Account.js' +export * as Actions from './Actions.js' +export * as Client from './Client.js' +export * as Conversation from './Conversation.js' +export * as ConversationTree from './ConversationTree.js' +export * as SuperCast from './SuperCast.js' +export * as Transport from './Transport.js' +export * as Types from './Types.js' +export * as Utils from './Utils.js' diff --git a/src/Internal/types.ts b/src/fhub/internal/types.ts similarity index 100% rename from src/Internal/types.ts rename to src/fhub/internal/types.ts diff --git a/src/fhub/utils/LruSet.ts b/src/fhub/utils/LruSet.ts new file mode 100644 index 0000000..6e3d15c --- /dev/null +++ b/src/fhub/utils/LruSet.ts @@ -0,0 +1,28 @@ +export class LruSet extends Set { + private maxSize: number + + constructor(size: number, iterable?: Iterable | null) { + super(iterable) + this.maxSize = size + } + + override add(value: T): this { + super.add(value) + if (this.maxSize && this.size > this.maxSize) { + const firstItem = this.values().next().value + if (firstItem) this.delete(firstItem) + } + return this + } + override union(value: Set): LruSet { + const result = new LruSet(this.maxSize, super.union(value) as any) + if (result.maxSize && result.size > result.maxSize) { + const iterator = result.values() + for (let i = 0; i < result.size - result.maxSize; i++) { + const firstItem = iterator.next().value + if (firstItem) result.delete(firstItem) + } + } + return result + } +} diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index cd8225a..0000000 --- a/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * as Actions from './Actions.js' -export * as Client from './Client.js' -export * as Transport from './Transport.js' diff --git a/src/package.json b/src/package.json index 9bf5aa1..e3d67ea 100644 --- a/src/package.json +++ b/src/package.json @@ -3,26 +3,26 @@ "description": "TypeScript Interface for Farcaster Hubs", "version": "0.0.0", "type": "module", - "module": "./_esm/index.js", - "types": "./_types/index.d.ts", - "typings": "./_types/index.d.ts", + "module": "./_esm/fhub/index.js", + "types": "./_types/fhub/index.d.ts", + "typings": "./_types/fhub/index.d.ts", "sideEffects": false, "files": ["*", "!**/*.tsbuildinfo", "!tsconfig.build.json", "!jsr.json"], "bin": { - "fhub": "./_esm/Cli/Bin.js" + "fhub": "./_esm/cli/Bin.js" }, "exports": { ".": { - "types": "./_types/index.d.ts", - "import": "./_esm/index.js" + "types": "./_types/fhub/index.d.ts", + "import": "./_esm/fhub/index.js" }, - "./Node": { - "types": "./_types/Node/index.d.ts", - "import": "./_esm/Node/index.js" + "./core": { + "types": "./_types/core/index.d.ts", + "import": "./_esm/core/index.js" }, - "./Cli": { - "types": "./_types/Cli/index.d.ts", - "import": "./_esm/Cli/index.js" + "./cli": { + "types": "./_types/cli/index.d.ts", + "import": "./_esm/cli/index.js" }, "./package.json": "./package.json" }, diff --git a/tsconfig.base.json b/tsconfig.base.json index 6f0f4e2..137d457 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -32,9 +32,9 @@ // Language and environment "moduleResolution": "NodeNext", "module": "NodeNext", - "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping. + "target": "esnext", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping. "lib": [ - "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances. + "esnext", // By using ES2022 we get access to the `.cause` property on `Error` instances. "DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped. ],