weave-typescript 0.12.0 → 0.14.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.
Files changed (136) hide show
  1. package/dist/google/api/annotations.pb.js +1 -1
  2. package/dist/google/api/http.pb.js +1 -1
  3. package/dist/google/protobuf/descriptor.pb.d.ts +8 -1
  4. package/dist/google/protobuf/descriptor.pb.js +8 -1
  5. package/dist/google/protobuf/struct.pb.js +1 -1
  6. package/dist/google/protobuf/timestamp.pb.d.ts +7 -6
  7. package/dist/google/protobuf/timestamp.pb.js +1 -1
  8. package/dist/index.d.ts +9 -16
  9. package/dist/index.js +13 -21
  10. package/dist/weaveapi/{storage/v1/auth.pb.d.ts → atc/v1/event.pb.d.ts} +12 -6
  11. package/dist/weaveapi/atc/v1/event.pb.js +263 -0
  12. package/dist/weaveapi/{auth/v1/session.pb.d.ts → atc/v1/message.pb.d.ts} +22 -21
  13. package/dist/weaveapi/atc/v1/message.pb.js +287 -0
  14. package/dist/weaveapi/atc/v1/process.pb.d.ts +91 -0
  15. package/dist/weaveapi/atc/v1/process.pb.js +658 -0
  16. package/dist/weaveapi/atc/v1/run.pb.d.ts +71 -0
  17. package/dist/weaveapi/atc/v1/run.pb.js +525 -0
  18. package/dist/weaveapi/atc/v1/service.pb.d.ts +339 -0
  19. package/dist/weaveapi/atc/v1/service.pb.js +1922 -0
  20. package/dist/weaveapi/project/v1/project.pb.d.ts +67 -5
  21. package/dist/weaveapi/project/v1/project.pb.js +765 -66
  22. package/dist/weaveapi/project/v1/service.pb.d.ts +117 -76
  23. package/dist/weaveapi/project/v1/service.pb.js +1088 -401
  24. package/dist/weaveapi/task/v1/service.pb.d.ts +171 -0
  25. package/dist/weaveapi/task/v1/service.pb.js +1416 -0
  26. package/dist/weaveapi/task/v1/task.pb.d.ts +84 -0
  27. package/dist/weaveapi/task/v1/task.pb.js +782 -0
  28. package/dist/weavesql/atcdb/event_sql.d.ts +101 -0
  29. package/dist/weavesql/atcdb/event_sql.js +191 -0
  30. package/dist/weavesql/atcdb/mailbox_sql.d.ts +43 -0
  31. package/dist/weavesql/atcdb/mailbox_sql.js +85 -0
  32. package/dist/weavesql/weavedb/project_sql.d.ts +121 -46
  33. package/dist/weavesql/weavedb/project_sql.js +304 -112
  34. package/dist/weavesql/weavedb/task_sql.d.ts +163 -0
  35. package/dist/weavesql/weavedb/task_sql.js +328 -0
  36. package/package.json +1 -1
  37. package/dist/weaveapi/auth/v1/service.pb.d.ts +0 -709
  38. package/dist/weaveapi/auth/v1/service.pb.js +0 -4977
  39. package/dist/weaveapi/auth/v1/session.pb.js +0 -308
  40. package/dist/weaveapi/auth/v1/usage.pb.d.ts +0 -76
  41. package/dist/weaveapi/auth/v1/usage.pb.js +0 -849
  42. package/dist/weaveapi/auth/v1/user.pb.d.ts +0 -141
  43. package/dist/weaveapi/auth/v1/user.pb.js +0 -1625
  44. package/dist/weaveapi/data/v1/data.pb.d.ts +0 -54
  45. package/dist/weaveapi/data/v1/data.pb.js +0 -411
  46. package/dist/weaveapi/data/v1/service.pb.d.ts +0 -296
  47. package/dist/weaveapi/data/v1/service.pb.js +0 -2777
  48. package/dist/weaveapi/generate/v1/configuration.pb.d.ts +0 -122
  49. package/dist/weaveapi/generate/v1/configuration.pb.js +0 -877
  50. package/dist/weaveapi/generate/v1/generate.pb.d.ts +0 -48
  51. package/dist/weaveapi/generate/v1/generate.pb.js +0 -367
  52. package/dist/weaveapi/generate/v1/service.pb.d.ts +0 -173
  53. package/dist/weaveapi/generate/v1/service.pb.js +0 -1207
  54. package/dist/weaveapi/input/v1/input.pb.d.ts +0 -77
  55. package/dist/weaveapi/input/v1/input.pb.js +0 -632
  56. package/dist/weaveapi/input/v1/service.pb.d.ts +0 -390
  57. package/dist/weaveapi/input/v1/service.pb.js +0 -3610
  58. package/dist/weaveapi/integration/v1/integration.pb.d.ts +0 -67
  59. package/dist/weaveapi/integration/v1/integration.pb.js +0 -486
  60. package/dist/weaveapi/integration/v1/service.pb.d.ts +0 -318
  61. package/dist/weaveapi/integration/v1/service.pb.js +0 -2992
  62. package/dist/weaveapi/llmx/v1/architecture.pb.d.ts +0 -665
  63. package/dist/weaveapi/llmx/v1/architecture.pb.js +0 -3028
  64. package/dist/weaveapi/llmx/v1/capabilities.pb.d.ts +0 -709
  65. package/dist/weaveapi/llmx/v1/capabilities.pb.js +0 -3458
  66. package/dist/weaveapi/llmx/v1/model.pb.d.ts +0 -375
  67. package/dist/weaveapi/llmx/v1/model.pb.js +0 -1472
  68. package/dist/weaveapi/llmx/v1/pricing.pb.d.ts +0 -340
  69. package/dist/weaveapi/llmx/v1/pricing.pb.js +0 -974
  70. package/dist/weaveapi/llmx/v1/provider.pb.d.ts +0 -72
  71. package/dist/weaveapi/llmx/v1/provider.pb.js +0 -218
  72. package/dist/weaveapi/llmx/v1/service.pb.d.ts +0 -683
  73. package/dist/weaveapi/llmx/v1/service.pb.js +0 -5266
  74. package/dist/weaveapi/mcpregistry/v1/server.pb.d.ts +0 -54
  75. package/dist/weaveapi/mcpregistry/v1/server.pb.js +0 -436
  76. package/dist/weaveapi/mcpregistry/v1/service.pb.d.ts +0 -171
  77. package/dist/weaveapi/mcpregistry/v1/service.pb.js +0 -963
  78. package/dist/weaveapi/payment/v1/invoice.pb.d.ts +0 -92
  79. package/dist/weaveapi/payment/v1/invoice.pb.js +0 -998
  80. package/dist/weaveapi/payment/v1/service.pb.d.ts +0 -662
  81. package/dist/weaveapi/payment/v1/service.pb.js +0 -5395
  82. package/dist/weaveapi/payment/v1/subscription.pb.d.ts +0 -165
  83. package/dist/weaveapi/payment/v1/subscription.pb.js +0 -1930
  84. package/dist/weaveapi/report/v1/report.pb.d.ts +0 -81
  85. package/dist/weaveapi/report/v1/report.pb.js +0 -678
  86. package/dist/weaveapi/report/v1/service.pb.d.ts +0 -194
  87. package/dist/weaveapi/report/v1/service.pb.js +0 -1923
  88. package/dist/weaveapi/requirement/v1/requirement.pb.d.ts +0 -70
  89. package/dist/weaveapi/requirement/v1/requirement.pb.js +0 -570
  90. package/dist/weaveapi/requirement/v1/service.pb.d.ts +0 -390
  91. package/dist/weaveapi/requirement/v1/service.pb.js +0 -3636
  92. package/dist/weaveapi/run/v1/run.pb.d.ts +0 -117
  93. package/dist/weaveapi/run/v1/run.pb.js +0 -1155
  94. package/dist/weaveapi/run/v1/service.pb.d.ts +0 -229
  95. package/dist/weaveapi/run/v1/service.pb.js +0 -2426
  96. package/dist/weaveapi/script/v1/script.pb.d.ts +0 -102
  97. package/dist/weaveapi/script/v1/script.pb.js +0 -1025
  98. package/dist/weaveapi/script/v1/service.pb.d.ts +0 -502
  99. package/dist/weaveapi/script/v1/service.pb.js +0 -4871
  100. package/dist/weaveapi/storage/v1/auth.pb.js +0 -110
  101. package/dist/weaveapi/storage/v1/nosql_database.pb.d.ts +0 -91
  102. package/dist/weaveapi/storage/v1/nosql_database.pb.js +0 -1056
  103. package/dist/weaveapi/storage/v1/object_store.pb.d.ts +0 -49
  104. package/dist/weaveapi/storage/v1/object_store.pb.js +0 -441
  105. package/dist/weaveapi/storage/v1/service.pb.d.ts +0 -245
  106. package/dist/weaveapi/storage/v1/service.pb.js +0 -1339
  107. package/dist/weaveapi/storage/v1/sql_database.pb.d.ts +0 -98
  108. package/dist/weaveapi/storage/v1/sql_database.pb.js +0 -1184
  109. package/dist/weaveapi/storage/v1/storage.pb.d.ts +0 -35
  110. package/dist/weaveapi/storage/v1/storage.pb.js +0 -198
  111. package/dist/weaveapi/storage/v1/vcs.pb.d.ts +0 -75
  112. package/dist/weaveapi/storage/v1/vcs.pb.js +0 -864
  113. package/dist/weaveapi/suite/v1/service.pb.d.ts +0 -539
  114. package/dist/weaveapi/suite/v1/service.pb.js +0 -5279
  115. package/dist/weaveapi/suite/v1/suite.pb.d.ts +0 -92
  116. package/dist/weaveapi/suite/v1/suite.pb.js +0 -876
  117. package/dist/weaveapi/synthesize/v1/dataset.pb.d.ts +0 -68
  118. package/dist/weaveapi/synthesize/v1/dataset.pb.js +0 -460
  119. package/dist/weaveapi/synthesize/v1/inline_data.pb.d.ts +0 -45
  120. package/dist/weaveapi/synthesize/v1/inline_data.pb.js +0 -166
  121. package/dist/weaveapi/synthesize/v1/relationship.pb.d.ts +0 -58
  122. package/dist/weaveapi/synthesize/v1/relationship.pb.js +0 -253
  123. package/dist/weaveapi/synthesize/v1/service.pb.d.ts +0 -144
  124. package/dist/weaveapi/synthesize/v1/service.pb.js +0 -917
  125. package/dist/weaveapi/synthesize/v1/training.pb.d.ts +0 -58
  126. package/dist/weaveapi/synthesize/v1/training.pb.js +0 -386
  127. package/dist/weaveapi/testcase/v1/service.pb.d.ts +0 -498
  128. package/dist/weaveapi/testcase/v1/service.pb.js +0 -4728
  129. package/dist/weaveapi/testcase/v1/testcase.pb.d.ts +0 -91
  130. package/dist/weaveapi/testcase/v1/testcase.pb.js +0 -794
  131. package/dist/weaveapi/workflow/v1/service.pb.d.ts +0 -261
  132. package/dist/weaveapi/workflow/v1/service.pb.js +0 -2120
  133. package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +0 -77
  134. package/dist/weaveapi/workflow/v1/workflow.pb.js +0 -555
  135. package/dist/weaveapi/workflowdata/v1/service.pb.d.ts +0 -295
  136. package/dist/weaveapi/workflowdata/v1/service.pb.js +0 -2612
@@ -1,1930 +0,0 @@
1
- "use strict";
2
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
- // versions:
4
- // protoc-gen-ts_proto v2.11.2
5
- // protoc unknown
6
- // source: weaveapi/payment/v1/subscription.proto
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Discount = exports.Address = exports.BillingDetails = exports.BankDetails = exports.CardDetails = exports.PaymentMethod = exports.SubscriptionFeatures = exports.PricingPlan = exports.SubscriptionStatus = 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.payment.v1";
13
- function createBaseSubscriptionStatus() {
14
- return {
15
- id: "",
16
- status: "",
17
- tier: "",
18
- plan: undefined,
19
- currentPeriodStart: undefined,
20
- currentPeriodEnd: undefined,
21
- cancelAt: undefined,
22
- canceledAt: undefined,
23
- cancelAtPeriodEnd: false,
24
- defaultPaymentMethod: undefined,
25
- currency: "",
26
- amountCents: 0,
27
- isTrial: false,
28
- trialStart: undefined,
29
- trialEnd: undefined,
30
- activeDiscount: undefined,
31
- createdAt: undefined,
32
- updatedAt: undefined,
33
- features: undefined,
34
- };
35
- }
36
- exports.SubscriptionStatus = {
37
- encode(message, writer = new wire_1.BinaryWriter()) {
38
- if (message.id !== "") {
39
- writer.uint32(10).string(message.id);
40
- }
41
- if (message.status !== "") {
42
- writer.uint32(18).string(message.status);
43
- }
44
- if (message.tier !== "") {
45
- writer.uint32(26).string(message.tier);
46
- }
47
- if (message.plan !== undefined) {
48
- exports.PricingPlan.encode(message.plan, writer.uint32(34).fork()).join();
49
- }
50
- if (message.currentPeriodStart !== undefined) {
51
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.currentPeriodStart), writer.uint32(42).fork()).join();
52
- }
53
- if (message.currentPeriodEnd !== undefined) {
54
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.currentPeriodEnd), writer.uint32(50).fork()).join();
55
- }
56
- if (message.cancelAt !== undefined) {
57
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.cancelAt), writer.uint32(58).fork()).join();
58
- }
59
- if (message.canceledAt !== undefined) {
60
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.canceledAt), writer.uint32(66).fork()).join();
61
- }
62
- if (message.cancelAtPeriodEnd !== false) {
63
- writer.uint32(72).bool(message.cancelAtPeriodEnd);
64
- }
65
- if (message.defaultPaymentMethod !== undefined) {
66
- exports.PaymentMethod.encode(message.defaultPaymentMethod, writer.uint32(82).fork()).join();
67
- }
68
- if (message.currency !== "") {
69
- writer.uint32(90).string(message.currency);
70
- }
71
- if (message.amountCents !== 0) {
72
- writer.uint32(96).int64(message.amountCents);
73
- }
74
- if (message.isTrial !== false) {
75
- writer.uint32(104).bool(message.isTrial);
76
- }
77
- if (message.trialStart !== undefined) {
78
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.trialStart), writer.uint32(114).fork()).join();
79
- }
80
- if (message.trialEnd !== undefined) {
81
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.trialEnd), writer.uint32(122).fork()).join();
82
- }
83
- if (message.activeDiscount !== undefined) {
84
- exports.Discount.encode(message.activeDiscount, writer.uint32(130).fork()).join();
85
- }
86
- if (message.createdAt !== undefined) {
87
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(138).fork()).join();
88
- }
89
- if (message.updatedAt !== undefined) {
90
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(146).fork()).join();
91
- }
92
- if (message.features !== undefined) {
93
- exports.SubscriptionFeatures.encode(message.features, writer.uint32(154).fork()).join();
94
- }
95
- return writer;
96
- },
97
- decode(input, length) {
98
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
99
- const end = length === undefined ? reader.len : reader.pos + length;
100
- const message = createBaseSubscriptionStatus();
101
- while (reader.pos < end) {
102
- const tag = reader.uint32();
103
- switch (tag >>> 3) {
104
- case 1: {
105
- if (tag !== 10) {
106
- break;
107
- }
108
- message.id = reader.string();
109
- continue;
110
- }
111
- case 2: {
112
- if (tag !== 18) {
113
- break;
114
- }
115
- message.status = reader.string();
116
- continue;
117
- }
118
- case 3: {
119
- if (tag !== 26) {
120
- break;
121
- }
122
- message.tier = reader.string();
123
- continue;
124
- }
125
- case 4: {
126
- if (tag !== 34) {
127
- break;
128
- }
129
- message.plan = exports.PricingPlan.decode(reader, reader.uint32());
130
- continue;
131
- }
132
- case 5: {
133
- if (tag !== 42) {
134
- break;
135
- }
136
- message.currentPeriodStart = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
137
- continue;
138
- }
139
- case 6: {
140
- if (tag !== 50) {
141
- break;
142
- }
143
- message.currentPeriodEnd = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
144
- continue;
145
- }
146
- case 7: {
147
- if (tag !== 58) {
148
- break;
149
- }
150
- message.cancelAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
151
- continue;
152
- }
153
- case 8: {
154
- if (tag !== 66) {
155
- break;
156
- }
157
- message.canceledAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
158
- continue;
159
- }
160
- case 9: {
161
- if (tag !== 72) {
162
- break;
163
- }
164
- message.cancelAtPeriodEnd = reader.bool();
165
- continue;
166
- }
167
- case 10: {
168
- if (tag !== 82) {
169
- break;
170
- }
171
- message.defaultPaymentMethod = exports.PaymentMethod.decode(reader, reader.uint32());
172
- continue;
173
- }
174
- case 11: {
175
- if (tag !== 90) {
176
- break;
177
- }
178
- message.currency = reader.string();
179
- continue;
180
- }
181
- case 12: {
182
- if (tag !== 96) {
183
- break;
184
- }
185
- message.amountCents = longToNumber(reader.int64());
186
- continue;
187
- }
188
- case 13: {
189
- if (tag !== 104) {
190
- break;
191
- }
192
- message.isTrial = reader.bool();
193
- continue;
194
- }
195
- case 14: {
196
- if (tag !== 114) {
197
- break;
198
- }
199
- message.trialStart = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
200
- continue;
201
- }
202
- case 15: {
203
- if (tag !== 122) {
204
- break;
205
- }
206
- message.trialEnd = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
207
- continue;
208
- }
209
- case 16: {
210
- if (tag !== 130) {
211
- break;
212
- }
213
- message.activeDiscount = exports.Discount.decode(reader, reader.uint32());
214
- continue;
215
- }
216
- case 17: {
217
- if (tag !== 138) {
218
- break;
219
- }
220
- message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
221
- continue;
222
- }
223
- case 18: {
224
- if (tag !== 146) {
225
- break;
226
- }
227
- message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
228
- continue;
229
- }
230
- case 19: {
231
- if (tag !== 154) {
232
- break;
233
- }
234
- message.features = exports.SubscriptionFeatures.decode(reader, reader.uint32());
235
- continue;
236
- }
237
- }
238
- if ((tag & 7) === 4 || tag === 0) {
239
- break;
240
- }
241
- reader.skip(tag & 7);
242
- }
243
- return message;
244
- },
245
- fromJSON(object) {
246
- return {
247
- id: isSet(object.id) ? globalThis.String(object.id) : "",
248
- status: isSet(object.status) ? globalThis.String(object.status) : "",
249
- tier: isSet(object.tier) ? globalThis.String(object.tier) : "",
250
- plan: isSet(object.plan) ? exports.PricingPlan.fromJSON(object.plan) : undefined,
251
- currentPeriodStart: isSet(object.currentPeriodStart)
252
- ? fromJsonTimestamp(object.currentPeriodStart)
253
- : isSet(object.current_period_start)
254
- ? fromJsonTimestamp(object.current_period_start)
255
- : undefined,
256
- currentPeriodEnd: isSet(object.currentPeriodEnd)
257
- ? fromJsonTimestamp(object.currentPeriodEnd)
258
- : isSet(object.current_period_end)
259
- ? fromJsonTimestamp(object.current_period_end)
260
- : undefined,
261
- cancelAt: isSet(object.cancelAt)
262
- ? fromJsonTimestamp(object.cancelAt)
263
- : isSet(object.cancel_at)
264
- ? fromJsonTimestamp(object.cancel_at)
265
- : undefined,
266
- canceledAt: isSet(object.canceledAt)
267
- ? fromJsonTimestamp(object.canceledAt)
268
- : isSet(object.canceled_at)
269
- ? fromJsonTimestamp(object.canceled_at)
270
- : undefined,
271
- cancelAtPeriodEnd: isSet(object.cancelAtPeriodEnd)
272
- ? globalThis.Boolean(object.cancelAtPeriodEnd)
273
- : isSet(object.cancel_at_period_end)
274
- ? globalThis.Boolean(object.cancel_at_period_end)
275
- : false,
276
- defaultPaymentMethod: isSet(object.defaultPaymentMethod)
277
- ? exports.PaymentMethod.fromJSON(object.defaultPaymentMethod)
278
- : isSet(object.default_payment_method)
279
- ? exports.PaymentMethod.fromJSON(object.default_payment_method)
280
- : undefined,
281
- currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
282
- amountCents: isSet(object.amountCents)
283
- ? globalThis.Number(object.amountCents)
284
- : isSet(object.amount_cents)
285
- ? globalThis.Number(object.amount_cents)
286
- : 0,
287
- isTrial: isSet(object.isTrial)
288
- ? globalThis.Boolean(object.isTrial)
289
- : isSet(object.is_trial)
290
- ? globalThis.Boolean(object.is_trial)
291
- : false,
292
- trialStart: isSet(object.trialStart)
293
- ? fromJsonTimestamp(object.trialStart)
294
- : isSet(object.trial_start)
295
- ? fromJsonTimestamp(object.trial_start)
296
- : undefined,
297
- trialEnd: isSet(object.trialEnd)
298
- ? fromJsonTimestamp(object.trialEnd)
299
- : isSet(object.trial_end)
300
- ? fromJsonTimestamp(object.trial_end)
301
- : undefined,
302
- activeDiscount: isSet(object.activeDiscount)
303
- ? exports.Discount.fromJSON(object.activeDiscount)
304
- : isSet(object.active_discount)
305
- ? exports.Discount.fromJSON(object.active_discount)
306
- : undefined,
307
- createdAt: isSet(object.createdAt)
308
- ? fromJsonTimestamp(object.createdAt)
309
- : isSet(object.created_at)
310
- ? fromJsonTimestamp(object.created_at)
311
- : undefined,
312
- updatedAt: isSet(object.updatedAt)
313
- ? fromJsonTimestamp(object.updatedAt)
314
- : isSet(object.updated_at)
315
- ? fromJsonTimestamp(object.updated_at)
316
- : undefined,
317
- features: isSet(object.features) ? exports.SubscriptionFeatures.fromJSON(object.features) : undefined,
318
- };
319
- },
320
- toJSON(message) {
321
- const obj = {};
322
- if (message.id !== "") {
323
- obj.id = message.id;
324
- }
325
- if (message.status !== "") {
326
- obj.status = message.status;
327
- }
328
- if (message.tier !== "") {
329
- obj.tier = message.tier;
330
- }
331
- if (message.plan !== undefined) {
332
- obj.plan = exports.PricingPlan.toJSON(message.plan);
333
- }
334
- if (message.currentPeriodStart !== undefined) {
335
- obj.currentPeriodStart = message.currentPeriodStart.toISOString();
336
- }
337
- if (message.currentPeriodEnd !== undefined) {
338
- obj.currentPeriodEnd = message.currentPeriodEnd.toISOString();
339
- }
340
- if (message.cancelAt !== undefined) {
341
- obj.cancelAt = message.cancelAt.toISOString();
342
- }
343
- if (message.canceledAt !== undefined) {
344
- obj.canceledAt = message.canceledAt.toISOString();
345
- }
346
- if (message.cancelAtPeriodEnd !== false) {
347
- obj.cancelAtPeriodEnd = message.cancelAtPeriodEnd;
348
- }
349
- if (message.defaultPaymentMethod !== undefined) {
350
- obj.defaultPaymentMethod = exports.PaymentMethod.toJSON(message.defaultPaymentMethod);
351
- }
352
- if (message.currency !== "") {
353
- obj.currency = message.currency;
354
- }
355
- if (message.amountCents !== 0) {
356
- obj.amountCents = Math.round(message.amountCents);
357
- }
358
- if (message.isTrial !== false) {
359
- obj.isTrial = message.isTrial;
360
- }
361
- if (message.trialStart !== undefined) {
362
- obj.trialStart = message.trialStart.toISOString();
363
- }
364
- if (message.trialEnd !== undefined) {
365
- obj.trialEnd = message.trialEnd.toISOString();
366
- }
367
- if (message.activeDiscount !== undefined) {
368
- obj.activeDiscount = exports.Discount.toJSON(message.activeDiscount);
369
- }
370
- if (message.createdAt !== undefined) {
371
- obj.createdAt = message.createdAt.toISOString();
372
- }
373
- if (message.updatedAt !== undefined) {
374
- obj.updatedAt = message.updatedAt.toISOString();
375
- }
376
- if (message.features !== undefined) {
377
- obj.features = exports.SubscriptionFeatures.toJSON(message.features);
378
- }
379
- return obj;
380
- },
381
- create(base) {
382
- return exports.SubscriptionStatus.fromPartial(base !== null && base !== void 0 ? base : {});
383
- },
384
- fromPartial(object) {
385
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
386
- const message = createBaseSubscriptionStatus();
387
- message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
388
- message.status = (_b = object.status) !== null && _b !== void 0 ? _b : "";
389
- message.tier = (_c = object.tier) !== null && _c !== void 0 ? _c : "";
390
- message.plan = (object.plan !== undefined && object.plan !== null)
391
- ? exports.PricingPlan.fromPartial(object.plan)
392
- : undefined;
393
- message.currentPeriodStart = (_d = object.currentPeriodStart) !== null && _d !== void 0 ? _d : undefined;
394
- message.currentPeriodEnd = (_e = object.currentPeriodEnd) !== null && _e !== void 0 ? _e : undefined;
395
- message.cancelAt = (_f = object.cancelAt) !== null && _f !== void 0 ? _f : undefined;
396
- message.canceledAt = (_g = object.canceledAt) !== null && _g !== void 0 ? _g : undefined;
397
- message.cancelAtPeriodEnd = (_h = object.cancelAtPeriodEnd) !== null && _h !== void 0 ? _h : false;
398
- message.defaultPaymentMethod = (object.defaultPaymentMethod !== undefined && object.defaultPaymentMethod !== null)
399
- ? exports.PaymentMethod.fromPartial(object.defaultPaymentMethod)
400
- : undefined;
401
- message.currency = (_j = object.currency) !== null && _j !== void 0 ? _j : "";
402
- message.amountCents = (_k = object.amountCents) !== null && _k !== void 0 ? _k : 0;
403
- message.isTrial = (_l = object.isTrial) !== null && _l !== void 0 ? _l : false;
404
- message.trialStart = (_m = object.trialStart) !== null && _m !== void 0 ? _m : undefined;
405
- message.trialEnd = (_o = object.trialEnd) !== null && _o !== void 0 ? _o : undefined;
406
- message.activeDiscount = (object.activeDiscount !== undefined && object.activeDiscount !== null)
407
- ? exports.Discount.fromPartial(object.activeDiscount)
408
- : undefined;
409
- message.createdAt = (_p = object.createdAt) !== null && _p !== void 0 ? _p : undefined;
410
- message.updatedAt = (_q = object.updatedAt) !== null && _q !== void 0 ? _q : undefined;
411
- message.features = (object.features !== undefined && object.features !== null)
412
- ? exports.SubscriptionFeatures.fromPartial(object.features)
413
- : undefined;
414
- return message;
415
- },
416
- };
417
- function createBasePricingPlan() {
418
- return {
419
- id: "",
420
- productId: "",
421
- name: "",
422
- description: "",
423
- amountCents: 0,
424
- currency: "",
425
- interval: "",
426
- intervalCount: 0,
427
- features: undefined,
428
- isDefault: false,
429
- isPopular: false,
430
- highlights: [],
431
- };
432
- }
433
- exports.PricingPlan = {
434
- encode(message, writer = new wire_1.BinaryWriter()) {
435
- if (message.id !== "") {
436
- writer.uint32(10).string(message.id);
437
- }
438
- if (message.productId !== "") {
439
- writer.uint32(18).string(message.productId);
440
- }
441
- if (message.name !== "") {
442
- writer.uint32(26).string(message.name);
443
- }
444
- if (message.description !== "") {
445
- writer.uint32(34).string(message.description);
446
- }
447
- if (message.amountCents !== 0) {
448
- writer.uint32(40).int64(message.amountCents);
449
- }
450
- if (message.currency !== "") {
451
- writer.uint32(50).string(message.currency);
452
- }
453
- if (message.interval !== "") {
454
- writer.uint32(58).string(message.interval);
455
- }
456
- if (message.intervalCount !== 0) {
457
- writer.uint32(64).int32(message.intervalCount);
458
- }
459
- if (message.features !== undefined) {
460
- exports.SubscriptionFeatures.encode(message.features, writer.uint32(74).fork()).join();
461
- }
462
- if (message.isDefault !== false) {
463
- writer.uint32(80).bool(message.isDefault);
464
- }
465
- if (message.isPopular !== false) {
466
- writer.uint32(88).bool(message.isPopular);
467
- }
468
- for (const v of message.highlights) {
469
- writer.uint32(98).string(v);
470
- }
471
- return writer;
472
- },
473
- decode(input, length) {
474
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
475
- const end = length === undefined ? reader.len : reader.pos + length;
476
- const message = createBasePricingPlan();
477
- while (reader.pos < end) {
478
- const tag = reader.uint32();
479
- switch (tag >>> 3) {
480
- case 1: {
481
- if (tag !== 10) {
482
- break;
483
- }
484
- message.id = reader.string();
485
- continue;
486
- }
487
- case 2: {
488
- if (tag !== 18) {
489
- break;
490
- }
491
- message.productId = reader.string();
492
- continue;
493
- }
494
- case 3: {
495
- if (tag !== 26) {
496
- break;
497
- }
498
- message.name = reader.string();
499
- continue;
500
- }
501
- case 4: {
502
- if (tag !== 34) {
503
- break;
504
- }
505
- message.description = reader.string();
506
- continue;
507
- }
508
- case 5: {
509
- if (tag !== 40) {
510
- break;
511
- }
512
- message.amountCents = longToNumber(reader.int64());
513
- continue;
514
- }
515
- case 6: {
516
- if (tag !== 50) {
517
- break;
518
- }
519
- message.currency = reader.string();
520
- continue;
521
- }
522
- case 7: {
523
- if (tag !== 58) {
524
- break;
525
- }
526
- message.interval = reader.string();
527
- continue;
528
- }
529
- case 8: {
530
- if (tag !== 64) {
531
- break;
532
- }
533
- message.intervalCount = reader.int32();
534
- continue;
535
- }
536
- case 9: {
537
- if (tag !== 74) {
538
- break;
539
- }
540
- message.features = exports.SubscriptionFeatures.decode(reader, reader.uint32());
541
- continue;
542
- }
543
- case 10: {
544
- if (tag !== 80) {
545
- break;
546
- }
547
- message.isDefault = reader.bool();
548
- continue;
549
- }
550
- case 11: {
551
- if (tag !== 88) {
552
- break;
553
- }
554
- message.isPopular = reader.bool();
555
- continue;
556
- }
557
- case 12: {
558
- if (tag !== 98) {
559
- break;
560
- }
561
- message.highlights.push(reader.string());
562
- continue;
563
- }
564
- }
565
- if ((tag & 7) === 4 || tag === 0) {
566
- break;
567
- }
568
- reader.skip(tag & 7);
569
- }
570
- return message;
571
- },
572
- fromJSON(object) {
573
- return {
574
- id: isSet(object.id) ? globalThis.String(object.id) : "",
575
- productId: isSet(object.productId)
576
- ? globalThis.String(object.productId)
577
- : isSet(object.product_id)
578
- ? globalThis.String(object.product_id)
579
- : "",
580
- name: isSet(object.name) ? globalThis.String(object.name) : "",
581
- description: isSet(object.description) ? globalThis.String(object.description) : "",
582
- amountCents: isSet(object.amountCents)
583
- ? globalThis.Number(object.amountCents)
584
- : isSet(object.amount_cents)
585
- ? globalThis.Number(object.amount_cents)
586
- : 0,
587
- currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
588
- interval: isSet(object.interval) ? globalThis.String(object.interval) : "",
589
- intervalCount: isSet(object.intervalCount)
590
- ? globalThis.Number(object.intervalCount)
591
- : isSet(object.interval_count)
592
- ? globalThis.Number(object.interval_count)
593
- : 0,
594
- features: isSet(object.features) ? exports.SubscriptionFeatures.fromJSON(object.features) : undefined,
595
- isDefault: isSet(object.isDefault)
596
- ? globalThis.Boolean(object.isDefault)
597
- : isSet(object.is_default)
598
- ? globalThis.Boolean(object.is_default)
599
- : false,
600
- isPopular: isSet(object.isPopular)
601
- ? globalThis.Boolean(object.isPopular)
602
- : isSet(object.is_popular)
603
- ? globalThis.Boolean(object.is_popular)
604
- : false,
605
- highlights: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.highlights)
606
- ? object.highlights.map((e) => globalThis.String(e))
607
- : [],
608
- };
609
- },
610
- toJSON(message) {
611
- var _a;
612
- const obj = {};
613
- if (message.id !== "") {
614
- obj.id = message.id;
615
- }
616
- if (message.productId !== "") {
617
- obj.productId = message.productId;
618
- }
619
- if (message.name !== "") {
620
- obj.name = message.name;
621
- }
622
- if (message.description !== "") {
623
- obj.description = message.description;
624
- }
625
- if (message.amountCents !== 0) {
626
- obj.amountCents = Math.round(message.amountCents);
627
- }
628
- if (message.currency !== "") {
629
- obj.currency = message.currency;
630
- }
631
- if (message.interval !== "") {
632
- obj.interval = message.interval;
633
- }
634
- if (message.intervalCount !== 0) {
635
- obj.intervalCount = Math.round(message.intervalCount);
636
- }
637
- if (message.features !== undefined) {
638
- obj.features = exports.SubscriptionFeatures.toJSON(message.features);
639
- }
640
- if (message.isDefault !== false) {
641
- obj.isDefault = message.isDefault;
642
- }
643
- if (message.isPopular !== false) {
644
- obj.isPopular = message.isPopular;
645
- }
646
- if ((_a = message.highlights) === null || _a === void 0 ? void 0 : _a.length) {
647
- obj.highlights = message.highlights;
648
- }
649
- return obj;
650
- },
651
- create(base) {
652
- return exports.PricingPlan.fromPartial(base !== null && base !== void 0 ? base : {});
653
- },
654
- fromPartial(object) {
655
- var _a;
656
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
657
- const message = createBasePricingPlan();
658
- message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "";
659
- message.productId = (_c = object.productId) !== null && _c !== void 0 ? _c : "";
660
- message.name = (_d = object.name) !== null && _d !== void 0 ? _d : "";
661
- message.description = (_e = object.description) !== null && _e !== void 0 ? _e : "";
662
- message.amountCents = (_f = object.amountCents) !== null && _f !== void 0 ? _f : 0;
663
- message.currency = (_g = object.currency) !== null && _g !== void 0 ? _g : "";
664
- message.interval = (_h = object.interval) !== null && _h !== void 0 ? _h : "";
665
- message.intervalCount = (_j = object.intervalCount) !== null && _j !== void 0 ? _j : 0;
666
- message.features = (object.features !== undefined && object.features !== null)
667
- ? exports.SubscriptionFeatures.fromPartial(object.features)
668
- : undefined;
669
- message.isDefault = (_k = object.isDefault) !== null && _k !== void 0 ? _k : false;
670
- message.isPopular = (_l = object.isPopular) !== null && _l !== void 0 ? _l : false;
671
- message.highlights = ((_a = object.highlights) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
672
- return message;
673
- },
674
- };
675
- function createBaseSubscriptionFeatures() {
676
- return {
677
- apiRequestsPerHour: 0,
678
- apiRequestsPerDay: 0,
679
- apiRequestsPerMonth: 0,
680
- unlimitedRequests: false,
681
- apiKeysLimit: 0,
682
- unlimitedApiKeys: false,
683
- webhookAccess: false,
684
- exportAccess: false,
685
- prioritySupport: false,
686
- customLimits: false,
687
- teamAccess: false,
688
- teamMembersLimit: 0,
689
- ssoAccess: false,
690
- auditLogs: false,
691
- slaGuarantee: false,
692
- };
693
- }
694
- exports.SubscriptionFeatures = {
695
- encode(message, writer = new wire_1.BinaryWriter()) {
696
- if (message.apiRequestsPerHour !== 0) {
697
- writer.uint32(8).int64(message.apiRequestsPerHour);
698
- }
699
- if (message.apiRequestsPerDay !== 0) {
700
- writer.uint32(16).int64(message.apiRequestsPerDay);
701
- }
702
- if (message.apiRequestsPerMonth !== 0) {
703
- writer.uint32(24).int64(message.apiRequestsPerMonth);
704
- }
705
- if (message.unlimitedRequests !== false) {
706
- writer.uint32(32).bool(message.unlimitedRequests);
707
- }
708
- if (message.apiKeysLimit !== 0) {
709
- writer.uint32(40).int32(message.apiKeysLimit);
710
- }
711
- if (message.unlimitedApiKeys !== false) {
712
- writer.uint32(48).bool(message.unlimitedApiKeys);
713
- }
714
- if (message.webhookAccess !== false) {
715
- writer.uint32(56).bool(message.webhookAccess);
716
- }
717
- if (message.exportAccess !== false) {
718
- writer.uint32(64).bool(message.exportAccess);
719
- }
720
- if (message.prioritySupport !== false) {
721
- writer.uint32(72).bool(message.prioritySupport);
722
- }
723
- if (message.customLimits !== false) {
724
- writer.uint32(80).bool(message.customLimits);
725
- }
726
- if (message.teamAccess !== false) {
727
- writer.uint32(88).bool(message.teamAccess);
728
- }
729
- if (message.teamMembersLimit !== 0) {
730
- writer.uint32(96).int32(message.teamMembersLimit);
731
- }
732
- if (message.ssoAccess !== false) {
733
- writer.uint32(104).bool(message.ssoAccess);
734
- }
735
- if (message.auditLogs !== false) {
736
- writer.uint32(112).bool(message.auditLogs);
737
- }
738
- if (message.slaGuarantee !== false) {
739
- writer.uint32(120).bool(message.slaGuarantee);
740
- }
741
- return writer;
742
- },
743
- decode(input, length) {
744
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
745
- const end = length === undefined ? reader.len : reader.pos + length;
746
- const message = createBaseSubscriptionFeatures();
747
- while (reader.pos < end) {
748
- const tag = reader.uint32();
749
- switch (tag >>> 3) {
750
- case 1: {
751
- if (tag !== 8) {
752
- break;
753
- }
754
- message.apiRequestsPerHour = longToNumber(reader.int64());
755
- continue;
756
- }
757
- case 2: {
758
- if (tag !== 16) {
759
- break;
760
- }
761
- message.apiRequestsPerDay = longToNumber(reader.int64());
762
- continue;
763
- }
764
- case 3: {
765
- if (tag !== 24) {
766
- break;
767
- }
768
- message.apiRequestsPerMonth = longToNumber(reader.int64());
769
- continue;
770
- }
771
- case 4: {
772
- if (tag !== 32) {
773
- break;
774
- }
775
- message.unlimitedRequests = reader.bool();
776
- continue;
777
- }
778
- case 5: {
779
- if (tag !== 40) {
780
- break;
781
- }
782
- message.apiKeysLimit = reader.int32();
783
- continue;
784
- }
785
- case 6: {
786
- if (tag !== 48) {
787
- break;
788
- }
789
- message.unlimitedApiKeys = reader.bool();
790
- continue;
791
- }
792
- case 7: {
793
- if (tag !== 56) {
794
- break;
795
- }
796
- message.webhookAccess = reader.bool();
797
- continue;
798
- }
799
- case 8: {
800
- if (tag !== 64) {
801
- break;
802
- }
803
- message.exportAccess = reader.bool();
804
- continue;
805
- }
806
- case 9: {
807
- if (tag !== 72) {
808
- break;
809
- }
810
- message.prioritySupport = reader.bool();
811
- continue;
812
- }
813
- case 10: {
814
- if (tag !== 80) {
815
- break;
816
- }
817
- message.customLimits = reader.bool();
818
- continue;
819
- }
820
- case 11: {
821
- if (tag !== 88) {
822
- break;
823
- }
824
- message.teamAccess = reader.bool();
825
- continue;
826
- }
827
- case 12: {
828
- if (tag !== 96) {
829
- break;
830
- }
831
- message.teamMembersLimit = reader.int32();
832
- continue;
833
- }
834
- case 13: {
835
- if (tag !== 104) {
836
- break;
837
- }
838
- message.ssoAccess = reader.bool();
839
- continue;
840
- }
841
- case 14: {
842
- if (tag !== 112) {
843
- break;
844
- }
845
- message.auditLogs = reader.bool();
846
- continue;
847
- }
848
- case 15: {
849
- if (tag !== 120) {
850
- break;
851
- }
852
- message.slaGuarantee = reader.bool();
853
- continue;
854
- }
855
- }
856
- if ((tag & 7) === 4 || tag === 0) {
857
- break;
858
- }
859
- reader.skip(tag & 7);
860
- }
861
- return message;
862
- },
863
- fromJSON(object) {
864
- return {
865
- apiRequestsPerHour: isSet(object.apiRequestsPerHour)
866
- ? globalThis.Number(object.apiRequestsPerHour)
867
- : isSet(object.api_requests_per_hour)
868
- ? globalThis.Number(object.api_requests_per_hour)
869
- : 0,
870
- apiRequestsPerDay: isSet(object.apiRequestsPerDay)
871
- ? globalThis.Number(object.apiRequestsPerDay)
872
- : isSet(object.api_requests_per_day)
873
- ? globalThis.Number(object.api_requests_per_day)
874
- : 0,
875
- apiRequestsPerMonth: isSet(object.apiRequestsPerMonth)
876
- ? globalThis.Number(object.apiRequestsPerMonth)
877
- : isSet(object.api_requests_per_month)
878
- ? globalThis.Number(object.api_requests_per_month)
879
- : 0,
880
- unlimitedRequests: isSet(object.unlimitedRequests)
881
- ? globalThis.Boolean(object.unlimitedRequests)
882
- : isSet(object.unlimited_requests)
883
- ? globalThis.Boolean(object.unlimited_requests)
884
- : false,
885
- apiKeysLimit: isSet(object.apiKeysLimit)
886
- ? globalThis.Number(object.apiKeysLimit)
887
- : isSet(object.api_keys_limit)
888
- ? globalThis.Number(object.api_keys_limit)
889
- : 0,
890
- unlimitedApiKeys: isSet(object.unlimitedApiKeys)
891
- ? globalThis.Boolean(object.unlimitedApiKeys)
892
- : isSet(object.unlimited_api_keys)
893
- ? globalThis.Boolean(object.unlimited_api_keys)
894
- : false,
895
- webhookAccess: isSet(object.webhookAccess)
896
- ? globalThis.Boolean(object.webhookAccess)
897
- : isSet(object.webhook_access)
898
- ? globalThis.Boolean(object.webhook_access)
899
- : false,
900
- exportAccess: isSet(object.exportAccess)
901
- ? globalThis.Boolean(object.exportAccess)
902
- : isSet(object.export_access)
903
- ? globalThis.Boolean(object.export_access)
904
- : false,
905
- prioritySupport: isSet(object.prioritySupport)
906
- ? globalThis.Boolean(object.prioritySupport)
907
- : isSet(object.priority_support)
908
- ? globalThis.Boolean(object.priority_support)
909
- : false,
910
- customLimits: isSet(object.customLimits)
911
- ? globalThis.Boolean(object.customLimits)
912
- : isSet(object.custom_limits)
913
- ? globalThis.Boolean(object.custom_limits)
914
- : false,
915
- teamAccess: isSet(object.teamAccess)
916
- ? globalThis.Boolean(object.teamAccess)
917
- : isSet(object.team_access)
918
- ? globalThis.Boolean(object.team_access)
919
- : false,
920
- teamMembersLimit: isSet(object.teamMembersLimit)
921
- ? globalThis.Number(object.teamMembersLimit)
922
- : isSet(object.team_members_limit)
923
- ? globalThis.Number(object.team_members_limit)
924
- : 0,
925
- ssoAccess: isSet(object.ssoAccess)
926
- ? globalThis.Boolean(object.ssoAccess)
927
- : isSet(object.sso_access)
928
- ? globalThis.Boolean(object.sso_access)
929
- : false,
930
- auditLogs: isSet(object.auditLogs)
931
- ? globalThis.Boolean(object.auditLogs)
932
- : isSet(object.audit_logs)
933
- ? globalThis.Boolean(object.audit_logs)
934
- : false,
935
- slaGuarantee: isSet(object.slaGuarantee)
936
- ? globalThis.Boolean(object.slaGuarantee)
937
- : isSet(object.sla_guarantee)
938
- ? globalThis.Boolean(object.sla_guarantee)
939
- : false,
940
- };
941
- },
942
- toJSON(message) {
943
- const obj = {};
944
- if (message.apiRequestsPerHour !== 0) {
945
- obj.apiRequestsPerHour = Math.round(message.apiRequestsPerHour);
946
- }
947
- if (message.apiRequestsPerDay !== 0) {
948
- obj.apiRequestsPerDay = Math.round(message.apiRequestsPerDay);
949
- }
950
- if (message.apiRequestsPerMonth !== 0) {
951
- obj.apiRequestsPerMonth = Math.round(message.apiRequestsPerMonth);
952
- }
953
- if (message.unlimitedRequests !== false) {
954
- obj.unlimitedRequests = message.unlimitedRequests;
955
- }
956
- if (message.apiKeysLimit !== 0) {
957
- obj.apiKeysLimit = Math.round(message.apiKeysLimit);
958
- }
959
- if (message.unlimitedApiKeys !== false) {
960
- obj.unlimitedApiKeys = message.unlimitedApiKeys;
961
- }
962
- if (message.webhookAccess !== false) {
963
- obj.webhookAccess = message.webhookAccess;
964
- }
965
- if (message.exportAccess !== false) {
966
- obj.exportAccess = message.exportAccess;
967
- }
968
- if (message.prioritySupport !== false) {
969
- obj.prioritySupport = message.prioritySupport;
970
- }
971
- if (message.customLimits !== false) {
972
- obj.customLimits = message.customLimits;
973
- }
974
- if (message.teamAccess !== false) {
975
- obj.teamAccess = message.teamAccess;
976
- }
977
- if (message.teamMembersLimit !== 0) {
978
- obj.teamMembersLimit = Math.round(message.teamMembersLimit);
979
- }
980
- if (message.ssoAccess !== false) {
981
- obj.ssoAccess = message.ssoAccess;
982
- }
983
- if (message.auditLogs !== false) {
984
- obj.auditLogs = message.auditLogs;
985
- }
986
- if (message.slaGuarantee !== false) {
987
- obj.slaGuarantee = message.slaGuarantee;
988
- }
989
- return obj;
990
- },
991
- create(base) {
992
- return exports.SubscriptionFeatures.fromPartial(base !== null && base !== void 0 ? base : {});
993
- },
994
- fromPartial(object) {
995
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
996
- const message = createBaseSubscriptionFeatures();
997
- message.apiRequestsPerHour = (_a = object.apiRequestsPerHour) !== null && _a !== void 0 ? _a : 0;
998
- message.apiRequestsPerDay = (_b = object.apiRequestsPerDay) !== null && _b !== void 0 ? _b : 0;
999
- message.apiRequestsPerMonth = (_c = object.apiRequestsPerMonth) !== null && _c !== void 0 ? _c : 0;
1000
- message.unlimitedRequests = (_d = object.unlimitedRequests) !== null && _d !== void 0 ? _d : false;
1001
- message.apiKeysLimit = (_e = object.apiKeysLimit) !== null && _e !== void 0 ? _e : 0;
1002
- message.unlimitedApiKeys = (_f = object.unlimitedApiKeys) !== null && _f !== void 0 ? _f : false;
1003
- message.webhookAccess = (_g = object.webhookAccess) !== null && _g !== void 0 ? _g : false;
1004
- message.exportAccess = (_h = object.exportAccess) !== null && _h !== void 0 ? _h : false;
1005
- message.prioritySupport = (_j = object.prioritySupport) !== null && _j !== void 0 ? _j : false;
1006
- message.customLimits = (_k = object.customLimits) !== null && _k !== void 0 ? _k : false;
1007
- message.teamAccess = (_l = object.teamAccess) !== null && _l !== void 0 ? _l : false;
1008
- message.teamMembersLimit = (_m = object.teamMembersLimit) !== null && _m !== void 0 ? _m : 0;
1009
- message.ssoAccess = (_o = object.ssoAccess) !== null && _o !== void 0 ? _o : false;
1010
- message.auditLogs = (_p = object.auditLogs) !== null && _p !== void 0 ? _p : false;
1011
- message.slaGuarantee = (_q = object.slaGuarantee) !== null && _q !== void 0 ? _q : false;
1012
- return message;
1013
- },
1014
- };
1015
- function createBasePaymentMethod() {
1016
- return {
1017
- id: "",
1018
- type: "",
1019
- isDefault: false,
1020
- card: undefined,
1021
- bank: undefined,
1022
- billingDetails: undefined,
1023
- createdAt: undefined,
1024
- };
1025
- }
1026
- exports.PaymentMethod = {
1027
- encode(message, writer = new wire_1.BinaryWriter()) {
1028
- if (message.id !== "") {
1029
- writer.uint32(10).string(message.id);
1030
- }
1031
- if (message.type !== "") {
1032
- writer.uint32(18).string(message.type);
1033
- }
1034
- if (message.isDefault !== false) {
1035
- writer.uint32(24).bool(message.isDefault);
1036
- }
1037
- if (message.card !== undefined) {
1038
- exports.CardDetails.encode(message.card, writer.uint32(34).fork()).join();
1039
- }
1040
- if (message.bank !== undefined) {
1041
- exports.BankDetails.encode(message.bank, writer.uint32(42).fork()).join();
1042
- }
1043
- if (message.billingDetails !== undefined) {
1044
- exports.BillingDetails.encode(message.billingDetails, writer.uint32(50).fork()).join();
1045
- }
1046
- if (message.createdAt !== undefined) {
1047
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
1048
- }
1049
- return writer;
1050
- },
1051
- decode(input, length) {
1052
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1053
- const end = length === undefined ? reader.len : reader.pos + length;
1054
- const message = createBasePaymentMethod();
1055
- while (reader.pos < end) {
1056
- const tag = reader.uint32();
1057
- switch (tag >>> 3) {
1058
- case 1: {
1059
- if (tag !== 10) {
1060
- break;
1061
- }
1062
- message.id = reader.string();
1063
- continue;
1064
- }
1065
- case 2: {
1066
- if (tag !== 18) {
1067
- break;
1068
- }
1069
- message.type = reader.string();
1070
- continue;
1071
- }
1072
- case 3: {
1073
- if (tag !== 24) {
1074
- break;
1075
- }
1076
- message.isDefault = reader.bool();
1077
- continue;
1078
- }
1079
- case 4: {
1080
- if (tag !== 34) {
1081
- break;
1082
- }
1083
- message.card = exports.CardDetails.decode(reader, reader.uint32());
1084
- continue;
1085
- }
1086
- case 5: {
1087
- if (tag !== 42) {
1088
- break;
1089
- }
1090
- message.bank = exports.BankDetails.decode(reader, reader.uint32());
1091
- continue;
1092
- }
1093
- case 6: {
1094
- if (tag !== 50) {
1095
- break;
1096
- }
1097
- message.billingDetails = exports.BillingDetails.decode(reader, reader.uint32());
1098
- continue;
1099
- }
1100
- case 7: {
1101
- if (tag !== 58) {
1102
- break;
1103
- }
1104
- message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1105
- continue;
1106
- }
1107
- }
1108
- if ((tag & 7) === 4 || tag === 0) {
1109
- break;
1110
- }
1111
- reader.skip(tag & 7);
1112
- }
1113
- return message;
1114
- },
1115
- fromJSON(object) {
1116
- return {
1117
- id: isSet(object.id) ? globalThis.String(object.id) : "",
1118
- type: isSet(object.type) ? globalThis.String(object.type) : "",
1119
- isDefault: isSet(object.isDefault)
1120
- ? globalThis.Boolean(object.isDefault)
1121
- : isSet(object.is_default)
1122
- ? globalThis.Boolean(object.is_default)
1123
- : false,
1124
- card: isSet(object.card) ? exports.CardDetails.fromJSON(object.card) : undefined,
1125
- bank: isSet(object.bank) ? exports.BankDetails.fromJSON(object.bank) : undefined,
1126
- billingDetails: isSet(object.billingDetails)
1127
- ? exports.BillingDetails.fromJSON(object.billingDetails)
1128
- : isSet(object.billing_details)
1129
- ? exports.BillingDetails.fromJSON(object.billing_details)
1130
- : undefined,
1131
- createdAt: isSet(object.createdAt)
1132
- ? fromJsonTimestamp(object.createdAt)
1133
- : isSet(object.created_at)
1134
- ? fromJsonTimestamp(object.created_at)
1135
- : undefined,
1136
- };
1137
- },
1138
- toJSON(message) {
1139
- const obj = {};
1140
- if (message.id !== "") {
1141
- obj.id = message.id;
1142
- }
1143
- if (message.type !== "") {
1144
- obj.type = message.type;
1145
- }
1146
- if (message.isDefault !== false) {
1147
- obj.isDefault = message.isDefault;
1148
- }
1149
- if (message.card !== undefined) {
1150
- obj.card = exports.CardDetails.toJSON(message.card);
1151
- }
1152
- if (message.bank !== undefined) {
1153
- obj.bank = exports.BankDetails.toJSON(message.bank);
1154
- }
1155
- if (message.billingDetails !== undefined) {
1156
- obj.billingDetails = exports.BillingDetails.toJSON(message.billingDetails);
1157
- }
1158
- if (message.createdAt !== undefined) {
1159
- obj.createdAt = message.createdAt.toISOString();
1160
- }
1161
- return obj;
1162
- },
1163
- create(base) {
1164
- return exports.PaymentMethod.fromPartial(base !== null && base !== void 0 ? base : {});
1165
- },
1166
- fromPartial(object) {
1167
- var _a, _b, _c, _d;
1168
- const message = createBasePaymentMethod();
1169
- message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
1170
- message.type = (_b = object.type) !== null && _b !== void 0 ? _b : "";
1171
- message.isDefault = (_c = object.isDefault) !== null && _c !== void 0 ? _c : false;
1172
- message.card = (object.card !== undefined && object.card !== null)
1173
- ? exports.CardDetails.fromPartial(object.card)
1174
- : undefined;
1175
- message.bank = (object.bank !== undefined && object.bank !== null)
1176
- ? exports.BankDetails.fromPartial(object.bank)
1177
- : undefined;
1178
- message.billingDetails = (object.billingDetails !== undefined && object.billingDetails !== null)
1179
- ? exports.BillingDetails.fromPartial(object.billingDetails)
1180
- : undefined;
1181
- message.createdAt = (_d = object.createdAt) !== null && _d !== void 0 ? _d : undefined;
1182
- return message;
1183
- },
1184
- };
1185
- function createBaseCardDetails() {
1186
- return { brand: "", last4: "", expMonth: 0, expYear: 0, funding: "", country: "", fingerprint: "" };
1187
- }
1188
- exports.CardDetails = {
1189
- encode(message, writer = new wire_1.BinaryWriter()) {
1190
- if (message.brand !== "") {
1191
- writer.uint32(10).string(message.brand);
1192
- }
1193
- if (message.last4 !== "") {
1194
- writer.uint32(18).string(message.last4);
1195
- }
1196
- if (message.expMonth !== 0) {
1197
- writer.uint32(24).int32(message.expMonth);
1198
- }
1199
- if (message.expYear !== 0) {
1200
- writer.uint32(32).int32(message.expYear);
1201
- }
1202
- if (message.funding !== "") {
1203
- writer.uint32(42).string(message.funding);
1204
- }
1205
- if (message.country !== "") {
1206
- writer.uint32(50).string(message.country);
1207
- }
1208
- if (message.fingerprint !== "") {
1209
- writer.uint32(58).string(message.fingerprint);
1210
- }
1211
- return writer;
1212
- },
1213
- decode(input, length) {
1214
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1215
- const end = length === undefined ? reader.len : reader.pos + length;
1216
- const message = createBaseCardDetails();
1217
- while (reader.pos < end) {
1218
- const tag = reader.uint32();
1219
- switch (tag >>> 3) {
1220
- case 1: {
1221
- if (tag !== 10) {
1222
- break;
1223
- }
1224
- message.brand = reader.string();
1225
- continue;
1226
- }
1227
- case 2: {
1228
- if (tag !== 18) {
1229
- break;
1230
- }
1231
- message.last4 = reader.string();
1232
- continue;
1233
- }
1234
- case 3: {
1235
- if (tag !== 24) {
1236
- break;
1237
- }
1238
- message.expMonth = reader.int32();
1239
- continue;
1240
- }
1241
- case 4: {
1242
- if (tag !== 32) {
1243
- break;
1244
- }
1245
- message.expYear = reader.int32();
1246
- continue;
1247
- }
1248
- case 5: {
1249
- if (tag !== 42) {
1250
- break;
1251
- }
1252
- message.funding = reader.string();
1253
- continue;
1254
- }
1255
- case 6: {
1256
- if (tag !== 50) {
1257
- break;
1258
- }
1259
- message.country = reader.string();
1260
- continue;
1261
- }
1262
- case 7: {
1263
- if (tag !== 58) {
1264
- break;
1265
- }
1266
- message.fingerprint = reader.string();
1267
- continue;
1268
- }
1269
- }
1270
- if ((tag & 7) === 4 || tag === 0) {
1271
- break;
1272
- }
1273
- reader.skip(tag & 7);
1274
- }
1275
- return message;
1276
- },
1277
- fromJSON(object) {
1278
- return {
1279
- brand: isSet(object.brand) ? globalThis.String(object.brand) : "",
1280
- last4: isSet(object.last4) ? globalThis.String(object.last4) : "",
1281
- expMonth: isSet(object.expMonth)
1282
- ? globalThis.Number(object.expMonth)
1283
- : isSet(object.exp_month)
1284
- ? globalThis.Number(object.exp_month)
1285
- : 0,
1286
- expYear: isSet(object.expYear)
1287
- ? globalThis.Number(object.expYear)
1288
- : isSet(object.exp_year)
1289
- ? globalThis.Number(object.exp_year)
1290
- : 0,
1291
- funding: isSet(object.funding) ? globalThis.String(object.funding) : "",
1292
- country: isSet(object.country) ? globalThis.String(object.country) : "",
1293
- fingerprint: isSet(object.fingerprint) ? globalThis.String(object.fingerprint) : "",
1294
- };
1295
- },
1296
- toJSON(message) {
1297
- const obj = {};
1298
- if (message.brand !== "") {
1299
- obj.brand = message.brand;
1300
- }
1301
- if (message.last4 !== "") {
1302
- obj.last4 = message.last4;
1303
- }
1304
- if (message.expMonth !== 0) {
1305
- obj.expMonth = Math.round(message.expMonth);
1306
- }
1307
- if (message.expYear !== 0) {
1308
- obj.expYear = Math.round(message.expYear);
1309
- }
1310
- if (message.funding !== "") {
1311
- obj.funding = message.funding;
1312
- }
1313
- if (message.country !== "") {
1314
- obj.country = message.country;
1315
- }
1316
- if (message.fingerprint !== "") {
1317
- obj.fingerprint = message.fingerprint;
1318
- }
1319
- return obj;
1320
- },
1321
- create(base) {
1322
- return exports.CardDetails.fromPartial(base !== null && base !== void 0 ? base : {});
1323
- },
1324
- fromPartial(object) {
1325
- var _a, _b, _c, _d, _e, _f, _g;
1326
- const message = createBaseCardDetails();
1327
- message.brand = (_a = object.brand) !== null && _a !== void 0 ? _a : "";
1328
- message.last4 = (_b = object.last4) !== null && _b !== void 0 ? _b : "";
1329
- message.expMonth = (_c = object.expMonth) !== null && _c !== void 0 ? _c : 0;
1330
- message.expYear = (_d = object.expYear) !== null && _d !== void 0 ? _d : 0;
1331
- message.funding = (_e = object.funding) !== null && _e !== void 0 ? _e : "";
1332
- message.country = (_f = object.country) !== null && _f !== void 0 ? _f : "";
1333
- message.fingerprint = (_g = object.fingerprint) !== null && _g !== void 0 ? _g : "";
1334
- return message;
1335
- },
1336
- };
1337
- function createBaseBankDetails() {
1338
- return { bankName: "", last4: "", accountType: "", country: "", currency: "" };
1339
- }
1340
- exports.BankDetails = {
1341
- encode(message, writer = new wire_1.BinaryWriter()) {
1342
- if (message.bankName !== "") {
1343
- writer.uint32(10).string(message.bankName);
1344
- }
1345
- if (message.last4 !== "") {
1346
- writer.uint32(18).string(message.last4);
1347
- }
1348
- if (message.accountType !== "") {
1349
- writer.uint32(26).string(message.accountType);
1350
- }
1351
- if (message.country !== "") {
1352
- writer.uint32(34).string(message.country);
1353
- }
1354
- if (message.currency !== "") {
1355
- writer.uint32(42).string(message.currency);
1356
- }
1357
- return writer;
1358
- },
1359
- decode(input, length) {
1360
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1361
- const end = length === undefined ? reader.len : reader.pos + length;
1362
- const message = createBaseBankDetails();
1363
- while (reader.pos < end) {
1364
- const tag = reader.uint32();
1365
- switch (tag >>> 3) {
1366
- case 1: {
1367
- if (tag !== 10) {
1368
- break;
1369
- }
1370
- message.bankName = reader.string();
1371
- continue;
1372
- }
1373
- case 2: {
1374
- if (tag !== 18) {
1375
- break;
1376
- }
1377
- message.last4 = reader.string();
1378
- continue;
1379
- }
1380
- case 3: {
1381
- if (tag !== 26) {
1382
- break;
1383
- }
1384
- message.accountType = reader.string();
1385
- continue;
1386
- }
1387
- case 4: {
1388
- if (tag !== 34) {
1389
- break;
1390
- }
1391
- message.country = reader.string();
1392
- continue;
1393
- }
1394
- case 5: {
1395
- if (tag !== 42) {
1396
- break;
1397
- }
1398
- message.currency = reader.string();
1399
- continue;
1400
- }
1401
- }
1402
- if ((tag & 7) === 4 || tag === 0) {
1403
- break;
1404
- }
1405
- reader.skip(tag & 7);
1406
- }
1407
- return message;
1408
- },
1409
- fromJSON(object) {
1410
- return {
1411
- bankName: isSet(object.bankName)
1412
- ? globalThis.String(object.bankName)
1413
- : isSet(object.bank_name)
1414
- ? globalThis.String(object.bank_name)
1415
- : "",
1416
- last4: isSet(object.last4) ? globalThis.String(object.last4) : "",
1417
- accountType: isSet(object.accountType)
1418
- ? globalThis.String(object.accountType)
1419
- : isSet(object.account_type)
1420
- ? globalThis.String(object.account_type)
1421
- : "",
1422
- country: isSet(object.country) ? globalThis.String(object.country) : "",
1423
- currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
1424
- };
1425
- },
1426
- toJSON(message) {
1427
- const obj = {};
1428
- if (message.bankName !== "") {
1429
- obj.bankName = message.bankName;
1430
- }
1431
- if (message.last4 !== "") {
1432
- obj.last4 = message.last4;
1433
- }
1434
- if (message.accountType !== "") {
1435
- obj.accountType = message.accountType;
1436
- }
1437
- if (message.country !== "") {
1438
- obj.country = message.country;
1439
- }
1440
- if (message.currency !== "") {
1441
- obj.currency = message.currency;
1442
- }
1443
- return obj;
1444
- },
1445
- create(base) {
1446
- return exports.BankDetails.fromPartial(base !== null && base !== void 0 ? base : {});
1447
- },
1448
- fromPartial(object) {
1449
- var _a, _b, _c, _d, _e;
1450
- const message = createBaseBankDetails();
1451
- message.bankName = (_a = object.bankName) !== null && _a !== void 0 ? _a : "";
1452
- message.last4 = (_b = object.last4) !== null && _b !== void 0 ? _b : "";
1453
- message.accountType = (_c = object.accountType) !== null && _c !== void 0 ? _c : "";
1454
- message.country = (_d = object.country) !== null && _d !== void 0 ? _d : "";
1455
- message.currency = (_e = object.currency) !== null && _e !== void 0 ? _e : "";
1456
- return message;
1457
- },
1458
- };
1459
- function createBaseBillingDetails() {
1460
- return { name: "", email: "", phone: "", address: undefined };
1461
- }
1462
- exports.BillingDetails = {
1463
- encode(message, writer = new wire_1.BinaryWriter()) {
1464
- if (message.name !== "") {
1465
- writer.uint32(10).string(message.name);
1466
- }
1467
- if (message.email !== "") {
1468
- writer.uint32(18).string(message.email);
1469
- }
1470
- if (message.phone !== "") {
1471
- writer.uint32(26).string(message.phone);
1472
- }
1473
- if (message.address !== undefined) {
1474
- exports.Address.encode(message.address, writer.uint32(34).fork()).join();
1475
- }
1476
- return writer;
1477
- },
1478
- decode(input, length) {
1479
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1480
- const end = length === undefined ? reader.len : reader.pos + length;
1481
- const message = createBaseBillingDetails();
1482
- while (reader.pos < end) {
1483
- const tag = reader.uint32();
1484
- switch (tag >>> 3) {
1485
- case 1: {
1486
- if (tag !== 10) {
1487
- break;
1488
- }
1489
- message.name = reader.string();
1490
- continue;
1491
- }
1492
- case 2: {
1493
- if (tag !== 18) {
1494
- break;
1495
- }
1496
- message.email = reader.string();
1497
- continue;
1498
- }
1499
- case 3: {
1500
- if (tag !== 26) {
1501
- break;
1502
- }
1503
- message.phone = reader.string();
1504
- continue;
1505
- }
1506
- case 4: {
1507
- if (tag !== 34) {
1508
- break;
1509
- }
1510
- message.address = exports.Address.decode(reader, reader.uint32());
1511
- continue;
1512
- }
1513
- }
1514
- if ((tag & 7) === 4 || tag === 0) {
1515
- break;
1516
- }
1517
- reader.skip(tag & 7);
1518
- }
1519
- return message;
1520
- },
1521
- fromJSON(object) {
1522
- return {
1523
- name: isSet(object.name) ? globalThis.String(object.name) : "",
1524
- email: isSet(object.email) ? globalThis.String(object.email) : "",
1525
- phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
1526
- address: isSet(object.address) ? exports.Address.fromJSON(object.address) : undefined,
1527
- };
1528
- },
1529
- toJSON(message) {
1530
- const obj = {};
1531
- if (message.name !== "") {
1532
- obj.name = message.name;
1533
- }
1534
- if (message.email !== "") {
1535
- obj.email = message.email;
1536
- }
1537
- if (message.phone !== "") {
1538
- obj.phone = message.phone;
1539
- }
1540
- if (message.address !== undefined) {
1541
- obj.address = exports.Address.toJSON(message.address);
1542
- }
1543
- return obj;
1544
- },
1545
- create(base) {
1546
- return exports.BillingDetails.fromPartial(base !== null && base !== void 0 ? base : {});
1547
- },
1548
- fromPartial(object) {
1549
- var _a, _b, _c;
1550
- const message = createBaseBillingDetails();
1551
- message.name = (_a = object.name) !== null && _a !== void 0 ? _a : "";
1552
- message.email = (_b = object.email) !== null && _b !== void 0 ? _b : "";
1553
- message.phone = (_c = object.phone) !== null && _c !== void 0 ? _c : "";
1554
- message.address = (object.address !== undefined && object.address !== null)
1555
- ? exports.Address.fromPartial(object.address)
1556
- : undefined;
1557
- return message;
1558
- },
1559
- };
1560
- function createBaseAddress() {
1561
- return { line1: "", line2: "", city: "", state: "", postalCode: "", country: "" };
1562
- }
1563
- exports.Address = {
1564
- encode(message, writer = new wire_1.BinaryWriter()) {
1565
- if (message.line1 !== "") {
1566
- writer.uint32(10).string(message.line1);
1567
- }
1568
- if (message.line2 !== "") {
1569
- writer.uint32(18).string(message.line2);
1570
- }
1571
- if (message.city !== "") {
1572
- writer.uint32(26).string(message.city);
1573
- }
1574
- if (message.state !== "") {
1575
- writer.uint32(34).string(message.state);
1576
- }
1577
- if (message.postalCode !== "") {
1578
- writer.uint32(42).string(message.postalCode);
1579
- }
1580
- if (message.country !== "") {
1581
- writer.uint32(50).string(message.country);
1582
- }
1583
- return writer;
1584
- },
1585
- decode(input, length) {
1586
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1587
- const end = length === undefined ? reader.len : reader.pos + length;
1588
- const message = createBaseAddress();
1589
- while (reader.pos < end) {
1590
- const tag = reader.uint32();
1591
- switch (tag >>> 3) {
1592
- case 1: {
1593
- if (tag !== 10) {
1594
- break;
1595
- }
1596
- message.line1 = reader.string();
1597
- continue;
1598
- }
1599
- case 2: {
1600
- if (tag !== 18) {
1601
- break;
1602
- }
1603
- message.line2 = reader.string();
1604
- continue;
1605
- }
1606
- case 3: {
1607
- if (tag !== 26) {
1608
- break;
1609
- }
1610
- message.city = reader.string();
1611
- continue;
1612
- }
1613
- case 4: {
1614
- if (tag !== 34) {
1615
- break;
1616
- }
1617
- message.state = reader.string();
1618
- continue;
1619
- }
1620
- case 5: {
1621
- if (tag !== 42) {
1622
- break;
1623
- }
1624
- message.postalCode = reader.string();
1625
- continue;
1626
- }
1627
- case 6: {
1628
- if (tag !== 50) {
1629
- break;
1630
- }
1631
- message.country = reader.string();
1632
- continue;
1633
- }
1634
- }
1635
- if ((tag & 7) === 4 || tag === 0) {
1636
- break;
1637
- }
1638
- reader.skip(tag & 7);
1639
- }
1640
- return message;
1641
- },
1642
- fromJSON(object) {
1643
- return {
1644
- line1: isSet(object.line1) ? globalThis.String(object.line1) : "",
1645
- line2: isSet(object.line2) ? globalThis.String(object.line2) : "",
1646
- city: isSet(object.city) ? globalThis.String(object.city) : "",
1647
- state: isSet(object.state) ? globalThis.String(object.state) : "",
1648
- postalCode: isSet(object.postalCode)
1649
- ? globalThis.String(object.postalCode)
1650
- : isSet(object.postal_code)
1651
- ? globalThis.String(object.postal_code)
1652
- : "",
1653
- country: isSet(object.country) ? globalThis.String(object.country) : "",
1654
- };
1655
- },
1656
- toJSON(message) {
1657
- const obj = {};
1658
- if (message.line1 !== "") {
1659
- obj.line1 = message.line1;
1660
- }
1661
- if (message.line2 !== "") {
1662
- obj.line2 = message.line2;
1663
- }
1664
- if (message.city !== "") {
1665
- obj.city = message.city;
1666
- }
1667
- if (message.state !== "") {
1668
- obj.state = message.state;
1669
- }
1670
- if (message.postalCode !== "") {
1671
- obj.postalCode = message.postalCode;
1672
- }
1673
- if (message.country !== "") {
1674
- obj.country = message.country;
1675
- }
1676
- return obj;
1677
- },
1678
- create(base) {
1679
- return exports.Address.fromPartial(base !== null && base !== void 0 ? base : {});
1680
- },
1681
- fromPartial(object) {
1682
- var _a, _b, _c, _d, _e, _f;
1683
- const message = createBaseAddress();
1684
- message.line1 = (_a = object.line1) !== null && _a !== void 0 ? _a : "";
1685
- message.line2 = (_b = object.line2) !== null && _b !== void 0 ? _b : "";
1686
- message.city = (_c = object.city) !== null && _c !== void 0 ? _c : "";
1687
- message.state = (_d = object.state) !== null && _d !== void 0 ? _d : "";
1688
- message.postalCode = (_e = object.postalCode) !== null && _e !== void 0 ? _e : "";
1689
- message.country = (_f = object.country) !== null && _f !== void 0 ? _f : "";
1690
- return message;
1691
- },
1692
- };
1693
- function createBaseDiscount() {
1694
- return {
1695
- id: "",
1696
- name: "",
1697
- type: "",
1698
- percentOff: 0,
1699
- amountOffCents: 0,
1700
- duration: "",
1701
- durationInMonths: 0,
1702
- validUntil: undefined,
1703
- appliedAt: undefined,
1704
- };
1705
- }
1706
- exports.Discount = {
1707
- encode(message, writer = new wire_1.BinaryWriter()) {
1708
- if (message.id !== "") {
1709
- writer.uint32(10).string(message.id);
1710
- }
1711
- if (message.name !== "") {
1712
- writer.uint32(18).string(message.name);
1713
- }
1714
- if (message.type !== "") {
1715
- writer.uint32(26).string(message.type);
1716
- }
1717
- if (message.percentOff !== 0) {
1718
- writer.uint32(33).double(message.percentOff);
1719
- }
1720
- if (message.amountOffCents !== 0) {
1721
- writer.uint32(40).int64(message.amountOffCents);
1722
- }
1723
- if (message.duration !== "") {
1724
- writer.uint32(50).string(message.duration);
1725
- }
1726
- if (message.durationInMonths !== 0) {
1727
- writer.uint32(56).int32(message.durationInMonths);
1728
- }
1729
- if (message.validUntil !== undefined) {
1730
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.validUntil), writer.uint32(66).fork()).join();
1731
- }
1732
- if (message.appliedAt !== undefined) {
1733
- timestamp_pb_1.Timestamp.encode(toTimestamp(message.appliedAt), writer.uint32(74).fork()).join();
1734
- }
1735
- return writer;
1736
- },
1737
- decode(input, length) {
1738
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1739
- const end = length === undefined ? reader.len : reader.pos + length;
1740
- const message = createBaseDiscount();
1741
- while (reader.pos < end) {
1742
- const tag = reader.uint32();
1743
- switch (tag >>> 3) {
1744
- case 1: {
1745
- if (tag !== 10) {
1746
- break;
1747
- }
1748
- message.id = reader.string();
1749
- continue;
1750
- }
1751
- case 2: {
1752
- if (tag !== 18) {
1753
- break;
1754
- }
1755
- message.name = reader.string();
1756
- continue;
1757
- }
1758
- case 3: {
1759
- if (tag !== 26) {
1760
- break;
1761
- }
1762
- message.type = reader.string();
1763
- continue;
1764
- }
1765
- case 4: {
1766
- if (tag !== 33) {
1767
- break;
1768
- }
1769
- message.percentOff = reader.double();
1770
- continue;
1771
- }
1772
- case 5: {
1773
- if (tag !== 40) {
1774
- break;
1775
- }
1776
- message.amountOffCents = longToNumber(reader.int64());
1777
- continue;
1778
- }
1779
- case 6: {
1780
- if (tag !== 50) {
1781
- break;
1782
- }
1783
- message.duration = reader.string();
1784
- continue;
1785
- }
1786
- case 7: {
1787
- if (tag !== 56) {
1788
- break;
1789
- }
1790
- message.durationInMonths = reader.int32();
1791
- continue;
1792
- }
1793
- case 8: {
1794
- if (tag !== 66) {
1795
- break;
1796
- }
1797
- message.validUntil = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1798
- continue;
1799
- }
1800
- case 9: {
1801
- if (tag !== 74) {
1802
- break;
1803
- }
1804
- message.appliedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1805
- continue;
1806
- }
1807
- }
1808
- if ((tag & 7) === 4 || tag === 0) {
1809
- break;
1810
- }
1811
- reader.skip(tag & 7);
1812
- }
1813
- return message;
1814
- },
1815
- fromJSON(object) {
1816
- return {
1817
- id: isSet(object.id) ? globalThis.String(object.id) : "",
1818
- name: isSet(object.name) ? globalThis.String(object.name) : "",
1819
- type: isSet(object.type) ? globalThis.String(object.type) : "",
1820
- percentOff: isSet(object.percentOff)
1821
- ? globalThis.Number(object.percentOff)
1822
- : isSet(object.percent_off)
1823
- ? globalThis.Number(object.percent_off)
1824
- : 0,
1825
- amountOffCents: isSet(object.amountOffCents)
1826
- ? globalThis.Number(object.amountOffCents)
1827
- : isSet(object.amount_off_cents)
1828
- ? globalThis.Number(object.amount_off_cents)
1829
- : 0,
1830
- duration: isSet(object.duration) ? globalThis.String(object.duration) : "",
1831
- durationInMonths: isSet(object.durationInMonths)
1832
- ? globalThis.Number(object.durationInMonths)
1833
- : isSet(object.duration_in_months)
1834
- ? globalThis.Number(object.duration_in_months)
1835
- : 0,
1836
- validUntil: isSet(object.validUntil)
1837
- ? fromJsonTimestamp(object.validUntil)
1838
- : isSet(object.valid_until)
1839
- ? fromJsonTimestamp(object.valid_until)
1840
- : undefined,
1841
- appliedAt: isSet(object.appliedAt)
1842
- ? fromJsonTimestamp(object.appliedAt)
1843
- : isSet(object.applied_at)
1844
- ? fromJsonTimestamp(object.applied_at)
1845
- : undefined,
1846
- };
1847
- },
1848
- toJSON(message) {
1849
- const obj = {};
1850
- if (message.id !== "") {
1851
- obj.id = message.id;
1852
- }
1853
- if (message.name !== "") {
1854
- obj.name = message.name;
1855
- }
1856
- if (message.type !== "") {
1857
- obj.type = message.type;
1858
- }
1859
- if (message.percentOff !== 0) {
1860
- obj.percentOff = message.percentOff;
1861
- }
1862
- if (message.amountOffCents !== 0) {
1863
- obj.amountOffCents = Math.round(message.amountOffCents);
1864
- }
1865
- if (message.duration !== "") {
1866
- obj.duration = message.duration;
1867
- }
1868
- if (message.durationInMonths !== 0) {
1869
- obj.durationInMonths = Math.round(message.durationInMonths);
1870
- }
1871
- if (message.validUntil !== undefined) {
1872
- obj.validUntil = message.validUntil.toISOString();
1873
- }
1874
- if (message.appliedAt !== undefined) {
1875
- obj.appliedAt = message.appliedAt.toISOString();
1876
- }
1877
- return obj;
1878
- },
1879
- create(base) {
1880
- return exports.Discount.fromPartial(base !== null && base !== void 0 ? base : {});
1881
- },
1882
- fromPartial(object) {
1883
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1884
- const message = createBaseDiscount();
1885
- message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
1886
- message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
1887
- message.type = (_c = object.type) !== null && _c !== void 0 ? _c : "";
1888
- message.percentOff = (_d = object.percentOff) !== null && _d !== void 0 ? _d : 0;
1889
- message.amountOffCents = (_e = object.amountOffCents) !== null && _e !== void 0 ? _e : 0;
1890
- message.duration = (_f = object.duration) !== null && _f !== void 0 ? _f : "";
1891
- message.durationInMonths = (_g = object.durationInMonths) !== null && _g !== void 0 ? _g : 0;
1892
- message.validUntil = (_h = object.validUntil) !== null && _h !== void 0 ? _h : undefined;
1893
- message.appliedAt = (_j = object.appliedAt) !== null && _j !== void 0 ? _j : undefined;
1894
- return message;
1895
- },
1896
- };
1897
- function toTimestamp(date) {
1898
- const seconds = Math.trunc(date.getTime() / 1000);
1899
- const nanos = (date.getTime() % 1000) * 1000000;
1900
- return { seconds, nanos };
1901
- }
1902
- function fromTimestamp(t) {
1903
- let millis = (t.seconds || 0) * 1000;
1904
- millis += (t.nanos || 0) / 1000000;
1905
- return new globalThis.Date(millis);
1906
- }
1907
- function fromJsonTimestamp(o) {
1908
- if (o instanceof globalThis.Date) {
1909
- return o;
1910
- }
1911
- else if (typeof o === "string") {
1912
- return new globalThis.Date(o);
1913
- }
1914
- else {
1915
- return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
1916
- }
1917
- }
1918
- function longToNumber(int64) {
1919
- const num = globalThis.Number(int64.toString());
1920
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1921
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1922
- }
1923
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1924
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1925
- }
1926
- return num;
1927
- }
1928
- function isSet(value) {
1929
- return value !== null && value !== undefined;
1930
- }