Started building

This commit is contained in:
Franck Royer 2021-09-14 12:50:33 +10:00
parent a08a491332
commit 9a1f6a3286
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
38 changed files with 2007 additions and 0 deletions

234
.pnp.cjs generated
View File

@ -46,6 +46,134 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "SOFT", "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", [ ["ansi-styles", [
["npm:3.2.1", { ["npm:3.2.1", {
"packageLocation": "./.yarn/cache/ansi-styles-npm-3.2.1-8cb8107983-d85ade01c1.zip/node_modules/ansi-styles/", "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", "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", [ ["define-properties", [
["npm:1.1.3", { ["npm:1.1.3", {
"packageLocation": "./.yarn/cache/define-properties-npm-1.1.3-0f3115e2b9-da80dba55d.zip/node_modules/define-properties/", "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", "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", [ ["memorystream", [
["npm:0.3.1", { ["npm:0.3.1", {
"packageLocation": "./.yarn/cache/memorystream-npm-0.3.1-ae973f1d16-f18b42440d.zip/node_modules/memorystream/", "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", "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", [ ["object-inspect", [
["npm:1.11.0", { ["npm:1.11.0", {
"packageLocation": "./.yarn/cache/object-inspect-npm-1.11.0-c9d4bd1487-8c64f89ce3.zip/node_modules/object-inspect/", "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"] ["prettier", "npm:2.3.2"]
], ],
"linkType": "HARD", "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", [ ["read-pkg", [
@ -730,6 +923,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"packageLocation": "./packages/status-communities/", "packageLocation": "./packages/status-communities/",
"packageDependencies": [ "packageDependencies": [
["status-communities", "workspace:packages/status-communities"], ["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<compat/typescript>::version=4.4.3&hash=d8b4e7"] ["typescript", "patch:typescript@npm%3A4.4.3#~builtin<compat/typescript>::version=4.4.3&hash=d8b4e7"]
], ],
"linkType": "SOFT", "linkType": "SOFT",
@ -788,6 +984,44 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "HARD", "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", [ ["typescript", [
["patch:typescript@npm%3A4.4.3#~builtin<compat/typescript>::version=4.4.3&hash=d8b4e7", { ["patch:typescript@npm%3A4.4.3#~builtin<compat/typescript>::version=4.4.3&hash=d8b4e7", {
"packageLocation": "./.yarn/cache/typescript-patch-2e9f9a47cb-215a59742a.zip/node_modules/typescript/", "packageLocation": "./.yarn/cache/typescript-patch-2e9f9a47cb-215a59742a.zip/node_modules/typescript/",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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"
}
}
]
}

View File

@ -0,0 +1,2 @@
# package.json is formatted by package managers, so we ignore it here
package.json

View File

@ -0,0 +1,6 @@
version: v1beta1
plugins:
- name: ts_proto
out: ./src/proto
opt: grpc_js,esModuleInterop=true

View File

@ -0,0 +1,5 @@
version: v1beta1
build:
roots:
- ./proto

View File

@ -1,7 +1,25 @@
{ {
"name": "status-communities", "name": "status-communities",
"packageManager": "yarn@3.0.1", "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": { "devDependencies": {
"npm-run-all": "^4.1.5",
"ts-proto": "^1.83.0",
"typescript": "^4.4.3" "typescript": "^4.4.3"
},
"dependencies": {
"protobufjs": "^6.11.2"
} }
} }

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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
}
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,5 @@
export class Community {
}

File diff suppressed because it is too large Load Diff

View File

@ -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();
}

View File

@ -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
}

202
yarn.lock
View File

@ -5,6 +5,107 @@ __metadata:
version: 4 version: 4
cacheKey: 8 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": "ansi-styles@npm:^3.2.1":
version: 3.2.1 version: 3.2.1
resolution: "ansi-styles@npm:3.2.1" resolution: "ansi-styles@npm:3.2.1"
@ -97,6 +198,13 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft 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": "define-properties@npm:^1.1.3":
version: 1.1.3 version: 1.1.3
resolution: "define-properties@npm:1.1.3" resolution: "define-properties@npm:1.1.3"
@ -361,6 +469,20 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "memorystream@npm:^0.3.1":
version: 0.3.1 version: 0.3.1
resolution: "memorystream@npm:0.3.1" resolution: "memorystream@npm:0.3.1"
@ -417,6 +539,13 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "object-inspect@npm:^1.11.0, object-inspect@npm:^1.9.0":
version: 1.11.0 version: 1.11.0
resolution: "object-inspect@npm:1.11.0" resolution: "object-inspect@npm:1.11.0"
@ -492,6 +621,15 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "prettier@npm:^2.3.2":
version: 2.3.2 version: 2.3.2
resolution: "prettier@npm:2.3.2" resolution: "prettier@npm:2.3.2"
@ -501,6 +639,30 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "read-pkg@npm:^3.0.0":
version: 3.0.0 version: 3.0.0
resolution: "read-pkg@npm:3.0.0" resolution: "read-pkg@npm:3.0.0"
@ -613,6 +775,9 @@ resolve@^1.10.0:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "status-communities@workspace:packages/status-communities" resolution: "status-communities@workspace:packages/status-communities"
dependencies: dependencies:
npm-run-all: ^4.1.5
protobufjs: ^6.11.2
ts-proto: ^1.83.0
typescript: ^4.4.3 typescript: ^4.4.3
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -664,6 +829,43 @@ resolve@^1.10.0:
languageName: node languageName: node
linkType: hard 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: typescript@^4.4.3:
version: 4.4.3 version: 4.4.3
resolution: "typescript@npm:4.4.3" resolution: "typescript@npm:4.4.3"