quiver-protobuf-typescript 1.0.0

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.
@@ -0,0 +1,246 @@
1
+ // Copyright 2021-2023 Buf Technologies, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // @generated by protoc-gen-es v1.2.0 with parameter "target=ts"
16
+ // @generated from file addressbook.proto (package example, syntax proto3)
17
+ /* eslint-disable */
18
+ // @ts-nocheck
19
+
20
+ import type {
21
+ BinaryReadOptions,
22
+ FieldList,
23
+ JsonReadOptions,
24
+ JsonValue,
25
+ PartialMessage,
26
+ PlainMessage,
27
+ } from "@bufbuild/protobuf";
28
+ import { Message, proto3, Timestamp } from "@bufbuild/protobuf";
29
+
30
+ /**
31
+ * @generated from message example.Person
32
+ */
33
+ export class Person extends Message<Person> {
34
+ /**
35
+ * @generated from field: string name = 1;
36
+ */
37
+ name = "";
38
+
39
+ /**
40
+ * Unique ID number for this person.
41
+ *
42
+ * @generated from field: int32 id = 2;
43
+ */
44
+ id = 0;
45
+
46
+ /**
47
+ * @generated from field: string email = 3;
48
+ */
49
+ email = "";
50
+
51
+ /**
52
+ * @generated from field: repeated example.Person.PhoneNumber phones = 4;
53
+ */
54
+ phones: Person_PhoneNumber[] = [];
55
+
56
+ /**
57
+ * @generated from field: google.protobuf.Timestamp last_updated = 5;
58
+ */
59
+ lastUpdated?: Timestamp;
60
+
61
+ constructor(data?: PartialMessage<Person>) {
62
+ super();
63
+ proto3.util.initPartial(data, this);
64
+ }
65
+
66
+ static readonly runtime: typeof proto3 = proto3;
67
+ static readonly typeName = "example.Person";
68
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
69
+ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
70
+ { no: 2, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
71
+ { no: 3, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ },
72
+ {
73
+ no: 4,
74
+ name: "phones",
75
+ kind: "message",
76
+ T: Person_PhoneNumber,
77
+ repeated: true,
78
+ },
79
+ { no: 5, name: "last_updated", kind: "message", T: Timestamp },
80
+ ]);
81
+
82
+ static fromBinary(
83
+ bytes: Uint8Array,
84
+ options?: Partial<BinaryReadOptions>
85
+ ): Person {
86
+ return new Person().fromBinary(bytes, options);
87
+ }
88
+
89
+ static fromJson(
90
+ jsonValue: JsonValue,
91
+ options?: Partial<JsonReadOptions>
92
+ ): Person {
93
+ return new Person().fromJson(jsonValue, options);
94
+ }
95
+
96
+ static fromJsonString(
97
+ jsonString: string,
98
+ options?: Partial<JsonReadOptions>
99
+ ): Person {
100
+ return new Person().fromJsonString(jsonString, options);
101
+ }
102
+
103
+ static equals(
104
+ a: Person | PlainMessage<Person> | undefined,
105
+ b: Person | PlainMessage<Person> | undefined
106
+ ): boolean {
107
+ return proto3.util.equals(Person, a, b);
108
+ }
109
+ }
110
+
111
+ /**
112
+ * @generated from enum example.Person.PhoneType
113
+ */
114
+ export enum Person_PhoneType {
115
+ /**
116
+ * @generated from enum value: MOBILE = 0;
117
+ */
118
+ MOBILE = 0,
119
+
120
+ /**
121
+ * @generated from enum value: HOME = 1;
122
+ */
123
+ HOME = 1,
124
+
125
+ /**
126
+ * @generated from enum value: WORK = 2;
127
+ */
128
+ WORK = 2,
129
+ }
130
+ // Retrieve enum metadata with: proto3.getEnumType(Person_PhoneType)
131
+ proto3.util.setEnumType(Person_PhoneType, "example.Person.PhoneType", [
132
+ { no: 0, name: "MOBILE" },
133
+ { no: 1, name: "HOME" },
134
+ { no: 2, name: "WORK" },
135
+ ]);
136
+
137
+ /**
138
+ * @generated from message example.Person.PhoneNumber
139
+ */
140
+ export class Person_PhoneNumber extends Message<Person_PhoneNumber> {
141
+ /**
142
+ * @generated from field: string number = 1;
143
+ */
144
+ number = "";
145
+
146
+ /**
147
+ * @generated from field: example.Person.PhoneType type = 2;
148
+ */
149
+ type = Person_PhoneType.MOBILE;
150
+
151
+ constructor(data?: PartialMessage<Person_PhoneNumber>) {
152
+ super();
153
+ proto3.util.initPartial(data, this);
154
+ }
155
+
156
+ static readonly runtime: typeof proto3 = proto3;
157
+ static readonly typeName = "example.Person.PhoneNumber";
158
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
159
+ { no: 1, name: "number", kind: "scalar", T: 9 /* ScalarType.STRING */ },
160
+ {
161
+ no: 2,
162
+ name: "type",
163
+ kind: "enum",
164
+ T: proto3.getEnumType(Person_PhoneType),
165
+ },
166
+ ]);
167
+
168
+ static fromBinary(
169
+ bytes: Uint8Array,
170
+ options?: Partial<BinaryReadOptions>
171
+ ): Person_PhoneNumber {
172
+ return new Person_PhoneNumber().fromBinary(bytes, options);
173
+ }
174
+
175
+ static fromJson(
176
+ jsonValue: JsonValue,
177
+ options?: Partial<JsonReadOptions>
178
+ ): Person_PhoneNumber {
179
+ return new Person_PhoneNumber().fromJson(jsonValue, options);
180
+ }
181
+
182
+ static fromJsonString(
183
+ jsonString: string,
184
+ options?: Partial<JsonReadOptions>
185
+ ): Person_PhoneNumber {
186
+ return new Person_PhoneNumber().fromJsonString(jsonString, options);
187
+ }
188
+
189
+ static equals(
190
+ a: Person_PhoneNumber | PlainMessage<Person_PhoneNumber> | undefined,
191
+ b: Person_PhoneNumber | PlainMessage<Person_PhoneNumber> | undefined
192
+ ): boolean {
193
+ return proto3.util.equals(Person_PhoneNumber, a, b);
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Our address book file is just one of these.
199
+ *
200
+ * @generated from message example.AddressBook
201
+ */
202
+ export class AddressBook extends Message<AddressBook> {
203
+ /**
204
+ * @generated from field: repeated example.Person people = 1;
205
+ */
206
+ people: Person[] = [];
207
+
208
+ constructor(data?: PartialMessage<AddressBook>) {
209
+ super();
210
+ proto3.util.initPartial(data, this);
211
+ }
212
+
213
+ static readonly runtime: typeof proto3 = proto3;
214
+ static readonly typeName = "example.AddressBook";
215
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
216
+ { no: 1, name: "people", kind: "message", T: Person, repeated: true },
217
+ ]);
218
+
219
+ static fromBinary(
220
+ bytes: Uint8Array,
221
+ options?: Partial<BinaryReadOptions>
222
+ ): AddressBook {
223
+ return new AddressBook().fromBinary(bytes, options);
224
+ }
225
+
226
+ static fromJson(
227
+ jsonValue: JsonValue,
228
+ options?: Partial<JsonReadOptions>
229
+ ): AddressBook {
230
+ return new AddressBook().fromJson(jsonValue, options);
231
+ }
232
+
233
+ static fromJsonString(
234
+ jsonString: string,
235
+ options?: Partial<JsonReadOptions>
236
+ ): AddressBook {
237
+ return new AddressBook().fromJsonString(jsonString, options);
238
+ }
239
+
240
+ static equals(
241
+ a: AddressBook | PlainMessage<AddressBook> | undefined,
242
+ b: AddressBook | PlainMessage<AddressBook> | undefined
243
+ ): boolean {
244
+ return proto3.util.equals(AddressBook, a, b);
245
+ }
246
+ }
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./addressbook_pb";
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "quiver-protobuf-typescript",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc"
9
+ },
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "@bufbuild/protobuf": "1.2.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "18.15.11",
17
+ "typescript": "4.7.2"
18
+ }
19
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Basic Options */
4
+ "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
5
+ "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
6
+ "lib": [
7
+ "es2017",
8
+ "es7",
9
+ "es6",
10
+ "dom"
11
+ ] /* Specify library files to be included in the compilation. */,
12
+ // "allowJs": true, /* Allow javascript files to be compiled. */
13
+ // "checkJs": true, /* Report errors in .js files. */
14
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
15
+ "declaration": true /* Generates corresponding '.d.ts' file. */,
16
+ // "sourceMap": true, /* Generates corresponding '.map' file. */
17
+ // "outFile": "./", /* Concatenate and emit output to single file. */
18
+ "outDir": "dist" /* Redirect output structure to the directory. */,
19
+ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
20
+ // "removeComments": true, /* Do not emit comments to output. */
21
+ // "noEmit": true, /* Do not emit outputs. */
22
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
23
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
24
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
25
+
26
+ /* Strict Type-Checking Options */
27
+ "strict": true /* Enable all strict type-checking options. */,
28
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
29
+ // "strictNullChecks": true, /* Enable strict null checks. */
30
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
31
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
32
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
33
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
34
+
35
+ /* Additional Checks */
36
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
37
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
38
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
39
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
40
+
41
+ /* Module Resolution Options */
42
+ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
43
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
44
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
45
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
46
+ // "typeRoots": [], /* List of folders to include type definitions from. */
47
+ // "types": [], /* Type declaration files to be included in compilation. */
48
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49
+ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
50
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
51
+
52
+ /* Source Map Options */
53
+ // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
54
+ // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
55
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
56
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
57
+
58
+ /* Experimental Options */
59
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
60
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
61
+ },
62
+ "exclude": ["node_modules", "dist", "test"]
63
+ }