@inline-chat/protocol 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @inline-chat/protocol
2
+
3
+ Generated TypeScript protocol package for Inline APIs.
4
+
5
+ ## Source of Truth
6
+
7
+ - Proto definitions live in `proto/` at the repo root.
8
+ - This package is generated from those proto files.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ bun add @inline-chat/protocol
14
+ ```
15
+
16
+ ## Exports
17
+
18
+ - `@inline-chat/protocol`
19
+ - `@inline-chat/protocol/core`
20
+ - `@inline-chat/protocol/client`
21
+ - `@inline-chat/protocol/server`
22
+
23
+ ## Regenerate
24
+
25
+ From repo root:
26
+
27
+ ```bash
28
+ bun run generate:proto
29
+ ```
30
+
31
+ Do not manually edit generated files in this package.
@@ -0,0 +1,35 @@
1
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
5
+ import type { PartialMessage } from "@protobuf-ts/runtime";
6
+ import { MessageType } from "@protobuf-ts/runtime";
7
+ import { RpcCall } from "./core.js";
8
+ /**
9
+ * @generated from protobuf message client.Transaction
10
+ */
11
+ export interface Transaction {
12
+ /**
13
+ * @generated from protobuf field: string id = 1;
14
+ */
15
+ id: string;
16
+ /**
17
+ * @generated from protobuf field: int64 date = 2;
18
+ */
19
+ date: bigint;
20
+ /**
21
+ * @generated from protobuf field: RpcCall call = 3;
22
+ */
23
+ call?: RpcCall;
24
+ }
25
+ declare class Transaction$Type extends MessageType<Transaction> {
26
+ constructor();
27
+ create(value?: PartialMessage<Transaction>): Transaction;
28
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Transaction): Transaction;
29
+ internalBinaryWrite(message: Transaction, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
30
+ }
31
+ /**
32
+ * @generated MessageType for protobuf message client.Transaction
33
+ */
34
+ export declare const Transaction: Transaction$Type;
35
+ export {};
package/dist/client.js ADDED
@@ -0,0 +1,67 @@
1
+ import { WireType } from "@protobuf-ts/runtime";
2
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
3
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
+ import { MessageType } from "@protobuf-ts/runtime";
5
+ import { RpcCall } from "./core.js";
6
+ // @generated message type with reflection information, may provide speed optimized methods
7
+ class Transaction$Type extends MessageType {
8
+ constructor() {
9
+ super("client.Transaction", [
10
+ { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
11
+ { no: 2, name: "date", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
12
+ { no: 3, name: "call", kind: "message", T: () => RpcCall }
13
+ ]);
14
+ }
15
+ create(value) {
16
+ const message = globalThis.Object.create((this.messagePrototype));
17
+ message.id = "";
18
+ message.date = 0n;
19
+ if (value !== undefined)
20
+ reflectionMergePartial(this, message, value);
21
+ return message;
22
+ }
23
+ internalBinaryRead(reader, length, options, target) {
24
+ let message = target ?? this.create(), end = reader.pos + length;
25
+ while (reader.pos < end) {
26
+ let [fieldNo, wireType] = reader.tag();
27
+ switch (fieldNo) {
28
+ case /* string id */ 1:
29
+ message.id = reader.string();
30
+ break;
31
+ case /* int64 date */ 2:
32
+ message.date = reader.int64().toBigInt();
33
+ break;
34
+ case /* RpcCall call */ 3:
35
+ message.call = RpcCall.internalBinaryRead(reader, reader.uint32(), options, message.call);
36
+ break;
37
+ default:
38
+ let u = options.readUnknownField;
39
+ if (u === "throw")
40
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
41
+ let d = reader.skip(wireType);
42
+ if (u !== false)
43
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
44
+ }
45
+ }
46
+ return message;
47
+ }
48
+ internalBinaryWrite(message, writer, options) {
49
+ /* string id = 1; */
50
+ if (message.id !== "")
51
+ writer.tag(1, WireType.LengthDelimited).string(message.id);
52
+ /* int64 date = 2; */
53
+ if (message.date !== 0n)
54
+ writer.tag(2, WireType.Varint).int64(message.date);
55
+ /* RpcCall call = 3; */
56
+ if (message.call)
57
+ RpcCall.internalBinaryWrite(message.call, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
58
+ let u = options.writeUnknownFields;
59
+ if (u !== false)
60
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
61
+ return writer;
62
+ }
63
+ }
64
+ /**
65
+ * @generated MessageType for protobuf message client.Transaction
66
+ */
67
+ export const Transaction = new Transaction$Type();