weave-typescript 0.4.4 → 0.5.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.
- package/dist/google/protobuf/timestamp.pb.d.ts +128 -0
- package/dist/google/protobuf/timestamp.pb.js +93 -0
- package/dist/weaveapi/auth/v1/service.pb.d.ts +705 -0
- package/dist/weaveapi/auth/v1/service.pb.js +3910 -0
- package/dist/weaveapi/auth/v1/session.pb.d.ts +43 -0
- package/dist/weaveapi/auth/v1/session.pb.js +268 -0
- package/dist/weaveapi/auth/v1/usage.pb.d.ts +76 -0
- package/dist/weaveapi/auth/v1/usage.pb.js +761 -0
- package/dist/weaveapi/auth/v1/user.pb.d.ts +141 -0
- package/dist/weaveapi/auth/v1/user.pb.js +1439 -0
- package/dist/weaveapi/modex/v1/model.pb.d.ts +147 -0
- package/dist/weaveapi/modex/v1/model.pb.js +1655 -0
- package/dist/weaveapi/modex/v1/provider.pb.d.ts +35 -0
- package/dist/weaveapi/modex/v1/provider.pb.js +252 -0
- package/dist/weaveapi/modex/v1/service.pb.d.ts +517 -0
- package/dist/weaveapi/modex/v1/service.pb.js +4431 -0
- package/dist/weaveapi/payment/v1/invoice.pb.d.ts +92 -0
- package/dist/weaveapi/payment/v1/invoice.pb.js +899 -0
- package/dist/weaveapi/payment/v1/service.pb.d.ts +657 -0
- package/dist/weaveapi/payment/v1/service.pb.js +4153 -0
- package/dist/weaveapi/payment/v1/subscription.pb.d.ts +167 -0
- package/dist/weaveapi/payment/v1/subscription.pb.js +1747 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1439 @@
|
|
|
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/auth/v1/user.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.APIKey = exports.UserPreferences = exports.SubscriptionInfo = exports.OAuthProvider = exports.OAuthAccount_MetadataEntry = exports.OAuthAccount = exports.User = 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.auth.v1";
|
|
13
|
+
function createBaseUser() {
|
|
14
|
+
return {
|
|
15
|
+
id: "",
|
|
16
|
+
email: "",
|
|
17
|
+
username: "",
|
|
18
|
+
fullName: "",
|
|
19
|
+
avatarUrl: "",
|
|
20
|
+
oauthAccounts: [],
|
|
21
|
+
primaryProvider: "",
|
|
22
|
+
subscription: undefined,
|
|
23
|
+
accountStatus: "",
|
|
24
|
+
emailVerified: false,
|
|
25
|
+
lastLoginAt: undefined,
|
|
26
|
+
createdAt: undefined,
|
|
27
|
+
updatedAt: undefined,
|
|
28
|
+
preferences: undefined,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.User = {
|
|
32
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
33
|
+
if (message.id !== "") {
|
|
34
|
+
writer.uint32(10).string(message.id);
|
|
35
|
+
}
|
|
36
|
+
if (message.email !== "") {
|
|
37
|
+
writer.uint32(18).string(message.email);
|
|
38
|
+
}
|
|
39
|
+
if (message.username !== "") {
|
|
40
|
+
writer.uint32(26).string(message.username);
|
|
41
|
+
}
|
|
42
|
+
if (message.fullName !== "") {
|
|
43
|
+
writer.uint32(34).string(message.fullName);
|
|
44
|
+
}
|
|
45
|
+
if (message.avatarUrl !== "") {
|
|
46
|
+
writer.uint32(42).string(message.avatarUrl);
|
|
47
|
+
}
|
|
48
|
+
for (const v of message.oauthAccounts) {
|
|
49
|
+
exports.OAuthAccount.encode(v, writer.uint32(50).fork()).join();
|
|
50
|
+
}
|
|
51
|
+
if (message.primaryProvider !== "") {
|
|
52
|
+
writer.uint32(58).string(message.primaryProvider);
|
|
53
|
+
}
|
|
54
|
+
if (message.subscription !== undefined) {
|
|
55
|
+
exports.SubscriptionInfo.encode(message.subscription, writer.uint32(66).fork()).join();
|
|
56
|
+
}
|
|
57
|
+
if (message.accountStatus !== "") {
|
|
58
|
+
writer.uint32(74).string(message.accountStatus);
|
|
59
|
+
}
|
|
60
|
+
if (message.emailVerified !== false) {
|
|
61
|
+
writer.uint32(80).bool(message.emailVerified);
|
|
62
|
+
}
|
|
63
|
+
if (message.lastLoginAt !== undefined) {
|
|
64
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.lastLoginAt), writer.uint32(90).fork()).join();
|
|
65
|
+
}
|
|
66
|
+
if (message.createdAt !== undefined) {
|
|
67
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(98).fork()).join();
|
|
68
|
+
}
|
|
69
|
+
if (message.updatedAt !== undefined) {
|
|
70
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(106).fork()).join();
|
|
71
|
+
}
|
|
72
|
+
if (message.preferences !== undefined) {
|
|
73
|
+
exports.UserPreferences.encode(message.preferences, writer.uint32(114).fork()).join();
|
|
74
|
+
}
|
|
75
|
+
return writer;
|
|
76
|
+
},
|
|
77
|
+
decode(input, length) {
|
|
78
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
79
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
80
|
+
const message = createBaseUser();
|
|
81
|
+
while (reader.pos < end) {
|
|
82
|
+
const tag = reader.uint32();
|
|
83
|
+
switch (tag >>> 3) {
|
|
84
|
+
case 1: {
|
|
85
|
+
if (tag !== 10) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
message.id = reader.string();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
case 2: {
|
|
92
|
+
if (tag !== 18) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
message.email = reader.string();
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
case 3: {
|
|
99
|
+
if (tag !== 26) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
message.username = reader.string();
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
case 4: {
|
|
106
|
+
if (tag !== 34) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
message.fullName = reader.string();
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
case 5: {
|
|
113
|
+
if (tag !== 42) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
message.avatarUrl = reader.string();
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
case 6: {
|
|
120
|
+
if (tag !== 50) {
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
message.oauthAccounts.push(exports.OAuthAccount.decode(reader, reader.uint32()));
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
case 7: {
|
|
127
|
+
if (tag !== 58) {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
message.primaryProvider = reader.string();
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
case 8: {
|
|
134
|
+
if (tag !== 66) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
message.subscription = exports.SubscriptionInfo.decode(reader, reader.uint32());
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
case 9: {
|
|
141
|
+
if (tag !== 74) {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
message.accountStatus = reader.string();
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
case 10: {
|
|
148
|
+
if (tag !== 80) {
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
message.emailVerified = reader.bool();
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
case 11: {
|
|
155
|
+
if (tag !== 90) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
message.lastLoginAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
case 12: {
|
|
162
|
+
if (tag !== 98) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
case 13: {
|
|
169
|
+
if (tag !== 106) {
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
case 14: {
|
|
176
|
+
if (tag !== 114) {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
message.preferences = exports.UserPreferences.decode(reader, reader.uint32());
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
reader.skip(tag & 7);
|
|
187
|
+
}
|
|
188
|
+
return message;
|
|
189
|
+
},
|
|
190
|
+
fromJSON(object) {
|
|
191
|
+
return {
|
|
192
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
193
|
+
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
|
194
|
+
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
|
195
|
+
fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "",
|
|
196
|
+
avatarUrl: isSet(object.avatarUrl) ? globalThis.String(object.avatarUrl) : "",
|
|
197
|
+
oauthAccounts: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.oauthAccounts)
|
|
198
|
+
? object.oauthAccounts.map((e) => exports.OAuthAccount.fromJSON(e))
|
|
199
|
+
: [],
|
|
200
|
+
primaryProvider: isSet(object.primaryProvider) ? globalThis.String(object.primaryProvider) : "",
|
|
201
|
+
subscription: isSet(object.subscription) ? exports.SubscriptionInfo.fromJSON(object.subscription) : undefined,
|
|
202
|
+
accountStatus: isSet(object.accountStatus) ? globalThis.String(object.accountStatus) : "",
|
|
203
|
+
emailVerified: isSet(object.emailVerified) ? globalThis.Boolean(object.emailVerified) : false,
|
|
204
|
+
lastLoginAt: isSet(object.lastLoginAt) ? fromJsonTimestamp(object.lastLoginAt) : undefined,
|
|
205
|
+
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
|
|
206
|
+
updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
|
|
207
|
+
preferences: isSet(object.preferences) ? exports.UserPreferences.fromJSON(object.preferences) : undefined,
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
toJSON(message) {
|
|
211
|
+
var _a;
|
|
212
|
+
const obj = {};
|
|
213
|
+
if (message.id !== "") {
|
|
214
|
+
obj.id = message.id;
|
|
215
|
+
}
|
|
216
|
+
if (message.email !== "") {
|
|
217
|
+
obj.email = message.email;
|
|
218
|
+
}
|
|
219
|
+
if (message.username !== "") {
|
|
220
|
+
obj.username = message.username;
|
|
221
|
+
}
|
|
222
|
+
if (message.fullName !== "") {
|
|
223
|
+
obj.fullName = message.fullName;
|
|
224
|
+
}
|
|
225
|
+
if (message.avatarUrl !== "") {
|
|
226
|
+
obj.avatarUrl = message.avatarUrl;
|
|
227
|
+
}
|
|
228
|
+
if ((_a = message.oauthAccounts) === null || _a === void 0 ? void 0 : _a.length) {
|
|
229
|
+
obj.oauthAccounts = message.oauthAccounts.map((e) => exports.OAuthAccount.toJSON(e));
|
|
230
|
+
}
|
|
231
|
+
if (message.primaryProvider !== "") {
|
|
232
|
+
obj.primaryProvider = message.primaryProvider;
|
|
233
|
+
}
|
|
234
|
+
if (message.subscription !== undefined) {
|
|
235
|
+
obj.subscription = exports.SubscriptionInfo.toJSON(message.subscription);
|
|
236
|
+
}
|
|
237
|
+
if (message.accountStatus !== "") {
|
|
238
|
+
obj.accountStatus = message.accountStatus;
|
|
239
|
+
}
|
|
240
|
+
if (message.emailVerified !== false) {
|
|
241
|
+
obj.emailVerified = message.emailVerified;
|
|
242
|
+
}
|
|
243
|
+
if (message.lastLoginAt !== undefined) {
|
|
244
|
+
obj.lastLoginAt = message.lastLoginAt.toISOString();
|
|
245
|
+
}
|
|
246
|
+
if (message.createdAt !== undefined) {
|
|
247
|
+
obj.createdAt = message.createdAt.toISOString();
|
|
248
|
+
}
|
|
249
|
+
if (message.updatedAt !== undefined) {
|
|
250
|
+
obj.updatedAt = message.updatedAt.toISOString();
|
|
251
|
+
}
|
|
252
|
+
if (message.preferences !== undefined) {
|
|
253
|
+
obj.preferences = exports.UserPreferences.toJSON(message.preferences);
|
|
254
|
+
}
|
|
255
|
+
return obj;
|
|
256
|
+
},
|
|
257
|
+
create(base) {
|
|
258
|
+
return exports.User.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
259
|
+
},
|
|
260
|
+
fromPartial(object) {
|
|
261
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
262
|
+
const message = createBaseUser();
|
|
263
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
264
|
+
message.email = (_b = object.email) !== null && _b !== void 0 ? _b : "";
|
|
265
|
+
message.username = (_c = object.username) !== null && _c !== void 0 ? _c : "";
|
|
266
|
+
message.fullName = (_d = object.fullName) !== null && _d !== void 0 ? _d : "";
|
|
267
|
+
message.avatarUrl = (_e = object.avatarUrl) !== null && _e !== void 0 ? _e : "";
|
|
268
|
+
message.oauthAccounts = ((_f = object.oauthAccounts) === null || _f === void 0 ? void 0 : _f.map((e) => exports.OAuthAccount.fromPartial(e))) || [];
|
|
269
|
+
message.primaryProvider = (_g = object.primaryProvider) !== null && _g !== void 0 ? _g : "";
|
|
270
|
+
message.subscription = (object.subscription !== undefined && object.subscription !== null)
|
|
271
|
+
? exports.SubscriptionInfo.fromPartial(object.subscription)
|
|
272
|
+
: undefined;
|
|
273
|
+
message.accountStatus = (_h = object.accountStatus) !== null && _h !== void 0 ? _h : "";
|
|
274
|
+
message.emailVerified = (_j = object.emailVerified) !== null && _j !== void 0 ? _j : false;
|
|
275
|
+
message.lastLoginAt = (_k = object.lastLoginAt) !== null && _k !== void 0 ? _k : undefined;
|
|
276
|
+
message.createdAt = (_l = object.createdAt) !== null && _l !== void 0 ? _l : undefined;
|
|
277
|
+
message.updatedAt = (_m = object.updatedAt) !== null && _m !== void 0 ? _m : undefined;
|
|
278
|
+
message.preferences = (object.preferences !== undefined && object.preferences !== null)
|
|
279
|
+
? exports.UserPreferences.fromPartial(object.preferences)
|
|
280
|
+
: undefined;
|
|
281
|
+
return message;
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
function createBaseOAuthAccount() {
|
|
285
|
+
return {
|
|
286
|
+
provider: "",
|
|
287
|
+
providerUserId: "",
|
|
288
|
+
providerUsername: "",
|
|
289
|
+
providerEmail: "",
|
|
290
|
+
accessToken: "",
|
|
291
|
+
refreshToken: "",
|
|
292
|
+
tokenExpiresAt: undefined,
|
|
293
|
+
linkedAt: undefined,
|
|
294
|
+
lastUsedAt: undefined,
|
|
295
|
+
metadata: {},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
exports.OAuthAccount = {
|
|
299
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
300
|
+
if (message.provider !== "") {
|
|
301
|
+
writer.uint32(10).string(message.provider);
|
|
302
|
+
}
|
|
303
|
+
if (message.providerUserId !== "") {
|
|
304
|
+
writer.uint32(18).string(message.providerUserId);
|
|
305
|
+
}
|
|
306
|
+
if (message.providerUsername !== "") {
|
|
307
|
+
writer.uint32(26).string(message.providerUsername);
|
|
308
|
+
}
|
|
309
|
+
if (message.providerEmail !== "") {
|
|
310
|
+
writer.uint32(34).string(message.providerEmail);
|
|
311
|
+
}
|
|
312
|
+
if (message.accessToken !== "") {
|
|
313
|
+
writer.uint32(42).string(message.accessToken);
|
|
314
|
+
}
|
|
315
|
+
if (message.refreshToken !== "") {
|
|
316
|
+
writer.uint32(50).string(message.refreshToken);
|
|
317
|
+
}
|
|
318
|
+
if (message.tokenExpiresAt !== undefined) {
|
|
319
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.tokenExpiresAt), writer.uint32(58).fork()).join();
|
|
320
|
+
}
|
|
321
|
+
if (message.linkedAt !== undefined) {
|
|
322
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.linkedAt), writer.uint32(66).fork()).join();
|
|
323
|
+
}
|
|
324
|
+
if (message.lastUsedAt !== undefined) {
|
|
325
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.lastUsedAt), writer.uint32(74).fork()).join();
|
|
326
|
+
}
|
|
327
|
+
Object.entries(message.metadata).forEach(([key, value]) => {
|
|
328
|
+
exports.OAuthAccount_MetadataEntry.encode({ key: key, value }, writer.uint32(82).fork()).join();
|
|
329
|
+
});
|
|
330
|
+
return writer;
|
|
331
|
+
},
|
|
332
|
+
decode(input, length) {
|
|
333
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
334
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
335
|
+
const message = createBaseOAuthAccount();
|
|
336
|
+
while (reader.pos < end) {
|
|
337
|
+
const tag = reader.uint32();
|
|
338
|
+
switch (tag >>> 3) {
|
|
339
|
+
case 1: {
|
|
340
|
+
if (tag !== 10) {
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
message.provider = reader.string();
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
case 2: {
|
|
347
|
+
if (tag !== 18) {
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
message.providerUserId = reader.string();
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
case 3: {
|
|
354
|
+
if (tag !== 26) {
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
message.providerUsername = reader.string();
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
case 4: {
|
|
361
|
+
if (tag !== 34) {
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
message.providerEmail = reader.string();
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
case 5: {
|
|
368
|
+
if (tag !== 42) {
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
message.accessToken = reader.string();
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
case 6: {
|
|
375
|
+
if (tag !== 50) {
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
message.refreshToken = reader.string();
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
case 7: {
|
|
382
|
+
if (tag !== 58) {
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
message.tokenExpiresAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
case 8: {
|
|
389
|
+
if (tag !== 66) {
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
message.linkedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
case 9: {
|
|
396
|
+
if (tag !== 74) {
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
message.lastUsedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
case 10: {
|
|
403
|
+
if (tag !== 82) {
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
const entry10 = exports.OAuthAccount_MetadataEntry.decode(reader, reader.uint32());
|
|
407
|
+
if (entry10.value !== undefined) {
|
|
408
|
+
message.metadata[entry10.key] = entry10.value;
|
|
409
|
+
}
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
reader.skip(tag & 7);
|
|
417
|
+
}
|
|
418
|
+
return message;
|
|
419
|
+
},
|
|
420
|
+
fromJSON(object) {
|
|
421
|
+
return {
|
|
422
|
+
provider: isSet(object.provider) ? globalThis.String(object.provider) : "",
|
|
423
|
+
providerUserId: isSet(object.providerUserId) ? globalThis.String(object.providerUserId) : "",
|
|
424
|
+
providerUsername: isSet(object.providerUsername) ? globalThis.String(object.providerUsername) : "",
|
|
425
|
+
providerEmail: isSet(object.providerEmail) ? globalThis.String(object.providerEmail) : "",
|
|
426
|
+
accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "",
|
|
427
|
+
refreshToken: isSet(object.refreshToken) ? globalThis.String(object.refreshToken) : "",
|
|
428
|
+
tokenExpiresAt: isSet(object.tokenExpiresAt) ? fromJsonTimestamp(object.tokenExpiresAt) : undefined,
|
|
429
|
+
linkedAt: isSet(object.linkedAt) ? fromJsonTimestamp(object.linkedAt) : undefined,
|
|
430
|
+
lastUsedAt: isSet(object.lastUsedAt) ? fromJsonTimestamp(object.lastUsedAt) : undefined,
|
|
431
|
+
metadata: isObject(object.metadata)
|
|
432
|
+
? Object.entries(object.metadata).reduce((acc, [key, value]) => {
|
|
433
|
+
acc[key] = String(value);
|
|
434
|
+
return acc;
|
|
435
|
+
}, {})
|
|
436
|
+
: {},
|
|
437
|
+
};
|
|
438
|
+
},
|
|
439
|
+
toJSON(message) {
|
|
440
|
+
const obj = {};
|
|
441
|
+
if (message.provider !== "") {
|
|
442
|
+
obj.provider = message.provider;
|
|
443
|
+
}
|
|
444
|
+
if (message.providerUserId !== "") {
|
|
445
|
+
obj.providerUserId = message.providerUserId;
|
|
446
|
+
}
|
|
447
|
+
if (message.providerUsername !== "") {
|
|
448
|
+
obj.providerUsername = message.providerUsername;
|
|
449
|
+
}
|
|
450
|
+
if (message.providerEmail !== "") {
|
|
451
|
+
obj.providerEmail = message.providerEmail;
|
|
452
|
+
}
|
|
453
|
+
if (message.accessToken !== "") {
|
|
454
|
+
obj.accessToken = message.accessToken;
|
|
455
|
+
}
|
|
456
|
+
if (message.refreshToken !== "") {
|
|
457
|
+
obj.refreshToken = message.refreshToken;
|
|
458
|
+
}
|
|
459
|
+
if (message.tokenExpiresAt !== undefined) {
|
|
460
|
+
obj.tokenExpiresAt = message.tokenExpiresAt.toISOString();
|
|
461
|
+
}
|
|
462
|
+
if (message.linkedAt !== undefined) {
|
|
463
|
+
obj.linkedAt = message.linkedAt.toISOString();
|
|
464
|
+
}
|
|
465
|
+
if (message.lastUsedAt !== undefined) {
|
|
466
|
+
obj.lastUsedAt = message.lastUsedAt.toISOString();
|
|
467
|
+
}
|
|
468
|
+
if (message.metadata) {
|
|
469
|
+
const entries = Object.entries(message.metadata);
|
|
470
|
+
if (entries.length > 0) {
|
|
471
|
+
obj.metadata = {};
|
|
472
|
+
entries.forEach(([k, v]) => {
|
|
473
|
+
obj.metadata[k] = v;
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return obj;
|
|
478
|
+
},
|
|
479
|
+
create(base) {
|
|
480
|
+
return exports.OAuthAccount.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
481
|
+
},
|
|
482
|
+
fromPartial(object) {
|
|
483
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
484
|
+
const message = createBaseOAuthAccount();
|
|
485
|
+
message.provider = (_a = object.provider) !== null && _a !== void 0 ? _a : "";
|
|
486
|
+
message.providerUserId = (_b = object.providerUserId) !== null && _b !== void 0 ? _b : "";
|
|
487
|
+
message.providerUsername = (_c = object.providerUsername) !== null && _c !== void 0 ? _c : "";
|
|
488
|
+
message.providerEmail = (_d = object.providerEmail) !== null && _d !== void 0 ? _d : "";
|
|
489
|
+
message.accessToken = (_e = object.accessToken) !== null && _e !== void 0 ? _e : "";
|
|
490
|
+
message.refreshToken = (_f = object.refreshToken) !== null && _f !== void 0 ? _f : "";
|
|
491
|
+
message.tokenExpiresAt = (_g = object.tokenExpiresAt) !== null && _g !== void 0 ? _g : undefined;
|
|
492
|
+
message.linkedAt = (_h = object.linkedAt) !== null && _h !== void 0 ? _h : undefined;
|
|
493
|
+
message.lastUsedAt = (_j = object.lastUsedAt) !== null && _j !== void 0 ? _j : undefined;
|
|
494
|
+
message.metadata = Object.entries((_k = object.metadata) !== null && _k !== void 0 ? _k : {}).reduce((acc, [key, value]) => {
|
|
495
|
+
if (value !== undefined) {
|
|
496
|
+
acc[key] = globalThis.String(value);
|
|
497
|
+
}
|
|
498
|
+
return acc;
|
|
499
|
+
}, {});
|
|
500
|
+
return message;
|
|
501
|
+
},
|
|
502
|
+
};
|
|
503
|
+
function createBaseOAuthAccount_MetadataEntry() {
|
|
504
|
+
return { key: "", value: "" };
|
|
505
|
+
}
|
|
506
|
+
exports.OAuthAccount_MetadataEntry = {
|
|
507
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
508
|
+
if (message.key !== "") {
|
|
509
|
+
writer.uint32(10).string(message.key);
|
|
510
|
+
}
|
|
511
|
+
if (message.value !== "") {
|
|
512
|
+
writer.uint32(18).string(message.value);
|
|
513
|
+
}
|
|
514
|
+
return writer;
|
|
515
|
+
},
|
|
516
|
+
decode(input, length) {
|
|
517
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
518
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
519
|
+
const message = createBaseOAuthAccount_MetadataEntry();
|
|
520
|
+
while (reader.pos < end) {
|
|
521
|
+
const tag = reader.uint32();
|
|
522
|
+
switch (tag >>> 3) {
|
|
523
|
+
case 1: {
|
|
524
|
+
if (tag !== 10) {
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
message.key = reader.string();
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
case 2: {
|
|
531
|
+
if (tag !== 18) {
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
message.value = reader.string();
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
reader.skip(tag & 7);
|
|
542
|
+
}
|
|
543
|
+
return message;
|
|
544
|
+
},
|
|
545
|
+
fromJSON(object) {
|
|
546
|
+
return {
|
|
547
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
548
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
549
|
+
};
|
|
550
|
+
},
|
|
551
|
+
toJSON(message) {
|
|
552
|
+
const obj = {};
|
|
553
|
+
if (message.key !== "") {
|
|
554
|
+
obj.key = message.key;
|
|
555
|
+
}
|
|
556
|
+
if (message.value !== "") {
|
|
557
|
+
obj.value = message.value;
|
|
558
|
+
}
|
|
559
|
+
return obj;
|
|
560
|
+
},
|
|
561
|
+
create(base) {
|
|
562
|
+
return exports.OAuthAccount_MetadataEntry.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
563
|
+
},
|
|
564
|
+
fromPartial(object) {
|
|
565
|
+
var _a, _b;
|
|
566
|
+
const message = createBaseOAuthAccount_MetadataEntry();
|
|
567
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
|
|
568
|
+
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
|
|
569
|
+
return message;
|
|
570
|
+
},
|
|
571
|
+
};
|
|
572
|
+
function createBaseOAuthProvider() {
|
|
573
|
+
return {
|
|
574
|
+
name: "",
|
|
575
|
+
displayName: "",
|
|
576
|
+
iconUrl: "",
|
|
577
|
+
enabled: false,
|
|
578
|
+
supportedScopes: [],
|
|
579
|
+
defaultScope: "",
|
|
580
|
+
supportsRefresh: false,
|
|
581
|
+
supportsPkce: false,
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
exports.OAuthProvider = {
|
|
585
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
586
|
+
if (message.name !== "") {
|
|
587
|
+
writer.uint32(10).string(message.name);
|
|
588
|
+
}
|
|
589
|
+
if (message.displayName !== "") {
|
|
590
|
+
writer.uint32(18).string(message.displayName);
|
|
591
|
+
}
|
|
592
|
+
if (message.iconUrl !== "") {
|
|
593
|
+
writer.uint32(26).string(message.iconUrl);
|
|
594
|
+
}
|
|
595
|
+
if (message.enabled !== false) {
|
|
596
|
+
writer.uint32(32).bool(message.enabled);
|
|
597
|
+
}
|
|
598
|
+
for (const v of message.supportedScopes) {
|
|
599
|
+
writer.uint32(42).string(v);
|
|
600
|
+
}
|
|
601
|
+
if (message.defaultScope !== "") {
|
|
602
|
+
writer.uint32(50).string(message.defaultScope);
|
|
603
|
+
}
|
|
604
|
+
if (message.supportsRefresh !== false) {
|
|
605
|
+
writer.uint32(56).bool(message.supportsRefresh);
|
|
606
|
+
}
|
|
607
|
+
if (message.supportsPkce !== false) {
|
|
608
|
+
writer.uint32(64).bool(message.supportsPkce);
|
|
609
|
+
}
|
|
610
|
+
return writer;
|
|
611
|
+
},
|
|
612
|
+
decode(input, length) {
|
|
613
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
614
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
615
|
+
const message = createBaseOAuthProvider();
|
|
616
|
+
while (reader.pos < end) {
|
|
617
|
+
const tag = reader.uint32();
|
|
618
|
+
switch (tag >>> 3) {
|
|
619
|
+
case 1: {
|
|
620
|
+
if (tag !== 10) {
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
message.name = reader.string();
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
case 2: {
|
|
627
|
+
if (tag !== 18) {
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
message.displayName = reader.string();
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
case 3: {
|
|
634
|
+
if (tag !== 26) {
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
message.iconUrl = reader.string();
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
case 4: {
|
|
641
|
+
if (tag !== 32) {
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
message.enabled = reader.bool();
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
case 5: {
|
|
648
|
+
if (tag !== 42) {
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
message.supportedScopes.push(reader.string());
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
case 6: {
|
|
655
|
+
if (tag !== 50) {
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
message.defaultScope = reader.string();
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
case 7: {
|
|
662
|
+
if (tag !== 56) {
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
message.supportsRefresh = reader.bool();
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
case 8: {
|
|
669
|
+
if (tag !== 64) {
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
message.supportsPkce = reader.bool();
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
reader.skip(tag & 7);
|
|
680
|
+
}
|
|
681
|
+
return message;
|
|
682
|
+
},
|
|
683
|
+
fromJSON(object) {
|
|
684
|
+
return {
|
|
685
|
+
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
686
|
+
displayName: isSet(object.displayName) ? globalThis.String(object.displayName) : "",
|
|
687
|
+
iconUrl: isSet(object.iconUrl) ? globalThis.String(object.iconUrl) : "",
|
|
688
|
+
enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
|
|
689
|
+
supportedScopes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.supportedScopes)
|
|
690
|
+
? object.supportedScopes.map((e) => globalThis.String(e))
|
|
691
|
+
: [],
|
|
692
|
+
defaultScope: isSet(object.defaultScope) ? globalThis.String(object.defaultScope) : "",
|
|
693
|
+
supportsRefresh: isSet(object.supportsRefresh) ? globalThis.Boolean(object.supportsRefresh) : false,
|
|
694
|
+
supportsPkce: isSet(object.supportsPkce) ? globalThis.Boolean(object.supportsPkce) : false,
|
|
695
|
+
};
|
|
696
|
+
},
|
|
697
|
+
toJSON(message) {
|
|
698
|
+
var _a;
|
|
699
|
+
const obj = {};
|
|
700
|
+
if (message.name !== "") {
|
|
701
|
+
obj.name = message.name;
|
|
702
|
+
}
|
|
703
|
+
if (message.displayName !== "") {
|
|
704
|
+
obj.displayName = message.displayName;
|
|
705
|
+
}
|
|
706
|
+
if (message.iconUrl !== "") {
|
|
707
|
+
obj.iconUrl = message.iconUrl;
|
|
708
|
+
}
|
|
709
|
+
if (message.enabled !== false) {
|
|
710
|
+
obj.enabled = message.enabled;
|
|
711
|
+
}
|
|
712
|
+
if ((_a = message.supportedScopes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
713
|
+
obj.supportedScopes = message.supportedScopes;
|
|
714
|
+
}
|
|
715
|
+
if (message.defaultScope !== "") {
|
|
716
|
+
obj.defaultScope = message.defaultScope;
|
|
717
|
+
}
|
|
718
|
+
if (message.supportsRefresh !== false) {
|
|
719
|
+
obj.supportsRefresh = message.supportsRefresh;
|
|
720
|
+
}
|
|
721
|
+
if (message.supportsPkce !== false) {
|
|
722
|
+
obj.supportsPkce = message.supportsPkce;
|
|
723
|
+
}
|
|
724
|
+
return obj;
|
|
725
|
+
},
|
|
726
|
+
create(base) {
|
|
727
|
+
return exports.OAuthProvider.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
728
|
+
},
|
|
729
|
+
fromPartial(object) {
|
|
730
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
731
|
+
const message = createBaseOAuthProvider();
|
|
732
|
+
message.name = (_a = object.name) !== null && _a !== void 0 ? _a : "";
|
|
733
|
+
message.displayName = (_b = object.displayName) !== null && _b !== void 0 ? _b : "";
|
|
734
|
+
message.iconUrl = (_c = object.iconUrl) !== null && _c !== void 0 ? _c : "";
|
|
735
|
+
message.enabled = (_d = object.enabled) !== null && _d !== void 0 ? _d : false;
|
|
736
|
+
message.supportedScopes = ((_e = object.supportedScopes) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || [];
|
|
737
|
+
message.defaultScope = (_f = object.defaultScope) !== null && _f !== void 0 ? _f : "";
|
|
738
|
+
message.supportsRefresh = (_g = object.supportsRefresh) !== null && _g !== void 0 ? _g : false;
|
|
739
|
+
message.supportsPkce = (_h = object.supportsPkce) !== null && _h !== void 0 ? _h : false;
|
|
740
|
+
return message;
|
|
741
|
+
},
|
|
742
|
+
};
|
|
743
|
+
function createBaseSubscriptionInfo() {
|
|
744
|
+
return {
|
|
745
|
+
status: "",
|
|
746
|
+
tier: "",
|
|
747
|
+
stripeCustomerId: "",
|
|
748
|
+
stripeSubscriptionId: "",
|
|
749
|
+
startedAt: undefined,
|
|
750
|
+
endsAt: undefined,
|
|
751
|
+
cancelledAt: undefined,
|
|
752
|
+
autoRenew: false,
|
|
753
|
+
paymentMethodLast4: "",
|
|
754
|
+
paymentMethodBrand: "",
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
exports.SubscriptionInfo = {
|
|
758
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
759
|
+
if (message.status !== "") {
|
|
760
|
+
writer.uint32(10).string(message.status);
|
|
761
|
+
}
|
|
762
|
+
if (message.tier !== "") {
|
|
763
|
+
writer.uint32(18).string(message.tier);
|
|
764
|
+
}
|
|
765
|
+
if (message.stripeCustomerId !== "") {
|
|
766
|
+
writer.uint32(26).string(message.stripeCustomerId);
|
|
767
|
+
}
|
|
768
|
+
if (message.stripeSubscriptionId !== "") {
|
|
769
|
+
writer.uint32(34).string(message.stripeSubscriptionId);
|
|
770
|
+
}
|
|
771
|
+
if (message.startedAt !== undefined) {
|
|
772
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.startedAt), writer.uint32(42).fork()).join();
|
|
773
|
+
}
|
|
774
|
+
if (message.endsAt !== undefined) {
|
|
775
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.endsAt), writer.uint32(50).fork()).join();
|
|
776
|
+
}
|
|
777
|
+
if (message.cancelledAt !== undefined) {
|
|
778
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.cancelledAt), writer.uint32(58).fork()).join();
|
|
779
|
+
}
|
|
780
|
+
if (message.autoRenew !== false) {
|
|
781
|
+
writer.uint32(64).bool(message.autoRenew);
|
|
782
|
+
}
|
|
783
|
+
if (message.paymentMethodLast4 !== "") {
|
|
784
|
+
writer.uint32(74).string(message.paymentMethodLast4);
|
|
785
|
+
}
|
|
786
|
+
if (message.paymentMethodBrand !== "") {
|
|
787
|
+
writer.uint32(82).string(message.paymentMethodBrand);
|
|
788
|
+
}
|
|
789
|
+
return writer;
|
|
790
|
+
},
|
|
791
|
+
decode(input, length) {
|
|
792
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
793
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
794
|
+
const message = createBaseSubscriptionInfo();
|
|
795
|
+
while (reader.pos < end) {
|
|
796
|
+
const tag = reader.uint32();
|
|
797
|
+
switch (tag >>> 3) {
|
|
798
|
+
case 1: {
|
|
799
|
+
if (tag !== 10) {
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
message.status = reader.string();
|
|
803
|
+
continue;
|
|
804
|
+
}
|
|
805
|
+
case 2: {
|
|
806
|
+
if (tag !== 18) {
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
message.tier = reader.string();
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
case 3: {
|
|
813
|
+
if (tag !== 26) {
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
message.stripeCustomerId = reader.string();
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
case 4: {
|
|
820
|
+
if (tag !== 34) {
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
message.stripeSubscriptionId = reader.string();
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
case 5: {
|
|
827
|
+
if (tag !== 42) {
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
message.startedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
case 6: {
|
|
834
|
+
if (tag !== 50) {
|
|
835
|
+
break;
|
|
836
|
+
}
|
|
837
|
+
message.endsAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
case 7: {
|
|
841
|
+
if (tag !== 58) {
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
message.cancelledAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
case 8: {
|
|
848
|
+
if (tag !== 64) {
|
|
849
|
+
break;
|
|
850
|
+
}
|
|
851
|
+
message.autoRenew = reader.bool();
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
case 9: {
|
|
855
|
+
if (tag !== 74) {
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
message.paymentMethodLast4 = reader.string();
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
case 10: {
|
|
862
|
+
if (tag !== 82) {
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
message.paymentMethodBrand = reader.string();
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
reader.skip(tag & 7);
|
|
873
|
+
}
|
|
874
|
+
return message;
|
|
875
|
+
},
|
|
876
|
+
fromJSON(object) {
|
|
877
|
+
return {
|
|
878
|
+
status: isSet(object.status) ? globalThis.String(object.status) : "",
|
|
879
|
+
tier: isSet(object.tier) ? globalThis.String(object.tier) : "",
|
|
880
|
+
stripeCustomerId: isSet(object.stripeCustomerId) ? globalThis.String(object.stripeCustomerId) : "",
|
|
881
|
+
stripeSubscriptionId: isSet(object.stripeSubscriptionId) ? globalThis.String(object.stripeSubscriptionId) : "",
|
|
882
|
+
startedAt: isSet(object.startedAt) ? fromJsonTimestamp(object.startedAt) : undefined,
|
|
883
|
+
endsAt: isSet(object.endsAt) ? fromJsonTimestamp(object.endsAt) : undefined,
|
|
884
|
+
cancelledAt: isSet(object.cancelledAt) ? fromJsonTimestamp(object.cancelledAt) : undefined,
|
|
885
|
+
autoRenew: isSet(object.autoRenew) ? globalThis.Boolean(object.autoRenew) : false,
|
|
886
|
+
paymentMethodLast4: isSet(object.paymentMethodLast4) ? globalThis.String(object.paymentMethodLast4) : "",
|
|
887
|
+
paymentMethodBrand: isSet(object.paymentMethodBrand) ? globalThis.String(object.paymentMethodBrand) : "",
|
|
888
|
+
};
|
|
889
|
+
},
|
|
890
|
+
toJSON(message) {
|
|
891
|
+
const obj = {};
|
|
892
|
+
if (message.status !== "") {
|
|
893
|
+
obj.status = message.status;
|
|
894
|
+
}
|
|
895
|
+
if (message.tier !== "") {
|
|
896
|
+
obj.tier = message.tier;
|
|
897
|
+
}
|
|
898
|
+
if (message.stripeCustomerId !== "") {
|
|
899
|
+
obj.stripeCustomerId = message.stripeCustomerId;
|
|
900
|
+
}
|
|
901
|
+
if (message.stripeSubscriptionId !== "") {
|
|
902
|
+
obj.stripeSubscriptionId = message.stripeSubscriptionId;
|
|
903
|
+
}
|
|
904
|
+
if (message.startedAt !== undefined) {
|
|
905
|
+
obj.startedAt = message.startedAt.toISOString();
|
|
906
|
+
}
|
|
907
|
+
if (message.endsAt !== undefined) {
|
|
908
|
+
obj.endsAt = message.endsAt.toISOString();
|
|
909
|
+
}
|
|
910
|
+
if (message.cancelledAt !== undefined) {
|
|
911
|
+
obj.cancelledAt = message.cancelledAt.toISOString();
|
|
912
|
+
}
|
|
913
|
+
if (message.autoRenew !== false) {
|
|
914
|
+
obj.autoRenew = message.autoRenew;
|
|
915
|
+
}
|
|
916
|
+
if (message.paymentMethodLast4 !== "") {
|
|
917
|
+
obj.paymentMethodLast4 = message.paymentMethodLast4;
|
|
918
|
+
}
|
|
919
|
+
if (message.paymentMethodBrand !== "") {
|
|
920
|
+
obj.paymentMethodBrand = message.paymentMethodBrand;
|
|
921
|
+
}
|
|
922
|
+
return obj;
|
|
923
|
+
},
|
|
924
|
+
create(base) {
|
|
925
|
+
return exports.SubscriptionInfo.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
926
|
+
},
|
|
927
|
+
fromPartial(object) {
|
|
928
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
929
|
+
const message = createBaseSubscriptionInfo();
|
|
930
|
+
message.status = (_a = object.status) !== null && _a !== void 0 ? _a : "";
|
|
931
|
+
message.tier = (_b = object.tier) !== null && _b !== void 0 ? _b : "";
|
|
932
|
+
message.stripeCustomerId = (_c = object.stripeCustomerId) !== null && _c !== void 0 ? _c : "";
|
|
933
|
+
message.stripeSubscriptionId = (_d = object.stripeSubscriptionId) !== null && _d !== void 0 ? _d : "";
|
|
934
|
+
message.startedAt = (_e = object.startedAt) !== null && _e !== void 0 ? _e : undefined;
|
|
935
|
+
message.endsAt = (_f = object.endsAt) !== null && _f !== void 0 ? _f : undefined;
|
|
936
|
+
message.cancelledAt = (_g = object.cancelledAt) !== null && _g !== void 0 ? _g : undefined;
|
|
937
|
+
message.autoRenew = (_h = object.autoRenew) !== null && _h !== void 0 ? _h : false;
|
|
938
|
+
message.paymentMethodLast4 = (_j = object.paymentMethodLast4) !== null && _j !== void 0 ? _j : "";
|
|
939
|
+
message.paymentMethodBrand = (_k = object.paymentMethodBrand) !== null && _k !== void 0 ? _k : "";
|
|
940
|
+
return message;
|
|
941
|
+
},
|
|
942
|
+
};
|
|
943
|
+
function createBaseUserPreferences() {
|
|
944
|
+
return {
|
|
945
|
+
emailNotifications: false,
|
|
946
|
+
webhookNotifications: false,
|
|
947
|
+
webhookUrl: "",
|
|
948
|
+
webhookSecret: "",
|
|
949
|
+
watchedModels: [],
|
|
950
|
+
watchedProviders: [],
|
|
951
|
+
timezone: "",
|
|
952
|
+
dateFormat: "",
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
exports.UserPreferences = {
|
|
956
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
957
|
+
if (message.emailNotifications !== false) {
|
|
958
|
+
writer.uint32(8).bool(message.emailNotifications);
|
|
959
|
+
}
|
|
960
|
+
if (message.webhookNotifications !== false) {
|
|
961
|
+
writer.uint32(16).bool(message.webhookNotifications);
|
|
962
|
+
}
|
|
963
|
+
if (message.webhookUrl !== "") {
|
|
964
|
+
writer.uint32(26).string(message.webhookUrl);
|
|
965
|
+
}
|
|
966
|
+
if (message.webhookSecret !== "") {
|
|
967
|
+
writer.uint32(34).string(message.webhookSecret);
|
|
968
|
+
}
|
|
969
|
+
for (const v of message.watchedModels) {
|
|
970
|
+
writer.uint32(42).string(v);
|
|
971
|
+
}
|
|
972
|
+
for (const v of message.watchedProviders) {
|
|
973
|
+
writer.uint32(50).string(v);
|
|
974
|
+
}
|
|
975
|
+
if (message.timezone !== "") {
|
|
976
|
+
writer.uint32(58).string(message.timezone);
|
|
977
|
+
}
|
|
978
|
+
if (message.dateFormat !== "") {
|
|
979
|
+
writer.uint32(66).string(message.dateFormat);
|
|
980
|
+
}
|
|
981
|
+
return writer;
|
|
982
|
+
},
|
|
983
|
+
decode(input, length) {
|
|
984
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
985
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
986
|
+
const message = createBaseUserPreferences();
|
|
987
|
+
while (reader.pos < end) {
|
|
988
|
+
const tag = reader.uint32();
|
|
989
|
+
switch (tag >>> 3) {
|
|
990
|
+
case 1: {
|
|
991
|
+
if (tag !== 8) {
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
message.emailNotifications = reader.bool();
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
997
|
+
case 2: {
|
|
998
|
+
if (tag !== 16) {
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
message.webhookNotifications = reader.bool();
|
|
1002
|
+
continue;
|
|
1003
|
+
}
|
|
1004
|
+
case 3: {
|
|
1005
|
+
if (tag !== 26) {
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
message.webhookUrl = reader.string();
|
|
1009
|
+
continue;
|
|
1010
|
+
}
|
|
1011
|
+
case 4: {
|
|
1012
|
+
if (tag !== 34) {
|
|
1013
|
+
break;
|
|
1014
|
+
}
|
|
1015
|
+
message.webhookSecret = reader.string();
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
case 5: {
|
|
1019
|
+
if (tag !== 42) {
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
message.watchedModels.push(reader.string());
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
case 6: {
|
|
1026
|
+
if (tag !== 50) {
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
message.watchedProviders.push(reader.string());
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
case 7: {
|
|
1033
|
+
if (tag !== 58) {
|
|
1034
|
+
break;
|
|
1035
|
+
}
|
|
1036
|
+
message.timezone = reader.string();
|
|
1037
|
+
continue;
|
|
1038
|
+
}
|
|
1039
|
+
case 8: {
|
|
1040
|
+
if (tag !== 66) {
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
message.dateFormat = reader.string();
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1048
|
+
break;
|
|
1049
|
+
}
|
|
1050
|
+
reader.skip(tag & 7);
|
|
1051
|
+
}
|
|
1052
|
+
return message;
|
|
1053
|
+
},
|
|
1054
|
+
fromJSON(object) {
|
|
1055
|
+
return {
|
|
1056
|
+
emailNotifications: isSet(object.emailNotifications) ? globalThis.Boolean(object.emailNotifications) : false,
|
|
1057
|
+
webhookNotifications: isSet(object.webhookNotifications)
|
|
1058
|
+
? globalThis.Boolean(object.webhookNotifications)
|
|
1059
|
+
: false,
|
|
1060
|
+
webhookUrl: isSet(object.webhookUrl) ? globalThis.String(object.webhookUrl) : "",
|
|
1061
|
+
webhookSecret: isSet(object.webhookSecret) ? globalThis.String(object.webhookSecret) : "",
|
|
1062
|
+
watchedModels: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.watchedModels)
|
|
1063
|
+
? object.watchedModels.map((e) => globalThis.String(e))
|
|
1064
|
+
: [],
|
|
1065
|
+
watchedProviders: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.watchedProviders)
|
|
1066
|
+
? object.watchedProviders.map((e) => globalThis.String(e))
|
|
1067
|
+
: [],
|
|
1068
|
+
timezone: isSet(object.timezone) ? globalThis.String(object.timezone) : "",
|
|
1069
|
+
dateFormat: isSet(object.dateFormat) ? globalThis.String(object.dateFormat) : "",
|
|
1070
|
+
};
|
|
1071
|
+
},
|
|
1072
|
+
toJSON(message) {
|
|
1073
|
+
var _a, _b;
|
|
1074
|
+
const obj = {};
|
|
1075
|
+
if (message.emailNotifications !== false) {
|
|
1076
|
+
obj.emailNotifications = message.emailNotifications;
|
|
1077
|
+
}
|
|
1078
|
+
if (message.webhookNotifications !== false) {
|
|
1079
|
+
obj.webhookNotifications = message.webhookNotifications;
|
|
1080
|
+
}
|
|
1081
|
+
if (message.webhookUrl !== "") {
|
|
1082
|
+
obj.webhookUrl = message.webhookUrl;
|
|
1083
|
+
}
|
|
1084
|
+
if (message.webhookSecret !== "") {
|
|
1085
|
+
obj.webhookSecret = message.webhookSecret;
|
|
1086
|
+
}
|
|
1087
|
+
if ((_a = message.watchedModels) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1088
|
+
obj.watchedModels = message.watchedModels;
|
|
1089
|
+
}
|
|
1090
|
+
if ((_b = message.watchedProviders) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1091
|
+
obj.watchedProviders = message.watchedProviders;
|
|
1092
|
+
}
|
|
1093
|
+
if (message.timezone !== "") {
|
|
1094
|
+
obj.timezone = message.timezone;
|
|
1095
|
+
}
|
|
1096
|
+
if (message.dateFormat !== "") {
|
|
1097
|
+
obj.dateFormat = message.dateFormat;
|
|
1098
|
+
}
|
|
1099
|
+
return obj;
|
|
1100
|
+
},
|
|
1101
|
+
create(base) {
|
|
1102
|
+
return exports.UserPreferences.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1103
|
+
},
|
|
1104
|
+
fromPartial(object) {
|
|
1105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1106
|
+
const message = createBaseUserPreferences();
|
|
1107
|
+
message.emailNotifications = (_a = object.emailNotifications) !== null && _a !== void 0 ? _a : false;
|
|
1108
|
+
message.webhookNotifications = (_b = object.webhookNotifications) !== null && _b !== void 0 ? _b : false;
|
|
1109
|
+
message.webhookUrl = (_c = object.webhookUrl) !== null && _c !== void 0 ? _c : "";
|
|
1110
|
+
message.webhookSecret = (_d = object.webhookSecret) !== null && _d !== void 0 ? _d : "";
|
|
1111
|
+
message.watchedModels = ((_e = object.watchedModels) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || [];
|
|
1112
|
+
message.watchedProviders = ((_f = object.watchedProviders) === null || _f === void 0 ? void 0 : _f.map((e) => e)) || [];
|
|
1113
|
+
message.timezone = (_g = object.timezone) !== null && _g !== void 0 ? _g : "";
|
|
1114
|
+
message.dateFormat = (_h = object.dateFormat) !== null && _h !== void 0 ? _h : "";
|
|
1115
|
+
return message;
|
|
1116
|
+
},
|
|
1117
|
+
};
|
|
1118
|
+
function createBaseAPIKey() {
|
|
1119
|
+
return {
|
|
1120
|
+
id: "",
|
|
1121
|
+
userId: "",
|
|
1122
|
+
keyPrefix: "",
|
|
1123
|
+
name: "",
|
|
1124
|
+
description: "",
|
|
1125
|
+
scopes: [],
|
|
1126
|
+
allowedEndpoints: [],
|
|
1127
|
+
allowedIps: [],
|
|
1128
|
+
lastUsedAt: undefined,
|
|
1129
|
+
requestCount: 0,
|
|
1130
|
+
totalTokens: 0,
|
|
1131
|
+
isActive: false,
|
|
1132
|
+
expiresAt: undefined,
|
|
1133
|
+
createdAt: undefined,
|
|
1134
|
+
updatedAt: undefined,
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
exports.APIKey = {
|
|
1138
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1139
|
+
if (message.id !== "") {
|
|
1140
|
+
writer.uint32(10).string(message.id);
|
|
1141
|
+
}
|
|
1142
|
+
if (message.userId !== "") {
|
|
1143
|
+
writer.uint32(18).string(message.userId);
|
|
1144
|
+
}
|
|
1145
|
+
if (message.keyPrefix !== "") {
|
|
1146
|
+
writer.uint32(26).string(message.keyPrefix);
|
|
1147
|
+
}
|
|
1148
|
+
if (message.name !== "") {
|
|
1149
|
+
writer.uint32(34).string(message.name);
|
|
1150
|
+
}
|
|
1151
|
+
if (message.description !== "") {
|
|
1152
|
+
writer.uint32(42).string(message.description);
|
|
1153
|
+
}
|
|
1154
|
+
for (const v of message.scopes) {
|
|
1155
|
+
writer.uint32(50).string(v);
|
|
1156
|
+
}
|
|
1157
|
+
for (const v of message.allowedEndpoints) {
|
|
1158
|
+
writer.uint32(58).string(v);
|
|
1159
|
+
}
|
|
1160
|
+
for (const v of message.allowedIps) {
|
|
1161
|
+
writer.uint32(66).string(v);
|
|
1162
|
+
}
|
|
1163
|
+
if (message.lastUsedAt !== undefined) {
|
|
1164
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.lastUsedAt), writer.uint32(74).fork()).join();
|
|
1165
|
+
}
|
|
1166
|
+
if (message.requestCount !== 0) {
|
|
1167
|
+
writer.uint32(80).int64(message.requestCount);
|
|
1168
|
+
}
|
|
1169
|
+
if (message.totalTokens !== 0) {
|
|
1170
|
+
writer.uint32(88).int64(message.totalTokens);
|
|
1171
|
+
}
|
|
1172
|
+
if (message.isActive !== false) {
|
|
1173
|
+
writer.uint32(96).bool(message.isActive);
|
|
1174
|
+
}
|
|
1175
|
+
if (message.expiresAt !== undefined) {
|
|
1176
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(106).fork()).join();
|
|
1177
|
+
}
|
|
1178
|
+
if (message.createdAt !== undefined) {
|
|
1179
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(114).fork()).join();
|
|
1180
|
+
}
|
|
1181
|
+
if (message.updatedAt !== undefined) {
|
|
1182
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(122).fork()).join();
|
|
1183
|
+
}
|
|
1184
|
+
return writer;
|
|
1185
|
+
},
|
|
1186
|
+
decode(input, length) {
|
|
1187
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1188
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1189
|
+
const message = createBaseAPIKey();
|
|
1190
|
+
while (reader.pos < end) {
|
|
1191
|
+
const tag = reader.uint32();
|
|
1192
|
+
switch (tag >>> 3) {
|
|
1193
|
+
case 1: {
|
|
1194
|
+
if (tag !== 10) {
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
message.id = reader.string();
|
|
1198
|
+
continue;
|
|
1199
|
+
}
|
|
1200
|
+
case 2: {
|
|
1201
|
+
if (tag !== 18) {
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
message.userId = reader.string();
|
|
1205
|
+
continue;
|
|
1206
|
+
}
|
|
1207
|
+
case 3: {
|
|
1208
|
+
if (tag !== 26) {
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
|
+
message.keyPrefix = reader.string();
|
|
1212
|
+
continue;
|
|
1213
|
+
}
|
|
1214
|
+
case 4: {
|
|
1215
|
+
if (tag !== 34) {
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
message.name = reader.string();
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
case 5: {
|
|
1222
|
+
if (tag !== 42) {
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
message.description = reader.string();
|
|
1226
|
+
continue;
|
|
1227
|
+
}
|
|
1228
|
+
case 6: {
|
|
1229
|
+
if (tag !== 50) {
|
|
1230
|
+
break;
|
|
1231
|
+
}
|
|
1232
|
+
message.scopes.push(reader.string());
|
|
1233
|
+
continue;
|
|
1234
|
+
}
|
|
1235
|
+
case 7: {
|
|
1236
|
+
if (tag !== 58) {
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
message.allowedEndpoints.push(reader.string());
|
|
1240
|
+
continue;
|
|
1241
|
+
}
|
|
1242
|
+
case 8: {
|
|
1243
|
+
if (tag !== 66) {
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
message.allowedIps.push(reader.string());
|
|
1247
|
+
continue;
|
|
1248
|
+
}
|
|
1249
|
+
case 9: {
|
|
1250
|
+
if (tag !== 74) {
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
message.lastUsedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
case 10: {
|
|
1257
|
+
if (tag !== 80) {
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
message.requestCount = longToNumber(reader.int64());
|
|
1261
|
+
continue;
|
|
1262
|
+
}
|
|
1263
|
+
case 11: {
|
|
1264
|
+
if (tag !== 88) {
|
|
1265
|
+
break;
|
|
1266
|
+
}
|
|
1267
|
+
message.totalTokens = longToNumber(reader.int64());
|
|
1268
|
+
continue;
|
|
1269
|
+
}
|
|
1270
|
+
case 12: {
|
|
1271
|
+
if (tag !== 96) {
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
1274
|
+
message.isActive = reader.bool();
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
1277
|
+
case 13: {
|
|
1278
|
+
if (tag !== 106) {
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
message.expiresAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
1282
|
+
continue;
|
|
1283
|
+
}
|
|
1284
|
+
case 14: {
|
|
1285
|
+
if (tag !== 114) {
|
|
1286
|
+
break;
|
|
1287
|
+
}
|
|
1288
|
+
message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
1289
|
+
continue;
|
|
1290
|
+
}
|
|
1291
|
+
case 15: {
|
|
1292
|
+
if (tag !== 122) {
|
|
1293
|
+
break;
|
|
1294
|
+
}
|
|
1295
|
+
message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
1296
|
+
continue;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
reader.skip(tag & 7);
|
|
1303
|
+
}
|
|
1304
|
+
return message;
|
|
1305
|
+
},
|
|
1306
|
+
fromJSON(object) {
|
|
1307
|
+
return {
|
|
1308
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
1309
|
+
userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
|
|
1310
|
+
keyPrefix: isSet(object.keyPrefix) ? globalThis.String(object.keyPrefix) : "",
|
|
1311
|
+
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
1312
|
+
description: isSet(object.description) ? globalThis.String(object.description) : "",
|
|
1313
|
+
scopes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.scopes) ? object.scopes.map((e) => globalThis.String(e)) : [],
|
|
1314
|
+
allowedEndpoints: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.allowedEndpoints)
|
|
1315
|
+
? object.allowedEndpoints.map((e) => globalThis.String(e))
|
|
1316
|
+
: [],
|
|
1317
|
+
allowedIps: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.allowedIps)
|
|
1318
|
+
? object.allowedIps.map((e) => globalThis.String(e))
|
|
1319
|
+
: [],
|
|
1320
|
+
lastUsedAt: isSet(object.lastUsedAt) ? fromJsonTimestamp(object.lastUsedAt) : undefined,
|
|
1321
|
+
requestCount: isSet(object.requestCount) ? globalThis.Number(object.requestCount) : 0,
|
|
1322
|
+
totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : 0,
|
|
1323
|
+
isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false,
|
|
1324
|
+
expiresAt: isSet(object.expiresAt) ? fromJsonTimestamp(object.expiresAt) : undefined,
|
|
1325
|
+
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
|
|
1326
|
+
updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
|
|
1327
|
+
};
|
|
1328
|
+
},
|
|
1329
|
+
toJSON(message) {
|
|
1330
|
+
var _a, _b, _c;
|
|
1331
|
+
const obj = {};
|
|
1332
|
+
if (message.id !== "") {
|
|
1333
|
+
obj.id = message.id;
|
|
1334
|
+
}
|
|
1335
|
+
if (message.userId !== "") {
|
|
1336
|
+
obj.userId = message.userId;
|
|
1337
|
+
}
|
|
1338
|
+
if (message.keyPrefix !== "") {
|
|
1339
|
+
obj.keyPrefix = message.keyPrefix;
|
|
1340
|
+
}
|
|
1341
|
+
if (message.name !== "") {
|
|
1342
|
+
obj.name = message.name;
|
|
1343
|
+
}
|
|
1344
|
+
if (message.description !== "") {
|
|
1345
|
+
obj.description = message.description;
|
|
1346
|
+
}
|
|
1347
|
+
if ((_a = message.scopes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1348
|
+
obj.scopes = message.scopes;
|
|
1349
|
+
}
|
|
1350
|
+
if ((_b = message.allowedEndpoints) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1351
|
+
obj.allowedEndpoints = message.allowedEndpoints;
|
|
1352
|
+
}
|
|
1353
|
+
if ((_c = message.allowedIps) === null || _c === void 0 ? void 0 : _c.length) {
|
|
1354
|
+
obj.allowedIps = message.allowedIps;
|
|
1355
|
+
}
|
|
1356
|
+
if (message.lastUsedAt !== undefined) {
|
|
1357
|
+
obj.lastUsedAt = message.lastUsedAt.toISOString();
|
|
1358
|
+
}
|
|
1359
|
+
if (message.requestCount !== 0) {
|
|
1360
|
+
obj.requestCount = Math.round(message.requestCount);
|
|
1361
|
+
}
|
|
1362
|
+
if (message.totalTokens !== 0) {
|
|
1363
|
+
obj.totalTokens = Math.round(message.totalTokens);
|
|
1364
|
+
}
|
|
1365
|
+
if (message.isActive !== false) {
|
|
1366
|
+
obj.isActive = message.isActive;
|
|
1367
|
+
}
|
|
1368
|
+
if (message.expiresAt !== undefined) {
|
|
1369
|
+
obj.expiresAt = message.expiresAt.toISOString();
|
|
1370
|
+
}
|
|
1371
|
+
if (message.createdAt !== undefined) {
|
|
1372
|
+
obj.createdAt = message.createdAt.toISOString();
|
|
1373
|
+
}
|
|
1374
|
+
if (message.updatedAt !== undefined) {
|
|
1375
|
+
obj.updatedAt = message.updatedAt.toISOString();
|
|
1376
|
+
}
|
|
1377
|
+
return obj;
|
|
1378
|
+
},
|
|
1379
|
+
create(base) {
|
|
1380
|
+
return exports.APIKey.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1381
|
+
},
|
|
1382
|
+
fromPartial(object) {
|
|
1383
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1384
|
+
const message = createBaseAPIKey();
|
|
1385
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
1386
|
+
message.userId = (_b = object.userId) !== null && _b !== void 0 ? _b : "";
|
|
1387
|
+
message.keyPrefix = (_c = object.keyPrefix) !== null && _c !== void 0 ? _c : "";
|
|
1388
|
+
message.name = (_d = object.name) !== null && _d !== void 0 ? _d : "";
|
|
1389
|
+
message.description = (_e = object.description) !== null && _e !== void 0 ? _e : "";
|
|
1390
|
+
message.scopes = ((_f = object.scopes) === null || _f === void 0 ? void 0 : _f.map((e) => e)) || [];
|
|
1391
|
+
message.allowedEndpoints = ((_g = object.allowedEndpoints) === null || _g === void 0 ? void 0 : _g.map((e) => e)) || [];
|
|
1392
|
+
message.allowedIps = ((_h = object.allowedIps) === null || _h === void 0 ? void 0 : _h.map((e) => e)) || [];
|
|
1393
|
+
message.lastUsedAt = (_j = object.lastUsedAt) !== null && _j !== void 0 ? _j : undefined;
|
|
1394
|
+
message.requestCount = (_k = object.requestCount) !== null && _k !== void 0 ? _k : 0;
|
|
1395
|
+
message.totalTokens = (_l = object.totalTokens) !== null && _l !== void 0 ? _l : 0;
|
|
1396
|
+
message.isActive = (_m = object.isActive) !== null && _m !== void 0 ? _m : false;
|
|
1397
|
+
message.expiresAt = (_o = object.expiresAt) !== null && _o !== void 0 ? _o : undefined;
|
|
1398
|
+
message.createdAt = (_p = object.createdAt) !== null && _p !== void 0 ? _p : undefined;
|
|
1399
|
+
message.updatedAt = (_q = object.updatedAt) !== null && _q !== void 0 ? _q : undefined;
|
|
1400
|
+
return message;
|
|
1401
|
+
},
|
|
1402
|
+
};
|
|
1403
|
+
function toTimestamp(date) {
|
|
1404
|
+
const seconds = Math.trunc(date.getTime() / 1000);
|
|
1405
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
1406
|
+
return { seconds, nanos };
|
|
1407
|
+
}
|
|
1408
|
+
function fromTimestamp(t) {
|
|
1409
|
+
let millis = (t.seconds || 0) * 1000;
|
|
1410
|
+
millis += (t.nanos || 0) / 1000000;
|
|
1411
|
+
return new globalThis.Date(millis);
|
|
1412
|
+
}
|
|
1413
|
+
function fromJsonTimestamp(o) {
|
|
1414
|
+
if (o instanceof globalThis.Date) {
|
|
1415
|
+
return o;
|
|
1416
|
+
}
|
|
1417
|
+
else if (typeof o === "string") {
|
|
1418
|
+
return new globalThis.Date(o);
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
function longToNumber(int64) {
|
|
1425
|
+
const num = globalThis.Number(int64.toString());
|
|
1426
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
1427
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
1428
|
+
}
|
|
1429
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
1430
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
1431
|
+
}
|
|
1432
|
+
return num;
|
|
1433
|
+
}
|
|
1434
|
+
function isObject(value) {
|
|
1435
|
+
return typeof value === "object" && value !== null;
|
|
1436
|
+
}
|
|
1437
|
+
function isSet(value) {
|
|
1438
|
+
return value !== null && value !== undefined;
|
|
1439
|
+
}
|