weave-typescript 0.4.5 → 0.5.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.
@@ -0,0 +1,35 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "weaveapi.modex.v1";
3
+ export interface Provider {
4
+ id: string;
5
+ slug: string;
6
+ name: string;
7
+ description: string;
8
+ websiteUrl: string;
9
+ documentationUrl: string;
10
+ logoUrl: string;
11
+ isActive: boolean;
12
+ modelCount: number;
13
+ createdAt: Date | undefined;
14
+ updatedAt: Date | undefined;
15
+ }
16
+ export declare const Provider: MessageFns<Provider>;
17
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
18
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
19
+ [K in keyof T]?: DeepPartial<T[K]>;
20
+ } : Partial<T>;
21
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
22
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
23
+ [K in keyof P]: Exact<P[K], I[K]>;
24
+ } & {
25
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
26
+ };
27
+ export interface MessageFns<T> {
28
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
29
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
30
+ fromJSON(object: any): T;
31
+ toJSON(message: T): unknown;
32
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
33
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
34
+ }
35
+ export {};
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.6.1
5
+ // protoc unknown
6
+ // source: weaveapi/modex/v1/provider.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Provider = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
12
+ exports.protobufPackage = "weaveapi.modex.v1";
13
+ function createBaseProvider() {
14
+ return {
15
+ id: "",
16
+ slug: "",
17
+ name: "",
18
+ description: "",
19
+ websiteUrl: "",
20
+ documentationUrl: "",
21
+ logoUrl: "",
22
+ isActive: false,
23
+ modelCount: 0,
24
+ createdAt: undefined,
25
+ updatedAt: undefined,
26
+ };
27
+ }
28
+ exports.Provider = {
29
+ encode(message, writer = new wire_1.BinaryWriter()) {
30
+ if (message.id !== "") {
31
+ writer.uint32(10).string(message.id);
32
+ }
33
+ if (message.slug !== "") {
34
+ writer.uint32(18).string(message.slug);
35
+ }
36
+ if (message.name !== "") {
37
+ writer.uint32(26).string(message.name);
38
+ }
39
+ if (message.description !== "") {
40
+ writer.uint32(34).string(message.description);
41
+ }
42
+ if (message.websiteUrl !== "") {
43
+ writer.uint32(42).string(message.websiteUrl);
44
+ }
45
+ if (message.documentationUrl !== "") {
46
+ writer.uint32(50).string(message.documentationUrl);
47
+ }
48
+ if (message.logoUrl !== "") {
49
+ writer.uint32(58).string(message.logoUrl);
50
+ }
51
+ if (message.isActive !== false) {
52
+ writer.uint32(64).bool(message.isActive);
53
+ }
54
+ if (message.modelCount !== 0) {
55
+ writer.uint32(72).int32(message.modelCount);
56
+ }
57
+ if (message.createdAt !== undefined) {
58
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join();
59
+ }
60
+ if (message.updatedAt !== undefined) {
61
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join();
62
+ }
63
+ return writer;
64
+ },
65
+ decode(input, length) {
66
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
67
+ let end = length === undefined ? reader.len : reader.pos + length;
68
+ const message = createBaseProvider();
69
+ while (reader.pos < end) {
70
+ const tag = reader.uint32();
71
+ switch (tag >>> 3) {
72
+ case 1: {
73
+ if (tag !== 10) {
74
+ break;
75
+ }
76
+ message.id = reader.string();
77
+ continue;
78
+ }
79
+ case 2: {
80
+ if (tag !== 18) {
81
+ break;
82
+ }
83
+ message.slug = reader.string();
84
+ continue;
85
+ }
86
+ case 3: {
87
+ if (tag !== 26) {
88
+ break;
89
+ }
90
+ message.name = reader.string();
91
+ continue;
92
+ }
93
+ case 4: {
94
+ if (tag !== 34) {
95
+ break;
96
+ }
97
+ message.description = reader.string();
98
+ continue;
99
+ }
100
+ case 5: {
101
+ if (tag !== 42) {
102
+ break;
103
+ }
104
+ message.websiteUrl = reader.string();
105
+ continue;
106
+ }
107
+ case 6: {
108
+ if (tag !== 50) {
109
+ break;
110
+ }
111
+ message.documentationUrl = reader.string();
112
+ continue;
113
+ }
114
+ case 7: {
115
+ if (tag !== 58) {
116
+ break;
117
+ }
118
+ message.logoUrl = reader.string();
119
+ continue;
120
+ }
121
+ case 8: {
122
+ if (tag !== 64) {
123
+ break;
124
+ }
125
+ message.isActive = reader.bool();
126
+ continue;
127
+ }
128
+ case 9: {
129
+ if (tag !== 72) {
130
+ break;
131
+ }
132
+ message.modelCount = reader.int32();
133
+ continue;
134
+ }
135
+ case 10: {
136
+ if (tag !== 82) {
137
+ break;
138
+ }
139
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
140
+ continue;
141
+ }
142
+ case 11: {
143
+ if (tag !== 90) {
144
+ break;
145
+ }
146
+ message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
147
+ continue;
148
+ }
149
+ }
150
+ if ((tag & 7) === 4 || tag === 0) {
151
+ break;
152
+ }
153
+ reader.skip(tag & 7);
154
+ }
155
+ return message;
156
+ },
157
+ fromJSON(object) {
158
+ return {
159
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
160
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
161
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
162
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
163
+ websiteUrl: isSet(object.websiteUrl) ? globalThis.String(object.websiteUrl) : "",
164
+ documentationUrl: isSet(object.documentationUrl) ? globalThis.String(object.documentationUrl) : "",
165
+ logoUrl: isSet(object.logoUrl) ? globalThis.String(object.logoUrl) : "",
166
+ isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false,
167
+ modelCount: isSet(object.modelCount) ? globalThis.Number(object.modelCount) : 0,
168
+ createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
169
+ updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
170
+ };
171
+ },
172
+ toJSON(message) {
173
+ const obj = {};
174
+ if (message.id !== "") {
175
+ obj.id = message.id;
176
+ }
177
+ if (message.slug !== "") {
178
+ obj.slug = message.slug;
179
+ }
180
+ if (message.name !== "") {
181
+ obj.name = message.name;
182
+ }
183
+ if (message.description !== "") {
184
+ obj.description = message.description;
185
+ }
186
+ if (message.websiteUrl !== "") {
187
+ obj.websiteUrl = message.websiteUrl;
188
+ }
189
+ if (message.documentationUrl !== "") {
190
+ obj.documentationUrl = message.documentationUrl;
191
+ }
192
+ if (message.logoUrl !== "") {
193
+ obj.logoUrl = message.logoUrl;
194
+ }
195
+ if (message.isActive !== false) {
196
+ obj.isActive = message.isActive;
197
+ }
198
+ if (message.modelCount !== 0) {
199
+ obj.modelCount = Math.round(message.modelCount);
200
+ }
201
+ if (message.createdAt !== undefined) {
202
+ obj.createdAt = message.createdAt.toISOString();
203
+ }
204
+ if (message.updatedAt !== undefined) {
205
+ obj.updatedAt = message.updatedAt.toISOString();
206
+ }
207
+ return obj;
208
+ },
209
+ create(base) {
210
+ return exports.Provider.fromPartial(base !== null && base !== void 0 ? base : {});
211
+ },
212
+ fromPartial(object) {
213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
214
+ const message = createBaseProvider();
215
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
216
+ message.slug = (_b = object.slug) !== null && _b !== void 0 ? _b : "";
217
+ message.name = (_c = object.name) !== null && _c !== void 0 ? _c : "";
218
+ message.description = (_d = object.description) !== null && _d !== void 0 ? _d : "";
219
+ message.websiteUrl = (_e = object.websiteUrl) !== null && _e !== void 0 ? _e : "";
220
+ message.documentationUrl = (_f = object.documentationUrl) !== null && _f !== void 0 ? _f : "";
221
+ message.logoUrl = (_g = object.logoUrl) !== null && _g !== void 0 ? _g : "";
222
+ message.isActive = (_h = object.isActive) !== null && _h !== void 0 ? _h : false;
223
+ message.modelCount = (_j = object.modelCount) !== null && _j !== void 0 ? _j : 0;
224
+ message.createdAt = (_k = object.createdAt) !== null && _k !== void 0 ? _k : undefined;
225
+ message.updatedAt = (_l = object.updatedAt) !== null && _l !== void 0 ? _l : undefined;
226
+ return message;
227
+ },
228
+ };
229
+ function toTimestamp(date) {
230
+ const seconds = Math.trunc(date.getTime() / 1000);
231
+ const nanos = (date.getTime() % 1000) * 1000000;
232
+ return { seconds, nanos };
233
+ }
234
+ function fromTimestamp(t) {
235
+ let millis = (t.seconds || 0) * 1000;
236
+ millis += (t.nanos || 0) / 1000000;
237
+ return new globalThis.Date(millis);
238
+ }
239
+ function fromJsonTimestamp(o) {
240
+ if (o instanceof globalThis.Date) {
241
+ return o;
242
+ }
243
+ else if (typeof o === "string") {
244
+ return new globalThis.Date(o);
245
+ }
246
+ else {
247
+ return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
248
+ }
249
+ }
250
+ function isSet(value) {
251
+ return value !== null && value !== undefined;
252
+ }