@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
1 lines • 17.7 kB
Source Map (JSON)
{"version":3,"file":"messages.mjs","sources":["../../../../src/pullClient/protobuf-lite/messages.ts"],"sourcesContent":["/**\n * The four structures the Pull client sends and the four it receives.\n *\n * Field numbers come from the box's descriptors, restored into\n * `.github/contributing/pull-protobuf.md`. Two of them are easy to get wrong\n * and are called out where they are used:\n *\n * - **`OutgoingMessage` is not `IncomingMessage`.** The client SENDS\n * `IncomingMessage` (receivers, sender, body, expiry, type) and RECEIVES\n * `OutgoingMessage` (id, body, expiry, created, sender) — different layout,\n * `sender` at a different number. The vendored library hid this because it\n * resolved the type through the schema; here it has to be written out.\n * - **`created` is `fixed32`**, the only one in the schema. Read as four\n * little-endian bytes, not as a varint.\n */\nimport { Reader, Writer, WireError, tag, WIRE_BYTES, WIRE_FIXED32, WIRE_VARINT } from './wire'\n\nexport interface LiteReceiver { id?: Uint8Array, isPrivate?: boolean, signature?: Uint8Array }\nexport interface LiteSender { type?: number, id?: Uint8Array }\nexport interface LiteIncomingMessage {\n receivers?: LiteReceiver[]\n sender?: LiteSender\n body?: string\n expiry?: number\n type?: string\n}\nexport interface LiteOutgoingMessage {\n id?: Uint8Array\n body?: string\n expiry?: number\n created?: number\n sender?: LiteSender\n}\n/**\n * What `decodeResponseBatch` returns.\n *\n * `damaged` is not decoration. A frame whose tail could not be read is now\n * decoded as far as it goes rather than rejected — which keeps the sound\n * messages when the damage sits inside one message, and recovers nothing when\n * a frame is cut short at the end — and that removed the only signal a caller\n * had that the frame was broken at all. This puts it back: the caller logs it.\n *\n * It is not a guarantee of integrity. A length prefix inflated to a value that\n * still fits the buffer reads the following bytes as part of the current\n * message, parses cleanly, and leaves `damaged` false. Nothing at this layer\n * can detect that; protobuf has no checksum.\n */\nexport interface LiteResponseBatch {\n responses: LiteResponse[]\n /** True when any level stopped early on a tail it could not read. */\n damaged: boolean\n}\n\nexport interface LiteResponse {\n /** The `oneof` discriminator the client switches on. */\n command?: 'outgoingMessages' | 'channelStats' | 'serverStats'\n outgoingMessages?: { messages: LiteOutgoingMessage[] }\n}\n\n// region encode ////\n\n/**\n * Written only if the value is the object's OWN, and not null.\n *\n * This is protobuf.js's own rule (`message.f != null && hasOwnProperty(message, 'f')`),\n * and copying it is load-bearing rather than pedantic: `client.ts` builds\n * `Receiver.create(...)` / `IncomingMessage.create(...)` instances, and those\n * carry `isPrivate = false` and `type = ''` on the PROTOTYPE as defaults. A\n * plain `!== undefined` check sees them and writes two fields the library\n * omits. The differential test missed it, because it passes plain objects; the\n * switch test caught it.\n */\nfunction has<T extends object, K extends keyof T>(source: T, key: K): boolean {\n return Object.hasOwn(source, key) && source[key] !== null && source[key] !== undefined\n}\n\nfunction writeReceiver(receiver: LiteReceiver): Uint8Array {\n const w = new Writer()\n if (has(receiver, 'id')) {\n w.varint(tag(1, WIRE_BYTES)).bytes(receiver.id!)\n }\n if (has(receiver, 'isPrivate')) {\n w.varint(tag(2, WIRE_VARINT)).varint(receiver.isPrivate ? 1 : 0)\n }\n if (has(receiver, 'signature')) {\n w.varint(tag(3, WIRE_BYTES)).bytes(receiver.signature!)\n }\n\n return w.finish()\n}\n\nfunction writeSender(sender: LiteSender): Uint8Array {\n const w = new Writer()\n if (has(sender, 'type')) {\n w.varint(tag(1, WIRE_VARINT)).varint(sender.type!)\n }\n if (has(sender, 'id')) {\n w.varint(tag(2, WIRE_BYTES)).bytes(sender.id!)\n }\n\n return w.finish()\n}\n\nfunction writeIncomingMessage(message: LiteIncomingMessage): Uint8Array {\n const w = new Writer()\n for (const receiver of message.receivers ?? []) {\n w.varint(tag(1, WIRE_BYTES)).bytes(writeReceiver(receiver))\n }\n if (has(message, 'sender')) {\n w.varint(tag(2, WIRE_BYTES)).bytes(writeSender(message.sender!))\n }\n if (has(message, 'body')) {\n w.varint(tag(3, WIRE_BYTES)).string(message.body!)\n }\n if (has(message, 'expiry')) {\n w.varint(tag(4, WIRE_VARINT)).varint(message.expiry!)\n }\n if (has(message, 'type')) {\n w.varint(tag(5, WIRE_BYTES)).string(message.type!)\n }\n\n return w.finish()\n}\n\n/**\n * `RequestBatch { requests: [ Request { incomingMessages: { messages } } ] }`,\n * the only shape the client ever sends.\n */\nexport function encodeRequestBatch(messages: LiteIncomingMessage[]): Uint8Array {\n const messagesRequest = new Writer()\n for (const message of messages) {\n messagesRequest.varint(tag(1, WIRE_BYTES)).bytes(writeIncomingMessage(message))\n }\n\n const request = new Writer()\n request.varint(tag(1, WIRE_BYTES)).bytes(messagesRequest.finish())\n\n const batch = new Writer()\n batch.varint(tag(1, WIRE_BYTES)).bytes(request.finish())\n\n return batch.finish()\n}\n\n// endregion ////\n\n// region decode ////\n\n/**\n * Walk the fields of one message, and stop at a tail that cannot be read.\n *\n * A message whose OWN length prefix is intact but whose contents are damaged —\n * a nested `sender` whose length overruns, a field that ends mid-varint — used\n * to throw from inside it. Because the `catch` in `extractProtobufMessages`\n * wraps the whole decode, that one bad message dropped every message in the\n * batch, including its sound neighbours. protobuf.js copes with several of\n * these; a fuzz differential against it found six in four hundred where this\n * codec threw and the library did not.\n *\n * So a malformed tail now ends THIS message instead of the batch, keeping what\n * was read. Be precise about the reach of that: it rescues damage confined to\n * one message. A frame cut short at the END is not rescued — the cut breaks\n * every enclosing length prefix before reaching any message, so the top level\n * stops first and nothing is recovered, in either codec. Clamping an overrun to\n * the bytes that remain would recover it, and was rejected: an inflated prefix\n * mid-frame would then read the next message's bytes as this one's `id` and\n * deliver a message under a wrong id, breaking de-duplication and `mack`.\n *\n * Only a `WireError` is caught. Anything else — a bug in a field handler, say —\n * propagates, so this cannot turn a defect into a silent truncation. And the\n * damage is reported through `flag`, so it is not silent either.\n */\nfunction readFields(\n view: Uint8Array,\n flag: DamageFlag,\n onField: (field: number, wireType: number, r: Reader) => void\n): void {\n const r = new Reader(view)\n while (!r.done) {\n try {\n const key = r.varint()\n onField(key >>> 3, key & 7, r)\n } catch (error) {\n if (!(error instanceof WireError)) {\n throw error\n }\n flag.damaged = true\n return\n }\n }\n}\n\n/** Shared by every level of one decode, so a nested truncation surfaces at the top. */\ninterface DamageFlag { damaged: boolean }\n\nfunction readSender(view: Uint8Array, flag: DamageFlag): LiteSender {\n // Defaults, not `{}`. protobuf.js hands the caller a message whose unset\n // fields carry the schema's defaults; leaving them `undefined` here is what\n // made a frame without `id` throw inside `decodeId` and take the whole batch\n // with it (the catch in `extractProtobufMessages` is around the loop, not\n // around one message).\n const sender: LiteSender = { type: 0, id: new Uint8Array(0) }\n readFields(view, flag, (field, wireType, r) => {\n if (field === 1 && wireType === WIRE_VARINT) {\n sender.type = r.uint32()\n } else if (field === 2 && wireType === WIRE_BYTES) {\n sender.id = r.bytes()\n } else {\n r.skip(wireType)\n }\n })\n\n return sender\n}\n\nfunction readOutgoingMessage(view: Uint8Array, flag: DamageFlag): LiteOutgoingMessage {\n // See `readSender`: these are protobuf.js's defaults for the field types —\n // `bytes` empty, `string` empty, numbers zero. `sender` stays absent, as the\n // library leaves an unset message field null.\n const message: LiteOutgoingMessage = {\n id: new Uint8Array(0),\n body: '',\n expiry: 0,\n created: 0\n }\n readFields(view, flag, (field, wireType, r) => {\n if (field === 1 && wireType === WIRE_BYTES) {\n message.id = r.bytes()\n } else if (field === 2 && wireType === WIRE_BYTES) {\n message.body = r.string()\n } else if (field === 3 && wireType === WIRE_VARINT) {\n // `uint32`, masked the way the library masks it: a wire value of 2^32\n // reads back as 0 there and would read as 4294967296 here.\n message.expiry = r.uint32()\n } else if (field === 4 && wireType === WIRE_FIXED32) {\n // The schema's only fixed32.\n message.created = r.fixed32()\n } else if (field === 5 && wireType === WIRE_BYTES) {\n message.sender = readSender(r.bytes(), flag)\n } else {\n r.skip(wireType)\n }\n })\n\n return message\n}\n\nfunction readOutgoingMessagesResponse(view: Uint8Array, flag: DamageFlag): { messages: LiteOutgoingMessage[] } {\n const messages: LiteOutgoingMessage[] = []\n readFields(view, flag, (field, wireType, r) => {\n if (field === 1 && wireType === WIRE_BYTES) {\n messages.push(readOutgoingMessage(r.bytes(), flag))\n } else {\n r.skip(wireType)\n }\n })\n\n return { messages }\n}\n\nfunction readResponse(view: Uint8Array, flag: DamageFlag): LiteResponse {\n const response: LiteResponse = {}\n readFields(view, flag, (field, wireType, r) => {\n if (field === 1 && wireType === WIRE_BYTES) {\n response.outgoingMessages = readOutgoingMessagesResponse(r.bytes(), flag)\n response.command = 'outgoingMessages'\n } else if (field === 2 && wireType === WIRE_BYTES) {\n // Statistics. The client skips these by command name, so the payload is\n // not modelled — only the discriminator has to be right, because reading\n // it as `outgoingMessages` would hand the client a message list it never\n // received. `oneof` is last-one-wins on the wire, hence the overwrite.\n r.bytes()\n response.command = 'channelStats'\n } else if (field === 3 && wireType === WIRE_BYTES) {\n r.bytes()\n response.command = 'serverStats'\n } else {\n r.skip(wireType)\n }\n })\n\n return response\n}\n\nexport function decodeResponseBatch(view: Uint8Array): LiteResponseBatch {\n const flag: DamageFlag = { damaged: false }\n const responses: LiteResponse[] = []\n readFields(view, flag, (field, wireType, r) => {\n if (field === 1 && wireType === WIRE_BYTES) {\n responses.push(readResponse(r.bytes(), flag))\n } else {\n r.skip(wireType)\n }\n })\n\n return { responses, damaged: flag.damaged }\n}\n\n// endregion ////\n"],"names":[],"mappings":";;;;;;;;;;;;AAwEA,SAAS,GAAA,CAAyC,QAAW,GAAA,EAAiB;AAC5E,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,MAAA,EAAQ,GAAG,CAAA,IAAK,MAAA,CAAO,GAAG,CAAA,KAAM,IAAA,IAAQ,MAAA,CAAO,GAAG,CAAA,KAAM,MAAA;AAC/E;AAFS,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA;AAIT,SAAS,cAAc,QAAA,EAAoC;AACzD,EAAA,MAAM,CAAA,GAAI,IAAI,MAAA,EAAO;AACrB,EAAA,IAAI,GAAA,CAAI,QAAA,EAAU,IAAI,CAAA,EAAG;AACvB,IAAA,CAAA,CAAE,MAAA,CAAO,IAAI,CAAA,EAAG,UAAU,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