diff --git a/.pnp.cjs b/.pnp.cjs index 9ee2c2e5..db2ddb9a 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -46,6 +46,134 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "SOFT", }] ]], + ["@protobufjs/aspromise", [ + ["npm:1.1.2", { + "packageLocation": "./.yarn/cache/@protobufjs-aspromise-npm-1.1.2-71d00b938f-011fe7ef08.zip/node_modules/@protobufjs/aspromise/", + "packageDependencies": [ + ["@protobufjs/aspromise", "npm:1.1.2"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/base64", [ + ["npm:1.1.2", { + "packageLocation": "./.yarn/cache/@protobufjs-base64-npm-1.1.2-cd8ca6814a-67173ac34d.zip/node_modules/@protobufjs/base64/", + "packageDependencies": [ + ["@protobufjs/base64", "npm:1.1.2"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/codegen", [ + ["npm:2.0.4", { + "packageLocation": "./.yarn/cache/@protobufjs-codegen-npm-2.0.4-36e188bbe6-59240c850b.zip/node_modules/@protobufjs/codegen/", + "packageDependencies": [ + ["@protobufjs/codegen", "npm:2.0.4"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/eventemitter", [ + ["npm:1.1.0", { + "packageLocation": "./.yarn/cache/@protobufjs-eventemitter-npm-1.1.0-029cc7d431-0369163a3d.zip/node_modules/@protobufjs/eventemitter/", + "packageDependencies": [ + ["@protobufjs/eventemitter", "npm:1.1.0"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/fetch", [ + ["npm:1.1.0", { + "packageLocation": "./.yarn/cache/@protobufjs-fetch-npm-1.1.0-ca857b7df4-3fce7e09eb.zip/node_modules/@protobufjs/fetch/", + "packageDependencies": [ + ["@protobufjs/fetch", "npm:1.1.0"], + ["@protobufjs/aspromise", "npm:1.1.2"], + ["@protobufjs/inquire", "npm:1.1.0"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/float", [ + ["npm:1.0.2", { + "packageLocation": "./.yarn/cache/@protobufjs-float-npm-1.0.2-5678f64d08-5781e12412.zip/node_modules/@protobufjs/float/", + "packageDependencies": [ + ["@protobufjs/float", "npm:1.0.2"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/inquire", [ + ["npm:1.1.0", { + "packageLocation": "./.yarn/cache/@protobufjs-inquire-npm-1.1.0-3c7759e9ce-ca06f02eaf.zip/node_modules/@protobufjs/inquire/", + "packageDependencies": [ + ["@protobufjs/inquire", "npm:1.1.0"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/path", [ + ["npm:1.1.2", { + "packageLocation": "./.yarn/cache/@protobufjs-path-npm-1.1.2-641d08de76-856eeb532b.zip/node_modules/@protobufjs/path/", + "packageDependencies": [ + ["@protobufjs/path", "npm:1.1.2"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/pool", [ + ["npm:1.1.0", { + "packageLocation": "./.yarn/cache/@protobufjs-pool-npm-1.1.0-47a76f96a1-d6a34fbbd2.zip/node_modules/@protobufjs/pool/", + "packageDependencies": [ + ["@protobufjs/pool", "npm:1.1.0"] + ], + "linkType": "HARD", + }] + ]], + ["@protobufjs/utf8", [ + ["npm:1.1.0", { + "packageLocation": "./.yarn/cache/@protobufjs-utf8-npm-1.1.0-02c590807c-f9bf3163d1.zip/node_modules/@protobufjs/utf8/", + "packageDependencies": [ + ["@protobufjs/utf8", "npm:1.1.0"] + ], + "linkType": "HARD", + }] + ]], + ["@types/long", [ + ["npm:4.0.1", { + "packageLocation": "./.yarn/cache/@types-long-npm-4.0.1-022c8b6e77-ff9653c33f.zip/node_modules/@types/long/", + "packageDependencies": [ + ["@types/long", "npm:4.0.1"] + ], + "linkType": "HARD", + }] + ]], + ["@types/node", [ + ["npm:16.9.1", { + "packageLocation": "./.yarn/cache/@types-node-npm-16.9.1-bde6d3b0c9-41afcf183a.zip/node_modules/@types/node/", + "packageDependencies": [ + ["@types/node", "npm:16.9.1"] + ], + "linkType": "HARD", + }] + ]], + ["@types/object-hash", [ + ["npm:1.3.4", { + "packageLocation": "./.yarn/cache/@types-object-hash-npm-1.3.4-3b3e2e44e8-fe4aa04142.zip/node_modules/@types/object-hash/", + "packageDependencies": [ + ["@types/object-hash", "npm:1.3.4"] + ], + "linkType": "HARD", + }] + ]], + ["@types/prettier", [ + ["npm:1.19.1", { + "packageLocation": "./.yarn/cache/@types-prettier-npm-1.19.1-396f22bcd2-d34229c37d.zip/node_modules/@types/prettier/", + "packageDependencies": [ + ["@types/prettier", "npm:1.19.1"] + ], + "linkType": "HARD", + }] + ]], ["ansi-styles", [ ["npm:3.2.1", { "packageLocation": "./.yarn/cache/ansi-styles-npm-3.2.1-8cb8107983-d85ade01c1.zip/node_modules/ansi-styles/", @@ -152,6 +280,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "SOFT", }] ]], + ["dataloader", [ + ["npm:1.4.0", { + "packageLocation": "./.yarn/cache/dataloader-npm-1.4.0-ba03bd2183-e2c93d43af.zip/node_modules/dataloader/", + "packageDependencies": [ + ["dataloader", "npm:1.4.0"] + ], + "linkType": "HARD", + }] + ]], ["define-properties", [ ["npm:1.1.3", { "packageLocation": "./.yarn/cache/define-properties-npm-1.1.3-0f3115e2b9-da80dba55d.zip/node_modules/define-properties/", @@ -457,6 +594,24 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["lodash", [ + ["npm:4.17.21", { + "packageLocation": "./.yarn/cache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip/node_modules/lodash/", + "packageDependencies": [ + ["lodash", "npm:4.17.21"] + ], + "linkType": "HARD", + }] + ]], + ["long", [ + ["npm:4.0.0", { + "packageLocation": "./.yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip/node_modules/long/", + "packageDependencies": [ + ["long", "npm:4.0.0"] + ], + "linkType": "HARD", + }] + ]], ["memorystream", [ ["npm:0.3.1", { "packageLocation": "./.yarn/cache/memorystream-npm-0.3.1-ae973f1d16-f18b42440d.zip/node_modules/memorystream/", @@ -516,6 +671,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["object-hash", [ + ["npm:1.3.1", { + "packageLocation": "./.yarn/cache/object-hash-npm-1.3.1-ea495b8e52-fdcb957a2f.zip/node_modules/object-hash/", + "packageDependencies": [ + ["object-hash", "npm:1.3.1"] + ], + "linkType": "HARD", + }] + ]], ["object-inspect", [ ["npm:1.11.0", { "packageLocation": "./.yarn/cache/object-inspect-npm-1.11.0-c9d4bd1487-8c64f89ce3.zip/node_modules/object-inspect/", @@ -611,6 +775,35 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["prettier", "npm:2.3.2"] ], "linkType": "HARD", + }], + ["npm:2.4.0", { + "packageLocation": "./.yarn/cache/prettier-npm-2.4.0-9f056d9529-ac1bf07566.zip/node_modules/prettier/", + "packageDependencies": [ + ["prettier", "npm:2.4.0"] + ], + "linkType": "HARD", + }] + ]], + ["protobufjs", [ + ["npm:6.11.2", { + "packageLocation": "./.yarn/unplugged/protobufjs-npm-6.11.2-9b422ce98e/node_modules/protobufjs/", + "packageDependencies": [ + ["protobufjs", "npm:6.11.2"], + ["@protobufjs/aspromise", "npm:1.1.2"], + ["@protobufjs/base64", "npm:1.1.2"], + ["@protobufjs/codegen", "npm:2.0.4"], + ["@protobufjs/eventemitter", "npm:1.1.0"], + ["@protobufjs/fetch", "npm:1.1.0"], + ["@protobufjs/float", "npm:1.0.2"], + ["@protobufjs/inquire", "npm:1.1.0"], + ["@protobufjs/path", "npm:1.1.2"], + ["@protobufjs/pool", "npm:1.1.0"], + ["@protobufjs/utf8", "npm:1.1.0"], + ["@types/long", "npm:4.0.1"], + ["@types/node", "npm:16.9.1"], + ["long", "npm:4.0.0"] + ], + "linkType": "HARD", }] ]], ["read-pkg", [ @@ -730,6 +923,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./packages/status-communities/", "packageDependencies": [ ["status-communities", "workspace:packages/status-communities"], + ["npm-run-all", "npm:4.1.5"], + ["protobufjs", "npm:6.11.2"], + ["ts-proto", "npm:1.83.0"], ["typescript", "patch:typescript@npm%3A4.4.3#~builtin::version=4.4.3&hash=d8b4e7"] ], "linkType": "SOFT", @@ -788,6 +984,44 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], + ["ts-poet", [ + ["npm:4.5.0", { + "packageLocation": "./.yarn/unplugged/ts-poet-npm-4.5.0-5771bc00e9/node_modules/ts-poet/", + "packageDependencies": [ + ["ts-poet", "npm:4.5.0"], + ["@types/prettier", "npm:1.19.1"], + ["lodash", "npm:4.17.21"], + ["prettier", "npm:2.4.0"] + ], + "linkType": "HARD", + }] + ]], + ["ts-proto", [ + ["npm:1.83.0", { + "packageLocation": "./.yarn/cache/ts-proto-npm-1.83.0-06a74570ad-57797769b3.zip/node_modules/ts-proto/", + "packageDependencies": [ + ["ts-proto", "npm:1.83.0"], + ["@types/object-hash", "npm:1.3.4"], + ["dataloader", "npm:1.4.0"], + ["object-hash", "npm:1.3.1"], + ["protobufjs", "npm:6.11.2"], + ["ts-poet", "npm:4.5.0"], + ["ts-proto-descriptors", "npm:1.3.1"] + ], + "linkType": "HARD", + }] + ]], + ["ts-proto-descriptors", [ + ["npm:1.3.1", { + "packageLocation": "./.yarn/cache/ts-proto-descriptors-npm-1.3.1-9f5c70fd7f-ef8acf9231.zip/node_modules/ts-proto-descriptors/", + "packageDependencies": [ + ["ts-proto-descriptors", "npm:1.3.1"], + ["long", "npm:4.0.0"], + ["protobufjs", "npm:6.11.2"] + ], + "linkType": "HARD", + }] + ]], ["typescript", [ ["patch:typescript@npm%3A4.4.3#~builtin::version=4.4.3&hash=d8b4e7", { "packageLocation": "./.yarn/cache/typescript-patch-2e9f9a47cb-215a59742a.zip/node_modules/typescript/", diff --git a/.yarn/cache/@protobufjs-aspromise-npm-1.1.2-71d00b938f-011fe7ef08.zip b/.yarn/cache/@protobufjs-aspromise-npm-1.1.2-71d00b938f-011fe7ef08.zip new file mode 100644 index 00000000..fc9081b9 Binary files /dev/null and b/.yarn/cache/@protobufjs-aspromise-npm-1.1.2-71d00b938f-011fe7ef08.zip differ diff --git a/.yarn/cache/@protobufjs-base64-npm-1.1.2-cd8ca6814a-67173ac34d.zip b/.yarn/cache/@protobufjs-base64-npm-1.1.2-cd8ca6814a-67173ac34d.zip new file mode 100644 index 00000000..cdc42f13 Binary files /dev/null and b/.yarn/cache/@protobufjs-base64-npm-1.1.2-cd8ca6814a-67173ac34d.zip differ diff --git a/.yarn/cache/@protobufjs-codegen-npm-2.0.4-36e188bbe6-59240c850b.zip b/.yarn/cache/@protobufjs-codegen-npm-2.0.4-36e188bbe6-59240c850b.zip new file mode 100644 index 00000000..2217a817 Binary files /dev/null and b/.yarn/cache/@protobufjs-codegen-npm-2.0.4-36e188bbe6-59240c850b.zip differ diff --git a/.yarn/cache/@protobufjs-eventemitter-npm-1.1.0-029cc7d431-0369163a3d.zip b/.yarn/cache/@protobufjs-eventemitter-npm-1.1.0-029cc7d431-0369163a3d.zip new file mode 100644 index 00000000..91729815 Binary files /dev/null and b/.yarn/cache/@protobufjs-eventemitter-npm-1.1.0-029cc7d431-0369163a3d.zip differ diff --git a/.yarn/cache/@protobufjs-fetch-npm-1.1.0-ca857b7df4-3fce7e09eb.zip b/.yarn/cache/@protobufjs-fetch-npm-1.1.0-ca857b7df4-3fce7e09eb.zip new file mode 100644 index 00000000..3f687b0b Binary files /dev/null and b/.yarn/cache/@protobufjs-fetch-npm-1.1.0-ca857b7df4-3fce7e09eb.zip differ diff --git a/.yarn/cache/@protobufjs-float-npm-1.0.2-5678f64d08-5781e12412.zip b/.yarn/cache/@protobufjs-float-npm-1.0.2-5678f64d08-5781e12412.zip new file mode 100644 index 00000000..d7027a9c Binary files /dev/null and b/.yarn/cache/@protobufjs-float-npm-1.0.2-5678f64d08-5781e12412.zip differ diff --git a/.yarn/cache/@protobufjs-inquire-npm-1.1.0-3c7759e9ce-ca06f02eaf.zip b/.yarn/cache/@protobufjs-inquire-npm-1.1.0-3c7759e9ce-ca06f02eaf.zip new file mode 100644 index 00000000..c7a6b3dc Binary files /dev/null and b/.yarn/cache/@protobufjs-inquire-npm-1.1.0-3c7759e9ce-ca06f02eaf.zip differ diff --git a/.yarn/cache/@protobufjs-path-npm-1.1.2-641d08de76-856eeb532b.zip b/.yarn/cache/@protobufjs-path-npm-1.1.2-641d08de76-856eeb532b.zip new file mode 100644 index 00000000..27b166d2 Binary files /dev/null and b/.yarn/cache/@protobufjs-path-npm-1.1.2-641d08de76-856eeb532b.zip differ diff --git a/.yarn/cache/@protobufjs-pool-npm-1.1.0-47a76f96a1-d6a34fbbd2.zip b/.yarn/cache/@protobufjs-pool-npm-1.1.0-47a76f96a1-d6a34fbbd2.zip new file mode 100644 index 00000000..14babc22 Binary files /dev/null and b/.yarn/cache/@protobufjs-pool-npm-1.1.0-47a76f96a1-d6a34fbbd2.zip differ diff --git a/.yarn/cache/@protobufjs-utf8-npm-1.1.0-02c590807c-f9bf3163d1.zip b/.yarn/cache/@protobufjs-utf8-npm-1.1.0-02c590807c-f9bf3163d1.zip new file mode 100644 index 00000000..6e9fdd4c Binary files /dev/null and b/.yarn/cache/@protobufjs-utf8-npm-1.1.0-02c590807c-f9bf3163d1.zip differ diff --git a/.yarn/cache/@types-long-npm-4.0.1-022c8b6e77-ff9653c33f.zip b/.yarn/cache/@types-long-npm-4.0.1-022c8b6e77-ff9653c33f.zip new file mode 100644 index 00000000..c88a2cb3 Binary files /dev/null and b/.yarn/cache/@types-long-npm-4.0.1-022c8b6e77-ff9653c33f.zip differ diff --git a/.yarn/cache/@types-node-npm-16.9.1-bde6d3b0c9-41afcf183a.zip b/.yarn/cache/@types-node-npm-16.9.1-bde6d3b0c9-41afcf183a.zip new file mode 100644 index 00000000..b506ae0f Binary files /dev/null and b/.yarn/cache/@types-node-npm-16.9.1-bde6d3b0c9-41afcf183a.zip differ diff --git a/.yarn/cache/@types-object-hash-npm-1.3.4-3b3e2e44e8-fe4aa04142.zip b/.yarn/cache/@types-object-hash-npm-1.3.4-3b3e2e44e8-fe4aa04142.zip new file mode 100644 index 00000000..2ecd9adc Binary files /dev/null and b/.yarn/cache/@types-object-hash-npm-1.3.4-3b3e2e44e8-fe4aa04142.zip differ diff --git a/.yarn/cache/@types-prettier-npm-1.19.1-396f22bcd2-d34229c37d.zip b/.yarn/cache/@types-prettier-npm-1.19.1-396f22bcd2-d34229c37d.zip new file mode 100644 index 00000000..37889a42 Binary files /dev/null and b/.yarn/cache/@types-prettier-npm-1.19.1-396f22bcd2-d34229c37d.zip differ diff --git a/.yarn/cache/dataloader-npm-1.4.0-ba03bd2183-e2c93d43af.zip b/.yarn/cache/dataloader-npm-1.4.0-ba03bd2183-e2c93d43af.zip new file mode 100644 index 00000000..c666806b Binary files /dev/null and b/.yarn/cache/dataloader-npm-1.4.0-ba03bd2183-e2c93d43af.zip differ diff --git a/.yarn/cache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip b/.yarn/cache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip new file mode 100644 index 00000000..22ac44c4 Binary files /dev/null and b/.yarn/cache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip differ diff --git a/.yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip b/.yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip new file mode 100644 index 00000000..228e6f99 Binary files /dev/null and b/.yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip differ diff --git a/.yarn/cache/object-hash-npm-1.3.1-ea495b8e52-fdcb957a2f.zip b/.yarn/cache/object-hash-npm-1.3.1-ea495b8e52-fdcb957a2f.zip new file mode 100644 index 00000000..e52a8590 Binary files /dev/null and b/.yarn/cache/object-hash-npm-1.3.1-ea495b8e52-fdcb957a2f.zip differ diff --git a/.yarn/cache/prettier-npm-2.4.0-9f056d9529-ac1bf07566.zip b/.yarn/cache/prettier-npm-2.4.0-9f056d9529-ac1bf07566.zip new file mode 100644 index 00000000..1905fb8b Binary files /dev/null and b/.yarn/cache/prettier-npm-2.4.0-9f056d9529-ac1bf07566.zip differ diff --git a/.yarn/cache/protobufjs-npm-6.11.2-9b422ce98e-80e9d9610c.zip b/.yarn/cache/protobufjs-npm-6.11.2-9b422ce98e-80e9d9610c.zip new file mode 100644 index 00000000..f284ecb0 Binary files /dev/null and b/.yarn/cache/protobufjs-npm-6.11.2-9b422ce98e-80e9d9610c.zip differ diff --git a/.yarn/cache/ts-poet-npm-4.5.0-5771bc00e9-3d3d620449.zip b/.yarn/cache/ts-poet-npm-4.5.0-5771bc00e9-3d3d620449.zip new file mode 100644 index 00000000..57829b9d Binary files /dev/null and b/.yarn/cache/ts-poet-npm-4.5.0-5771bc00e9-3d3d620449.zip differ diff --git a/.yarn/cache/ts-proto-descriptors-npm-1.3.1-9f5c70fd7f-ef8acf9231.zip b/.yarn/cache/ts-proto-descriptors-npm-1.3.1-9f5c70fd7f-ef8acf9231.zip new file mode 100644 index 00000000..6b5f06ca Binary files /dev/null and b/.yarn/cache/ts-proto-descriptors-npm-1.3.1-9f5c70fd7f-ef8acf9231.zip differ diff --git a/.yarn/cache/ts-proto-npm-1.83.0-06a74570ad-57797769b3.zip b/.yarn/cache/ts-proto-npm-1.83.0-06a74570ad-57797769b3.zip new file mode 100644 index 00000000..f6f720bc Binary files /dev/null and b/.yarn/cache/ts-proto-npm-1.83.0-06a74570ad-57797769b3.zip differ diff --git a/packages/status-communities/.eslintrc.json b/packages/status-communities/.eslintrc.json new file mode 100644 index 00000000..735d95f0 --- /dev/null +++ b/packages/status-communities/.eslintrc.json @@ -0,0 +1,43 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { "project": "./tsconfig.dev.json" }, + "env": { "es6": true }, + "ignorePatterns": ["node_modules", "dist", "coverage", "./proto"], + "plugins": ["import", "eslint-comments", "functional"], + "extends": [ + "eslint:recommended", + "plugin:eslint-comments/recommended", + "plugin:@typescript-eslint/recommended", + "plugin:import/typescript", + "prettier", + "prettier/@typescript-eslint" + ], + "globals": { "BigInt": true, "console": true, "WebAssembly": true }, + "rules": { + "@typescript-eslint/explicit-function-return-type": ["error"], + "@typescript-eslint/explicit-module-boundary-types": "off", + "eslint-comments/disable-enable-pair": [ + "error", + { "allowWholeFile": true } + ], + "eslint-comments/no-unused-disable": "error", + "import/order": [ + "error", + { "newlines-between": "always", "alphabetize": { "order": "asc" } } + ], + "no-constant-condition": ["error", { "checkLoops": false }], + "sort-imports": [ + "error", + { "ignoreDeclarationSort": true, "ignoreCase": true } + ] + }, + "overrides": [ + { + "files": ["*.spec.ts", "**/test_utils/*.ts"], + "rules": { + "@typescript-eslint/no-non-null-assertion": "off" + } + } + ] +} diff --git a/packages/status-communities/.prettierignore b/packages/status-communities/.prettierignore new file mode 100644 index 00000000..996c3a37 --- /dev/null +++ b/packages/status-communities/.prettierignore @@ -0,0 +1,2 @@ +# package.json is formatted by package managers, so we ignore it here +package.json diff --git a/packages/status-communities/buf.gen.yaml b/packages/status-communities/buf.gen.yaml new file mode 100644 index 00000000..40edf963 --- /dev/null +++ b/packages/status-communities/buf.gen.yaml @@ -0,0 +1,6 @@ +version: v1beta1 + +plugins: + - name: ts_proto + out: ./src/proto + opt: grpc_js,esModuleInterop=true diff --git a/packages/status-communities/buf.yaml b/packages/status-communities/buf.yaml new file mode 100644 index 00000000..c7b2d892 --- /dev/null +++ b/packages/status-communities/buf.yaml @@ -0,0 +1,5 @@ +version: v1beta1 + +build: + roots: + - ./proto diff --git a/packages/status-communities/package.json b/packages/status-communities/package.json index 8fdf83be..8cc6476f 100644 --- a/packages/status-communities/package.json +++ b/packages/status-communities/package.json @@ -1,7 +1,25 @@ { "name": "status-communities", "packageManager": "yarn@3.0.1", + "scripts": { + "build": "tsc -p tsconfig.json", + "fix": "run-s fix:*", + "fix:prettier": "prettier \"src/**/*.ts\" \"./*.json\" \"*.conf.js\" --write", + "fix:lint": "eslint src --ext .ts --fix", + "test:lint": "eslint src --ext .ts", + "test:prettier": "prettier \"src/**/*.ts\" \"./*.json\" \"*.conf.js\" --list-different", + "test:spelling": "cspell \"{README.md,.github/*.md,guides/*.md,src/**/*.ts}\"", + "test:unit": "nyc --silent mocha", + "proto": "run-s 'proto:*'", + "proto:lint": "buf lint", + "proto:build": "buf generate" + }, "devDependencies": { + "npm-run-all": "^4.1.5", + "ts-proto": "^1.83.0", "typescript": "^4.4.3" + }, + "dependencies": { + "protobufjs": "^6.11.2" } } diff --git a/packages/status-communities/proto/communities/v2/chat_message.proto b/packages/status-communities/proto/communities/v2/chat_message.proto new file mode 100644 index 00000000..ef4ccb55 --- /dev/null +++ b/packages/status-communities/proto/communities/v2/chat_message.proto @@ -0,0 +1,105 @@ +syntax = "proto3"; + +package communities.v2; + +import "communities/v2/enums.proto"; + +message StickerMessage { + string hash = 1; + int32 pack = 2; +} + +message ImageMessage { + bytes payload = 1; + ImageType type = 2; +} + +message AudioMessage { + bytes payload = 1; + AudioType type = 2; + uint64 duration_ms = 3; + enum AudioType { + AUDIO_TYPE_UNKNOWN_UNSPECIFIED = 0; + AUDIO_TYPE_AAC = 1; + AUDIO_TYPE_AMR = 2; + } +} + +message EditMessage { + uint64 clock = 1; + // Text of the message + string text = 2; + + string chat_id = 3; + string message_id = 4; + + // Grant for community edit messages + bytes grant = 5; + + // The type of message (public/one-to-one/private-group-chat) + MessageType message_type = 6; +} + +message DeleteMessage { + uint64 clock = 1; + + string chat_id = 2; + string message_id = 3; + + // Grant for community delete messages + bytes grant = 4; + + // The type of message (public/one-to-one/private-group-chat) + MessageType message_type = 5; +} + + +message ChatMessage { + // Lamport timestamp of the chat message + uint64 clock = 1; + // Unix timestamps in milliseconds, currently not used as we use whisper as more reliable, but here + // so that we don't rely on it + uint64 timestamp = 2; + // Text of the message + string text = 3; + // Id of the message that we are replying to + string response_to = 4; + // Ens name of the sender + string ens_name = 5; + // Chat id, this field is symmetric for public-chats and private group chats, + // but asymmetric in case of one-to-ones, as the sender will use the chat-id + // of the received, while the receiver will use the chat-id of the sender. + // Probably should be the concatenation of sender-pk & receiver-pk in alphabetical order + string chat_id = 6; + + // The type of message (public/one-to-one/private-group-chat) + MessageType message_type = 7; + // The type of the content of the message + ContentType content_type = 8; + + oneof payload { + StickerMessage sticker = 9; + ImageMessage image = 10; + AudioMessage audio = 11; + bytes community = 12; + } + + // Grant for community chat messages + optional bytes grant = 13; + + enum ContentType { + CONTENT_TYPE_UNKNOWN_UNSPECIFIED = 0; + CONTENT_TYPE_TEXT_PLAIN = 1; + CONTENT_TYPE_STICKER = 2; + CONTENT_TYPE_STATUS = 3; + CONTENT_TYPE_EMOJI = 4; + CONTENT_TYPE_TRANSACTION_COMMAND = 5; + // Only local + CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6; + CONTENT_TYPE_IMAGE = 7; + CONTENT_TYPE_AUDIO = 8; + CONTENT_TYPE_COMMUNITY = 9; + // Only local + CONTENT_TYPE_SYSTEM_MESSAGE_GAP = 10; + } +} diff --git a/packages/status-communities/proto/communities/v2/enums.proto b/packages/status-communities/proto/communities/v2/enums.proto new file mode 100644 index 00000000..111fa9e7 --- /dev/null +++ b/packages/status-communities/proto/communities/v2/enums.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package communities.v2; + +enum MessageType { + MESSAGE_TYPE_UNKNOWN_UNSPECIFIED = 0; + MESSAGE_TYPE_ONE_TO_ONE = 1; + MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP = 2; + MESSAGE_TYPE_PRIVATE_GROUP = 3; + // Only local + MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP = 4; + MESSAGE_TYPE_COMMUNITY_CHAT = 5; + // Only local + MESSAGE_TYPE_SYSTEM_MESSAGE_GAP = 6; +} + +enum ImageType { + IMAGE_TYPE_UNKNOWN_UNSPECIFIED = 0; + + // Raster image files is payload data that can be read as a raster image + IMAGE_TYPE_PNG = 1; + IMAGE_TYPE_JPEG = 2; + IMAGE_TYPE_WEBP = 3; + IMAGE_TYPE_GIF = 4; +} diff --git a/packages/status-communities/src/chat.ts b/packages/status-communities/src/chat.ts new file mode 100644 index 00000000..f685e6d5 --- /dev/null +++ b/packages/status-communities/src/chat.ts @@ -0,0 +1,42 @@ +import {ChatMessage} from "./chat_message"; + + +export class Chat { + private lastClockValue?: number; + private lastMessage?: ChatMessage; + public id: string; + + constructor(id: string) { + this.id = id + } + + public createMessage(text: string) { + + const {timestamp, clock} = this.nextClockAndTimestamp(); + + return ChatMessage.createMessage(clock, timestamp, text, this.id) + } + + private nextClockAndTimestamp() { + let clock = this.lastClockValue; + const timestamp = Date.now(); + + if (!clock || clock < timestamp) { + clock = timestamp + } else { + clock += 1; + } + + return {clock, timestamp} + } + + private updateFromMessage(message: ChatMessage) { + if (!this.lastMessage || this.lastMessage.clock <= message.clock { + this.lastMessage = message + } + + if (this.lastClockValue < message.clock) { + this.lastClockValue = message.clock + } + } +} diff --git a/packages/status-communities/src/chat_message.ts b/packages/status-communities/src/chat_message.ts new file mode 100644 index 00000000..f1f4a2fe --- /dev/null +++ b/packages/status-communities/src/chat_message.ts @@ -0,0 +1,43 @@ +import * as proto from './proto/communities/v2/chat_message'; +import {MessageType} from "./proto/communities/v2/enums"; +import {AudioMessage, ChatMessage_ContentType, ImageMessage, StickerMessage} from "./proto/communities/v2/chat_message"; + +export class ChatMessage { + private constructor( + public proto: proto.ChatMessage, + ) { + } + + /** + * Create a chat message to be sent to an Open (permission = no membership) community + */ + public static createMessage(clock: number, timestamp: number, text: string, chatId: string) { + + const proto = { + clock, // ms? + timestamp, //ms? + text, + /** Id of the message that we are replying to */ + responseTo: "", + /** Ens name of the sender */ + ensName: "", + /** Public Key of the community (TBC) **/ + chatId, + /** The type of message (public/one-to-one/private-group-chat) */ + messageType: MessageType.MESSAGE_TYPE_COMMUNITY_CHAT, + /** The type of the content of the message */ + contentType: ChatMessage_ContentType.CONTENT_TYPE_COMMUNITY, + sticker: undefined, + image: undefined, + audio: undefined, + community: undefined, // Used to share a community + grant: undefined + } + + return new ChatMessage(proto) + } + + public get clock() { + return this.proto.clock; + } +} diff --git a/packages/status-communities/src/community.ts b/packages/status-communities/src/community.ts new file mode 100644 index 00000000..65d495f7 --- /dev/null +++ b/packages/status-communities/src/community.ts @@ -0,0 +1,5 @@ + + +export class Community { + +} diff --git a/packages/status-communities/src/proto/communities/v2/chat_message.ts b/packages/status-communities/src/proto/communities/v2/chat_message.ts new file mode 100644 index 00000000..7e4c2a8a --- /dev/null +++ b/packages/status-communities/src/proto/communities/v2/chat_message.ts @@ -0,0 +1,1105 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { + ImageType, + MessageType, + imageTypeFromJSON, + imageTypeToJSON, + messageTypeFromJSON, + messageTypeToJSON, +} from "../../communities/v2/enums"; + +export const protobufPackage = "communities.v2"; + +export interface StickerMessage { + hash: string; + pack: number; +} + +export interface ImageMessage { + payload: Uint8Array; + type: ImageType; +} + +export interface AudioMessage { + payload: Uint8Array; + type: AudioMessage_AudioType; + durationMs: number; +} + +export enum AudioMessage_AudioType { + AUDIO_TYPE_UNKNOWN_UNSPECIFIED = 0, + AUDIO_TYPE_AAC = 1, + AUDIO_TYPE_AMR = 2, + UNRECOGNIZED = -1, +} + +export function audioMessage_AudioTypeFromJSON( + object: any +): AudioMessage_AudioType { + switch (object) { + case 0: + case "AUDIO_TYPE_UNKNOWN_UNSPECIFIED": + return AudioMessage_AudioType.AUDIO_TYPE_UNKNOWN_UNSPECIFIED; + case 1: + case "AUDIO_TYPE_AAC": + return AudioMessage_AudioType.AUDIO_TYPE_AAC; + case 2: + case "AUDIO_TYPE_AMR": + return AudioMessage_AudioType.AUDIO_TYPE_AMR; + case -1: + case "UNRECOGNIZED": + default: + return AudioMessage_AudioType.UNRECOGNIZED; + } +} + +export function audioMessage_AudioTypeToJSON( + object: AudioMessage_AudioType +): string { + switch (object) { + case AudioMessage_AudioType.AUDIO_TYPE_UNKNOWN_UNSPECIFIED: + return "AUDIO_TYPE_UNKNOWN_UNSPECIFIED"; + case AudioMessage_AudioType.AUDIO_TYPE_AAC: + return "AUDIO_TYPE_AAC"; + case AudioMessage_AudioType.AUDIO_TYPE_AMR: + return "AUDIO_TYPE_AMR"; + default: + return "UNKNOWN"; + } +} + +export interface EditMessage { + clock: number; + /** Text of the message */ + text: string; + chatId: string; + messageId: string; + /** Grant for community edit messages */ + grant: Uint8Array; + /** The type of message (public/one-to-one/private-group-chat) */ + messageType: MessageType; +} + +export interface DeleteMessage { + clock: number; + chatId: string; + messageId: string; + /** Grant for community delete messages */ + grant: Uint8Array; + /** The type of message (public/one-to-one/private-group-chat) */ + messageType: MessageType; +} + +export interface ChatMessage { + /** Lamport timestamp of the chat message */ + clock: number; + /** + * Unix timestamps in milliseconds, currently not used as we use whisper as more reliable, but here + * so that we don't rely on it + */ + timestamp: number; + /** Text of the message */ + text: string; + /** Id of the message that we are replying to */ + responseTo: string; + /** Ens name of the sender */ + ensName: string; + /** + * Chat id, this field is symmetric for public-chats and private group chats, + * but asymmetric in case of one-to-ones, as the sender will use the chat-id + * of the received, while the receiver will use the chat-id of the sender. + * Probably should be the concatenation of sender-pk & receiver-pk in alphabetical order + */ + chatId: string; + /** The type of message (public/one-to-one/private-group-chat) */ + messageType: MessageType; + /** The type of the content of the message */ + contentType: ChatMessage_ContentType; + sticker: StickerMessage | undefined; + image: ImageMessage | undefined; + audio: AudioMessage | undefined; + community: Uint8Array | undefined; + /** Grant for community chat messages */ + grant?: Uint8Array | undefined; +} + +export enum ChatMessage_ContentType { + CONTENT_TYPE_UNKNOWN_UNSPECIFIED = 0, + CONTENT_TYPE_TEXT_PLAIN = 1, + CONTENT_TYPE_STICKER = 2, + CONTENT_TYPE_STATUS = 3, + CONTENT_TYPE_EMOJI = 4, + CONTENT_TYPE_TRANSACTION_COMMAND = 5, + /** CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP - Only local */ + CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6, + CONTENT_TYPE_IMAGE = 7, + CONTENT_TYPE_AUDIO = 8, + CONTENT_TYPE_COMMUNITY = 9, + /** CONTENT_TYPE_SYSTEM_MESSAGE_GAP - Only local */ + CONTENT_TYPE_SYSTEM_MESSAGE_GAP = 10, + UNRECOGNIZED = -1, +} + +export function chatMessage_ContentTypeFromJSON( + object: any +): ChatMessage_ContentType { + switch (object) { + case 0: + case "CONTENT_TYPE_UNKNOWN_UNSPECIFIED": + return ChatMessage_ContentType.CONTENT_TYPE_UNKNOWN_UNSPECIFIED; + case 1: + case "CONTENT_TYPE_TEXT_PLAIN": + return ChatMessage_ContentType.CONTENT_TYPE_TEXT_PLAIN; + case 2: + case "CONTENT_TYPE_STICKER": + return ChatMessage_ContentType.CONTENT_TYPE_STICKER; + case 3: + case "CONTENT_TYPE_STATUS": + return ChatMessage_ContentType.CONTENT_TYPE_STATUS; + case 4: + case "CONTENT_TYPE_EMOJI": + return ChatMessage_ContentType.CONTENT_TYPE_EMOJI; + case 5: + case "CONTENT_TYPE_TRANSACTION_COMMAND": + return ChatMessage_ContentType.CONTENT_TYPE_TRANSACTION_COMMAND; + case 6: + case "CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP": + return ChatMessage_ContentType.CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP; + case 7: + case "CONTENT_TYPE_IMAGE": + return ChatMessage_ContentType.CONTENT_TYPE_IMAGE; + case 8: + case "CONTENT_TYPE_AUDIO": + return ChatMessage_ContentType.CONTENT_TYPE_AUDIO; + case 9: + case "CONTENT_TYPE_COMMUNITY": + return ChatMessage_ContentType.CONTENT_TYPE_COMMUNITY; + case 10: + case "CONTENT_TYPE_SYSTEM_MESSAGE_GAP": + return ChatMessage_ContentType.CONTENT_TYPE_SYSTEM_MESSAGE_GAP; + case -1: + case "UNRECOGNIZED": + default: + return ChatMessage_ContentType.UNRECOGNIZED; + } +} + +export function chatMessage_ContentTypeToJSON( + object: ChatMessage_ContentType +): string { + switch (object) { + case ChatMessage_ContentType.CONTENT_TYPE_UNKNOWN_UNSPECIFIED: + return "CONTENT_TYPE_UNKNOWN_UNSPECIFIED"; + case ChatMessage_ContentType.CONTENT_TYPE_TEXT_PLAIN: + return "CONTENT_TYPE_TEXT_PLAIN"; + case ChatMessage_ContentType.CONTENT_TYPE_STICKER: + return "CONTENT_TYPE_STICKER"; + case ChatMessage_ContentType.CONTENT_TYPE_STATUS: + return "CONTENT_TYPE_STATUS"; + case ChatMessage_ContentType.CONTENT_TYPE_EMOJI: + return "CONTENT_TYPE_EMOJI"; + case ChatMessage_ContentType.CONTENT_TYPE_TRANSACTION_COMMAND: + return "CONTENT_TYPE_TRANSACTION_COMMAND"; + case ChatMessage_ContentType.CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP: + return "CONTENT_TYPE_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP"; + case ChatMessage_ContentType.CONTENT_TYPE_IMAGE: + return "CONTENT_TYPE_IMAGE"; + case ChatMessage_ContentType.CONTENT_TYPE_AUDIO: + return "CONTENT_TYPE_AUDIO"; + case ChatMessage_ContentType.CONTENT_TYPE_COMMUNITY: + return "CONTENT_TYPE_COMMUNITY"; + case ChatMessage_ContentType.CONTENT_TYPE_SYSTEM_MESSAGE_GAP: + return "CONTENT_TYPE_SYSTEM_MESSAGE_GAP"; + default: + return "UNKNOWN"; + } +} + +const baseStickerMessage: object = { hash: "", pack: 0 }; + +export const StickerMessage = { + encode( + message: StickerMessage, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + if (message.pack !== 0) { + writer.uint32(16).int32(message.pack); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StickerMessage { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseStickerMessage } as StickerMessage; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + case 2: + message.pack = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): StickerMessage { + const message = { ...baseStickerMessage } as StickerMessage; + if (object.hash !== undefined && object.hash !== null) { + message.hash = String(object.hash); + } else { + message.hash = ""; + } + if (object.pack !== undefined && object.pack !== null) { + message.pack = Number(object.pack); + } else { + message.pack = 0; + } + return message; + }, + + toJSON(message: StickerMessage): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + message.pack !== undefined && (obj.pack = message.pack); + return obj; + }, + + fromPartial(object: DeepPartial): StickerMessage { + const message = { ...baseStickerMessage } as StickerMessage; + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } else { + message.hash = ""; + } + if (object.pack !== undefined && object.pack !== null) { + message.pack = object.pack; + } else { + message.pack = 0; + } + return message; + }, +}; + +const baseImageMessage: object = { type: 0 }; + +export const ImageMessage = { + encode( + message: ImageMessage, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ImageMessage { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseImageMessage } as ImageMessage; + message.payload = new Uint8Array(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.payload = reader.bytes(); + break; + case 2: + message.type = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ImageMessage { + const message = { ...baseImageMessage } as ImageMessage; + message.payload = new Uint8Array(); + if (object.payload !== undefined && object.payload !== null) { + message.payload = bytesFromBase64(object.payload); + } + if (object.type !== undefined && object.type !== null) { + message.type = imageTypeFromJSON(object.type); + } else { + message.type = 0; + } + return message; + }, + + toJSON(message: ImageMessage): unknown { + const obj: any = {}; + message.payload !== undefined && + (obj.payload = base64FromBytes( + message.payload !== undefined ? message.payload : new Uint8Array() + )); + message.type !== undefined && (obj.type = imageTypeToJSON(message.type)); + return obj; + }, + + fromPartial(object: DeepPartial): ImageMessage { + const message = { ...baseImageMessage } as ImageMessage; + if (object.payload !== undefined && object.payload !== null) { + message.payload = object.payload; + } else { + message.payload = new Uint8Array(); + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } else { + message.type = 0; + } + return message; + }, +}; + +const baseAudioMessage: object = { type: 0, durationMs: 0 }; + +export const AudioMessage = { + encode( + message: AudioMessage, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.durationMs !== 0) { + writer.uint32(24).uint64(message.durationMs); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AudioMessage { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseAudioMessage } as AudioMessage; + message.payload = new Uint8Array(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.payload = reader.bytes(); + break; + case 2: + message.type = reader.int32() as any; + break; + case 3: + message.durationMs = longToNumber(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): AudioMessage { + const message = { ...baseAudioMessage } as AudioMessage; + message.payload = new Uint8Array(); + if (object.payload !== undefined && object.payload !== null) { + message.payload = bytesFromBase64(object.payload); + } + if (object.type !== undefined && object.type !== null) { + message.type = audioMessage_AudioTypeFromJSON(object.type); + } else { + message.type = 0; + } + if (object.durationMs !== undefined && object.durationMs !== null) { + message.durationMs = Number(object.durationMs); + } else { + message.durationMs = 0; + } + return message; + }, + + toJSON(message: AudioMessage): unknown { + const obj: any = {}; + message.payload !== undefined && + (obj.payload = base64FromBytes( + message.payload !== undefined ? message.payload : new Uint8Array() + )); + message.type !== undefined && + (obj.type = audioMessage_AudioTypeToJSON(message.type)); + message.durationMs !== undefined && (obj.durationMs = message.durationMs); + return obj; + }, + + fromPartial(object: DeepPartial): AudioMessage { + const message = { ...baseAudioMessage } as AudioMessage; + if (object.payload !== undefined && object.payload !== null) { + message.payload = object.payload; + } else { + message.payload = new Uint8Array(); + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } else { + message.type = 0; + } + if (object.durationMs !== undefined && object.durationMs !== null) { + message.durationMs = object.durationMs; + } else { + message.durationMs = 0; + } + return message; + }, +}; + +const baseEditMessage: object = { + clock: 0, + text: "", + chatId: "", + messageId: "", + messageType: 0, +}; + +export const EditMessage = { + encode( + message: EditMessage, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.clock !== 0) { + writer.uint32(8).uint64(message.clock); + } + if (message.text !== "") { + writer.uint32(18).string(message.text); + } + if (message.chatId !== "") { + writer.uint32(26).string(message.chatId); + } + if (message.messageId !== "") { + writer.uint32(34).string(message.messageId); + } + if (message.grant.length !== 0) { + writer.uint32(42).bytes(message.grant); + } + if (message.messageType !== 0) { + writer.uint32(48).int32(message.messageType); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EditMessage { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseEditMessage } as EditMessage; + message.grant = new Uint8Array(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clock = longToNumber(reader.uint64() as Long); + break; + case 2: + message.text = reader.string(); + break; + case 3: + message.chatId = reader.string(); + break; + case 4: + message.messageId = reader.string(); + break; + case 5: + message.grant = reader.bytes(); + break; + case 6: + message.messageType = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EditMessage { + const message = { ...baseEditMessage } as EditMessage; + message.grant = new Uint8Array(); + if (object.clock !== undefined && object.clock !== null) { + message.clock = Number(object.clock); + } else { + message.clock = 0; + } + if (object.text !== undefined && object.text !== null) { + message.text = String(object.text); + } else { + message.text = ""; + } + if (object.chatId !== undefined && object.chatId !== null) { + message.chatId = String(object.chatId); + } else { + message.chatId = ""; + } + if (object.messageId !== undefined && object.messageId !== null) { + message.messageId = String(object.messageId); + } else { + message.messageId = ""; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = bytesFromBase64(object.grant); + } + if (object.messageType !== undefined && object.messageType !== null) { + message.messageType = messageTypeFromJSON(object.messageType); + } else { + message.messageType = 0; + } + return message; + }, + + toJSON(message: EditMessage): unknown { + const obj: any = {}; + message.clock !== undefined && (obj.clock = message.clock); + message.text !== undefined && (obj.text = message.text); + message.chatId !== undefined && (obj.chatId = message.chatId); + message.messageId !== undefined && (obj.messageId = message.messageId); + message.grant !== undefined && + (obj.grant = base64FromBytes( + message.grant !== undefined ? message.grant : new Uint8Array() + )); + message.messageType !== undefined && + (obj.messageType = messageTypeToJSON(message.messageType)); + return obj; + }, + + fromPartial(object: DeepPartial): EditMessage { + const message = { ...baseEditMessage } as EditMessage; + if (object.clock !== undefined && object.clock !== null) { + message.clock = object.clock; + } else { + message.clock = 0; + } + if (object.text !== undefined && object.text !== null) { + message.text = object.text; + } else { + message.text = ""; + } + if (object.chatId !== undefined && object.chatId !== null) { + message.chatId = object.chatId; + } else { + message.chatId = ""; + } + if (object.messageId !== undefined && object.messageId !== null) { + message.messageId = object.messageId; + } else { + message.messageId = ""; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = object.grant; + } else { + message.grant = new Uint8Array(); + } + if (object.messageType !== undefined && object.messageType !== null) { + message.messageType = object.messageType; + } else { + message.messageType = 0; + } + return message; + }, +}; + +const baseDeleteMessage: object = { + clock: 0, + chatId: "", + messageId: "", + messageType: 0, +}; + +export const DeleteMessage = { + encode( + message: DeleteMessage, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.clock !== 0) { + writer.uint32(8).uint64(message.clock); + } + if (message.chatId !== "") { + writer.uint32(18).string(message.chatId); + } + if (message.messageId !== "") { + writer.uint32(26).string(message.messageId); + } + if (message.grant.length !== 0) { + writer.uint32(34).bytes(message.grant); + } + if (message.messageType !== 0) { + writer.uint32(40).int32(message.messageType); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteMessage { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseDeleteMessage } as DeleteMessage; + message.grant = new Uint8Array(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clock = longToNumber(reader.uint64() as Long); + break; + case 2: + message.chatId = reader.string(); + break; + case 3: + message.messageId = reader.string(); + break; + case 4: + message.grant = reader.bytes(); + break; + case 5: + message.messageType = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DeleteMessage { + const message = { ...baseDeleteMessage } as DeleteMessage; + message.grant = new Uint8Array(); + if (object.clock !== undefined && object.clock !== null) { + message.clock = Number(object.clock); + } else { + message.clock = 0; + } + if (object.chatId !== undefined && object.chatId !== null) { + message.chatId = String(object.chatId); + } else { + message.chatId = ""; + } + if (object.messageId !== undefined && object.messageId !== null) { + message.messageId = String(object.messageId); + } else { + message.messageId = ""; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = bytesFromBase64(object.grant); + } + if (object.messageType !== undefined && object.messageType !== null) { + message.messageType = messageTypeFromJSON(object.messageType); + } else { + message.messageType = 0; + } + return message; + }, + + toJSON(message: DeleteMessage): unknown { + const obj: any = {}; + message.clock !== undefined && (obj.clock = message.clock); + message.chatId !== undefined && (obj.chatId = message.chatId); + message.messageId !== undefined && (obj.messageId = message.messageId); + message.grant !== undefined && + (obj.grant = base64FromBytes( + message.grant !== undefined ? message.grant : new Uint8Array() + )); + message.messageType !== undefined && + (obj.messageType = messageTypeToJSON(message.messageType)); + return obj; + }, + + fromPartial(object: DeepPartial): DeleteMessage { + const message = { ...baseDeleteMessage } as DeleteMessage; + if (object.clock !== undefined && object.clock !== null) { + message.clock = object.clock; + } else { + message.clock = 0; + } + if (object.chatId !== undefined && object.chatId !== null) { + message.chatId = object.chatId; + } else { + message.chatId = ""; + } + if (object.messageId !== undefined && object.messageId !== null) { + message.messageId = object.messageId; + } else { + message.messageId = ""; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = object.grant; + } else { + message.grant = new Uint8Array(); + } + if (object.messageType !== undefined && object.messageType !== null) { + message.messageType = object.messageType; + } else { + message.messageType = 0; + } + return message; + }, +}; + +const baseChatMessage: object = { + clock: 0, + timestamp: 0, + text: "", + responseTo: "", + ensName: "", + chatId: "", + messageType: 0, + contentType: 0, +}; + +export const ChatMessage = { + encode( + message: ChatMessage, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.clock !== 0) { + writer.uint32(8).uint64(message.clock); + } + if (message.timestamp !== 0) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.text !== "") { + writer.uint32(26).string(message.text); + } + if (message.responseTo !== "") { + writer.uint32(34).string(message.responseTo); + } + if (message.ensName !== "") { + writer.uint32(42).string(message.ensName); + } + if (message.chatId !== "") { + writer.uint32(50).string(message.chatId); + } + if (message.messageType !== 0) { + writer.uint32(56).int32(message.messageType); + } + if (message.contentType !== 0) { + writer.uint32(64).int32(message.contentType); + } + if (message.sticker !== undefined) { + StickerMessage.encode(message.sticker, writer.uint32(74).fork()).ldelim(); + } + if (message.image !== undefined) { + ImageMessage.encode(message.image, writer.uint32(82).fork()).ldelim(); + } + if (message.audio !== undefined) { + AudioMessage.encode(message.audio, writer.uint32(90).fork()).ldelim(); + } + if (message.community !== undefined) { + writer.uint32(98).bytes(message.community); + } + if (message.grant !== undefined) { + writer.uint32(106).bytes(message.grant); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ChatMessage { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseChatMessage } as ChatMessage; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clock = longToNumber(reader.uint64() as Long); + break; + case 2: + message.timestamp = longToNumber(reader.uint64() as Long); + break; + case 3: + message.text = reader.string(); + break; + case 4: + message.responseTo = reader.string(); + break; + case 5: + message.ensName = reader.string(); + break; + case 6: + message.chatId = reader.string(); + break; + case 7: + message.messageType = reader.int32() as any; + break; + case 8: + message.contentType = reader.int32() as any; + break; + case 9: + message.sticker = StickerMessage.decode(reader, reader.uint32()); + break; + case 10: + message.image = ImageMessage.decode(reader, reader.uint32()); + break; + case 11: + message.audio = AudioMessage.decode(reader, reader.uint32()); + break; + case 12: + message.community = reader.bytes(); + break; + case 13: + message.grant = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ChatMessage { + const message = { ...baseChatMessage } as ChatMessage; + if (object.clock !== undefined && object.clock !== null) { + message.clock = Number(object.clock); + } else { + message.clock = 0; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = Number(object.timestamp); + } else { + message.timestamp = 0; + } + if (object.text !== undefined && object.text !== null) { + message.text = String(object.text); + } else { + message.text = ""; + } + if (object.responseTo !== undefined && object.responseTo !== null) { + message.responseTo = String(object.responseTo); + } else { + message.responseTo = ""; + } + if (object.ensName !== undefined && object.ensName !== null) { + message.ensName = String(object.ensName); + } else { + message.ensName = ""; + } + if (object.chatId !== undefined && object.chatId !== null) { + message.chatId = String(object.chatId); + } else { + message.chatId = ""; + } + if (object.messageType !== undefined && object.messageType !== null) { + message.messageType = messageTypeFromJSON(object.messageType); + } else { + message.messageType = 0; + } + if (object.contentType !== undefined && object.contentType !== null) { + message.contentType = chatMessage_ContentTypeFromJSON(object.contentType); + } else { + message.contentType = 0; + } + if (object.sticker !== undefined && object.sticker !== null) { + message.sticker = StickerMessage.fromJSON(object.sticker); + } else { + message.sticker = undefined; + } + if (object.image !== undefined && object.image !== null) { + message.image = ImageMessage.fromJSON(object.image); + } else { + message.image = undefined; + } + if (object.audio !== undefined && object.audio !== null) { + message.audio = AudioMessage.fromJSON(object.audio); + } else { + message.audio = undefined; + } + if (object.community !== undefined && object.community !== null) { + message.community = bytesFromBase64(object.community); + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = bytesFromBase64(object.grant); + } + return message; + }, + + toJSON(message: ChatMessage): unknown { + const obj: any = {}; + message.clock !== undefined && (obj.clock = message.clock); + message.timestamp !== undefined && (obj.timestamp = message.timestamp); + message.text !== undefined && (obj.text = message.text); + message.responseTo !== undefined && (obj.responseTo = message.responseTo); + message.ensName !== undefined && (obj.ensName = message.ensName); + message.chatId !== undefined && (obj.chatId = message.chatId); + message.messageType !== undefined && + (obj.messageType = messageTypeToJSON(message.messageType)); + message.contentType !== undefined && + (obj.contentType = chatMessage_ContentTypeToJSON(message.contentType)); + message.sticker !== undefined && + (obj.sticker = message.sticker + ? StickerMessage.toJSON(message.sticker) + : undefined); + message.image !== undefined && + (obj.image = message.image + ? ImageMessage.toJSON(message.image) + : undefined); + message.audio !== undefined && + (obj.audio = message.audio + ? AudioMessage.toJSON(message.audio) + : undefined); + message.community !== undefined && + (obj.community = + message.community !== undefined + ? base64FromBytes(message.community) + : undefined); + message.grant !== undefined && + (obj.grant = + message.grant !== undefined + ? base64FromBytes(message.grant) + : undefined); + return obj; + }, + + fromPartial(object: DeepPartial): ChatMessage { + const message = { ...baseChatMessage } as ChatMessage; + if (object.clock !== undefined && object.clock !== null) { + message.clock = object.clock; + } else { + message.clock = 0; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = object.timestamp; + } else { + message.timestamp = 0; + } + if (object.text !== undefined && object.text !== null) { + message.text = object.text; + } else { + message.text = ""; + } + if (object.responseTo !== undefined && object.responseTo !== null) { + message.responseTo = object.responseTo; + } else { + message.responseTo = ""; + } + if (object.ensName !== undefined && object.ensName !== null) { + message.ensName = object.ensName; + } else { + message.ensName = ""; + } + if (object.chatId !== undefined && object.chatId !== null) { + message.chatId = object.chatId; + } else { + message.chatId = ""; + } + if (object.messageType !== undefined && object.messageType !== null) { + message.messageType = object.messageType; + } else { + message.messageType = 0; + } + if (object.contentType !== undefined && object.contentType !== null) { + message.contentType = object.contentType; + } else { + message.contentType = 0; + } + if (object.sticker !== undefined && object.sticker !== null) { + message.sticker = StickerMessage.fromPartial(object.sticker); + } else { + message.sticker = undefined; + } + if (object.image !== undefined && object.image !== null) { + message.image = ImageMessage.fromPartial(object.image); + } else { + message.image = undefined; + } + if (object.audio !== undefined && object.audio !== null) { + message.audio = AudioMessage.fromPartial(object.audio); + } else { + message.audio = undefined; + } + if (object.community !== undefined && object.community !== null) { + message.community = object.community; + } else { + message.community = undefined; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = object.grant; + } else { + message.grant = undefined; + } + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw "Unable to locate global object"; +})(); + +const atob: (b64: string) => string = + globalThis.atob || + ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); +function bytesFromBase64(b64: string): Uint8Array { + const bin = atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +const btoa: (bin: string) => string = + globalThis.btoa || + ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + for (const byte of arr) { + bin.push(String.fromCharCode(byte)); + } + return btoa(bin.join("")); +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/packages/status-communities/src/proto/communities/v2/enums.ts b/packages/status-communities/src/proto/communities/v2/enums.ts new file mode 100644 index 00000000..899ba749 --- /dev/null +++ b/packages/status-communities/src/proto/communities/v2/enums.ts @@ -0,0 +1,125 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "communities.v2"; + +export enum MessageType { + MESSAGE_TYPE_UNKNOWN_UNSPECIFIED = 0, + MESSAGE_TYPE_ONE_TO_ONE = 1, + MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP = 2, + MESSAGE_TYPE_PRIVATE_GROUP = 3, + /** MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP - Only local */ + MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + MESSAGE_TYPE_COMMUNITY_CHAT = 5, + /** MESSAGE_TYPE_SYSTEM_MESSAGE_GAP - Only local */ + MESSAGE_TYPE_SYSTEM_MESSAGE_GAP = 6, + UNRECOGNIZED = -1, +} + +export function messageTypeFromJSON(object: any): MessageType { + switch (object) { + case 0: + case "MESSAGE_TYPE_UNKNOWN_UNSPECIFIED": + return MessageType.MESSAGE_TYPE_UNKNOWN_UNSPECIFIED; + case 1: + case "MESSAGE_TYPE_ONE_TO_ONE": + return MessageType.MESSAGE_TYPE_ONE_TO_ONE; + case 2: + case "MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP": + return MessageType.MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP; + case 3: + case "MESSAGE_TYPE_PRIVATE_GROUP": + return MessageType.MESSAGE_TYPE_PRIVATE_GROUP; + case 4: + case "MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP": + return MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP; + case 5: + case "MESSAGE_TYPE_COMMUNITY_CHAT": + return MessageType.MESSAGE_TYPE_COMMUNITY_CHAT; + case 6: + case "MESSAGE_TYPE_SYSTEM_MESSAGE_GAP": + return MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_GAP; + case -1: + case "UNRECOGNIZED": + default: + return MessageType.UNRECOGNIZED; + } +} + +export function messageTypeToJSON(object: MessageType): string { + switch (object) { + case MessageType.MESSAGE_TYPE_UNKNOWN_UNSPECIFIED: + return "MESSAGE_TYPE_UNKNOWN_UNSPECIFIED"; + case MessageType.MESSAGE_TYPE_ONE_TO_ONE: + return "MESSAGE_TYPE_ONE_TO_ONE"; + case MessageType.MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP: + return "MESSAGE_TYPE_MESSAGE_TYPE_PUBLIC_GROUP"; + case MessageType.MESSAGE_TYPE_PRIVATE_GROUP: + return "MESSAGE_TYPE_PRIVATE_GROUP"; + case MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP: + return "MESSAGE_TYPE_SYSTEM_MESSAGE_PRIVATE_GROUP"; + case MessageType.MESSAGE_TYPE_COMMUNITY_CHAT: + return "MESSAGE_TYPE_COMMUNITY_CHAT"; + case MessageType.MESSAGE_TYPE_SYSTEM_MESSAGE_GAP: + return "MESSAGE_TYPE_SYSTEM_MESSAGE_GAP"; + default: + return "UNKNOWN"; + } +} + +export enum ImageType { + IMAGE_TYPE_UNKNOWN_UNSPECIFIED = 0, + /** IMAGE_TYPE_PNG - Raster image files is payload data that can be read as a raster image */ + IMAGE_TYPE_PNG = 1, + IMAGE_TYPE_JPEG = 2, + IMAGE_TYPE_WEBP = 3, + IMAGE_TYPE_GIF = 4, + UNRECOGNIZED = -1, +} + +export function imageTypeFromJSON(object: any): ImageType { + switch (object) { + case 0: + case "IMAGE_TYPE_UNKNOWN_UNSPECIFIED": + return ImageType.IMAGE_TYPE_UNKNOWN_UNSPECIFIED; + case 1: + case "IMAGE_TYPE_PNG": + return ImageType.IMAGE_TYPE_PNG; + case 2: + case "IMAGE_TYPE_JPEG": + return ImageType.IMAGE_TYPE_JPEG; + case 3: + case "IMAGE_TYPE_WEBP": + return ImageType.IMAGE_TYPE_WEBP; + case 4: + case "IMAGE_TYPE_GIF": + return ImageType.IMAGE_TYPE_GIF; + case -1: + case "UNRECOGNIZED": + default: + return ImageType.UNRECOGNIZED; + } +} + +export function imageTypeToJSON(object: ImageType): string { + switch (object) { + case ImageType.IMAGE_TYPE_UNKNOWN_UNSPECIFIED: + return "IMAGE_TYPE_UNKNOWN_UNSPECIFIED"; + case ImageType.IMAGE_TYPE_PNG: + return "IMAGE_TYPE_PNG"; + case ImageType.IMAGE_TYPE_JPEG: + return "IMAGE_TYPE_JPEG"; + case ImageType.IMAGE_TYPE_WEBP: + return "IMAGE_TYPE_WEBP"; + case ImageType.IMAGE_TYPE_GIF: + return "IMAGE_TYPE_GIF"; + default: + return "UNKNOWN"; + } +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/packages/status-communities/tsconfig.json b/packages/status-communities/tsconfig.json new file mode 100644 index 00000000..da7ad6d0 --- /dev/null +++ b/packages/status-communities/tsconfig.json @@ -0,0 +1,47 @@ +{ + "compilerOptions": { + "incremental": true, + "target": "es6", + "outDir": "dist", + "rootDir": "src", + "moduleResolution": "node", + "module": "commonjs", + "declaration": true, + "sourceMap": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "composite": true, + "strict": true /* Enable all strict type-checking options. */, + + /* Strict Type-Checking Options */ + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "alwaysStrict": true, + + /* Additional Checks */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": false /* to set at a later stage */, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + + /* Debugging Options */ + "traceResolution": false, + "listEmittedFiles": false, + "listFiles": false, + "pretty": true, + + // Due to broken types in indirect dependencies + "skipLibCheck": true, + + "lib": ["es2017", "dom"], + "types": ["node", "mocha"], + "typeRoots": ["node_modules/@types", "src/types"] + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules/**",], + "compileOnSave": false +} diff --git a/yarn.lock b/yarn.lock index d7605dfb..a99827c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,107 @@ __metadata: version: 4 cacheKey: 8 +"@protobufjs/aspromise@npm:^1.1.1, @protobufjs/aspromise@npm:^1.1.2": + version: 1.1.2 + resolution: "@protobufjs/aspromise@npm:1.1.2" + checksum: 011fe7ef0826b0fd1a95935a033a3c0fd08483903e1aa8f8b4e0704e3233406abb9ee25350ec0c20bbecb2aad8da0dcea58b392bbd77d6690736f02c143865d2 + languageName: node + linkType: hard + +"@protobufjs/base64@npm:^1.1.2": + version: 1.1.2 + resolution: "@protobufjs/base64@npm:1.1.2" + checksum: 67173ac34de1e242c55da52c2f5bdc65505d82453893f9b51dc74af9fe4c065cf4a657a4538e91b0d4a1a1e0a0642215e31894c31650ff6e3831471061e1ee9e + languageName: node + linkType: hard + +"@protobufjs/codegen@npm:^2.0.4": + version: 2.0.4 + resolution: "@protobufjs/codegen@npm:2.0.4" + checksum: 59240c850b1d3d0b56d8f8098dd04787dcaec5c5bd8de186fa548de86b86076e1c50e80144b90335e705a044edf5bc8b0998548474c2a10a98c7e004a1547e4b + languageName: node + linkType: hard + +"@protobufjs/eventemitter@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/eventemitter@npm:1.1.0" + checksum: 0369163a3d226851682f855f81413cbf166cd98f131edb94a0f67f79e75342d86e89df9d7a1df08ac28be2bc77e0a7f0200526bb6c2a407abbfee1f0262d5fd7 + languageName: node + linkType: hard + +"@protobufjs/fetch@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/fetch@npm:1.1.0" + dependencies: + "@protobufjs/aspromise": ^1.1.1 + "@protobufjs/inquire": ^1.1.0 + checksum: 3fce7e09eb3f1171dd55a192066450f65324fd5f7cc01a431df01bb00d0a895e6bfb5b0c5561ce157ee1d886349c90703d10a4e11a1a256418ff591b969b3477 + languageName: node + linkType: hard + +"@protobufjs/float@npm:^1.0.2": + version: 1.0.2 + resolution: "@protobufjs/float@npm:1.0.2" + checksum: 5781e1241270b8bd1591d324ca9e3a3128d2f768077a446187a049e36505e91bc4156ed5ac3159c3ce3d2ba3743dbc757b051b2d723eea9cd367bfd54ab29b2f + languageName: node + linkType: hard + +"@protobufjs/inquire@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/inquire@npm:1.1.0" + checksum: ca06f02eaf65ca36fb7498fc3492b7fc087bfcc85c702bac5b86fad34b692bdce4990e0ef444c1e2aea8c034227bd1f0484be02810d5d7e931c55445555646f4 + languageName: node + linkType: hard + +"@protobufjs/path@npm:^1.1.2": + version: 1.1.2 + resolution: "@protobufjs/path@npm:1.1.2" + checksum: 856eeb532b16a7aac071cacde5c5620df800db4c80cee6dbc56380524736205aae21e5ae47739114bf669ab5e8ba0e767a282ad894f3b5e124197cb9224445ee + languageName: node + linkType: hard + +"@protobufjs/pool@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/pool@npm:1.1.0" + checksum: d6a34fbbd24f729e2a10ee915b74e1d77d52214de626b921b2d77288bd8f2386808da2315080f2905761527cceffe7ec34c7647bd21a5ae41a25e8212ff79451 + languageName: node + linkType: hard + +"@protobufjs/utf8@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/utf8@npm:1.1.0" + checksum: f9bf3163d13aaa3b6f5e6fbf37a116e094ea021c0e1f2a7ccd0e12a29e2ce08dafba4e8b36e13f8ed7397e1591610ce880ed1289af4d66cf4ace8a36a9557278 + languageName: node + linkType: hard + +"@types/long@npm:^4.0.1": + version: 4.0.1 + resolution: "@types/long@npm:4.0.1" + checksum: ff9653c33f5000d0f131fd98a950a0343e2e33107dd067a97ac4a3b9678e1a2e39ea44772ad920f54ef6e8f107f76bc92c2584ba905a0dc4253282a4101166d0 + languageName: node + linkType: hard + +"@types/node@npm:>=13.7.0": + version: 16.9.1 + resolution: "@types/node@npm:16.9.1" + checksum: 41afcf183a22d59323a0199dd7e0f46591247f45fc08a4434edb26d56dc279ae4fdb80f37989ddd7a0f45e3857c4933e6e82057ede09c5a829f77e373e680375 + languageName: node + linkType: hard + +"@types/object-hash@npm:^1.3.0": + version: 1.3.4 + resolution: "@types/object-hash@npm:1.3.4" + checksum: fe4aa041427f3c69cbcf63434af6e788329b40d7208b30aa845cfc1aa6bf9b0c11b23fa33a567d85ba7f2574a95c3b4a227f4b9b9b55da1eaea68ab94b4058d9 + languageName: node + linkType: hard + +"@types/prettier@npm:^1.19.0": + version: 1.19.1 + resolution: "@types/prettier@npm:1.19.1" + checksum: d34229c37d3419b01efa31968b68c33b8b9b717bdf961e48f68e89821864b1329c45323d28e1200a204e7b2eefca1dabdac4aa0c3d698dbc8c60247322103b11 + languageName: node + linkType: hard + "ansi-styles@npm:^3.2.1": version: 3.2.1 resolution: "ansi-styles@npm:3.2.1" @@ -97,6 +198,13 @@ __metadata: languageName: unknown linkType: soft +"dataloader@npm:^1.4.0": + version: 1.4.0 + resolution: "dataloader@npm:1.4.0" + checksum: e2c93d43afde68980efc0cd9ff48e9851116e27a9687f863e02b56d46f7e7868cc762cd6dcbaf4197e1ca850a03651510c165c2ae24b8e9843fd894002ad0e20 + languageName: node + linkType: hard + "define-properties@npm:^1.1.3": version: 1.1.3 resolution: "define-properties@npm:1.1.3" @@ -361,6 +469,20 @@ __metadata: languageName: node linkType: hard +"lodash@npm:^4.17.15": + version: 4.17.21 + resolution: "lodash@npm:4.17.21" + checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 + languageName: node + linkType: hard + +"long@npm:^4.0.0": + version: 4.0.0 + resolution: "long@npm:4.0.0" + checksum: 16afbe8f749c7c849db1f4de4e2e6a31ac6e617cead3bdc4f9605cb703cd20e1e9fc1a7baba674ffcca57d660a6e5b53a9e236d7b25a295d3855cca79cc06744 + languageName: node + linkType: hard + "memorystream@npm:^0.3.1": version: 0.3.1 resolution: "memorystream@npm:0.3.1" @@ -417,6 +539,13 @@ __metadata: languageName: node linkType: hard +"object-hash@npm:^1.3.1": + version: 1.3.1 + resolution: "object-hash@npm:1.3.1" + checksum: fdcb957a2f15a9060e30655a9f683ba1fc25dfb8809a73d32e9634bec385a2f1d686c707ac1e5f69fb773bc12df03fb64c77ce3faeed83e35f4eb1946cb1989e + languageName: node + linkType: hard + "object-inspect@npm:^1.11.0, object-inspect@npm:^1.9.0": version: 1.11.0 resolution: "object-inspect@npm:1.11.0" @@ -492,6 +621,15 @@ __metadata: languageName: node linkType: hard +"prettier@npm:^2.0.2": + version: 2.4.0 + resolution: "prettier@npm:2.4.0" + bin: + prettier: bin-prettier.js + checksum: ac1bf07566dad5f58469e6d8a954bd5c0f833935597deb00330e9f673e14e4cf81e07dee7eff5776c0edebe11358d199f332d9940be40c8b455516034e553ce0 + languageName: node + linkType: hard + "prettier@npm:^2.3.2": version: 2.3.2 resolution: "prettier@npm:2.3.2" @@ -501,6 +639,30 @@ __metadata: languageName: node linkType: hard +"protobufjs@npm:^6.11.2, protobufjs@npm:^6.8.8": + version: 6.11.2 + resolution: "protobufjs@npm:6.11.2" + dependencies: + "@protobufjs/aspromise": ^1.1.2 + "@protobufjs/base64": ^1.1.2 + "@protobufjs/codegen": ^2.0.4 + "@protobufjs/eventemitter": ^1.1.0 + "@protobufjs/fetch": ^1.1.0 + "@protobufjs/float": ^1.0.2 + "@protobufjs/inquire": ^1.1.0 + "@protobufjs/path": ^1.1.2 + "@protobufjs/pool": ^1.1.0 + "@protobufjs/utf8": ^1.1.0 + "@types/long": ^4.0.1 + "@types/node": ">=13.7.0" + long: ^4.0.0 + bin: + pbjs: bin/pbjs + pbts: bin/pbts + checksum: 80e9d9610c3eb66f9eae4e44a1ae30381cedb721b7d5f635d781fe4c507e2c77bb7c879addcd1dda79733d3ae589d9e66fd18d42baf99b35df7382a0f9920795 + languageName: node + linkType: hard + "read-pkg@npm:^3.0.0": version: 3.0.0 resolution: "read-pkg@npm:3.0.0" @@ -613,6 +775,9 @@ resolve@^1.10.0: version: 0.0.0-use.local resolution: "status-communities@workspace:packages/status-communities" dependencies: + npm-run-all: ^4.1.5 + protobufjs: ^6.11.2 + ts-proto: ^1.83.0 typescript: ^4.4.3 languageName: unknown linkType: soft @@ -664,6 +829,43 @@ resolve@^1.10.0: languageName: node linkType: hard +"ts-poet@npm:^4.5.0": + version: 4.5.0 + resolution: "ts-poet@npm:4.5.0" + dependencies: + "@types/prettier": ^1.19.0 + lodash: ^4.17.15 + prettier: ^2.0.2 + checksum: 3d3d620449bf002ff684887d45078fdd35889d2e6d90b93872eab5c3cc4565a0bc2520ad83a14d08b2ed474d093d071b20c813a0ff6c4a100719f73485ce53d9 + languageName: node + linkType: hard + +"ts-proto-descriptors@npm:^1.2.1": + version: 1.3.1 + resolution: "ts-proto-descriptors@npm:1.3.1" + dependencies: + long: ^4.0.0 + protobufjs: ^6.8.8 + checksum: ef8acf9231375dd00cfa667c688746ae24fb8012a3875d1447cb6a6e9e0311150681719072716f58a24b1df801bcc35e56faca11ea4bac1f8146038b524b93c4 + languageName: node + linkType: hard + +"ts-proto@npm:^1.83.0": + version: 1.83.0 + resolution: "ts-proto@npm:1.83.0" + dependencies: + "@types/object-hash": ^1.3.0 + dataloader: ^1.4.0 + object-hash: ^1.3.1 + protobufjs: ^6.8.8 + ts-poet: ^4.5.0 + ts-proto-descriptors: ^1.2.1 + bin: + protoc-gen-ts_proto: protoc-gen-ts_proto + checksum: 57797769b3bbf718829cc9f3f5702b8f80bbe34e3ba14736019d74bd5b8da0b28c1fd9eed984e81f145af42031e7754d4ae054c68cfac93a5f54855191c37617 + languageName: node + linkType: hard + typescript@^4.4.3: version: 4.4.3 resolution: "typescript@npm:4.4.3"