diff --git a/.claude/launch.json b/.claude/launch.json new file mode 100644 index 0000000000..c6649917ae --- /dev/null +++ b/.claude/launch.json @@ -0,0 +1,53 @@ +{ + "version": "0.0.1", + "configurations": [ + { + "name": "server", + "runtimeExecutable": "bash", + "runtimeArgs": [ + "-c", + "cd server && bun run dev" + ], + "port": 8000 + }, + { + "name": "poo-site", + "runtimeExecutable": "python3", + "runtimeArgs": [ + "-m", + "http.server", + "8787", + "--directory", + "/private/tmp/claude-501/-Users-mo-dev-inline-chat-inline/edb6300b-cf65-4f16-975a-67c4adb6b305/scratchpad/site" + ], + "port": 8787 + }, + { + "name": "web", + "runtimeExecutable": "bash", + "runtimeArgs": [ + "-c", + "cd web && bun run dev" + ], + "port": 8001 + }, + { + "name": "web-preview", + "runtimeExecutable": "bash", + "runtimeArgs": [ + "-c", + "cd web && bun run build && bun run preview" + ], + "port": 8001 + }, + { + "name": "web-labs", + "runtimeExecutable": "bash", + "runtimeArgs": [ + "-c", + "cd web && bunx vite preview -c tooling/vite.labs.config.ts" + ], + "port": 8001 + } + ] +} diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml index 4a42e49495..a12f0f4f18 100644 --- a/.github/workflows/integrations.yml +++ b/.github/workflows/integrations.yml @@ -16,8 +16,37 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: + web: + name: Web app + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.4.4 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Check web app and client packages + run: | + bun run --cwd web typecheck + bun run --cwd web lint + bun run --cwd web test + bun run --cwd web test:packages + bun run --cwd web build + + # Headless Google Chrome (preinstalled on ubuntu-latest): the Solid binding tests in a real + # browser, the timeline lab, and every page free of errors and Solid's development warnings. + - name: Browser checks + run: bun run --cwd web check:browser + landing: - name: Landing and browser client + name: Landing runs-on: ubuntu-latest timeout-minutes: 20 steps: @@ -37,16 +66,12 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile - - name: Check landing and browser client + - name: Check landing run: | bun run --cwd landing build bun run --cwd landing typecheck bun run --cwd landing lint bun run --cwd landing test - bun run --cwd landing/packages/client test - for package in auth ids log protocol; do - bun run --cwd "landing/packages/$package" test - done - name: Install Chromium for browser acceptance working-directory: landing run: bun x playwright install --with-deps chromium @@ -519,7 +544,7 @@ jobs: required: name: Integrations required if: ${{ always() }} - needs: [landing, codex-plugin, mcp, openclaw, openclaw-source, hermes, chat-sdk, shared-packages, rust-workspace, workflow-and-release-contracts, candidate-packages, packed-consumers, openclaw-admission, hermes-admission, local-integration] + needs: [landing, codex-plugin, mcp, openclaw, openclaw-source, hermes, chat-sdk, shared-packages, rust-workspace, workflow-and-release-contracts, candidate-packages, packed-consumers, openclaw-admission, hermes-admission, local-integration, web] runs-on: ubuntu-latest timeout-minutes: 5 steps: diff --git a/.oxlintrc.json b/.oxlintrc.json index 79c15d046c..21e5ede7ad 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -8,6 +8,14 @@ { "name": "inline-tests", "specifier": "./server/scripts/lint/oxlint-plugin-inline-tests.js" + }, + { + "name": "solid", + "specifier": "./web/node_modules/eslint-plugin-solid/dist/index.mjs" + }, + { + "name": "inline-solid", + "specifier": "./web/tooling/lint/oxlint-plugin-inline-solid.js" } ], "categories": { @@ -23,7 +31,7 @@ { "files": [ "web/src/**/*.{ts,tsx}", - "landing/packages/client/src/**/*.{ts,tsx}" + "web/packages/client/src/**/*.{ts,tsx}" ], "excludeFiles": [ "web/src/testing/**", @@ -33,6 +41,102 @@ "no-console": "error" } }, + { + "files": [ + "web/**/*.tsx" + ], + "excludeFiles": [ + "web/packages/reactive/src/solid/**", + "**/*.{test,spec}.tsx" + ], + "rules": { + "no-restricted-imports": [ + "error", + { + "paths": [ + { + "name": "react", + "message": "Views are Solid 2. See web/docs/views.md." + }, + { + "name": "react-dom", + "message": "Views are Solid 2. See web/docs/views.md." + } + ], + "patterns": [ + { + "group": [ + "@solidjs/router", + "@tanstack/solid-*", + "solid-query", + "solid-zustand", + "@solid-primitives/storage" + ], + "message": "No framework-bound router, data or state libraries. See web/docs/views.md." + } + ] + } + ], + "solid/no-destructure": "error", + "solid/components-return-once": "error", + "solid/no-react-specific-props": "error", + "solid/no-react-deps": "error", + "solid/jsx-no-duplicate-props": "error", + "solid/no-unknown-namespaces": "error", + "solid/style-prop": "error", + "solid/no-innerhtml": "error", + "solid/event-handlers": "error", + "solid/prefer-for": "error", + "inline-solid/solid-api": "error", + "inline-solid/stylex-attrs-calls": "error" + } + }, + { + "files": [ + "web/**/*.ts" + ], + "excludeFiles": [ + "web/packages/reactive/src/solid/**", + "web/*.config.ts" + ], + "rules": { + "no-restricted-imports": [ + "error", + { + "paths": [ + { + "name": "react", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + }, + { + "name": "react-dom", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + }, + { + "name": "react-dom/client", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + }, + { + "name": "react/jsx-runtime", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + }, + { + "name": "solid-js", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + }, + { + "name": "@solidjs/web", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + }, + { + "name": "@solidjs/signals", + "message": "Plain .ts files are framework-free. Only view files (.tsx) and the reactive bindings import a view framework. See web/docs/architecture.md." + } + ] + } + ] + } + }, { "files": [ "server/src/core/**/*.{ts,tsx}", diff --git a/AGENTS.md b/AGENTS.md index ab45970507..9f4c14cdf9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,6 +10,7 @@ - `apple/`: native iOS and macOS clients. - `server/`: Bun and TypeScript backend. - `landing/`: website and product documentation. +- `web/`: web app (`app.inline.chat`) and its client packages. - `proto/`: canonical protocol schemas. - `packages/`: shared TypeScript packages, including the SDK, protocol, bot client, and MCP server. - `plugins/`: ChatGPT, OpenClaw, Hermes, and other integrations. diff --git a/bun.lock b/bun.lock index 96e2d8975e..4fe036ce8b 100644 --- a/bun.lock +++ b/bun.lock @@ -22,9 +22,7 @@ "name": "@inline-chat/landing", "dependencies": { "@base-ui/react": "^1.6.0", - "@inline/client": "workspace:*", "@inline/config": "workspace:*", - "@inline/ids": "workspace:*", "@stylexjs/stylex": "0.19.1", "@tailwindcss/postcss": "^4.1.13", "@tailwindcss/vite": "^4.1.13", @@ -58,81 +56,6 @@ "vitest": "catalog:", }, }, - "landing/packages/auth": { - "name": "@inline/auth", - "version": "0.0.0", - "dependencies": { - "@inline/ids": "workspace:*", - "react": "^19.1.1", - }, - "devDependencies": { - "@types/react": "catalog:", - "fake-indexeddb": "^6.2.5", - "oxlint": "catalog:", - "typescript": "catalog:", - "vitest": "catalog:", - }, - }, - "landing/packages/client": { - "name": "@inline/client", - "version": "0.0.0", - "dependencies": { - "@inline-chat/protocol": "workspace:*", - "@inline/auth": "workspace:*", - "@inline/config": "workspace:*", - "@inline/ids": "workspace:*", - "@inline/log": "workspace:*", - "@msgpack/msgpack": "3.1.3", - "@sqlite.org/sqlite-wasm": "3.53.0-build1", - "react": "^19.1.1", - }, - "devDependencies": { - "@types/react": "catalog:", - "fake-indexeddb": "^6.2.5", - "oxlint": "catalog:", - "typescript": "catalog:", - "vitest": "catalog:", - }, - }, - "landing/packages/config": { - "name": "@inline/config", - "version": "0.0.0", - "devDependencies": { - "oxlint": "catalog:", - "typescript": "catalog:", - "vitest": "catalog:", - }, - }, - "landing/packages/ids": { - "name": "@inline/ids", - "version": "0.0.0", - "devDependencies": { - "oxlint": "catalog:", - "typescript": "catalog:", - "vitest": "catalog:", - }, - }, - "landing/packages/log": { - "name": "@inline/log", - "version": "0.0.0", - "devDependencies": { - "oxlint": "catalog:", - "typescript": "catalog:", - "vitest": "catalog:", - }, - }, - "landing/packages/protocol": { - "name": "@in/protocol", - "version": "0.0.0", - "dependencies": { - "@protobuf-ts/runtime": "^2.11.1", - }, - "devDependencies": { - "oxlint": "catalog:", - "typescript": "catalog:", - "vitest": "catalog:", - }, - }, "packages/agent-activity": { "name": "@inline-chat/agent-activity", "version": "0.0.1", @@ -403,7 +326,7 @@ "dependencies": { "@livekit/rtc-node": "1.1.0", "onnxruntime-node": "1.24.3", - "ws": "8.21.3", + "ws": "8.23.1", }, "devDependencies": { "@types/node": "catalog:", @@ -424,6 +347,241 @@ "typescript": "catalog:", }, }, + "web": { + "name": "@inline/web", + "version": "0.0.0", + "dependencies": { + "@inline/auth": "workspace:*", + "@inline/chat-ui": "workspace:*", + "@inline/client": "workspace:*", + "@inline/composer": "workspace:*", + "@inline/config": "workspace:*", + "@inline/core-protocol": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/link": "workspace:*", + "@inline/log": "workspace:*", + "@inline/platform": "workspace:*", + "@inline/reactive": "workspace:*", + "@inline/timeline": "workspace:*", + "@inline/ui": "workspace:*", + "@inline/view": "workspace:*", + "@solidjs/web": "2.0.4", + "@stylexjs/stylex": "0.19.2", + "solid-js": "2.0.4", + }, + "devDependencies": { + "@solidjs/vite-plugin": "3.0.1", + "@stylexjs/unplugin": "0.19.2", + "@types/node": "catalog:", + "eslint-plugin-solid": "0.20.1", + "oxlint": "catalog:", + "playwright-core": "1.63.0", + "typescript": "catalog:", + "vite": "^8.3.8", + "vitest": "catalog:", + }, + }, + "web/packages/auth": { + "name": "@inline/auth", + "version": "0.0.0", + "dependencies": { + "@inline/config": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/reactive": "workspace:*", + }, + "devDependencies": { + "fake-indexeddb": "^6.2.5", + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/chat-ui": { + "name": "@inline/chat-ui", + "version": "0.0.0", + "dependencies": { + "@inline/core-protocol": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/reactive": "workspace:*", + "@solidjs/web": "2.0.4", + "@stylexjs/stylex": "0.19.2", + "solid-js": "2.0.4", + }, + "devDependencies": { + "@solidjs/vite-plugin": "3.0.1", + "happy-dom": "20.14.5", + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/client": { + "name": "@inline/client", + "version": "0.0.0", + "dependencies": { + "@inline-chat/protocol": "workspace:*", + "@inline/auth": "workspace:*", + "@inline/config": "workspace:*", + "@inline/core-protocol": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/log": "workspace:*", + "@msgpack/msgpack": "3.1.3", + "@sqlite.org/sqlite-wasm": "3.54.1-build1", + }, + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/composer": { + "name": "@inline/composer", + "version": "0.0.0", + "dependencies": { + "@inline/core-protocol": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/reactive": "workspace:*", + }, + "devDependencies": { + "happy-dom": "20.14.5", + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/config": { + "name": "@inline/config", + "version": "0.0.0", + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/core-protocol": { + "name": "@inline/core-protocol", + "version": "0.0.0", + "dependencies": { + "@inline/ids": "workspace:*", + }, + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/ids": { + "name": "@inline/ids", + "version": "0.0.0", + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/link": { + "name": "@inline/link", + "version": "0.0.0", + "dependencies": { + "@inline/core-protocol": "workspace:*", + "@inline/log": "workspace:*", + }, + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/log": { + "name": "@inline/log", + "version": "0.0.0", + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/platform": { + "name": "@inline/platform", + "version": "0.0.0", + "dependencies": { + "@inline/reactive": "workspace:*", + }, + "devDependencies": { + "happy-dom": "20.14.5", + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/reactive": { + "name": "@inline/reactive", + "version": "0.0.0", + "dependencies": { + "@inline/core-protocol": "workspace:*", + "@solidjs/web": "2.0.4", + "alien-signals": "3.2.1", + "solid-js": "2.0.4", + }, + "devDependencies": { + "@solidjs/vite-plugin": "3.0.1", + "@vitest/browser-playwright": "4.1.10", + "happy-dom": "20.14.5", + "oxlint": "catalog:", + "playwright": "1.63.0", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/timeline": { + "name": "@inline/timeline", + "version": "0.0.0", + "dependencies": { + "@inline/core-protocol": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/reactive": "workspace:*", + }, + "devDependencies": { + "happy-dom": "20.14.5", + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/ui": { + "name": "@inline/ui", + "version": "0.0.0", + "dependencies": { + "@inline/reactive": "workspace:*", + "@solidjs/web": "2.0.4", + "@stylexjs/stylex": "0.19.2", + "solid-js": "2.0.4", + }, + "devDependencies": { + "@solidjs/vite-plugin": "3.0.1", + "happy-dom": "20.14.5", + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, + "web/packages/view": { + "name": "@inline/view", + "version": "0.0.0", + "dependencies": { + "@inline/auth": "workspace:*", + "@inline/chat-ui": "workspace:*", + "@inline/core-protocol": "workspace:*", + "@inline/ids": "workspace:*", + "@inline/platform": "workspace:*", + "@inline/reactive": "workspace:*", + }, + "devDependencies": { + "oxlint": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:", + }, + }, }, "overrides": { "@aws-sdk/core@3.749.0": { @@ -462,6 +620,8 @@ "@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="], + "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], + "@anthropic-ai/sdk": ["@anthropic-ai/sdk@0.38.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-ZUYjadEEeb1wwKd9MEM+plSfl7zQjYixhjHRtyPsjO7MtzRmbZvBb1n1ofo2kHwb0aUiIdb3aAEbAwS9Bcbm/A=="], "@apm-js-collab/code-transformer": ["@apm-js-collab/code-transformer@0.8.2", "", {}, "sha512-YRjJjNq5KFSjDUoqu5pFUWrrsvGOxl6c3bu+uMFc9HNNptZ2rNU/TI2nLw4jnhQNtka972Ee2m3uqbvDQtPeCA=="], @@ -598,6 +758,8 @@ "@bcoe/v8-coverage": ["@bcoe/v8-coverage@1.0.2", "", {}, "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA=="], + "@blazediff/core": ["@blazediff/core@1.9.1", "", {}, "sha512-ehg3jIkYKulZh+8om/O25vkvSsXXwC+skXmyA87FFx6A/45eqOkZsBltMw/TVteb0mloiGT8oGRTcjRAz66zaA=="], + "@borewit/text-codec": ["@borewit/text-codec@0.2.1", "", {}, "sha512-k7vvKPbf7J2fZ5klGRD9AeKfUvojuZIQ3BT5u7Jfv+puwXkUBUT5PVyMDfJZpy30CBDXGMgw7fguK/lpOMBvgw=="], "@bufbuild/protobuf": ["@bufbuild/protobuf@2.2.3", "", {}, "sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg=="], @@ -758,8 +920,6 @@ "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.35.5", "", { "os": "win32", "cpu": "x64" }, "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg=="], - "@in/protocol": ["@in/protocol@workspace:landing/packages/protocol"], - "@inline-chat/agent-activity": ["@inline-chat/agent-activity@workspace:packages/agent-activity"], "@inline-chat/bot-api-types": ["@inline-chat/bot-api-types@workspace:packages/bot-api-types"], @@ -796,15 +956,35 @@ "@inline-openclaw/inline": ["@inline-openclaw/inline@workspace:plugins/openclaw"], - "@inline/auth": ["@inline/auth@workspace:landing/packages/auth"], + "@inline/auth": ["@inline/auth@workspace:web/packages/auth"], + + "@inline/chat-ui": ["@inline/chat-ui@workspace:web/packages/chat-ui"], + + "@inline/client": ["@inline/client@workspace:web/packages/client"], + + "@inline/composer": ["@inline/composer@workspace:web/packages/composer"], + + "@inline/config": ["@inline/config@workspace:web/packages/config"], + + "@inline/core-protocol": ["@inline/core-protocol@workspace:web/packages/core-protocol"], + + "@inline/ids": ["@inline/ids@workspace:web/packages/ids"], + + "@inline/link": ["@inline/link@workspace:web/packages/link"], + + "@inline/log": ["@inline/log@workspace:web/packages/log"], + + "@inline/platform": ["@inline/platform@workspace:web/packages/platform"], + + "@inline/reactive": ["@inline/reactive@workspace:web/packages/reactive"], - "@inline/client": ["@inline/client@workspace:landing/packages/client"], + "@inline/timeline": ["@inline/timeline@workspace:web/packages/timeline"], - "@inline/config": ["@inline/config@workspace:landing/packages/config"], + "@inline/ui": ["@inline/ui@workspace:web/packages/ui"], - "@inline/ids": ["@inline/ids@workspace:landing/packages/ids"], + "@inline/view": ["@inline/view@workspace:web/packages/view"], - "@inline/log": ["@inline/log@workspace:landing/packages/log"], + "@inline/web": ["@inline/web@workspace:web"], "@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="], @@ -1060,6 +1240,8 @@ "@playwright/test": ["@playwright/test@1.63.0", "", { "dependencies": { "playwright": "1.63.0" }, "bin": { "playwright": "cli.js" } }, "sha512-oxMK4vllB9RK5NQ2l1pq1IfOf2AvnEuj/vYGDj0H2nMtmtZpKtCwt/l00GEO6xjGfpBNAvjovvYdCm50dRQkpQ=="], + "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], + "@prelude.so/sdk": ["@prelude.so/sdk@0.3.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-PlL+tpfS1utMzszFwMoJRwpJsNF1iV2QvGzBI9RnhK1lYcUl5AzNEs78WjmXq2APlsY5fgvspZWhem4lBlXFeg=="], "@prisma/instrumentation": ["@prisma/instrumentation@6.15.0", "", { "dependencies": { "@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0" }, "peerDependencies": { "@opentelemetry/api": "^1.8" } }, "sha512-6TXaH6OmDkMOQvOxwLZ8XS51hU2v4A3vmE2pSijCIiGRJYyNeMcL6nMHQMyYdZRD8wl7LF3Wzc+AMPMV/9Oo7A=="], @@ -1162,6 +1344,8 @@ "@resvg/resvg-js-win32-x64-msvc": ["@resvg/resvg-js-win32-x64-msvc@2.6.2", "", { "os": "win32", "cpu": "x64" }, "sha512-ZXtYhtUr5SSaBrUDq7DiyjOFJqBVL/dOBN7N/qmi/pO0IgiWW/f/ue3nbvu9joWE5aAKDoIzy/CxsY0suwGosQ=="], + "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.3.4", "", { "os": "android", "cpu": "arm" }, "sha512-xCW8CkL/ualx/SbYqeG9iK87lJCZGDQ0soE+kaORJ0Bd+pHALyE4qK7BStmEAyYWLEzZ3/biSIpA6/7GDFvzIg=="], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.0", "", { "os": "android", "cpu": "arm64" }, "sha512-9yB1l95IrJuNGDFdOYe79vdApdz6WWBCObE+rQ2LUliYUlcyFwSYIb2xb5/Ifw7dAtMy2ZqNyd8QTSOc7duAKw=="], "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pexNaW9ACLUOaBITOpU6qVu4VrsOFIjTv6bzgu0YUATo4eUJx0V605PxwZfndpPOn0ilqGqvGQ0M8UW0IE24jg=="], @@ -1356,7 +1540,27 @@ "@smithy/util-waiter": ["@smithy/util-waiter@4.6.2", "", { "dependencies": { "@smithy/core": "^3.33.2", "tslib": "^2.6.2" } }, "sha512-TNNK01i1HiSAR6hBF94J7q338JgEaHPrP8QKRSeQBsbSbw5O4+YGdZYitmsTeEWvHGX+2R/oQ7BzxyAjeZxuWg=="], - "@sqlite.org/sqlite-wasm": ["@sqlite.org/sqlite-wasm@3.53.0-build1", "", {}, "sha512-PfWPWN2n+/37doa8oh2/oUXk4OOsRYZsxc1W1sDXIGb/Pu5Yrb+f2eyYpgQMGITVX7HVgxhs9P18Rc6I97ym/g=="], + "@solidjs/compiler": ["@solidjs/compiler@2.0.3", "", { "optionalDependencies": { "@solidjs/compiler-darwin-arm64": "2.0.3", "@solidjs/compiler-darwin-x64": "2.0.3", "@solidjs/compiler-linux-arm64-gnu": "2.0.3", "@solidjs/compiler-linux-x64-gnu": "2.0.3", "@solidjs/compiler-wasm32-wasi": "2.0.3", "@solidjs/compiler-win32-x64-msvc": "2.0.3" } }, "sha512-05CTYXgogEf1Ww7AXFRKbIhmev5RrEyEumBjqyubTD0015l26f6DySW8/pbkEcWIaSRzTtbE4usuMIOOugig/Q=="], + + "@solidjs/compiler-darwin-arm64": ["@solidjs/compiler-darwin-arm64@2.0.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-X0HUNmnrQDayNdnJeXpu96qtHqyHMFAFyOkXN9U4DCc0s+Mx6W30RvyPK7TedMao05osAdr/wWg5ycICxFdRww=="], + + "@solidjs/compiler-darwin-x64": ["@solidjs/compiler-darwin-x64@2.0.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-N0bySpSsxB4xwF66yqJwnPCzCqnxaorkyucJqFtgl6u3Wi8cYcmUFW9+6CyDm5YLVQBBDnl622KS4t51LD8yNw=="], + + "@solidjs/compiler-linux-arm64-gnu": ["@solidjs/compiler-linux-arm64-gnu@2.0.3", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-ZxXB/qtHDYlucbBfLRvjGXFjAv1dLs/3PvA0IgU2IjcF0YmBjzHvYp25o7UFi07HLrAsSRZXasND7R2VKMcBLw=="], + + "@solidjs/compiler-linux-x64-gnu": ["@solidjs/compiler-linux-x64-gnu@2.0.3", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-xcJp6ApQu30uC+74lj8beulmaZsVo7kXjI+rPgH6SXhRcv74XXa7yvbAyO0v+66+dPXuUT6ztxy5q9zHrfMx+g=="], + + "@solidjs/compiler-wasm32-wasi": ["@solidjs/compiler-wasm32-wasi@2.0.3", "", { "dependencies": { "@emnapi/core": "1.11.3", "@emnapi/runtime": "1.11.3", "@napi-rs/wasm-runtime": "^1.1.6" } }, "sha512-DxM+IucpmkzKpS6d9WFMC8HKiw1/OJNx0aapsqMDgh9uPafM7n+lP2+lMI5zzeV7ZokVVGwXxqwhHVNX4hj/Fw=="], + + "@solidjs/compiler-win32-x64-msvc": ["@solidjs/compiler-win32-x64-msvc@2.0.3", "", { "os": "win32", "cpu": "x64" }, "sha512-nRY5PkGieRnyUH1HASIq3V0YSzfozLQS5U3rSglSqS1a/MY/gAyvPBN2MOtqXBM+QtcOBwHoTLvI0Tx69uzmCQ=="], + + "@solidjs/signals": ["@solidjs/signals@2.0.4", "", {}, "sha512-U/Z0DOsoJO18Wsw/5piSrJhtj85nMOOD/ldn8ZP+CCA5RVcu4GDheNTOECOZwxCS+l7BVIzIakToJC91Q6lMXQ=="], + + "@solidjs/vite-plugin": ["@solidjs/vite-plugin@3.0.1", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "@solidjs/compiler": "^2.0.0", "magic-string": "^0.30.21", "merge-anything": "^5.1.7", "vitefu": "^1.0.4" }, "peerDependencies": { "@babel/core": "^7.23.3 || ^8.0.0", "@solidjs/babel-plugin": "^2.0.0", "@solidjs/start-devtools": "^1.0.0-next.2", "@solidjs/web": "^2.0.0", "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0", "solid-js": "^2.0.0", "vite": "^8.0.0 || ^9.0.0" }, "optionalPeers": ["@babel/core", "@solidjs/babel-plugin", "@solidjs/start-devtools", "@testing-library/jest-dom"] }, "sha512-dyRU4LJXhzEEgtF32AtUdjqaUuMVYTVLQvhYlT6HcYBvf10yIVmKgW9cg42b5YDxkl6BgAJ9o0OjUnAy3qKb9A=="], + + "@solidjs/web": ["@solidjs/web@2.0.4", "", { "dependencies": { "csstype": "^3.1.0", "seroval": "^1.8.0", "seroval-plugins": "^1.8.0" }, "peerDependencies": { "solid-js": "^2.0.4" } }, "sha512-E7bEnI/+z5Lj8fthibMbud8zXbdn5fc0/QJpC4kruxmVIwj/FyrkgiMVqfBmILjaYtKXD3QNEZCKyTV3agbH5A=="], + + "@sqlite.org/sqlite-wasm": ["@sqlite.org/sqlite-wasm@3.54.1-build1", "", {}, "sha512-foW427VBLJ3G87bsnvQTZCc9zYe0Fq1wH0pz1I6BlKLKXcArIAyTkHtq0iT2llmhcMQt9T/p6l5PpQQh+6O8uQ=="], "@stablelib/base64": ["@stablelib/base64@1.0.1", "", {}, "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ=="], @@ -1580,6 +1784,10 @@ "@vitejs/plugin-react": ["@vitejs/plugin-react@5.0.4", "", { "dependencies": { "@babel/core": "^7.28.4", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.38", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-La0KD0vGkVkSk6K+piWDKRUyg8Rl5iAIKRMH0vMJI0Eg47bq1eOxmoObAaQG37WMW9MSyk7Cs8EIWwJC1PtzKA=="], + "@vitest/browser": ["@vitest/browser@4.1.10", "", { "dependencies": { "@blazediff/core": "1.9.1", "@vitest/mocker": "4.1.10", "@vitest/utils": "4.1.10", "magic-string": "^0.30.21", "pngjs": "^7.0.0", "sirv": "^3.0.2", "tinyrainbow": "^3.1.0", "ws": "^8.19.0" }, "peerDependencies": { "vitest": "4.1.10" } }, "sha512-UDwuWGwXj646CBx/bQHOaJSX7np0I8JL/UKQYa1e4QrVHH8VdWtx8eaOuf8sy0ShwDgR6NjJAsp5eF6vjF6qng=="], + + "@vitest/browser-playwright": ["@vitest/browser-playwright@4.1.10", "", { "dependencies": { "@vitest/browser": "4.1.10", "@vitest/mocker": "4.1.10", "tinyrainbow": "^3.1.0" }, "peerDependencies": { "playwright": "*", "vitest": "4.1.10" } }, "sha512-nMoXGEiRpT7m3W7NsbvrM2aKNwiNHZf+zEpUCvMteGjZFvfT96Q9fh7QyB98dvDWXiKvrLxA7bJ1mCOOv+JQPw=="], + "@vitest/coverage-v8": ["@vitest/coverage-v8@4.1.10", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/utils": "4.1.10", "ast-v8-to-istanbul": "^1.0.0", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", "istanbul-reports": "^3.2.0", "magicast": "^0.5.2", "obug": "^2.1.1", "std-env": "^4.0.0-rc.1", "tinyrainbow": "^3.1.0" }, "peerDependencies": { "@vitest/browser": "4.1.10", "vitest": "4.1.10" }, "optionalPeers": ["@vitest/browser"] }, "sha512-IM49HmthevbgAO4anp1hwtoT9wYe59w0LR00gr+eagHE+ZJ5lK4sLPeO0ubgoJcwLk6dehU3R24N+FbEEKDc8g=="], "@vitest/expect": ["@vitest/expect@4.1.10", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "@types/chai": "^5.2.2", "@vitest/spy": "4.1.10", "@vitest/utils": "4.1.10", "chai": "^6.2.2", "tinyrainbow": "^3.1.0" } }, "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA=="], @@ -1616,6 +1824,8 @@ "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="], + "alien-signals": ["alien-signals@3.2.1", "", {}, "sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g=="], + "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], @@ -1856,6 +2066,12 @@ "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], + "eslint-plugin-solid": ["eslint-plugin-solid@0.20.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3", "estraverse": "^5.3.0", "is-html": "^2.0.0", "kebab-case": "^1.0.2", "known-css-properties": "^0.30.0", "parse5": "^7.3.0", "style-to-object": "^1.0.6", "validate-html-nesting": "^1.2.4" }, "peerDependencies": { "eslint": "^9.0.0 || ^10.0.0" }, "optionalPeers": ["eslint"] }, "sha512-HPBVDgkGCOqXpfMQUyMP273AXo/VUwm/hqvTWWovVSJKPBzrKhq7w04Yn0PtTgj9g+7ZdlcAAJ9dwgBGeJQ4Gg=="], + + "eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + + "estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="], + "estree-util-is-identifier-name": ["estree-util-is-identifier-name@3.0.0", "", {}, "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg=="], "estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], @@ -2016,6 +2232,8 @@ "html-escaper": ["html-escaper@2.0.2", "", {}, "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="], + "html-tags": ["html-tags@3.3.1", "", {}, "sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ=="], + "html-to-text": ["html-to-text@9.0.5", "", { "dependencies": { "@selderee/plugin-htmlparser2": "^0.11.0", "deepmerge": "^4.3.1", "dom-serializer": "^2.0.0", "htmlparser2": "^8.0.2", "selderee": "^0.11.0" } }, "sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg=="], "html-url-attributes": ["html-url-attributes@3.0.1", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="], @@ -2072,6 +2290,8 @@ "is-hexadecimal": ["is-hexadecimal@2.0.1", "", {}, "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg=="], + "is-html": ["is-html@2.0.0", "", { "dependencies": { "html-tags": "^3.0.0" } }, "sha512-S+OpgB5i7wzIue/YSE5hg0e5ZYfG3hhpNh9KGl6ayJ38p7ED6wxQLd1TV91xHpcTvw90KMJ9EwN3F/iNflHBVg=="], + "is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="], "is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="], @@ -2080,6 +2300,8 @@ "is-unicode-supported": ["is-unicode-supported@2.1.0", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="], + "is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="], + "isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], "isbot": ["isbot@5.1.22", "", {}, "sha512-RqCFY3cJy3c2y1I+rMn81cfzAR4XJwfPBC+M8kffUjbPzxApzyyv7Tbm1C/gXXq2dSCuD238pKFEWlQMTWsTFw=="], @@ -2128,6 +2350,10 @@ "jws": ["jws@4.0.1", "", { "dependencies": { "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA=="], + "kebab-case": ["kebab-case@1.0.2", "", {}, "sha512-7n6wXq4gNgBELfDCpzKc+mRrZFs7D+wgfF5WRFLNAr4DA/qtr9Js8uOAVAfHhuLMfAcQ0pRKqbpjx+TcJVdE1Q=="], + + "known-css-properties": ["known-css-properties@0.30.0", "", {}, "sha512-VSWXYUnsPu9+WYKkfmJyLKtIvaRJi1kXUqVmBACORXZQxT5oZDsoZ2vQP+bQFDnWtpI/4eq3MLoRMjI2fnLzTQ=="], + "kubernetes-types": ["kubernetes-types@1.30.0", "", {}, "sha512-Dew1okvhM/SQcIa2rcgujNndZwU8VnSapDgdxlYoB84ZlpAD43U6KLAFqYo17ykSFGHNPrg0qry0bP+GJd9v7Q=="], "kysely": ["kysely@0.29.6", "", {}, "sha512-hHaB8C/rfzDDtr/t8YZwxAuPJTT0zHyaPoVzcXwDYhYNAgH/4sIfVhi/XLLIY+bL/FqaIJnjATDbi8ObSELmxg=="], @@ -2236,6 +2462,8 @@ "media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="], + "merge-anything": ["merge-anything@5.1.7", "", { "dependencies": { "is-what": "^4.1.8" } }, "sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ=="], + "merge-descriptors": ["merge-descriptors@2.0.0", "", {}, "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g=="], "micromark": ["micromark@4.0.1", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-eBPdkcoCNvYcxQOAKAlceo5SNdzZWfF+FcSupREAzdAh9rRmE239CEQAiTwIgblwnoM8zzj35sZ5ZwvSEOF6Kw=="], @@ -2316,6 +2544,8 @@ "motion-utils": ["motion-utils@11.18.1", "", {}, "sha512-49Kt+HKjtbJKLtgO/LKj9Ld+6vw9BjH5d9sc40R/kVyH8GLAXgT42M2NnuPcJNuA3s9ZfZBUcwIgpmZWGEE+hA=="], + "mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="], + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], "msgpackr": ["msgpackr@2.0.4", "", { "optionalDependencies": { "msgpackr-extract": "^3.0.4" } }, "sha512-o1C5KRmuRt+apqMr1HuGSqWStZoRBUpEsCsl15uM9VdAF1qHLtvMOU2En747EnTyEl6c4pzPewRMFF31s1CNbA=="], @@ -2328,6 +2558,8 @@ "nanoid-dictionary": ["nanoid-dictionary@4.3.0", "", {}, "sha512-Xw1+/QnRGWO1KJ0rLfU1xR85qXmAHyLbE3TUkklu9gOIDburP6CsUnLmTaNECGpBh5SHb2uPFmx0VT8UPyoeyw=="], + "napi-windows-process-start-time": ["napi-windows-process-start-time@0.1.0", "", { "os": "win32", "cpu": [ "x64", "arm64", ] }, "sha512-zHxhzKsIFu3elch3eFw69WEUGc79DFhbc3nD/WEOzWL/pFFLZRW13EHnuO0c+0YjncE5uCaS9ICHxOBXkb6vPw=="], + "negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="], "nf3": ["nf3@0.3.22", "", {}, "sha512-NOcqlHu22X1rUakd0SrqllP8kb3LWFmSAi1svTxaKxz+yB604xlaOmUfI3oO+RkODvaocKDDy8bgthnZL8hrkw=="], @@ -2402,6 +2634,8 @@ "parse-ms": ["parse-ms@4.0.0", "", {}, "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw=="], + "parse5": ["parse5@7.3.0", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="], + "parseley": ["parseley@0.12.1", "", { "dependencies": { "leac": "^0.6.0", "peberminta": "^0.9.0" } }, "sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw=="], "parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="], @@ -2456,7 +2690,7 @@ "playwright-core": ["playwright-core@1.63.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg=="], - "pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="], + "pngjs": ["pngjs@7.0.0", "", {}, "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow=="], "postal-mime": ["postal-mime@2.7.5", "", {}, "sha512-GNEXKvWFQnbgO5NlrGzVa0FmWzBZ24PersAWErttSg1Hjpf0ATxTwS5DOMGaOpTG6bUh5cTr7xi0jAD942wCJA=="], @@ -2586,9 +2820,9 @@ "serialize-error": ["serialize-error@7.0.1", "", { "dependencies": { "type-fest": "^0.13.1" } }, "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw=="], - "seroval": ["seroval@1.6.9", "", {}, "sha512-UeEzHwAK+yl0YLbsvROV1t5yMYEwZZ0CfKYxDvUgS2fO9Vxdf8djqVIB+OuVpuawRNPqw68LE1Du/GMsW2ZPqA=="], + "seroval": ["seroval@1.8.3", "", {}, "sha512-9rx30nsFFRbzDx6Vdky87kv0S2/IGXhWwd8qH6V2O2/cdbtBNChE0qemRW+lFAN4uOPOgMbAw5cSsW/L6o9wIw=="], - "seroval-plugins": ["seroval-plugins@1.6.9", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-kiDK/Tb8IWZ61WEU8pA2PDmAuw37gKph9Y77OZlD56mg0Y2g0Bg7gZ1HeHhs5d40w+nRoUq/wj08V26ilbez9g=="], + "seroval-plugins": ["seroval-plugins@1.8.0", "", { "peerDependencies": { "seroval": "^1.8.0" } }, "sha512-96vBb12rDvPPwdKUgWw1op3fGq8AVBFOr0IllbnM72yR5J9WWXF18cQ4g1XfDO7HCyh2dt70P3XdtyRayP8FWg=="], "serve-static": ["serve-static@2.2.1", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw=="], @@ -2618,8 +2852,12 @@ "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], + "sirv": ["sirv@3.0.2", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g=="], + "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="], + "solid-js": ["solid-js@2.0.4", "", { "dependencies": { "@solidjs/signals": "^2.0.4", "seroval": "^1.8.0", "seroval-plugins": "^1.8.0" } }, "sha512-RaBVDtzYGgQEAcMa9QgyT8UdzOayFgXJ1w1/f8vz7aoeF5tQDZwrHLfM1PDTIuprb8RdMWFGZwwyKCXtXEUX0w=="], + "sonic-boom": ["sonic-boom@4.2.1", "", { "dependencies": { "atomic-sleep": "^1.0.0" } }, "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q=="], "source-map": ["source-map@0.7.6", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="], @@ -2708,6 +2946,8 @@ "toml": ["toml@5.0.1", "", {}, "sha512-EqYNA/YvUNndrA2B3O2ojzLQoTQrBxeZ9UIjQwk8t10oe6n7dwclBwd9IdZQTOKwe6vWX+AXtl6IntXRbepdxQ=="], + "totalist": ["totalist@3.0.1", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="], + "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], "trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="], @@ -2772,6 +3012,8 @@ "uuid": ["uuid@14.0.1", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew=="], + "validate-html-nesting": ["validate-html-nesting@1.2.4", "", {}, "sha512-doQi7e8EJ2OWneSG1aZpJluS6A49aZM0+EICXWKm1i6WvqTLmq0tpUcImc4KTWG50mORO0C4YDBtOCSYvElftw=="], + "vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="], "verror": ["verror@1.10.1", "", { "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" } }, "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg=="], @@ -2816,7 +3058,7 @@ "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], - "ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="], + "ws": ["ws@8.23.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA=="], "xmlbuilder2": ["xmlbuilder2@4.0.3", "", { "dependencies": { "@oozcitak/dom": "^2.0.2", "@oozcitak/infra": "^2.0.2", "@oozcitak/util": "^10.0.0", "js-yaml": "^4.1.1" } }, "sha512-bx8Q1STctnNaaDymWnkfQLKofs0mGNN7rLLapJlGuV3VlvegD7Ls4ggMjE3aUSWItCCzU0PEv45lI87iSigiCA=="], @@ -2844,6 +3086,8 @@ "zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="], + "@ampproject/remapping/@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], + "@anthropic-ai/sdk/@types/node": ["@types/node@18.19.76", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-yvR7Q9LdPz2vGpmpJX5LolrgRdWvB67MJKDPSgIIzpFbaf9a1j/f5DnLp5VDyHGMR0QZHlTr1afsD87QCXFHKw=="], "@apm-js-collab/tracing-hooks/debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], @@ -2934,6 +3178,18 @@ "@inline-openclaw/inline/typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], + "@inline/chat-ui/@stylexjs/stylex": ["@stylexjs/stylex@0.19.2", "", { "dependencies": { "styleq": "0.2.1" } }, "sha512-l0fRhOBZ4rFiZ0GntYSlp4lYO5dPT11F3mLb7O4ShK6eE1WOjHtv9GHGQZuzHJbQkjcEaRjPSpBn6itI7yXc3Q=="], + + "@inline/ui/@stylexjs/stylex": ["@stylexjs/stylex@0.19.2", "", { "dependencies": { "styleq": "0.2.1" } }, "sha512-l0fRhOBZ4rFiZ0GntYSlp4lYO5dPT11F3mLb7O4ShK6eE1WOjHtv9GHGQZuzHJbQkjcEaRjPSpBn6itI7yXc3Q=="], + + "@inline/web/@solidjs/vite-plugin": ["@solidjs/vite-plugin@3.0.1", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "@solidjs/compiler": "^2.0.0", "magic-string": "^0.30.21", "merge-anything": "^5.1.7", "vitefu": "^1.0.4" }, "peerDependencies": { "@babel/core": "^7.23.3 || ^8.0.0", "@solidjs/babel-plugin": "^2.0.0", "@solidjs/start-devtools": "^1.0.0-next.2", "@solidjs/web": "^2.0.0", "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0", "solid-js": "^2.0.0", "vite": "^8.0.0 || ^9.0.0" }, "optionalPeers": ["@babel/core", "@solidjs/babel-plugin", "@solidjs/start-devtools", "@testing-library/jest-dom"] }, "sha512-dyRU4LJXhzEEgtF32AtUdjqaUuMVYTVLQvhYlT6HcYBvf10yIVmKgW9cg42b5YDxkl6BgAJ9o0OjUnAy3qKb9A=="], + + "@inline/web/@stylexjs/stylex": ["@stylexjs/stylex@0.19.2", "", { "dependencies": { "styleq": "0.2.1" } }, "sha512-l0fRhOBZ4rFiZ0GntYSlp4lYO5dPT11F3mLb7O4ShK6eE1WOjHtv9GHGQZuzHJbQkjcEaRjPSpBn6itI7yXc3Q=="], + + "@inline/web/@stylexjs/unplugin": ["@stylexjs/unplugin@0.19.2", "", { "dependencies": { "@babel/core": "^7.26.8", "@babel/plugin-syntax-flow": "^7.26.0", "@babel/plugin-syntax-jsx": "^7.25.9", "@babel/plugin-syntax-typescript": "^7.25.9", "@stylexjs/babel-plugin": "0.19.2", "browserslist": "^4.24.0", "lightningcss": "^1.29.1" }, "peerDependencies": { "unplugin": "^2.3.11" } }, "sha512-kyHrLCVyKNmycPl+WnjVGJmPgKGAYbtVPasuCe3UgQllennwj2himUKQncG98zt+66nDuGpy7Sx2xCYM03nr3Q=="], + + "@inline/web/vite": ["vite@8.4.0", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.33", "rolldown": "~1.3.2", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3", "napi-windows-process-start-time": "^0.1.0" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-X2nUJg+9cutlz3hzqyO6p+WTwk9H257DjwAEf9EQYUFrQbDItmetadi9gYmb+l7VDy4r3VXLUnmLTwuPmzejDw=="], + "@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], "@isaacs/cliui/strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="], @@ -3000,6 +3256,12 @@ "@smithy/util-waiter/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="], + "@solidjs/compiler-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" } }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], + + "@solidjs/compiler-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="], + + "@solidjs/vite-plugin/vite": ["vite@8.4.0", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.33", "rolldown": "~1.3.2", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3", "napi-windows-process-start-time": "^0.1.0" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-X2nUJg+9cutlz3hzqyO6p+WTwk9H257DjwAEf9EQYUFrQbDItmetadi9gYmb+l7VDy4r3VXLUnmLTwuPmzejDw=="], + "@stylexjs/babel-plugin/@babel/traverse": ["@babel/traverse@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/template": "^7.29.7", "@babel/types": "^7.29.7", "debug": "^4.3.1" } }, "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw=="], "@stylexjs/babel-plugin/@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], @@ -3034,6 +3296,10 @@ "@tailwindcss/vite/tailwindcss": ["tailwindcss@4.1.13", "", {}, "sha512-i+zidfmTqtwquj4hMEwdjshYYgMbOrPzb9a0M3ZgNa0JMoZeFC6bxZvO8yr8ozS6ix2SDz0+mvryPeBs2TFE+w=="], + "@tanstack/router-core/seroval": ["seroval@1.6.9", "", {}, "sha512-UeEzHwAK+yl0YLbsvROV1t5yMYEwZZ0CfKYxDvUgS2fO9Vxdf8djqVIB+OuVpuawRNPqw68LE1Du/GMsW2ZPqA=="], + + "@tanstack/router-core/seroval-plugins": ["seroval-plugins@1.6.9", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-kiDK/Tb8IWZ61WEU8pA2PDmAuw37gKph9Y77OZlD56mg0Y2g0Bg7gZ1HeHhs5d40w+nRoUq/wj08V26ilbez9g=="], + "@tanstack/router-generator/@babel/types": ["@babel/types@7.29.8", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg=="], "@tanstack/router-generator/prettier": ["prettier@3.9.10", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA=="], @@ -3050,10 +3316,16 @@ "@tanstack/router-utils/diff": ["diff@8.0.4", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="], + "@tanstack/start-client-core/seroval": ["seroval@1.6.9", "", {}, "sha512-UeEzHwAK+yl0YLbsvROV1t5yMYEwZZ0CfKYxDvUgS2fO9Vxdf8djqVIB+OuVpuawRNPqw68LE1Du/GMsW2ZPqA=="], + "@tanstack/start-plugin-core/@babel/types": ["@babel/types@7.29.8", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg=="], "@tanstack/start-plugin-core/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], + "@tanstack/start-plugin-core/seroval": ["seroval@1.6.9", "", {}, "sha512-UeEzHwAK+yl0YLbsvROV1t5yMYEwZZ0CfKYxDvUgS2fO9Vxdf8djqVIB+OuVpuawRNPqw68LE1Du/GMsW2ZPqA=="], + + "@tanstack/start-server-core/seroval": ["seroval@1.6.9", "", {}, "sha512-UeEzHwAK+yl0YLbsvROV1t5yMYEwZZ0CfKYxDvUgS2fO9Vxdf8djqVIB+OuVpuawRNPqw68LE1Du/GMsW2ZPqA=="], + "@tokenizer/inflate/debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], "@types/babel__core/@babel/parser": ["@babel/parser@7.28.4", "", { "dependencies": { "@babel/types": "^7.28.4" }, "bin": "./bin/babel-parser.js" }, "sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg=="], @@ -3084,6 +3356,8 @@ "@vitejs/plugin-react/@babel/core": ["@babel/core@7.28.4", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.3", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.28.3", "@babel/helpers": "^7.28.4", "@babel/parser": "^7.28.4", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.4", "@babel/types": "^7.28.4", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA=="], + "@vitest/browser/ws": ["ws@8.22.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg=="], + "ajv-formats/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], "apn/debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], @@ -3554,6 +3828,8 @@ "parse-entities/@types/unist": ["@types/unist@2.0.11", "", {}, "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="], + "parse5/entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="], + "path-scurry/minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="], "pg/pg-protocol": ["pg-protocol@1.16.1", "", {}, "sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg=="], @@ -3566,6 +3842,8 @@ "protobufjs/@types/node": ["@types/node@25.6.0", "", { "dependencies": { "undici-types": "~7.19.0" } }, "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ=="], + "qrcode/pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="], + "qrcode/yargs": ["yargs@15.4.1", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="], "raw-body/iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="], @@ -3588,6 +3866,8 @@ "vite/picomatch": ["picomatch@4.0.5", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="], + "@ampproject/remapping/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], + "@anthropic-ai/sdk/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], "@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], @@ -3698,6 +3978,14 @@ "@inline-openclaw/inline/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin": ["@stylexjs/babel-plugin@0.19.2", "", { "dependencies": { "@babel/core": "^7.26.8", "@babel/helper-module-imports": "^7.25.9", "@babel/traverse": "^7.26.8", "@babel/types": "^7.26.8", "@dual-bundle/import-meta-resolve": "^4.1.0", "@stylexjs/shared": "0.19.2", "@stylexjs/stylex": "0.19.2", "postcss-value-parser": "^4.1.0" } }, "sha512-R6cB7Ym+IAvySNfmtRJ6CZ+83rjZ82Uw4wmG3YtwYY8vrnliUrYy9fOLvZ1nX407zeHNkCnE5AodEnjXXfOSYg=="], + + "@inline/web/vite/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], + + "@inline/web/vite/postcss": ["postcss@8.5.34", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.4" } }, "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw=="], + + "@inline/web/vite/rolldown": ["rolldown@1.3.4", "", { "dependencies": { "@oxc-project/types": "=0.160.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.3.4", "@rolldown/binding-android-arm64": "1.3.4", "@rolldown/binding-darwin-arm64": "1.3.4", "@rolldown/binding-darwin-x64": "1.3.4", "@rolldown/binding-freebsd-x64": "1.3.4", "@rolldown/binding-linux-arm-gnueabihf": "1.3.4", "@rolldown/binding-linux-arm64-gnu": "1.3.4", "@rolldown/binding-linux-arm64-musl": "1.3.4", "@rolldown/binding-linux-ppc64-gnu": "1.3.4", "@rolldown/binding-linux-s390x-gnu": "1.3.4", "@rolldown/binding-linux-x64-gnu": "1.3.4", "@rolldown/binding-linux-x64-musl": "1.3.4", "@rolldown/binding-openharmony-arm64": "1.3.4", "@rolldown/binding-wasm32-wasi": "1.3.4", "@rolldown/binding-win32-arm64-msvc": "1.3.4", "@rolldown/binding-win32-x64-msvc": "1.3.4" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-p2rq4bfBmF0M6yaR8+A89fbkBQynZI2fxUW4G07eq9kpctAkpo7q5BZ4X4Mo4XZ7HHROu33cX9PeopUFN6u+2Q=="], + "@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], "@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], @@ -3734,6 +4022,14 @@ "@smithy/util-waiter/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="], + "@solidjs/compiler-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], + + "@solidjs/vite-plugin/vite/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], + + "@solidjs/vite-plugin/vite/postcss": ["postcss@8.5.34", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.4" } }, "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw=="], + + "@solidjs/vite-plugin/vite/rolldown": ["rolldown@1.3.4", "", { "dependencies": { "@oxc-project/types": "=0.160.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.3.4", "@rolldown/binding-android-arm64": "1.3.4", "@rolldown/binding-darwin-arm64": "1.3.4", "@rolldown/binding-darwin-x64": "1.3.4", "@rolldown/binding-freebsd-x64": "1.3.4", "@rolldown/binding-linux-arm-gnueabihf": "1.3.4", "@rolldown/binding-linux-arm64-gnu": "1.3.4", "@rolldown/binding-linux-arm64-musl": "1.3.4", "@rolldown/binding-linux-ppc64-gnu": "1.3.4", "@rolldown/binding-linux-s390x-gnu": "1.3.4", "@rolldown/binding-linux-x64-gnu": "1.3.4", "@rolldown/binding-linux-x64-musl": "1.3.4", "@rolldown/binding-openharmony-arm64": "1.3.4", "@rolldown/binding-wasm32-wasi": "1.3.4", "@rolldown/binding-win32-arm64-msvc": "1.3.4", "@rolldown/binding-win32-x64-msvc": "1.3.4" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-p2rq4bfBmF0M6yaR8+A89fbkBQynZI2fxUW4G07eq9kpctAkpo7q5BZ4X4Mo4XZ7HHROu33cX9PeopUFN6u+2Q=="], + "@stylexjs/babel-plugin/@babel/traverse/@babel/generator": ["@babel/generator@7.29.7", "", { "dependencies": { "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ=="], "@stylexjs/babel-plugin/@babel/traverse/@babel/helper-globals": ["@babel/helper-globals@7.29.7", "", {}, "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA=="], @@ -3978,12 +4274,94 @@ "@babel/helper-module-transforms/@babel/traverse/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse": ["@babel/traverse@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/template": "^7.29.7", "@babel/types": "^7.29.7", "debug": "^4.3.1" } }, "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/types": ["@babel/types@7.29.8", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@stylexjs/shared": ["@stylexjs/shared@0.19.2", "", {}, "sha512-xjTZ/6T/1FV103F2bspmXoDRDy1gM/ZKYEHpQlUC0h4R5q7PqUV6k+DJbrayRAMwALIdzTf7zSTqteRde0ZXWQ=="], + + "@inline/web/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], + + "@inline/web/vite/postcss/source-map-js": ["source-map-js@1.3.0", "", {}, "sha512-pdUVfIWcK0kCgK831ibqkZDcL7I9zljjOu0TQFnA+fiQ6y1CYqYB7RkTOHHO45FGMg5P/Mvk/+4ToQ7gAYAL5Q=="], + + "@inline/web/vite/rolldown/@oxc-project/types": ["@oxc-project/types@0.160.0", "", {}, "sha512-gw4k9syEmnckbOgw2A2FU1TBDdX9hfwV9jEn/uio65pguPzwWiXQS3OIJDMEhv9m06tj9XiEe6RoD0YA+LgreA=="], + + "@inline/web/vite/rolldown/@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.3.4", "", { "os": "android", "cpu": "arm64" }, "sha512-5lifIO+b/prcM9sx/bkPN4w6UEToEfQ3gjhx0+0neuL+dkYskI792CfAq03T51jc8JFcaYXs2hi3l8RjiH/VWQ=="], + + "@inline/web/vite/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RCgxTI4AJQxhVF//BI3ImQOsXTHrF4Eg+f99jBy8WoETA2kSEGFxpnrVmW0leQq/2aBR4R5AC6csmy3rc66e3Q=="], + + "@inline/web/vite/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-zNPJVVPUaDEj+L0lImoK3rFv2b+Z5gNijI6DWu/fcD3/1TfmRXKb9ZyxbSN+2AhlctqjbNzUvCsMa+EBhnEM4Q=="], + + "@inline/web/vite/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.3.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-upP6g7ZIRy5by1RDQ/EphHIdJ5xK0eUD7sUgfZFWJ49s4XdbYsIvIlAPtrFpayR70Hhf9J22lb4Pm8/9FhrZmg=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.3.4", "", { "os": "linux", "cpu": "arm" }, "sha512-SAX5C5+poMLCxu8dkPF6h5yst40rkzs+9Y3cbPn2OFSydmHjAEprrGi64zGgnYyPIVZfdGUFqJ2fJbfbnHI+mA=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-nwHqdlRZS6GWBef3dG5/pMY6RNTBBUjj7s0Da+m6xsFpe7jx6IC46SLZcCu8f46JOfCovZmwnrz51EzGE+7Fyw=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Gr78X2ur/AgLCkmZgHffk/FerIX8S5zb/eII4bCcvJo0ANzeXhTShahdNbpnY6bpiszIAgIfiuKS9ziziWsamw=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.3.4", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-o9Wcn8nWrsQasaBRYM4d//FwhlBsTJYWkPVlhlt6FwzpwEoovY4IopRZjk5Fq3+ntRuSDORJjF/nA8sFeF2q6w=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.3.4", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-UDWu4jkVcx2kiBKm3Ec//4lVCbeTWj8gmJ9SyLWCdLWtTlyq7fQVeVV/14nXvRtSLErvJ2+yA/Ux5taS31Y17Q=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-W9mGtTa0w4fWh8RLMNPyaEhhcuqUfO07Q4I1bBc4PDMNg7gQSw0yPQNQ3D0qwbkXwxbyL4YrIzc8n6k1vuFExQ=="], + + "@inline/web/vite/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-8B+ofyQZ7/aCmkqnyMonPr5zKLqMVNczhRGFNtdIuItiwNn8iQWJawMq2E58r7bxD1XEbtRRsULY/eCWwZQ01Q=="], + + "@inline/web/vite/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.3.4", "", { "os": "none", "cpu": "arm64" }, "sha512-TlD0FSZaC7o2B4NCe9V5N11ugTnhzTM9ksj4sgRLvrKosDzjEkvlsTX3ehkw4ZlPv8AADimZZTvJGEa16pfXug=="], + + "@inline/web/vite/rolldown/@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.3.4", "", { "dependencies": { "@oxc-project/types": "0.160.0" }, "cpu": "none" }, "sha512-jwO8P3o53ygo7b5061B7BeaJ1BGv3BKZ6jroFdw/01qWry7Z+qNBlDvulzbTle5s/A0Fc1FRgsTxrke9DvsSbA=="], + + "@inline/web/vite/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.3.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-8adGMrNtrdzi2WD1ozhYapER59gD8Q/DV6SCKJlyG2HqULPdeQUBvMa33lTsiEYwIqTZUaIU2MmvPp5f1wbtXA=="], + + "@inline/web/vite/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.3.4", "", { "os": "win32", "cpu": "x64" }, "sha512-rIMjtESdXJCIoOiUTroQ1Y1rjVDZkuUVRUxs3APX2vNv175D7TDWvzdELiIhzGq9cUNUFat+co+PTmPHPqSREg=="], + + "@inline/web/vite/rolldown/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], + "@opentelemetry/instrumentation-pg/@types/pg/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], "@prisma/instrumentation/@opentelemetry/instrumentation/import-in-the-middle/acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="], "@sentry/node/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "@solidjs/vite-plugin/vite/postcss/nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], + + "@solidjs/vite-plugin/vite/postcss/source-map-js": ["source-map-js@1.3.0", "", {}, "sha512-pdUVfIWcK0kCgK831ibqkZDcL7I9zljjOu0TQFnA+fiQ6y1CYqYB7RkTOHHO45FGMg5P/Mvk/+4ToQ7gAYAL5Q=="], + + "@solidjs/vite-plugin/vite/rolldown/@oxc-project/types": ["@oxc-project/types@0.160.0", "", {}, "sha512-gw4k9syEmnckbOgw2A2FU1TBDdX9hfwV9jEn/uio65pguPzwWiXQS3OIJDMEhv9m06tj9XiEe6RoD0YA+LgreA=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.3.4", "", { "os": "android", "cpu": "arm64" }, "sha512-5lifIO+b/prcM9sx/bkPN4w6UEToEfQ3gjhx0+0neuL+dkYskI792CfAq03T51jc8JFcaYXs2hi3l8RjiH/VWQ=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RCgxTI4AJQxhVF//BI3ImQOsXTHrF4Eg+f99jBy8WoETA2kSEGFxpnrVmW0leQq/2aBR4R5AC6csmy3rc66e3Q=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-zNPJVVPUaDEj+L0lImoK3rFv2b+Z5gNijI6DWu/fcD3/1TfmRXKb9ZyxbSN+2AhlctqjbNzUvCsMa+EBhnEM4Q=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.3.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-upP6g7ZIRy5by1RDQ/EphHIdJ5xK0eUD7sUgfZFWJ49s4XdbYsIvIlAPtrFpayR70Hhf9J22lb4Pm8/9FhrZmg=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.3.4", "", { "os": "linux", "cpu": "arm" }, "sha512-SAX5C5+poMLCxu8dkPF6h5yst40rkzs+9Y3cbPn2OFSydmHjAEprrGi64zGgnYyPIVZfdGUFqJ2fJbfbnHI+mA=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-nwHqdlRZS6GWBef3dG5/pMY6RNTBBUjj7s0Da+m6xsFpe7jx6IC46SLZcCu8f46JOfCovZmwnrz51EzGE+7Fyw=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Gr78X2ur/AgLCkmZgHffk/FerIX8S5zb/eII4bCcvJo0ANzeXhTShahdNbpnY6bpiszIAgIfiuKS9ziziWsamw=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.3.4", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-o9Wcn8nWrsQasaBRYM4d//FwhlBsTJYWkPVlhlt6FwzpwEoovY4IopRZjk5Fq3+ntRuSDORJjF/nA8sFeF2q6w=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.3.4", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-UDWu4jkVcx2kiBKm3Ec//4lVCbeTWj8gmJ9SyLWCdLWtTlyq7fQVeVV/14nXvRtSLErvJ2+yA/Ux5taS31Y17Q=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-W9mGtTa0w4fWh8RLMNPyaEhhcuqUfO07Q4I1bBc4PDMNg7gQSw0yPQNQ3D0qwbkXwxbyL4YrIzc8n6k1vuFExQ=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-8B+ofyQZ7/aCmkqnyMonPr5zKLqMVNczhRGFNtdIuItiwNn8iQWJawMq2E58r7bxD1XEbtRRsULY/eCWwZQ01Q=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.3.4", "", { "os": "none", "cpu": "arm64" }, "sha512-TlD0FSZaC7o2B4NCe9V5N11ugTnhzTM9ksj4sgRLvrKosDzjEkvlsTX3ehkw4ZlPv8AADimZZTvJGEa16pfXug=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.3.4", "", { "dependencies": { "@oxc-project/types": "0.160.0" }, "cpu": "none" }, "sha512-jwO8P3o53ygo7b5061B7BeaJ1BGv3BKZ6jroFdw/01qWry7Z+qNBlDvulzbTle5s/A0Fc1FRgsTxrke9DvsSbA=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.3.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-8adGMrNtrdzi2WD1ozhYapER59gD8Q/DV6SCKJlyG2HqULPdeQUBvMa33lTsiEYwIqTZUaIU2MmvPp5f1wbtXA=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.3.4", "", { "os": "win32", "cpu": "x64" }, "sha512-rIMjtESdXJCIoOiUTroQ1Y1rjVDZkuUVRUxs3APX2vNv175D7TDWvzdELiIhzGq9cUNUFat+co+PTmPHPqSREg=="], + + "@solidjs/vite-plugin/vite/rolldown/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], + "@stylexjs/babel-plugin/@babel/traverse/@babel/generator/@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], "@tanstack/router-utils/@babel/generator/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], @@ -4042,6 +4420,20 @@ "@babel/helper-module-transforms/@babel/traverse/@babel/generator/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/generator": ["@babel/generator@7.29.7", "", { "dependencies": { "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/helper-globals": ["@babel/helper-globals@7.29.7", "", {}, "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/parser": ["@babel/parser@7.29.7", "", { "dependencies": { "@babel/types": "^7.29.7" }, "bin": "./bin/babel-parser.js" }, "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], + "@stylexjs/babel-plugin/@babel/traverse/@babel/generator/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], "@vitejs/plugin-react/@babel/core/@babel/generator/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], @@ -4053,5 +4445,13 @@ "babel-dead-code-elimination/@babel/core/@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], "babel-dead-code-elimination/@babel/traverse/@babel/generator/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/generator/@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/types/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], + + "@inline/web/@stylexjs/unplugin/@stylexjs/babel-plugin/@babel/traverse/@babel/generator/@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], } } diff --git a/landing/Dockerfile b/landing/Dockerfile index 8ecf39723d..0dae4aa0c1 100644 --- a/landing/Dockerfile +++ b/landing/Dockerfile @@ -8,6 +8,7 @@ COPY package.json bun.lock bunfig.toml ./ COPY cli/package.json ./cli/package.json COPY server ./server COPY landing ./landing +COPY web ./web COPY packages ./packages COPY plugins ./plugins COPY scripts ./scripts diff --git a/landing/README.md b/landing/README.md index 5e8e213832..c69d8350ac 100644 --- a/landing/README.md +++ b/landing/README.md @@ -9,8 +9,7 @@ bun run --cwd landing dev Configure local services and credentials separately. Do not commit credentials. -The website uses the browser libraries in `packages/` beneath this -directory. +The website shares `@inline/config` with the web app in `web/packages/`. Run checks individually: @@ -19,7 +18,6 @@ bun run --cwd landing build bun run --cwd landing typecheck bun run --cwd landing lint bun run --cwd landing test -bun run --cwd landing/packages/client test ``` Product documentation is in `src/docs/content/`; legal pages are in diff --git a/landing/package.json b/landing/package.json index a6f2de0663..e9302c47a8 100644 --- a/landing/package.json +++ b/landing/package.json @@ -9,15 +9,13 @@ "docs:llms": "bun run docs:check", "start": "bun run .output/server/index.mjs", "typecheck": "tsc -p tsconfig.json --noEmit", - "lint": "oxlint --ignore-path ../.oxlintignore src packages vite.config.ts vitest.config.ts", + "lint": "oxlint --ignore-path ../.oxlintignore src vite.config.ts vitest.config.ts", "test": "vitest run", "test:e2e": "playwright test", "test:watch": "vitest" }, "dependencies": { "@base-ui/react": "^1.6.0", - "@inline/client": "workspace:*", - "@inline/ids": "workspace:*", "@stylexjs/stylex": "0.19.1", "@tailwindcss/postcss": "^4.1.13", "@tailwindcss/vite": "^4.1.13", diff --git a/landing/packages/auth/src/react.tsx b/landing/packages/auth/src/react.tsx deleted file mode 100644 index c2d73d3bce..0000000000 --- a/landing/packages/auth/src/react.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { useSyncExternalStore } from "react" -import type { UserID } from "@inline/ids" -import type { AuthSession, AuthState, AuthStore } from "./core" - -export function useAuthState(auth: AuthStore): AuthState { - return useSyncExternalStore( - (listener) => auth.subscribe(() => listener()), - () => auth.getSnapshot(), - () => auth.getSnapshot(), - ) -} - -export function useIsLoggedIn(auth: AuthStore): boolean { - return useSyncExternalStore( - (listener) => auth.subscribe(() => listener()), - () => auth.isLoggedIn(), - () => auth.isLoggedIn(), - ) -} - -export function useToken(auth: AuthStore): string | null { - const state = useAuthState(auth) - return state.token -} - -export function useCurrentUserId(auth: AuthStore): UserID | null { - const state = useAuthState(auth) - return state.currentUserId -} - -export function useHasHydrated(auth: AuthStore): boolean { - const state = useAuthState(auth) - return state.hasHydrated -} - -export function useAuthActions(auth: AuthStore) { - return { - login: (session: AuthSession) => auth.login(session), - logout: () => auth.logout(), - } -} diff --git a/landing/packages/client/src/database/InlineStartupPersistenceStore.ts b/landing/packages/client/src/database/InlineStartupPersistenceStore.ts deleted file mode 100644 index 784517ff4a..0000000000 --- a/landing/packages/client/src/database/InlineStartupPersistenceStore.ts +++ /dev/null @@ -1,313 +0,0 @@ -import type { ChatID, MessageID } from "@inline/ids" -import { - DbObjectKind, - type DbModels, -} from "./models" -import type { MessageWindowCursor } from "./message-window" -import type { - InlinePersistenceCollection, - InlinePersistenceOperation, - InlinePersistenceStore, -} from "./persistence" - -export type InlinePersistenceSelectionSnapshot = - | { phase: "idle" } - | { phase: "opening-primary" } - | { phase: "primary" } - | { phase: "opening-fallback"; primaryError: unknown } - | { phase: "fallback"; primaryError: unknown } - | { phase: "failed"; error: unknown } - -export type InlineStartupPersistenceOptions = { - primary: () => InlinePersistenceStore - preparePrimary?: (primary: InlinePersistenceStore) => Promise - fallback: () => InlinePersistenceStore | null - prepareFallback?: (fallback: InlinePersistenceStore) => Promise - canFallback: (error: unknown) => boolean -} - -export class InlinePersistencePrimaryCleanupError extends Error { - constructor( - readonly primaryError: unknown, - readonly cleanupError: unknown, - ) { - super( - "Inline persistence primary failed to open and could not close cleanly", - { cause: cleanupError }, - ) - this.name = "InlinePersistencePrimaryCleanupError" - } -} - -export class InlinePersistenceFallbackUnavailableError extends Error { - constructor(readonly primaryError: unknown) { - super( - "Inline persistence fallback is unavailable", - { cause: primaryError }, - ) - this.name = "InlinePersistenceFallbackUnavailableError" - } -} - -export class InlinePersistenceFallbackOpenError extends Error { - constructor( - readonly primaryError: unknown, - readonly fallbackError: unknown, - ) { - super( - "Inline persistence primary and fallback both failed to open", - { cause: fallbackError }, - ) - this.name = "InlinePersistenceFallbackOpenError" - } -} - -export class InlinePersistenceCapabilityError extends Error { - constructor(capability: string, kind: DbObjectKind) { - super( - `Inline persistence ${kind} collection does not implement ${capability}`, - ) - this.name = "InlinePersistenceCapabilityError" - } -} - -export class InlinePersistenceClosedError extends Error { - constructor() { - super("Inline persistence is closed") - this.name = "InlinePersistenceClosedError" - } -} - -class InlineStartupPersistenceCollection - implements InlinePersistenceCollection -{ - constructor( - private readonly store: InlineStartupPersistenceStore, - private readonly kind: K, - ) {} - - private async collection() { - const store = await this.store.selectedStore() - return store.collection(this.kind) - } - - async init() { - await (await this.collection()).init() - } - - async get(id: DbModels[K]["id"]) { - return (await this.collection()).get(id) - } - - async getMany(ids: DbModels[K]["id"][]) { - const collection = await this.collection() - if (collection.getMany) return collection.getMany(ids) - const objects: DbModels[K][] = [] - for (const id of ids) { - const object = await collection.get(id) - if (object !== undefined) objects.push(object) - } - return objects - } - - async getAll() { - return (await this.collection()).getAll() - } - - async getDeferredUpdatesByTargetKeys(targetKeys: string[]) { - const collection = await this.collection() - if (!collection.getDeferredUpdatesByTargetKeys) { - throw new InlinePersistenceCapabilityError( - "getDeferredUpdatesByTargetKeys", - this.kind, - ) - } - return collection.getDeferredUpdatesByTargetKeys(targetKeys) - } - - async getMessageWindowByChatId( - chatId: ChatID, - limit: number, - before?: MessageWindowCursor, - after?: MessageWindowCursor, - ) { - const collection = await this.collection() - if (!collection.getMessageWindowByChatId) { - throw new InlinePersistenceCapabilityError( - "getMessageWindowByChatId", - this.kind, - ) - } - return collection.getMessageWindowByChatId( - chatId, - limit, - before, - after, - ) - } - - async getMessageWindowAroundMessageId( - chatId: ChatID, - messageId: MessageID, - beforeLimit: number, - afterLimit: number, - ) { - const collection = await this.collection() - if (!collection.getMessageWindowAroundMessageId) { - throw new InlinePersistenceCapabilityError( - "getMessageWindowAroundMessageId", - this.kind, - ) - } - return collection.getMessageWindowAroundMessageId( - chatId, - messageId, - beforeLimit, - afterLimit, - ) - } - - async deleteAllByChatId(chatId: ChatID) { - const collection = await this.collection() - if (!collection.deleteAllByChatId) { - throw new InlinePersistenceCapabilityError( - "deleteAllByChatId", - this.kind, - ) - } - await collection.deleteAllByChatId(chatId) - } - - async put(object: DbModels[K]) { - await (await this.collection()).put(object) - } - - async delete(id: DbModels[K]["id"]) { - await (await this.collection()).delete(id) - } -} - -/** - * Selects one account replica at startup and never switches it after open. - * - * The classifier must accept only errors which prove that the primary never - * became usable. A later read/write error is always returned from the already - * selected store; it can never redirect the account to a divergent replica. - */ -export class InlineStartupPersistenceStore - implements InlinePersistenceStore -{ - private selectionPromise: Promise | null = null - private operationsAllowed = true - private readonly collections = new Map< - DbObjectKind, - InlinePersistenceCollection - >() - private snapshot: InlinePersistenceSelectionSnapshot = { - phase: "idle", - } - - constructor(private readonly options: InlineStartupPersistenceOptions) {} - - getSelectionSnapshot(): InlinePersistenceSelectionSnapshot { - return this.snapshot - } - - async open(): Promise { - this.operationsAllowed = true - await this.selectedStore() - } - - collection(kind: K) { - let collection = this.collections.get(kind) - if (!collection) { - collection = new InlineStartupPersistenceCollection(this, kind) - this.collections.set(kind, collection) - } - return collection as InlinePersistenceCollection - } - - async write(operations: readonly InlinePersistenceOperation[]) { - await (await this.selectedStore()).write(operations) - } - - async close() { - this.operationsAllowed = false - const selection = this.selectionPromise - this.selectionPromise = null - if (selection) { - const store = await selection.catch(() => undefined) - await store?.close() - } - this.snapshot = { phase: "idle" } - } - - selectedStore(): Promise { - if (!this.operationsAllowed) { - return Promise.reject(new InlinePersistenceClosedError()) - } - if (!this.selectionPromise) { - this.selectionPromise = this.selectStore() - } - return this.selectionPromise - } - - private async selectStore(): Promise { - const primary = this.options.primary() - let primaryOpened = false - this.snapshot = { phase: "opening-primary" } - try { - await primary.open() - primaryOpened = true - await this.options.preparePrimary?.(primary) - this.snapshot = { phase: "primary" } - return primary - } catch (primaryError) { - try { - await primary.close() - } catch (cleanupError) { - const error = new InlinePersistencePrimaryCleanupError( - primaryError, - cleanupError, - ) - this.snapshot = { phase: "failed", error } - throw error - } - - if ( - primaryOpened || - !this.options.canFallback(primaryError) - ) { - this.snapshot = { phase: "failed", error: primaryError } - throw primaryError - } - - this.snapshot = { - phase: "opening-fallback", - primaryError, - } - const fallback = this.options.fallback() - if (!fallback) { - const error = new InlinePersistenceFallbackUnavailableError( - primaryError, - ) - this.snapshot = { phase: "failed", error } - throw error - } - try { - await fallback.open() - await this.options.prepareFallback?.(fallback) - this.snapshot = { phase: "fallback", primaryError } - return fallback - } catch (fallbackError) { - await fallback.close().catch(() => undefined) - const error = new InlinePersistenceFallbackOpenError( - primaryError, - fallbackError, - ) - this.snapshot = { phase: "failed", error } - throw error - } - } - } -} diff --git a/landing/packages/client/src/database/__tests__/atomic-batch.test.ts b/landing/packages/client/src/database/__tests__/atomic-batch.test.ts deleted file mode 100644 index 6b6754aaab..0000000000 --- a/landing/packages/client/src/database/__tests__/atomic-batch.test.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { - IDBDatabase, - IDBFactory, - IDBKeyRange, -} from "fake-indexeddb" -import { afterEach, describe, expect, it, vi } from "vitest" -import { chatId, userId } from "@inline/ids" -import { Db } from "../index" -import { - DbObjectKind, - type User, -} from "../models" -import { createDatabaseStorage } from "../storage" - -const installIndexedDb = () => { - vi.stubGlobal("indexedDB", new IDBFactory()) - vi.stubGlobal("IDBKeyRange", IDBKeyRange) -} - -describe("database atomic batches", () => { - afterEach(() => { - vi.restoreAllMocks() - vi.unstubAllGlobals() - }) - - it("writes all default-storage mutations through one readwrite transaction", async () => { - installIndexedDb() - const db = new Db({ - autoHydrate: false, - storageNamespace: `atomic-${crypto.randomUUID()}`, - }) - await db.hydrateKinds([ - DbObjectKind.User, - DbObjectKind.Chat, - ]) - - const transactions = vi.spyOn( - IDBDatabase.prototype, - "transaction", - ) - - db.batch(() => { - db.insert({ - kind: DbObjectKind.User, - id: userId(7), - firstName: "Dena", - }) - db.insert({ - kind: DbObjectKind.Chat, - id: chatId(10), - title: "Foundation", - }) - }) - await db.flushPersistence() - - expect( - transactions.mock.calls.filter( - ([, mode]) => mode === "readwrite", - ), - ).toHaveLength(1) - }) - - it("aborts the whole IndexedDB transaction when one row cannot be cloned", async () => { - installIndexedDb() - const storage = createDatabaseStorage( - `atomic-abort-${crypto.randomUUID()}`, - ) - if (!storage) throw new Error("IndexedDB storage unavailable") - - const valid: User = { - kind: DbObjectKind.User, - id: userId(7), - firstName: "Dena", - } - const invalid = { - kind: DbObjectKind.User, - id: userId(8), - firstName: "Invalid", - uncloneable: () => undefined, - } as unknown as User - - await expect( - storage.write([ - { type: "put", object: valid }, - { type: "put", object: invalid }, - ]), - ).rejects.toBeDefined() - - await storage.collection(DbObjectKind.User).init() - await expect( - storage.collection(DbObjectKind.User).get(valid.id), - ).resolves.toBeUndefined() - }) - - it("keeps collection facades owned across close and reopen", async () => { - installIndexedDb() - const storage = createDatabaseStorage( - `close-reopen-${crypto.randomUUID()}`, - ) - if (!storage) throw new Error("IndexedDB storage unavailable") - const users = storage.collection(DbObjectKind.User) - const databaseCloses = vi.spyOn(IDBDatabase.prototype, "close") - - await storage.open() - await users.put({ - kind: DbObjectKind.User, - id: userId(7), - firstName: "Dena", - }) - await storage.close() - const closesAfterFirstStop = databaseCloses.mock.calls.length - - await expect(users.get(userId(7))).resolves.toMatchObject({ - firstName: "Dena", - }) - await storage.close() - - expect(databaseCloses.mock.calls.length).toBeGreaterThan( - closesAfterFirstStop, - ) - }) - - it("persists replica authority metadata across close and reopen", async () => { - installIndexedDb() - const storage = createDatabaseStorage( - `replica-metadata-${crypto.randomUUID()}`, - ) - if ( - !storage?.getReplicaMetadata || - !storage.setReplicaMetadata - ) { - throw new Error("IndexedDB replica metadata unavailable") - } - - await storage.open() - await storage.setReplicaMetadata("authority", "sqlite") - await storage.close() - await expect( - storage.getReplicaMetadata("authority"), - ).resolves.toBe("sqlite") - await storage.close() - }) - - it("rolls memory back and suppresses observers when a recipe throws", () => { - const db = new Db({ - autoHydrate: false, - storageByKind: { - [DbObjectKind.User]: null, - }, - }) - const ref = db.ref(DbObjectKind.User, userId(7)) - const observer = vi.fn() - db.subscribeToObject(ref, observer) - db.insert({ - kind: DbObjectKind.User, - id: userId(7), - firstName: "Before", - }) - observer.mockClear() - - expect(() => - db.batch(() => { - db.replace({ - kind: DbObjectKind.User, - id: userId(7), - firstName: "After", - }) - db.insert({ - kind: DbObjectKind.User, - id: userId(8), - firstName: "Transient", - }) - throw new Error("recipe failed") - }), - ).toThrow("recipe failed") - - expect(db.get(ref)?.firstName).toBe("Before") - expect( - db.get(db.ref(DbObjectKind.User, userId(8))), - ).toBeUndefined() - expect(observer).not.toHaveBeenCalled() - }) - - it("rolls memory back when an asynchronous commit is rejected", async () => { - const put = vi.fn(async () => { - throw new Error("disk full") - }) - const db = new Db({ - autoHydrate: false, - storageByKind: { - [DbObjectKind.User]: { - init: async () => {}, - get: async () => undefined, - getAll: async () => [], - put, - delete: async () => {}, - }, - }, - }) - const ref = db.ref(DbObjectKind.User, userId(7)) - const observer = vi.fn() - db.subscribeToObject(ref, observer) - - await expect( - db.commit(() => { - db.insert({ - kind: DbObjectKind.User, - id: userId(7), - firstName: "Transient", - }) - }), - ).rejects.toThrow("disk full") - - expect(db.get(ref)).toBeUndefined() - expect(observer).not.toHaveBeenCalled() - }) -}) diff --git a/landing/packages/client/src/database/__tests__/identity-migration.test.ts b/landing/packages/client/src/database/__tests__/identity-migration.test.ts deleted file mode 100644 index f64629e935..0000000000 --- a/landing/packages/client/src/database/__tests__/identity-migration.test.ts +++ /dev/null @@ -1,358 +0,0 @@ -import { - IDBFactory, - IDBKeyRange, -} from "fake-indexeddb" -import { - afterEach, - describe, - expect, - it, - vi, -} from "vitest" -import { Update } from "@inline-chat/protocol/core" -import { - chatId, - dialogId, - inlineIdOrderKey, - messageId, - userId, -} from "@inline/ids" -import { DbObjectKind, messageKey } from "../models" -import { - IndexedDbIdentityMigrationError, - createDatabaseStorage, - migrateStoredIdentity, -} from "../storage" - -describe("IndexedDB identity migration", () => { - afterEach(() => { - vi.unstubAllGlobals() - }) - - it("keeps adjacent int64 identities distinct beyond Number.MAX_SAFE_INTEGER", () => { - const lower = migrateStoredIdentity({ - kind: DbObjectKind.Chat, - id: 9_007_199_254_740_992n, - createdBy: 9_007_199_254_740_994n, - }) - const upper = migrateStoredIdentity({ - kind: DbObjectKind.Chat, - id: "9007199254740993", - createdBy: "9007199254740995", - }) - - expect(lower).toMatchObject({ - id: chatId("9007199254740992"), - createdBy: userId("9007199254740994"), - }) - expect(upper).toMatchObject({ - id: chatId("9007199254740993"), - createdBy: userId("9007199254740995"), - }) - expect(lower.id).not.toBe(upper.id) - }) - - it("migrates chat-scoped message identity and replay context atomically", () => { - expect( - migrateStoredIdentity({ - kind: DbObjectKind.Message, - id: 7, - chatId: 10, - fromId: 1, - }), - ).toMatchObject({ - id: messageKey(chatId(10), messageId(7)), - messageId: messageId(7), - chatId: chatId(10), - fromId: userId(1), - }) - - expect( - migrateStoredIdentity({ - kind: DbObjectKind.PendingTransaction, - id: "transaction-1", - type: "send_message", - context: { - chatId: 10, - replyToMsgId: 5, - temporaryMessageId: -1, - }, - }), - ).toMatchObject({ - context: { - chatId: chatId(10), - replyToMsgId: messageId(5), - temporaryMessageId: messageId(-1), - }, - }) - - expect( - migrateStoredIdentity({ - kind: DbObjectKind.PendingTransaction, - id: "transaction-unpin", - type: "pin_message", - context: { - messageId: "9007199254740993", - unpin: true, - previousPinnedMessageIds: [1, "9007199254740995"], - optimisticPinnedMessageIds: [1], - }, - }), - ).toMatchObject({ - context: { - messageId: messageId("9007199254740993"), - previousPinnedMessageIds: [ - messageId(1), - messageId("9007199254740995"), - ], - optimisticPinnedMessageIds: [messageId(1)], - }, - }) - }) - - it("preserves native signed dialog identity", () => { - expect( - migrateStoredIdentity({ - kind: DbObjectKind.Dialog, - id: -801, - chatId: 801, - peerThreadId: 801, - }), - ).toMatchObject({ - id: dialogId(-801), - chatId: chatId(801), - peerThreadId: chatId(801), - }) - }) - - it("preserves an exact owner-only reserved chat identity", () => { - expect( - migrateStoredIdentity({ - kind: DbObjectKind.ReservedChatID, - id: "9007199254740993", - chatId: 9_007_199_254_740_993n, - expiresAt: 1_800_000_000, - createdAt: 1_700_000_000_000, - }), - ).toMatchObject({ - id: chatId("9007199254740993"), - chatId: chatId("9007199254740993"), - }) - }) - - it("derives a draft identity from its exact Inline peer", () => { - expect( - migrateStoredIdentity({ - kind: DbObjectKind.MessageDraft, - id: "stale-draft-key", - peerKind: "user", - peerUserId: "9007199254740993", - peerThreadId: 44, - text: "draft", - revision: 1, - updatedAt: 1, - }), - ).toMatchObject({ - id: "user:9007199254740993", - peerKind: "user", - peerUserId: userId("9007199254740993"), - peerThreadId: undefined, - }) - }) - - it("aborts instead of blessing a number that JavaScript already rounded", () => { - expect(() => - migrateStoredIdentity({ - kind: DbObjectKind.Chat, - id: Number.MAX_SAFE_INTEGER + 1, - }), - ).toThrow(IndexedDbIdentityMigrationError) - }) - - it("backfills selective message targets for pre-v6 deferred rows", () => { - const update = Update.create({ - seq: 9, - update: { - oneofKind: "updateReaction", - updateReaction: { - reaction: { - chatId: 801n, - messageId: 41n, - userId: 7n, - emoji: "🔥", - date: 1_009n, - }, - }, - }, - }) - - expect( - migrateStoredIdentity({ - kind: DbObjectKind.DeferredUpdate, - id: "legacy-reaction", - bucketId: "chat:801", - seq: 9, - payloadType: "Update", - updateType: "updateReaction", - payload: Update.toBinary(update), - }), - ).toMatchObject({ targetKey: messageKey(chatId(801), messageId(41)) }) - - const attachment = Update.create({ - seq: 10, - update: { - oneofKind: "messageAttachment", - messageAttachment: { - chatId: 801n, - messageId: 42n, - attachment: { - id: 12n, - attachment: { oneofKind: undefined }, - }, - }, - }, - }) - expect( - migrateStoredIdentity({ - kind: DbObjectKind.DeferredUpdate, - id: "legacy-attachment", - bucketId: "chat:801", - seq: 10, - payloadType: "Update", - updateType: "messageAttachment", - payload: Update.toBinary(attachment), - }), - ).toMatchObject({ - targetKey: messageKey(chatId(801), messageId(42)), - }) - - expect( - migrateStoredIdentity({ - kind: DbObjectKind.DeferredUpdate, - id: "legacy-malformed", - bucketId: "chat:801", - payloadType: "Update", - updateType: "updateReaction", - payload: new Uint8Array([255]), - }), - ).toMatchObject({ targetKey: undefined }) - }) - - it("forwards the v4 message-ID index to the date and ID window index", async () => { - vi.stubGlobal("indexedDB", new IDBFactory()) - vi.stubGlobal("IDBKeyRange", IDBKeyRange) - const namespace = `v4-window-${crypto.randomUUID()}` - const databaseName = `inline-client-db:${namespace}` - - const legacyDatabase = await new Promise( - (resolve, reject) => { - const request = indexedDB.open(databaseName, 4) - request.onupgradeneeded = () => { - const store = request.result.createObjectStore( - "objects", - { - keyPath: ["kind", "id"], - }, - ) - store.createIndex("kind", "kind", { - unique: false, - }) - store.createIndex( - "message-chat-id", - ["kind", "chatId", "_messageIdOrder"], - { unique: false }, - ) - for (const [rawMessageId, date] of [ - [900, 10], - [1, 20], - ] as const) { - const exactMessageId = messageId(rawMessageId) - store.put({ - kind: DbObjectKind.Message, - id: messageKey(chatId(10), exactMessageId), - messageId: exactMessageId, - chatId: chatId(10), - fromId: userId(7), - date, - _messageIdOrder: - inlineIdOrderKey(exactMessageId), - }) - } - } - request.onsuccess = () => resolve(request.result) - request.onerror = () => reject(request.error) - }, - ) - legacyDatabase.onversionchange = () => legacyDatabase.close() - - const storage = createDatabaseStorage(namespace) - if (!storage) { - throw new Error("IndexedDB storage unavailable") - } - const messages = storage.collection( - DbObjectKind.Message, - ) - await messages.init() - - await expect( - messages.getMessageWindowByChatId?.( - chatId(10), - 1, - ), - ).resolves.toEqual([ - expect.objectContaining({ - messageId: messageId(1), - date: 20, - }), - ]) - }) - - it("adds v7 replica metadata without rerunning the v6 identity rewrite", async () => { - vi.stubGlobal("indexedDB", new IDBFactory()) - vi.stubGlobal("IDBKeyRange", IDBKeyRange) - const namespace = `v6-metadata-${crypto.randomUUID()}` - const databaseName = `inline-client-db:${namespace}` - const legacyDatabase = await new Promise( - (resolve, reject) => { - const request = indexedDB.open(databaseName, 6) - request.onupgradeneeded = () => { - const store = request.result.createObjectStore( - "objects", - { keyPath: ["kind", "id"] }, - ) - // This deliberately cannot pass the old identity rewrite. A v6→v7 - // metadata-only upgrade must leave it untouched. - store.put({ - kind: DbObjectKind.User, - id: Number.MAX_SAFE_INTEGER + 1, - firstName: "Legacy sentinel", - }) - } - request.onsuccess = () => resolve(request.result) - request.onerror = () => reject(request.error) - }, - ) - legacyDatabase.close() - - const storage = createDatabaseStorage(namespace) - if (!storage?.setReplicaMetadata || !storage.getReplicaMetadata) { - throw new Error("IndexedDB replica metadata unavailable") - } - await storage.open() - expect(() => - legacyDatabase.transaction("objects", "readonly"), - ).toThrow() - await storage.setReplicaMetadata("cutover", "ready") - await expect(storage.getReplicaMetadata("cutover")).resolves.toBe( - "ready", - ) - await expect( - new Promise((resolve, reject) => { - const oldWriter = indexedDB.open(databaseName, 6) - oldWriter.onsuccess = () => resolve(oldWriter.result) - oldWriter.onerror = () => reject(oldWriter.error) - }), - ).rejects.toMatchObject({ name: "VersionError" }) - await storage.close() - }) -}) diff --git a/landing/packages/client/src/database/__tests__/replica-import.test.ts b/landing/packages/client/src/database/__tests__/replica-import.test.ts deleted file mode 100644 index d59cfc70bf..0000000000 --- a/landing/packages/client/src/database/__tests__/replica-import.test.ts +++ /dev/null @@ -1,312 +0,0 @@ -import { - IDBFactory, - IDBKeyRange, -} from "fake-indexeddb" -import { - chatId, - dialogId, - messageId, - spaceId, - userId, -} from "@inline/ids" -import { afterEach, describe, expect, it, vi } from "vitest" -import { - DbObjectKind, - messageDraftKey, - messageKey, - type DbModel, -} from "../models" -import { - assertInlineLegacyFallbackAllowed, - importIndexedDbReplicaIntoSqlite, - INLINE_INDEXED_DB_IMPORT_MARKER, - INLINE_REPLICA_IMPORT_KINDS, - INLINE_SQLITE_AUTHORITY_MARKER, - InlinePersistenceReplicaPromotedError, -} from "../replica-import" -import { createSqliteMemoryPersistenceStore } from "../sqlite/openers" -import { createIndexedDbPersistenceStore } from "../storage" - -const targetChatId = chatId("9223372036854775806") -const targetUserId = userId("9223372036854775805") - -const fixtureModels = (): DbModel[] => [ - { - kind: DbObjectKind.User, - id: targetUserId, - firstName: "Dena", - }, - { - kind: DbObjectKind.Space, - id: spaceId(2), - name: "Inline", - creator: true, - date: 100, - }, - { - kind: DbObjectKind.Chat, - id: targetChatId, - title: "Foundation", - spaceId: spaceId(2), - lastMsgId: messageId(5), - date: 105, - }, - { - kind: DbObjectKind.Dialog, - id: dialogId(-1), - chatId: targetChatId, - spaceId: spaceId(2), - open: true, - order: "a", - }, - ...Array.from({ length: 5 }, (_, index) => { - const id = messageId(index + 1) - return { - kind: DbObjectKind.Message, - id: messageKey(targetChatId, id), - chatId: targetChatId, - messageId: id, - fromId: targetUserId, - date: 100 + index, - message: `Imported ${index + 1}`, - randomId: BigInt(index + 1), - } as const - }), - { - kind: DbObjectKind.DeferredUpdate, - id: "deferred-1", - bucketId: `chat:${targetChatId}`, - targetKey: messageKey(targetChatId, messageId(1)), - payloadType: "Update", - updateType: "messageAttachment", - payload: new Uint8Array([1, 2, 3]), - seq: 3, - date: 103, - }, - { - kind: DbObjectKind.PendingTransaction, - id: "outbox-1", - type: "send_message", - replayPolicy: "idempotent", - context: { - chatId: targetChatId, - randomId: 9223372036854775807n, - }, - createdAt: 1_700_000_000_000, - status: "pending", - }, - { - kind: DbObjectKind.ReservedChatID, - id: chatId("9223372036854775804"), - chatId: chatId("9223372036854775804"), - expiresAt: 1_700_000_100, - createdAt: 1_700_000_000_000, - }, - { - kind: DbObjectKind.MessageDraft, - id: messageDraftKey({ - peerKind: "chat", - peerThreadId: targetChatId, - }), - peerKind: "chat", - peerThreadId: targetChatId, - text: "Survives cutover", - revision: 2, - updatedAt: 1_700_000_000_000, - }, - { - kind: DbObjectKind.SyncBucketState, - id: `chat:${targetChatId}`, - seq: 7, - date: 107, - }, - { - kind: DbObjectKind.SyncGlobalState, - id: 0, - lastSyncDate: 107, - }, -] - -const installIndexedDb = () => { - vi.stubGlobal("indexedDB", new IDBFactory()) - vi.stubGlobal("IDBKeyRange", IDBKeyRange) -} - -describe("IndexedDB to SQLite replica import", () => { - afterEach(() => { - vi.unstubAllGlobals() - vi.restoreAllMocks() - }) - - it("keeps the import-kind manifest exhaustive and cursors last", () => { - expect(new Set(INLINE_REPLICA_IMPORT_KINDS)).toEqual( - new Set(Object.values(DbObjectKind)), - ) - expect(INLINE_REPLICA_IMPORT_KINDS.slice(-2)).toEqual([ - DbObjectKind.SyncBucketState, - DbObjectKind.SyncGlobalState, - ]) - }) - - it("streams every replica model in bounded pages and marks completion", async () => { - installIndexedDb() - const source = createIndexedDbPersistenceStore( - `replica-import-${crypto.randomUUID()}`, - ) - if (!source) throw new Error("IndexedDB unavailable") - const models = fixtureModels() - await source.write( - models.map((object) => ({ type: "put" as const, object })), - ) - const scan = vi.spyOn(source, "scan") - const target = createSqliteMemoryPersistenceStore() - const progress = vi.fn() - - const result = await importIndexedDbReplicaIntoSqlite({ - source, - target, - batchSize: 2, - onProgress: progress, - }) - - expect(result.status).toBe("imported") - expect(result.importedTotal).toBe(models.length) - expect( - scan.mock.calls.every(([, , limit]) => limit === 2), - ).toBe(true) - expect( - scan.mock.calls.filter( - ([kind]) => kind === DbObjectKind.Message, - ), - ).toHaveLength(3) - expect(progress).toHaveBeenLastCalledWith({ - kind: DbObjectKind.SyncGlobalState, - importedForKind: 1, - importedTotal: models.length, - }) - - for (const model of models) { - await expect( - target.collection(model.kind).get(model.id as never), - ).resolves.toEqual(model) - } - await expect( - target.getReplicaMetadata(INLINE_INDEXED_DB_IMPORT_MARKER), - ).resolves.toBe("complete") - await expect( - source.getReplicaMetadata?.(INLINE_SQLITE_AUTHORITY_MARKER), - ).resolves.toBe("complete") - await expect( - assertInlineLegacyFallbackAllowed(source), - ).rejects.toBeInstanceOf(InlinePersistenceReplicaPromotedError) - - // Import is non-destructive. A completed target reopens only to repair the - // authority fence; it never rescans legacy rows. - await expect( - source.collection(DbObjectKind.User).get(targetUserId), - ).resolves.toEqual(models[0]) - const sourceOpen = vi.spyOn(source, "open") - scan.mockClear() - await expect( - importIndexedDbReplicaIntoSqlite({ source, target, batchSize: 2 }), - ).resolves.toMatchObject({ - status: "already-imported", - importedTotal: 0, - }) - expect(sourceOpen).toHaveBeenCalledOnce() - expect(scan).not.toHaveBeenCalled() - await source.close() - await target.close() - }) - - it("leaves no marker on interruption and safely reapplies batches", async () => { - installIndexedDb() - const source = createIndexedDbPersistenceStore( - `replica-resume-${crypto.randomUUID()}`, - ) - if (!source) throw new Error("IndexedDB unavailable") - const models = fixtureModels() - await source.write( - models.map((object) => ({ type: "put" as const, object })), - ) - const target = createSqliteMemoryPersistenceStore() - const originalWrite = target.write.bind(target) - let writes = 0 - vi.spyOn(target, "write").mockImplementation(async (operations) => { - writes += 1 - if (writes === 4) throw new Error("simulated worker termination") - await originalWrite(operations) - }) - - await expect( - importIndexedDbReplicaIntoSqlite({ source, target, batchSize: 2 }), - ).rejects.toThrow("Inline IndexedDB replica import failed") - await expect( - target.getReplicaMetadata(INLINE_INDEXED_DB_IMPORT_MARKER), - ).resolves.toBeUndefined() - await expect( - source.getReplicaMetadata?.(INLINE_SQLITE_AUTHORITY_MARKER), - ).resolves.toBeUndefined() - - vi.mocked(target.write).mockImplementation(originalWrite) - await expect( - importIndexedDbReplicaIntoSqlite({ source, target, batchSize: 2 }), - ).resolves.toMatchObject({ - status: "imported", - importedTotal: models.length, - }) - for (const model of models) { - await expect( - target.collection(model.kind).get(model.id as never), - ).resolves.toEqual(model) - } - await expect( - source.getReplicaMetadata?.(INLINE_SQLITE_AUTHORITY_MARKER), - ).resolves.toBe("complete") - - await source.close() - await target.close() - }) - - it("fences IndexedDB before committing SQLite completion", async () => { - installIndexedDb() - const source = createIndexedDbPersistenceStore( - `replica-fence-${crypto.randomUUID()}`, - ) - if (!source) throw new Error("IndexedDB unavailable") - await source.write( - fixtureModels().map((object) => ({ type: "put" as const, object })), - ) - const target = createSqliteMemoryPersistenceStore() - const setTargetMetadata = target.setReplicaMetadata.bind(target) - vi.spyOn(target, "setReplicaMetadata").mockRejectedValueOnce( - new Error("simulated completion-marker failure"), - ) - - await expect( - importIndexedDbReplicaIntoSqlite({ source, target, batchSize: 2 }), - ).rejects.toThrow("Inline IndexedDB replica import failed") - await expect( - source.getReplicaMetadata?.(INLINE_SQLITE_AUTHORITY_MARKER), - ).resolves.toBe("complete") - await expect( - target.getReplicaMetadata(INLINE_INDEXED_DB_IMPORT_MARKER), - ).resolves.toBeUndefined() - await expect( - assertInlineLegacyFallbackAllowed(source), - ).rejects.toBeInstanceOf(InlinePersistenceReplicaPromotedError) - - vi.mocked(target.setReplicaMetadata).mockImplementation( - setTargetMetadata, - ) - await expect( - importIndexedDbReplicaIntoSqlite({ source, target, batchSize: 2 }), - ).resolves.toMatchObject({ status: "imported" }) - await expect( - target.getReplicaMetadata(INLINE_INDEXED_DB_IMPORT_MARKER), - ).resolves.toBe("complete") - - await source.close() - await target.close() - }) -}) diff --git a/landing/packages/client/src/database/__tests__/startup-persistence.test.ts b/landing/packages/client/src/database/__tests__/startup-persistence.test.ts deleted file mode 100644 index 1e976b1624..0000000000 --- a/landing/packages/client/src/database/__tests__/startup-persistence.test.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { userId } from "@inline/ids" -import { describe, expect, it, vi } from "vitest" -import { - InlinePersistenceFallbackOpenError, - InlinePersistenceFallbackUnavailableError, - InlinePersistencePrimaryCleanupError, - InlineStartupPersistenceStore, -} from "../InlineStartupPersistenceStore" -import { - DbObjectKind, - type DbModels, -} from "../models" -import type { - InlinePersistenceCollection, - InlinePersistenceStore, -} from "../persistence" -import { - InlineSqliteUnavailableError, - isInlineSqliteStartupFallbackSafe, -} from "../sqlite/openers" - -const user = { - kind: DbObjectKind.User, - id: userId(7), - firstName: "Dena", -} as const - -const createStore = (options: { - open?: () => Promise - close?: () => Promise - write?: InlinePersistenceStore["write"] - storedUser?: DbModels[DbObjectKind.User] -}) => { - const open = vi.fn(options.open ?? (async () => {})) - const close = vi.fn(options.close ?? (async () => {})) - const write = vi.fn(options.write ?? (async () => {})) - const collection: InlinePersistenceCollection< - DbModels[DbObjectKind.User] - > = { - init: async () => {}, - get: async (id) => - id === options.storedUser?.id - ? options.storedUser - : undefined, - getMany: async (ids) => - ids.includes(options.storedUser?.id ?? userId(-1)) && - options.storedUser - ? [options.storedUser] - : [], - getAll: async () => options.storedUser ? [options.storedUser] : [], - put: async () => {}, - delete: async () => {}, - } - const store: InlinePersistenceStore = { - open, - close, - write, - collection: () => - collection as unknown as InlinePersistenceCollection, - } - return { store, open, close, write } -} - -describe("InlineStartupPersistenceStore", () => { - it("selects the fallback once for a classified startup capability failure", async () => { - const primaryError = new InlineSqliteUnavailableError( - "opfs-unsupported", - ) - const primary = createStore({ - open: async () => { - throw primaryError - }, - }) - const fallback = createStore({ storedUser: user }) - const fallbackFactory = vi.fn(() => fallback.store) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: fallbackFactory, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - await Promise.all([ - store.open(), - store.collection(DbObjectKind.User).init(), - ]) - await expect( - store.collection(DbObjectKind.User).get(user.id), - ).resolves.toEqual(user) - await store.write([{ type: "put", object: user }]) - - expect(primary.open).toHaveBeenCalledTimes(1) - expect(primary.close).toHaveBeenCalledTimes(1) - expect(fallbackFactory).toHaveBeenCalledTimes(1) - expect(fallback.open).toHaveBeenCalledTimes(1) - expect(fallback.write).toHaveBeenCalledTimes(1) - expect(store.getSelectionSnapshot()).toEqual({ - phase: "fallback", - primaryError, - }) - }) - - it("fails closed for migration, corruption, and unknown startup errors", async () => { - const primaryError = new Error("migration failed") - const primary = createStore({ - open: async () => { - throw primaryError - }, - }) - const fallbackFactory = vi.fn(() => createStore({}).store) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: fallbackFactory, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - await expect(store.open()).rejects.toBe(primaryError) - expect(primary.close).toHaveBeenCalledOnce() - expect(fallbackFactory).not.toHaveBeenCalled() - expect(store.getSelectionSnapshot()).toEqual({ - phase: "failed", - error: primaryError, - }) - }) - - it("never switches replicas after the primary has opened", async () => { - const writeError = new InlineSqliteUnavailableError( - "opfs-permission-denied", - ) - const primary = createStore({ - write: async () => { - throw writeError - }, - }) - const fallbackFactory = vi.fn(() => createStore({}).store) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: fallbackFactory, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - await store.open() - await expect( - store.write([{ type: "put", object: user }]), - ).rejects.toBe(writeError) - expect(fallbackFactory).not.toHaveBeenCalled() - expect(store.getSelectionSnapshot()).toEqual({ phase: "primary" }) - }) - - it("does not implicitly reopen through a collection after close", async () => { - const primary = createStore({ storedUser: user }) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: () => null, - canFallback: () => false, - }) - const users = store.collection(DbObjectKind.User) - - await store.open() - await store.close() - - await expect(users.get(user.id)).rejects.toThrow( - "Inline persistence is closed", - ) - expect(primary.open).toHaveBeenCalledTimes(1) - - await store.open() - await expect(users.get(user.id)).resolves.toEqual(user) - expect(primary.open).toHaveBeenCalledTimes(2) - }) - - it("fails closed when replica preparation fails after primary open", async () => { - const preparationError = new InlineSqliteUnavailableError( - "opfs-permission-denied", - ) - const primary = createStore({}) - const fallbackFactory = vi.fn(() => createStore({}).store) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - preparePrimary: async () => { - throw preparationError - }, - fallback: fallbackFactory, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - await expect(store.open()).rejects.toBe(preparationError) - expect(primary.close).toHaveBeenCalledOnce() - expect(fallbackFactory).not.toHaveBeenCalled() - }) - - it("refuses fallback when the failed primary cannot close", async () => { - const primaryError = new InlineSqliteUnavailableError( - "opfs-permission-denied", - ) - const cleanupError = new Error("handle remains open") - const primary = createStore({ - open: async () => { - throw primaryError - }, - close: async () => { - throw cleanupError - }, - }) - const fallbackFactory = vi.fn(() => createStore({}).store) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: fallbackFactory, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - const error = await store.open().catch((cause) => cause) - expect(error).toBeInstanceOf( - InlinePersistencePrimaryCleanupError, - ) - expect(error).toMatchObject({ primaryError, cleanupError }) - expect(fallbackFactory).not.toHaveBeenCalled() - }) - - it("keeps both startup failures when the fallback cannot open", async () => { - const primaryError = new InlineSqliteUnavailableError( - "opfs-unsupported", - ) - const fallbackError = new Error("IndexedDB denied") - const primary = createStore({ - open: async () => { - throw primaryError - }, - }) - const fallback = createStore({ - open: async () => { - throw fallbackError - }, - }) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: () => fallback.store, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - const error = await store.open().catch((cause) => cause) - expect(error).toBeInstanceOf(InlinePersistenceFallbackOpenError) - expect(error).toMatchObject({ primaryError, fallbackError }) - expect(fallback.close).toHaveBeenCalledOnce() - }) - - it("closes and refuses a fallback which fails replica preparation", async () => { - const primaryError = new InlineSqliteUnavailableError( - "opfs-unsupported", - ) - const promotedError = new Error("SQLite is authoritative") - const primary = createStore({ - open: async () => { - throw primaryError - }, - }) - const fallback = createStore({ storedUser: user }) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: () => fallback.store, - prepareFallback: async () => { - throw promotedError - }, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - const error = await store.open().catch((cause) => cause) - expect(error).toBeInstanceOf(InlinePersistenceFallbackOpenError) - expect(error).toMatchObject({ primaryError, fallbackError: promotedError }) - expect(fallback.open).toHaveBeenCalledOnce() - expect(fallback.close).toHaveBeenCalledOnce() - expect(store.getSelectionSnapshot()).toEqual({ phase: "failed", error }) - }) - - it("reports when no fallback adapter exists", async () => { - const primaryError = new InlineSqliteUnavailableError( - "opfs-unsupported", - ) - const primary = createStore({ - open: async () => { - throw primaryError - }, - }) - const store = new InlineStartupPersistenceStore({ - primary: () => primary.store, - fallback: () => null, - canFallback: isInlineSqliteStartupFallbackSafe, - }) - - await expect(store.open()).rejects.toMatchObject({ - name: InlinePersistenceFallbackUnavailableError.name, - primaryError, - }) - }) - - it("only classifies pre-database capability and permission failures as safe", () => { - expect( - isInlineSqliteStartupFallbackSafe( - new InlineSqliteUnavailableError("worker-required"), - ), - ).toBe(true) - expect( - isInlineSqliteStartupFallbackSafe( - new InlineSqliteUnavailableError("opfs-unsupported"), - ), - ).toBe(true) - expect( - isInlineSqliteStartupFallbackSafe( - new InlineSqliteUnavailableError("opfs-permission-denied"), - ), - ).toBe(true) - expect( - isInlineSqliteStartupFallbackSafe( - new InlineSqliteUnavailableError( - "wasm-initialization-failed", - ), - ), - ).toBe(false) - expect( - isInlineSqliteStartupFallbackSafe( - new InlineSqliteUnavailableError( - "opfs-initialization-failed", - ), - ), - ).toBe(false) - expect(isInlineSqliteStartupFallbackSafe(new Error("IO"))).toBe(false) - }) -}) diff --git a/landing/packages/client/src/database/models.ts b/landing/packages/client/src/database/models.ts deleted file mode 100644 index a75c7efa9d..0000000000 --- a/landing/packages/client/src/database/models.ts +++ /dev/null @@ -1,310 +0,0 @@ -/** - * Models - * - * We use plain typescript objects for now. Later we can upgrade to Effect Schema or Zod. - * - */ - -export type DbModel = - | User - | Dialog - | Chat - | Message - | Space - | SyncGlobalState - | SyncBucketState - | DeferredUpdate - | PendingTransaction - | ReservedChatID - | MessageDraft - -export enum DbObjectKind { - Dialog = "D", - Chat = "C", - User = "U", - Message = "M", - Space = "S", - SyncGlobalState = "SG", - SyncBucketState = "SB", - DeferredUpdate = "DU", - PendingTransaction = "TX", - ReservedChatID = "RCI", - MessageDraft = "MD", -} - -export type DbModels = { - [DbObjectKind.User]: User - [DbObjectKind.Dialog]: Dialog - [DbObjectKind.Chat]: Chat - [DbObjectKind.Message]: Message - [DbObjectKind.Space]: Space - [DbObjectKind.SyncGlobalState]: SyncGlobalState - [DbObjectKind.SyncBucketState]: SyncBucketState - [DbObjectKind.DeferredUpdate]: DeferredUpdate - [DbObjectKind.PendingTransaction]: PendingTransaction - [DbObjectKind.ReservedChatID]: ReservedChatID - [DbObjectKind.MessageDraft]: MessageDraft -} - -export interface DbModelBase { - kind: K - id: Id -} - -export interface User extends DbModelBase { - kind: DbObjectKind.User - id: UserID - firstName?: string - lastName?: string - username?: string - email?: string - min?: boolean - pendingSetup?: boolean - bot?: boolean - - profilePhoto?: { - fileUniqueId?: string - /** not filled out */ - photoId?: PhotoID - cdnUrl?: string - strippedThumb?: Uint8Array - } -} - -export interface Dialog extends DbModelBase { - kind: DbObjectKind.Dialog - // driven from associated chat ID - id: DialogID - chatId: ChatID - peerUserId?: UserID - peerThreadId?: ChatID - spaceId?: SpaceID - archived?: boolean - pinned?: boolean - readMaxId?: MessageID - unreadCount?: number - unreadMark?: boolean - open?: boolean - order?: string - pinnedOrder?: string - chatListHidden?: boolean - followMode?: number - collapsedMaxId?: MessageID -} - -export type MessageDraftKey = - | `user:${UserID}` - | `chat:${ChatID}` - -export type MessageDraftPeer = - | { peerKind: "user"; peerUserId: UserID } - | { peerKind: "chat"; peerThreadId: ChatID } - -export const messageDraftKey = ( - peer: MessageDraftPeer, -): MessageDraftKey => - peer.peerKind === "user" - ? `user:${peer.peerUserId}` - : `chat:${peer.peerThreadId}` - -/** Local-only compose state, modeled after InlineKit Drafts2. */ -export interface MessageDraft - extends DbModelBase { - kind: DbObjectKind.MessageDraft - id: MessageDraftKey - peerKind: MessageDraftPeer["peerKind"] - peerUserId?: UserID - peerThreadId?: ChatID - text: string - entities?: MessageEntities - revision: number - updatedAt: number -} - -export interface Chat extends DbModelBase { - kind: DbObjectKind.Chat - id: ChatID - title?: string - spaceId?: SpaceID - description?: string - emoji?: string - isPublic?: boolean - lastMsgId?: MessageID - date?: number - createdBy?: UserID - peerUserId?: UserID - parentChatId?: ChatID - parentMessageId?: MessageID - untitled?: boolean - number?: number - canUpdateInfo?: boolean - pinnedMessageIds?: MessageID[] - /** Owner-local state for a reserved-ID create that has not completed. */ - createState?: "pending" | "failed" -} - -export type MessageKey = `${ChatID}:${MessageID}` - -export const messageKey = (chatId: ChatID, messageId: MessageID): MessageKey => - `${chatId}:${messageId}` as MessageKey - -export interface Message extends DbModelBase { - kind: DbObjectKind.Message - /** Protocol message ID. Message IDs are unique only within a chat. */ - messageId: MessageID - randomId?: bigint - fromId: UserID - peerUserId?: UserID - chatId: ChatID - message?: string - out?: boolean - date?: number - mentioned?: boolean - replyToMsgId?: MessageID - groupedId?: bigint - editDate?: number - isSticker?: boolean - hasLink?: boolean - rev?: bigint - media?: MessageMedia - attachments?: MessageAttachments - reactions?: MessageReactions - /** - * Owner-local optimistic overlays. They project to renderers but are - * deliberately stripped by persistent storage because reaction RPCs are - * not replay-safe on the current server. - */ - reactionIntents?: ReactionMutationIntent[] - entities?: MessageEntities - sendMode?: MessageSendMode - fwdFrom?: MessageFwdHeader - replies?: MessageReplies - actions?: MessageActions - serviceMessage?: MessageService - status?: MessageSendingStatus -} - -export type ReactionMutationIntent = { - id: string - emoji: string - userId: UserID - action: "add" | "delete" -} - -export enum MessageSendingStatus { - Sending = "sending", - Sent = "sent", - Failed = "failed", -} - -// export interface Photo extends DbModelBase { -// kind: DbObjectKind.Photo -// id: number -// chatId: number -// messageId: number -// photoId: number -// photo: Photo -// } - -export interface Space extends DbModelBase { - kind: DbObjectKind.Space - - id: SpaceID - - // Name of the space - name: string - - // Whether the current user is the creator of the space - creator: boolean - - // Date of creation - date: number - - isPublic?: boolean -} - -export interface SyncGlobalState - extends DbModelBase { - kind: DbObjectKind.SyncGlobalState - id: 0 - lastSyncDate: number -} - -export interface SyncBucketState - extends DbModelBase { - kind: DbObjectKind.SyncBucketState - id: string - seq: number - date: number -} - -/** - * Lossless protocol payload retained when the lean client does not yet own a - * materialized model for that durable update kind. Future model migrations - * can replay these records instead of requiring a destructive cache reset. - */ -export interface DeferredUpdate - extends DbModelBase { - kind: DbObjectKind.DeferredUpdate - id: string - bucketId: string - seq?: number - date?: number - payloadType: "Update" | "UserGroup" - updateType: string - /** - * Denormalized resident-object key used for selective replay. A deferred - * message update must never require hydrating the complete deferred log. - */ - targetKey?: string - payload: Uint8Array -} - -export type PendingTransactionStatus = "pending" | "failed" - -export interface PendingTransaction - extends DbModelBase { - kind: DbObjectKind.PendingTransaction - id: string - type: string - /** - * Optional for rows written before replay policies were recorded. Legacy - * rows are still restricted by the transaction decoder's replay-safe - * allowlist. - */ - replayPolicy?: "idempotent" - context: unknown - createdAt: number - status: PendingTransactionStatus -} - -/** Persisted owner-only pool entry matching InlineKit ReservedChatID. */ -export interface ReservedChatID - extends DbModelBase { - kind: DbObjectKind.ReservedChatID - id: ChatID - chatId: ChatID - /** Protocol seconds since Unix epoch. */ - expiresAt: number - /** Local milliseconds since Unix epoch, used for FIFO consumption. */ - createdAt: number -} -import type { - ChatID, - DialogID, - MessageID, - PhotoID, - SpaceID, - UserID, -} from "@inline/ids" -import type { - MessageActions, - MessageAttachments, - MessageEntities, - MessageFwdHeader, - MessageMedia, - MessageReactions, - MessageReplies, - MessageSendMode, - MessageService, -} from "@inline-chat/protocol/core" diff --git a/landing/packages/client/src/database/react.tsx b/landing/packages/client/src/database/react.tsx deleted file mode 100644 index 5067c2f6a7..0000000000 --- a/landing/packages/client/src/database/react.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { useCallback, useMemo, useSyncExternalStore } from "react" -import { useClientDb } from "../react/InlineClientContext" -import { DbModels, DbObjectKind } from "./models" -import { type DbObjectId, DbObjectRef, DbQueryPlanType } from "./types" - -const defaultPredicate = () => true - -/** Get a stable ref for a given kind and id. Returns undefined if id is undefined. */ -export function useObjectRef( - kind: K, - id: DbObjectId | undefined, -): DbObjectRef | undefined { - const db = useClientDb() - return useMemo(() => (id !== undefined ? db.ref(kind, id) : undefined), [kind, id]) -} - -/** Subscribe to a single object by ref. Returns the object or undefined if not found. */ -export function useObject( - ref: DbObjectRef | undefined, -): O | undefined { - const db = useClientDb() - const subscribe = useCallback( - (onStoreChange: () => void) => { - if (!ref) return () => {} - const { unsubscribe } = db.subscribeToObject(ref, onStoreChange) - return unsubscribe - }, - [ref], - ) - - const getSnapshot = useCallback(() => { - if (!ref) return undefined - return db.get(ref) - }, [ref]) - - return useSyncExternalStore(subscribe, getSnapshot, getSnapshot) -} - -/** Subscribe to a query that returns objects. */ -export function useQueryObjects( - kind: K, - predicate: (object: O) => boolean = defaultPredicate, -): O[] { - const db = useClientDb() - const key = useMemo(() => `query:${kind}:objects:${predicate.toString()}`, [kind, predicate]) - - const subscribe = useCallback( - (onStoreChange: () => void) => { - const { unsubscribe } = db.subscribeToQuery(key, DbQueryPlanType.Objects, kind, predicate, onStoreChange) - return unsubscribe - }, - [key, kind], - ) - - const getSnapshot = useCallback(() => { - return db.queryCached(key, DbQueryPlanType.Objects, kind, predicate) - }, [key, kind, predicate]) - - return useSyncExternalStore(subscribe, getSnapshot, getSnapshot) -} - -/** Subscribe to a query that returns refs. */ -export function useQueryRefs( - kind: K, - predicate: (object: O) => boolean = defaultPredicate, -): DbObjectRef[] { - const db = useClientDb() - const key = useMemo(() => `query:${kind}:refs:${predicate.toString()}`, [kind, predicate]) - - const subscribe = useCallback( - (onStoreChange: () => void) => { - const { unsubscribe } = db.subscribeToQuery(key, DbQueryPlanType.Refs, kind, predicate, onStoreChange) - return unsubscribe - }, - [key, kind, predicate], - ) - - const getSnapshot = useCallback(() => { - return db.queryCached(key, DbQueryPlanType.Refs, kind, predicate) - }, [key, kind, predicate]) - - return useSyncExternalStore(subscribe, getSnapshot, getSnapshot) -} diff --git a/landing/packages/client/src/database/replica-import.ts b/landing/packages/client/src/database/replica-import.ts deleted file mode 100644 index c4da8bb314..0000000000 --- a/landing/packages/client/src/database/replica-import.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { - DbObjectKind, - type DbModel, -} from "./models" -import type { InlinePersistenceStore } from "./persistence" - -export const INLINE_INDEXED_DB_IMPORT_MARKER = - "legacy-indexeddb-v6-to-sqlite-v1" -export const INLINE_SQLITE_AUTHORITY_MARKER = - "sqlite-authoritative-v1" - -/** - * Cursors are copied last. A partially imported SQLite file is never selected, - * but this order also keeps an interrupted file conservative when inspected. - */ -export const INLINE_REPLICA_IMPORT_KINDS = [ - DbObjectKind.User, - DbObjectKind.Space, - DbObjectKind.Chat, - DbObjectKind.Dialog, - DbObjectKind.Message, - DbObjectKind.DeferredUpdate, - DbObjectKind.PendingTransaction, - DbObjectKind.ReservedChatID, - DbObjectKind.MessageDraft, - DbObjectKind.SyncBucketState, - DbObjectKind.SyncGlobalState, -] as const - -export type InlineReplicaImportProgress = { - kind: DbObjectKind - importedForKind: number - importedTotal: number -} - -export type InlineReplicaImportResult = { - status: "imported" | "already-imported" - importedTotal: number - importedByKind: Partial> -} - -export class InlineReplicaImportError extends Error { - constructor(message: string, options?: ErrorOptions) { - super(message, options) - this.name = "InlineReplicaImportError" - } -} - -export class InlinePersistenceReplicaPromotedError extends Error { - constructor() { - super( - "Inline IndexedDB fallback is stale because SQLite is authoritative", - ) - this.name = "InlinePersistenceReplicaPromotedError" - } -} - -type InlineReplicaMetadataStore = InlinePersistenceStore & Required< - Pick< - InlinePersistenceStore, - "getReplicaMetadata" | "setReplicaMetadata" - > -> - -const requireReplicaMetadata: ( - store: InlinePersistenceStore, -) => asserts store is InlineReplicaMetadataStore = (store) => { - if (!store.getReplicaMetadata || !store.setReplicaMetadata) { - throw new InlineReplicaImportError( - "Inline replica store does not support cutover metadata", - ) - } -} - -export const assertInlineLegacyFallbackAllowed = async ( - store: InlinePersistenceStore, -): Promise => { - requireReplicaMetadata(store) - if ( - await store.getReplicaMetadata( - INLINE_SQLITE_AUTHORITY_MARKER, - ) === "complete" - ) { - throw new InlinePersistenceReplicaPromotedError() - } -} - -export const importIndexedDbReplicaIntoSqlite = async (options: { - source: InlinePersistenceStore - target: InlineReplicaMetadataStore - batchSize?: number - onProgress?: (progress: InlineReplicaImportProgress) => void -}): Promise => { - const batchSize = options.batchSize ?? 500 - if (!Number.isSafeInteger(batchSize) || batchSize <= 0) { - throw new InlineReplicaImportError( - `Invalid Inline replica import batch size ${batchSize}`, - ) - } - if (!options.source.scan) { - throw new InlineReplicaImportError( - "Inline replica import source does not support bounded scans", - ) - } - requireReplicaMetadata(options.source) - - await options.target.open() - if ( - await options.target.getReplicaMetadata( - INLINE_INDEXED_DB_IMPORT_MARKER, - ) === "complete" - ) { - await options.source.open() - try { - // Backfill the authority fence for stores imported before the fence was - // introduced, and repair it if browser data was partially restored. - await options.source.setReplicaMetadata( - INLINE_SQLITE_AUTHORITY_MARKER, - "complete", - ) - return { - status: "already-imported", - importedTotal: 0, - importedByKind: {}, - } - } finally { - await options.source.close() - } - } - - const importedByKind: Partial> = {} - let importedTotal = 0 - await options.source.open() - try { - for (const kind of INLINE_REPLICA_IMPORT_KINDS) { - let afterId: DbModel["id"] | undefined - let done = false - let importedForKind = 0 - while (!done) { - const page = await options.source.scan( - kind, - afterId as never, - batchSize, - ) - if (page.objects.length > batchSize) { - throw new InlineReplicaImportError( - `Inline ${kind} import page exceeded its batch size`, - ) - } - if (!page.done && page.nextId === undefined) { - throw new InlineReplicaImportError( - `Inline ${kind} import page omitted its continuation`, - ) - } - if (page.objects.length === 0 && !page.done) { - throw new InlineReplicaImportError( - `Inline ${kind} import made no progress`, - ) - } - - if (page.objects.length > 0) { - await options.target.write( - page.objects.map((object) => ({ - type: "put" as const, - object, - })), - ) - importedForKind += page.objects.length - importedTotal += page.objects.length - importedByKind[kind] = importedForKind - options.onProgress?.({ - kind, - importedForKind, - importedTotal, - }) - } - afterId = page.nextId - done = page.done - } - } - - // Fence the old replica first. A crash between these writes may replay the - // idempotent import, but can never expose stale IndexedDB as a fallback. - await options.source.setReplicaMetadata( - INLINE_SQLITE_AUTHORITY_MARKER, - "complete", - ) - await options.target.setReplicaMetadata( - INLINE_INDEXED_DB_IMPORT_MARKER, - "complete", - ) - return { status: "imported", importedTotal, importedByKind } - } catch (cause) { - throw cause instanceof InlineReplicaImportError - ? cause - : new InlineReplicaImportError( - "Inline IndexedDB replica import failed", - { cause }, - ) - } finally { - await options.source.close() - } -} diff --git a/landing/packages/client/src/database/sqlite/openers.ts b/landing/packages/client/src/database/sqlite/openers.ts deleted file mode 100644 index c713671e5a..0000000000 --- a/landing/packages/client/src/database/sqlite/openers.ts +++ /dev/null @@ -1,136 +0,0 @@ -import type { - Database, - SAHPoolUtil, - Sqlite3Static, -} from "@sqlite.org/sqlite-wasm" -import type { UserID } from "@inline/ids" -import { - SQLitePersistenceStore, - type SQLitePersistenceStoreOptions, -} from "./SQLitePersistenceStore" - -let sqlitePromise: Promise | null = null -let sahPoolPromise: Promise | null = null - -const sqlite = () => { - if (!sqlitePromise) { - sqlitePromise = import("@sqlite.org/sqlite-wasm").then( - ({ default: initialize }) => initialize(), - ) - } - return sqlitePromise -} - -export type InlineSqliteUnavailableReason = - | "worker-required" - | "opfs-unsupported" - | "opfs-permission-denied" - | "wasm-initialization-failed" - | "opfs-initialization-failed" - -export class InlineSqliteUnavailableError extends Error { - constructor( - readonly reason: InlineSqliteUnavailableReason, - options?: ErrorOptions, - ) { - super(`Inline SQLite persistence unavailable: ${reason}`, options) - this.name = "InlineSqliteUnavailableError" - } -} - -export const isInlineSqliteStartupFallbackSafe = ( - error: unknown, -): error is InlineSqliteUnavailableError => - error instanceof InlineSqliteUnavailableError && - (error.reason === "worker-required" || - error.reason === "opfs-unsupported" || - error.reason === "opfs-permission-denied") - -const hasOpfsSyncAccessHandles = () => { - const scope = globalThis as typeof globalThis & { - FileSystemHandle?: unknown - FileSystemDirectoryHandle?: unknown - FileSystemFileHandle?: { - prototype?: { createSyncAccessHandle?: unknown } - } - } - return ( - !!scope.FileSystemHandle && - !!scope.FileSystemDirectoryHandle && - !!scope.FileSystemFileHandle && - typeof scope.FileSystemFileHandle.prototype - ?.createSyncAccessHandle === "function" && - typeof navigator !== "undefined" && - typeof navigator.storage?.getDirectory === "function" - ) -} - -const isStoragePermissionDenied = (error: unknown) => - typeof DOMException !== "undefined" && - error instanceof DOMException && - (error.name === "SecurityError" || - error.name === "NotAllowedError") - -const sqliteForWorker = async () => { - if (typeof document !== "undefined") { - throw new InlineSqliteUnavailableError("worker-required") - } - if (!hasOpfsSyncAccessHandles()) { - throw new InlineSqliteUnavailableError("opfs-unsupported") - } - try { - return await sqlite() - } catch (cause) { - throw new InlineSqliteUnavailableError( - "wasm-initialization-failed", - { cause }, - ) - } -} - -const sahPool = async () => { - if (!sahPoolPromise) { - sahPoolPromise = sqliteForWorker().then(async (sqlite3) => { - try { - return await sqlite3.installOpfsSAHPoolVfs({ - name: "inline-opfs-sahpool-v1", - directory: ".inline-sqlite-v1", - initialCapacity: 6, - }) - } catch (cause) { - throw new InlineSqliteUnavailableError( - isStoragePermissionDenied(cause) - ? "opfs-permission-denied" - : "opfs-initialization-failed", - { cause }, - ) - } - }) - } - return sahPoolPromise -} - -export const createSqliteMemoryPersistenceStore = ( - options?: SQLitePersistenceStoreOptions, -) => - new SQLitePersistenceStore( - async (): Promise => { - const sqlite3 = await sqlite() - return new sqlite3.oo1.DB(":memory:", "c") - }, - options, - ) - -export const createOpfsSqlitePersistenceStore = ( - accountId: UserID, - options?: SQLitePersistenceStoreOptions, -) => { - const filename = `/user-${accountId}.sqlite3` - return new SQLitePersistenceStore( - async () => { - const pool = await sahPool() - return new pool.OpfsSAHPoolDb(filename) - }, - options, - ) -} diff --git a/landing/packages/client/src/database/sqlite/schema.ts b/landing/packages/client/src/database/sqlite/schema.ts deleted file mode 100644 index 5c1909efe9..0000000000 --- a/landing/packages/client/src/database/sqlite/schema.ts +++ /dev/null @@ -1,215 +0,0 @@ -import type { Database } from "@sqlite.org/sqlite-wasm" - -export const INLINE_SQLITE_SCHEMA_VERSION = 2 - -type InlineSqliteMigration = { - version: number - name: string - sql: string -} - -const migrations: readonly InlineSqliteMigration[] = [ - { - version: 1, - name: "initial_inline_replica", - sql: ` - CREATE TABLE user ( - id INTEGER PRIMARY KEY, - payload BLOB NOT NULL - ); - - CREATE TABLE space ( - id INTEGER PRIMARY KEY, - date INTEGER NOT NULL, - payload BLOB NOT NULL - ); - - CREATE TABLE chat ( - id INTEGER PRIMARY KEY, - space_id INTEGER, - last_message_id INTEGER, - date INTEGER, - payload BLOB NOT NULL - ); - CREATE INDEX chat_space_date_idx - ON chat(space_id, date DESC, id DESC); - - CREATE TABLE dialog ( - id INTEGER PRIMARY KEY, - chat_id INTEGER NOT NULL, - space_id INTEGER, - is_open INTEGER NOT NULL DEFAULT 0, - is_pinned INTEGER NOT NULL DEFAULT 0, - is_archived INTEGER NOT NULL DEFAULT 0, - is_chat_list_hidden INTEGER NOT NULL DEFAULT 0, - sidebar_order TEXT, - pinned_order TEXT, - payload BLOB NOT NULL - ); - CREATE UNIQUE INDEX dialog_chat_id_idx ON dialog(chat_id); - CREATE INDEX dialog_inbox_idx ON dialog( - is_archived, - is_chat_list_hidden, - is_open, - is_pinned, - pinned_order, - sidebar_order - ); - - CREATE TABLE message ( - chat_id INTEGER NOT NULL, - message_id INTEGER NOT NULL, - date_order INTEGER NOT NULL, - payload BLOB NOT NULL, - PRIMARY KEY(chat_id, message_id) - ) WITHOUT ROWID; - CREATE INDEX message_chat_window_idx - ON message(chat_id, date_order, message_id); - - CREATE TABLE sync_global_state ( - id INTEGER PRIMARY KEY CHECK(id = 0), - last_sync_date INTEGER NOT NULL, - payload BLOB NOT NULL - ); - - CREATE TABLE sync_bucket_state ( - id TEXT PRIMARY KEY, - seq INTEGER NOT NULL, - date INTEGER NOT NULL, - payload BLOB NOT NULL - ) WITHOUT ROWID; - - CREATE TABLE deferred_update ( - id TEXT PRIMARY KEY, - bucket_id TEXT NOT NULL, - target_key TEXT, - seq INTEGER, - date INTEGER, - payload BLOB NOT NULL - ) WITHOUT ROWID; - CREATE INDEX deferred_update_target_idx - ON deferred_update(target_key, seq, date, id) - WHERE target_key IS NOT NULL; - CREATE INDEX deferred_update_bucket_idx - ON deferred_update(bucket_id, seq, date, id); - - CREATE TABLE pending_transaction ( - id TEXT PRIMARY KEY, - transaction_type TEXT NOT NULL, - status TEXT NOT NULL, - created_at INTEGER NOT NULL, - payload BLOB NOT NULL - ) WITHOUT ROWID; - CREATE INDEX pending_transaction_created_idx - ON pending_transaction(status, created_at, id); - - CREATE TABLE reserved_chat_id ( - chat_id INTEGER PRIMARY KEY, - expires_at INTEGER NOT NULL, - created_at INTEGER NOT NULL, - payload BLOB NOT NULL - ); - CREATE INDEX reserved_chat_id_expiry_idx - ON reserved_chat_id(expires_at, created_at, chat_id); - - CREATE TABLE message_draft ( - id TEXT PRIMARY KEY, - peer_kind TEXT NOT NULL, - peer_user_id INTEGER, - peer_thread_id INTEGER, - revision INTEGER NOT NULL, - updated_at INTEGER NOT NULL, - payload BLOB NOT NULL, - CHECK( - (peer_kind = 'user' AND peer_user_id IS NOT NULL AND peer_thread_id IS NULL) - OR - (peer_kind = 'chat' AND peer_user_id IS NULL AND peer_thread_id IS NOT NULL) - ) - ) WITHOUT ROWID; - CREATE INDEX message_draft_updated_idx - ON message_draft(updated_at, id); - `, - }, - { - version: 2, - name: "replica_import_metadata", - sql: ` - CREATE TABLE inline_replica_metadata ( - key TEXT PRIMARY KEY, - value TEXT NOT NULL, - updated_at INTEGER NOT NULL - ) WITHOUT ROWID; - `, - }, -] - -const migrationTableSql = ` - CREATE TABLE IF NOT EXISTS inline_schema_migration ( - version INTEGER PRIMARY KEY, - name TEXT NOT NULL UNIQUE, - applied_at INTEGER NOT NULL - ); -` - -const currentVersion = (db: Database): number => { - const rows = db.exec({ - sql: "SELECT COALESCE(MAX(version), 0) AS version FROM inline_schema_migration", - rowMode: "object", - returnValue: "resultRows", - }) - const version = rows[0]?.version - if (typeof version === "bigint") return Number(version) - return typeof version === "number" ? version : 0 -} - -export class InlineSqliteMigrationError extends Error { - constructor( - readonly migration: string, - cause: unknown, - ) { - super(`Inline SQLite migration failed: ${migration}`, { cause }) - this.name = "InlineSqliteMigrationError" - } -} - -export const migrateInlineSqlite = (db: Database): number => { - db.exec("PRAGMA foreign_keys = ON") - db.exec("PRAGMA trusted_schema = OFF") - db.exec("PRAGMA temp_store = MEMORY") - db.exec("PRAGMA synchronous = FULL") - db.exec(migrationTableSql) - - let version = currentVersion(db) - if (version > INLINE_SQLITE_SCHEMA_VERSION) { - throw new InlineSqliteMigrationError( - `database version ${version} is newer than supported ${INLINE_SQLITE_SCHEMA_VERSION}`, - undefined, - ) - } - - for (const migration of migrations) { - if (migration.version <= version) continue - db.exec("BEGIN IMMEDIATE") - try { - db.exec(migration.sql) - db.exec({ - sql: ` - INSERT INTO inline_schema_migration(version, name, applied_at) - VALUES (?, ?, ?) - `, - bind: [migration.version, migration.name, Date.now()], - }) - db.exec("COMMIT") - version = migration.version - } catch (cause) { - try { - db.exec("ROLLBACK") - } catch { - // Preserve the migration failure; SQLite may already have rolled back. - } - throw new InlineSqliteMigrationError(migration.name, cause) - } - } - - return version -} diff --git a/landing/packages/client/src/database/storage.ts b/landing/packages/client/src/database/storage.ts deleted file mode 100644 index 6ce6323c1d..0000000000 --- a/landing/packages/client/src/database/storage.ts +++ /dev/null @@ -1,1156 +0,0 @@ -import { - Update, -} from "@inline-chat/protocol/core" -import { - chatId, - dialogId, - inlineIdOrderKey, - messageId, - photoId, - spaceId, - userId, - type ChatID, - type InlineIDInput, - type MessageID, -} from "@inline/ids" -import { - DbModels, - DbObjectKind, - type Message, - messageDraftKey, - messageKey, -} from "./models" -import { - messageWindowDate, - type MessageWindowCursor, -} from "./message-window" -import type { - InlinePersistenceCollection, - InlinePersistenceOperation, - InlinePersistenceScanPage, - InlinePersistenceStore, -} from "./persistence" -import { preparePersistedModel } from "./persisted-model" - -/** @deprecated Import InlinePersistenceCollection from ./persistence. */ -export type CollectionStorage< - O extends { id: number | string }, -> = InlinePersistenceCollection -/** @deprecated Import InlinePersistenceOperation from ./persistence. */ -export type DatabaseStorageOperation = InlinePersistenceOperation -/** @deprecated Import InlinePersistenceStore from ./persistence. */ -export type DatabaseStorage = InlinePersistenceStore - -const DEFAULT_DB_NAME = "inline-client-db" -const DEFAULT_STORE_NAME = "objects" -const DEFAULT_KIND_INDEX = "kind" -const LEGACY_MESSAGE_CHAT_ID_INDEX = "message-chat-id" -const DEFAULT_MESSAGE_CHAT_WINDOW_INDEX = - "message-chat-window" -const DEFAULT_DEFERRED_TARGET_INDEX = "deferred-target-key" -const DEFAULT_REPLICA_METADATA_STORE = "replica-metadata" -const INLINE_INDEXED_DB_IDENTITY_SCHEMA_VERSION = 6 -export const INLINE_INDEXED_DB_SCHEMA_VERSION = 7 -const MIN_MESSAGE_DATE = Number.MIN_SAFE_INTEGER -const MAX_MESSAGE_DATE = Number.MAX_SAFE_INTEGER -const MIN_MESSAGE_ORDER_KEY = "00000000000000000000" -const MAX_MESSAGE_ORDER_KEY = "18446744073709551615" -const MESSAGE_ORDER_FIELD = "_messageIdOrder" -const MESSAGE_DATE_FIELD = "_messageDateOrder" - -type StoredObject = DbModels[DbObjectKind] & { - [MESSAGE_ORDER_FIELD]?: string - [MESSAGE_DATE_FIELD]?: number -} - -type UnknownRecord = Record - -const deferredMessageTargetKey = ( - payloadType: unknown, - payload: unknown, -): string | undefined => { - if (payloadType !== "Update" || !ArrayBuffer.isView(payload)) { - return undefined - } - try { - const bytes = new Uint8Array( - payload.buffer, - payload.byteOffset, - payload.byteLength, - ) - const update = Update.fromBinary(bytes) - switch (update.update.oneofKind) { - case "updateReaction": { - const reaction = update.update.updateReaction.reaction - return reaction - ? messageKey(chatId(reaction.chatId), messageId(reaction.messageId)) - : undefined - } - case "deleteReaction": - return messageKey( - chatId(update.update.deleteReaction.chatId), - messageId(update.update.deleteReaction.messageId), - ) - case "messageAttachment": { - const attachment = update.update.messageAttachment - if (attachment.chatId <= 0n || attachment.messageId <= 0n) { - return undefined - } - return messageKey( - chatId(attachment.chatId), - messageId(attachment.messageId), - ) - } - default: - return undefined - } - } catch { - return undefined - } -} - -export class IndexedDbIdentityMigrationError extends Error { - constructor(readonly field: string, readonly value: unknown) { - super(`Cannot migrate lossy Inline ID in ${field}`) - this.name = "IndexedDbIdentityMigrationError" - } -} - -const idInput = (value: unknown, field: string): InlineIDInput => { - if ( - typeof value !== "string" && - typeof value !== "number" && - typeof value !== "bigint" - ) { - throw new IndexedDbIdentityMigrationError(field, value) - } - return value -} - -const requiredId = ( - value: unknown, - field: string, - convert: (input: InlineIDInput) => T, -): T => { - try { - return convert(idInput(value, field)) - } catch (error) { - if (error instanceof IndexedDbIdentityMigrationError) throw error - throw new IndexedDbIdentityMigrationError(field, value) - } -} - -const optionalId = ( - value: unknown, - field: string, - convert: (input: InlineIDInput) => T, -): T | undefined => - value == null ? undefined : requiredId(value, field, convert) - -const optionalIds = ( - value: unknown, - field: string, - convert: (input: InlineIDInput) => T, -): T[] | undefined => { - if (value == null) return undefined - if (!Array.isArray(value)) { - throw new IndexedDbIdentityMigrationError(field, value) - } - return value.map((item, index) => - requiredId(item, `${field}[${index}]`, convert), - ) -} - -const migratePendingContext = ( - type: unknown, - value: unknown, -): unknown => { - if (!value || typeof value !== "object") return value - const context = { ...(value as UnknownRecord) } - - switch (type) { - case "send_message": - context.chatId = requiredId(context.chatId, "transaction.chatId", chatId) - context.replyToMsgId = optionalId( - context.replyToMsgId, - "transaction.replyToMsgId", - messageId, - ) - context.temporaryMessageId = optionalId( - context.temporaryMessageId, - "transaction.temporaryMessageId", - messageId, - ) - return context - case "read_messages": - context.maxId = optionalId( - context.maxId, - "transaction.maxId", - messageId, - ) - return context - case "pin_message": - context.messageId = requiredId( - context.messageId, - "transaction.messageId", - messageId, - ) - context.previousPinnedMessageIds = - context.previousPinnedMessageIds === null - ? null - : optionalIds( - context.previousPinnedMessageIds, - "transaction.previousPinnedMessageIds", - messageId, - ) - context.optimisticPinnedMessageIds = optionalIds( - context.optimisticPinnedMessageIds, - "transaction.optimisticPinnedMessageIds", - messageId, - ) - return context - default: - return context - } -} - -/** - * Converts pre-v4 rows to the canonical web domain representation. Unsafe - * JavaScript numbers abort the upgrade; silently rounding an Inline ID would - * corrupt cache identity and is never an acceptable recovery strategy. - */ -export const migrateStoredIdentity = (input: unknown): StoredObject => { - if (!input || typeof input !== "object") { - throw new IndexedDbIdentityMigrationError("object", input) - } - const value = { ...(input as UnknownRecord) } - - switch (value.kind) { - case DbObjectKind.User: - value.id = requiredId(value.id, "user.id", userId) - if (value.profilePhoto && typeof value.profilePhoto === "object") { - const profilePhoto = { - ...(value.profilePhoto as UnknownRecord), - } - profilePhoto.photoId = optionalId( - profilePhoto.photoId, - "user.profilePhoto.photoId", - photoId, - ) - value.profilePhoto = profilePhoto - } - break - case DbObjectKind.Dialog: - value.id = requiredId(value.id, "dialog.id", dialogId) - value.chatId = requiredId(value.chatId, "dialog.chatId", chatId) - value.peerUserId = optionalId( - value.peerUserId, - "dialog.peerUserId", - userId, - ) - value.peerThreadId = optionalId( - value.peerThreadId, - "dialog.peerThreadId", - chatId, - ) - value.spaceId = optionalId(value.spaceId, "dialog.spaceId", spaceId) - value.readMaxId = optionalId( - value.readMaxId, - "dialog.readMaxId", - messageId, - ) - break - case DbObjectKind.Chat: - value.id = requiredId(value.id, "chat.id", chatId) - value.spaceId = optionalId(value.spaceId, "chat.spaceId", spaceId) - value.lastMsgId = optionalId( - value.lastMsgId, - "chat.lastMsgId", - messageId, - ) - value.createdBy = optionalId(value.createdBy, "chat.createdBy", userId) - value.peerUserId = optionalId( - value.peerUserId, - "chat.peerUserId", - userId, - ) - value.parentChatId = optionalId( - value.parentChatId, - "chat.parentChatId", - chatId, - ) - value.parentMessageId = optionalId( - value.parentMessageId, - "chat.parentMessageId", - messageId, - ) - value.pinnedMessageIds = optionalIds( - value.pinnedMessageIds, - "chat.pinnedMessageIds", - messageId, - ) - break - case DbObjectKind.ReservedChatID: - value.id = requiredId( - value.id, - "reservedChatID.id", - chatId, - ) - value.chatId = requiredId( - value.chatId, - "reservedChatID.chatId", - chatId, - ) - if ( - value.id !== value.chatId || - typeof value.expiresAt !== "number" || - !Number.isSafeInteger(value.expiresAt) || - typeof value.createdAt !== "number" || - !Number.isSafeInteger(value.createdAt) - ) { - throw new IndexedDbIdentityMigrationError( - "reservedChatID", - value, - ) - } - break - case DbObjectKind.Message: { - const legacyId = - value.messageId ?? - (typeof value.id === "number" || typeof value.id === "bigint" - ? value.id - : undefined) - const exactChatId = requiredId(value.chatId, "message.chatId", chatId) - const exactMessageId = requiredId( - legacyId, - "message.messageId", - messageId, - ) - value.chatId = exactChatId - value.messageId = exactMessageId - value.id = messageKey(exactChatId, exactMessageId) - value.fromId = requiredId(value.fromId, "message.fromId", userId) - value.peerUserId = optionalId( - value.peerUserId, - "message.peerUserId", - userId, - ) - value.replyToMsgId = optionalId( - value.replyToMsgId, - "message.replyToMsgId", - messageId, - ) - value[MESSAGE_ORDER_FIELD] = inlineIdOrderKey(exactMessageId) - value[MESSAGE_DATE_FIELD] = messageWindowDate( - typeof value.date === "number" ? value.date : undefined, - ) - break - } - case DbObjectKind.Space: - value.id = requiredId(value.id, "space.id", spaceId) - break - case DbObjectKind.MessageDraft: { - const peerUserId = optionalId( - value.peerUserId, - "draft.peerUserId", - userId, - ) - const peerThreadId = optionalId( - value.peerThreadId, - "draft.peerThreadId", - chatId, - ) - if (value.peerKind === "user" && peerUserId != null) { - value.peerUserId = peerUserId - value.peerThreadId = undefined - value.id = messageDraftKey({ - peerKind: "user", - peerUserId, - }) - } else if ( - value.peerKind === "chat" && - peerThreadId != null - ) { - value.peerUserId = undefined - value.peerThreadId = peerThreadId - value.id = messageDraftKey({ - peerKind: "chat", - peerThreadId, - }) - } else { - throw new IndexedDbIdentityMigrationError( - "draft.peer", - value, - ) - } - break - } - case DbObjectKind.PendingTransaction: - if (typeof value.id !== "string") { - throw new IndexedDbIdentityMigrationError("transaction.id", value.id) - } - value.context = migratePendingContext(value.type, value.context) - break - case DbObjectKind.SyncGlobalState: - if (value.id !== 0) { - throw new IndexedDbIdentityMigrationError("syncGlobal.id", value.id) - } - break - case DbObjectKind.SyncBucketState: - if (typeof value.id !== "string") { - throw new IndexedDbIdentityMigrationError("syncBucket.id", value.id) - } - break - case DbObjectKind.DeferredUpdate: - if ( - typeof value.id !== "string" || - typeof value.bucketId !== "string" || - (value.payloadType !== "Update" && - value.payloadType !== "UserGroup") || - typeof value.updateType !== "string" || - !ArrayBuffer.isView(value.payload) - ) { - throw new IndexedDbIdentityMigrationError( - "deferredUpdate", - value, - ) - } - value.payload = new Uint8Array( - value.payload.buffer, - value.payload.byteOffset, - value.payload.byteLength, - ) - value.targetKey = - typeof value.targetKey === "string" - ? value.targetKey - : deferredMessageTargetKey( - value.payloadType, - value.payload, - ) - break - default: - throw new IndexedDbIdentityMigrationError("kind", value.kind) - } - - return value as unknown as StoredObject -} - -const encodeStoredObject = ( - object: O, -): StoredObject => { - if (object.kind !== DbObjectKind.Message) return object - const persistedMessage = preparePersistedModel(object) - return { - ...persistedMessage, - [MESSAGE_ORDER_FIELD]: inlineIdOrderKey(object.messageId), - [MESSAGE_DATE_FIELD]: messageWindowDate(object.date), - } as StoredObject -} - -const decodeStoredObject = (value: unknown): O | undefined => { - if (!value || typeof value !== "object") return undefined - const { - [MESSAGE_ORDER_FIELD]: _messageOrder, - [MESSAGE_DATE_FIELD]: _messageDate, - ...object - } = value as UnknownRecord - return object as O -} - -class IndexedDbStorage implements CollectionStorage { - private dbPromise: Promise | null = null - - constructor( - private kind: K, - private dbName: string = DEFAULT_DB_NAME, - private storeName: string = DEFAULT_STORE_NAME, - private kindIndex: string = DEFAULT_KIND_INDEX, - private messageChatWindowIndex: string = - DEFAULT_MESSAGE_CHAT_WINDOW_INDEX, - private deferredTargetIndex: string = - DEFAULT_DEFERRED_TARGET_INDEX, - ) {} - - async init(): Promise { - await this.open() - } - - async get(id: O["id"]): Promise { - const stored = await this.read((store) => store.get([this.kind, id])) - return decodeStoredObject(stored) - } - - async getMany(ids: O["id"][]): Promise { - if (ids.length === 0) return [] - const db = await this.open() - - return await new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readonly") - const store = transaction.objectStore(this.storeName) - const objects: O[] = [] - - for (const id of ids) { - const request = store.get([this.kind, id]) - request.onsuccess = () => { - const object = decodeStoredObject(request.result) - if (object) objects.push(object) - } - request.onerror = () => reject(request.error) - } - - transaction.oncomplete = () => resolve(objects) - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - async getAll(): Promise { - const values = await this.read((store) => - store.index(this.kindIndex).getAll(this.kind), - ) - return (values as unknown[]) - .map((value) => decodeStoredObject(value)) - .filter((value): value is O => value != null) - } - - async getDeferredUpdatesByTargetKeys( - targetKeys: string[], - ): Promise { - if ( - this.kind !== DbObjectKind.DeferredUpdate || - targetKeys.length === 0 - ) { - return [] - } - const db = await this.open() - return await new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readonly") - const index = transaction - .objectStore(this.storeName) - .index(this.deferredTargetIndex) - const objects: O[] = [] - - for (const targetKey of new Set(targetKeys)) { - const request = index.getAll([ - DbObjectKind.DeferredUpdate, - targetKey, - ]) - request.onsuccess = () => { - for (const value of request.result as unknown[]) { - const object = decodeStoredObject(value) - if (object) objects.push(object) - } - } - request.onerror = () => transaction.abort() - } - - transaction.oncomplete = () => resolve(objects) - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - async getMessageWindowByChatId( - chatId: ChatID, - limit: number, - before?: MessageWindowCursor, - after?: MessageWindowCursor, - ): Promise { - if ( - this.kind !== DbObjectKind.Message || - limit <= 0 || - (before != null && after != null) - ) { - return [] - } - - const range = IDBKeyRange.bound( - [ - this.kind, - chatId, - after?.date ?? MIN_MESSAGE_DATE, - after == null - ? MIN_MESSAGE_ORDER_KEY - : inlineIdOrderKey(after.messageId), - ], - [ - this.kind, - chatId, - before?.date ?? MAX_MESSAGE_DATE, - before == null - ? MAX_MESSAGE_ORDER_KEY - : inlineIdOrderKey(before.messageId), - ], - after != null, - before != null, - ) - const db = await this.open() - - return await new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readonly") - const store = transaction.objectStore(this.storeName) - const request = store - .index(this.messageChatWindowIndex) - .openCursor(range, after == null ? "prev" : "next") - const objects: O[] = [] - - request.onsuccess = () => { - const cursor = request.result - if (!cursor || objects.length >= limit) { - resolve(after == null ? objects.reverse() : objects) - return - } - const object = decodeStoredObject(cursor.value) - if (object) objects.push(object) - cursor.continue() - } - request.onerror = () => reject(request.error) - }) - } - - async getMessageWindowAroundMessageId( - chatId: ChatID, - anchorMessageId: MessageID, - beforeLimit: number, - afterLimit: number, - ): Promise { - if ( - this.kind !== DbObjectKind.Message || - beforeLimit < 0 || - afterLimit < 0 - ) { - return [] - } - - const db = await this.open() - return await new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readonly") - const store = transaction.objectStore(this.storeName) - const index = store.index(this.messageChatWindowIndex) - const targetRequest = store.get([ - this.kind, - messageKey(chatId, anchorMessageId), - ]) - const olderOrTarget: O[] = [] - const newer: O[] = [] - let targetFound = false - - targetRequest.onsuccess = () => { - const target = decodeStoredObject(targetRequest.result) - if (!target) return - targetFound = true - const targetMessage = target as unknown as Message - const anchorKey = [ - this.kind, - chatId, - messageWindowDate(targetMessage.date), - inlineIdOrderKey(targetMessage.messageId), - ] - - const olderRequest = index.openCursor( - IDBKeyRange.bound( - [ - this.kind, - chatId, - MIN_MESSAGE_DATE, - MIN_MESSAGE_ORDER_KEY, - ], - anchorKey, - ), - "prev", - ) - olderRequest.onsuccess = () => { - const cursor = olderRequest.result - if (!cursor || olderOrTarget.length >= beforeLimit + 1) return - const object = decodeStoredObject(cursor.value) - if (object) olderOrTarget.push(object) - cursor.continue() - } - olderRequest.onerror = () => transaction.abort() - - if (afterLimit > 0) { - const newerRequest = index.openCursor( - IDBKeyRange.bound( - anchorKey, - [ - this.kind, - chatId, - MAX_MESSAGE_DATE, - MAX_MESSAGE_ORDER_KEY, - ], - true, - ), - "next", - ) - newerRequest.onsuccess = () => { - const cursor = newerRequest.result - if (!cursor || newer.length >= afterLimit) return - const object = decodeStoredObject(cursor.value) - if (object) newer.push(object) - cursor.continue() - } - newerRequest.onerror = () => transaction.abort() - } - } - targetRequest.onerror = () => transaction.abort() - transaction.oncomplete = () => - resolve( - targetFound - ? olderOrTarget.reverse().concat(newer) - : [], - ) - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - async put(object: O): Promise { - await this.write((store) => { - store.put(encodeStoredObject(object)) - }) - } - - async delete(id: O["id"]): Promise { - await this.write((store) => { - store.delete([this.kind, id]) - }) - } - - async deleteAllByChatId(chatId: ChatID): Promise { - if (this.kind !== DbObjectKind.Message) return - - const range = IDBKeyRange.bound( - [ - this.kind, - chatId, - MIN_MESSAGE_DATE, - MIN_MESSAGE_ORDER_KEY, - ], - [ - this.kind, - chatId, - MAX_MESSAGE_DATE, - MAX_MESSAGE_ORDER_KEY, - ], - ) - const db = await this.open() - - await new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readwrite") - const store = transaction.objectStore(this.storeName) - const request = store - .index(this.messageChatWindowIndex) - .openCursor(range) - - request.onsuccess = () => { - const cursor = request.result - if (!cursor) return - cursor.delete() - cursor.continue() - } - request.onerror = () => reject(request.error) - transaction.oncomplete = () => resolve() - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - private open(): Promise { - if (!this.dbPromise) { - this.dbPromise = new Promise((resolve, reject) => { - const request = indexedDB.open( - this.dbName, - INLINE_INDEXED_DB_SCHEMA_VERSION, - ) - let settled = false - let upgradeError: unknown - request.onupgradeneeded = (event) => { - const db = request.result - if ( - !db.objectStoreNames.contains( - DEFAULT_REPLICA_METADATA_STORE, - ) - ) { - db.createObjectStore(DEFAULT_REPLICA_METADATA_STORE, { - keyPath: "key", - }) - } - let store: IDBObjectStore - if (!db.objectStoreNames.contains(this.storeName)) { - store = db.createObjectStore(this.storeName, { keyPath: ["kind", "id"] }) - } else { - store = request.transaction!.objectStore(this.storeName) - } - if (!store.indexNames.contains(this.kindIndex)) { - store.createIndex(this.kindIndex, "kind", { unique: false }) - } - if ( - !store.indexNames.contains(this.deferredTargetIndex) - ) { - store.createIndex( - this.deferredTargetIndex, - ["kind", "targetKey"], - { unique: false }, - ) - } - if (event.oldVersion < INLINE_INDEXED_DB_IDENTITY_SCHEMA_VERSION) { - if ( - store.indexNames.contains( - LEGACY_MESSAGE_CHAT_ID_INDEX, - ) - ) { - store.deleteIndex(LEGACY_MESSAGE_CHAT_ID_INDEX) - } - if ( - store.indexNames.contains( - this.messageChatWindowIndex, - ) - ) { - store.deleteIndex(this.messageChatWindowIndex) - } - store.createIndex( - this.messageChatWindowIndex, - [ - "kind", - "chatId", - MESSAGE_DATE_FIELD, - MESSAGE_ORDER_FIELD, - ], - { unique: false }, - ) - - const legacyObjects = store.openCursor() - legacyObjects.onsuccess = () => { - const cursor = legacyObjects.result - if (!cursor) return - try { - const previous = cursor.value as UnknownRecord - const migrated = migrateStoredIdentity(previous) - const previousKey = cursor.primaryKey as [unknown, unknown] - if ( - previousKey[0] === migrated.kind && - previousKey[1] === migrated.id - ) { - cursor.update(migrated) - } else { - cursor.delete() - store.put(migrated) - } - cursor.continue() - } catch (error) { - upgradeError = error - request.transaction?.abort() - } - } - } else if ( - !store.indexNames.contains( - this.messageChatWindowIndex, - ) - ) { - store.createIndex( - this.messageChatWindowIndex, - [ - "kind", - "chatId", - MESSAGE_DATE_FIELD, - MESSAGE_ORDER_FIELD, - ], - { unique: false }, - ) - } - } - request.onsuccess = () => { - if (settled) { - request.result.close() - return - } - settled = true - request.result.onversionchange = () => request.result.close() - resolve(request.result) - } - request.onerror = () => { - if (settled) return - settled = true - reject(upgradeError ?? request.error) - } - request.onblocked = () => { - if (settled) return - settled = true - reject(new Error(`IndexedDB upgrade blocked for ${this.dbName}`)) - } - }) - } - return this.dbPromise - } - - database(): Promise { - return this.open() - } - - async close(): Promise { - const promise = this.dbPromise - this.dbPromise = null - if (!promise) return - const database = await promise.catch(() => undefined) - database?.close() - } - - private async read(fn: (store: IDBObjectStore) => IDBRequest): Promise { - const db = await this.open() - return new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readonly") - const store = transaction.objectStore(this.storeName) - const request = fn(store) - request.onsuccess = () => resolve(request.result) - request.onerror = () => reject(request.error) - }) - } - - private async write(fn: (store: IDBObjectStore) => void): Promise { - const db = await this.open() - return new Promise((resolve, reject) => { - const transaction = db.transaction(this.storeName, "readwrite") - const store = transaction.objectStore(this.storeName) - fn(store) - transaction.oncomplete = () => resolve() - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } -} - -class IndexedDbPersistenceStore implements InlinePersistenceStore { - private readonly storageByKind = new Map< - DbObjectKind, - IndexedDbStorage - >() - private readonly batchStorage: IndexedDbStorage< - DbObjectKind.User, - DbModels[DbObjectKind.User] - > - - constructor(private readonly dbName: string) { - this.batchStorage = new IndexedDbStorage( - DbObjectKind.User, - this.dbName, - ) - } - - async open(): Promise { - await this.batchStorage.init() - } - - collection( - kind: K, - ): CollectionStorage { - let storage = this.storageByKind.get(kind) - if (!storage) { - storage = new IndexedDbStorage( - kind, - this.dbName, - ) as IndexedDbStorage< - DbObjectKind, - DbModels[DbObjectKind] - > - this.storageByKind.set(kind, storage) - } - return storage as unknown as CollectionStorage - } - - async write( - operations: readonly InlinePersistenceOperation[], - ): Promise { - if (operations.length === 0) return - const database = await this.batchStorage.database() - - await new Promise((resolve, reject) => { - const transaction = database.transaction( - DEFAULT_STORE_NAME, - "readwrite", - ) - const store = transaction.objectStore(DEFAULT_STORE_NAME) - const messageIndex = store.index( - DEFAULT_MESSAGE_CHAT_WINDOW_INDEX, - ) - - try { - for (const operation of operations) { - switch (operation.type) { - case "put": - store.put(encodeStoredObject(operation.object)) - break - case "delete": - store.delete([operation.kind, operation.id]) - break - case "deleteMessagesByChat": { - const range = IDBKeyRange.bound( - [ - DbObjectKind.Message, - operation.chatId, - MIN_MESSAGE_DATE, - MIN_MESSAGE_ORDER_KEY, - ], - [ - DbObjectKind.Message, - operation.chatId, - MAX_MESSAGE_DATE, - MAX_MESSAGE_ORDER_KEY, - ], - ) - const request = messageIndex.openCursor(range) - request.onsuccess = () => { - const cursor = request.result - if (!cursor) return - cursor.delete() - cursor.continue() - } - request.onerror = () => transaction.abort() - break - } - } - } - } catch (error) { - transaction.abort() - reject(error) - } - - transaction.oncomplete = () => resolve() - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - async scan( - kind: K, - afterId: DbModels[K]["id"] | undefined, - limit: number, - ): Promise> { - if (!Number.isSafeInteger(limit) || limit <= 0) { - return { objects: [], done: true } - } - const database = await this.batchStorage.database() - return new Promise((resolve, reject) => { - const transaction = database.transaction( - DEFAULT_STORE_NAME, - "readonly", - ) - const store = transaction.objectStore(DEFAULT_STORE_NAME) - const lower = afterId === undefined - ? [kind] - : [kind, afterId] - const range = IDBKeyRange.bound( - lower, - [kind, []], - afterId !== undefined, - ) - const request = store.openCursor(range) - const objects: DbModels[K][] = [] - let hasMore = false - - request.onsuccess = () => { - const cursor = request.result - if (!cursor) return - if (objects.length === limit) { - hasMore = true - return - } - const object = decodeStoredObject(cursor.value) - if (object) objects.push(object) - cursor.continue() - } - request.onerror = () => reject(request.error) - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - transaction.oncomplete = () => { - resolve({ - objects, - nextId: hasMore ? objects.at(-1)?.id : undefined, - done: !hasMore, - }) - } - }) - } - - async getReplicaMetadata(key: string): Promise { - const database = await this.batchStorage.database() - return new Promise((resolve, reject) => { - const transaction = database.transaction( - DEFAULT_REPLICA_METADATA_STORE, - "readonly", - ) - const request = transaction - .objectStore(DEFAULT_REPLICA_METADATA_STORE) - .get(key) - request.onsuccess = () => { - const value = request.result as - | { key?: unknown; value?: unknown } - | undefined - resolve( - typeof value?.value === "string" - ? value.value - : undefined, - ) - } - request.onerror = () => reject(request.error) - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - async setReplicaMetadata(key: string, value: string): Promise { - const database = await this.batchStorage.database() - await new Promise((resolve, reject) => { - const transaction = database.transaction( - DEFAULT_REPLICA_METADATA_STORE, - "readwrite", - ) - transaction.objectStore(DEFAULT_REPLICA_METADATA_STORE).put({ - key, - value, - updatedAt: Date.now(), - }) - transaction.oncomplete = () => resolve() - transaction.onerror = () => reject(transaction.error) - transaction.onabort = () => reject(transaction.error) - }) - } - - async close(): Promise { - const storages = new Set([ - this.batchStorage, - ...this.storageByKind.values(), - ]) - await Promise.all( - Array.from(storages, (storage) => storage.close()), - ) - } -} - -const supportsIndexedDb = () => typeof indexedDB !== "undefined" && typeof indexedDB.open === "function" - -export const createIndexedDbPersistenceStore = ( - namespace?: string, -): InlinePersistenceStore | null => { - if (!supportsIndexedDb()) return null - const dbName = namespace - ? `${DEFAULT_DB_NAME}:${namespace}` - : DEFAULT_DB_NAME - return new IndexedDbPersistenceStore(dbName) -} - -/** @deprecated Use the explicit IndexedDB adapter factory. */ -export const createDatabaseStorage = - createIndexedDbPersistenceStore - -const createCollectionStorage = ( - kind: K, - namespace?: string, -): CollectionStorage | null => { - if (supportsIndexedDb()) { - const dbName = namespace ? `${DEFAULT_DB_NAME}:${namespace}` : DEFAULT_DB_NAME - return new IndexedDbStorage(kind, dbName) - } - return null -} - -export { createCollectionStorage } diff --git a/landing/packages/client/src/index.ts b/landing/packages/client/src/index.ts deleted file mode 100644 index 6e76981349..0000000000 --- a/landing/packages/client/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./core" -export * from "./database/react" -export * from "./react" diff --git a/landing/packages/client/src/react/InlineClientContext.tsx b/landing/packages/client/src/react/InlineClientContext.tsx deleted file mode 100644 index 42c953fc6e..0000000000 --- a/landing/packages/client/src/react/InlineClientContext.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { createContext, type ReactNode, useContext } from "react" -import type { AuthStore } from "../auth" -import type { InlineClientContextValue } from "../client" -import type { Db } from "../database" -import type { RealtimeService } from "../realtime" - -const InlineClientContext = - createContext(null) - -export function InlineClientProvider({ - children, - value, -}: { - children: ReactNode - value: InlineClientContextValue -}) { - return ( - - {children} - - ) -} - -export function useInlineClient(): InlineClientContextValue { - const client = useContext(InlineClientContext) - if (!client) { - throw new Error( - "useInlineClient must be used within InlineClientProvider", - ) - } - return client -} - -export function useRealtimeClient(): RealtimeService { - return useInlineClient().realtime -} - -export function useClientDb(): Db { - return useInlineClient().db -} - -export function useAuthStore(): AuthStore { - return useInlineClient().auth -} diff --git a/landing/packages/client/src/react/index.tsx b/landing/packages/client/src/react/index.tsx deleted file mode 100644 index c8b22043a8..0000000000 --- a/landing/packages/client/src/react/index.tsx +++ /dev/null @@ -1,145 +0,0 @@ -import { useEffect, useRef, useState, useSyncExternalStore } from "react" -import { - useAuthActions as useAuthActionsBase, - useAuthState as useAuthStateBase, - useCurrentUserId as useCurrentUserIdBase, - useHasHydrated as useHasHydratedBase, - useIsLoggedIn as useIsLoggedInBase, - useToken as useTokenBase, -} from "@inline/auth/react" -import type { UserID } from "@inline/ids" -import type { AuthState } from "../auth" -import type { InlineClientContextValue } from "../client" -import type { Db } from "../database" -import type { RealtimeConnectionState } from "../realtime" -import { useAuthStore, useClientDb, useRealtimeClient } from "./InlineClientContext" - -export type { InlineClientContextValue } from "../client" -export { - InlineClientProvider, - useAuthStore, - useClientDb, - useInlineClient, - useRealtimeClient, -} from "./InlineClientContext" - -export type InlineClientProviderOptions = { - value: InlineClientContextValue - autoConnect?: boolean -} - -export type InlineClientProviderState = { - value: InlineClientContextValue - hasDbHydrated: boolean -} - -export function useInlineClientProvider({ - value, - autoConnect = true, -}: InlineClientProviderOptions): InlineClientProviderState { - const reconnectRef = useRef(value) - reconnectRef.current = value - - useEffect(() => { - if (!autoConnect) return - - const syncConnection = () => { - const next = reconnectRef.current - if (next.auth.isLoggedIn()) { - void next.realtime.start() - } else { - void next.realtime.stop() - } - } - - syncConnection() - const unsubscribe = value.auth.subscribe(syncConnection) - return unsubscribe - }, [value, autoConnect]) - - const hasDbHydrated = useDbHasHydrated(value.db) - - return { value, hasDbHydrated } -} - -export function useDbHasHydrated(db?: Db): boolean { - const resolvedDb = db ?? useClientDb() - const reactLog = resolvedDb.logger.withScope("React") - const [hydrated, setHydrated] = useState(resolvedDb.hasHydrated) - - useEffect(() => { - let active = true - if (resolvedDb.hasHydrated) { - if (resolvedDb.hydrationState === "pending") { - reactLog.error("storage.hydration.invalid_state", { - hydrationState: resolvedDb.hydrationState, - }) - } - if (resolvedDb.hydrationState === "failed") { - reactLog.error("storage.hydration.failed", { - hydrationState: resolvedDb.hydrationState, - }) - } - reactLog.debug("storage.hydration.already_ready") - setHydrated(true) - return () => { - active = false - } - } - - void resolvedDb.ready.then(() => { - if (resolvedDb.hydrationState === "failed") { - reactLog.error("storage.hydration.failed", { - hydrationState: resolvedDb.hydrationState, - }) - } - reactLog.debug("storage.hydration.ready") - if (active) setHydrated(true) - }) - - return () => { - active = false - } - }, [resolvedDb]) - - return hydrated -} - -export function useAuthState(): AuthState { - const auth = useAuthStore() - return useAuthStateBase(auth) -} - -export function useIsLoggedIn(): boolean { - const auth = useAuthStore() - return useIsLoggedInBase(auth) -} - -export function useToken(): string | null { - const auth = useAuthStore() - return useTokenBase(auth) -} - -export function useCurrentUserId(): UserID | null { - const auth = useAuthStore() - return useCurrentUserIdBase(auth) -} - -export function useHasHydrated(): boolean { - const auth = useAuthStore() - return useHasHydratedBase(auth) -} - -export function useAuthActions() { - const auth = useAuthStore() - return useAuthActionsBase(auth) -} - -export function useConnectionState(): RealtimeConnectionState { - const realtime = useRealtimeClient() - return useSyncExternalStore( - (listener) => realtime.onConnectionState(() => listener()), - () => realtime.connectionState, - () => realtime.connectionState, - ) -} diff --git a/landing/packages/client/src/react/useQuery.tsx b/landing/packages/client/src/react/useQuery.tsx deleted file mode 100644 index f4fe52f749..0000000000 --- a/landing/packages/client/src/react/useQuery.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { useEffect, useRef } from "react" -import { useInlineClient } from "./index" -import { Transaction } from "../realtime" - -type UseQueryOptions = { - dependencies?: unknown[] -} - -function dependenciesAreEqual(a: unknown[] | null | undefined, b: unknown[] | null | undefined) { - if (a == null && b != null) return false - if (a != null && b == null) return false - if (a == null && b == null) return true - - return (a ?? []).every((value, index) => value === b?.[index]) -} - -export const useQuery = (query: Transaction, options: UseQueryOptions = {}) => { - const client = useInlineClient() - const queryLog = client.db.logger.withScope("React.Query") - - const state = useRef<{ - initial: boolean - inFlight: boolean - dependencies: unknown[] | null - }>({ initial: true, inFlight: false, dependencies: null }) - - useEffect(() => { - // Check dependencies have changed - if (!state.current.initial && dependenciesAreEqual(state.current.dependencies, options.dependencies)) return - state.current.initial = false - state.current.dependencies = options.dependencies ?? [] - state.current.inFlight = true - - queryLog.debug("query.started", { method: query.method }) - client.realtime - .query(query) - .catch((error: unknown) => { - queryLog.warn("query.failed", { - method: query.method, - error, - }) - }) - .finally(() => { - queryLog.debug("query.finished", { method: query.method }) - state.current.inFlight = false - }) - }, [client.realtime, query.method, ...(options.dependencies ?? [])]) -} diff --git a/landing/packages/client/src/realtime/client/ping-pong.ts b/landing/packages/client/src/realtime/client/ping-pong.ts deleted file mode 100644 index f5f8f60031..0000000000 --- a/landing/packages/client/src/realtime/client/ping-pong.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { Log } from "@inline/log" -import type { ProtocolClient } from "./protocol-client" - -export class PingPongService { - private readonly log: Log - private client: ProtocolClient | null = null - private onTimeout: (() => void) | null = null - private running = false - private sleepTimer: ReturnType | null = null - private sleepResolver: (() => void) | null = null - - private pings = new Map() - private recentLatenciesMs: number[] = [] - - constructor(logger?: Log) { - this.log = logger ?? new Log("RealtimeV2.PingPongService", "info") - } - - configure(client: ProtocolClient, onTimeout: () => void) { - this.client = client - this.onTimeout = onTimeout - } - - start() { - if (this.running) return - this.log.debug("ping_pong.started", {}) - this.running = true - this.reset() - void this.loop() - } - - stop() { - this.log.debug("ping_pong.stopped", {}) - this.running = false - this.clearSleep() - this.reset() - } - - async ping() { - const client = this.client - if (!client) return - if (client.state !== "open") return - - const nonce = this.randomNonce() - this.log.debug("ping_pong.ping.sent", {}) - await client.sendPing(nonce) - this.pings.set(nonce, Date.now()) - } - - pong(nonce: bigint) { - this.log.debug("ping_pong.pong.received", {}) - const pingDate = this.pings.get(nonce) - if (!pingDate) { - this.log.trace("ping_pong.pong.unmatched", { - pendingCount: this.pings.size, - }) - return - } - - this.pings.delete(nonce) - this.recordLatency(pingDate) - this.log.debug("ping_pong.latency.updated", { - averageMs: this.avgLatencyMs(), - }) - } - - private async loop() { - while (this.running) { - await this.checkConnection() - - const delay = this.getNextPingDelayMs() - await this.sleep(delay) - if (!this.running) break - - await this.ping() - } - } - - private reset() { - this.pings.clear() - this.recentLatenciesMs = [] - } - - private getNextPingDelayMs() { - const averageMs = this.avgLatencyMs() - if (averageMs > 2000) { - this.log.debug("ping_pong.latency.high", { - averageMs, - nextIntervalMs: 25_000, - }) - return 25_000 - } - return 10_000 - } - - private async checkConnection() { - const client = this.client - if (!client) return - if (client.state !== "open") return - - const now = Date.now() - const hasTimedOutPing = [...this.pings.values()].some((timestamp) => now - timestamp > 30_000) - if (!hasTimedOutPing) return - - this.onTimeout?.() - this.pings.clear() - } - - private recordLatency(pingDateMs: number) { - const latency = Date.now() - pingDateMs - this.recentLatenciesMs.push(latency) - if (this.recentLatenciesMs.length > 10) { - this.recentLatenciesMs.shift() - } - } - - private avgLatencyMs() { - if (this.recentLatenciesMs.length === 0) return 0 - const sum = this.recentLatenciesMs.reduce((acc, value) => acc + value, 0) - return Math.round(sum / this.recentLatenciesMs.length) - } - - private async sleep(ms: number) { - if (ms <= 0) return - await new Promise((resolve) => { - this.sleepResolver = resolve - this.sleepTimer = setTimeout(() => { - this.sleepTimer = null - this.sleepResolver = null - resolve() - }, ms) - }) - } - - private clearSleep() { - if (this.sleepTimer) { - clearTimeout(this.sleepTimer) - this.sleepTimer = null - } - if (this.sleepResolver) { - this.sleepResolver() - this.sleepResolver = null - } - } - - private randomNonce(): bigint { - if (typeof crypto !== "undefined" && "getRandomValues" in crypto) { - const buffer = new Uint32Array(2) - crypto.getRandomValues(buffer) - return (BigInt(buffer[0] ?? 0) << 32n) | BigInt(buffer[1] ?? 0) - } - - return BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)) - } -} diff --git a/landing/packages/client/src/realtime/transactions/get-chats.ts b/landing/packages/client/src/realtime/transactions/get-chats.ts deleted file mode 100644 index af2eedc272..0000000000 --- a/landing/packages/client/src/realtime/transactions/get-chats.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { GetChatsInput, Method, type RpcResult } from "@inline-chat/protocol/core" -import type { Db } from "../../database" -import { Query } from "./transaction" -import type { Transaction } from "./transaction" -import { upsertChat, upsertDialog, upsertMessage, upsertSpace, upsertUser } from "./mappers" - -export type GetChatsContext = {} - -export class GetChatsTransaction implements Transaction { - readonly method = Method.GET_CHATS - readonly kind = Query() - readonly context: GetChatsContext = {} - - input(_context: GetChatsContext): { oneofKind: "getChats"; getChats: GetChatsInput } { - return { oneofKind: "getChats", getChats: GetChatsInput.create() } - } - - apply(result: RpcResult["result"] | undefined, db: Db) { - if (!result || result.oneofKind !== "getChats") { - throw new Error("invalid") - } - - const payload = result.getChats - - db.batch(() => { - for (const user of payload.users) { - upsertUser(db, user) - } - - for (const chat of payload.chats) { - upsertChat(db, chat) - } - - for (const dialog of payload.dialogs) { - upsertDialog(db, dialog) - } - - for (const space of payload.spaces) { - upsertSpace(db, space) - } - - for (const message of payload.messages) { - upsertMessage(db, message) - } - }) - } -} - -export const getChats = () => new GetChatsTransaction() diff --git a/landing/packages/ids/tsconfig.json b/landing/packages/ids/tsconfig.json deleted file mode 100644 index e15038a18c..0000000000 --- a/landing/packages/ids/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "composite": true, - "rootDir": ".", - "noUncheckedIndexedAccess": false - }, - "include": ["src", "vitest.config.ts"] -} diff --git a/landing/packages/protocol/src/__tests__/message-nudge.test.ts b/landing/packages/protocol/src/__tests__/message-nudge.test.ts deleted file mode 100644 index 9f7ec08a88..0000000000 --- a/landing/packages/protocol/src/__tests__/message-nudge.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { describe, expect, it } from "vitest" -import { Message } from "../core" -import type { Peer } from "../core" - -const peer: Peer = { - type: { - oneofKind: "user", - user: { userId: 42n }, - }, -} - -describe("Message nudge serialization", () => { - it("round-trips nudge media", () => { - const message = Message.create({ - id: 1n, - fromId: 42n, - peerId: peer, - chatId: 10n, - out: true, - date: 100n, - media: { - media: { - oneofKind: "nudge", - nudge: {}, - }, - }, - }) - - const encoded = Message.toBinary(message) - const decoded = Message.fromBinary(encoded) - - const decodedMedia = decoded.media?.media - expect(decodedMedia?.oneofKind).toBe("nudge") - - if (!decodedMedia || decodedMedia.oneofKind !== "nudge") { - throw new Error("Expected decoded message media to be a nudge") - } - - expect(decodedMedia.nudge).toBeDefined() - }) -}) diff --git a/landing/packages/protocol/src/client.ts b/landing/packages/protocol/src/client.ts deleted file mode 100644 index b3a859cb1c..0000000000 --- a/landing/packages/protocol/src/client.ts +++ /dev/null @@ -1,92 +0,0 @@ -// @generated by protobuf-ts 2.9.4 -// @generated from protobuf file "client.proto" (package "client", syntax proto3) -// tslint:disable -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -import { RpcCall } from "./core"; -/** - * @generated from protobuf message client.Transaction - */ -export interface Transaction { - /** - * @generated from protobuf field: string id = 1; - */ - id: string; - /** - * @generated from protobuf field: int64 date = 2; - */ - date: bigint; - /** - * @generated from protobuf field: RpcCall call = 3; - */ - call?: RpcCall; -} -// @generated message type with reflection information, may provide speed optimized methods -class Transaction$Type extends MessageType { - constructor() { - super("client.Transaction", [ - { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "call", kind: "message", T: () => RpcCall } - ]); - } - create(value?: PartialMessage): Transaction { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = ""; - message.date = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Transaction): Transaction { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string id */ 1: - message.id = reader.string(); - break; - case /* int64 date */ 2: - message.date = reader.int64().toBigInt(); - break; - case /* RpcCall call */ 3: - message.call = RpcCall.internalBinaryRead(reader, reader.uint32(), options, message.call); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Transaction, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string id = 1; */ - if (message.id !== "") - writer.tag(1, WireType.LengthDelimited).string(message.id); - /* int64 date = 2; */ - if (message.date !== 0n) - writer.tag(2, WireType.Varint).int64(message.date); - /* RpcCall call = 3; */ - if (message.call) - RpcCall.internalBinaryWrite(message.call, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message client.Transaction - */ -export const Transaction = new Transaction$Type(); diff --git a/landing/packages/protocol/src/core.ts b/landing/packages/protocol/src/core.ts deleted file mode 100644 index b434ac5108..0000000000 --- a/landing/packages/protocol/src/core.ts +++ /dev/null @@ -1,14784 +0,0 @@ -// @generated by protobuf-ts 2.9.4 -// @generated from protobuf file "core.proto" (syntax proto3) -// tslint:disable -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -// --- Protocol Messages --- - -/** - * @generated from protobuf message ClientMessage - */ -export interface ClientMessage { - /** - * @generated from protobuf field: uint64 id = 1; - */ - id: bigint; - /** - * @generated from protobuf field: uint32 seq = 2; - */ - seq: number; - /** - * @generated from protobuf oneof: body - */ - body: { - oneofKind: "connectionInit"; - /** - * @generated from protobuf field: ConnectionInit connection_init = 4; - */ - connectionInit: ConnectionInit; - } | { - oneofKind: "rpcCall"; - /** - * @generated from protobuf field: RpcCall rpc_call = 5; - */ - rpcCall: RpcCall; - } | { - oneofKind: "ack"; - /** - * @generated from protobuf field: Ack ack = 6; - */ - ack: Ack; - } | { - oneofKind: "ping"; - /** - * @generated from protobuf field: Ping ping = 7; - */ - ping: Ping; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message ConnectionInit - */ -export interface ConnectionInit { - /** - * @generated from protobuf field: string token = 1; - */ - token: string; - /** - * Build number of the client app - * - * @generated from protobuf field: optional int32 build_number = 2; - */ - buildNumber?: number; - /** - * API layer, for specific API differentiation - * - * @generated from protobuf field: optional uint32 layer = 3; - */ - layer?: number; - /** - * Client version (semver) - * - * @generated from protobuf field: optional string client_version = 4; - */ - clientVersion?: string; -} -/** - * @generated from protobuf message ServerProtocolMessage - */ -export interface ServerProtocolMessage { - /** - * @generated from protobuf field: uint64 id = 1; - */ - id: bigint; - /** - * @generated from protobuf oneof: body - */ - body: { - oneofKind: "connectionOpen"; - /** - * @generated from protobuf field: ConnectionOpen connection_open = 4; - */ - connectionOpen: ConnectionOpen; - } | { - oneofKind: "rpcResult"; - /** - * @generated from protobuf field: RpcResult rpc_result = 5; - */ - rpcResult: RpcResult; - } | { - oneofKind: "rpcError"; - /** - * @generated from protobuf field: RpcError rpc_error = 6; - */ - rpcError: RpcError; - } | { - oneofKind: "message"; - /** - * @generated from protobuf field: ServerMessage message = 7; - */ - message: ServerMessage; - } | { - oneofKind: "ack"; - /** - * @generated from protobuf field: Ack ack = 8; - */ - ack: Ack; - } | { - oneofKind: "pong"; - /** - * @generated from protobuf field: Pong pong = 9; - */ - pong: Pong; - } | { - oneofKind: "connectionError"; - /** - * @generated from protobuf field: ConnectionError connection_error = 10; - */ - connectionError: ConnectionError; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message ServerMessage - */ -export interface ServerMessage { - /** - * @generated from protobuf oneof: payload - */ - payload: { - oneofKind: "update"; - /** - * @generated from protobuf field: UpdatesPayload update = 4; - */ - update: UpdatesPayload; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message UpdatesPayload - */ -export interface UpdatesPayload { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message Ack - */ -export interface Ack { - /** - * @generated from protobuf field: uint64 msg_id = 1; - */ - msgId: bigint; -} -/** - * @generated from protobuf message ConnectionOpen - */ -export interface ConnectionOpen { -} -/** - * @generated from protobuf message ConnectionError - */ -export interface ConnectionError { -} -/** - * @generated from protobuf message Ping - */ -export interface Ping { - /** - * @generated from protobuf field: uint64 nonce = 1; - */ - nonce: bigint; -} -/** - * @generated from protobuf message Pong - */ -export interface Pong { - /** - * @generated from protobuf field: uint64 nonce = 1; - */ - nonce: bigint; -} -// --- Application Types --- - -/** - * @generated from protobuf message InputPeer - */ -export interface InputPeer { - /** - * @generated from protobuf oneof: type - */ - type: { - oneofKind: "self"; - /** - * @generated from protobuf field: InputPeerSelf self = 2; - */ - self: InputPeerSelf; - } | { - oneofKind: "chat"; - /** - * @generated from protobuf field: InputPeerChat chat = 3; - */ - chat: InputPeerChat; - } | { - oneofKind: "user"; - /** - * @generated from protobuf field: InputPeerUser user = 4; - */ - user: InputPeerUser; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message InputPeerSelf - */ -export interface InputPeerSelf { -} -/** - * @generated from protobuf message InputPeerChat - */ -export interface InputPeerChat { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; -} -/** - * @generated from protobuf message InputPeerUser - */ -export interface InputPeerUser { - /** - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; -} -/** - * @generated from protobuf message Peer - */ -export interface Peer { - /** - * @generated from protobuf oneof: type - */ - type: { - oneofKind: "chat"; - /** - * @generated from protobuf field: PeerChat chat = 2; - */ - chat: PeerChat; - } | { - oneofKind: "user"; - /** - * @generated from protobuf field: PeerUser user = 3; - */ - user: PeerUser; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message PeerChat - */ -export interface PeerChat { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; -} -/** - * @generated from protobuf message PeerUser - */ -export interface PeerUser { - /** - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; -} -/** - * @generated from protobuf message User - */ -export interface User { - /** - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * @generated from protobuf field: optional string first_name = 2; - */ - firstName?: string; - /** - * @generated from protobuf field: optional string last_name = 3; - */ - lastName?: string; - /** - * @generated from protobuf field: optional string username = 4; - */ - username?: string; - /** - * @generated from protobuf field: optional string phone_number = 5; - */ - phoneNumber?: string; - /** - * @generated from protobuf field: optional string email = 6; - */ - email?: string; - /** - * If true, certain fields such as email or phone_number will be missing - * - * @generated from protobuf field: optional bool min = 7; - */ - min?: boolean; - /** - * @generated from protobuf field: optional UserStatus status = 8; - */ - status?: UserStatus; - /** - * @generated from protobuf field: optional UserProfilePhoto profile_photo = 9; - */ - profilePhoto?: UserProfilePhoto; - // Last message ID - // optional int64 last_msg_id = 10; - - /** - * If true, the user has not completed the setup process - * - * @generated from protobuf field: optional bool pending_setup = 11; - */ - pendingSetup?: boolean; - /** - * @generated from protobuf field: optional string time_zone = 12; - */ - timeZone?: string; - /** - * @generated from protobuf field: optional bool bot = 13; - */ - bot?: boolean; -} -/** - * @generated from protobuf message UserProfilePhoto - */ -export interface UserProfilePhoto { - /** - * ID of the photo - * - * @generated from protobuf field: optional int64 photo_id = 1; - */ - photoId?: bigint; - /** - * Stripped thumbnail of the photo - * - * @generated from protobuf field: optional bytes stripped_thumb = 2; - */ - strippedThumb?: Uint8Array; - /** - * Photo - * - * @generated from protobuf field: optional string cdn_url = 3; - */ - cdnUrl?: string; - /** - * Unique identifier of the file for cache invalidation - * - * @generated from protobuf field: optional string file_unique_id = 4; - */ - fileUniqueId?: string; -} -/** - * @generated from protobuf message Dialog - */ -export interface Dialog { - /** - * @generated from protobuf field: Peer peer = 1; - */ - peer?: Peer; - /** - * @generated from protobuf field: optional int64 space_id = 2; - */ - spaceId?: bigint; - /** - * @generated from protobuf field: optional bool archived = 3; - */ - archived?: boolean; - /** - * @generated from protobuf field: optional bool pinned = 4; - */ - pinned?: boolean; - /** - * @generated from protobuf field: optional int64 read_max_id = 5; - */ - readMaxId?: bigint; - /** - * @generated from protobuf field: optional int32 unread_count = 6; - */ - unreadCount?: number; - /** - * @generated from protobuf field: optional int64 chat_id = 7; - */ - chatId?: bigint; - /** - * @generated from protobuf field: optional bool unread_mark = 8; - */ - unreadMark?: boolean; -} -/** - * A thread - * - * @generated from protobuf message Chat - */ -export interface Chat { - /** - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * Title - * - * @generated from protobuf field: string title = 2; - */ - title: string; - /** - * If it belongs to a space - * - * @generated from protobuf field: optional int64 space_id = 3; - */ - spaceId?: bigint; - /** - * Optional description - * - * @generated from protobuf field: optional string description = 4; - */ - description?: string; - /** - * Emoji to show as the icon, can be null - * - * @generated from protobuf field: optional string emoji = 5; - */ - emoji?: string; - /** - * If true, everyone in parent space can accces it - * - * @generated from protobuf field: optional bool is_public = 6; - */ - isPublic?: boolean; - /** - * Last message ID - * - * @generated from protobuf field: optional int64 last_msg_id = 7; - */ - lastMsgId?: bigint; - /** - * ID of the peer that this chat belongs to - * - * @generated from protobuf field: Peer peer_id = 8; - */ - peerId?: Peer; - /** - * Date of creation - * - * @generated from protobuf field: optional int64 date = 9; - */ - date?: bigint; - /** - * Creator user ID - * - * @generated from protobuf field: optional int64 created_by = 10; - */ - createdBy?: bigint; -} -/** - * @generated from protobuf message Message - */ -export interface Message { - /** - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * User ID of the sender - * - * @generated from protobuf field: int64 from_id = 2; - */ - fromId: bigint; - /** - * Peer ID of the recipient - * - * @generated from protobuf field: Peer peer_id = 3; - */ - peerId?: Peer; - /** - * The "chat ID" of the message, for messages in a chat (deprecated) - * - * @generated from protobuf field: int64 chat_id = 4; - */ - chatId: bigint; - /** - * Message text - * - * @generated from protobuf field: optional string message = 5; - */ - message?: string; - /** - * Whether the message is outgoing - * - * @generated from protobuf field: bool out = 6; - */ - out: boolean; - /** - * Date of the message - * - * @generated from protobuf field: int64 date = 7; - */ - date: bigint; - /** - * Whether user is mentioned - * - * @generated from protobuf field: optional bool mentioned = 8; - */ - mentioned?: boolean; - /** - * Message ID of the message being replied to - * - * @generated from protobuf field: optional int64 reply_to_msg_id = 9; - */ - replyToMsgId?: bigint; - /** - * Media of the message - * - * @generated from protobuf field: optional MessageMedia media = 10; - */ - media?: MessageMedia; - /** - * Date of the last edit if edited - * - * @generated from protobuf field: optional int64 edit_date = 11; - */ - editDate?: bigint; - /** - * ID of the grouped message if it's part of an album - * - * @generated from protobuf field: optional int64 grouped_id = 12; - */ - groupedId?: bigint; - /** - * Attachments of the message - * - * @generated from protobuf field: optional MessageAttachments attachments = 13; - */ - attachments?: MessageAttachments; - /** - * Reactions of the message - * - * @generated from protobuf field: optional MessageReactions reactions = 14; - */ - reactions?: MessageReactions; - /** - * Whether the message is a sticker - * - * @generated from protobuf field: optional bool is_sticker = 15; - */ - isSticker?: boolean; - /** - * @generated from protobuf field: optional bool has_link = 6000; - */ - hasLink?: boolean; - /** - * Rich text entities - * - * @generated from protobuf field: optional MessageEntities entities = 16; - */ - entities?: MessageEntities; - /** - * Send mode for this message, if any - * - * @generated from protobuf field: optional MessageSendMode send_mode = 17; - */ - sendMode?: MessageSendMode; - /** - * Forward header info - * - * @generated from protobuf field: optional MessageFwdHeader fwd_from = 18; - */ - fwdFrom?: MessageFwdHeader; -} -/** - * @generated from protobuf message MessageFwdHeader - */ -export interface MessageFwdHeader { - /** - * Original chat or user peer - * - * @generated from protobuf field: Peer from_peer_id = 1; - */ - fromPeerId?: Peer; - /** - * Original sender user ID - * - * @generated from protobuf field: int64 from_id = 2; - */ - fromId: bigint; - /** - * Original message ID - * - * @generated from protobuf field: int64 from_message_id = 3; - */ - fromMessageId: bigint; -} -/** - * @generated from protobuf message MessageEntities - */ -export interface MessageEntities { - /** - * @generated from protobuf field: repeated MessageEntity entities = 1; - */ - entities: MessageEntity[]; -} -/** - * @generated from protobuf message MessageEntity - */ -export interface MessageEntity { - /** - * @generated from protobuf field: MessageEntity.Type type = 1; - */ - type: MessageEntity_Type; - /** - * @generated from protobuf field: int64 offset = 2; - */ - offset: bigint; - /** - * @generated from protobuf field: int64 length = 3; - */ - length: bigint; - /** - * @generated from protobuf oneof: entity - */ - entity: { - oneofKind: "mention"; - /** - * @generated from protobuf field: MessageEntity.MessageEntityMention mention = 4; - */ - mention: MessageEntity_MessageEntityMention; - } | { - oneofKind: "textUrl"; - /** - * @generated from protobuf field: MessageEntity.MessageEntityTextUrl text_url = 5; - */ - textUrl: MessageEntity_MessageEntityTextUrl; - } | { - oneofKind: "pre"; - /** - * @generated from protobuf field: MessageEntity.MessageEntityPre pre = 6; - */ - pre: MessageEntity_MessageEntityPre; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message MessageEntity.MessageEntityMention - */ -export interface MessageEntity_MessageEntityMention { - /** - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; -} -/** - * @generated from protobuf message MessageEntity.MessageEntityTextUrl - */ -export interface MessageEntity_MessageEntityTextUrl { - /** - * @generated from protobuf field: string url = 1; - */ - url: string; -} -/** - * @generated from protobuf message MessageEntity.MessageEntityPre - */ -export interface MessageEntity_MessageEntityPre { - /** - * @generated from protobuf field: string language = 1; - */ - language: string; -} -/** - * @generated from protobuf enum MessageEntity.Type - */ -export enum MessageEntity_Type { - /** - * @generated from protobuf enum value: TYPE_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: TYPE_MENTION = 1; - */ - MENTION = 1, - /** - * @generated from protobuf enum value: TYPE_URL = 2; - */ - URL = 2, - /** - * @generated from protobuf enum value: TYPE_TEXT_URL = 3; - */ - TEXT_URL = 3, - /** - * @generated from protobuf enum value: TYPE_EMAIL = 4; - */ - EMAIL = 4, - /** - * @generated from protobuf enum value: TYPE_BOLD = 5; - */ - BOLD = 5, - /** - * @generated from protobuf enum value: TYPE_ITALIC = 6; - */ - ITALIC = 6, - /** - * @generated from protobuf enum value: TYPE_USERNAME_MENTION = 7; - */ - USERNAME_MENTION = 7, - /** - * @generated from protobuf enum value: TYPE_CODE = 8; - */ - CODE = 8, - /** - * @generated from protobuf enum value: TYPE_PRE = 9; - */ - PRE = 9, - /** - * @generated from protobuf enum value: TYPE_PHONE_NUMBER = 10; - */ - PHONE_NUMBER = 10 -} -/** - * @generated from protobuf message MessageReactions - */ -export interface MessageReactions { - /** - * Reactions of the message - * - * @generated from protobuf field: repeated Reaction reactions = 1; - */ - reactions: Reaction[]; -} -/** - * @generated from protobuf message Reaction - */ -export interface Reaction { - /** - * Emoji of the reaction - * - * @generated from protobuf field: string emoji = 1; - */ - emoji: string; - /** - * ID of the user who reacted - * - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; - /** - * ID of the message that this reaction is for - * - * @generated from protobuf field: int64 message_id = 3; - */ - messageId: bigint; - /** - * ID of the chat that this reaction is for - * - * @generated from protobuf field: int64 chat_id = 4; - */ - chatId: bigint; - /** - * Date of the reaction - * - * @generated from protobuf field: int64 date = 5; - */ - date: bigint; -} -/** - * @generated from protobuf message Member - */ -export interface Member { - /** - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * @generated from protobuf field: int64 space_id = 2; - */ - spaceId: bigint; - /** - * @generated from protobuf field: int64 user_id = 3; - */ - userId: bigint; - /** - * @generated from protobuf field: optional Member.Role role = 4; - */ - role?: Member_Role; - /** - * Date of joining - * - * @generated from protobuf field: int64 date = 5; - */ - date: bigint; - /** - * Whether member can access public chats in the space - * - * @generated from protobuf field: bool can_access_public_chats = 6; - */ - canAccessPublicChats: boolean; -} -/** - * @generated from protobuf enum Member.Role - */ -export enum Member_Role { - /** - * @generated from protobuf enum value: OWNER = 0; - */ - OWNER = 0, - /** - * @generated from protobuf enum value: ADMIN = 1; - */ - ADMIN = 1, - /** - * @generated from protobuf enum value: MEMBER = 2; - */ - MEMBER = 2 -} -/** - * @generated from protobuf message Space - */ -export interface Space { - /** - * ID - * - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * Name of the space - * - * @generated from protobuf field: string name = 2; - */ - name: string; - /** - * Whether the current user is the creator of the space - * - * @generated from protobuf field: bool creator = 3; - */ - creator: boolean; - /** - * Date of creation - * - * @generated from protobuf field: int64 date = 4; - */ - date: bigint; -} -/** - * Add reaction input - * - * @generated from protobuf message AddReactionInput - */ -export interface AddReactionInput { - /** - * Emoji of the reaction - * - * @generated from protobuf field: string emoji = 1; - */ - emoji: string; - /** - * ID of the message that this reaction is for - * - * @generated from protobuf field: int64 message_id = 2; - */ - messageId: bigint; - /** - * ID of the peer that this reaction is for - * - * @generated from protobuf field: InputPeer peer_id = 3; - */ - peerId?: InputPeer; -} -/** - * Add reaction result - * - * @generated from protobuf message AddReactionResult - */ -export interface AddReactionResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * Delete reaction input - * - * @generated from protobuf message DeleteReactionInput - */ -export interface DeleteReactionInput { - /** - * @generated from protobuf field: string emoji = 1; - */ - emoji: string; - /** - * @generated from protobuf field: InputPeer peer_id = 2; - */ - peerId?: InputPeer; - /** - * @generated from protobuf field: int64 message_id = 3; - */ - messageId: bigint; -} -/** - * @generated from protobuf message DeleteReactionResult - */ -export interface DeleteReactionResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message MessageAttachments - */ -export interface MessageAttachments { - /** - * @generated from protobuf field: repeated MessageAttachment attachments = 1; - */ - attachments: MessageAttachment[]; -} -/** - * @generated from protobuf message MessageAttachment - */ -export interface MessageAttachment { - /** - * ID - * - * @generated from protobuf field: int64 id = 4; - */ - id: bigint; - /** - * @generated from protobuf oneof: attachment - */ - attachment: { - oneofKind: "externalTask"; - /** - * @generated from protobuf field: MessageAttachmentExternalTask external_task = 2; - */ - externalTask: MessageAttachmentExternalTask; - } | { - oneofKind: "urlPreview"; - /** - * @generated from protobuf field: UrlPreview url_preview = 3; - */ - urlPreview: UrlPreview; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message UrlPreview - */ -export interface UrlPreview { - /** - * ID of external task in our database - * - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * URL of the link - * - * @generated from protobuf field: optional string url = 2; - */ - url?: string; - /** - * Site name of the link - * - * @generated from protobuf field: optional string site_name = 3; - */ - siteName?: string; - /** - * Title of the link - * - * @generated from protobuf field: optional string title = 4; - */ - title?: string; - /** - * Description of the link - * - * @generated from protobuf field: optional string description = 5; - */ - description?: string; - /** - * Image ID of the link - * - * @generated from protobuf field: optional Photo photo = 6; - */ - photo?: Photo; - /** - * Duration of the content - * - * @generated from protobuf field: optional int64 duration = 7; - */ - duration?: bigint; -} -/** - * @generated from protobuf message MessageAttachmentExternalTask - */ -export interface MessageAttachmentExternalTask { - /** - * ID of external task in our database - * - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * ID of the task in the external application - * - * @generated from protobuf field: string task_id = 2; - */ - taskId: string; - /** - * Application name - * - * @generated from protobuf field: string application = 3; - */ - application: string; - /** - * Title of the task/issue - * - * @generated from protobuf field: string title = 4; - */ - title: string; - /** - * Status of the task - * - * @generated from protobuf field: MessageAttachmentExternalTask.Status status = 5; - */ - status: MessageAttachmentExternalTask_Status; - /** - * Assigned user ID in Inline - * - * @generated from protobuf field: int64 assigned_user_id = 6; - */ - assignedUserId: bigint; - /** - * URL of the task/issue in the external application - * - * @generated from protobuf field: string url = 7; - */ - url: string; - /** - * Number/code of the task/issue in the external application - * - * @generated from protobuf field: string number = 8; - */ - number: string; - /** - * Date of creation/addition in Inline - * - * @generated from protobuf field: int64 date = 9; - */ - date: bigint; -} -/** - * @generated from protobuf enum MessageAttachmentExternalTask.Status - */ -export enum MessageAttachmentExternalTask_Status { - /** - * @generated from protobuf enum value: STATUS_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: STATUS_BACKLOG = 1; - */ - BACKLOG = 1, - /** - * @generated from protobuf enum value: STATUS_TODO = 2; - */ - TODO = 2, - /** - * @generated from protobuf enum value: STATUS_IN_PROGRESS = 3; - */ - IN_PROGRESS = 3, - /** - * @generated from protobuf enum value: STATUS_DONE = 4; - */ - DONE = 4, - /** - * @generated from protobuf enum value: STATUS_CANCELLED = 5; - */ - CANCELLED = 5 -} -/** - * WIP: add document, audio, video. - * - * @generated from protobuf message MessageMedia - */ -export interface MessageMedia { - /** - * @generated from protobuf oneof: media - */ - media: { - oneofKind: "photo"; - /** - * @generated from protobuf field: MessagePhoto photo = 1; - */ - photo: MessagePhoto; - } | { - oneofKind: "video"; - /** - * @generated from protobuf field: MessageVideo video = 2; - */ - video: MessageVideo; - } | { - oneofKind: "document"; - /** - * @generated from protobuf field: MessageDocument document = 3; - */ - document: MessageDocument; - } | { - oneofKind: "nudge"; - /** - * @generated from protobuf field: MessageNudge nudge = 4; - */ - nudge: MessageNudge; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message MessagePhoto - */ -export interface MessagePhoto { - /** - * @generated from protobuf field: Photo photo = 1; - */ - photo?: Photo; -} -/** - * @generated from protobuf message MessageVideo - */ -export interface MessageVideo { - /** - * @generated from protobuf field: Video video = 1; - */ - video?: Video; -} -/** - * @generated from protobuf message MessageDocument - */ -export interface MessageDocument { - /** - * @generated from protobuf field: Document document = 1; - */ - document?: Document; -} -/** - * Nudge message (empty payload) - * - * @generated from protobuf message MessageNudge - */ -export interface MessageNudge { -} -/** - * @generated from protobuf message Video - */ -export interface Video { - /** - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * Date of upload - * - * @generated from protobuf field: int64 date = 2; - */ - date: bigint; - /** - * Width of the video - * - * @generated from protobuf field: int32 w = 3; - */ - w: number; - /** - * Height of the video - * - * @generated from protobuf field: int32 h = 4; - */ - h: number; - /** - * Duration of the video in seconds - * - * @generated from protobuf field: int32 duration = 5; - */ - duration: number; - /** - * File size - * - * @generated from protobuf field: int32 size = 6; - */ - size: number; - /** - * Thumbnail of the video - * - * @generated from protobuf field: optional Photo photo = 7; - */ - photo?: Photo; - /** - * CDN URL - * - * @generated from protobuf field: optional string cdn_url = 8; - */ - cdnUrl?: string; -} -/** - * @generated from protobuf message Document - */ -export interface Document { - /** - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * Original file name - * - * @generated from protobuf field: string file_name = 2; - */ - fileName: string; - /** - * MIME type of the file - * - * @generated from protobuf field: string mime_type = 3; - */ - mimeType: string; - /** - * File size - * - * @generated from protobuf field: int32 size = 4; - */ - size: number; - /** - * CDN URL - * - * @generated from protobuf field: optional string cdn_url = 5; - */ - cdnUrl?: string; - /** - * Date of upload - * - * @generated from protobuf field: int64 date = 6; - */ - date: bigint; -} -/** - * Photo for message media, profile photo, space photo, or chat photo - * - * @generated from protobuf message Photo - */ -export interface Photo { - /** - * ID - * - * @generated from protobuf field: int64 id = 1; - */ - id: bigint; - /** - * Date of upload - * - * @generated from protobuf field: int64 date = 2; - */ - date: bigint; - /** - * @generated from protobuf field: repeated PhotoSize sizes = 3; - */ - sizes: PhotoSize[]; - /** - * Format of the photo - * - * @generated from protobuf field: Photo.Format format = 4; - */ - format: Photo_Format; - /** - * Unique identifier of the file - * - * @generated from protobuf field: optional string file_unique_id = 100; - */ - fileUniqueId?: string; -} -/** - * @generated from protobuf enum Photo.Format - */ -export enum Photo_Format { - /** - * @generated from protobuf enum value: FORMAT_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: FORMAT_JPEG = 1; - */ - JPEG = 1, - /** - * @generated from protobuf enum value: FORMAT_PNG = 2; - */ - PNG = 2 -} -/** - * @generated from protobuf message PhotoSize - */ -export interface PhotoSize { - /** - * * Thumbnail type. - * Currently supported: - * - "b" - small box 140x140 - * - "c" - medium box 320x320 - * - "d" - regular box 800x800 - * - "f" - large box 2560x2560 - * - "s" - stripped (tiny version embedded in bytes) - * - "y" - ?? - * - "x" - small cropped ?? - * - "w" - medium cropped ?? - * - "v" - ?? - * - * @generated from protobuf field: string type = 1; - */ - type: string; - /** - * Width in pixels - * - * @generated from protobuf field: int32 w = 2; - */ - w: number; - /** - * Height in pixels - * - * @generated from protobuf field: int32 h = 3; - */ - h: number; - /** - * File size - * - * @generated from protobuf field: int32 size = 4; - */ - size: number; - /** - * Bytes for stripped size used in blur thumbnails - * - * @generated from protobuf field: optional bytes bytes = 5; - */ - bytes?: Uint8Array; - /** - * CDN URL - * - * @generated from protobuf field: optional string cdn_url = 6; - */ - cdnUrl?: string; -} -// --- Application RPC Functions --- - -/** - * @generated from protobuf message RpcError - */ -export interface RpcError { - /** - * @generated from protobuf field: uint64 req_msg_id = 1; - */ - reqMsgId: bigint; - /** - * @generated from protobuf field: RpcError.Code error_code = 2; - */ - errorCode: RpcError_Code; - /** - * @generated from protobuf field: string message = 3; - */ - message: string; - /** - * @generated from protobuf field: int32 code = 4; - */ - code: number; -} -/** - * Type of error - * - * @generated from protobuf enum RpcError.Code - */ -export enum RpcError_Code { - /** - * @generated from protobuf enum value: UNKNOWN = 0; - */ - UNKNOWN = 0, - /** - * @generated from protobuf enum value: BAD_REQUEST = 1; - */ - BAD_REQUEST = 1, - /** - * @generated from protobuf enum value: UNAUTHENTICATED = 2; - */ - UNAUTHENTICATED = 2, - /** - * @generated from protobuf enum value: RATE_LIMIT = 3; - */ - RATE_LIMIT = 3, - /** - * @generated from protobuf enum value: INTERNAL_ERROR = 4; - */ - INTERNAL_ERROR = 4, - /** - * @generated from protobuf enum value: PEER_ID_INVALID = 5; - */ - PEER_ID_INVALID = 5, - /** - * @generated from protobuf enum value: MESSAGE_ID_INVALID = 6; - */ - MESSAGE_ID_INVALID = 6, - /** - * @generated from protobuf enum value: USER_ID_INVALID = 7; - */ - USER_ID_INVALID = 7, - /** - * @generated from protobuf enum value: USER_ALREADY_MEMBER = 8; - */ - USER_ALREADY_MEMBER = 8, - /** - * @generated from protobuf enum value: SPACE_ID_INVALID = 9; - */ - SPACE_ID_INVALID = 9, - /** - * @generated from protobuf enum value: CHAT_ID_INVALID = 10; - */ - CHAT_ID_INVALID = 10, - /** - * @generated from protobuf enum value: EMAIL_INVALID = 11; - */ - EMAIL_INVALID = 11, - /** - * @generated from protobuf enum value: PHONE_NUMBER_INVALID = 12; - */ - PHONE_NUMBER_INVALID = 12, - /** - * @generated from protobuf enum value: SPACE_ADMIN_REQUIRED = 13; - */ - SPACE_ADMIN_REQUIRED = 13, - /** - * @generated from protobuf enum value: SPACE_OWNER_REQUIRED = 14; - */ - SPACE_OWNER_REQUIRED = 14 -} -/** - * @generated from protobuf message RpcCall - */ -export interface RpcCall { - /** - * @generated from protobuf field: Method method = 1; - */ - method: Method; - /** - * @generated from protobuf oneof: input - */ - input: { - oneofKind: "getMe"; - /** - * @generated from protobuf field: GetMeInput getMe = 2; - */ - getMe: GetMeInput; - } | { - oneofKind: "getPeerPhoto"; - /** - * @generated from protobuf field: GetPeerPhotoInput getPeerPhoto = 3; - */ - getPeerPhoto: GetPeerPhotoInput; - } | { - oneofKind: "deleteMessages"; - /** - * @generated from protobuf field: DeleteMessagesInput deleteMessages = 4; - */ - deleteMessages: DeleteMessagesInput; - } | { - oneofKind: "sendMessage"; - /** - * @generated from protobuf field: SendMessageInput sendMessage = 5; - */ - sendMessage: SendMessageInput; - } | { - oneofKind: "getChatHistory"; - /** - * @generated from protobuf field: GetChatHistoryInput getChatHistory = 6; - */ - getChatHistory: GetChatHistoryInput; - } | { - oneofKind: "addReaction"; - /** - * @generated from protobuf field: AddReactionInput addReaction = 7; - */ - addReaction: AddReactionInput; - } | { - oneofKind: "deleteReaction"; - /** - * @generated from protobuf field: DeleteReactionInput deleteReaction = 8; - */ - deleteReaction: DeleteReactionInput; - } | { - oneofKind: "editMessage"; - /** - * @generated from protobuf field: EditMessageInput editMessage = 9; - */ - editMessage: EditMessageInput; - } | { - oneofKind: "createChat"; - /** - * @generated from protobuf field: CreateChatInput createChat = 10; - */ - createChat: CreateChatInput; - } | { - oneofKind: "getSpaceMembers"; - /** - * @generated from protobuf field: GetSpaceMembersInput getSpaceMembers = 11; - */ - getSpaceMembers: GetSpaceMembersInput; - } | { - oneofKind: "deleteChat"; - /** - * @generated from protobuf field: DeleteChatInput deleteChat = 12; - */ - deleteChat: DeleteChatInput; - } | { - oneofKind: "inviteToSpace"; - /** - * @generated from protobuf field: InviteToSpaceInput inviteToSpace = 13; - */ - inviteToSpace: InviteToSpaceInput; - } | { - oneofKind: "getChatParticipants"; - /** - * @generated from protobuf field: GetChatParticipantsInput getChatParticipants = 14; - */ - getChatParticipants: GetChatParticipantsInput; - } | { - oneofKind: "addChatParticipant"; - /** - * @generated from protobuf field: AddChatParticipantInput addChatParticipant = 15; - */ - addChatParticipant: AddChatParticipantInput; - } | { - oneofKind: "removeChatParticipant"; - /** - * @generated from protobuf field: RemoveChatParticipantInput removeChatParticipant = 16; - */ - removeChatParticipant: RemoveChatParticipantInput; - } | { - oneofKind: "translateMessages"; - /** - * @generated from protobuf field: TranslateMessagesInput translateMessages = 17; - */ - translateMessages: TranslateMessagesInput; - } | { - oneofKind: "getChats"; - /** - * @generated from protobuf field: GetChatsInput getChats = 18; - */ - getChats: GetChatsInput; - } | { - oneofKind: "updateUserSettings"; - /** - * @generated from protobuf field: UpdateUserSettingsInput updateUserSettings = 19; - */ - updateUserSettings: UpdateUserSettingsInput; - } | { - oneofKind: "getUserSettings"; - /** - * @generated from protobuf field: GetUserSettingsInput getUserSettings = 20; - */ - getUserSettings: GetUserSettingsInput; - } | { - oneofKind: "sendComposeAction"; - /** - * @generated from protobuf field: SendComposeActionInput sendComposeAction = 21; - */ - sendComposeAction: SendComposeActionInput; - } | { - oneofKind: "createBot"; - /** - * @generated from protobuf field: CreateBotInput createBot = 22; - */ - createBot: CreateBotInput; - } | { - oneofKind: "deleteMember"; - /** - * @generated from protobuf field: DeleteMemberInput deleteMember = 23; - */ - deleteMember: DeleteMemberInput; - } | { - oneofKind: "markAsUnread"; - /** - * @generated from protobuf field: MarkAsUnreadInput markAsUnread = 24; - */ - markAsUnread: MarkAsUnreadInput; - } | { - oneofKind: "getUpdatesState"; - /** - * @generated from protobuf field: GetUpdatesStateInput getUpdatesState = 25; - */ - getUpdatesState: GetUpdatesStateInput; - } | { - oneofKind: "getChat"; - /** - * @generated from protobuf field: GetChatInput getChat = 26; - */ - getChat: GetChatInput; - } | { - oneofKind: "getUpdates"; - /** - * @generated from protobuf field: GetUpdatesInput getUpdates = 27; - */ - getUpdates: GetUpdatesInput; - } | { - oneofKind: "updateMemberAccess"; - /** - * @generated from protobuf field: UpdateMemberAccessInput updateMemberAccess = 28; - */ - updateMemberAccess: UpdateMemberAccessInput; - } | { - oneofKind: "searchMessages"; - /** - * @generated from protobuf field: SearchMessagesInput searchMessages = 29; - */ - searchMessages: SearchMessagesInput; - } | { - oneofKind: "forwardMessages"; - /** - * @generated from protobuf field: ForwardMessagesInput forwardMessages = 30; - */ - forwardMessages: ForwardMessagesInput; - } | { - oneofKind: "updateChatVisibility"; - /** - * @generated from protobuf field: UpdateChatVisibilityInput updateChatVisibility = 31; - */ - updateChatVisibility: UpdateChatVisibilityInput; - } | { - oneofKind: "pinMessage"; - /** - * @generated from protobuf field: PinMessageInput pinMessage = 32; - */ - pinMessage: PinMessageInput; - } | { - oneofKind: "updateChatInfo"; - /** - * @generated from protobuf field: UpdateChatInfoInput updateChatInfo = 33; - */ - updateChatInfo: UpdateChatInfoInput; - } | { - oneofKind: "listBots"; - /** - * @generated from protobuf field: ListBotsInput listBots = 34; - */ - listBots: ListBotsInput; - } | { - oneofKind: "revealBotToken"; - /** - * @generated from protobuf field: RevealBotTokenInput revealBotToken = 35; - */ - revealBotToken: RevealBotTokenInput; - } | { - oneofKind: "moveThread"; - /** - * @generated from protobuf field: MoveThreadInput moveThread = 36; - */ - moveThread: MoveThreadInput; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message RpcResult - */ -export interface RpcResult { - /** - * @generated from protobuf field: uint64 req_msg_id = 1; - */ - reqMsgId: bigint; - /** - * @generated from protobuf oneof: result - */ - result: { - oneofKind: "getMe"; - /** - * @generated from protobuf field: GetMeResult getMe = 2; - */ - getMe: GetMeResult; - } | { - oneofKind: "getPeerPhoto"; - /** - * @generated from protobuf field: GetPeerPhotoResult getPeerPhoto = 3; - */ - getPeerPhoto: GetPeerPhotoResult; - } | { - oneofKind: "deleteMessages"; - /** - * @generated from protobuf field: DeleteMessagesResult deleteMessages = 4; - */ - deleteMessages: DeleteMessagesResult; - } | { - oneofKind: "sendMessage"; - /** - * @generated from protobuf field: SendMessageResult sendMessage = 5; - */ - sendMessage: SendMessageResult; - } | { - oneofKind: "getChatHistory"; - /** - * @generated from protobuf field: GetChatHistoryResult getChatHistory = 6; - */ - getChatHistory: GetChatHistoryResult; - } | { - oneofKind: "addReaction"; - /** - * @generated from protobuf field: AddReactionResult addReaction = 7; - */ - addReaction: AddReactionResult; - } | { - oneofKind: "deleteReaction"; - /** - * @generated from protobuf field: DeleteReactionResult deleteReaction = 8; - */ - deleteReaction: DeleteReactionResult; - } | { - oneofKind: "editMessage"; - /** - * @generated from protobuf field: EditMessageResult editMessage = 9; - */ - editMessage: EditMessageResult; - } | { - oneofKind: "createChat"; - /** - * @generated from protobuf field: CreateChatResult createChat = 10; - */ - createChat: CreateChatResult; - } | { - oneofKind: "getSpaceMembers"; - /** - * @generated from protobuf field: GetSpaceMembersResult getSpaceMembers = 11; - */ - getSpaceMembers: GetSpaceMembersResult; - } | { - oneofKind: "deleteChat"; - /** - * @generated from protobuf field: DeleteChatResult deleteChat = 12; - */ - deleteChat: DeleteChatResult; - } | { - oneofKind: "inviteToSpace"; - /** - * @generated from protobuf field: InviteToSpaceResult inviteToSpace = 13; - */ - inviteToSpace: InviteToSpaceResult; - } | { - oneofKind: "getChatParticipants"; - /** - * @generated from protobuf field: GetChatParticipantsResult getChatParticipants = 14; - */ - getChatParticipants: GetChatParticipantsResult; - } | { - oneofKind: "addChatParticipant"; - /** - * @generated from protobuf field: AddChatParticipantResult addChatParticipant = 15; - */ - addChatParticipant: AddChatParticipantResult; - } | { - oneofKind: "removeChatParticipant"; - /** - * @generated from protobuf field: RemoveChatParticipantResult removeChatParticipant = 16; - */ - removeChatParticipant: RemoveChatParticipantResult; - } | { - oneofKind: "translateMessages"; - /** - * @generated from protobuf field: TranslateMessagesResult translateMessages = 17; - */ - translateMessages: TranslateMessagesResult; - } | { - oneofKind: "getChats"; - /** - * @generated from protobuf field: GetChatsResult getChats = 18; - */ - getChats: GetChatsResult; - } | { - oneofKind: "updateUserSettings"; - /** - * @generated from protobuf field: UpdateUserSettingsResult updateUserSettings = 19; - */ - updateUserSettings: UpdateUserSettingsResult; - } | { - oneofKind: "getUserSettings"; - /** - * @generated from protobuf field: GetUserSettingsResult getUserSettings = 20; - */ - getUserSettings: GetUserSettingsResult; - } | { - oneofKind: "sendComposeAction"; - /** - * @generated from protobuf field: SendComposeActionResult sendComposeAction = 21; - */ - sendComposeAction: SendComposeActionResult; - } | { - oneofKind: "createBot"; - /** - * @generated from protobuf field: CreateBotResult createBot = 22; - */ - createBot: CreateBotResult; - } | { - oneofKind: "deleteMember"; - /** - * @generated from protobuf field: DeleteMemberResult deleteMember = 23; - */ - deleteMember: DeleteMemberResult; - } | { - oneofKind: "markAsUnread"; - /** - * @generated from protobuf field: MarkAsUnreadResult markAsUnread = 24; - */ - markAsUnread: MarkAsUnreadResult; - } | { - oneofKind: "getUpdatesState"; - /** - * @generated from protobuf field: GetUpdatesStateResult getUpdatesState = 25; - */ - getUpdatesState: GetUpdatesStateResult; - } | { - oneofKind: "getChat"; - /** - * @generated from protobuf field: GetChatResult getChat = 26; - */ - getChat: GetChatResult; - } | { - oneofKind: "getUpdates"; - /** - * @generated from protobuf field: GetUpdatesResult getUpdates = 27; - */ - getUpdates: GetUpdatesResult; - } | { - oneofKind: "updateMemberAccess"; - /** - * @generated from protobuf field: UpdateMemberAccessResult updateMemberAccess = 28; - */ - updateMemberAccess: UpdateMemberAccessResult; - } | { - oneofKind: "searchMessages"; - /** - * @generated from protobuf field: SearchMessagesResult searchMessages = 29; - */ - searchMessages: SearchMessagesResult; - } | { - oneofKind: "forwardMessages"; - /** - * @generated from protobuf field: ForwardMessagesResult forwardMessages = 30; - */ - forwardMessages: ForwardMessagesResult; - } | { - oneofKind: "updateChatVisibility"; - /** - * @generated from protobuf field: UpdateChatVisibilityResult updateChatVisibility = 31; - */ - updateChatVisibility: UpdateChatVisibilityResult; - } | { - oneofKind: "pinMessage"; - /** - * @generated from protobuf field: PinMessageResult pinMessage = 32; - */ - pinMessage: PinMessageResult; - } | { - oneofKind: "updateChatInfo"; - /** - * @generated from protobuf field: UpdateChatInfoResult updateChatInfo = 33; - */ - updateChatInfo: UpdateChatInfoResult; - } | { - oneofKind: "listBots"; - /** - * @generated from protobuf field: ListBotsResult listBots = 34; - */ - listBots: ListBotsResult; - } | { - oneofKind: "revealBotToken"; - /** - * @generated from protobuf field: RevealBotTokenResult revealBotToken = 35; - */ - revealBotToken: RevealBotTokenResult; - } | { - oneofKind: "moveThread"; - /** - * @generated from protobuf field: MoveThreadResult moveThread = 36; - */ - moveThread: MoveThreadResult; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message UpdateBucket - */ -export interface UpdateBucket { - /** - * @generated from protobuf oneof: type - */ - type: { - oneofKind: "user"; - /** - * @generated from protobuf field: UpdateBucketUser user = 1; - */ - user: UpdateBucketUser; - } | { - oneofKind: "space"; - /** - * @generated from protobuf field: UpdateBucketSpace space = 2; - */ - space: UpdateBucketSpace; - } | { - oneofKind: "chat"; - /** - * @generated from protobuf field: UpdateBucketChat chat = 3; - */ - chat: UpdateBucketChat; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message UpdateBucketUser - */ -export interface UpdateBucketUser { -} -/** - * @generated from protobuf message UpdateBucketSpace - */ -export interface UpdateBucketSpace { - /** - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; -} -/** - * @generated from protobuf message UpdateBucketChat - */ -export interface UpdateBucketChat { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; -} -/** - * @generated from protobuf message GetUpdatesInput - */ -export interface GetUpdatesInput { - /** - * @generated from protobuf field: UpdateBucket bucket = 1; - */ - bucket?: UpdateBucket; - /** - * @generated from protobuf field: int64 start_seq = 2; - */ - startSeq: bigint; - // unsure about these - // int64 start_date = 3; - - /** - * if the difference with the start_seq is greater than this, the result will - * contain "too long" result type - * - * @generated from protobuf field: int32 total_limit = 3; - */ - totalLimit: number; - /** - * optional inclusive upper bound for slicing - * - * @generated from protobuf field: int64 seq_end = 4; - */ - seqEnd: bigint; -} -/** - * @generated from protobuf message GetUpdatesResult - */ -export interface GetUpdatesResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; - /** - * Final sequence of the updates slice - * - * @generated from protobuf field: int64 seq = 2; - */ - seq: bigint; - /** - * Final date of the updates slice - * - * @generated from protobuf field: int64 date = 3; - */ - date: bigint; - /** - * Whether this is the final slice of updates - * - * @generated from protobuf field: optional bool final = 4; - */ - final?: boolean; - /** - * Type of the result - * - * @generated from protobuf field: GetUpdatesResult.ResultType result_type = 5; - */ - resultType: GetUpdatesResult_ResultType; -} -/** - * @generated from protobuf enum GetUpdatesResult.ResultType - */ -export enum GetUpdatesResult_ResultType { - /** - * @generated from protobuf enum value: RESULT_TYPE_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: RESULT_TYPE_EMPTY = 1; - */ - EMPTY = 1, - /** - * @generated from protobuf enum value: RESULT_TYPE_SLICE = 2; - */ - SLICE = 2, - /** - * @generated from protobuf enum value: RESULT_TYPE_TOO_LONG = 3; - */ - TOO_LONG = 3 -} -/** - * Remove member from space - * - * @generated from protobuf message DeleteMemberInput - */ -export interface DeleteMemberInput { - /** - * Space ID - * - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; - /** - * Member ID - * - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; -} -/** - * Remove member from space result - * - * @generated from protobuf message DeleteMemberResult - */ -export interface DeleteMemberResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * Update an existing member's access/role within a space - * - * @generated from protobuf message UpdateMemberAccessInput - */ -export interface UpdateMemberAccessInput { - /** - * Space ID - * - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; - /** - * Member user ID - * - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; - /** - * Updated role/options - * - * @generated from protobuf field: SpaceMemberRole role = 3; - */ - role?: SpaceMemberRole; -} -/** - * @generated from protobuf message UpdateMemberAccessResult - */ -export interface UpdateMemberAccessResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message GetUpdatesStateInput - */ -export interface GetUpdatesStateInput { - /** - * Local date of state - * - * @generated from protobuf field: int64 date = 2; - */ - date: bigint; -} -/** - * @generated from protobuf message GetUpdatesStateResult - */ -export interface GetUpdatesStateResult { - /** - * Current date of the state - * - * @generated from protobuf field: int64 date = 1; - */ - date: bigint; -} -/** - * @generated from protobuf message GetChatInput - */ -export interface GetChatInput { - /** - * Peer ID to get chat for - * - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; -} -/** - * @generated from protobuf message GetChatResult - */ -export interface GetChatResult { - /** - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; - /** - * @generated from protobuf field: Dialog dialog = 2; - */ - dialog?: Dialog; - /** - * @generated from protobuf field: repeated int64 pinned_message_ids = 3; - */ - pinnedMessageIds: bigint[]; -} -/** - * Mark dialog as unread - * - * @generated from protobuf message MarkAsUnreadInput - */ -export interface MarkAsUnreadInput { - /** - * Peer ID to mark as unread - * - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; -} -/** - * Mark dialog as unread result - * - * @generated from protobuf message MarkAsUnreadResult - */ -export interface MarkAsUnreadResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message CreateBotInput - */ -export interface CreateBotInput { - /** - * Name of the bot - * - * @generated from protobuf field: string name = 1; - */ - name: string; - /** - * Username of the bot - * - * @generated from protobuf field: string username = 2; - */ - username: string; - /** - * If not null, add the bot to this space - * - * @generated from protobuf field: optional int64 add_to_space = 3; - */ - addToSpace?: bigint; -} -/** - * @generated from protobuf message CreateBotResult - */ -export interface CreateBotResult { - /** - * @generated from protobuf field: User bot = 1; - */ - bot?: User; - /** - * Token to use for the bot - * - * @generated from protobuf field: string token = 2; - */ - token: string; -} -/** - * @generated from protobuf message ListBotsInput - */ -export interface ListBotsInput { -} -/** - * @generated from protobuf message ListBotsResult - */ -export interface ListBotsResult { - /** - * @generated from protobuf field: repeated User bots = 1; - */ - bots: User[]; -} -/** - * @generated from protobuf message RevealBotTokenInput - */ -export interface RevealBotTokenInput { - /** - * @generated from protobuf field: int64 bot_user_id = 1; - */ - botUserId: bigint; -} -/** - * @generated from protobuf message RevealBotTokenResult - */ -export interface RevealBotTokenResult { - /** - * @generated from protobuf field: string token = 1; - */ - token: string; -} -/** - * @generated from protobuf message GetUserSettingsInput - */ -export interface GetUserSettingsInput { -} -/** - * @generated from protobuf message GetUserSettingsResult - */ -export interface GetUserSettingsResult { - /** - * @generated from protobuf field: UserSettings user_settings = 1; - */ - userSettings?: UserSettings; -} -/** - * @generated from protobuf message UserSettings - */ -export interface UserSettings { - /** - * @generated from protobuf field: optional NotificationSettings notification_settings = 1; - */ - notificationSettings?: NotificationSettings; -} -/** - * @generated from protobuf message NotificationSettings - */ -export interface NotificationSettings { - /** - * @generated from protobuf field: optional NotificationSettings.Mode mode = 1; - */ - mode?: NotificationSettings_Mode; - /** - * If true, no sound will be played for notifications - * - * @generated from protobuf field: optional bool silent = 2; - */ - silent?: boolean; - /** - * If true, the notification requires mentioning the user - * - * @generated from protobuf field: optional bool zen_mode_requires_mention = 3; - */ - zenModeRequiresMention?: boolean; - /** - * If true, the default rules will be used - * - * @generated from protobuf field: optional bool zen_mode_uses_default_rules = 4; - */ - zenModeUsesDefaultRules?: boolean; - /** - * Custom rules for notifications - * - * @generated from protobuf field: optional string zen_mode_custom_rules = 5; - */ - zenModeCustomRules?: string; - /** - * If true, direct message notifications are disabled - * - * @generated from protobuf field: optional bool disable_dm_notifications = 6; - */ - disableDmNotifications?: boolean; -} -/** - * @generated from protobuf enum NotificationSettings.Mode - */ -export enum NotificationSettings_Mode { - /** - * @generated from protobuf enum value: MODE_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: MODE_ALL = 1; - */ - ALL = 1, - /** - * @generated from protobuf enum value: MODE_NONE = 2; - */ - NONE = 2, - /** - * @generated from protobuf enum value: MODE_MENTIONS = 3; - */ - MENTIONS = 3, - /** - * @generated from protobuf enum value: MODE_IMPORTANT_ONLY = 4; - */ - IMPORTANT_ONLY = 4, - /** - * @generated from protobuf enum value: MODE_ONLY_MENTIONS = 5; - */ - ONLY_MENTIONS = 5 -} -/** - * @generated from protobuf message UpdateUserSettingsInput - */ -export interface UpdateUserSettingsInput { - /** - * @generated from protobuf field: UserSettings user_settings = 1; - */ - userSettings?: UserSettings; -} -/** - * @generated from protobuf message UpdateUserSettingsResult - */ -export interface UpdateUserSettingsResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message SendComposeActionInput - */ -export interface SendComposeActionInput { - /** - * Peer - where user is typing/uploading - * - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * Compose action (optional, null means stop action) - * - * @generated from protobuf field: optional UpdateComposeAction.ComposeAction action = 2; - */ - action?: UpdateComposeAction_ComposeAction; -} -/** - * @generated from protobuf message SendComposeActionResult - */ -export interface SendComposeActionResult { -} -/** - * @generated from protobuf message GetChatsInput - */ -export interface GetChatsInput { -} -/** - * @generated from protobuf message GetChatsResult - */ -export interface GetChatsResult { - /** - * Dialogs - * - * @generated from protobuf field: repeated Dialog dialogs = 1; - */ - dialogs: Dialog[]; - /** - * Chats - * - * @generated from protobuf field: repeated Chat chats = 2; - */ - chats: Chat[]; - /** - * Spaces referenced in the chats - * - * @generated from protobuf field: repeated Space spaces = 3; - */ - spaces: Space[]; - /** - * Users referenced in the chats or messages - * - * @generated from protobuf field: repeated User users = 4; - */ - users: User[]; - /** - * Messages referenced in the chats - * - * @generated from protobuf field: repeated Message messages = 5; - */ - messages: Message[]; -} -/** - * @generated from protobuf message TranslateMessagesInput - */ -export interface TranslateMessagesInput { - /** - * ID of the peer - * - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * IDs of the messages to translate, these must not have gaps of more than 50 - * messages - * - * @generated from protobuf field: repeated int64 message_ids = 2; - */ - messageIds: bigint[]; - // // Only return messages starting from the specified message ID - // int32 offset_id = 2; - - // // Number of messages to return - // int32 limit = 3; - - /** - * Language code to translate to - * - * @generated from protobuf field: string language = 4; - */ - language: string; -} -/** - * @generated from protobuf message TranslateMessagesResult - */ -export interface TranslateMessagesResult { - /** - * Translated messages - * - * @generated from protobuf field: repeated MessageTranslation translations = 1; - */ - translations: MessageTranslation[]; -} -/** - * @generated from protobuf message MessageTranslation - */ -export interface MessageTranslation { - /** - * ID of the message - * - * @generated from protobuf field: int64 message_id = 1; - */ - messageId: bigint; - /** - * Language code of the translation - * - * @generated from protobuf field: string language = 2; - */ - language: string; - /** - * Translation of the message - * - * @generated from protobuf field: string translation = 3; - */ - translation: string; - /** - * Date of translation - * - * @generated from protobuf field: int64 date = 4; - */ - date: bigint; - /** - * Entities in the translation - * - * @generated from protobuf field: optional MessageEntities entities = 5; - */ - entities?: MessageEntities; -} -/** - * @generated from protobuf message GetMeInput - */ -export interface GetMeInput { -} -/** - * @generated from protobuf message GetMeResult - */ -export interface GetMeResult { - /** - * @generated from protobuf field: User user = 1; - */ - user?: User; -} -/** - * @generated from protobuf message GetPeerPhotoInput - */ -export interface GetPeerPhotoInput { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * @generated from protobuf field: int64 photo_id = 2; - */ - photoId: bigint; -} -/** - * @generated from protobuf message GetPeerPhotoResult - */ -export interface GetPeerPhotoResult { - /** - * @generated from protobuf field: Photo photo = 1; - */ - photo?: Photo; -} -/** - * @generated from protobuf message DeleteMessagesInput - */ -export interface DeleteMessagesInput { - /** - * @generated from protobuf field: repeated int64 message_ids = 1; - */ - messageIds: bigint[]; - /** - * @generated from protobuf field: InputPeer peer_id = 2; - */ - peerId?: InputPeer; -} -/** - * @generated from protobuf message DeleteMessagesResult - */ -export interface DeleteMessagesResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message EditMessageInput - */ -export interface EditMessageInput { - /** - * @generated from protobuf field: int64 message_id = 1; - */ - messageId: bigint; - /** - * @generated from protobuf field: InputPeer peer_id = 2; - */ - peerId?: InputPeer; - /** - * @generated from protobuf field: string text = 3; - */ - text: string; - /** - * @generated from protobuf field: optional MessageEntities entities = 7; - */ - entities?: MessageEntities; -} -/** - * @generated from protobuf message EditMessageResult - */ -export interface EditMessageResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message InputMedia - */ -export interface InputMedia { - /** - * @generated from protobuf oneof: media - */ - media: { - oneofKind: "photo"; - /** - * @generated from protobuf field: InputMediaPhoto photo = 1; - */ - photo: InputMediaPhoto; - } | { - oneofKind: "video"; - /** - * @generated from protobuf field: InputMediaVideo video = 2; - */ - video: InputMediaVideo; - } | { - oneofKind: "document"; - /** - * @generated from protobuf field: InputMediaDocument document = 3; - */ - document: InputMediaDocument; - } | { - oneofKind: "nudge"; - /** - * @generated from protobuf field: InputMediaNudge nudge = 4; - */ - nudge: InputMediaNudge; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message InputMediaPhoto - */ -export interface InputMediaPhoto { - /** - * ID of the photo that we have uploaded - * - * @generated from protobuf field: int64 photo_id = 1; - */ - photoId: bigint; -} -/** - * @generated from protobuf message InputMediaVideo - */ -export interface InputMediaVideo { - /** - * ID of the video that we have uploaded - * - * @generated from protobuf field: int64 video_id = 1; - */ - videoId: bigint; -} -/** - * @generated from protobuf message InputMediaDocument - */ -export interface InputMediaDocument { - /** - * ID of the document that we have uploaded - * - * @generated from protobuf field: int64 document_id = 1; - */ - documentId: bigint; -} -/** - * Nudge message (empty payload) - * - * @generated from protobuf message InputMediaNudge - */ -export interface InputMediaNudge { -} -/** - * @generated from protobuf message SendMessageInput - */ -export interface SendMessageInput { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * Message text or caption - * - * @generated from protobuf field: optional string message = 2; - */ - message?: string; - /** - * Message ID of the message being replied to - * - * @generated from protobuf field: optional int64 reply_to_msg_id = 3; - */ - replyToMsgId?: bigint; - /** - * Random ID to prevent duplicate messages - * - * @generated from protobuf field: optional int64 random_id = 4; - */ - randomId?: bigint; - /** - * Media to send - * - * @generated from protobuf field: optional InputMedia media = 5; - */ - media?: InputMedia; - /** - * Date of sending (until we fix the client reordering) - * - * @generated from protobuf field: optional int64 temporary_send_date = 1000; - */ - temporarySendDate?: bigint; - /** - * Whether the message is a sticker - * - * @generated from protobuf field: optional bool is_sticker = 6; - */ - isSticker?: boolean; - /** - * @generated from protobuf field: optional bool has_link = 6000; - */ - hasLink?: boolean; - /** - * Entities in the message (bold, italic, mention, etc) - * - * @generated from protobuf field: optional MessageEntities entities = 7; - */ - entities?: MessageEntities; - /** - * Parse markdown in message text and derive entities. - * - * @generated from protobuf field: optional bool parse_markdown = 8; - */ - parseMarkdown?: boolean; - /** - * Special send mode for this message - * - * @generated from protobuf field: optional MessageSendMode send_mode = 9; - */ - sendMode?: MessageSendMode; -} -/** - * @generated from protobuf message SendMessageResult - */ -export interface SendMessageResult { - /** - * @generated from protobuf field: repeated Update updates = 2; - */ - updates: Update[]; -} -/** - * @generated from protobuf message ForwardMessagesInput - */ -export interface ForwardMessagesInput { - /** - * Source chat/user peer - * - * @generated from protobuf field: InputPeer from_peer_id = 1; - */ - fromPeerId?: InputPeer; - /** - * Message IDs to forward from the source peer - * - * @generated from protobuf field: repeated int64 message_ids = 2; - */ - messageIds: bigint[]; - /** - * Destination chat/user peer - * - * @generated from protobuf field: InputPeer to_peer_id = 3; - */ - toPeerId?: InputPeer; - /** - * Whether to include forward header (defaults to true on server) - * - * @generated from protobuf field: optional bool share_forward_header = 4; - */ - shareForwardHeader?: boolean; -} -/** - * @generated from protobuf message ForwardMessagesResult - */ -export interface ForwardMessagesResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * @generated from protobuf message GetChatHistoryInput - */ -export interface GetChatHistoryInput { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * ID of the message to start from - * - * @generated from protobuf field: optional int64 offset_id = 2; - */ - offsetId?: bigint; - /** - * Number of messages to return - * - * @generated from protobuf field: optional int32 limit = 3; - */ - limit?: number; -} -/** - * @generated from protobuf message GetChatHistoryResult - */ -export interface GetChatHistoryResult { - /** - * @generated from protobuf field: repeated Message messages = 1; - */ - messages: Message[]; -} -/** - * @generated from protobuf message SearchMessagesInput - */ -export interface SearchMessagesInput { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * Queries to match in message text (space-separated terms ANDed within a - * query, ORed across queries) - * - * @generated from protobuf field: repeated string queries = 2; - */ - queries: string[]; - /** - * Max number of results to return - * - * @generated from protobuf field: optional int32 limit = 3; - */ - limit?: number; - /** - * ID of the message to start from - * - * @generated from protobuf field: optional int64 offset_id = 4; - */ - offsetId?: bigint; - /** - * Optional filter for media/doc messages - * - * @generated from protobuf field: optional SearchMessagesFilter filter = 5; - */ - filter?: SearchMessagesFilter; -} -/** - * @generated from protobuf message SearchMessagesResult - */ -export interface SearchMessagesResult { - /** - * @generated from protobuf field: repeated Message messages = 1; - */ - messages: Message[]; -} -/** - * @generated from protobuf message InputChatParticipant - */ -export interface InputChatParticipant { - /** - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; -} -/** - * @generated from protobuf message CreateChatInput - */ -export interface CreateChatInput { - /** - * Required title - * - * @generated from protobuf field: string title = 1; - */ - title: string; - /** - * Parent space ID - * - * @generated from protobuf field: optional int64 space_id = 2; - */ - spaceId?: bigint; - /** - * Optional description of the thread - * - * @generated from protobuf field: optional string description = 3; - */ - description?: string; - /** - * Emoji to show as the icon, can be null - * - * @generated from protobuf field: optional string emoji = 4; - */ - emoji?: string; - /** - * If true, everyone in parent space can accces it - * - * @generated from protobuf field: bool is_public = 5; - */ - isPublic: boolean; - /** - * For public threads, it must be an empty list - * - * @generated from protobuf field: repeated InputChatParticipant participants = 6; - */ - participants: InputChatParticipant[]; -} -/** - * @generated from protobuf message CreateChatResult - */ -export interface CreateChatResult { - /** - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; - /** - * @generated from protobuf field: Dialog dialog = 2; - */ - dialog?: Dialog; -} -/** - * @generated from protobuf message GetSpaceMembersInput - */ -export interface GetSpaceMembersInput { - /** - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; -} -/** - * @generated from protobuf message GetSpaceMembersResult - */ -export interface GetSpaceMembersResult { - /** - * @generated from protobuf field: repeated Member members = 1; - */ - members: Member[]; - /** - * @generated from protobuf field: repeated User users = 2; - */ - users: User[]; -} -/** - * / ------------------------------ - * Updates Subsystem - * - * @generated from protobuf message Update - */ -export interface Update { - /** - * @generated from protobuf field: optional int32 seq = 1; - */ - seq?: number; - /** - * @generated from protobuf field: optional int64 date = 2; - */ - date?: bigint; - /** - * @generated from protobuf oneof: update - */ - update: { - oneofKind: "newMessage"; - /** - * @generated from protobuf field: UpdateNewMessage new_message = 4; - */ - newMessage: UpdateNewMessage; // this - } | { - oneofKind: "editMessage"; - /** - * @generated from protobuf field: UpdateEditMessage edit_message = 5; - */ - editMessage: UpdateEditMessage; // this - } | { - oneofKind: "updateMessageId"; - /** - * @generated from protobuf field: UpdateMessageId update_message_id = 6; - */ - updateMessageId: UpdateMessageId; - } | { - oneofKind: "deleteMessages"; - /** - * @generated from protobuf field: UpdateDeleteMessages delete_messages = 7; - */ - deleteMessages: UpdateDeleteMessages; // this - } | { - oneofKind: "updateComposeAction"; - /** - * @generated from protobuf field: UpdateComposeAction update_compose_action = 8; - */ - updateComposeAction: UpdateComposeAction; - } | { - oneofKind: "updateUserStatus"; - /** - * @generated from protobuf field: UpdateUserStatus update_user_status = 9; - */ - updateUserStatus: UpdateUserStatus; - } | { - oneofKind: "messageAttachment"; - /** - * @generated from protobuf field: UpdateMessageAttachment message_attachment = 10; - */ - messageAttachment: UpdateMessageAttachment; // this - } | { - oneofKind: "updateReaction"; - /** - * @generated from protobuf field: UpdateReaction update_reaction = 11; - */ - updateReaction: UpdateReaction; - } | { - oneofKind: "deleteReaction"; - /** - * @generated from protobuf field: UpdateDeleteReaction delete_reaction = 12; - */ - deleteReaction: UpdateDeleteReaction; - } | { - oneofKind: "participantAdd"; - /** - * @generated from protobuf field: UpdateChatParticipantAdd participant_add = 13; - */ - participantAdd: UpdateChatParticipantAdd; // this - } | { - oneofKind: "participantDelete"; - /** - * @generated from protobuf field: UpdateChatParticipantDelete participant_delete = 14; - */ - participantDelete: UpdateChatParticipantDelete; // this - } | { - oneofKind: "newChat"; - /** - * @generated from protobuf field: UpdateNewChat new_chat = 15; - */ - newChat: UpdateNewChat; // this - } | { - oneofKind: "deleteChat"; - /** - * @generated from protobuf field: UpdateDeleteChat delete_chat = 16; - */ - deleteChat: UpdateDeleteChat; // this - } | { - oneofKind: "spaceMemberAdd"; - /** - * @generated from protobuf field: UpdateSpaceMemberAdd space_member_add = 17; - */ - spaceMemberAdd: UpdateSpaceMemberAdd; - } | { - oneofKind: "spaceMemberDelete"; - /** - * @generated from protobuf field: UpdateSpaceMemberDelete space_member_delete = 18; - */ - spaceMemberDelete: UpdateSpaceMemberDelete; // this - } | { - oneofKind: "joinSpace"; - /** - * @generated from protobuf field: UpdateJoinSpace join_space = 19; - */ - joinSpace: UpdateJoinSpace; // this - } | { - oneofKind: "updateReadMaxId"; - /** - * @generated from protobuf field: UpdateReadMaxId update_read_max_id = 20; - */ - updateReadMaxId: UpdateReadMaxId; - } | { - oneofKind: "updateUserSettings"; - /** - * @generated from protobuf field: UpdateUserSettings update_user_settings = 21; - */ - updateUserSettings: UpdateUserSettings; - } | { - oneofKind: "newMessageNotification"; - /** - * @generated from protobuf field: UpdateNewMessageNotification new_message_notification = 22; - */ - newMessageNotification: UpdateNewMessageNotification; - } | { - oneofKind: "markAsUnread"; - /** - * @generated from protobuf field: UpdateMarkAsUnread mark_as_unread = 23; - */ - markAsUnread: UpdateMarkAsUnread; - } | { - oneofKind: "chatSkipPts"; - /** - * @generated from protobuf field: UpdateChatSkipPts chat_skip_pts = 24; - */ - chatSkipPts: UpdateChatSkipPts; - } | { - oneofKind: "chatHasNewUpdates"; - /** - * @generated from protobuf field: UpdateChatHasNewUpdates chat_has_new_updates = 25; - */ - chatHasNewUpdates: UpdateChatHasNewUpdates; - } | { - oneofKind: "spaceHasNewUpdates"; - /** - * @generated from protobuf field: UpdateSpaceHasNewUpdates space_has_new_updates = 26; - */ - spaceHasNewUpdates: UpdateSpaceHasNewUpdates; - } | { - oneofKind: "spaceMemberUpdate"; - /** - * @generated from protobuf field: UpdateSpaceMemberUpdate space_member_update = 27; - */ - spaceMemberUpdate: UpdateSpaceMemberUpdate; - } | { - oneofKind: "chatVisibility"; - /** - * @generated from protobuf field: UpdateChatVisibility chat_visibility = 28; - */ - chatVisibility: UpdateChatVisibility; - } | { - oneofKind: "dialogArchived"; - /** - * @generated from protobuf field: UpdateDialogArchived dialog_archived = 29; - */ - dialogArchived: UpdateDialogArchived; - } | { - oneofKind: "chatInfo"; - /** - * @generated from protobuf field: UpdateChatInfo chat_info = 30; - */ - chatInfo: UpdateChatInfo; - } | { - oneofKind: "pinnedMessages"; - /** - * @generated from protobuf field: UpdatePinnedMessages pinned_messages = 31; - */ - pinnedMessages: UpdatePinnedMessages; - } | { - oneofKind: "chatMoved"; - /** - * @generated from protobuf field: UpdateChatMoved chat_moved = 32; - */ - chatMoved: UpdateChatMoved; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message UpdateSpaceHasNewUpdates - */ -export interface UpdateSpaceHasNewUpdates { - /** - * Space ID - * - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; - /** - * Current sequence of the space - * - * @generated from protobuf field: int32 update_seq = 2; - */ - updateSeq: number; -} -/** - * Update when a chat has new updates and client should fetch them - * - * @generated from protobuf message UpdateChatHasNewUpdates - */ -export interface UpdateChatHasNewUpdates { - /** - * Chat ID - * - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * Peer ID of the chat - * - * @generated from protobuf field: Peer peer_id = 3; - */ - peerId?: Peer; - /** - * Current PTS of the chat - * - * @generated from protobuf field: int32 update_seq = 2; - */ - updateSeq: number; -} -/** - * @generated from protobuf message UpdateChatSkipPts - */ -export interface UpdateChatSkipPts { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; -} -/** - * Update when chat visibility changes (public/private) - * - * @generated from protobuf message UpdateChatVisibility - */ -export interface UpdateChatVisibility { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: bool is_public = 2; - */ - isPublic: boolean; -} -/** - * Update when chat title or emoji changes - * - * @generated from protobuf message UpdateChatInfo - */ -export interface UpdateChatInfo { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: optional string title = 2; - */ - title?: string; - /** - * @generated from protobuf field: optional string emoji = 3; - */ - emoji?: string; -} -/** - * Update when pinned messages change for a chat - * - * @generated from protobuf message UpdatePinnedMessages - */ -export interface UpdatePinnedMessages { - /** - * Peer ID of the chat - * - * @generated from protobuf field: Peer peer_id = 1; - */ - peerId?: Peer; - /** - * Ordered list of pinned message IDs (latest first) - * - * @generated from protobuf field: repeated int64 message_ids = 2; - */ - messageIds: bigint[]; -} -/** - * Update when a thread is moved between home and a space. - * - * NOTE: v1 only supports private threads and only home <-> space moves. - * Keep this payload flexible for future: - * - moving across spaces - * - moving public threads out of a space (would likely convert members to participants) - * - allowing external participants in space threads - * - * @generated from protobuf message UpdateChatMoved - */ -export interface UpdateChatMoved { - /** - * Updated chat record (includes new space_id if moved into a space). - * - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; - /** - * Optional old/new space IDs for convenience. new_space_id is unset when moved to home. - * - * @generated from protobuf field: optional int64 old_space_id = 2; - */ - oldSpaceId?: bigint; - /** - * @generated from protobuf field: optional int64 new_space_id = 3; - */ - newSpaceId?: bigint; -} -/** - * @generated from protobuf message UpdateNewMessageNotification - */ -export interface UpdateNewMessageNotification { - /** - * Message that triggered the notification - * - * @generated from protobuf field: Message message = 1; - */ - message?: Message; - /** - * Reason for the notification - * - * @generated from protobuf field: UpdateNewMessageNotification.Reason reason = 2; - */ - reason: UpdateNewMessageNotification_Reason; -} -/** - * @generated from protobuf enum UpdateNewMessageNotification.Reason - */ -export enum UpdateNewMessageNotification_Reason { - /** - * @generated from protobuf enum value: REASON_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: REASON_MENTION = 1; - */ - MENTION = 1, - /** - * @generated from protobuf enum value: REASON_IMPORTANT = 2; - */ - IMPORTANT = 2 -} -/** - * @generated from protobuf message UpdateUserSettings - */ -export interface UpdateUserSettings { - /** - * @generated from protobuf field: UserSettings settings = 1; - */ - settings?: UserSettings; -} -/** - * Update when a new space member is added - * - * @generated from protobuf message UpdateSpaceMemberAdd - */ -export interface UpdateSpaceMemberAdd { - /** - * @generated from protobuf field: Member member = 1; - */ - member?: Member; - /** - * @generated from protobuf field: User user = 2; - */ - user?: User; -} -/** - * Update when a space member is removed - * - * @generated from protobuf message UpdateSpaceMemberDelete - */ -export interface UpdateSpaceMemberDelete { - /** - * Space ID - * - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; - /** - * User ID - * - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; -} -/** - * Update when a space member's access/role changes - * - * @generated from protobuf message UpdateSpaceMemberUpdate - */ -export interface UpdateSpaceMemberUpdate { - /** - * @generated from protobuf field: Member member = 1; - */ - member?: Member; -} -/** - * Update when we joined a space - * - * @generated from protobuf message UpdateJoinSpace - */ -export interface UpdateJoinSpace { - /** - * @generated from protobuf field: Space space = 1; - */ - space?: Space; - /** - * @generated from protobuf field: Member member = 2; - */ - member?: Member; -} -/** - * Update when we read up to a certain message ID - * - * @generated from protobuf message UpdateReadMaxId - */ -export interface UpdateReadMaxId { - /** - * Peer ID - * - * @generated from protobuf field: Peer peer_id = 1; - */ - peerId?: Peer; - // Chat ID - // int64 chat_id = 2; - - /** - * Read max ID - * - * @generated from protobuf field: int64 read_max_id = 3; - */ - readMaxId: bigint; - /** - * Still unread count - * - * @generated from protobuf field: int32 unread_count = 4; - */ - unreadCount: number; -} -/** - * Update when a dialog is marked as unread - * - * @generated from protobuf message UpdateMarkAsUnread - */ -export interface UpdateMarkAsUnread { - /** - * Peer ID of the dialog that was marked as unread - * - * @generated from protobuf field: Peer peer_id = 1; - */ - peerId?: Peer; - /** - * Whether it's marked as unread (true) or not (false) - * - * @generated from protobuf field: bool unread_mark = 2; - */ - unreadMark: boolean; -} -/** - * Update when a dialog is archived or unarchived - * - * @generated from protobuf message UpdateDialogArchived - */ -export interface UpdateDialogArchived { - /** - * Peer ID of the dialog that changed - * - * @generated from protobuf field: Peer peer_id = 1; - */ - peerId?: Peer; - /** - * Whether it's archived (true) or unarchived (false) - * - * @generated from protobuf field: bool archived = 2; - */ - archived: boolean; -} -/** - * Update when a new chat is created either in space or a private chat - * - * @generated from protobuf message UpdateNewChat - */ -export interface UpdateNewChat { - /** - * Chat - * - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; - // Dialog for the chat - // Dialog dialog = 2; - - /** - * If private chat - * - * @generated from protobuf field: optional User user = 3; - */ - user?: User; -} -/** - * Update when a chat is deleted - * - * @generated from protobuf message UpdateDeleteChat - */ -export interface UpdateDeleteChat { - /** - * Peer ID - * - * @generated from protobuf field: Peer peer_id = 1; - */ - peerId?: Peer; -} -/** - * Update when a new message is created - * - * @generated from protobuf message UpdateNewMessage - */ -export interface UpdateNewMessage { - /** - * @generated from protobuf field: Message message = 1; - */ - message?: Message; -} -/** - * Update when a message is edited - * - * @generated from protobuf message UpdateEditMessage - */ -export interface UpdateEditMessage { - /** - * @generated from protobuf field: Message message = 1; - */ - message?: Message; -} -/** - * Update when messages are deleted - * - * @generated from protobuf message UpdateDeleteMessages - */ -export interface UpdateDeleteMessages { - /** - * Message IDs - * - * @generated from protobuf field: repeated int64 message_ids = 1; - */ - messageIds: bigint[]; - /** - * Peer ID - * - * @generated from protobuf field: Peer peer_id = 2; - */ - peerId?: Peer; -} -/** - * Update when a message ID is updated after sending - * - * @generated from protobuf message UpdateMessageId - */ -export interface UpdateMessageId { - /** - * @generated from protobuf field: int64 message_id = 1; - */ - messageId: bigint; - /** - * @generated from protobuf field: int64 random_id = 2; - */ - randomId: bigint; -} -/** - * Update when a user starts or stops composing a message for typing, uploading - * a photo, etc - * - * @generated from protobuf message UpdateComposeAction - */ -export interface UpdateComposeAction { - /** - * User ID of the user who is composing the message - * - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; - /** - * Peer ID of the peer user is composing the message to - * - * @generated from protobuf field: Peer peer_id = 2; - */ - peerId?: Peer; - /** - * Action of the user (typing, etc) - * - * @generated from protobuf field: UpdateComposeAction.ComposeAction action = 3; - */ - action: UpdateComposeAction_ComposeAction; -} -/** - * @generated from protobuf enum UpdateComposeAction.ComposeAction - */ -export enum UpdateComposeAction_ComposeAction { - /** - * @generated from protobuf enum value: NONE = 0; - */ - NONE = 0, - /** - * @generated from protobuf enum value: TYPING = 1; - */ - TYPING = 1, - /** - * @generated from protobuf enum value: UPLOADING_PHOTO = 2; - */ - UPLOADING_PHOTO = 2, - /** - * @generated from protobuf enum value: UPLOADING_DOCUMENT = 3; - */ - UPLOADING_DOCUMENT = 3, - /** - * @generated from protobuf enum value: UPLOADING_VIDEO = 4; - */ - UPLOADING_VIDEO = 4 -} -/** - * @generated from protobuf message UpdateMessageAttachment - */ -export interface UpdateMessageAttachment { - /** - * @generated from protobuf field: MessageAttachment attachment = 1; - */ - attachment?: MessageAttachment; - /** - * @generated from protobuf field: int64 message_id = 2; - */ - messageId: bigint; - /** - * @generated from protobuf field: Peer peer_id = 3; - */ - peerId?: Peer; - /** - * @generated from protobuf field: int64 chat_id = 50; - */ - chatId: bigint; -} -/** - * @generated from protobuf message UpdateReaction - */ -export interface UpdateReaction { - /** - * @generated from protobuf field: Reaction reaction = 1; - */ - reaction?: Reaction; -} -/** - * @generated from protobuf message UpdateDeleteReaction - */ -export interface UpdateDeleteReaction { - /** - * @generated from protobuf field: string emoji = 1; - */ - emoji: string; - /** - * @generated from protobuf field: int64 chat_id = 2; - */ - chatId: bigint; - /** - * @generated from protobuf field: int64 message_id = 3; - */ - messageId: bigint; - /** - * @generated from protobuf field: int64 user_id = 4; - */ - userId: bigint; -} -/** - * @generated from protobuf message UpdateUserStatus - */ -export interface UpdateUserStatus { - /** - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; - /** - * @generated from protobuf field: UserStatus status = 2; - */ - status?: UserStatus; -} -/** - * @generated from protobuf message ChatParticipant - */ -export interface ChatParticipant { - /** - * @generated from protobuf field: int64 user_id = 1; - */ - userId: bigint; - /** - * @generated from protobuf field: int64 date = 2; - */ - date: bigint; -} -/** - * @generated from protobuf message UpdateChatParticipantAdd - */ -export interface UpdateChatParticipantAdd { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: ChatParticipant participant = 2; - */ - participant?: ChatParticipant; -} -/** - * @generated from protobuf message UpdateChatParticipantDelete - */ -export interface UpdateChatParticipantDelete { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; -} -/** - * @generated from protobuf message UserStatus - */ -export interface UserStatus { - /** - * @generated from protobuf field: UserStatus.Status online = 1; - */ - online: UserStatus_Status; - /** - * @generated from protobuf field: LastOnline last_online = 2; - */ - lastOnline?: LastOnline; -} -/** - * @generated from protobuf enum UserStatus.Status - */ -export enum UserStatus_Status { - /** - * @generated from protobuf enum value: UNKNOWN = 0; - */ - UNKNOWN = 0, - /** - * @generated from protobuf enum value: ONLINE = 1; - */ - ONLINE = 1, - /** - * @generated from protobuf enum value: OFFLINE = 2; - */ - OFFLINE = 2 -} -/** - * @generated from protobuf message LastOnline - */ -export interface LastOnline { - /** - * Date of the last online if exact last online is permitted by the user - * - * @generated from protobuf field: optional int64 date = 1; - */ - date?: bigint; -} -/** - * @generated from protobuf message DeleteChatInput - */ -export interface DeleteChatInput { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; -} -/** - * @generated from protobuf message DeleteChatResult - */ -export interface DeleteChatResult { -} -/** - * @generated from protobuf message SpaceMemberOptions - */ -export interface SpaceMemberOptions { - /** - * @generated from protobuf field: bool can_access_public_chats = 1; - */ - canAccessPublicChats: boolean; -} -/** - * @generated from protobuf message SpaceAdminOptions - */ -export interface SpaceAdminOptions { -} -/** - * @generated from protobuf message SpaceMemberRole - */ -export interface SpaceMemberRole { - /** - * @generated from protobuf oneof: role - */ - role: { - oneofKind: "member"; - /** - * @generated from protobuf field: SpaceMemberOptions member = 1; - */ - member: SpaceMemberOptions; - } | { - oneofKind: "admin"; - /** - * @generated from protobuf field: SpaceAdminOptions admin = 2; - */ - admin: SpaceAdminOptions; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message InviteToSpaceInput - */ -export interface InviteToSpaceInput { - /** - * ID of the space to invite to - * - * @generated from protobuf field: int64 space_id = 1; - */ - spaceId: bigint; - /** - * @generated from protobuf field: SpaceMemberRole role = 6; - */ - role?: SpaceMemberRole; - /** - * @generated from protobuf oneof: via - */ - via: { - oneofKind: "userId"; - /** - * ID of the user to invite - * - * @generated from protobuf field: int64 user_id = 3; - */ - userId: bigint; - } | { - oneofKind: "email"; - /** - * Email of the user to invite - * - * @generated from protobuf field: string email = 4; - */ - email: string; - } | { - oneofKind: "phoneNumber"; - /** - * Phone number of the user to invite - * - * @generated from protobuf field: string phone_number = 5; - */ - phoneNumber: string; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message InviteToSpaceResult - */ -export interface InviteToSpaceResult { - /** - * @generated from protobuf field: User user = 1; - */ - user?: User; - /** - * @generated from protobuf field: Member member = 2; - */ - member?: Member; - /** - * @generated from protobuf field: Chat chat = 3; - */ - chat?: Chat; - /** - * @generated from protobuf field: Dialog dialog = 4; - */ - dialog?: Dialog; -} -/** - * @generated from protobuf message GetChatParticipantsInput - */ -export interface GetChatParticipantsInput { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; -} -/** - * @generated from protobuf message GetChatParticipantsResult - */ -export interface GetChatParticipantsResult { - /** - * @generated from protobuf field: repeated ChatParticipant participants = 1; - */ - participants: ChatParticipant[]; - /** - * @generated from protobuf field: repeated User users = 2; - */ - users: User[]; -} -/** - * @generated from protobuf message AddChatParticipantInput - */ -export interface AddChatParticipantInput { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; -} -/** - * @generated from protobuf message AddChatParticipantResult - */ -export interface AddChatParticipantResult { - /** - * @generated from protobuf field: ChatParticipant participant = 1; - */ - participant?: ChatParticipant; -} -/** - * @generated from protobuf message RemoveChatParticipantInput - */ -export interface RemoveChatParticipantInput { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: int64 user_id = 2; - */ - userId: bigint; -} -/** - * @generated from protobuf message RemoveChatParticipantResult - */ -export interface RemoveChatParticipantResult { -} -/** - * @generated from protobuf message UpdateChatVisibilityInput - */ -export interface UpdateChatVisibilityInput { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: bool is_public = 2; - */ - isPublic: boolean; - /** - * @generated from protobuf field: repeated InputChatParticipant participants = 3; - */ - participants: InputChatParticipant[]; -} -/** - * @generated from protobuf message UpdateChatVisibilityResult - */ -export interface UpdateChatVisibilityResult { - /** - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; -} -/** - * @generated from protobuf message UpdateChatInfoInput - */ -export interface UpdateChatInfoInput { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * @generated from protobuf field: optional string title = 2; - */ - title?: string; - /** - * @generated from protobuf field: optional string emoji = 3; - */ - emoji?: string; -} -/** - * @generated from protobuf message UpdateChatInfoResult - */ -export interface UpdateChatInfoResult { - /** - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; -} -/** - * Move a private thread between home (space_id unset) and a space (space_id set). - * v1 does NOT support cross-space moves or public threads. - * - * @generated from protobuf message MoveThreadInput - */ -export interface MoveThreadInput { - /** - * @generated from protobuf field: int64 chat_id = 1; - */ - chatId: bigint; - /** - * Target space. If unset, moves to home. - * - * @generated from protobuf field: optional int64 space_id = 2; - */ - spaceId?: bigint; -} -/** - * @generated from protobuf message MoveThreadResult - */ -export interface MoveThreadResult { - /** - * @generated from protobuf field: Chat chat = 1; - */ - chat?: Chat; -} -/** - * Pin or unpin a message for everyone - * - * @generated from protobuf message PinMessageInput - */ -export interface PinMessageInput { - /** - * @generated from protobuf field: InputPeer peer_id = 1; - */ - peerId?: InputPeer; - /** - * @generated from protobuf field: int64 message_id = 2; - */ - messageId: bigint; - /** - * @generated from protobuf field: bool unpin = 3; - */ - unpin: boolean; -} -/** - * @generated from protobuf message PinMessageResult - */ -export interface PinMessageResult { - /** - * @generated from protobuf field: repeated Update updates = 1; - */ - updates: Update[]; -} -/** - * Apple only types - * - * @generated from protobuf message DraftMessage - */ -export interface DraftMessage { - /** - * @generated from protobuf field: string text = 1; - */ - text: string; - /** - * @generated from protobuf field: optional MessageEntities entities = 2; - */ - entities?: MessageEntities; -} -/** - * @generated from protobuf enum MessageSendMode - */ -export enum MessageSendMode { - /** - * @generated from protobuf enum value: MODE_UNSPECIFIED = 0; - */ - MODE_UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: MODE_SILENT = 1; - */ - MODE_SILENT = 1 -} -/** - * @generated from protobuf enum Method - */ -export enum Method { - /** - * @generated from protobuf enum value: UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: GET_ME = 1; - */ - GET_ME = 1, - /** - * @generated from protobuf enum value: SEND_MESSAGE = 2; - */ - SEND_MESSAGE = 2, - /** - * @generated from protobuf enum value: GET_PEER_PHOTO = 3; - */ - GET_PEER_PHOTO = 3, - /** - * @generated from protobuf enum value: DELETE_MESSAGES = 4; - */ - DELETE_MESSAGES = 4, - /** - * @generated from protobuf enum value: GET_CHAT_HISTORY = 5; - */ - GET_CHAT_HISTORY = 5, - /** - * @generated from protobuf enum value: ADD_REACTION = 6; - */ - ADD_REACTION = 6, - /** - * @generated from protobuf enum value: DELETE_REACTION = 7; - */ - DELETE_REACTION = 7, - /** - * @generated from protobuf enum value: EDIT_MESSAGE = 8; - */ - EDIT_MESSAGE = 8, - /** - * @generated from protobuf enum value: CREATE_CHAT = 9; - */ - CREATE_CHAT = 9, - /** - * @generated from protobuf enum value: GET_SPACE_MEMBERS = 10; - */ - GET_SPACE_MEMBERS = 10, - /** - * @generated from protobuf enum value: DELETE_CHAT = 11; - */ - DELETE_CHAT = 11, - /** - * @generated from protobuf enum value: INVITE_TO_SPACE = 12; - */ - INVITE_TO_SPACE = 12, - /** - * @generated from protobuf enum value: GET_CHAT_PARTICIPANTS = 13; - */ - GET_CHAT_PARTICIPANTS = 13, - /** - * @generated from protobuf enum value: ADD_CHAT_PARTICIPANT = 14; - */ - ADD_CHAT_PARTICIPANT = 14, - /** - * @generated from protobuf enum value: REMOVE_CHAT_PARTICIPANT = 15; - */ - REMOVE_CHAT_PARTICIPANT = 15, - /** - * @generated from protobuf enum value: TRANSLATE_MESSAGES = 16; - */ - TRANSLATE_MESSAGES = 16, - /** - * @generated from protobuf enum value: GET_CHATS = 17; - */ - GET_CHATS = 17, - /** - * @generated from protobuf enum value: UPDATE_USER_SETTINGS = 18; - */ - UPDATE_USER_SETTINGS = 18, - /** - * @generated from protobuf enum value: GET_USER_SETTINGS = 19; - */ - GET_USER_SETTINGS = 19, - /** - * @generated from protobuf enum value: SEND_COMPOSE_ACTION = 20; - */ - SEND_COMPOSE_ACTION = 20, - /** - * @generated from protobuf enum value: CREATE_BOT = 21; - */ - CREATE_BOT = 21, - /** - * @generated from protobuf enum value: DELETE_MEMBER = 22; - */ - DELETE_MEMBER = 22, - /** - * @generated from protobuf enum value: MARK_AS_UNREAD = 23; - */ - MARK_AS_UNREAD = 23, - /** - * @generated from protobuf enum value: GET_UPDATES_STATE = 24; - */ - GET_UPDATES_STATE = 24, - /** - * @generated from protobuf enum value: GET_CHAT = 25; - */ - GET_CHAT = 25, - /** - * @generated from protobuf enum value: GET_UPDATES = 26; - */ - GET_UPDATES = 26, - /** - * @generated from protobuf enum value: UPDATE_MEMBER_ACCESS = 27; - */ - UPDATE_MEMBER_ACCESS = 27, - /** - * @generated from protobuf enum value: SEARCH_MESSAGES = 28; - */ - SEARCH_MESSAGES = 28, - /** - * @generated from protobuf enum value: FORWARD_MESSAGES = 29; - */ - FORWARD_MESSAGES = 29, - /** - * @generated from protobuf enum value: UPDATE_CHAT_VISIBILITY = 30; - */ - UPDATE_CHAT_VISIBILITY = 30, - /** - * @generated from protobuf enum value: PIN_MESSAGE = 31; - */ - PIN_MESSAGE = 31, - /** - * @generated from protobuf enum value: UPDATE_CHAT_INFO = 32; - */ - UPDATE_CHAT_INFO = 32, - /** - * @generated from protobuf enum value: LIST_BOTS = 33; - */ - LIST_BOTS = 33, - /** - * @generated from protobuf enum value: REVEAL_BOT_TOKEN = 34; - */ - REVEAL_BOT_TOKEN = 34, - /** - * @generated from protobuf enum value: MOVE_THREAD = 35; - */ - MOVE_THREAD = 35 -} -/** - * @generated from protobuf enum SearchMessagesFilter - */ -export enum SearchMessagesFilter { - /** - * @generated from protobuf enum value: FILTER_UNSPECIFIED = 0; - */ - FILTER_UNSPECIFIED = 0, - /** - * @generated from protobuf enum value: FILTER_PHOTOS = 1; - */ - FILTER_PHOTOS = 1, - /** - * @generated from protobuf enum value: FILTER_VIDEOS = 2; - */ - FILTER_VIDEOS = 2, - /** - * @generated from protobuf enum value: FILTER_PHOTO_VIDEO = 3; - */ - FILTER_PHOTO_VIDEO = 3, - /** - * @generated from protobuf enum value: FILTER_DOCUMENTS = 4; - */ - FILTER_DOCUMENTS = 4, - /** - * @generated from protobuf enum value: FILTER_LINKS = 5; - */ - FILTER_LINKS = 5 -} -// @generated message type with reflection information, may provide speed optimized methods -class ClientMessage$Type extends MessageType { - constructor() { - super("ClientMessage", [ - { no: 1, name: "id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "seq", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 4, name: "connection_init", kind: "message", oneof: "body", T: () => ConnectionInit }, - { no: 5, name: "rpc_call", kind: "message", oneof: "body", T: () => RpcCall }, - { no: 6, name: "ack", kind: "message", oneof: "body", T: () => Ack }, - { no: 7, name: "ping", kind: "message", oneof: "body", T: () => Ping } - ]); - } - create(value?: PartialMessage): ClientMessage { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.seq = 0; - message.body = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ClientMessage): ClientMessage { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* uint64 id */ 1: - message.id = reader.uint64().toBigInt(); - break; - case /* uint32 seq */ 2: - message.seq = reader.uint32(); - break; - case /* ConnectionInit connection_init */ 4: - message.body = { - oneofKind: "connectionInit", - connectionInit: ConnectionInit.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).connectionInit) - }; - break; - case /* RpcCall rpc_call */ 5: - message.body = { - oneofKind: "rpcCall", - rpcCall: RpcCall.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).rpcCall) - }; - break; - case /* Ack ack */ 6: - message.body = { - oneofKind: "ack", - ack: Ack.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).ack) - }; - break; - case /* Ping ping */ 7: - message.body = { - oneofKind: "ping", - ping: Ping.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).ping) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: ClientMessage, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* uint64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).uint64(message.id); - /* uint32 seq = 2; */ - if (message.seq !== 0) - writer.tag(2, WireType.Varint).uint32(message.seq); - /* ConnectionInit connection_init = 4; */ - if (message.body.oneofKind === "connectionInit") - ConnectionInit.internalBinaryWrite(message.body.connectionInit, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); - /* RpcCall rpc_call = 5; */ - if (message.body.oneofKind === "rpcCall") - RpcCall.internalBinaryWrite(message.body.rpcCall, writer.tag(5, WireType.LengthDelimited).fork(), options).join(); - /* Ack ack = 6; */ - if (message.body.oneofKind === "ack") - Ack.internalBinaryWrite(message.body.ack, writer.tag(6, WireType.LengthDelimited).fork(), options).join(); - /* Ping ping = 7; */ - if (message.body.oneofKind === "ping") - Ping.internalBinaryWrite(message.body.ping, writer.tag(7, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message ClientMessage - */ -export const ClientMessage = new ClientMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectionInit$Type extends MessageType { - constructor() { - super("ConnectionInit", [ - { no: 1, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "build_number", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ }, - { no: 3, name: "layer", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 4, name: "client_version", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } - create(value?: PartialMessage): ConnectionInit { - const message = globalThis.Object.create((this.messagePrototype!)); - message.token = ""; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ConnectionInit): ConnectionInit { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string token */ 1: - message.token = reader.string(); - break; - case /* optional int32 build_number */ 2: - message.buildNumber = reader.int32(); - break; - case /* optional uint32 layer */ 3: - message.layer = reader.uint32(); - break; - case /* optional string client_version */ 4: - message.clientVersion = reader.string(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: ConnectionInit, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string token = 1; */ - if (message.token !== "") - writer.tag(1, WireType.LengthDelimited).string(message.token); - /* optional int32 build_number = 2; */ - if (message.buildNumber !== undefined) - writer.tag(2, WireType.Varint).int32(message.buildNumber); - /* optional uint32 layer = 3; */ - if (message.layer !== undefined) - writer.tag(3, WireType.Varint).uint32(message.layer); - /* optional string client_version = 4; */ - if (message.clientVersion !== undefined) - writer.tag(4, WireType.LengthDelimited).string(message.clientVersion); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message ConnectionInit - */ -export const ConnectionInit = new ConnectionInit$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ServerProtocolMessage$Type extends MessageType { - constructor() { - super("ServerProtocolMessage", [ - { no: 1, name: "id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 4, name: "connection_open", kind: "message", oneof: "body", T: () => ConnectionOpen }, - { no: 5, name: "rpc_result", kind: "message", oneof: "body", T: () => RpcResult }, - { no: 6, name: "rpc_error", kind: "message", oneof: "body", T: () => RpcError }, - { no: 7, name: "message", kind: "message", oneof: "body", T: () => ServerMessage }, - { no: 8, name: "ack", kind: "message", oneof: "body", T: () => Ack }, - { no: 9, name: "pong", kind: "message", oneof: "body", T: () => Pong }, - { no: 10, name: "connection_error", kind: "message", oneof: "body", T: () => ConnectionError } - ]); - } - create(value?: PartialMessage): ServerProtocolMessage { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.body = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ServerProtocolMessage): ServerProtocolMessage { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* uint64 id */ 1: - message.id = reader.uint64().toBigInt(); - break; - case /* ConnectionOpen connection_open */ 4: - message.body = { - oneofKind: "connectionOpen", - connectionOpen: ConnectionOpen.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).connectionOpen) - }; - break; - case /* RpcResult rpc_result */ 5: - message.body = { - oneofKind: "rpcResult", - rpcResult: RpcResult.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).rpcResult) - }; - break; - case /* RpcError rpc_error */ 6: - message.body = { - oneofKind: "rpcError", - rpcError: RpcError.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).rpcError) - }; - break; - case /* ServerMessage message */ 7: - message.body = { - oneofKind: "message", - message: ServerMessage.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).message) - }; - break; - case /* Ack ack */ 8: - message.body = { - oneofKind: "ack", - ack: Ack.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).ack) - }; - break; - case /* Pong pong */ 9: - message.body = { - oneofKind: "pong", - pong: Pong.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).pong) - }; - break; - case /* ConnectionError connection_error */ 10: - message.body = { - oneofKind: "connectionError", - connectionError: ConnectionError.internalBinaryRead(reader, reader.uint32(), options, (message.body as any).connectionError) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: ServerProtocolMessage, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* uint64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).uint64(message.id); - /* ConnectionOpen connection_open = 4; */ - if (message.body.oneofKind === "connectionOpen") - ConnectionOpen.internalBinaryWrite(message.body.connectionOpen, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); - /* RpcResult rpc_result = 5; */ - if (message.body.oneofKind === "rpcResult") - RpcResult.internalBinaryWrite(message.body.rpcResult, writer.tag(5, WireType.LengthDelimited).fork(), options).join(); - /* RpcError rpc_error = 6; */ - if (message.body.oneofKind === "rpcError") - RpcError.internalBinaryWrite(message.body.rpcError, writer.tag(6, WireType.LengthDelimited).fork(), options).join(); - /* ServerMessage message = 7; */ - if (message.body.oneofKind === "message") - ServerMessage.internalBinaryWrite(message.body.message, writer.tag(7, WireType.LengthDelimited).fork(), options).join(); - /* Ack ack = 8; */ - if (message.body.oneofKind === "ack") - Ack.internalBinaryWrite(message.body.ack, writer.tag(8, WireType.LengthDelimited).fork(), options).join(); - /* Pong pong = 9; */ - if (message.body.oneofKind === "pong") - Pong.internalBinaryWrite(message.body.pong, writer.tag(9, WireType.LengthDelimited).fork(), options).join(); - /* ConnectionError connection_error = 10; */ - if (message.body.oneofKind === "connectionError") - ConnectionError.internalBinaryWrite(message.body.connectionError, writer.tag(10, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message ServerProtocolMessage - */ -export const ServerProtocolMessage = new ServerProtocolMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ServerMessage$Type extends MessageType { - constructor() { - super("ServerMessage", [ - { no: 4, name: "update", kind: "message", oneof: "payload", T: () => UpdatesPayload } - ]); - } - create(value?: PartialMessage): ServerMessage { - const message = globalThis.Object.create((this.messagePrototype!)); - message.payload = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ServerMessage): ServerMessage { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* UpdatesPayload update */ 4: - message.payload = { - oneofKind: "update", - update: UpdatesPayload.internalBinaryRead(reader, reader.uint32(), options, (message.payload as any).update) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: ServerMessage, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* UpdatesPayload update = 4; */ - if (message.payload.oneofKind === "update") - UpdatesPayload.internalBinaryWrite(message.payload.update, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message ServerMessage - */ -export const ServerMessage = new ServerMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class UpdatesPayload$Type extends MessageType { - constructor() { - super("UpdatesPayload", [ - { no: 1, name: "updates", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Update } - ]); - } - create(value?: PartialMessage): UpdatesPayload { - const message = globalThis.Object.create((this.messagePrototype!)); - message.updates = []; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdatesPayload): UpdatesPayload { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated Update updates */ 1: - message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: UpdatesPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated Update updates = 1; */ - for (let i = 0; i < message.updates.length; i++) - Update.internalBinaryWrite(message.updates[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message UpdatesPayload - */ -export const UpdatesPayload = new UpdatesPayload$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Ack$Type extends MessageType { - constructor() { - super("Ack", [ - { no: 1, name: "msg_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): Ack { - const message = globalThis.Object.create((this.messagePrototype!)); - message.msgId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Ack): Ack { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* uint64 msg_id */ 1: - message.msgId = reader.uint64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Ack, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* uint64 msg_id = 1; */ - if (message.msgId !== 0n) - writer.tag(1, WireType.Varint).uint64(message.msgId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Ack - */ -export const Ack = new Ack$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectionOpen$Type extends MessageType { - constructor() { - super("ConnectionOpen", []); - } - create(value?: PartialMessage): ConnectionOpen { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ConnectionOpen): ConnectionOpen { - return target ?? this.create(); - } - internalBinaryWrite(message: ConnectionOpen, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message ConnectionOpen - */ -export const ConnectionOpen = new ConnectionOpen$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectionError$Type extends MessageType { - constructor() { - super("ConnectionError", []); - } - create(value?: PartialMessage): ConnectionError { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ConnectionError): ConnectionError { - return target ?? this.create(); - } - internalBinaryWrite(message: ConnectionError, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message ConnectionError - */ -export const ConnectionError = new ConnectionError$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Ping$Type extends MessageType { - constructor() { - super("Ping", [ - { no: 1, name: "nonce", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): Ping { - const message = globalThis.Object.create((this.messagePrototype!)); - message.nonce = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Ping): Ping { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* uint64 nonce */ 1: - message.nonce = reader.uint64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Ping, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* uint64 nonce = 1; */ - if (message.nonce !== 0n) - writer.tag(1, WireType.Varint).uint64(message.nonce); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Ping - */ -export const Ping = new Ping$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Pong$Type extends MessageType { - constructor() { - super("Pong", [ - { no: 1, name: "nonce", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): Pong { - const message = globalThis.Object.create((this.messagePrototype!)); - message.nonce = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Pong): Pong { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* uint64 nonce */ 1: - message.nonce = reader.uint64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Pong, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* uint64 nonce = 1; */ - if (message.nonce !== 0n) - writer.tag(1, WireType.Varint).uint64(message.nonce); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Pong - */ -export const Pong = new Pong$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class InputPeer$Type extends MessageType { - constructor() { - super("InputPeer", [ - { no: 2, name: "self", kind: "message", oneof: "type", T: () => InputPeerSelf }, - { no: 3, name: "chat", kind: "message", oneof: "type", T: () => InputPeerChat }, - { no: 4, name: "user", kind: "message", oneof: "type", T: () => InputPeerUser } - ]); - } - create(value?: PartialMessage): InputPeer { - const message = globalThis.Object.create((this.messagePrototype!)); - message.type = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InputPeer): InputPeer { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* InputPeerSelf self */ 2: - message.type = { - oneofKind: "self", - self: InputPeerSelf.internalBinaryRead(reader, reader.uint32(), options, (message.type as any).self) - }; - break; - case /* InputPeerChat chat */ 3: - message.type = { - oneofKind: "chat", - chat: InputPeerChat.internalBinaryRead(reader, reader.uint32(), options, (message.type as any).chat) - }; - break; - case /* InputPeerUser user */ 4: - message.type = { - oneofKind: "user", - user: InputPeerUser.internalBinaryRead(reader, reader.uint32(), options, (message.type as any).user) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: InputPeer, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* InputPeerSelf self = 2; */ - if (message.type.oneofKind === "self") - InputPeerSelf.internalBinaryWrite(message.type.self, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); - /* InputPeerChat chat = 3; */ - if (message.type.oneofKind === "chat") - InputPeerChat.internalBinaryWrite(message.type.chat, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - /* InputPeerUser user = 4; */ - if (message.type.oneofKind === "user") - InputPeerUser.internalBinaryWrite(message.type.user, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message InputPeer - */ -export const InputPeer = new InputPeer$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class InputPeerSelf$Type extends MessageType { - constructor() { - super("InputPeerSelf", []); - } - create(value?: PartialMessage): InputPeerSelf { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InputPeerSelf): InputPeerSelf { - return target ?? this.create(); - } - internalBinaryWrite(message: InputPeerSelf, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message InputPeerSelf - */ -export const InputPeerSelf = new InputPeerSelf$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class InputPeerChat$Type extends MessageType { - constructor() { - super("InputPeerChat", [ - { no: 1, name: "chat_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): InputPeerChat { - const message = globalThis.Object.create((this.messagePrototype!)); - message.chatId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InputPeerChat): InputPeerChat { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 chat_id */ 1: - message.chatId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: InputPeerChat, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 chat_id = 1; */ - if (message.chatId !== 0n) - writer.tag(1, WireType.Varint).int64(message.chatId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message InputPeerChat - */ -export const InputPeerChat = new InputPeerChat$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class InputPeerUser$Type extends MessageType { - constructor() { - super("InputPeerUser", [ - { no: 1, name: "user_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): InputPeerUser { - const message = globalThis.Object.create((this.messagePrototype!)); - message.userId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InputPeerUser): InputPeerUser { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 user_id */ 1: - message.userId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: InputPeerUser, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 user_id = 1; */ - if (message.userId !== 0n) - writer.tag(1, WireType.Varint).int64(message.userId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message InputPeerUser - */ -export const InputPeerUser = new InputPeerUser$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Peer$Type extends MessageType { - constructor() { - super("Peer", [ - { no: 2, name: "chat", kind: "message", oneof: "type", T: () => PeerChat }, - { no: 3, name: "user", kind: "message", oneof: "type", T: () => PeerUser } - ]); - } - create(value?: PartialMessage): Peer { - const message = globalThis.Object.create((this.messagePrototype!)); - message.type = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Peer): Peer { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* PeerChat chat */ 2: - message.type = { - oneofKind: "chat", - chat: PeerChat.internalBinaryRead(reader, reader.uint32(), options, (message.type as any).chat) - }; - break; - case /* PeerUser user */ 3: - message.type = { - oneofKind: "user", - user: PeerUser.internalBinaryRead(reader, reader.uint32(), options, (message.type as any).user) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Peer, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* PeerChat chat = 2; */ - if (message.type.oneofKind === "chat") - PeerChat.internalBinaryWrite(message.type.chat, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); - /* PeerUser user = 3; */ - if (message.type.oneofKind === "user") - PeerUser.internalBinaryWrite(message.type.user, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Peer - */ -export const Peer = new Peer$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PeerChat$Type extends MessageType { - constructor() { - super("PeerChat", [ - { no: 1, name: "chat_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): PeerChat { - const message = globalThis.Object.create((this.messagePrototype!)); - message.chatId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PeerChat): PeerChat { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 chat_id */ 1: - message.chatId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: PeerChat, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 chat_id = 1; */ - if (message.chatId !== 0n) - writer.tag(1, WireType.Varint).int64(message.chatId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message PeerChat - */ -export const PeerChat = new PeerChat$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PeerUser$Type extends MessageType { - constructor() { - super("PeerUser", [ - { no: 1, name: "user_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): PeerUser { - const message = globalThis.Object.create((this.messagePrototype!)); - message.userId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PeerUser): PeerUser { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 user_id */ 1: - message.userId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: PeerUser, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 user_id = 1; */ - if (message.userId !== 0n) - writer.tag(1, WireType.Varint).int64(message.userId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message PeerUser - */ -export const PeerUser = new PeerUser$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class User$Type extends MessageType { - constructor() { - super("User", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "first_name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "last_name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "username", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "phone_number", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "email", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 7, name: "min", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 8, name: "status", kind: "message", T: () => UserStatus }, - { no: 9, name: "profile_photo", kind: "message", T: () => UserProfilePhoto }, - { no: 11, name: "pending_setup", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 12, name: "time_zone", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 13, name: "bot", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ } - ]); - } - create(value?: PartialMessage): User { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: User): User { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* optional string first_name */ 2: - message.firstName = reader.string(); - break; - case /* optional string last_name */ 3: - message.lastName = reader.string(); - break; - case /* optional string username */ 4: - message.username = reader.string(); - break; - case /* optional string phone_number */ 5: - message.phoneNumber = reader.string(); - break; - case /* optional string email */ 6: - message.email = reader.string(); - break; - case /* optional bool min */ 7: - message.min = reader.bool(); - break; - case /* optional UserStatus status */ 8: - message.status = UserStatus.internalBinaryRead(reader, reader.uint32(), options, message.status); - break; - case /* optional UserProfilePhoto profile_photo */ 9: - message.profilePhoto = UserProfilePhoto.internalBinaryRead(reader, reader.uint32(), options, message.profilePhoto); - break; - case /* optional bool pending_setup */ 11: - message.pendingSetup = reader.bool(); - break; - case /* optional string time_zone */ 12: - message.timeZone = reader.string(); - break; - case /* optional bool bot */ 13: - message.bot = reader.bool(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: User, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* optional string first_name = 2; */ - if (message.firstName !== undefined) - writer.tag(2, WireType.LengthDelimited).string(message.firstName); - /* optional string last_name = 3; */ - if (message.lastName !== undefined) - writer.tag(3, WireType.LengthDelimited).string(message.lastName); - /* optional string username = 4; */ - if (message.username !== undefined) - writer.tag(4, WireType.LengthDelimited).string(message.username); - /* optional string phone_number = 5; */ - if (message.phoneNumber !== undefined) - writer.tag(5, WireType.LengthDelimited).string(message.phoneNumber); - /* optional string email = 6; */ - if (message.email !== undefined) - writer.tag(6, WireType.LengthDelimited).string(message.email); - /* optional bool min = 7; */ - if (message.min !== undefined) - writer.tag(7, WireType.Varint).bool(message.min); - /* optional UserStatus status = 8; */ - if (message.status) - UserStatus.internalBinaryWrite(message.status, writer.tag(8, WireType.LengthDelimited).fork(), options).join(); - /* optional UserProfilePhoto profile_photo = 9; */ - if (message.profilePhoto) - UserProfilePhoto.internalBinaryWrite(message.profilePhoto, writer.tag(9, WireType.LengthDelimited).fork(), options).join(); - /* optional bool pending_setup = 11; */ - if (message.pendingSetup !== undefined) - writer.tag(11, WireType.Varint).bool(message.pendingSetup); - /* optional string time_zone = 12; */ - if (message.timeZone !== undefined) - writer.tag(12, WireType.LengthDelimited).string(message.timeZone); - /* optional bool bot = 13; */ - if (message.bot !== undefined) - writer.tag(13, WireType.Varint).bool(message.bot); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message User - */ -export const User = new User$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class UserProfilePhoto$Type extends MessageType { - constructor() { - super("UserProfilePhoto", [ - { no: 1, name: "photo_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "stripped_thumb", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, - { no: 3, name: "cdn_url", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "file_unique_id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } - create(value?: PartialMessage): UserProfilePhoto { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UserProfilePhoto): UserProfilePhoto { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* optional int64 photo_id */ 1: - message.photoId = reader.int64().toBigInt(); - break; - case /* optional bytes stripped_thumb */ 2: - message.strippedThumb = reader.bytes(); - break; - case /* optional string cdn_url */ 3: - message.cdnUrl = reader.string(); - break; - case /* optional string file_unique_id */ 4: - message.fileUniqueId = reader.string(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: UserProfilePhoto, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* optional int64 photo_id = 1; */ - if (message.photoId !== undefined) - writer.tag(1, WireType.Varint).int64(message.photoId); - /* optional bytes stripped_thumb = 2; */ - if (message.strippedThumb !== undefined) - writer.tag(2, WireType.LengthDelimited).bytes(message.strippedThumb); - /* optional string cdn_url = 3; */ - if (message.cdnUrl !== undefined) - writer.tag(3, WireType.LengthDelimited).string(message.cdnUrl); - /* optional string file_unique_id = 4; */ - if (message.fileUniqueId !== undefined) - writer.tag(4, WireType.LengthDelimited).string(message.fileUniqueId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message UserProfilePhoto - */ -export const UserProfilePhoto = new UserProfilePhoto$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Dialog$Type extends MessageType { - constructor() { - super("Dialog", [ - { no: 1, name: "peer", kind: "message", T: () => Peer }, - { no: 2, name: "space_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "archived", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 4, name: "pinned", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 5, name: "read_max_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 6, name: "unread_count", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ }, - { no: 7, name: "chat_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 8, name: "unread_mark", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ } - ]); - } - create(value?: PartialMessage): Dialog { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Dialog): Dialog { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* Peer peer */ 1: - message.peer = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peer); - break; - case /* optional int64 space_id */ 2: - message.spaceId = reader.int64().toBigInt(); - break; - case /* optional bool archived */ 3: - message.archived = reader.bool(); - break; - case /* optional bool pinned */ 4: - message.pinned = reader.bool(); - break; - case /* optional int64 read_max_id */ 5: - message.readMaxId = reader.int64().toBigInt(); - break; - case /* optional int32 unread_count */ 6: - message.unreadCount = reader.int32(); - break; - case /* optional int64 chat_id */ 7: - message.chatId = reader.int64().toBigInt(); - break; - case /* optional bool unread_mark */ 8: - message.unreadMark = reader.bool(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Dialog, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* Peer peer = 1; */ - if (message.peer) - Peer.internalBinaryWrite(message.peer, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - /* optional int64 space_id = 2; */ - if (message.spaceId !== undefined) - writer.tag(2, WireType.Varint).int64(message.spaceId); - /* optional bool archived = 3; */ - if (message.archived !== undefined) - writer.tag(3, WireType.Varint).bool(message.archived); - /* optional bool pinned = 4; */ - if (message.pinned !== undefined) - writer.tag(4, WireType.Varint).bool(message.pinned); - /* optional int64 read_max_id = 5; */ - if (message.readMaxId !== undefined) - writer.tag(5, WireType.Varint).int64(message.readMaxId); - /* optional int32 unread_count = 6; */ - if (message.unreadCount !== undefined) - writer.tag(6, WireType.Varint).int32(message.unreadCount); - /* optional int64 chat_id = 7; */ - if (message.chatId !== undefined) - writer.tag(7, WireType.Varint).int64(message.chatId); - /* optional bool unread_mark = 8; */ - if (message.unreadMark !== undefined) - writer.tag(8, WireType.Varint).bool(message.unreadMark); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Dialog - */ -export const Dialog = new Dialog$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Chat$Type extends MessageType { - constructor() { - super("Chat", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "title", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "space_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 4, name: "description", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "emoji", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "is_public", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 7, name: "last_msg_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 8, name: "peer_id", kind: "message", T: () => Peer }, - { no: 9, name: "date", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 10, name: "created_by", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): Chat { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.title = ""; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Chat): Chat { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* string title */ 2: - message.title = reader.string(); - break; - case /* optional int64 space_id */ 3: - message.spaceId = reader.int64().toBigInt(); - break; - case /* optional string description */ 4: - message.description = reader.string(); - break; - case /* optional string emoji */ 5: - message.emoji = reader.string(); - break; - case /* optional bool is_public */ 6: - message.isPublic = reader.bool(); - break; - case /* optional int64 last_msg_id */ 7: - message.lastMsgId = reader.int64().toBigInt(); - break; - case /* Peer peer_id */ 8: - message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId); - break; - case /* optional int64 date */ 9: - message.date = reader.int64().toBigInt(); - break; - case /* optional int64 created_by */ 10: - message.createdBy = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Chat, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* string title = 2; */ - if (message.title !== "") - writer.tag(2, WireType.LengthDelimited).string(message.title); - /* optional int64 space_id = 3; */ - if (message.spaceId !== undefined) - writer.tag(3, WireType.Varint).int64(message.spaceId); - /* optional string description = 4; */ - if (message.description !== undefined) - writer.tag(4, WireType.LengthDelimited).string(message.description); - /* optional string emoji = 5; */ - if (message.emoji !== undefined) - writer.tag(5, WireType.LengthDelimited).string(message.emoji); - /* optional bool is_public = 6; */ - if (message.isPublic !== undefined) - writer.tag(6, WireType.Varint).bool(message.isPublic); - /* optional int64 last_msg_id = 7; */ - if (message.lastMsgId !== undefined) - writer.tag(7, WireType.Varint).int64(message.lastMsgId); - /* Peer peer_id = 8; */ - if (message.peerId) - Peer.internalBinaryWrite(message.peerId, writer.tag(8, WireType.LengthDelimited).fork(), options).join(); - /* optional int64 date = 9; */ - if (message.date !== undefined) - writer.tag(9, WireType.Varint).int64(message.date); - /* optional int64 created_by = 10; */ - if (message.createdBy !== undefined) - writer.tag(10, WireType.Varint).int64(message.createdBy); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Chat - */ -export const Chat = new Chat$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Message$Type extends MessageType { - constructor() { - super("Message", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "from_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "peer_id", kind: "message", T: () => Peer }, - { no: 4, name: "chat_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 5, name: "message", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "out", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 7, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 8, name: "mentioned", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 9, name: "reply_to_msg_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 10, name: "media", kind: "message", T: () => MessageMedia }, - { no: 11, name: "edit_date", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 12, name: "grouped_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 13, name: "attachments", kind: "message", T: () => MessageAttachments }, - { no: 14, name: "reactions", kind: "message", T: () => MessageReactions }, - { no: 15, name: "is_sticker", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 6000, name: "has_link", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 16, name: "entities", kind: "message", T: () => MessageEntities }, - { no: 17, name: "send_mode", kind: "enum", opt: true, T: () => ["MessageSendMode", MessageSendMode] }, - { no: 18, name: "fwd_from", kind: "message", T: () => MessageFwdHeader } - ]); - } - create(value?: PartialMessage): Message { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.fromId = 0n; - message.chatId = 0n; - message.out = false; - message.date = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Message): Message { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* int64 from_id */ 2: - message.fromId = reader.int64().toBigInt(); - break; - case /* Peer peer_id */ 3: - message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId); - break; - case /* int64 chat_id */ 4: - message.chatId = reader.int64().toBigInt(); - break; - case /* optional string message */ 5: - message.message = reader.string(); - break; - case /* bool out */ 6: - message.out = reader.bool(); - break; - case /* int64 date */ 7: - message.date = reader.int64().toBigInt(); - break; - case /* optional bool mentioned */ 8: - message.mentioned = reader.bool(); - break; - case /* optional int64 reply_to_msg_id */ 9: - message.replyToMsgId = reader.int64().toBigInt(); - break; - case /* optional MessageMedia media */ 10: - message.media = MessageMedia.internalBinaryRead(reader, reader.uint32(), options, message.media); - break; - case /* optional int64 edit_date */ 11: - message.editDate = reader.int64().toBigInt(); - break; - case /* optional int64 grouped_id */ 12: - message.groupedId = reader.int64().toBigInt(); - break; - case /* optional MessageAttachments attachments */ 13: - message.attachments = MessageAttachments.internalBinaryRead(reader, reader.uint32(), options, message.attachments); - break; - case /* optional MessageReactions reactions */ 14: - message.reactions = MessageReactions.internalBinaryRead(reader, reader.uint32(), options, message.reactions); - break; - case /* optional bool is_sticker */ 15: - message.isSticker = reader.bool(); - break; - case /* optional bool has_link */ 6000: - message.hasLink = reader.bool(); - break; - case /* optional MessageEntities entities */ 16: - message.entities = MessageEntities.internalBinaryRead(reader, reader.uint32(), options, message.entities); - break; - case /* optional MessageSendMode send_mode */ 17: - message.sendMode = reader.int32(); - break; - case /* optional MessageFwdHeader fwd_from */ 18: - message.fwdFrom = MessageFwdHeader.internalBinaryRead(reader, reader.uint32(), options, message.fwdFrom); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Message, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* int64 from_id = 2; */ - if (message.fromId !== 0n) - writer.tag(2, WireType.Varint).int64(message.fromId); - /* Peer peer_id = 3; */ - if (message.peerId) - Peer.internalBinaryWrite(message.peerId, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - /* int64 chat_id = 4; */ - if (message.chatId !== 0n) - writer.tag(4, WireType.Varint).int64(message.chatId); - /* optional string message = 5; */ - if (message.message !== undefined) - writer.tag(5, WireType.LengthDelimited).string(message.message); - /* bool out = 6; */ - if (message.out !== false) - writer.tag(6, WireType.Varint).bool(message.out); - /* int64 date = 7; */ - if (message.date !== 0n) - writer.tag(7, WireType.Varint).int64(message.date); - /* optional bool mentioned = 8; */ - if (message.mentioned !== undefined) - writer.tag(8, WireType.Varint).bool(message.mentioned); - /* optional int64 reply_to_msg_id = 9; */ - if (message.replyToMsgId !== undefined) - writer.tag(9, WireType.Varint).int64(message.replyToMsgId); - /* optional MessageMedia media = 10; */ - if (message.media) - MessageMedia.internalBinaryWrite(message.media, writer.tag(10, WireType.LengthDelimited).fork(), options).join(); - /* optional int64 edit_date = 11; */ - if (message.editDate !== undefined) - writer.tag(11, WireType.Varint).int64(message.editDate); - /* optional int64 grouped_id = 12; */ - if (message.groupedId !== undefined) - writer.tag(12, WireType.Varint).int64(message.groupedId); - /* optional MessageAttachments attachments = 13; */ - if (message.attachments) - MessageAttachments.internalBinaryWrite(message.attachments, writer.tag(13, WireType.LengthDelimited).fork(), options).join(); - /* optional MessageReactions reactions = 14; */ - if (message.reactions) - MessageReactions.internalBinaryWrite(message.reactions, writer.tag(14, WireType.LengthDelimited).fork(), options).join(); - /* optional bool is_sticker = 15; */ - if (message.isSticker !== undefined) - writer.tag(15, WireType.Varint).bool(message.isSticker); - /* optional bool has_link = 6000; */ - if (message.hasLink !== undefined) - writer.tag(6000, WireType.Varint).bool(message.hasLink); - /* optional MessageEntities entities = 16; */ - if (message.entities) - MessageEntities.internalBinaryWrite(message.entities, writer.tag(16, WireType.LengthDelimited).fork(), options).join(); - /* optional MessageSendMode send_mode = 17; */ - if (message.sendMode !== undefined) - writer.tag(17, WireType.Varint).int32(message.sendMode); - /* optional MessageFwdHeader fwd_from = 18; */ - if (message.fwdFrom) - MessageFwdHeader.internalBinaryWrite(message.fwdFrom, writer.tag(18, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Message - */ -export const Message = new Message$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageFwdHeader$Type extends MessageType { - constructor() { - super("MessageFwdHeader", [ - { no: 1, name: "from_peer_id", kind: "message", T: () => Peer }, - { no: 2, name: "from_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "from_message_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): MessageFwdHeader { - const message = globalThis.Object.create((this.messagePrototype!)); - message.fromId = 0n; - message.fromMessageId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageFwdHeader): MessageFwdHeader { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* Peer from_peer_id */ 1: - message.fromPeerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.fromPeerId); - break; - case /* int64 from_id */ 2: - message.fromId = reader.int64().toBigInt(); - break; - case /* int64 from_message_id */ 3: - message.fromMessageId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageFwdHeader, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* Peer from_peer_id = 1; */ - if (message.fromPeerId) - Peer.internalBinaryWrite(message.fromPeerId, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - /* int64 from_id = 2; */ - if (message.fromId !== 0n) - writer.tag(2, WireType.Varint).int64(message.fromId); - /* int64 from_message_id = 3; */ - if (message.fromMessageId !== 0n) - writer.tag(3, WireType.Varint).int64(message.fromMessageId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageFwdHeader - */ -export const MessageFwdHeader = new MessageFwdHeader$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageEntities$Type extends MessageType { - constructor() { - super("MessageEntities", [ - { no: 1, name: "entities", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => MessageEntity } - ]); - } - create(value?: PartialMessage): MessageEntities { - const message = globalThis.Object.create((this.messagePrototype!)); - message.entities = []; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageEntities): MessageEntities { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated MessageEntity entities */ 1: - message.entities.push(MessageEntity.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageEntities, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated MessageEntity entities = 1; */ - for (let i = 0; i < message.entities.length; i++) - MessageEntity.internalBinaryWrite(message.entities[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageEntities - */ -export const MessageEntities = new MessageEntities$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageEntity$Type extends MessageType { - constructor() { - super("MessageEntity", [ - { no: 1, name: "type", kind: "enum", T: () => ["MessageEntity.Type", MessageEntity_Type, "TYPE_"] }, - { no: 2, name: "offset", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "length", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 4, name: "mention", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityMention }, - { no: 5, name: "text_url", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityTextUrl }, - { no: 6, name: "pre", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityPre } - ]); - } - create(value?: PartialMessage): MessageEntity { - const message = globalThis.Object.create((this.messagePrototype!)); - message.type = 0; - message.offset = 0n; - message.length = 0n; - message.entity = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageEntity): MessageEntity { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* MessageEntity.Type type */ 1: - message.type = reader.int32(); - break; - case /* int64 offset */ 2: - message.offset = reader.int64().toBigInt(); - break; - case /* int64 length */ 3: - message.length = reader.int64().toBigInt(); - break; - case /* MessageEntity.MessageEntityMention mention */ 4: - message.entity = { - oneofKind: "mention", - mention: MessageEntity_MessageEntityMention.internalBinaryRead(reader, reader.uint32(), options, (message.entity as any).mention) - }; - break; - case /* MessageEntity.MessageEntityTextUrl text_url */ 5: - message.entity = { - oneofKind: "textUrl", - textUrl: MessageEntity_MessageEntityTextUrl.internalBinaryRead(reader, reader.uint32(), options, (message.entity as any).textUrl) - }; - break; - case /* MessageEntity.MessageEntityPre pre */ 6: - message.entity = { - oneofKind: "pre", - pre: MessageEntity_MessageEntityPre.internalBinaryRead(reader, reader.uint32(), options, (message.entity as any).pre) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageEntity, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* MessageEntity.Type type = 1; */ - if (message.type !== 0) - writer.tag(1, WireType.Varint).int32(message.type); - /* int64 offset = 2; */ - if (message.offset !== 0n) - writer.tag(2, WireType.Varint).int64(message.offset); - /* int64 length = 3; */ - if (message.length !== 0n) - writer.tag(3, WireType.Varint).int64(message.length); - /* MessageEntity.MessageEntityMention mention = 4; */ - if (message.entity.oneofKind === "mention") - MessageEntity_MessageEntityMention.internalBinaryWrite(message.entity.mention, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); - /* MessageEntity.MessageEntityTextUrl text_url = 5; */ - if (message.entity.oneofKind === "textUrl") - MessageEntity_MessageEntityTextUrl.internalBinaryWrite(message.entity.textUrl, writer.tag(5, WireType.LengthDelimited).fork(), options).join(); - /* MessageEntity.MessageEntityPre pre = 6; */ - if (message.entity.oneofKind === "pre") - MessageEntity_MessageEntityPre.internalBinaryWrite(message.entity.pre, writer.tag(6, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageEntity - */ -export const MessageEntity = new MessageEntity$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageEntity_MessageEntityMention$Type extends MessageType { - constructor() { - super("MessageEntity.MessageEntityMention", [ - { no: 1, name: "user_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): MessageEntity_MessageEntityMention { - const message = globalThis.Object.create((this.messagePrototype!)); - message.userId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageEntity_MessageEntityMention): MessageEntity_MessageEntityMention { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 user_id */ 1: - message.userId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageEntity_MessageEntityMention, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 user_id = 1; */ - if (message.userId !== 0n) - writer.tag(1, WireType.Varint).int64(message.userId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageEntity.MessageEntityMention - */ -export const MessageEntity_MessageEntityMention = new MessageEntity_MessageEntityMention$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageEntity_MessageEntityTextUrl$Type extends MessageType { - constructor() { - super("MessageEntity.MessageEntityTextUrl", [ - { no: 1, name: "url", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } - create(value?: PartialMessage): MessageEntity_MessageEntityTextUrl { - const message = globalThis.Object.create((this.messagePrototype!)); - message.url = ""; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageEntity_MessageEntityTextUrl): MessageEntity_MessageEntityTextUrl { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string url */ 1: - message.url = reader.string(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageEntity_MessageEntityTextUrl, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string url = 1; */ - if (message.url !== "") - writer.tag(1, WireType.LengthDelimited).string(message.url); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageEntity.MessageEntityTextUrl - */ -export const MessageEntity_MessageEntityTextUrl = new MessageEntity_MessageEntityTextUrl$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageEntity_MessageEntityPre$Type extends MessageType { - constructor() { - super("MessageEntity.MessageEntityPre", [ - { no: 1, name: "language", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } - create(value?: PartialMessage): MessageEntity_MessageEntityPre { - const message = globalThis.Object.create((this.messagePrototype!)); - message.language = ""; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageEntity_MessageEntityPre): MessageEntity_MessageEntityPre { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string language */ 1: - message.language = reader.string(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageEntity_MessageEntityPre, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string language = 1; */ - if (message.language !== "") - writer.tag(1, WireType.LengthDelimited).string(message.language); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageEntity.MessageEntityPre - */ -export const MessageEntity_MessageEntityPre = new MessageEntity_MessageEntityPre$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageReactions$Type extends MessageType { - constructor() { - super("MessageReactions", [ - { no: 1, name: "reactions", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Reaction } - ]); - } - create(value?: PartialMessage): MessageReactions { - const message = globalThis.Object.create((this.messagePrototype!)); - message.reactions = []; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageReactions): MessageReactions { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated Reaction reactions */ 1: - message.reactions.push(Reaction.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageReactions, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated Reaction reactions = 1; */ - for (let i = 0; i < message.reactions.length; i++) - Reaction.internalBinaryWrite(message.reactions[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageReactions - */ -export const MessageReactions = new MessageReactions$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Reaction$Type extends MessageType { - constructor() { - super("Reaction", [ - { no: 1, name: "emoji", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "user_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "message_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 4, name: "chat_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 5, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): Reaction { - const message = globalThis.Object.create((this.messagePrototype!)); - message.emoji = ""; - message.userId = 0n; - message.messageId = 0n; - message.chatId = 0n; - message.date = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Reaction): Reaction { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string emoji */ 1: - message.emoji = reader.string(); - break; - case /* int64 user_id */ 2: - message.userId = reader.int64().toBigInt(); - break; - case /* int64 message_id */ 3: - message.messageId = reader.int64().toBigInt(); - break; - case /* int64 chat_id */ 4: - message.chatId = reader.int64().toBigInt(); - break; - case /* int64 date */ 5: - message.date = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Reaction, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string emoji = 1; */ - if (message.emoji !== "") - writer.tag(1, WireType.LengthDelimited).string(message.emoji); - /* int64 user_id = 2; */ - if (message.userId !== 0n) - writer.tag(2, WireType.Varint).int64(message.userId); - /* int64 message_id = 3; */ - if (message.messageId !== 0n) - writer.tag(3, WireType.Varint).int64(message.messageId); - /* int64 chat_id = 4; */ - if (message.chatId !== 0n) - writer.tag(4, WireType.Varint).int64(message.chatId); - /* int64 date = 5; */ - if (message.date !== 0n) - writer.tag(5, WireType.Varint).int64(message.date); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Reaction - */ -export const Reaction = new Reaction$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Member$Type extends MessageType { - constructor() { - super("Member", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "space_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "user_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 4, name: "role", kind: "enum", opt: true, T: () => ["Member.Role", Member_Role] }, - { no: 5, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 6, name: "can_access_public_chats", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } - create(value?: PartialMessage): Member { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.spaceId = 0n; - message.userId = 0n; - message.date = 0n; - message.canAccessPublicChats = false; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Member): Member { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* int64 space_id */ 2: - message.spaceId = reader.int64().toBigInt(); - break; - case /* int64 user_id */ 3: - message.userId = reader.int64().toBigInt(); - break; - case /* optional Member.Role role */ 4: - message.role = reader.int32(); - break; - case /* int64 date */ 5: - message.date = reader.int64().toBigInt(); - break; - case /* bool can_access_public_chats */ 6: - message.canAccessPublicChats = reader.bool(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Member, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* int64 space_id = 2; */ - if (message.spaceId !== 0n) - writer.tag(2, WireType.Varint).int64(message.spaceId); - /* int64 user_id = 3; */ - if (message.userId !== 0n) - writer.tag(3, WireType.Varint).int64(message.userId); - /* optional Member.Role role = 4; */ - if (message.role !== undefined) - writer.tag(4, WireType.Varint).int32(message.role); - /* int64 date = 5; */ - if (message.date !== 0n) - writer.tag(5, WireType.Varint).int64(message.date); - /* bool can_access_public_chats = 6; */ - if (message.canAccessPublicChats !== false) - writer.tag(6, WireType.Varint).bool(message.canAccessPublicChats); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Member - */ -export const Member = new Member$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Space$Type extends MessageType { - constructor() { - super("Space", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "creator", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 4, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): Space { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.name = ""; - message.creator = false; - message.date = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Space): Space { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* string name */ 2: - message.name = reader.string(); - break; - case /* bool creator */ 3: - message.creator = reader.bool(); - break; - case /* int64 date */ 4: - message.date = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Space, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* string name = 2; */ - if (message.name !== "") - writer.tag(2, WireType.LengthDelimited).string(message.name); - /* bool creator = 3; */ - if (message.creator !== false) - writer.tag(3, WireType.Varint).bool(message.creator); - /* int64 date = 4; */ - if (message.date !== 0n) - writer.tag(4, WireType.Varint).int64(message.date); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message Space - */ -export const Space = new Space$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class AddReactionInput$Type extends MessageType { - constructor() { - super("AddReactionInput", [ - { no: 1, name: "emoji", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "message_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 3, name: "peer_id", kind: "message", T: () => InputPeer } - ]); - } - create(value?: PartialMessage): AddReactionInput { - const message = globalThis.Object.create((this.messagePrototype!)); - message.emoji = ""; - message.messageId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddReactionInput): AddReactionInput { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string emoji */ 1: - message.emoji = reader.string(); - break; - case /* int64 message_id */ 2: - message.messageId = reader.int64().toBigInt(); - break; - case /* InputPeer peer_id */ 3: - message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: AddReactionInput, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string emoji = 1; */ - if (message.emoji !== "") - writer.tag(1, WireType.LengthDelimited).string(message.emoji); - /* int64 message_id = 2; */ - if (message.messageId !== 0n) - writer.tag(2, WireType.Varint).int64(message.messageId); - /* InputPeer peer_id = 3; */ - if (message.peerId) - InputPeer.internalBinaryWrite(message.peerId, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message AddReactionInput - */ -export const AddReactionInput = new AddReactionInput$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class AddReactionResult$Type extends MessageType { - constructor() { - super("AddReactionResult", [ - { no: 1, name: "updates", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Update } - ]); - } - create(value?: PartialMessage): AddReactionResult { - const message = globalThis.Object.create((this.messagePrototype!)); - message.updates = []; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddReactionResult): AddReactionResult { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated Update updates */ 1: - message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: AddReactionResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated Update updates = 1; */ - for (let i = 0; i < message.updates.length; i++) - Update.internalBinaryWrite(message.updates[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message AddReactionResult - */ -export const AddReactionResult = new AddReactionResult$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class DeleteReactionInput$Type extends MessageType { - constructor() { - super("DeleteReactionInput", [ - { no: 1, name: "emoji", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "peer_id", kind: "message", T: () => InputPeer }, - { no: 3, name: "message_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): DeleteReactionInput { - const message = globalThis.Object.create((this.messagePrototype!)); - message.emoji = ""; - message.messageId = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteReactionInput): DeleteReactionInput { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string emoji */ 1: - message.emoji = reader.string(); - break; - case /* InputPeer peer_id */ 2: - message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId); - break; - case /* int64 message_id */ 3: - message.messageId = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: DeleteReactionInput, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string emoji = 1; */ - if (message.emoji !== "") - writer.tag(1, WireType.LengthDelimited).string(message.emoji); - /* InputPeer peer_id = 2; */ - if (message.peerId) - InputPeer.internalBinaryWrite(message.peerId, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); - /* int64 message_id = 3; */ - if (message.messageId !== 0n) - writer.tag(3, WireType.Varint).int64(message.messageId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message DeleteReactionInput - */ -export const DeleteReactionInput = new DeleteReactionInput$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class DeleteReactionResult$Type extends MessageType { - constructor() { - super("DeleteReactionResult", [ - { no: 1, name: "updates", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Update } - ]); - } - create(value?: PartialMessage): DeleteReactionResult { - const message = globalThis.Object.create((this.messagePrototype!)); - message.updates = []; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteReactionResult): DeleteReactionResult { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated Update updates */ 1: - message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: DeleteReactionResult, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated Update updates = 1; */ - for (let i = 0; i < message.updates.length; i++) - Update.internalBinaryWrite(message.updates[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message DeleteReactionResult - */ -export const DeleteReactionResult = new DeleteReactionResult$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageAttachments$Type extends MessageType { - constructor() { - super("MessageAttachments", [ - { no: 1, name: "attachments", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => MessageAttachment } - ]); - } - create(value?: PartialMessage): MessageAttachments { - const message = globalThis.Object.create((this.messagePrototype!)); - message.attachments = []; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageAttachments): MessageAttachments { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated MessageAttachment attachments */ 1: - message.attachments.push(MessageAttachment.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageAttachments, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated MessageAttachment attachments = 1; */ - for (let i = 0; i < message.attachments.length; i++) - MessageAttachment.internalBinaryWrite(message.attachments[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageAttachments - */ -export const MessageAttachments = new MessageAttachments$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageAttachment$Type extends MessageType { - constructor() { - super("MessageAttachment", [ - { no: 4, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "external_task", kind: "message", oneof: "attachment", T: () => MessageAttachmentExternalTask }, - { no: 3, name: "url_preview", kind: "message", oneof: "attachment", T: () => UrlPreview } - ]); - } - create(value?: PartialMessage): MessageAttachment { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.attachment = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageAttachment): MessageAttachment { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 4: - message.id = reader.int64().toBigInt(); - break; - case /* MessageAttachmentExternalTask external_task */ 2: - message.attachment = { - oneofKind: "externalTask", - externalTask: MessageAttachmentExternalTask.internalBinaryRead(reader, reader.uint32(), options, (message.attachment as any).externalTask) - }; - break; - case /* UrlPreview url_preview */ 3: - message.attachment = { - oneofKind: "urlPreview", - urlPreview: UrlPreview.internalBinaryRead(reader, reader.uint32(), options, (message.attachment as any).urlPreview) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageAttachment, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 4; */ - if (message.id !== 0n) - writer.tag(4, WireType.Varint).int64(message.id); - /* MessageAttachmentExternalTask external_task = 2; */ - if (message.attachment.oneofKind === "externalTask") - MessageAttachmentExternalTask.internalBinaryWrite(message.attachment.externalTask, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); - /* UrlPreview url_preview = 3; */ - if (message.attachment.oneofKind === "urlPreview") - UrlPreview.internalBinaryWrite(message.attachment.urlPreview, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageAttachment - */ -export const MessageAttachment = new MessageAttachment$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class UrlPreview$Type extends MessageType { - constructor() { - super("UrlPreview", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "url", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "site_name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "title", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "description", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "photo", kind: "message", T: () => Photo }, - { no: 7, name: "duration", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): UrlPreview { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UrlPreview): UrlPreview { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* optional string url */ 2: - message.url = reader.string(); - break; - case /* optional string site_name */ 3: - message.siteName = reader.string(); - break; - case /* optional string title */ 4: - message.title = reader.string(); - break; - case /* optional string description */ 5: - message.description = reader.string(); - break; - case /* optional Photo photo */ 6: - message.photo = Photo.internalBinaryRead(reader, reader.uint32(), options, message.photo); - break; - case /* optional int64 duration */ 7: - message.duration = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: UrlPreview, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* optional string url = 2; */ - if (message.url !== undefined) - writer.tag(2, WireType.LengthDelimited).string(message.url); - /* optional string site_name = 3; */ - if (message.siteName !== undefined) - writer.tag(3, WireType.LengthDelimited).string(message.siteName); - /* optional string title = 4; */ - if (message.title !== undefined) - writer.tag(4, WireType.LengthDelimited).string(message.title); - /* optional string description = 5; */ - if (message.description !== undefined) - writer.tag(5, WireType.LengthDelimited).string(message.description); - /* optional Photo photo = 6; */ - if (message.photo) - Photo.internalBinaryWrite(message.photo, writer.tag(6, WireType.LengthDelimited).fork(), options).join(); - /* optional int64 duration = 7; */ - if (message.duration !== undefined) - writer.tag(7, WireType.Varint).int64(message.duration); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message UrlPreview - */ -export const UrlPreview = new UrlPreview$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageAttachmentExternalTask$Type extends MessageType { - constructor() { - super("MessageAttachmentExternalTask", [ - { no: 1, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 2, name: "task_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "application", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "title", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "status", kind: "enum", T: () => ["MessageAttachmentExternalTask.Status", MessageAttachmentExternalTask_Status, "STATUS_"] }, - { no: 6, name: "assigned_user_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, - { no: 7, name: "url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 8, name: "number", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 9, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } - ]); - } - create(value?: PartialMessage): MessageAttachmentExternalTask { - const message = globalThis.Object.create((this.messagePrototype!)); - message.id = 0n; - message.taskId = ""; - message.application = ""; - message.title = ""; - message.status = 0; - message.assignedUserId = 0n; - message.url = ""; - message.number = ""; - message.date = 0n; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageAttachmentExternalTask): MessageAttachmentExternalTask { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 id */ 1: - message.id = reader.int64().toBigInt(); - break; - case /* string task_id */ 2: - message.taskId = reader.string(); - break; - case /* string application */ 3: - message.application = reader.string(); - break; - case /* string title */ 4: - message.title = reader.string(); - break; - case /* MessageAttachmentExternalTask.Status status */ 5: - message.status = reader.int32(); - break; - case /* int64 assigned_user_id */ 6: - message.assignedUserId = reader.int64().toBigInt(); - break; - case /* string url */ 7: - message.url = reader.string(); - break; - case /* string number */ 8: - message.number = reader.string(); - break; - case /* int64 date */ 9: - message.date = reader.int64().toBigInt(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageAttachmentExternalTask, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 id = 1; */ - if (message.id !== 0n) - writer.tag(1, WireType.Varint).int64(message.id); - /* string task_id = 2; */ - if (message.taskId !== "") - writer.tag(2, WireType.LengthDelimited).string(message.taskId); - /* string application = 3; */ - if (message.application !== "") - writer.tag(3, WireType.LengthDelimited).string(message.application); - /* string title = 4; */ - if (message.title !== "") - writer.tag(4, WireType.LengthDelimited).string(message.title); - /* MessageAttachmentExternalTask.Status status = 5; */ - if (message.status !== 0) - writer.tag(5, WireType.Varint).int32(message.status); - /* int64 assigned_user_id = 6; */ - if (message.assignedUserId !== 0n) - writer.tag(6, WireType.Varint).int64(message.assignedUserId); - /* string url = 7; */ - if (message.url !== "") - writer.tag(7, WireType.LengthDelimited).string(message.url); - /* string number = 8; */ - if (message.number !== "") - writer.tag(8, WireType.LengthDelimited).string(message.number); - /* int64 date = 9; */ - if (message.date !== 0n) - writer.tag(9, WireType.Varint).int64(message.date); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageAttachmentExternalTask - */ -export const MessageAttachmentExternalTask = new MessageAttachmentExternalTask$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageMedia$Type extends MessageType { - constructor() { - super("MessageMedia", [ - { no: 1, name: "photo", kind: "message", oneof: "media", T: () => MessagePhoto }, - { no: 2, name: "video", kind: "message", oneof: "media", T: () => MessageVideo }, - { no: 3, name: "document", kind: "message", oneof: "media", T: () => MessageDocument }, - { no: 4, name: "nudge", kind: "message", oneof: "media", T: () => MessageNudge } - ]); - } - create(value?: PartialMessage): MessageMedia { - const message = globalThis.Object.create((this.messagePrototype!)); - message.media = { oneofKind: undefined }; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageMedia): MessageMedia { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* MessagePhoto photo */ 1: - message.media = { - oneofKind: "photo", - photo: MessagePhoto.internalBinaryRead(reader, reader.uint32(), options, (message.media as any).photo) - }; - break; - case /* MessageVideo video */ 2: - message.media = { - oneofKind: "video", - video: MessageVideo.internalBinaryRead(reader, reader.uint32(), options, (message.media as any).video) - }; - break; - case /* MessageDocument document */ 3: - message.media = { - oneofKind: "document", - document: MessageDocument.internalBinaryRead(reader, reader.uint32(), options, (message.media as any).document) - }; - break; - case /* MessageNudge nudge */ 4: - message.media = { - oneofKind: "nudge", - nudge: MessageNudge.internalBinaryRead(reader, reader.uint32(), options, (message.media as any).nudge) - }; - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageMedia, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* MessagePhoto photo = 1; */ - if (message.media.oneofKind === "photo") - MessagePhoto.internalBinaryWrite(message.media.photo, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - /* MessageVideo video = 2; */ - if (message.media.oneofKind === "video") - MessageVideo.internalBinaryWrite(message.media.video, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); - /* MessageDocument document = 3; */ - if (message.media.oneofKind === "document") - MessageDocument.internalBinaryWrite(message.media.document, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); - /* MessageNudge nudge = 4; */ - if (message.media.oneofKind === "nudge") - MessageNudge.internalBinaryWrite(message.media.nudge, writer.tag(4, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageMedia - */ -export const MessageMedia = new MessageMedia$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessagePhoto$Type extends MessageType { - constructor() { - super("MessagePhoto", [ - { no: 1, name: "photo", kind: "message", T: () => Photo } - ]); - } - create(value?: PartialMessage): MessagePhoto { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessagePhoto): MessagePhoto { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* Photo photo */ 1: - message.photo = Photo.internalBinaryRead(reader, reader.uint32(), options, message.photo); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessagePhoto, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* Photo photo = 1; */ - if (message.photo) - Photo.internalBinaryWrite(message.photo, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessagePhoto - */ -export const MessagePhoto = new MessagePhoto$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageVideo$Type extends MessageType { - constructor() { - super("MessageVideo", [ - { no: 1, name: "video", kind: "message", T: () => Video } - ]); - } - create(value?: PartialMessage): MessageVideo { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageVideo): MessageVideo { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* Video video */ 1: - message.video = Video.internalBinaryRead(reader, reader.uint32(), options, message.video); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageVideo, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* Video video = 1; */ - if (message.video) - Video.internalBinaryWrite(message.video, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageVideo - */ -export const MessageVideo = new MessageVideo$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageDocument$Type extends MessageType { - constructor() { - super("MessageDocument", [ - { no: 1, name: "document", kind: "message", T: () => Document } - ]); - } - create(value?: PartialMessage): MessageDocument { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageDocument): MessageDocument { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* Document document */ 1: - message.document = Document.internalBinaryRead(reader, reader.uint32(), options, message.document); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: MessageDocument, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* Document document = 1; */ - if (message.document) - Document.internalBinaryWrite(message.document, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageDocument - */ -export const MessageDocument = new MessageDocument$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageNudge$Type extends MessageType { - constructor() { - super("MessageNudge", []); - } - create(value?: PartialMessage): MessageNudge { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageNudge): MessageNudge { - return target ?? this.create(); - } - internalBinaryWrite(message: MessageNudge, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message MessageNudge - */ -export const MessageNudge = new MessageNudge$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Video$Type extends MessageType