diff --git a/.eslintignore b/.eslintignore index 83ffb91d..52191fef 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ **/dist **/node_modules -**/proto +**/protos diff --git a/packages/status-js/buf.gen.yaml b/packages/status-js/buf.gen.yaml deleted file mode 100644 index 40edf963..00000000 --- a/packages/status-js/buf.gen.yaml +++ /dev/null @@ -1,6 +0,0 @@ -version: v1beta1 - -plugins: - - name: ts_proto - out: ./src/proto - opt: grpc_js,esModuleInterop=true diff --git a/packages/status-js/buf.yaml b/packages/status-js/buf.yaml deleted file mode 100644 index c6a09b81..00000000 --- a/packages/status-js/buf.yaml +++ /dev/null @@ -1,9 +0,0 @@ -version: v1beta1 - -build: - roots: - - ./proto -lint: - except: - - ENUM_ZERO_VALUE_SUFFIX - - ENUM_VALUE_PREFIX diff --git a/packages/status-js/package.json b/packages/status-js/package.json index 1c4dfe73..d772a2be 100644 --- a/packages/status-js/package.json +++ b/packages/status-js/package.json @@ -17,14 +17,13 @@ "scripts": { "prebuild": "rm -rf dist", "build": "parcel build", + "build:vite": "vite build", "build:types": "tsc --emitDeclarationOnly", + "build:protos": "protons protos/*.proto", "typecheck": "tsc --noEmit", "lint": "eslint src", "format": "prettier --write src", "test": "mocha", - "proto": "run-s 'proto:*'", - "proto:lint": "buf lint", - "proto:build": "buf generate", "clean": "rm -rf node_modules && rm -rf dist" }, "dependencies": { @@ -37,7 +36,7 @@ "js-waku": "^0.23.0", "long": "^5.2.0", "pbkdf2": "^3.1.2", - "protobufjs": "^6.11.2", + "protons-runtime": "^1.0.4", "secp256k1": "^4.0.2", "uuid": "^8.3.2" }, @@ -52,7 +51,7 @@ "chai": "^4.3.4", "mocha": "^9.1.1", "npm-run-all": "^4.1.5", - "ts-node": "^10.2.1", - "ts-proto": "^1.83.0" + "protons": "^3.0.4", + "ts-node": "^10.2.1" } } diff --git a/packages/status-js/proto/communities/v1/enums.proto b/packages/status-js/proto/communities/v1/enums.proto deleted file mode 100644 index b8af60b1..00000000 --- a/packages/status-js/proto/communities/v1/enums.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; - -package communities.v1; - -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-js/proto/communities/v1/membership_update_message.proto b/packages/status-js/proto/communities/v1/membership_update_message.proto deleted file mode 100644 index 9952bffd..00000000 --- a/packages/status-js/proto/communities/v1/membership_update_message.proto +++ /dev/null @@ -1,45 +0,0 @@ -syntax = "proto3"; - -package communities.v1; - -import "communities/v1/chat_message.proto"; -import "communities/v1/emoji_reaction.proto"; - -message MembershipUpdateEvent { - // Lamport timestamp of the event - uint64 clock = 1; - // List of public keys of objects of the action - repeated string members = 2; - // Name of the chat for the CHAT_CREATED/NAME_CHANGED event types - string name = 3; - // The type of the event - EventType type = 4; - - enum EventType { - UNKNOWN = 0; - CHAT_CREATED = 1; - NAME_CHANGED = 2; - MEMBERS_ADDED = 3; - MEMBER_JOINED = 4; - MEMBER_REMOVED = 5; - ADMINS_ADDED = 6; - ADMIN_REMOVED = 7; - } -} - -// MembershipUpdateMessage is a message used to propagate information -// about group membership changes. -// For more information, see https://github.com/status-im/specs/blob/master/status-group-chats-spec.md. -message MembershipUpdateMessage { - // The chat id of the private group chat - string chat_id = 1; - // A list of events for this group chat, first x bytes are the signature, then is a - // protobuf encoded MembershipUpdateEvent - repeated bytes events = 2; - - // An optional chat message - oneof chat_entity { - ChatMessage message = 3; - EmojiReaction emoji_reaction = 4; - } -} \ No newline at end of file diff --git a/packages/status-js/proto/status/v1/application_metadata_message.proto b/packages/status-js/protos/application-metadata-message.proto similarity index 98% rename from packages/status-js/proto/status/v1/application_metadata_message.proto rename to packages/status-js/protos/application-metadata-message.proto index 53997cb0..79fe4351 100644 --- a/packages/status-js/proto/status/v1/application_metadata_message.proto +++ b/packages/status-js/protos/application-metadata-message.proto @@ -1,7 +1,5 @@ syntax = "proto3"; -package status.v1; - message ApplicationMetadataMessage { // Signature of the payload field bytes signature = 1; diff --git a/packages/status-js/protos/application-metadata-message.ts b/packages/status-js/protos/application-metadata-message.ts new file mode 100644 index 00000000..2243c726 --- /dev/null +++ b/packages/status-js/protos/application-metadata-message.ts @@ -0,0 +1,115 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + enumeration, + encodeMessage, + decodeMessage, + message, + bytes, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface ApplicationMetadataMessage { + signature: Uint8Array + payload: Uint8Array + type: ApplicationMetadataMessage.Type +} + +export namespace ApplicationMetadataMessage { + export enum Type { + TYPE_UNKNOWN_UNSPECIFIED = 'TYPE_UNKNOWN_UNSPECIFIED', + TYPE_CHAT_MESSAGE = 'TYPE_CHAT_MESSAGE', + TYPE_CONTACT_UPDATE = 'TYPE_CONTACT_UPDATE', + TYPE_MEMBERSHIP_UPDATE_MESSAGE = 'TYPE_MEMBERSHIP_UPDATE_MESSAGE', + TYPE_PAIR_INSTALLATION = 'TYPE_PAIR_INSTALLATION', + TYPE_SYNC_INSTALLATION = 'TYPE_SYNC_INSTALLATION', + TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_REQUEST_ADDRESS_FOR_TRANSACTION', + TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION', + TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 'TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION', + TYPE_REQUEST_TRANSACTION = 'TYPE_REQUEST_TRANSACTION', + TYPE_SEND_TRANSACTION = 'TYPE_SEND_TRANSACTION', + TYPE_DECLINE_REQUEST_TRANSACTION = 'TYPE_DECLINE_REQUEST_TRANSACTION', + TYPE_SYNC_INSTALLATION_CONTACT = 'TYPE_SYNC_INSTALLATION_CONTACT', + TYPE_SYNC_INSTALLATION_ACCOUNT = 'TYPE_SYNC_INSTALLATION_ACCOUNT', + TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 'TYPE_SYNC_INSTALLATION_PUBLIC_CHAT', + TYPE_CONTACT_CODE_ADVERTISEMENT = 'TYPE_CONTACT_CODE_ADVERTISEMENT', + TYPE_PUSH_NOTIFICATION_REGISTRATION = 'TYPE_PUSH_NOTIFICATION_REGISTRATION', + TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 'TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE', + TYPE_PUSH_NOTIFICATION_QUERY = 'TYPE_PUSH_NOTIFICATION_QUERY', + TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 'TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE', + TYPE_PUSH_NOTIFICATION_REQUEST = 'TYPE_PUSH_NOTIFICATION_REQUEST', + TYPE_PUSH_NOTIFICATION_RESPONSE = 'TYPE_PUSH_NOTIFICATION_RESPONSE', + TYPE_EMOJI_REACTION = 'TYPE_EMOJI_REACTION', + TYPE_GROUP_CHAT_INVITATION = 'TYPE_GROUP_CHAT_INVITATION', + TYPE_CHAT_IDENTITY = 'TYPE_CHAT_IDENTITY', + TYPE_COMMUNITY_DESCRIPTION = 'TYPE_COMMUNITY_DESCRIPTION', + TYPE_COMMUNITY_INVITATION = 'TYPE_COMMUNITY_INVITATION', + TYPE_COMMUNITY_REQUEST_TO_JOIN = 'TYPE_COMMUNITY_REQUEST_TO_JOIN', + TYPE_PIN_MESSAGE = 'TYPE_PIN_MESSAGE', + TYPE_EDIT_MESSAGE = 'TYPE_EDIT_MESSAGE', + TYPE_STATUS_UPDATE = 'TYPE_STATUS_UPDATE', + TYPE_DELETE_MESSAGE = 'TYPE_DELETE_MESSAGE', + TYPE_SYNC_INSTALLATION_COMMUNITY = 'TYPE_SYNC_INSTALLATION_COMMUNITY', + TYPE_ANONYMOUS_METRIC_BATCH = 'TYPE_ANONYMOUS_METRIC_BATCH', + } + + enum __TypeValues { + TYPE_UNKNOWN_UNSPECIFIED = 0, + TYPE_CHAT_MESSAGE = 1, + TYPE_CONTACT_UPDATE = 2, + TYPE_MEMBERSHIP_UPDATE_MESSAGE = 3, + TYPE_PAIR_INSTALLATION = 4, + TYPE_SYNC_INSTALLATION = 5, + TYPE_REQUEST_ADDRESS_FOR_TRANSACTION = 6, + TYPE_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7, + TYPE_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8, + TYPE_REQUEST_TRANSACTION = 9, + TYPE_SEND_TRANSACTION = 10, + TYPE_DECLINE_REQUEST_TRANSACTION = 11, + TYPE_SYNC_INSTALLATION_CONTACT = 12, + TYPE_SYNC_INSTALLATION_ACCOUNT = 13, + TYPE_SYNC_INSTALLATION_PUBLIC_CHAT = 14, + TYPE_CONTACT_CODE_ADVERTISEMENT = 15, + TYPE_PUSH_NOTIFICATION_REGISTRATION = 16, + TYPE_PUSH_NOTIFICATION_REGISTRATION_RESPONSE = 17, + TYPE_PUSH_NOTIFICATION_QUERY = 18, + TYPE_PUSH_NOTIFICATION_QUERY_RESPONSE = 19, + TYPE_PUSH_NOTIFICATION_REQUEST = 20, + TYPE_PUSH_NOTIFICATION_RESPONSE = 21, + TYPE_EMOJI_REACTION = 22, + TYPE_GROUP_CHAT_INVITATION = 23, + TYPE_CHAT_IDENTITY = 24, + TYPE_COMMUNITY_DESCRIPTION = 25, + TYPE_COMMUNITY_INVITATION = 26, + TYPE_COMMUNITY_REQUEST_TO_JOIN = 27, + TYPE_PIN_MESSAGE = 28, + TYPE_EDIT_MESSAGE = 29, + TYPE_STATUS_UPDATE = 30, + TYPE_DELETE_MESSAGE = 31, + TYPE_SYNC_INSTALLATION_COMMUNITY = 32, + TYPE_ANONYMOUS_METRIC_BATCH = 33, + } + + export namespace Type { + export const codec = () => { + return enumeration(__TypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'signature', codec: bytes }, + 2: { name: 'payload', codec: bytes }, + 3: { name: 'type', codec: ApplicationMetadataMessage.Type.codec() }, + }) + } + + export const encode = (obj: ApplicationMetadataMessage): Uint8Array => { + return encodeMessage(obj, ApplicationMetadataMessage.codec()) + } + + export const decode = (buf: Uint8Array): ApplicationMetadataMessage => { + return decodeMessage(buf, ApplicationMetadataMessage.codec()) + } +} diff --git a/packages/status-js/proto/communities/v1/chat_identity.proto b/packages/status-js/protos/chat-identity.proto similarity index 81% rename from packages/status-js/proto/communities/v1/chat_identity.proto rename to packages/status-js/protos/chat-identity.proto index 314fb1b1..0d600990 100644 --- a/packages/status-js/proto/communities/v1/chat_identity.proto +++ b/packages/status-js/protos/chat-identity.proto @@ -1,8 +1,6 @@ syntax = "proto3"; -package communities.v1; - -import "communities/v1/enums.proto"; +import "enums.proto"; // ChatIdentity represents the user defined identity associated with their public chat key message ChatIdentity { @@ -15,7 +13,7 @@ message ChatIdentity { // images is a string indexed mapping of images associated with an identity map images = 3; - // display name is the user set identity, valid only for organisations + // display name is the user set identity string display_name = 4; // description is the user set description, valid only for organisations @@ -37,7 +35,13 @@ message IdentityImage { SourceType source_type = 2; // image_type signals the image type and method of parsing the payload - ImageType image_type =3; + ImageType image_type = 3; + + // encryption_keys is a list of encrypted keys that can be used to decrypted an encrypted payload + repeated bytes encryption_keys = 4; + + // encrypted signals the encryption state of the payload, default is false. + bool encrypted = 5; // SourceType are the predefined types of image source allowed enum SourceType { diff --git a/packages/status-js/protos/chat-identity.ts b/packages/status-js/protos/chat-identity.ts new file mode 100644 index 00000000..8696a676 --- /dev/null +++ b/packages/status-js/protos/chat-identity.ts @@ -0,0 +1,139 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + encodeMessage, + decodeMessage, + message, + uint64, + string, + enumeration, + bytes, + bool, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface ChatIdentity { + clock: bigint + ensName: string + images: IdentityImage + displayName: string + description: string + color: string + emoji: string +} + +export namespace ChatIdentity { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'ensName', codec: string }, + 3: { name: 'images', codec: IdentityImage.codec() }, + 4: { name: 'displayName', codec: string }, + 5: { name: 'description', codec: string }, + 6: { name: 'color', codec: string }, + 7: { name: 'emoji', codec: string }, + }) + } + + export const encode = (obj: ChatIdentity): Uint8Array => { + return encodeMessage(obj, ChatIdentity.codec()) + } + + export const decode = (buf: Uint8Array): ChatIdentity => { + return decodeMessage(buf, ChatIdentity.codec()) + } +} + +export interface IdentityImage { + payload: Uint8Array + sourceType: IdentityImage.SourceType + imageType: ImageType + encryptionKeys: Uint8Array[] + encrypted: boolean +} + +export namespace IdentityImage { + export enum SourceType { + UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE', + RAW_PAYLOAD = 'RAW_PAYLOAD', + ENS_AVATAR = 'ENS_AVATAR', + } + + enum __SourceTypeValues { + UNKNOWN_SOURCE_TYPE = 0, + RAW_PAYLOAD = 1, + ENS_AVATAR = 2, + } + + export namespace SourceType { + export const codec = () => { + return enumeration(__SourceTypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'payload', codec: bytes }, + 2: { name: 'sourceType', codec: IdentityImage.SourceType.codec() }, + 3: { name: 'imageType', codec: ImageType.codec() }, + 4: { name: 'encryptionKeys', codec: bytes, repeats: true }, + 5: { name: 'encrypted', codec: bool }, + }) + } + + export const encode = (obj: IdentityImage): Uint8Array => { + return encodeMessage(obj, IdentityImage.codec()) + } + + export const decode = (buf: Uint8Array): IdentityImage => { + return decodeMessage(buf, IdentityImage.codec()) + } +} + +export enum MessageType { + UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE', + ONE_TO_ONE = 'ONE_TO_ONE', + PUBLIC_GROUP = 'PUBLIC_GROUP', + PRIVATE_GROUP = 'PRIVATE_GROUP', + SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP', + COMMUNITY_CHAT = 'COMMUNITY_CHAT', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', +} + +enum __MessageTypeValues { + UNKNOWN_MESSAGE_TYPE = 0, + ONE_TO_ONE = 1, + PUBLIC_GROUP = 2, + PRIVATE_GROUP = 3, + SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + COMMUNITY_CHAT = 5, + SYSTEM_MESSAGE_GAP = 6, +} + +export namespace MessageType { + export const codec = () => { + return enumeration(__MessageTypeValues) + } +} +export enum ImageType { + UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE', + PNG = 'PNG', + JPEG = 'JPEG', + WEBP = 'WEBP', + GIF = 'GIF', +} + +enum __ImageTypeValues { + UNKNOWN_IMAGE_TYPE = 0, + PNG = 1, + JPEG = 2, + WEBP = 3, + GIF = 4, +} + +export namespace ImageType { + export const codec = () => { + return enumeration(__ImageTypeValues) + } +} diff --git a/packages/status-js/proto/communities/v1/chat_message.proto b/packages/status-js/protos/chat-message.proto similarity index 77% rename from packages/status-js/proto/communities/v1/chat_message.proto rename to packages/status-js/protos/chat-message.proto index 20d467cb..9c130eef 100644 --- a/packages/status-js/proto/communities/v1/chat_message.proto +++ b/packages/status-js/protos/chat-message.proto @@ -1,8 +1,6 @@ syntax = "proto3"; -package communities.v1; - -import "communities/v1/enums.proto"; +import "enums.proto"; message StickerMessage { string hash = 1; @@ -19,9 +17,9 @@ message AudioMessage { AudioType type = 2; uint64 duration_ms = 3; enum AudioType { - AUDIO_TYPE_UNKNOWN_UNSPECIFIED = 0; - AUDIO_TYPE_AAC = 1; - AUDIO_TYPE_AMR = 2; + UNKNOWN_AUDIO_TYPE = 0; + AAC = 1; + AMR = 2; } } @@ -85,21 +83,24 @@ message ChatMessage { } // Grant for community chat messages - optional bytes grant = 13; + bytes grant = 13; + + // Message author's display name, introduced in version 1 + string display_name = 14; 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; + UNKNOWN_CONTENT_TYPE = 0; + TEXT_PLAIN = 1; + STICKER = 2; + STATUS = 3; + EMOJI = 4; + 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; + SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6; + IMAGE = 7; + AUDIO = 8; + COMMUNITY = 9; // Only local - CONTENT_TYPE_SYSTEM_MESSAGE_GAP = 10; + SYSTEM_MESSAGE_GAP = 10; } } diff --git a/packages/status-js/protos/chat-message.ts b/packages/status-js/protos/chat-message.ts new file mode 100644 index 00000000..f854f413 --- /dev/null +++ b/packages/status-js/protos/chat-message.ts @@ -0,0 +1,285 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + encodeMessage, + decodeMessage, + message, + string, + int32, + bytes, + enumeration, + uint64, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface StickerMessage { + hash: string + pack: number +} + +export namespace StickerMessage { + export const codec = (): Codec => { + return message({ + 1: { name: 'hash', codec: string }, + 2: { name: 'pack', codec: int32 }, + }) + } + + export const encode = (obj: StickerMessage): Uint8Array => { + return encodeMessage(obj, StickerMessage.codec()) + } + + export const decode = (buf: Uint8Array): StickerMessage => { + return decodeMessage(buf, StickerMessage.codec()) + } +} + +export interface ImageMessage { + payload: Uint8Array + type: ImageType +} + +export namespace ImageMessage { + export const codec = (): Codec => { + return message({ + 1: { name: 'payload', codec: bytes }, + 2: { name: 'type', codec: ImageType.codec() }, + }) + } + + export const encode = (obj: ImageMessage): Uint8Array => { + return encodeMessage(obj, ImageMessage.codec()) + } + + export const decode = (buf: Uint8Array): ImageMessage => { + return decodeMessage(buf, ImageMessage.codec()) + } +} + +export interface AudioMessage { + payload: Uint8Array + type: AudioMessage.AudioType + durationMs: bigint +} + +export namespace AudioMessage { + export enum AudioType { + UNKNOWN_AUDIO_TYPE = 'UNKNOWN_AUDIO_TYPE', + AAC = 'AAC', + AMR = 'AMR', + } + + enum __AudioTypeValues { + UNKNOWN_AUDIO_TYPE = 0, + AAC = 1, + AMR = 2, + } + + export namespace AudioType { + export const codec = () => { + return enumeration(__AudioTypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'payload', codec: bytes }, + 2: { name: 'type', codec: AudioMessage.AudioType.codec() }, + 3: { name: 'durationMs', codec: uint64 }, + }) + } + + export const encode = (obj: AudioMessage): Uint8Array => { + return encodeMessage(obj, AudioMessage.codec()) + } + + export const decode = (buf: Uint8Array): AudioMessage => { + return decodeMessage(buf, AudioMessage.codec()) + } +} + +export interface EditMessage { + clock: bigint + text: string + chatId: string + messageId: string + grant: Uint8Array + messageType: MessageType +} + +export namespace EditMessage { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'text', codec: string }, + 3: { name: 'chatId', codec: string }, + 4: { name: 'messageId', codec: string }, + 5: { name: 'grant', codec: bytes }, + 6: { name: 'messageType', codec: MessageType.codec() }, + }) + } + + export const encode = (obj: EditMessage): Uint8Array => { + return encodeMessage(obj, EditMessage.codec()) + } + + export const decode = (buf: Uint8Array): EditMessage => { + return decodeMessage(buf, EditMessage.codec()) + } +} + +export interface DeleteMessage { + clock: bigint + chatId: string + messageId: string + grant: Uint8Array + messageType: MessageType +} + +export namespace DeleteMessage { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'chatId', codec: string }, + 3: { name: 'messageId', codec: string }, + 4: { name: 'grant', codec: bytes }, + 5: { name: 'messageType', codec: MessageType.codec() }, + }) + } + + export const encode = (obj: DeleteMessage): Uint8Array => { + return encodeMessage(obj, DeleteMessage.codec()) + } + + export const decode = (buf: Uint8Array): DeleteMessage => { + return decodeMessage(buf, DeleteMessage.codec()) + } +} + +export interface ChatMessage { + clock: bigint + timestamp: bigint + text: string + responseTo: string + ensName: string + chatId: string + messageType: MessageType + contentType: ChatMessage.ContentType + sticker: StickerMessage + image: ImageMessage + audio: AudioMessage + community: Uint8Array + grant: Uint8Array + displayName: string +} + +export namespace ChatMessage { + export enum ContentType { + UNKNOWN_CONTENT_TYPE = 'UNKNOWN_CONTENT_TYPE', + TEXT_PLAIN = 'TEXT_PLAIN', + STICKER = 'STICKER', + STATUS = 'STATUS', + EMOJI = 'EMOJI', + TRANSACTION_COMMAND = 'TRANSACTION_COMMAND', + SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 'SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP', + IMAGE = 'IMAGE', + AUDIO = 'AUDIO', + COMMUNITY = 'COMMUNITY', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', + } + + enum __ContentTypeValues { + UNKNOWN_CONTENT_TYPE = 0, + TEXT_PLAIN = 1, + STICKER = 2, + STATUS = 3, + EMOJI = 4, + TRANSACTION_COMMAND = 5, + SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6, + IMAGE = 7, + AUDIO = 8, + COMMUNITY = 9, + SYSTEM_MESSAGE_GAP = 10, + } + + export namespace ContentType { + export const codec = () => { + return enumeration(__ContentTypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'timestamp', codec: uint64 }, + 3: { name: 'text', codec: string }, + 4: { name: 'responseTo', codec: string }, + 5: { name: 'ensName', codec: string }, + 6: { name: 'chatId', codec: string }, + 7: { name: 'messageType', codec: MessageType.codec() }, + 8: { name: 'contentType', codec: ChatMessage.ContentType.codec() }, + 9: { name: 'sticker', codec: StickerMessage.codec() }, + 10: { name: 'image', codec: ImageMessage.codec() }, + 11: { name: 'audio', codec: AudioMessage.codec() }, + 12: { name: 'community', codec: bytes }, + 13: { name: 'grant', codec: bytes }, + 14: { name: 'displayName', codec: string }, + }) + } + + export const encode = (obj: ChatMessage): Uint8Array => { + return encodeMessage(obj, ChatMessage.codec()) + } + + export const decode = (buf: Uint8Array): ChatMessage => { + return decodeMessage(buf, ChatMessage.codec()) + } +} + +export enum MessageType { + UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE', + ONE_TO_ONE = 'ONE_TO_ONE', + PUBLIC_GROUP = 'PUBLIC_GROUP', + PRIVATE_GROUP = 'PRIVATE_GROUP', + SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP', + COMMUNITY_CHAT = 'COMMUNITY_CHAT', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', +} + +enum __MessageTypeValues { + UNKNOWN_MESSAGE_TYPE = 0, + ONE_TO_ONE = 1, + PUBLIC_GROUP = 2, + PRIVATE_GROUP = 3, + SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + COMMUNITY_CHAT = 5, + SYSTEM_MESSAGE_GAP = 6, +} + +export namespace MessageType { + export const codec = () => { + return enumeration(__MessageTypeValues) + } +} +export enum ImageType { + UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE', + PNG = 'PNG', + JPEG = 'JPEG', + WEBP = 'WEBP', + GIF = 'GIF', +} + +enum __ImageTypeValues { + UNKNOWN_IMAGE_TYPE = 0, + PNG = 1, + JPEG = 2, + WEBP = 3, + GIF = 4, +} + +export namespace ImageType { + export const codec = () => { + return enumeration(__ImageTypeValues) + } +} diff --git a/packages/status-js/proto/communities/v1/communities.proto b/packages/status-js/protos/communities.proto similarity index 64% rename from packages/status-js/proto/communities/v1/communities.proto rename to packages/status-js/protos/communities.proto index 48badc95..a9ec84b6 100644 --- a/packages/status-js/proto/communities/v1/communities.proto +++ b/packages/status-js/protos/communities.proto @@ -1,8 +1,6 @@ syntax = "proto3"; -package communities.v1; - -import "communities/v1/chat_identity.proto"; +import "chat-identity.proto"; message Grant { bytes community_id = 1; @@ -42,6 +40,12 @@ message CommunityDescription { map chats = 6; repeated string ban_list = 7; map categories = 8; + uint64 archive_magnetlink_clock = 9; + CommunityAdminSettings admin_settings = 10; +} + +message CommunityAdminSettings { + bool pin_message_all_members_enabled = 1; } message CommunityChat { @@ -78,3 +82,42 @@ message CommunityRequestToJoinResponse { bool accepted = 3; bytes grant = 4; } + +message CommunityMessageArchiveMagnetlink { + uint64 clock = 1; + string magnet_uri = 2; +} + +message WakuMessage { + bytes sig = 1; + uint64 timestamp = 2; + bytes topic = 3; + bytes payload = 4; + bytes padding = 5; + bytes hash = 6; +} + +message WakuMessageArchiveMetadata { + uint32 version = 1; + uint64 from = 2; + uint64 to = 3; + repeated bytes contentTopic = 4; +} + +message WakuMessageArchive { + uint32 version = 1; + WakuMessageArchiveMetadata metadata = 2; + repeated WakuMessage messages = 3; +} + +message WakuMessageArchiveIndexMetadata { + uint32 version = 1; + WakuMessageArchiveMetadata metadata = 2; + uint64 offset = 3; + uint64 size = 4; + uint64 padding = 5; +} + +message WakuMessageArchiveIndex { + map archives = 1; +} diff --git a/packages/status-js/protos/communities.ts b/packages/status-js/protos/communities.ts new file mode 100644 index 00000000..cd7510ae --- /dev/null +++ b/packages/status-js/protos/communities.ts @@ -0,0 +1,589 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + encodeMessage, + decodeMessage, + message, + bytes, + string, + uint64, + enumeration, + bool, + int32, + uint32, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface Grant { + communityId: Uint8Array + memberId: Uint8Array + chatId: string + clock: bigint +} + +export namespace Grant { + export const codec = (): Codec => { + return message({ + 1: { name: 'communityId', codec: bytes }, + 2: { name: 'memberId', codec: bytes }, + 3: { name: 'chatId', codec: string }, + 4: { name: 'clock', codec: uint64 }, + }) + } + + export const encode = (obj: Grant): Uint8Array => { + return encodeMessage(obj, Grant.codec()) + } + + export const decode = (buf: Uint8Array): Grant => { + return decodeMessage(buf, Grant.codec()) + } +} + +export interface CommunityMember { + roles: CommunityMember.Roles[] +} + +export namespace CommunityMember { + export enum Roles { + UNKNOWN_ROLE = 'UNKNOWN_ROLE', + ROLE_ALL = 'ROLE_ALL', + ROLE_MANAGE_USERS = 'ROLE_MANAGE_USERS', + } + + enum __RolesValues { + UNKNOWN_ROLE = 0, + ROLE_ALL = 1, + ROLE_MANAGE_USERS = 2, + } + + export namespace Roles { + export const codec = () => { + return enumeration(__RolesValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'roles', codec: CommunityMember.Roles.codec(), repeats: true }, + }) + } + + export const encode = (obj: CommunityMember): Uint8Array => { + return encodeMessage(obj, CommunityMember.codec()) + } + + export const decode = (buf: Uint8Array): CommunityMember => { + return decodeMessage(buf, CommunityMember.codec()) + } +} + +export interface CommunityPermissions { + ensOnly: boolean + private: boolean + access: CommunityPermissions.Access +} + +export namespace CommunityPermissions { + export enum Access { + UNKNOWN_ACCESS = 'UNKNOWN_ACCESS', + NO_MEMBERSHIP = 'NO_MEMBERSHIP', + INVITATION_ONLY = 'INVITATION_ONLY', + ON_REQUEST = 'ON_REQUEST', + } + + enum __AccessValues { + UNKNOWN_ACCESS = 0, + NO_MEMBERSHIP = 1, + INVITATION_ONLY = 2, + ON_REQUEST = 3, + } + + export namespace Access { + export const codec = () => { + return enumeration(__AccessValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'ensOnly', codec: bool }, + 2: { name: 'private', codec: bool }, + 3: { name: 'access', codec: CommunityPermissions.Access.codec() }, + }) + } + + export const encode = (obj: CommunityPermissions): Uint8Array => { + return encodeMessage(obj, CommunityPermissions.codec()) + } + + export const decode = (buf: Uint8Array): CommunityPermissions => { + return decodeMessage(buf, CommunityPermissions.codec()) + } +} + +export interface CommunityDescription { + clock: bigint + members: CommunityMember + permissions: CommunityPermissions + identity: ChatIdentity + chats: CommunityChat + banList: string[] + categories: CommunityCategory + archiveMagnetlinkClock: bigint + adminSettings: CommunityAdminSettings +} + +export namespace CommunityDescription { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'members', codec: CommunityMember.codec() }, + 3: { name: 'permissions', codec: CommunityPermissions.codec() }, + 5: { name: 'identity', codec: ChatIdentity.codec() }, + 6: { name: 'chats', codec: CommunityChat.codec() }, + 7: { name: 'banList', codec: string, repeats: true }, + 8: { name: 'categories', codec: CommunityCategory.codec() }, + 9: { name: 'archiveMagnetlinkClock', codec: uint64 }, + 10: { name: 'adminSettings', codec: CommunityAdminSettings.codec() }, + }) + } + + export const encode = (obj: CommunityDescription): Uint8Array => { + return encodeMessage(obj, CommunityDescription.codec()) + } + + export const decode = (buf: Uint8Array): CommunityDescription => { + return decodeMessage(buf, CommunityDescription.codec()) + } +} + +export interface CommunityAdminSettings { + pinMessageAllMembersEnabled: boolean +} + +export namespace CommunityAdminSettings { + export const codec = (): Codec => { + return message({ + 1: { name: 'pinMessageAllMembersEnabled', codec: bool }, + }) + } + + export const encode = (obj: CommunityAdminSettings): Uint8Array => { + return encodeMessage(obj, CommunityAdminSettings.codec()) + } + + export const decode = (buf: Uint8Array): CommunityAdminSettings => { + return decodeMessage(buf, CommunityAdminSettings.codec()) + } +} + +export interface CommunityChat { + members: CommunityMember + permissions: CommunityPermissions + identity: ChatIdentity + categoryId: string + position: number +} + +export namespace CommunityChat { + export const codec = (): Codec => { + return message({ + 1: { name: 'members', codec: CommunityMember.codec() }, + 2: { name: 'permissions', codec: CommunityPermissions.codec() }, + 3: { name: 'identity', codec: ChatIdentity.codec() }, + 4: { name: 'categoryId', codec: string }, + 5: { name: 'position', codec: int32 }, + }) + } + + export const encode = (obj: CommunityChat): Uint8Array => { + return encodeMessage(obj, CommunityChat.codec()) + } + + export const decode = (buf: Uint8Array): CommunityChat => { + return decodeMessage(buf, CommunityChat.codec()) + } +} + +export interface CommunityCategory { + categoryId: string + name: string + position: number +} + +export namespace CommunityCategory { + export const codec = (): Codec => { + return message({ + 1: { name: 'categoryId', codec: string }, + 2: { name: 'name', codec: string }, + 3: { name: 'position', codec: int32 }, + }) + } + + export const encode = (obj: CommunityCategory): Uint8Array => { + return encodeMessage(obj, CommunityCategory.codec()) + } + + export const decode = (buf: Uint8Array): CommunityCategory => { + return decodeMessage(buf, CommunityCategory.codec()) + } +} + +export interface CommunityInvitation { + communityDescription: Uint8Array + grant: Uint8Array + chatId: string + publicKey: Uint8Array +} + +export namespace CommunityInvitation { + export const codec = (): Codec => { + return message({ + 1: { name: 'communityDescription', codec: bytes }, + 2: { name: 'grant', codec: bytes }, + 3: { name: 'chatId', codec: string }, + 4: { name: 'publicKey', codec: bytes }, + }) + } + + export const encode = (obj: CommunityInvitation): Uint8Array => { + return encodeMessage(obj, CommunityInvitation.codec()) + } + + export const decode = (buf: Uint8Array): CommunityInvitation => { + return decodeMessage(buf, CommunityInvitation.codec()) + } +} + +export interface CommunityRequestToJoin { + clock: bigint + ensName: string + chatId: string + communityId: Uint8Array +} + +export namespace CommunityRequestToJoin { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'ensName', codec: string }, + 3: { name: 'chatId', codec: string }, + 4: { name: 'communityId', codec: bytes }, + }) + } + + export const encode = (obj: CommunityRequestToJoin): Uint8Array => { + return encodeMessage(obj, CommunityRequestToJoin.codec()) + } + + export const decode = (buf: Uint8Array): CommunityRequestToJoin => { + return decodeMessage(buf, CommunityRequestToJoin.codec()) + } +} + +export interface CommunityRequestToJoinResponse { + clock: bigint + community: CommunityDescription + accepted: boolean + grant: Uint8Array +} + +export namespace CommunityRequestToJoinResponse { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'community', codec: CommunityDescription.codec() }, + 3: { name: 'accepted', codec: bool }, + 4: { name: 'grant', codec: bytes }, + }) + } + + export const encode = (obj: CommunityRequestToJoinResponse): Uint8Array => { + return encodeMessage(obj, CommunityRequestToJoinResponse.codec()) + } + + export const decode = (buf: Uint8Array): CommunityRequestToJoinResponse => { + return decodeMessage(buf, CommunityRequestToJoinResponse.codec()) + } +} + +export interface CommunityMessageArchiveMagnetlink { + clock: bigint + magnetUri: string +} + +export namespace CommunityMessageArchiveMagnetlink { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'magnetUri', codec: string }, + }) + } + + export const encode = ( + obj: CommunityMessageArchiveMagnetlink + ): Uint8Array => { + return encodeMessage(obj, CommunityMessageArchiveMagnetlink.codec()) + } + + export const decode = ( + buf: Uint8Array + ): CommunityMessageArchiveMagnetlink => { + return decodeMessage(buf, CommunityMessageArchiveMagnetlink.codec()) + } +} + +export interface WakuMessage { + sig: Uint8Array + timestamp: bigint + topic: Uint8Array + payload: Uint8Array + padding: Uint8Array + hash: Uint8Array +} + +export namespace WakuMessage { + export const codec = (): Codec => { + return message({ + 1: { name: 'sig', codec: bytes }, + 2: { name: 'timestamp', codec: uint64 }, + 3: { name: 'topic', codec: bytes }, + 4: { name: 'payload', codec: bytes }, + 5: { name: 'padding', codec: bytes }, + 6: { name: 'hash', codec: bytes }, + }) + } + + export const encode = (obj: WakuMessage): Uint8Array => { + return encodeMessage(obj, WakuMessage.codec()) + } + + export const decode = (buf: Uint8Array): WakuMessage => { + return decodeMessage(buf, WakuMessage.codec()) + } +} + +export interface WakuMessageArchiveMetadata { + version: number + from: bigint + to: bigint + contentTopic: Uint8Array[] +} + +export namespace WakuMessageArchiveMetadata { + export const codec = (): Codec => { + return message({ + 1: { name: 'version', codec: uint32 }, + 2: { name: 'from', codec: uint64 }, + 3: { name: 'to', codec: uint64 }, + 4: { name: 'contentTopic', codec: bytes, repeats: true }, + }) + } + + export const encode = (obj: WakuMessageArchiveMetadata): Uint8Array => { + return encodeMessage(obj, WakuMessageArchiveMetadata.codec()) + } + + export const decode = (buf: Uint8Array): WakuMessageArchiveMetadata => { + return decodeMessage(buf, WakuMessageArchiveMetadata.codec()) + } +} + +export interface WakuMessageArchive { + version: number + metadata: WakuMessageArchiveMetadata + messages: WakuMessage[] +} + +export namespace WakuMessageArchive { + export const codec = (): Codec => { + return message({ + 1: { name: 'version', codec: uint32 }, + 2: { name: 'metadata', codec: WakuMessageArchiveMetadata.codec() }, + 3: { name: 'messages', codec: WakuMessage.codec(), repeats: true }, + }) + } + + export const encode = (obj: WakuMessageArchive): Uint8Array => { + return encodeMessage(obj, WakuMessageArchive.codec()) + } + + export const decode = (buf: Uint8Array): WakuMessageArchive => { + return decodeMessage(buf, WakuMessageArchive.codec()) + } +} + +export interface WakuMessageArchiveIndexMetadata { + version: number + metadata: WakuMessageArchiveMetadata + offset: bigint + size: bigint + padding: bigint +} + +export namespace WakuMessageArchiveIndexMetadata { + export const codec = (): Codec => { + return message({ + 1: { name: 'version', codec: uint32 }, + 2: { name: 'metadata', codec: WakuMessageArchiveMetadata.codec() }, + 3: { name: 'offset', codec: uint64 }, + 4: { name: 'size', codec: uint64 }, + 5: { name: 'padding', codec: uint64 }, + }) + } + + export const encode = (obj: WakuMessageArchiveIndexMetadata): Uint8Array => { + return encodeMessage(obj, WakuMessageArchiveIndexMetadata.codec()) + } + + export const decode = (buf: Uint8Array): WakuMessageArchiveIndexMetadata => { + return decodeMessage(buf, WakuMessageArchiveIndexMetadata.codec()) + } +} + +export interface WakuMessageArchiveIndex { + archives: WakuMessageArchiveIndexMetadata +} + +export namespace WakuMessageArchiveIndex { + export const codec = (): Codec => { + return message({ + 1: { name: 'archives', codec: WakuMessageArchiveIndexMetadata.codec() }, + }) + } + + export const encode = (obj: WakuMessageArchiveIndex): Uint8Array => { + return encodeMessage(obj, WakuMessageArchiveIndex.codec()) + } + + export const decode = (buf: Uint8Array): WakuMessageArchiveIndex => { + return decodeMessage(buf, WakuMessageArchiveIndex.codec()) + } +} + +export interface ChatIdentity { + clock: bigint + ensName: string + images: IdentityImage + displayName: string + description: string + color: string + emoji: string +} + +export namespace ChatIdentity { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'ensName', codec: string }, + 3: { name: 'images', codec: IdentityImage.codec() }, + 4: { name: 'displayName', codec: string }, + 5: { name: 'description', codec: string }, + 6: { name: 'color', codec: string }, + 7: { name: 'emoji', codec: string }, + }) + } + + export const encode = (obj: ChatIdentity): Uint8Array => { + return encodeMessage(obj, ChatIdentity.codec()) + } + + export const decode = (buf: Uint8Array): ChatIdentity => { + return decodeMessage(buf, ChatIdentity.codec()) + } +} + +export interface IdentityImage { + payload: Uint8Array + sourceType: IdentityImage.SourceType + imageType: ImageType + encryptionKeys: Uint8Array[] + encrypted: boolean +} + +export namespace IdentityImage { + export enum SourceType { + UNKNOWN_SOURCE_TYPE = 'UNKNOWN_SOURCE_TYPE', + RAW_PAYLOAD = 'RAW_PAYLOAD', + ENS_AVATAR = 'ENS_AVATAR', + } + + enum __SourceTypeValues { + UNKNOWN_SOURCE_TYPE = 0, + RAW_PAYLOAD = 1, + ENS_AVATAR = 2, + } + + export namespace SourceType { + export const codec = () => { + return enumeration(__SourceTypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'payload', codec: bytes }, + 2: { name: 'sourceType', codec: IdentityImage.SourceType.codec() }, + 3: { name: 'imageType', codec: ImageType.codec() }, + 4: { name: 'encryptionKeys', codec: bytes, repeats: true }, + 5: { name: 'encrypted', codec: bool }, + }) + } + + export const encode = (obj: IdentityImage): Uint8Array => { + return encodeMessage(obj, IdentityImage.codec()) + } + + export const decode = (buf: Uint8Array): IdentityImage => { + return decodeMessage(buf, IdentityImage.codec()) + } +} + +export enum MessageType { + UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE', + ONE_TO_ONE = 'ONE_TO_ONE', + PUBLIC_GROUP = 'PUBLIC_GROUP', + PRIVATE_GROUP = 'PRIVATE_GROUP', + SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP', + COMMUNITY_CHAT = 'COMMUNITY_CHAT', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', +} + +enum __MessageTypeValues { + UNKNOWN_MESSAGE_TYPE = 0, + ONE_TO_ONE = 1, + PUBLIC_GROUP = 2, + PRIVATE_GROUP = 3, + SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + COMMUNITY_CHAT = 5, + SYSTEM_MESSAGE_GAP = 6, +} + +export namespace MessageType { + export const codec = () => { + return enumeration(__MessageTypeValues) + } +} +export enum ImageType { + UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE', + PNG = 'PNG', + JPEG = 'JPEG', + WEBP = 'WEBP', + GIF = 'GIF', +} + +enum __ImageTypeValues { + UNKNOWN_IMAGE_TYPE = 0, + PNG = 1, + JPEG = 2, + WEBP = 3, + GIF = 4, +} + +export namespace ImageType { + export const codec = () => { + return enumeration(__ImageTypeValues) + } +} diff --git a/packages/status-js/proto/communities/v1/emoji_reaction.proto b/packages/status-js/protos/emoji-reaction.proto similarity index 93% rename from packages/status-js/proto/communities/v1/emoji_reaction.proto rename to packages/status-js/protos/emoji-reaction.proto index 98726f25..f1652c73 100644 --- a/packages/status-js/proto/communities/v1/emoji_reaction.proto +++ b/packages/status-js/protos/emoji-reaction.proto @@ -1,8 +1,6 @@ syntax = "proto3"; -package communities.v1; - -import "communities/v1/enums.proto"; +import "enums.proto"; message EmojiReaction { // clock Lamport timestamp of the chat message @@ -36,4 +34,4 @@ message EmojiReaction { // Grant for organisation chat messages bytes grant = 7; -} \ No newline at end of file +} diff --git a/packages/status-js/protos/emoji-reaction.ts b/packages/status-js/protos/emoji-reaction.ts new file mode 100644 index 00000000..b8c69809 --- /dev/null +++ b/packages/status-js/protos/emoji-reaction.ts @@ -0,0 +1,119 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + enumeration, + encodeMessage, + decodeMessage, + message, + uint64, + string, + bool, + bytes, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface EmojiReaction { + clock: bigint + chatId: string + messageId: string + messageType: MessageType + type: EmojiReaction.Type + retracted: boolean + grant: Uint8Array +} + +export namespace EmojiReaction { + export enum Type { + UNKNOWN_EMOJI_REACTION_TYPE = 'UNKNOWN_EMOJI_REACTION_TYPE', + LOVE = 'LOVE', + THUMBS_UP = 'THUMBS_UP', + THUMBS_DOWN = 'THUMBS_DOWN', + LAUGH = 'LAUGH', + SAD = 'SAD', + ANGRY = 'ANGRY', + } + + enum __TypeValues { + UNKNOWN_EMOJI_REACTION_TYPE = 0, + LOVE = 1, + THUMBS_UP = 2, + THUMBS_DOWN = 3, + LAUGH = 4, + SAD = 5, + ANGRY = 6, + } + + export namespace Type { + export const codec = () => { + return enumeration(__TypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'chatId', codec: string }, + 3: { name: 'messageId', codec: string }, + 4: { name: 'messageType', codec: MessageType.codec() }, + 5: { name: 'type', codec: EmojiReaction.Type.codec() }, + 6: { name: 'retracted', codec: bool }, + 7: { name: 'grant', codec: bytes }, + }) + } + + export const encode = (obj: EmojiReaction): Uint8Array => { + return encodeMessage(obj, EmojiReaction.codec()) + } + + export const decode = (buf: Uint8Array): EmojiReaction => { + return decodeMessage(buf, EmojiReaction.codec()) + } +} + +export enum MessageType { + UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE', + ONE_TO_ONE = 'ONE_TO_ONE', + PUBLIC_GROUP = 'PUBLIC_GROUP', + PRIVATE_GROUP = 'PRIVATE_GROUP', + SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP', + COMMUNITY_CHAT = 'COMMUNITY_CHAT', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', +} + +enum __MessageTypeValues { + UNKNOWN_MESSAGE_TYPE = 0, + ONE_TO_ONE = 1, + PUBLIC_GROUP = 2, + PRIVATE_GROUP = 3, + SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + COMMUNITY_CHAT = 5, + SYSTEM_MESSAGE_GAP = 6, +} + +export namespace MessageType { + export const codec = () => { + return enumeration(__MessageTypeValues) + } +} +export enum ImageType { + UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE', + PNG = 'PNG', + JPEG = 'JPEG', + WEBP = 'WEBP', + GIF = 'GIF', +} + +enum __ImageTypeValues { + UNKNOWN_IMAGE_TYPE = 0, + PNG = 1, + JPEG = 2, + WEBP = 3, + GIF = 4, +} + +export namespace ImageType { + export const codec = () => { + return enumeration(__ImageTypeValues) + } +} diff --git a/packages/status-js/protos/enums.proto b/packages/status-js/protos/enums.proto new file mode 100644 index 00000000..b58762e0 --- /dev/null +++ b/packages/status-js/protos/enums.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +enum MessageType { + UNKNOWN_MESSAGE_TYPE = 0; + ONE_TO_ONE = 1; + PUBLIC_GROUP = 2; + PRIVATE_GROUP = 3; + // Only local + SYSTEM_MESSAGE_PRIVATE_GROUP = 4; + COMMUNITY_CHAT = 5; + // Only local + SYSTEM_MESSAGE_GAP = 6; +} + +enum ImageType { + UNKNOWN_IMAGE_TYPE = 0; + + // Raster image files is payload data that can be read as a raster image + PNG = 1; + JPEG = 2; + WEBP = 3; + GIF = 4; +} diff --git a/packages/status-js/protos/enums.ts b/packages/status-js/protos/enums.ts new file mode 100644 index 00000000..3446b901 --- /dev/null +++ b/packages/status-js/protos/enums.ts @@ -0,0 +1,51 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { enumeration } from 'protons-runtime' + +export enum MessageType { + UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE', + ONE_TO_ONE = 'ONE_TO_ONE', + PUBLIC_GROUP = 'PUBLIC_GROUP', + PRIVATE_GROUP = 'PRIVATE_GROUP', + SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP', + COMMUNITY_CHAT = 'COMMUNITY_CHAT', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', +} + +enum __MessageTypeValues { + UNKNOWN_MESSAGE_TYPE = 0, + ONE_TO_ONE = 1, + PUBLIC_GROUP = 2, + PRIVATE_GROUP = 3, + SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + COMMUNITY_CHAT = 5, + SYSTEM_MESSAGE_GAP = 6, +} + +export namespace MessageType { + export const codec = () => { + return enumeration(__MessageTypeValues) + } +} +export enum ImageType { + UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE', + PNG = 'PNG', + JPEG = 'JPEG', + WEBP = 'WEBP', + GIF = 'GIF', +} + +enum __ImageTypeValues { + UNKNOWN_IMAGE_TYPE = 0, + PNG = 1, + JPEG = 2, + WEBP = 3, + GIF = 4, +} + +export namespace ImageType { + export const codec = () => { + return enumeration(__ImageTypeValues) + } +} diff --git a/packages/status-js/protos/pin-message.proto b/packages/status-js/protos/pin-message.proto new file mode 100644 index 00000000..9becc03b --- /dev/null +++ b/packages/status-js/protos/pin-message.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "enums.proto"; + +message PinMessage { + uint64 clock = 1; + string message_id = 2; + string chat_id = 3; + bool pinned = 4; + // The type of message (public/one-to-one/private-group-chat) + MessageType message_type = 5; +} diff --git a/packages/status-js/protos/pin-message.ts b/packages/status-js/protos/pin-message.ts new file mode 100644 index 00000000..14c0b32d --- /dev/null +++ b/packages/status-js/protos/pin-message.ts @@ -0,0 +1,88 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + encodeMessage, + decodeMessage, + message, + uint64, + string, + bool, + enumeration, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface PinMessage { + clock: bigint + messageId: string + chatId: string + pinned: boolean + messageType: MessageType +} + +export namespace PinMessage { + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'messageId', codec: string }, + 3: { name: 'chatId', codec: string }, + 4: { name: 'pinned', codec: bool }, + 5: { name: 'messageType', codec: MessageType.codec() }, + }) + } + + export const encode = (obj: PinMessage): Uint8Array => { + return encodeMessage(obj, PinMessage.codec()) + } + + export const decode = (buf: Uint8Array): PinMessage => { + return decodeMessage(buf, PinMessage.codec()) + } +} + +export enum MessageType { + UNKNOWN_MESSAGE_TYPE = 'UNKNOWN_MESSAGE_TYPE', + ONE_TO_ONE = 'ONE_TO_ONE', + PUBLIC_GROUP = 'PUBLIC_GROUP', + PRIVATE_GROUP = 'PRIVATE_GROUP', + SYSTEM_MESSAGE_PRIVATE_GROUP = 'SYSTEM_MESSAGE_PRIVATE_GROUP', + COMMUNITY_CHAT = 'COMMUNITY_CHAT', + SYSTEM_MESSAGE_GAP = 'SYSTEM_MESSAGE_GAP', +} + +enum __MessageTypeValues { + UNKNOWN_MESSAGE_TYPE = 0, + ONE_TO_ONE = 1, + PUBLIC_GROUP = 2, + PRIVATE_GROUP = 3, + SYSTEM_MESSAGE_PRIVATE_GROUP = 4, + COMMUNITY_CHAT = 5, + SYSTEM_MESSAGE_GAP = 6, +} + +export namespace MessageType { + export const codec = () => { + return enumeration(__MessageTypeValues) + } +} +export enum ImageType { + UNKNOWN_IMAGE_TYPE = 'UNKNOWN_IMAGE_TYPE', + PNG = 'PNG', + JPEG = 'JPEG', + WEBP = 'WEBP', + GIF = 'GIF', +} + +enum __ImageTypeValues { + UNKNOWN_IMAGE_TYPE = 0, + PNG = 1, + JPEG = 2, + WEBP = 3, + GIF = 4, +} + +export namespace ImageType { + export const codec = () => { + return enumeration(__ImageTypeValues) + } +} diff --git a/packages/status-js/proto/communities/v1/status_update.proto b/packages/status-js/protos/status-update.proto similarity index 63% rename from packages/status-js/proto/communities/v1/status_update.proto rename to packages/status-js/protos/status-update.proto index 759b390e..a9d6358c 100644 --- a/packages/status-js/proto/communities/v1/status_update.proto +++ b/packages/status-js/protos/status-update.proto @@ -1,7 +1,5 @@ syntax = "proto3"; -package communities.v1; - /* Specs: :AUTOMATIC To Send - "AUTOMATIC" status ping every 5 minutes @@ -14,19 +12,19 @@ package communities.v1; Display - Offline forever Note: Only send pings if the user interacted with the app in the last x minutes. */ message StatusUpdate { - - uint64 clock = 1; - - StatusType status_type = 2; - - string custom_text = 3; - - enum StatusType { - UNKNOWN_STATUS_TYPE = 0; - AUTOMATIC = 1; - DO_NOT_DISTURB = 2; - ALWAYS_ONLINE = 3; - INACTIVE = 4; - }; - - } \ No newline at end of file + + uint64 clock = 1; + + StatusType status_type = 2; + + string custom_text = 3; + + enum StatusType { + UNKNOWN_STATUS_TYPE = 0; + AUTOMATIC = 1; + DO_NOT_DISTURB = 2; + ALWAYS_ONLINE = 3; + INACTIVE = 4; + }; + +} diff --git a/packages/status-js/protos/status-update.ts b/packages/status-js/protos/status-update.ts new file mode 100644 index 00000000..ad86a27a --- /dev/null +++ b/packages/status-js/protos/status-update.ts @@ -0,0 +1,58 @@ +/* eslint-disable import/export */ +/* eslint-disable @typescript-eslint/no-namespace */ + +import { + enumeration, + encodeMessage, + decodeMessage, + message, + uint64, + string, +} from 'protons-runtime' +import type { Codec } from 'protons-runtime' + +export interface StatusUpdate { + clock: bigint + statusType: StatusUpdate.StatusType + customText: string +} + +export namespace StatusUpdate { + export enum StatusType { + UNKNOWN_STATUS_TYPE = 'UNKNOWN_STATUS_TYPE', + AUTOMATIC = 'AUTOMATIC', + DO_NOT_DISTURB = 'DO_NOT_DISTURB', + ALWAYS_ONLINE = 'ALWAYS_ONLINE', + INACTIVE = 'INACTIVE', + } + + enum __StatusTypeValues { + UNKNOWN_STATUS_TYPE = 0, + AUTOMATIC = 1, + DO_NOT_DISTURB = 2, + ALWAYS_ONLINE = 3, + INACTIVE = 4, + } + + export namespace StatusType { + export const codec = () => { + return enumeration(__StatusTypeValues) + } + } + + export const codec = (): Codec => { + return message({ + 1: { name: 'clock', codec: uint64 }, + 2: { name: 'statusType', codec: StatusUpdate.StatusType.codec() }, + 3: { name: 'customText', codec: string }, + }) + } + + export const encode = (obj: StatusUpdate): Uint8Array => { + return encodeMessage(obj, StatusUpdate.codec()) + } + + export const decode = (buf: Uint8Array): StatusUpdate => { + return decodeMessage(buf, StatusUpdate.codec()) + } +} diff --git a/yarn.lock b/yarn.lock index 95e593b0..d8bcb9d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1611,6 +1611,11 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== +"@types/minimist@^1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" + integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== + "@types/mocha@^9.0.0": version "9.1.0" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.0.tgz#baf17ab2cca3fcce2d322ebc30454bff487efad5" @@ -1631,10 +1636,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.25.tgz#bb812b58bacbd060ce85921250d8b4ca553cd4a2" integrity sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ== -"@types/object-hash@^1.3.0": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@types/object-hash/-/object-hash-1.3.4.tgz#079ba142be65833293673254831b5e3e847fe58b" - integrity sha512-xFdpkAkikBgqBdG9vIlsqffDV8GpvnPEzs0IUtr1v3BEB97ijsFQ4RXVbUZwjFThhB4MDSTUfvmxUD5PGx0wXA== +"@types/normalize-package-data@^2.4.0": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" + integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== "@types/parse-json@^4.0.0": version "4.0.0" @@ -2014,6 +2019,11 @@ array.prototype.flatmap@^1.2.5: define-properties "^1.1.3" es-abstract "^1.19.0" +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== + asn1.js@^5.2.0: version "5.4.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" @@ -2324,12 +2334,22 @@ camelcase-css@^2.0.1: resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5" integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== +camelcase-keys@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252" + integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg== + dependencies: + camelcase "^6.3.0" + map-obj "^4.1.0" + quick-lru "^5.1.1" + type-fest "^1.2.1" + camelcase@^5.0.0: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.0.0: +camelcase@^6.0.0, camelcase@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -2761,11 +2781,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -dataloader@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8" - integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw== - datastore-core@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/datastore-core/-/datastore-core-7.0.1.tgz#f50f30bb55474a569118d41bba6052896b096aec" @@ -2804,7 +2819,15 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -decamelize@^1.2.0: +decamelize-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk= + dependencies: + decamelize "^1.1.0" + map-obj "^1.0.0" + +decamelize@^1.1.0, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= @@ -2814,6 +2837,11 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== +decamelize@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-5.0.1.tgz#db11a92e58c741ef339fb0a2868d8a06a9a7b1e9" + integrity sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA== + deep-eql@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" @@ -3551,7 +3579,7 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-up@5.0.0: +find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -3769,6 +3797,11 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" +hard-rejection@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" + integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== + has-bigints@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" @@ -3863,6 +3896,13 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== +hosted-git-info@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224" + integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== + dependencies: + lru-cache "^6.0.0" + html-entities@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.2.tgz#760b404685cb1d794e4f4b744332e3b00dcfe488" @@ -3946,6 +3986,11 @@ indent-string@^4.0.0: resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== +indent-string@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5" + integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -4074,6 +4119,13 @@ is-core-module@^2.2.0, is-core-module@^2.8.0, is-core-module@^2.8.1: dependencies: has "^1.0.3" +is-core-module@^2.5.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== + dependencies: + has "^1.0.3" + is-date-object@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" @@ -4162,6 +4214,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-plain-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" @@ -4540,6 +4597,11 @@ jsprim@^1.2.2: array-includes "^3.1.3" object.assign "^4.1.2" +kind-of@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + language-subtag-registry@~0.3.2: version "0.3.21" resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.21.tgz#04ac218bea46f04cb039084602c6da9e788dd45a" @@ -4829,7 +4891,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.4: +lodash@^4.17.11, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -4895,6 +4957,16 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +map-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= + +map-obj@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" + integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== + md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -4914,6 +4986,24 @@ memorystream@^0.3.1: resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= +meow@^10.1.2: + version "10.1.2" + resolved "https://registry.yarnpkg.com/meow/-/meow-10.1.2.tgz#62951cb69afa69594142c8250806bc30a3912e4d" + integrity sha512-zbuAlN+V/sXlbGchNS9WTWjUzeamwMt/BApKCJi7B0QyZstZaMx0n4Unll/fg0njGtMdC9UP5SAscvOCLYdM+Q== + dependencies: + "@types/minimist" "^1.2.2" + camelcase-keys "^7.0.0" + decamelize "^5.0.0" + decamelize-keys "^1.1.0" + hard-rejection "^2.1.0" + minimist-options "4.1.0" + normalize-package-data "^3.0.2" + read-pkg-up "^8.0.0" + redent "^4.0.0" + trim-newlines "^4.0.2" + type-fest "^1.2.2" + yargs-parser "^20.2.9" + merge-options@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7" @@ -4964,6 +5054,11 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +min-indent@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" + integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -4988,6 +5083,15 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" +minimist-options@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" + integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== + dependencies: + arrify "^1.0.1" + is-plain-obj "^1.1.0" + kind-of "^6.0.3" + minimist@^1.1.1: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" @@ -5216,6 +5320,16 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" +normalize-package-data@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" + integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== + dependencies: + hosted-git-info "^4.0.1" + is-core-module "^2.5.0" + semver "^7.3.4" + validate-npm-package-license "^3.0.1" + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" @@ -5282,11 +5396,6 @@ object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= -object-hash@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" - integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== - object-hash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" @@ -5576,7 +5685,7 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" -parse-json@^5.0.0: +parse-json@^5.0.0, parse-json@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== @@ -6017,6 +6126,22 @@ protobufjs@^6.10.2, protobufjs@^6.11.2, protobufjs@^6.8.8: "@types/node" ">=13.7.0" long "^4.0.0" +protons-runtime@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-1.0.4.tgz#85db97f82fb03a1205eafb591904736ba34e2972" + integrity sha512-DSKWjAgwaXhtYO5Jo/MrU8n/75I/P2IhxU0Fk/lSrXx6Gxl5DH+I6cHcbGAYFmAlOBmU4QRa0mvVme8VXlDeUg== + dependencies: + uint8arraylist "^1.4.0" + uint8arrays "^3.0.0" + +protons@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/protons/-/protons-3.0.4.tgz#29fbcbb2e43952e6a3e072e240b4d94d43778b09" + integrity sha512-R0X/4pCfpXo3X2CVMmhDLHnHRqVg202N32p8qESKc1Vh8cD7Lqj6DBB/Z6yk6lgrH2UEneCHmHYzqonRl+l+pg== + dependencies: + meow "^10.1.2" + protobufjs "^6.11.2" + psl@^1.1.28: version "1.8.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" @@ -6169,6 +6294,15 @@ react@^17.0.0, react@^17.0.2: loose-envify "^1.1.0" object-assign "^4.1.1" +read-pkg-up@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-8.0.0.tgz#72f595b65e66110f43b052dd9af4de6b10534670" + integrity sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ== + dependencies: + find-up "^5.0.0" + read-pkg "^6.0.0" + type-fest "^1.0.1" + read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" @@ -6178,6 +6312,16 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" +read-pkg@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-6.0.0.tgz#a67a7d6a1c2b0c3cd6aa2ea521f40c458a4a504c" + integrity sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^3.0.2" + parse-json "^5.2.0" + type-fest "^1.0.1" + readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" @@ -6201,6 +6345,14 @@ receptacle@^1.3.2: dependencies: ms "^2.1.1" +redent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-4.0.0.tgz#0c0ba7caabb24257ab3bb7a4fd95dd1d5c5681f9" + integrity sha512-tYkDkVVtYkSVhuQ4zBgfvciymHaeuel+zFKXShfDnFP5SyVEP7qo70Rf1jTOTCx3vGNAbnEi/xFkcfQVMIBWag== + dependencies: + indent-string "^5.0.0" + strip-indent "^4.0.0" + regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7: version "0.13.9" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" @@ -6383,6 +6535,13 @@ semver@^6.1.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.3.4: + version "7.3.7" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" + integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== + dependencies: + lru-cache "^6.0.0" + semver@^7.3.5: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" @@ -6714,6 +6873,13 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-4.0.0.tgz#b41379433dd06f5eae805e21d631e07ee670d853" + integrity sha512-mnVSV2l+Zv6BLpSD/8V87CW/y9EmmbYzGCIavsnsI6/nwn26DwffM/yztm30Z/I2DY9wdS3vXVCMnHDgZaVNoA== + dependencies: + min-indent "^1.0.1" + strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -6876,6 +7042,11 @@ tough-cookie@~2.5.0: psl "^1.1.28" punycode "^2.1.1" +trim-newlines@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-4.0.2.tgz#d6aaaf6a0df1b4b536d183879a6b939489808c7c" + integrity sha512-GJtWyq9InR/2HRiLZgpIKv+ufIKrVrvjQWEj7PxAXNc5dwbNJkqhAUoAGgzRmULAnoOM5EIpveYd3J2VeSAIew== + truncate-utf8-bytes@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz#405923909592d56f78a5818434b0b78489ca5f2b" @@ -6902,34 +7073,6 @@ ts-node@^10.2.1: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -ts-poet@^4.5.0: - version "4.10.0" - resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-4.10.0.tgz#8732374655e87f8f833e5d110938e346713e8c66" - integrity sha512-V5xzt+LDMVtxWvK12WVwHhGHTA//CeoPdWOqka0mMjlRqq7RPKYSfWEnzJdMmhNbd34BwZuZpip4mm+nqEcbQA== - dependencies: - lodash "^4.17.15" - prettier "^2.5.1" - -ts-proto-descriptors@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.6.0.tgz#ca6eafc882495a2e920da5b981d7b181b4e49c38" - integrity sha512-Vrhue2Ti99us/o76mGy28nF3W/Uanl1/8detyJw2yyRwiBC5yxy+hEZqQ/ZX2PbZ1vyCpJ51A9L4PnCCnkBMTQ== - dependencies: - long "^4.0.0" - protobufjs "^6.8.8" - -ts-proto@^1.83.0: - version "1.106.1" - resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.106.1.tgz#5681ce64879971e3a2ae9fa1385108b323255fb2" - integrity sha512-Nok5TwkqhfU4IZKtxZjvzTshKITBP6n5FMHBbgNNukplTAk+2OCBRZeA2Kh+svEmOvIHY/d4gnLHDQh8LHj/ww== - 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.6.0" - tsconfig-paths@^3.12.0, tsconfig-paths@^3.9.0: version "3.12.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz#19769aca6ee8f6a1a341e38c8fa45dd9fb18899b" @@ -6991,6 +7134,11 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== +type-fest@^1.0.1, type-fest@^1.2.1, type-fest@^1.2.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" + integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== + typescript@^4.0.0, typescript@^4.5.5: version "4.5.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" @@ -7001,6 +7149,13 @@ typescript@^4.6.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c" integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== +uint8arraylist@^1.4.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/uint8arraylist/-/uint8arraylist-1.5.1.tgz#b8b325865b65b62b4cec773bc568cdd03c691d08" + integrity sha512-UpPGcVlTVc7Brtwt4W2MfTqvJQsr8owHMKBnICsueSImiarVAHf8NGMjhMklFtgbCZN1/9S9oW5k1JwlalGHoA== + dependencies: + uint8arrays "^3.0.0" + uint8arrays@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.0.0.tgz#260869efb8422418b6f04e3fac73a3908175c63b" @@ -7283,7 +7438,7 @@ yargs-parser@^13.1.2: camelcase "^5.0.0" decamelize "^1.2.0" -yargs-parser@^20.2.2: +yargs-parser@^20.2.2, yargs-parser@^20.2.9: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==