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.
- 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 +10 -5
|
@@ -0,0 +1,899 @@
|
|
|
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/payment/v1/invoice.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.TaxRate = exports.InvoiceLineItem = exports.Invoice_MetadataEntry = exports.Invoice = 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
|
+
const subscription_pb_1 = require("./subscription.pb");
|
|
13
|
+
exports.protobufPackage = "weaveapi.payment.v1";
|
|
14
|
+
function createBaseInvoice() {
|
|
15
|
+
return {
|
|
16
|
+
id: "",
|
|
17
|
+
number: "",
|
|
18
|
+
status: "",
|
|
19
|
+
subtotalCents: 0,
|
|
20
|
+
taxCents: 0,
|
|
21
|
+
totalCents: 0,
|
|
22
|
+
amountPaidCents: 0,
|
|
23
|
+
amountDueCents: 0,
|
|
24
|
+
currency: "",
|
|
25
|
+
createdAt: undefined,
|
|
26
|
+
periodStart: undefined,
|
|
27
|
+
periodEnd: undefined,
|
|
28
|
+
dueDate: undefined,
|
|
29
|
+
paidAt: undefined,
|
|
30
|
+
lineItems: [],
|
|
31
|
+
paymentMethod: undefined,
|
|
32
|
+
paymentIntentId: "",
|
|
33
|
+
pdfUrl: "",
|
|
34
|
+
hostedInvoiceUrl: "",
|
|
35
|
+
discount: undefined,
|
|
36
|
+
taxRates: [],
|
|
37
|
+
taxId: "",
|
|
38
|
+
metadata: {},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.Invoice = {
|
|
42
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
43
|
+
if (message.id !== "") {
|
|
44
|
+
writer.uint32(10).string(message.id);
|
|
45
|
+
}
|
|
46
|
+
if (message.number !== "") {
|
|
47
|
+
writer.uint32(18).string(message.number);
|
|
48
|
+
}
|
|
49
|
+
if (message.status !== "") {
|
|
50
|
+
writer.uint32(26).string(message.status);
|
|
51
|
+
}
|
|
52
|
+
if (message.subtotalCents !== 0) {
|
|
53
|
+
writer.uint32(32).int64(message.subtotalCents);
|
|
54
|
+
}
|
|
55
|
+
if (message.taxCents !== 0) {
|
|
56
|
+
writer.uint32(40).int64(message.taxCents);
|
|
57
|
+
}
|
|
58
|
+
if (message.totalCents !== 0) {
|
|
59
|
+
writer.uint32(48).int64(message.totalCents);
|
|
60
|
+
}
|
|
61
|
+
if (message.amountPaidCents !== 0) {
|
|
62
|
+
writer.uint32(56).int64(message.amountPaidCents);
|
|
63
|
+
}
|
|
64
|
+
if (message.amountDueCents !== 0) {
|
|
65
|
+
writer.uint32(64).int64(message.amountDueCents);
|
|
66
|
+
}
|
|
67
|
+
if (message.currency !== "") {
|
|
68
|
+
writer.uint32(74).string(message.currency);
|
|
69
|
+
}
|
|
70
|
+
if (message.createdAt !== undefined) {
|
|
71
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join();
|
|
72
|
+
}
|
|
73
|
+
if (message.periodStart !== undefined) {
|
|
74
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.periodStart), writer.uint32(90).fork()).join();
|
|
75
|
+
}
|
|
76
|
+
if (message.periodEnd !== undefined) {
|
|
77
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.periodEnd), writer.uint32(98).fork()).join();
|
|
78
|
+
}
|
|
79
|
+
if (message.dueDate !== undefined) {
|
|
80
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.dueDate), writer.uint32(106).fork()).join();
|
|
81
|
+
}
|
|
82
|
+
if (message.paidAt !== undefined) {
|
|
83
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.paidAt), writer.uint32(114).fork()).join();
|
|
84
|
+
}
|
|
85
|
+
for (const v of message.lineItems) {
|
|
86
|
+
exports.InvoiceLineItem.encode(v, writer.uint32(122).fork()).join();
|
|
87
|
+
}
|
|
88
|
+
if (message.paymentMethod !== undefined) {
|
|
89
|
+
subscription_pb_1.PaymentMethod.encode(message.paymentMethod, writer.uint32(130).fork()).join();
|
|
90
|
+
}
|
|
91
|
+
if (message.paymentIntentId !== "") {
|
|
92
|
+
writer.uint32(138).string(message.paymentIntentId);
|
|
93
|
+
}
|
|
94
|
+
if (message.pdfUrl !== "") {
|
|
95
|
+
writer.uint32(146).string(message.pdfUrl);
|
|
96
|
+
}
|
|
97
|
+
if (message.hostedInvoiceUrl !== "") {
|
|
98
|
+
writer.uint32(154).string(message.hostedInvoiceUrl);
|
|
99
|
+
}
|
|
100
|
+
if (message.discount !== undefined) {
|
|
101
|
+
subscription_pb_1.Discount.encode(message.discount, writer.uint32(162).fork()).join();
|
|
102
|
+
}
|
|
103
|
+
for (const v of message.taxRates) {
|
|
104
|
+
exports.TaxRate.encode(v, writer.uint32(170).fork()).join();
|
|
105
|
+
}
|
|
106
|
+
if (message.taxId !== "") {
|
|
107
|
+
writer.uint32(178).string(message.taxId);
|
|
108
|
+
}
|
|
109
|
+
Object.entries(message.metadata).forEach(([key, value]) => {
|
|
110
|
+
exports.Invoice_MetadataEntry.encode({ key: key, value }, writer.uint32(186).fork()).join();
|
|
111
|
+
});
|
|
112
|
+
return writer;
|
|
113
|
+
},
|
|
114
|
+
decode(input, length) {
|
|
115
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
116
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
117
|
+
const message = createBaseInvoice();
|
|
118
|
+
while (reader.pos < end) {
|
|
119
|
+
const tag = reader.uint32();
|
|
120
|
+
switch (tag >>> 3) {
|
|
121
|
+
case 1: {
|
|
122
|
+
if (tag !== 10) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
message.id = reader.string();
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
case 2: {
|
|
129
|
+
if (tag !== 18) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
message.number = reader.string();
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
case 3: {
|
|
136
|
+
if (tag !== 26) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
message.status = reader.string();
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
case 4: {
|
|
143
|
+
if (tag !== 32) {
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
message.subtotalCents = longToNumber(reader.int64());
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
case 5: {
|
|
150
|
+
if (tag !== 40) {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
message.taxCents = longToNumber(reader.int64());
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
case 6: {
|
|
157
|
+
if (tag !== 48) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
message.totalCents = longToNumber(reader.int64());
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
case 7: {
|
|
164
|
+
if (tag !== 56) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
message.amountPaidCents = longToNumber(reader.int64());
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
case 8: {
|
|
171
|
+
if (tag !== 64) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
message.amountDueCents = longToNumber(reader.int64());
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
case 9: {
|
|
178
|
+
if (tag !== 74) {
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
message.currency = reader.string();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
case 10: {
|
|
185
|
+
if (tag !== 82) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
case 11: {
|
|
192
|
+
if (tag !== 90) {
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
message.periodStart = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
case 12: {
|
|
199
|
+
if (tag !== 98) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
message.periodEnd = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
case 13: {
|
|
206
|
+
if (tag !== 106) {
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
message.dueDate = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
case 14: {
|
|
213
|
+
if (tag !== 114) {
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
message.paidAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
case 15: {
|
|
220
|
+
if (tag !== 122) {
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
message.lineItems.push(exports.InvoiceLineItem.decode(reader, reader.uint32()));
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
case 16: {
|
|
227
|
+
if (tag !== 130) {
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
message.paymentMethod = subscription_pb_1.PaymentMethod.decode(reader, reader.uint32());
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
case 17: {
|
|
234
|
+
if (tag !== 138) {
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
message.paymentIntentId = reader.string();
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
case 18: {
|
|
241
|
+
if (tag !== 146) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
message.pdfUrl = reader.string();
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
case 19: {
|
|
248
|
+
if (tag !== 154) {
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
message.hostedInvoiceUrl = reader.string();
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
case 20: {
|
|
255
|
+
if (tag !== 162) {
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
message.discount = subscription_pb_1.Discount.decode(reader, reader.uint32());
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
case 21: {
|
|
262
|
+
if (tag !== 170) {
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
message.taxRates.push(exports.TaxRate.decode(reader, reader.uint32()));
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
case 22: {
|
|
269
|
+
if (tag !== 178) {
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
message.taxId = reader.string();
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
case 23: {
|
|
276
|
+
if (tag !== 186) {
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
const entry23 = exports.Invoice_MetadataEntry.decode(reader, reader.uint32());
|
|
280
|
+
if (entry23.value !== undefined) {
|
|
281
|
+
message.metadata[entry23.key] = entry23.value;
|
|
282
|
+
}
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
reader.skip(tag & 7);
|
|
290
|
+
}
|
|
291
|
+
return message;
|
|
292
|
+
},
|
|
293
|
+
fromJSON(object) {
|
|
294
|
+
return {
|
|
295
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
296
|
+
number: isSet(object.number) ? globalThis.String(object.number) : "",
|
|
297
|
+
status: isSet(object.status) ? globalThis.String(object.status) : "",
|
|
298
|
+
subtotalCents: isSet(object.subtotalCents) ? globalThis.Number(object.subtotalCents) : 0,
|
|
299
|
+
taxCents: isSet(object.taxCents) ? globalThis.Number(object.taxCents) : 0,
|
|
300
|
+
totalCents: isSet(object.totalCents) ? globalThis.Number(object.totalCents) : 0,
|
|
301
|
+
amountPaidCents: isSet(object.amountPaidCents) ? globalThis.Number(object.amountPaidCents) : 0,
|
|
302
|
+
amountDueCents: isSet(object.amountDueCents) ? globalThis.Number(object.amountDueCents) : 0,
|
|
303
|
+
currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
|
|
304
|
+
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
|
|
305
|
+
periodStart: isSet(object.periodStart) ? fromJsonTimestamp(object.periodStart) : undefined,
|
|
306
|
+
periodEnd: isSet(object.periodEnd) ? fromJsonTimestamp(object.periodEnd) : undefined,
|
|
307
|
+
dueDate: isSet(object.dueDate) ? fromJsonTimestamp(object.dueDate) : undefined,
|
|
308
|
+
paidAt: isSet(object.paidAt) ? fromJsonTimestamp(object.paidAt) : undefined,
|
|
309
|
+
lineItems: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.lineItems)
|
|
310
|
+
? object.lineItems.map((e) => exports.InvoiceLineItem.fromJSON(e))
|
|
311
|
+
: [],
|
|
312
|
+
paymentMethod: isSet(object.paymentMethod) ? subscription_pb_1.PaymentMethod.fromJSON(object.paymentMethod) : undefined,
|
|
313
|
+
paymentIntentId: isSet(object.paymentIntentId) ? globalThis.String(object.paymentIntentId) : "",
|
|
314
|
+
pdfUrl: isSet(object.pdfUrl) ? globalThis.String(object.pdfUrl) : "",
|
|
315
|
+
hostedInvoiceUrl: isSet(object.hostedInvoiceUrl) ? globalThis.String(object.hostedInvoiceUrl) : "",
|
|
316
|
+
discount: isSet(object.discount) ? subscription_pb_1.Discount.fromJSON(object.discount) : undefined,
|
|
317
|
+
taxRates: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.taxRates) ? object.taxRates.map((e) => exports.TaxRate.fromJSON(e)) : [],
|
|
318
|
+
taxId: isSet(object.taxId) ? globalThis.String(object.taxId) : "",
|
|
319
|
+
metadata: isObject(object.metadata)
|
|
320
|
+
? Object.entries(object.metadata).reduce((acc, [key, value]) => {
|
|
321
|
+
acc[key] = String(value);
|
|
322
|
+
return acc;
|
|
323
|
+
}, {})
|
|
324
|
+
: {},
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
toJSON(message) {
|
|
328
|
+
var _a, _b;
|
|
329
|
+
const obj = {};
|
|
330
|
+
if (message.id !== "") {
|
|
331
|
+
obj.id = message.id;
|
|
332
|
+
}
|
|
333
|
+
if (message.number !== "") {
|
|
334
|
+
obj.number = message.number;
|
|
335
|
+
}
|
|
336
|
+
if (message.status !== "") {
|
|
337
|
+
obj.status = message.status;
|
|
338
|
+
}
|
|
339
|
+
if (message.subtotalCents !== 0) {
|
|
340
|
+
obj.subtotalCents = Math.round(message.subtotalCents);
|
|
341
|
+
}
|
|
342
|
+
if (message.taxCents !== 0) {
|
|
343
|
+
obj.taxCents = Math.round(message.taxCents);
|
|
344
|
+
}
|
|
345
|
+
if (message.totalCents !== 0) {
|
|
346
|
+
obj.totalCents = Math.round(message.totalCents);
|
|
347
|
+
}
|
|
348
|
+
if (message.amountPaidCents !== 0) {
|
|
349
|
+
obj.amountPaidCents = Math.round(message.amountPaidCents);
|
|
350
|
+
}
|
|
351
|
+
if (message.amountDueCents !== 0) {
|
|
352
|
+
obj.amountDueCents = Math.round(message.amountDueCents);
|
|
353
|
+
}
|
|
354
|
+
if (message.currency !== "") {
|
|
355
|
+
obj.currency = message.currency;
|
|
356
|
+
}
|
|
357
|
+
if (message.createdAt !== undefined) {
|
|
358
|
+
obj.createdAt = message.createdAt.toISOString();
|
|
359
|
+
}
|
|
360
|
+
if (message.periodStart !== undefined) {
|
|
361
|
+
obj.periodStart = message.periodStart.toISOString();
|
|
362
|
+
}
|
|
363
|
+
if (message.periodEnd !== undefined) {
|
|
364
|
+
obj.periodEnd = message.periodEnd.toISOString();
|
|
365
|
+
}
|
|
366
|
+
if (message.dueDate !== undefined) {
|
|
367
|
+
obj.dueDate = message.dueDate.toISOString();
|
|
368
|
+
}
|
|
369
|
+
if (message.paidAt !== undefined) {
|
|
370
|
+
obj.paidAt = message.paidAt.toISOString();
|
|
371
|
+
}
|
|
372
|
+
if ((_a = message.lineItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
373
|
+
obj.lineItems = message.lineItems.map((e) => exports.InvoiceLineItem.toJSON(e));
|
|
374
|
+
}
|
|
375
|
+
if (message.paymentMethod !== undefined) {
|
|
376
|
+
obj.paymentMethod = subscription_pb_1.PaymentMethod.toJSON(message.paymentMethod);
|
|
377
|
+
}
|
|
378
|
+
if (message.paymentIntentId !== "") {
|
|
379
|
+
obj.paymentIntentId = message.paymentIntentId;
|
|
380
|
+
}
|
|
381
|
+
if (message.pdfUrl !== "") {
|
|
382
|
+
obj.pdfUrl = message.pdfUrl;
|
|
383
|
+
}
|
|
384
|
+
if (message.hostedInvoiceUrl !== "") {
|
|
385
|
+
obj.hostedInvoiceUrl = message.hostedInvoiceUrl;
|
|
386
|
+
}
|
|
387
|
+
if (message.discount !== undefined) {
|
|
388
|
+
obj.discount = subscription_pb_1.Discount.toJSON(message.discount);
|
|
389
|
+
}
|
|
390
|
+
if ((_b = message.taxRates) === null || _b === void 0 ? void 0 : _b.length) {
|
|
391
|
+
obj.taxRates = message.taxRates.map((e) => exports.TaxRate.toJSON(e));
|
|
392
|
+
}
|
|
393
|
+
if (message.taxId !== "") {
|
|
394
|
+
obj.taxId = message.taxId;
|
|
395
|
+
}
|
|
396
|
+
if (message.metadata) {
|
|
397
|
+
const entries = Object.entries(message.metadata);
|
|
398
|
+
if (entries.length > 0) {
|
|
399
|
+
obj.metadata = {};
|
|
400
|
+
entries.forEach(([k, v]) => {
|
|
401
|
+
obj.metadata[k] = v;
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return obj;
|
|
406
|
+
},
|
|
407
|
+
create(base) {
|
|
408
|
+
return exports.Invoice.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
409
|
+
},
|
|
410
|
+
fromPartial(object) {
|
|
411
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
412
|
+
const message = createBaseInvoice();
|
|
413
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
414
|
+
message.number = (_b = object.number) !== null && _b !== void 0 ? _b : "";
|
|
415
|
+
message.status = (_c = object.status) !== null && _c !== void 0 ? _c : "";
|
|
416
|
+
message.subtotalCents = (_d = object.subtotalCents) !== null && _d !== void 0 ? _d : 0;
|
|
417
|
+
message.taxCents = (_e = object.taxCents) !== null && _e !== void 0 ? _e : 0;
|
|
418
|
+
message.totalCents = (_f = object.totalCents) !== null && _f !== void 0 ? _f : 0;
|
|
419
|
+
message.amountPaidCents = (_g = object.amountPaidCents) !== null && _g !== void 0 ? _g : 0;
|
|
420
|
+
message.amountDueCents = (_h = object.amountDueCents) !== null && _h !== void 0 ? _h : 0;
|
|
421
|
+
message.currency = (_j = object.currency) !== null && _j !== void 0 ? _j : "";
|
|
422
|
+
message.createdAt = (_k = object.createdAt) !== null && _k !== void 0 ? _k : undefined;
|
|
423
|
+
message.periodStart = (_l = object.periodStart) !== null && _l !== void 0 ? _l : undefined;
|
|
424
|
+
message.periodEnd = (_m = object.periodEnd) !== null && _m !== void 0 ? _m : undefined;
|
|
425
|
+
message.dueDate = (_o = object.dueDate) !== null && _o !== void 0 ? _o : undefined;
|
|
426
|
+
message.paidAt = (_p = object.paidAt) !== null && _p !== void 0 ? _p : undefined;
|
|
427
|
+
message.lineItems = ((_q = object.lineItems) === null || _q === void 0 ? void 0 : _q.map((e) => exports.InvoiceLineItem.fromPartial(e))) || [];
|
|
428
|
+
message.paymentMethod = (object.paymentMethod !== undefined && object.paymentMethod !== null)
|
|
429
|
+
? subscription_pb_1.PaymentMethod.fromPartial(object.paymentMethod)
|
|
430
|
+
: undefined;
|
|
431
|
+
message.paymentIntentId = (_r = object.paymentIntentId) !== null && _r !== void 0 ? _r : "";
|
|
432
|
+
message.pdfUrl = (_s = object.pdfUrl) !== null && _s !== void 0 ? _s : "";
|
|
433
|
+
message.hostedInvoiceUrl = (_t = object.hostedInvoiceUrl) !== null && _t !== void 0 ? _t : "";
|
|
434
|
+
message.discount = (object.discount !== undefined && object.discount !== null)
|
|
435
|
+
? subscription_pb_1.Discount.fromPartial(object.discount)
|
|
436
|
+
: undefined;
|
|
437
|
+
message.taxRates = ((_u = object.taxRates) === null || _u === void 0 ? void 0 : _u.map((e) => exports.TaxRate.fromPartial(e))) || [];
|
|
438
|
+
message.taxId = (_v = object.taxId) !== null && _v !== void 0 ? _v : "";
|
|
439
|
+
message.metadata = Object.entries((_w = object.metadata) !== null && _w !== void 0 ? _w : {}).reduce((acc, [key, value]) => {
|
|
440
|
+
if (value !== undefined) {
|
|
441
|
+
acc[key] = globalThis.String(value);
|
|
442
|
+
}
|
|
443
|
+
return acc;
|
|
444
|
+
}, {});
|
|
445
|
+
return message;
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
function createBaseInvoice_MetadataEntry() {
|
|
449
|
+
return { key: "", value: "" };
|
|
450
|
+
}
|
|
451
|
+
exports.Invoice_MetadataEntry = {
|
|
452
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
453
|
+
if (message.key !== "") {
|
|
454
|
+
writer.uint32(10).string(message.key);
|
|
455
|
+
}
|
|
456
|
+
if (message.value !== "") {
|
|
457
|
+
writer.uint32(18).string(message.value);
|
|
458
|
+
}
|
|
459
|
+
return writer;
|
|
460
|
+
},
|
|
461
|
+
decode(input, length) {
|
|
462
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
463
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
464
|
+
const message = createBaseInvoice_MetadataEntry();
|
|
465
|
+
while (reader.pos < end) {
|
|
466
|
+
const tag = reader.uint32();
|
|
467
|
+
switch (tag >>> 3) {
|
|
468
|
+
case 1: {
|
|
469
|
+
if (tag !== 10) {
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
message.key = reader.string();
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
case 2: {
|
|
476
|
+
if (tag !== 18) {
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
message.value = reader.string();
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
reader.skip(tag & 7);
|
|
487
|
+
}
|
|
488
|
+
return message;
|
|
489
|
+
},
|
|
490
|
+
fromJSON(object) {
|
|
491
|
+
return {
|
|
492
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
493
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
494
|
+
};
|
|
495
|
+
},
|
|
496
|
+
toJSON(message) {
|
|
497
|
+
const obj = {};
|
|
498
|
+
if (message.key !== "") {
|
|
499
|
+
obj.key = message.key;
|
|
500
|
+
}
|
|
501
|
+
if (message.value !== "") {
|
|
502
|
+
obj.value = message.value;
|
|
503
|
+
}
|
|
504
|
+
return obj;
|
|
505
|
+
},
|
|
506
|
+
create(base) {
|
|
507
|
+
return exports.Invoice_MetadataEntry.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
508
|
+
},
|
|
509
|
+
fromPartial(object) {
|
|
510
|
+
var _a, _b;
|
|
511
|
+
const message = createBaseInvoice_MetadataEntry();
|
|
512
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
|
|
513
|
+
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
|
|
514
|
+
return message;
|
|
515
|
+
},
|
|
516
|
+
};
|
|
517
|
+
function createBaseInvoiceLineItem() {
|
|
518
|
+
return {
|
|
519
|
+
id: "",
|
|
520
|
+
description: "",
|
|
521
|
+
amountCents: 0,
|
|
522
|
+
currency: "",
|
|
523
|
+
quantity: 0,
|
|
524
|
+
unitAmountCents: 0,
|
|
525
|
+
periodStart: undefined,
|
|
526
|
+
periodEnd: undefined,
|
|
527
|
+
productId: "",
|
|
528
|
+
priceId: "",
|
|
529
|
+
proration: false,
|
|
530
|
+
prorationDetails: "",
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
exports.InvoiceLineItem = {
|
|
534
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
535
|
+
if (message.id !== "") {
|
|
536
|
+
writer.uint32(10).string(message.id);
|
|
537
|
+
}
|
|
538
|
+
if (message.description !== "") {
|
|
539
|
+
writer.uint32(18).string(message.description);
|
|
540
|
+
}
|
|
541
|
+
if (message.amountCents !== 0) {
|
|
542
|
+
writer.uint32(24).int64(message.amountCents);
|
|
543
|
+
}
|
|
544
|
+
if (message.currency !== "") {
|
|
545
|
+
writer.uint32(34).string(message.currency);
|
|
546
|
+
}
|
|
547
|
+
if (message.quantity !== 0) {
|
|
548
|
+
writer.uint32(40).int32(message.quantity);
|
|
549
|
+
}
|
|
550
|
+
if (message.unitAmountCents !== 0) {
|
|
551
|
+
writer.uint32(48).int64(message.unitAmountCents);
|
|
552
|
+
}
|
|
553
|
+
if (message.periodStart !== undefined) {
|
|
554
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.periodStart), writer.uint32(58).fork()).join();
|
|
555
|
+
}
|
|
556
|
+
if (message.periodEnd !== undefined) {
|
|
557
|
+
timestamp_pb_1.Timestamp.encode(toTimestamp(message.periodEnd), writer.uint32(66).fork()).join();
|
|
558
|
+
}
|
|
559
|
+
if (message.productId !== "") {
|
|
560
|
+
writer.uint32(74).string(message.productId);
|
|
561
|
+
}
|
|
562
|
+
if (message.priceId !== "") {
|
|
563
|
+
writer.uint32(82).string(message.priceId);
|
|
564
|
+
}
|
|
565
|
+
if (message.proration !== false) {
|
|
566
|
+
writer.uint32(88).bool(message.proration);
|
|
567
|
+
}
|
|
568
|
+
if (message.prorationDetails !== "") {
|
|
569
|
+
writer.uint32(98).string(message.prorationDetails);
|
|
570
|
+
}
|
|
571
|
+
return writer;
|
|
572
|
+
},
|
|
573
|
+
decode(input, length) {
|
|
574
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
575
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
576
|
+
const message = createBaseInvoiceLineItem();
|
|
577
|
+
while (reader.pos < end) {
|
|
578
|
+
const tag = reader.uint32();
|
|
579
|
+
switch (tag >>> 3) {
|
|
580
|
+
case 1: {
|
|
581
|
+
if (tag !== 10) {
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
message.id = reader.string();
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
case 2: {
|
|
588
|
+
if (tag !== 18) {
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
message.description = reader.string();
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
case 3: {
|
|
595
|
+
if (tag !== 24) {
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
message.amountCents = longToNumber(reader.int64());
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
case 4: {
|
|
602
|
+
if (tag !== 34) {
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
message.currency = reader.string();
|
|
606
|
+
continue;
|
|
607
|
+
}
|
|
608
|
+
case 5: {
|
|
609
|
+
if (tag !== 40) {
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
message.quantity = reader.int32();
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
case 6: {
|
|
616
|
+
if (tag !== 48) {
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
message.unitAmountCents = longToNumber(reader.int64());
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
case 7: {
|
|
623
|
+
if (tag !== 58) {
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
message.periodStart = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
case 8: {
|
|
630
|
+
if (tag !== 66) {
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
message.periodEnd = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
case 9: {
|
|
637
|
+
if (tag !== 74) {
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
message.productId = reader.string();
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
case 10: {
|
|
644
|
+
if (tag !== 82) {
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
message.priceId = reader.string();
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
case 11: {
|
|
651
|
+
if (tag !== 88) {
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
message.proration = reader.bool();
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
case 12: {
|
|
658
|
+
if (tag !== 98) {
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
message.prorationDetails = reader.string();
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
reader.skip(tag & 7);
|
|
669
|
+
}
|
|
670
|
+
return message;
|
|
671
|
+
},
|
|
672
|
+
fromJSON(object) {
|
|
673
|
+
return {
|
|
674
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
675
|
+
description: isSet(object.description) ? globalThis.String(object.description) : "",
|
|
676
|
+
amountCents: isSet(object.amountCents) ? globalThis.Number(object.amountCents) : 0,
|
|
677
|
+
currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
|
|
678
|
+
quantity: isSet(object.quantity) ? globalThis.Number(object.quantity) : 0,
|
|
679
|
+
unitAmountCents: isSet(object.unitAmountCents) ? globalThis.Number(object.unitAmountCents) : 0,
|
|
680
|
+
periodStart: isSet(object.periodStart) ? fromJsonTimestamp(object.periodStart) : undefined,
|
|
681
|
+
periodEnd: isSet(object.periodEnd) ? fromJsonTimestamp(object.periodEnd) : undefined,
|
|
682
|
+
productId: isSet(object.productId) ? globalThis.String(object.productId) : "",
|
|
683
|
+
priceId: isSet(object.priceId) ? globalThis.String(object.priceId) : "",
|
|
684
|
+
proration: isSet(object.proration) ? globalThis.Boolean(object.proration) : false,
|
|
685
|
+
prorationDetails: isSet(object.prorationDetails) ? globalThis.String(object.prorationDetails) : "",
|
|
686
|
+
};
|
|
687
|
+
},
|
|
688
|
+
toJSON(message) {
|
|
689
|
+
const obj = {};
|
|
690
|
+
if (message.id !== "") {
|
|
691
|
+
obj.id = message.id;
|
|
692
|
+
}
|
|
693
|
+
if (message.description !== "") {
|
|
694
|
+
obj.description = message.description;
|
|
695
|
+
}
|
|
696
|
+
if (message.amountCents !== 0) {
|
|
697
|
+
obj.amountCents = Math.round(message.amountCents);
|
|
698
|
+
}
|
|
699
|
+
if (message.currency !== "") {
|
|
700
|
+
obj.currency = message.currency;
|
|
701
|
+
}
|
|
702
|
+
if (message.quantity !== 0) {
|
|
703
|
+
obj.quantity = Math.round(message.quantity);
|
|
704
|
+
}
|
|
705
|
+
if (message.unitAmountCents !== 0) {
|
|
706
|
+
obj.unitAmountCents = Math.round(message.unitAmountCents);
|
|
707
|
+
}
|
|
708
|
+
if (message.periodStart !== undefined) {
|
|
709
|
+
obj.periodStart = message.periodStart.toISOString();
|
|
710
|
+
}
|
|
711
|
+
if (message.periodEnd !== undefined) {
|
|
712
|
+
obj.periodEnd = message.periodEnd.toISOString();
|
|
713
|
+
}
|
|
714
|
+
if (message.productId !== "") {
|
|
715
|
+
obj.productId = message.productId;
|
|
716
|
+
}
|
|
717
|
+
if (message.priceId !== "") {
|
|
718
|
+
obj.priceId = message.priceId;
|
|
719
|
+
}
|
|
720
|
+
if (message.proration !== false) {
|
|
721
|
+
obj.proration = message.proration;
|
|
722
|
+
}
|
|
723
|
+
if (message.prorationDetails !== "") {
|
|
724
|
+
obj.prorationDetails = message.prorationDetails;
|
|
725
|
+
}
|
|
726
|
+
return obj;
|
|
727
|
+
},
|
|
728
|
+
create(base) {
|
|
729
|
+
return exports.InvoiceLineItem.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
730
|
+
},
|
|
731
|
+
fromPartial(object) {
|
|
732
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
733
|
+
const message = createBaseInvoiceLineItem();
|
|
734
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
735
|
+
message.description = (_b = object.description) !== null && _b !== void 0 ? _b : "";
|
|
736
|
+
message.amountCents = (_c = object.amountCents) !== null && _c !== void 0 ? _c : 0;
|
|
737
|
+
message.currency = (_d = object.currency) !== null && _d !== void 0 ? _d : "";
|
|
738
|
+
message.quantity = (_e = object.quantity) !== null && _e !== void 0 ? _e : 0;
|
|
739
|
+
message.unitAmountCents = (_f = object.unitAmountCents) !== null && _f !== void 0 ? _f : 0;
|
|
740
|
+
message.periodStart = (_g = object.periodStart) !== null && _g !== void 0 ? _g : undefined;
|
|
741
|
+
message.periodEnd = (_h = object.periodEnd) !== null && _h !== void 0 ? _h : undefined;
|
|
742
|
+
message.productId = (_j = object.productId) !== null && _j !== void 0 ? _j : "";
|
|
743
|
+
message.priceId = (_k = object.priceId) !== null && _k !== void 0 ? _k : "";
|
|
744
|
+
message.proration = (_l = object.proration) !== null && _l !== void 0 ? _l : false;
|
|
745
|
+
message.prorationDetails = (_m = object.prorationDetails) !== null && _m !== void 0 ? _m : "";
|
|
746
|
+
return message;
|
|
747
|
+
},
|
|
748
|
+
};
|
|
749
|
+
function createBaseTaxRate() {
|
|
750
|
+
return { id: "", displayName: "", jurisdiction: "", percentage: 0, inclusive: false };
|
|
751
|
+
}
|
|
752
|
+
exports.TaxRate = {
|
|
753
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
754
|
+
if (message.id !== "") {
|
|
755
|
+
writer.uint32(10).string(message.id);
|
|
756
|
+
}
|
|
757
|
+
if (message.displayName !== "") {
|
|
758
|
+
writer.uint32(18).string(message.displayName);
|
|
759
|
+
}
|
|
760
|
+
if (message.jurisdiction !== "") {
|
|
761
|
+
writer.uint32(26).string(message.jurisdiction);
|
|
762
|
+
}
|
|
763
|
+
if (message.percentage !== 0) {
|
|
764
|
+
writer.uint32(33).double(message.percentage);
|
|
765
|
+
}
|
|
766
|
+
if (message.inclusive !== false) {
|
|
767
|
+
writer.uint32(40).bool(message.inclusive);
|
|
768
|
+
}
|
|
769
|
+
return writer;
|
|
770
|
+
},
|
|
771
|
+
decode(input, length) {
|
|
772
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
773
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
774
|
+
const message = createBaseTaxRate();
|
|
775
|
+
while (reader.pos < end) {
|
|
776
|
+
const tag = reader.uint32();
|
|
777
|
+
switch (tag >>> 3) {
|
|
778
|
+
case 1: {
|
|
779
|
+
if (tag !== 10) {
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
message.id = reader.string();
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
case 2: {
|
|
786
|
+
if (tag !== 18) {
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
message.displayName = reader.string();
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
case 3: {
|
|
793
|
+
if (tag !== 26) {
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
message.jurisdiction = reader.string();
|
|
797
|
+
continue;
|
|
798
|
+
}
|
|
799
|
+
case 4: {
|
|
800
|
+
if (tag !== 33) {
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
message.percentage = reader.double();
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
case 5: {
|
|
807
|
+
if (tag !== 40) {
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
message.inclusive = reader.bool();
|
|
811
|
+
continue;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
reader.skip(tag & 7);
|
|
818
|
+
}
|
|
819
|
+
return message;
|
|
820
|
+
},
|
|
821
|
+
fromJSON(object) {
|
|
822
|
+
return {
|
|
823
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
824
|
+
displayName: isSet(object.displayName) ? globalThis.String(object.displayName) : "",
|
|
825
|
+
jurisdiction: isSet(object.jurisdiction) ? globalThis.String(object.jurisdiction) : "",
|
|
826
|
+
percentage: isSet(object.percentage) ? globalThis.Number(object.percentage) : 0,
|
|
827
|
+
inclusive: isSet(object.inclusive) ? globalThis.Boolean(object.inclusive) : false,
|
|
828
|
+
};
|
|
829
|
+
},
|
|
830
|
+
toJSON(message) {
|
|
831
|
+
const obj = {};
|
|
832
|
+
if (message.id !== "") {
|
|
833
|
+
obj.id = message.id;
|
|
834
|
+
}
|
|
835
|
+
if (message.displayName !== "") {
|
|
836
|
+
obj.displayName = message.displayName;
|
|
837
|
+
}
|
|
838
|
+
if (message.jurisdiction !== "") {
|
|
839
|
+
obj.jurisdiction = message.jurisdiction;
|
|
840
|
+
}
|
|
841
|
+
if (message.percentage !== 0) {
|
|
842
|
+
obj.percentage = message.percentage;
|
|
843
|
+
}
|
|
844
|
+
if (message.inclusive !== false) {
|
|
845
|
+
obj.inclusive = message.inclusive;
|
|
846
|
+
}
|
|
847
|
+
return obj;
|
|
848
|
+
},
|
|
849
|
+
create(base) {
|
|
850
|
+
return exports.TaxRate.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
851
|
+
},
|
|
852
|
+
fromPartial(object) {
|
|
853
|
+
var _a, _b, _c, _d, _e;
|
|
854
|
+
const message = createBaseTaxRate();
|
|
855
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
856
|
+
message.displayName = (_b = object.displayName) !== null && _b !== void 0 ? _b : "";
|
|
857
|
+
message.jurisdiction = (_c = object.jurisdiction) !== null && _c !== void 0 ? _c : "";
|
|
858
|
+
message.percentage = (_d = object.percentage) !== null && _d !== void 0 ? _d : 0;
|
|
859
|
+
message.inclusive = (_e = object.inclusive) !== null && _e !== void 0 ? _e : false;
|
|
860
|
+
return message;
|
|
861
|
+
},
|
|
862
|
+
};
|
|
863
|
+
function toTimestamp(date) {
|
|
864
|
+
const seconds = Math.trunc(date.getTime() / 1000);
|
|
865
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
866
|
+
return { seconds, nanos };
|
|
867
|
+
}
|
|
868
|
+
function fromTimestamp(t) {
|
|
869
|
+
let millis = (t.seconds || 0) * 1000;
|
|
870
|
+
millis += (t.nanos || 0) / 1000000;
|
|
871
|
+
return new globalThis.Date(millis);
|
|
872
|
+
}
|
|
873
|
+
function fromJsonTimestamp(o) {
|
|
874
|
+
if (o instanceof globalThis.Date) {
|
|
875
|
+
return o;
|
|
876
|
+
}
|
|
877
|
+
else if (typeof o === "string") {
|
|
878
|
+
return new globalThis.Date(o);
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
881
|
+
return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function longToNumber(int64) {
|
|
885
|
+
const num = globalThis.Number(int64.toString());
|
|
886
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
887
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
888
|
+
}
|
|
889
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
890
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
891
|
+
}
|
|
892
|
+
return num;
|
|
893
|
+
}
|
|
894
|
+
function isObject(value) {
|
|
895
|
+
return typeof value === "object" && value !== null;
|
|
896
|
+
}
|
|
897
|
+
function isSet(value) {
|
|
898
|
+
return value !== null && value !== undefined;
|
|
899
|
+
}
|