@tarkahq/sdk 0.0.0-stage → 0.3.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 (130) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +69 -0
  3. package/README.md +700 -2
  4. package/api-source.json +38 -0
  5. package/dist/cjs/client.d.ts +114 -0
  6. package/dist/cjs/client.js +174 -0
  7. package/dist/cjs/errors.d.ts +27 -0
  8. package/dist/cjs/errors.js +78 -0
  9. package/dist/cjs/generated/google/api/annotations.d.ts +1 -0
  10. package/dist/cjs/generated/google/api/annotations.js +10 -0
  11. package/dist/cjs/generated/google/api/http.d.ts +395 -0
  12. package/dist/cjs/generated/google/api/http.js +421 -0
  13. package/dist/cjs/generated/google/protobuf/descriptor.d.ts +873 -0
  14. package/dist/cjs/generated/google/protobuf/descriptor.js +3992 -0
  15. package/dist/cjs/generated/google/protobuf/empty.d.ts +35 -0
  16. package/dist/cjs/generated/google/protobuf/empty.js +58 -0
  17. package/dist/cjs/generated/google/protobuf/struct.d.ts +127 -0
  18. package/dist/cjs/generated/google/protobuf/struct.js +529 -0
  19. package/dist/cjs/generated/google/protobuf/timestamp.d.ts +128 -0
  20. package/dist/cjs/generated/google/protobuf/timestamp.js +95 -0
  21. package/dist/cjs/generated/protoc-gen-openapiv2/options/annotations.d.ts +1 -0
  22. package/dist/cjs/generated/protoc-gen-openapiv2/options/annotations.js +10 -0
  23. package/dist/cjs/generated/protoc-gen-openapiv2/options/openapiv2.d.ts +983 -0
  24. package/dist/cjs/generated/protoc-gen-openapiv2/options/openapiv2.js +4874 -0
  25. package/dist/cjs/generated/tarka/access/v1/access.d.ts +322 -0
  26. package/dist/cjs/generated/tarka/access/v1/access.js +2979 -0
  27. package/dist/cjs/generated/tarka/channels/v1/channels.d.ts +370 -0
  28. package/dist/cjs/generated/tarka/channels/v1/channels.js +3603 -0
  29. package/dist/cjs/generated/tarka/gateway/v1/gateway.d.ts +804 -0
  30. package/dist/cjs/generated/tarka/gateway/v1/gateway.js +8081 -0
  31. package/dist/cjs/generated/tarka/iam/v1/iam.d.ts +1291 -0
  32. package/dist/cjs/generated/tarka/iam/v1/iam.js +13207 -0
  33. package/dist/cjs/generated/tarka/inference/v1/inference.d.ts +699 -0
  34. package/dist/cjs/generated/tarka/inference/v1/inference.js +7058 -0
  35. package/dist/cjs/generated/tarka/provisioning/v1/agent_secrets.d.ts +70 -0
  36. package/dist/cjs/generated/tarka/provisioning/v1/agent_secrets.js +603 -0
  37. package/dist/cjs/generated/tarka/provisioning/v1/billing_quote.d.ts +171 -0
  38. package/dist/cjs/generated/tarka/provisioning/v1/billing_quote.js +1588 -0
  39. package/dist/cjs/generated/tarka/provisioning/v1/job.d.ts +168 -0
  40. package/dist/cjs/generated/tarka/provisioning/v1/job.js +1505 -0
  41. package/dist/cjs/generated/tarka/provisioning/v1/provisioning.d.ts +2644 -0
  42. package/dist/cjs/generated/tarka/provisioning/v1/provisioning.js +19501 -0
  43. package/dist/cjs/generated/tarka/provisioning/v1/registry_credentials.d.ts +89 -0
  44. package/dist/cjs/generated/tarka/provisioning/v1/registry_credentials.js +856 -0
  45. package/dist/cjs/generated/tarka/provisioning/v1/sandbox.d.ts +431 -0
  46. package/dist/cjs/generated/tarka/provisioning/v1/sandbox.js +3203 -0
  47. package/dist/cjs/generated/tarka/provisioning/v1/source_builds.d.ts +291 -0
  48. package/dist/cjs/generated/tarka/provisioning/v1/source_builds.js +3920 -0
  49. package/dist/cjs/grpc.d.ts +12 -0
  50. package/dist/cjs/grpc.js +55 -0
  51. package/dist/cjs/index.d.ts +6 -0
  52. package/dist/cjs/index.js +21 -0
  53. package/dist/cjs/package.json +1 -0
  54. package/dist/cjs/resources/inference.d.ts +293 -0
  55. package/dist/cjs/resources/inference.js +451 -0
  56. package/dist/cjs/resources/provisioning.d.ts +389 -0
  57. package/dist/cjs/resources/provisioning.js +552 -0
  58. package/dist/cjs/resources/sandboxes.d.ts +360 -0
  59. package/dist/cjs/resources/sandboxes.js +732 -0
  60. package/dist/cjs/rpc-types.d.ts +36 -0
  61. package/dist/cjs/rpc-types.js +29 -0
  62. package/dist/cjs/runtime.d.ts +99 -0
  63. package/dist/cjs/runtime.js +473 -0
  64. package/dist/cjs/transport.d.ts +60 -0
  65. package/dist/cjs/transport.js +114 -0
  66. package/dist/cjs/types.d.ts +309 -0
  67. package/dist/cjs/types.js +2 -0
  68. package/dist/esm/client.d.ts +114 -0
  69. package/dist/esm/client.js +169 -0
  70. package/dist/esm/errors.d.ts +27 -0
  71. package/dist/esm/errors.js +71 -0
  72. package/dist/esm/generated/google/api/annotations.d.ts +1 -0
  73. package/dist/esm/generated/google/api/annotations.js +7 -0
  74. package/dist/esm/generated/google/api/http.d.ts +395 -0
  75. package/dist/esm/generated/google/api/http.js +418 -0
  76. package/dist/esm/generated/google/protobuf/descriptor.d.ts +873 -0
  77. package/dist/esm/generated/google/protobuf/descriptor.js +3977 -0
  78. package/dist/esm/generated/google/protobuf/empty.d.ts +35 -0
  79. package/dist/esm/generated/google/protobuf/empty.js +55 -0
  80. package/dist/esm/generated/google/protobuf/struct.d.ts +127 -0
  81. package/dist/esm/generated/google/protobuf/struct.js +524 -0
  82. package/dist/esm/generated/google/protobuf/timestamp.d.ts +128 -0
  83. package/dist/esm/generated/google/protobuf/timestamp.js +92 -0
  84. package/dist/esm/generated/protoc-gen-openapiv2/options/annotations.d.ts +1 -0
  85. package/dist/esm/generated/protoc-gen-openapiv2/options/annotations.js +7 -0
  86. package/dist/esm/generated/protoc-gen-openapiv2/options/openapiv2.d.ts +983 -0
  87. package/dist/esm/generated/protoc-gen-openapiv2/options/openapiv2.js +4859 -0
  88. package/dist/esm/generated/tarka/access/v1/access.d.ts +322 -0
  89. package/dist/esm/generated/tarka/access/v1/access.js +2976 -0
  90. package/dist/esm/generated/tarka/channels/v1/channels.d.ts +370 -0
  91. package/dist/esm/generated/tarka/channels/v1/channels.js +3600 -0
  92. package/dist/esm/generated/tarka/gateway/v1/gateway.d.ts +804 -0
  93. package/dist/esm/generated/tarka/gateway/v1/gateway.js +8077 -0
  94. package/dist/esm/generated/tarka/iam/v1/iam.d.ts +1291 -0
  95. package/dist/esm/generated/tarka/iam/v1/iam.js +13203 -0
  96. package/dist/esm/generated/tarka/inference/v1/inference.d.ts +699 -0
  97. package/dist/esm/generated/tarka/inference/v1/inference.js +7055 -0
  98. package/dist/esm/generated/tarka/provisioning/v1/agent_secrets.d.ts +70 -0
  99. package/dist/esm/generated/tarka/provisioning/v1/agent_secrets.js +600 -0
  100. package/dist/esm/generated/tarka/provisioning/v1/billing_quote.d.ts +171 -0
  101. package/dist/esm/generated/tarka/provisioning/v1/billing_quote.js +1585 -0
  102. package/dist/esm/generated/tarka/provisioning/v1/job.d.ts +168 -0
  103. package/dist/esm/generated/tarka/provisioning/v1/job.js +1500 -0
  104. package/dist/esm/generated/tarka/provisioning/v1/provisioning.d.ts +2644 -0
  105. package/dist/esm/generated/tarka/provisioning/v1/provisioning.js +19496 -0
  106. package/dist/esm/generated/tarka/provisioning/v1/registry_credentials.d.ts +89 -0
  107. package/dist/esm/generated/tarka/provisioning/v1/registry_credentials.js +853 -0
  108. package/dist/esm/generated/tarka/provisioning/v1/sandbox.d.ts +431 -0
  109. package/dist/esm/generated/tarka/provisioning/v1/sandbox.js +3192 -0
  110. package/dist/esm/generated/tarka/provisioning/v1/source_builds.d.ts +291 -0
  111. package/dist/esm/generated/tarka/provisioning/v1/source_builds.js +3917 -0
  112. package/dist/esm/grpc.d.ts +12 -0
  113. package/dist/esm/grpc.js +11 -0
  114. package/dist/esm/index.d.ts +6 -0
  115. package/dist/esm/index.js +4 -0
  116. package/dist/esm/resources/inference.d.ts +293 -0
  117. package/dist/esm/resources/inference.js +437 -0
  118. package/dist/esm/resources/provisioning.d.ts +389 -0
  119. package/dist/esm/resources/provisioning.js +531 -0
  120. package/dist/esm/resources/sandboxes.d.ts +360 -0
  121. package/dist/esm/resources/sandboxes.js +718 -0
  122. package/dist/esm/rpc-types.d.ts +36 -0
  123. package/dist/esm/rpc-types.js +26 -0
  124. package/dist/esm/runtime.d.ts +99 -0
  125. package/dist/esm/runtime.js +466 -0
  126. package/dist/esm/transport.d.ts +60 -0
  127. package/dist/esm/transport.js +110 -0
  128. package/dist/esm/types.d.ts +309 -0
  129. package/dist/esm/types.js +1 -0
  130. package/package.json +155 -4
@@ -0,0 +1,1588 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.12.4
5
+ // protoc v3.19.1
6
+ // source: tarka/provisioning/v1/billing_quote.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AcceptUsagePolicyRequest = exports.UsagePolicy = exports.UsageAllowance = exports.GetUsagePolicyRequest = exports.AdmissionAssessment = exports.ComputeQuote = exports.CreateComputeQuoteRequest = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const timestamp_js_1 = require("../../../google/protobuf/timestamp.js");
12
+ const job_js_1 = require("./job.js");
13
+ exports.protobufPackage = "tarka.provisioning.v1";
14
+ function createBaseCreateComputeQuoteRequest() {
15
+ return {
16
+ orgId: "",
17
+ product: "",
18
+ location: "",
19
+ resources: undefined,
20
+ maxRuntimeSeconds: 0,
21
+ maxNetworkBytes: undefined,
22
+ persistentStorageBytes: 0n,
23
+ };
24
+ }
25
+ exports.CreateComputeQuoteRequest = {
26
+ encode(message, writer = new wire_1.BinaryWriter()) {
27
+ if (message.orgId !== "") {
28
+ writer.uint32(10).string(message.orgId);
29
+ }
30
+ if (message.product !== "") {
31
+ writer.uint32(18).string(message.product);
32
+ }
33
+ if (message.location !== "") {
34
+ writer.uint32(26).string(message.location);
35
+ }
36
+ if (message.resources !== undefined) {
37
+ job_js_1.JobResources.encode(message.resources, writer.uint32(34).fork()).join();
38
+ }
39
+ if (message.maxRuntimeSeconds !== 0) {
40
+ writer.uint32(40).uint32(message.maxRuntimeSeconds);
41
+ }
42
+ if (message.maxNetworkBytes !== undefined) {
43
+ if (BigInt.asUintN(64, message.maxNetworkBytes) !== message.maxNetworkBytes) {
44
+ throw new globalThis.Error("value provided for field message.maxNetworkBytes of type uint64 too large");
45
+ }
46
+ writer.uint32(48).uint64(message.maxNetworkBytes);
47
+ }
48
+ if (message.persistentStorageBytes !== 0n) {
49
+ if (BigInt.asUintN(64, message.persistentStorageBytes) !== message.persistentStorageBytes) {
50
+ throw new globalThis.Error("value provided for field message.persistentStorageBytes of type uint64 too large");
51
+ }
52
+ writer.uint32(56).uint64(message.persistentStorageBytes);
53
+ }
54
+ return writer;
55
+ },
56
+ decode(input, length) {
57
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
58
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
59
+ if (previousRecursionDepth >= 100) {
60
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
61
+ }
62
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
63
+ try {
64
+ const end = length === undefined ? reader.len : reader.pos + length;
65
+ const message = createBaseCreateComputeQuoteRequest();
66
+ while (reader.pos < end) {
67
+ const tag = reader.uint32();
68
+ switch (tag >>> 3) {
69
+ case 1: {
70
+ if (tag !== 10) {
71
+ break;
72
+ }
73
+ message.orgId = reader.string();
74
+ continue;
75
+ }
76
+ case 2: {
77
+ if (tag !== 18) {
78
+ break;
79
+ }
80
+ message.product = reader.string();
81
+ continue;
82
+ }
83
+ case 3: {
84
+ if (tag !== 26) {
85
+ break;
86
+ }
87
+ message.location = reader.string();
88
+ continue;
89
+ }
90
+ case 4: {
91
+ if (tag !== 34) {
92
+ break;
93
+ }
94
+ message.resources = job_js_1.JobResources.decode(reader, reader.uint32());
95
+ continue;
96
+ }
97
+ case 5: {
98
+ if (tag !== 40) {
99
+ break;
100
+ }
101
+ message.maxRuntimeSeconds = reader.uint32();
102
+ continue;
103
+ }
104
+ case 6: {
105
+ if (tag !== 48) {
106
+ break;
107
+ }
108
+ message.maxNetworkBytes = reader.uint64();
109
+ continue;
110
+ }
111
+ case 7: {
112
+ if (tag !== 56) {
113
+ break;
114
+ }
115
+ message.persistentStorageBytes = reader.uint64();
116
+ continue;
117
+ }
118
+ }
119
+ if ((tag & 7) === 4 || tag === 0) {
120
+ break;
121
+ }
122
+ reader.skip(tag & 7);
123
+ }
124
+ return message;
125
+ }
126
+ finally {
127
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
128
+ }
129
+ },
130
+ fromJSON(object) {
131
+ return {
132
+ orgId: isSet(object.orgId)
133
+ ? globalThis.String(object.orgId)
134
+ : isSet(object.org_id)
135
+ ? globalThis.String(object.org_id)
136
+ : "",
137
+ product: isSet(object.product) ? globalThis.String(object.product) : "",
138
+ location: isSet(object.location) ? globalThis.String(object.location) : "",
139
+ resources: isSet(object.resources) ? job_js_1.JobResources.fromJSON(object.resources) : undefined,
140
+ maxRuntimeSeconds: isSet(object.maxRuntimeSeconds)
141
+ ? globalThis.Number(object.maxRuntimeSeconds)
142
+ : isSet(object.max_runtime_seconds)
143
+ ? globalThis.Number(object.max_runtime_seconds)
144
+ : 0,
145
+ maxNetworkBytes: isSet(object.maxNetworkBytes)
146
+ ? BigInt(object.maxNetworkBytes)
147
+ : isSet(object.max_network_bytes)
148
+ ? BigInt(object.max_network_bytes)
149
+ : undefined,
150
+ persistentStorageBytes: isSet(object.persistentStorageBytes)
151
+ ? BigInt(object.persistentStorageBytes)
152
+ : isSet(object.persistent_storage_bytes)
153
+ ? BigInt(object.persistent_storage_bytes)
154
+ : 0n,
155
+ };
156
+ },
157
+ toJSON(message) {
158
+ const obj = {};
159
+ if (message.orgId !== "") {
160
+ obj.orgId = message.orgId;
161
+ }
162
+ if (message.product !== "") {
163
+ obj.product = message.product;
164
+ }
165
+ if (message.location !== "") {
166
+ obj.location = message.location;
167
+ }
168
+ if (message.resources !== undefined) {
169
+ obj.resources = job_js_1.JobResources.toJSON(message.resources);
170
+ }
171
+ if (message.maxRuntimeSeconds !== 0) {
172
+ obj.maxRuntimeSeconds = Math.round(message.maxRuntimeSeconds);
173
+ }
174
+ if (message.maxNetworkBytes !== undefined) {
175
+ obj.maxNetworkBytes = message.maxNetworkBytes.toString();
176
+ }
177
+ if (message.persistentStorageBytes !== 0n) {
178
+ obj.persistentStorageBytes = message.persistentStorageBytes.toString();
179
+ }
180
+ return obj;
181
+ },
182
+ create(base) {
183
+ return exports.CreateComputeQuoteRequest.fromPartial(base ?? {});
184
+ },
185
+ fromPartial(object) {
186
+ const message = createBaseCreateComputeQuoteRequest();
187
+ message.orgId = object.orgId ?? "";
188
+ message.product = object.product ?? "";
189
+ message.location = object.location ?? "";
190
+ message.resources = (object.resources !== undefined && object.resources !== null)
191
+ ? job_js_1.JobResources.fromPartial(object.resources)
192
+ : undefined;
193
+ message.maxRuntimeSeconds = object.maxRuntimeSeconds ?? 0;
194
+ message.maxNetworkBytes = (object.maxNetworkBytes !== undefined && object.maxNetworkBytes !== null)
195
+ ? BigInt(object.maxNetworkBytes)
196
+ : undefined;
197
+ message.persistentStorageBytes =
198
+ (object.persistentStorageBytes !== undefined && object.persistentStorageBytes !== null)
199
+ ? BigInt(object.persistentStorageBytes)
200
+ : 0n;
201
+ return message;
202
+ },
203
+ };
204
+ function createBaseComputeQuote() {
205
+ return {
206
+ id: "",
207
+ orgId: "",
208
+ product: "",
209
+ location: "",
210
+ resources: undefined,
211
+ maxRuntimeSeconds: 0,
212
+ maxNetworkBytes: 0n,
213
+ currency: "",
214
+ hourlyMicrocents: 0n,
215
+ minimumRuntimeSeconds: 0,
216
+ minimumChargeMicrocents: 0n,
217
+ maximumReservationMicrocents: 0n,
218
+ networkGibMicrocents: 0n,
219
+ pricingVersion: "",
220
+ fxNumerator: 0n,
221
+ fxDenominator: 0n,
222
+ expiresAt: undefined,
223
+ available: false,
224
+ allocatedMemoryBytes: 0n,
225
+ persistentStorageBytes: 0n,
226
+ persistentStorageGibMonthMicrocents: 0n,
227
+ persistentStoragePeriodSeconds: 0,
228
+ startupReservationMicrocents: 0n,
229
+ networkAllowancePeriodSeconds: 0,
230
+ admission: undefined,
231
+ };
232
+ }
233
+ exports.ComputeQuote = {
234
+ encode(message, writer = new wire_1.BinaryWriter()) {
235
+ if (message.id !== "") {
236
+ writer.uint32(10).string(message.id);
237
+ }
238
+ if (message.orgId !== "") {
239
+ writer.uint32(18).string(message.orgId);
240
+ }
241
+ if (message.product !== "") {
242
+ writer.uint32(26).string(message.product);
243
+ }
244
+ if (message.location !== "") {
245
+ writer.uint32(34).string(message.location);
246
+ }
247
+ if (message.resources !== undefined) {
248
+ job_js_1.JobResources.encode(message.resources, writer.uint32(42).fork()).join();
249
+ }
250
+ if (message.maxRuntimeSeconds !== 0) {
251
+ writer.uint32(48).uint32(message.maxRuntimeSeconds);
252
+ }
253
+ if (message.maxNetworkBytes !== 0n) {
254
+ if (BigInt.asUintN(64, message.maxNetworkBytes) !== message.maxNetworkBytes) {
255
+ throw new globalThis.Error("value provided for field message.maxNetworkBytes of type uint64 too large");
256
+ }
257
+ writer.uint32(56).uint64(message.maxNetworkBytes);
258
+ }
259
+ if (message.currency !== "") {
260
+ writer.uint32(66).string(message.currency);
261
+ }
262
+ if (message.hourlyMicrocents !== 0n) {
263
+ if (BigInt.asIntN(64, message.hourlyMicrocents) !== message.hourlyMicrocents) {
264
+ throw new globalThis.Error("value provided for field message.hourlyMicrocents of type int64 too large");
265
+ }
266
+ writer.uint32(72).int64(message.hourlyMicrocents);
267
+ }
268
+ if (message.minimumRuntimeSeconds !== 0) {
269
+ writer.uint32(80).uint32(message.minimumRuntimeSeconds);
270
+ }
271
+ if (message.minimumChargeMicrocents !== 0n) {
272
+ if (BigInt.asIntN(64, message.minimumChargeMicrocents) !== message.minimumChargeMicrocents) {
273
+ throw new globalThis.Error("value provided for field message.minimumChargeMicrocents of type int64 too large");
274
+ }
275
+ writer.uint32(88).int64(message.minimumChargeMicrocents);
276
+ }
277
+ if (message.maximumReservationMicrocents !== 0n) {
278
+ if (BigInt.asIntN(64, message.maximumReservationMicrocents) !== message.maximumReservationMicrocents) {
279
+ throw new globalThis.Error("value provided for field message.maximumReservationMicrocents of type int64 too large");
280
+ }
281
+ writer.uint32(96).int64(message.maximumReservationMicrocents);
282
+ }
283
+ if (message.networkGibMicrocents !== 0n) {
284
+ if (BigInt.asIntN(64, message.networkGibMicrocents) !== message.networkGibMicrocents) {
285
+ throw new globalThis.Error("value provided for field message.networkGibMicrocents of type int64 too large");
286
+ }
287
+ writer.uint32(104).int64(message.networkGibMicrocents);
288
+ }
289
+ if (message.pricingVersion !== "") {
290
+ writer.uint32(114).string(message.pricingVersion);
291
+ }
292
+ if (message.fxNumerator !== 0n) {
293
+ if (BigInt.asIntN(64, message.fxNumerator) !== message.fxNumerator) {
294
+ throw new globalThis.Error("value provided for field message.fxNumerator of type int64 too large");
295
+ }
296
+ writer.uint32(120).int64(message.fxNumerator);
297
+ }
298
+ if (message.fxDenominator !== 0n) {
299
+ if (BigInt.asIntN(64, message.fxDenominator) !== message.fxDenominator) {
300
+ throw new globalThis.Error("value provided for field message.fxDenominator of type int64 too large");
301
+ }
302
+ writer.uint32(128).int64(message.fxDenominator);
303
+ }
304
+ if (message.expiresAt !== undefined) {
305
+ timestamp_js_1.Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(138).fork()).join();
306
+ }
307
+ if (message.available !== false) {
308
+ writer.uint32(144).bool(message.available);
309
+ }
310
+ if (message.allocatedMemoryBytes !== 0n) {
311
+ if (BigInt.asUintN(64, message.allocatedMemoryBytes) !== message.allocatedMemoryBytes) {
312
+ throw new globalThis.Error("value provided for field message.allocatedMemoryBytes of type uint64 too large");
313
+ }
314
+ writer.uint32(152).uint64(message.allocatedMemoryBytes);
315
+ }
316
+ if (message.persistentStorageBytes !== 0n) {
317
+ if (BigInt.asUintN(64, message.persistentStorageBytes) !== message.persistentStorageBytes) {
318
+ throw new globalThis.Error("value provided for field message.persistentStorageBytes of type uint64 too large");
319
+ }
320
+ writer.uint32(160).uint64(message.persistentStorageBytes);
321
+ }
322
+ if (message.persistentStorageGibMonthMicrocents !== 0n) {
323
+ if (BigInt.asIntN(64, message.persistentStorageGibMonthMicrocents) !== message.persistentStorageGibMonthMicrocents) {
324
+ throw new globalThis.Error("value provided for field message.persistentStorageGibMonthMicrocents of type int64 too large");
325
+ }
326
+ writer.uint32(168).int64(message.persistentStorageGibMonthMicrocents);
327
+ }
328
+ if (message.persistentStoragePeriodSeconds !== 0) {
329
+ writer.uint32(176).uint32(message.persistentStoragePeriodSeconds);
330
+ }
331
+ if (message.startupReservationMicrocents !== 0n) {
332
+ if (BigInt.asIntN(64, message.startupReservationMicrocents) !== message.startupReservationMicrocents) {
333
+ throw new globalThis.Error("value provided for field message.startupReservationMicrocents of type int64 too large");
334
+ }
335
+ writer.uint32(184).int64(message.startupReservationMicrocents);
336
+ }
337
+ if (message.networkAllowancePeriodSeconds !== 0) {
338
+ writer.uint32(192).uint32(message.networkAllowancePeriodSeconds);
339
+ }
340
+ if (message.admission !== undefined) {
341
+ exports.AdmissionAssessment.encode(message.admission, writer.uint32(202).fork()).join();
342
+ }
343
+ return writer;
344
+ },
345
+ decode(input, length) {
346
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
347
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
348
+ if (previousRecursionDepth >= 100) {
349
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
350
+ }
351
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
352
+ try {
353
+ const end = length === undefined ? reader.len : reader.pos + length;
354
+ const message = createBaseComputeQuote();
355
+ while (reader.pos < end) {
356
+ const tag = reader.uint32();
357
+ switch (tag >>> 3) {
358
+ case 1: {
359
+ if (tag !== 10) {
360
+ break;
361
+ }
362
+ message.id = reader.string();
363
+ continue;
364
+ }
365
+ case 2: {
366
+ if (tag !== 18) {
367
+ break;
368
+ }
369
+ message.orgId = reader.string();
370
+ continue;
371
+ }
372
+ case 3: {
373
+ if (tag !== 26) {
374
+ break;
375
+ }
376
+ message.product = reader.string();
377
+ continue;
378
+ }
379
+ case 4: {
380
+ if (tag !== 34) {
381
+ break;
382
+ }
383
+ message.location = reader.string();
384
+ continue;
385
+ }
386
+ case 5: {
387
+ if (tag !== 42) {
388
+ break;
389
+ }
390
+ message.resources = job_js_1.JobResources.decode(reader, reader.uint32());
391
+ continue;
392
+ }
393
+ case 6: {
394
+ if (tag !== 48) {
395
+ break;
396
+ }
397
+ message.maxRuntimeSeconds = reader.uint32();
398
+ continue;
399
+ }
400
+ case 7: {
401
+ if (tag !== 56) {
402
+ break;
403
+ }
404
+ message.maxNetworkBytes = reader.uint64();
405
+ continue;
406
+ }
407
+ case 8: {
408
+ if (tag !== 66) {
409
+ break;
410
+ }
411
+ message.currency = reader.string();
412
+ continue;
413
+ }
414
+ case 9: {
415
+ if (tag !== 72) {
416
+ break;
417
+ }
418
+ message.hourlyMicrocents = reader.int64();
419
+ continue;
420
+ }
421
+ case 10: {
422
+ if (tag !== 80) {
423
+ break;
424
+ }
425
+ message.minimumRuntimeSeconds = reader.uint32();
426
+ continue;
427
+ }
428
+ case 11: {
429
+ if (tag !== 88) {
430
+ break;
431
+ }
432
+ message.minimumChargeMicrocents = reader.int64();
433
+ continue;
434
+ }
435
+ case 12: {
436
+ if (tag !== 96) {
437
+ break;
438
+ }
439
+ message.maximumReservationMicrocents = reader.int64();
440
+ continue;
441
+ }
442
+ case 13: {
443
+ if (tag !== 104) {
444
+ break;
445
+ }
446
+ message.networkGibMicrocents = reader.int64();
447
+ continue;
448
+ }
449
+ case 14: {
450
+ if (tag !== 114) {
451
+ break;
452
+ }
453
+ message.pricingVersion = reader.string();
454
+ continue;
455
+ }
456
+ case 15: {
457
+ if (tag !== 120) {
458
+ break;
459
+ }
460
+ message.fxNumerator = reader.int64();
461
+ continue;
462
+ }
463
+ case 16: {
464
+ if (tag !== 128) {
465
+ break;
466
+ }
467
+ message.fxDenominator = reader.int64();
468
+ continue;
469
+ }
470
+ case 17: {
471
+ if (tag !== 138) {
472
+ break;
473
+ }
474
+ message.expiresAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
475
+ continue;
476
+ }
477
+ case 18: {
478
+ if (tag !== 144) {
479
+ break;
480
+ }
481
+ message.available = reader.bool();
482
+ continue;
483
+ }
484
+ case 19: {
485
+ if (tag !== 152) {
486
+ break;
487
+ }
488
+ message.allocatedMemoryBytes = reader.uint64();
489
+ continue;
490
+ }
491
+ case 20: {
492
+ if (tag !== 160) {
493
+ break;
494
+ }
495
+ message.persistentStorageBytes = reader.uint64();
496
+ continue;
497
+ }
498
+ case 21: {
499
+ if (tag !== 168) {
500
+ break;
501
+ }
502
+ message.persistentStorageGibMonthMicrocents = reader.int64();
503
+ continue;
504
+ }
505
+ case 22: {
506
+ if (tag !== 176) {
507
+ break;
508
+ }
509
+ message.persistentStoragePeriodSeconds = reader.uint32();
510
+ continue;
511
+ }
512
+ case 23: {
513
+ if (tag !== 184) {
514
+ break;
515
+ }
516
+ message.startupReservationMicrocents = reader.int64();
517
+ continue;
518
+ }
519
+ case 24: {
520
+ if (tag !== 192) {
521
+ break;
522
+ }
523
+ message.networkAllowancePeriodSeconds = reader.uint32();
524
+ continue;
525
+ }
526
+ case 25: {
527
+ if (tag !== 202) {
528
+ break;
529
+ }
530
+ message.admission = exports.AdmissionAssessment.decode(reader, reader.uint32());
531
+ continue;
532
+ }
533
+ }
534
+ if ((tag & 7) === 4 || tag === 0) {
535
+ break;
536
+ }
537
+ reader.skip(tag & 7);
538
+ }
539
+ return message;
540
+ }
541
+ finally {
542
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
543
+ }
544
+ },
545
+ fromJSON(object) {
546
+ return {
547
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
548
+ orgId: isSet(object.orgId)
549
+ ? globalThis.String(object.orgId)
550
+ : isSet(object.org_id)
551
+ ? globalThis.String(object.org_id)
552
+ : "",
553
+ product: isSet(object.product) ? globalThis.String(object.product) : "",
554
+ location: isSet(object.location) ? globalThis.String(object.location) : "",
555
+ resources: isSet(object.resources) ? job_js_1.JobResources.fromJSON(object.resources) : undefined,
556
+ maxRuntimeSeconds: isSet(object.maxRuntimeSeconds)
557
+ ? globalThis.Number(object.maxRuntimeSeconds)
558
+ : isSet(object.max_runtime_seconds)
559
+ ? globalThis.Number(object.max_runtime_seconds)
560
+ : 0,
561
+ maxNetworkBytes: isSet(object.maxNetworkBytes)
562
+ ? BigInt(object.maxNetworkBytes)
563
+ : isSet(object.max_network_bytes)
564
+ ? BigInt(object.max_network_bytes)
565
+ : 0n,
566
+ currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
567
+ hourlyMicrocents: isSet(object.hourlyMicrocents)
568
+ ? BigInt(object.hourlyMicrocents)
569
+ : isSet(object.hourly_microcents)
570
+ ? BigInt(object.hourly_microcents)
571
+ : 0n,
572
+ minimumRuntimeSeconds: isSet(object.minimumRuntimeSeconds)
573
+ ? globalThis.Number(object.minimumRuntimeSeconds)
574
+ : isSet(object.minimum_runtime_seconds)
575
+ ? globalThis.Number(object.minimum_runtime_seconds)
576
+ : 0,
577
+ minimumChargeMicrocents: isSet(object.minimumChargeMicrocents)
578
+ ? BigInt(object.minimumChargeMicrocents)
579
+ : isSet(object.minimum_charge_microcents)
580
+ ? BigInt(object.minimum_charge_microcents)
581
+ : 0n,
582
+ maximumReservationMicrocents: isSet(object.maximumReservationMicrocents)
583
+ ? BigInt(object.maximumReservationMicrocents)
584
+ : isSet(object.maximum_reservation_microcents)
585
+ ? BigInt(object.maximum_reservation_microcents)
586
+ : 0n,
587
+ networkGibMicrocents: isSet(object.networkGibMicrocents)
588
+ ? BigInt(object.networkGibMicrocents)
589
+ : isSet(object.network_gib_microcents)
590
+ ? BigInt(object.network_gib_microcents)
591
+ : 0n,
592
+ pricingVersion: isSet(object.pricingVersion)
593
+ ? globalThis.String(object.pricingVersion)
594
+ : isSet(object.pricing_version)
595
+ ? globalThis.String(object.pricing_version)
596
+ : "",
597
+ fxNumerator: isSet(object.fxNumerator)
598
+ ? BigInt(object.fxNumerator)
599
+ : isSet(object.fx_numerator)
600
+ ? BigInt(object.fx_numerator)
601
+ : 0n,
602
+ fxDenominator: isSet(object.fxDenominator)
603
+ ? BigInt(object.fxDenominator)
604
+ : isSet(object.fx_denominator)
605
+ ? BigInt(object.fx_denominator)
606
+ : 0n,
607
+ expiresAt: isSet(object.expiresAt)
608
+ ? fromJsonTimestamp(object.expiresAt)
609
+ : isSet(object.expires_at)
610
+ ? fromJsonTimestamp(object.expires_at)
611
+ : undefined,
612
+ available: isSet(object.available) ? globalThis.Boolean(object.available) : false,
613
+ allocatedMemoryBytes: isSet(object.allocatedMemoryBytes)
614
+ ? BigInt(object.allocatedMemoryBytes)
615
+ : isSet(object.allocated_memory_bytes)
616
+ ? BigInt(object.allocated_memory_bytes)
617
+ : 0n,
618
+ persistentStorageBytes: isSet(object.persistentStorageBytes)
619
+ ? BigInt(object.persistentStorageBytes)
620
+ : isSet(object.persistent_storage_bytes)
621
+ ? BigInt(object.persistent_storage_bytes)
622
+ : 0n,
623
+ persistentStorageGibMonthMicrocents: isSet(object.persistentStorageGibMonthMicrocents)
624
+ ? BigInt(object.persistentStorageGibMonthMicrocents)
625
+ : isSet(object.persistent_storage_gib_month_microcents)
626
+ ? BigInt(object.persistent_storage_gib_month_microcents)
627
+ : 0n,
628
+ persistentStoragePeriodSeconds: isSet(object.persistentStoragePeriodSeconds)
629
+ ? globalThis.Number(object.persistentStoragePeriodSeconds)
630
+ : isSet(object.persistent_storage_period_seconds)
631
+ ? globalThis.Number(object.persistent_storage_period_seconds)
632
+ : 0,
633
+ startupReservationMicrocents: isSet(object.startupReservationMicrocents)
634
+ ? BigInt(object.startupReservationMicrocents)
635
+ : isSet(object.startup_reservation_microcents)
636
+ ? BigInt(object.startup_reservation_microcents)
637
+ : 0n,
638
+ networkAllowancePeriodSeconds: isSet(object.networkAllowancePeriodSeconds)
639
+ ? globalThis.Number(object.networkAllowancePeriodSeconds)
640
+ : isSet(object.network_allowance_period_seconds)
641
+ ? globalThis.Number(object.network_allowance_period_seconds)
642
+ : 0,
643
+ admission: isSet(object.admission) ? exports.AdmissionAssessment.fromJSON(object.admission) : undefined,
644
+ };
645
+ },
646
+ toJSON(message) {
647
+ const obj = {};
648
+ if (message.id !== "") {
649
+ obj.id = message.id;
650
+ }
651
+ if (message.orgId !== "") {
652
+ obj.orgId = message.orgId;
653
+ }
654
+ if (message.product !== "") {
655
+ obj.product = message.product;
656
+ }
657
+ if (message.location !== "") {
658
+ obj.location = message.location;
659
+ }
660
+ if (message.resources !== undefined) {
661
+ obj.resources = job_js_1.JobResources.toJSON(message.resources);
662
+ }
663
+ if (message.maxRuntimeSeconds !== 0) {
664
+ obj.maxRuntimeSeconds = Math.round(message.maxRuntimeSeconds);
665
+ }
666
+ if (message.maxNetworkBytes !== 0n) {
667
+ obj.maxNetworkBytes = message.maxNetworkBytes.toString();
668
+ }
669
+ if (message.currency !== "") {
670
+ obj.currency = message.currency;
671
+ }
672
+ if (message.hourlyMicrocents !== 0n) {
673
+ obj.hourlyMicrocents = message.hourlyMicrocents.toString();
674
+ }
675
+ if (message.minimumRuntimeSeconds !== 0) {
676
+ obj.minimumRuntimeSeconds = Math.round(message.minimumRuntimeSeconds);
677
+ }
678
+ if (message.minimumChargeMicrocents !== 0n) {
679
+ obj.minimumChargeMicrocents = message.minimumChargeMicrocents.toString();
680
+ }
681
+ if (message.maximumReservationMicrocents !== 0n) {
682
+ obj.maximumReservationMicrocents = message.maximumReservationMicrocents.toString();
683
+ }
684
+ if (message.networkGibMicrocents !== 0n) {
685
+ obj.networkGibMicrocents = message.networkGibMicrocents.toString();
686
+ }
687
+ if (message.pricingVersion !== "") {
688
+ obj.pricingVersion = message.pricingVersion;
689
+ }
690
+ if (message.fxNumerator !== 0n) {
691
+ obj.fxNumerator = message.fxNumerator.toString();
692
+ }
693
+ if (message.fxDenominator !== 0n) {
694
+ obj.fxDenominator = message.fxDenominator.toString();
695
+ }
696
+ if (message.expiresAt !== undefined) {
697
+ obj.expiresAt = message.expiresAt.toISOString();
698
+ }
699
+ if (message.available !== false) {
700
+ obj.available = message.available;
701
+ }
702
+ if (message.allocatedMemoryBytes !== 0n) {
703
+ obj.allocatedMemoryBytes = message.allocatedMemoryBytes.toString();
704
+ }
705
+ if (message.persistentStorageBytes !== 0n) {
706
+ obj.persistentStorageBytes = message.persistentStorageBytes.toString();
707
+ }
708
+ if (message.persistentStorageGibMonthMicrocents !== 0n) {
709
+ obj.persistentStorageGibMonthMicrocents = message.persistentStorageGibMonthMicrocents.toString();
710
+ }
711
+ if (message.persistentStoragePeriodSeconds !== 0) {
712
+ obj.persistentStoragePeriodSeconds = Math.round(message.persistentStoragePeriodSeconds);
713
+ }
714
+ if (message.startupReservationMicrocents !== 0n) {
715
+ obj.startupReservationMicrocents = message.startupReservationMicrocents.toString();
716
+ }
717
+ if (message.networkAllowancePeriodSeconds !== 0) {
718
+ obj.networkAllowancePeriodSeconds = Math.round(message.networkAllowancePeriodSeconds);
719
+ }
720
+ if (message.admission !== undefined) {
721
+ obj.admission = exports.AdmissionAssessment.toJSON(message.admission);
722
+ }
723
+ return obj;
724
+ },
725
+ create(base) {
726
+ return exports.ComputeQuote.fromPartial(base ?? {});
727
+ },
728
+ fromPartial(object) {
729
+ const message = createBaseComputeQuote();
730
+ message.id = object.id ?? "";
731
+ message.orgId = object.orgId ?? "";
732
+ message.product = object.product ?? "";
733
+ message.location = object.location ?? "";
734
+ message.resources = (object.resources !== undefined && object.resources !== null)
735
+ ? job_js_1.JobResources.fromPartial(object.resources)
736
+ : undefined;
737
+ message.maxRuntimeSeconds = object.maxRuntimeSeconds ?? 0;
738
+ message.maxNetworkBytes = (object.maxNetworkBytes !== undefined && object.maxNetworkBytes !== null)
739
+ ? BigInt(object.maxNetworkBytes)
740
+ : 0n;
741
+ message.currency = object.currency ?? "";
742
+ message.hourlyMicrocents = (object.hourlyMicrocents !== undefined && object.hourlyMicrocents !== null)
743
+ ? BigInt(object.hourlyMicrocents)
744
+ : 0n;
745
+ message.minimumRuntimeSeconds = object.minimumRuntimeSeconds ?? 0;
746
+ message.minimumChargeMicrocents =
747
+ (object.minimumChargeMicrocents !== undefined && object.minimumChargeMicrocents !== null)
748
+ ? BigInt(object.minimumChargeMicrocents)
749
+ : 0n;
750
+ message.maximumReservationMicrocents =
751
+ (object.maximumReservationMicrocents !== undefined && object.maximumReservationMicrocents !== null)
752
+ ? BigInt(object.maximumReservationMicrocents)
753
+ : 0n;
754
+ message.networkGibMicrocents = (object.networkGibMicrocents !== undefined && object.networkGibMicrocents !== null)
755
+ ? BigInt(object.networkGibMicrocents)
756
+ : 0n;
757
+ message.pricingVersion = object.pricingVersion ?? "";
758
+ message.fxNumerator = (object.fxNumerator !== undefined && object.fxNumerator !== null)
759
+ ? BigInt(object.fxNumerator)
760
+ : 0n;
761
+ message.fxDenominator = (object.fxDenominator !== undefined && object.fxDenominator !== null)
762
+ ? BigInt(object.fxDenominator)
763
+ : 0n;
764
+ message.expiresAt = object.expiresAt ?? undefined;
765
+ message.available = object.available ?? false;
766
+ message.allocatedMemoryBytes = (object.allocatedMemoryBytes !== undefined && object.allocatedMemoryBytes !== null)
767
+ ? BigInt(object.allocatedMemoryBytes)
768
+ : 0n;
769
+ message.persistentStorageBytes =
770
+ (object.persistentStorageBytes !== undefined && object.persistentStorageBytes !== null)
771
+ ? BigInt(object.persistentStorageBytes)
772
+ : 0n;
773
+ message.persistentStorageGibMonthMicrocents =
774
+ (object.persistentStorageGibMonthMicrocents !== undefined && object.persistentStorageGibMonthMicrocents !== null)
775
+ ? BigInt(object.persistentStorageGibMonthMicrocents)
776
+ : 0n;
777
+ message.persistentStoragePeriodSeconds = object.persistentStoragePeriodSeconds ?? 0;
778
+ message.startupReservationMicrocents =
779
+ (object.startupReservationMicrocents !== undefined && object.startupReservationMicrocents !== null)
780
+ ? BigInt(object.startupReservationMicrocents)
781
+ : 0n;
782
+ message.networkAllowancePeriodSeconds = object.networkAllowancePeriodSeconds ?? 0;
783
+ message.admission = (object.admission !== undefined && object.admission !== null)
784
+ ? exports.AdmissionAssessment.fromPartial(object.admission)
785
+ : undefined;
786
+ return message;
787
+ },
788
+ };
789
+ function createBaseAdmissionAssessment() {
790
+ return { available: false, reason: "", checkedAt: undefined, capacityReserved: false };
791
+ }
792
+ exports.AdmissionAssessment = {
793
+ encode(message, writer = new wire_1.BinaryWriter()) {
794
+ if (message.available !== false) {
795
+ writer.uint32(8).bool(message.available);
796
+ }
797
+ if (message.reason !== "") {
798
+ writer.uint32(18).string(message.reason);
799
+ }
800
+ if (message.checkedAt !== undefined) {
801
+ timestamp_js_1.Timestamp.encode(toTimestamp(message.checkedAt), writer.uint32(26).fork()).join();
802
+ }
803
+ if (message.capacityReserved !== false) {
804
+ writer.uint32(32).bool(message.capacityReserved);
805
+ }
806
+ return writer;
807
+ },
808
+ decode(input, length) {
809
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
810
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
811
+ if (previousRecursionDepth >= 100) {
812
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
813
+ }
814
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
815
+ try {
816
+ const end = length === undefined ? reader.len : reader.pos + length;
817
+ const message = createBaseAdmissionAssessment();
818
+ while (reader.pos < end) {
819
+ const tag = reader.uint32();
820
+ switch (tag >>> 3) {
821
+ case 1: {
822
+ if (tag !== 8) {
823
+ break;
824
+ }
825
+ message.available = reader.bool();
826
+ continue;
827
+ }
828
+ case 2: {
829
+ if (tag !== 18) {
830
+ break;
831
+ }
832
+ message.reason = reader.string();
833
+ continue;
834
+ }
835
+ case 3: {
836
+ if (tag !== 26) {
837
+ break;
838
+ }
839
+ message.checkedAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
840
+ continue;
841
+ }
842
+ case 4: {
843
+ if (tag !== 32) {
844
+ break;
845
+ }
846
+ message.capacityReserved = reader.bool();
847
+ continue;
848
+ }
849
+ }
850
+ if ((tag & 7) === 4 || tag === 0) {
851
+ break;
852
+ }
853
+ reader.skip(tag & 7);
854
+ }
855
+ return message;
856
+ }
857
+ finally {
858
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
859
+ }
860
+ },
861
+ fromJSON(object) {
862
+ return {
863
+ available: isSet(object.available) ? globalThis.Boolean(object.available) : false,
864
+ reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
865
+ checkedAt: isSet(object.checkedAt)
866
+ ? fromJsonTimestamp(object.checkedAt)
867
+ : isSet(object.checked_at)
868
+ ? fromJsonTimestamp(object.checked_at)
869
+ : undefined,
870
+ capacityReserved: isSet(object.capacityReserved)
871
+ ? globalThis.Boolean(object.capacityReserved)
872
+ : isSet(object.capacity_reserved)
873
+ ? globalThis.Boolean(object.capacity_reserved)
874
+ : false,
875
+ };
876
+ },
877
+ toJSON(message) {
878
+ const obj = {};
879
+ if (message.available !== false) {
880
+ obj.available = message.available;
881
+ }
882
+ if (message.reason !== "") {
883
+ obj.reason = message.reason;
884
+ }
885
+ if (message.checkedAt !== undefined) {
886
+ obj.checkedAt = message.checkedAt.toISOString();
887
+ }
888
+ if (message.capacityReserved !== false) {
889
+ obj.capacityReserved = message.capacityReserved;
890
+ }
891
+ return obj;
892
+ },
893
+ create(base) {
894
+ return exports.AdmissionAssessment.fromPartial(base ?? {});
895
+ },
896
+ fromPartial(object) {
897
+ const message = createBaseAdmissionAssessment();
898
+ message.available = object.available ?? false;
899
+ message.reason = object.reason ?? "";
900
+ message.checkedAt = object.checkedAt ?? undefined;
901
+ message.capacityReserved = object.capacityReserved ?? false;
902
+ return message;
903
+ },
904
+ };
905
+ function createBaseGetUsagePolicyRequest() {
906
+ return { orgId: "" };
907
+ }
908
+ exports.GetUsagePolicyRequest = {
909
+ encode(message, writer = new wire_1.BinaryWriter()) {
910
+ if (message.orgId !== "") {
911
+ writer.uint32(10).string(message.orgId);
912
+ }
913
+ return writer;
914
+ },
915
+ decode(input, length) {
916
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
917
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
918
+ if (previousRecursionDepth >= 100) {
919
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
920
+ }
921
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
922
+ try {
923
+ const end = length === undefined ? reader.len : reader.pos + length;
924
+ const message = createBaseGetUsagePolicyRequest();
925
+ while (reader.pos < end) {
926
+ const tag = reader.uint32();
927
+ switch (tag >>> 3) {
928
+ case 1: {
929
+ if (tag !== 10) {
930
+ break;
931
+ }
932
+ message.orgId = reader.string();
933
+ continue;
934
+ }
935
+ }
936
+ if ((tag & 7) === 4 || tag === 0) {
937
+ break;
938
+ }
939
+ reader.skip(tag & 7);
940
+ }
941
+ return message;
942
+ }
943
+ finally {
944
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
945
+ }
946
+ },
947
+ fromJSON(object) {
948
+ return {
949
+ orgId: isSet(object.orgId)
950
+ ? globalThis.String(object.orgId)
951
+ : isSet(object.org_id)
952
+ ? globalThis.String(object.org_id)
953
+ : "",
954
+ };
955
+ },
956
+ toJSON(message) {
957
+ const obj = {};
958
+ if (message.orgId !== "") {
959
+ obj.orgId = message.orgId;
960
+ }
961
+ return obj;
962
+ },
963
+ create(base) {
964
+ return exports.GetUsagePolicyRequest.fromPartial(base ?? {});
965
+ },
966
+ fromPartial(object) {
967
+ const message = createBaseGetUsagePolicyRequest();
968
+ message.orgId = object.orgId ?? "";
969
+ return message;
970
+ },
971
+ };
972
+ function createBaseUsageAllowance() {
973
+ return {
974
+ meter: "",
975
+ freeUnits: 0n,
976
+ usedUnits: 0n,
977
+ remainingUnits: 0n,
978
+ rateMicrocents: 0n,
979
+ unitQuantity: 0n,
980
+ periodSeconds: 0n,
981
+ };
982
+ }
983
+ exports.UsageAllowance = {
984
+ encode(message, writer = new wire_1.BinaryWriter()) {
985
+ if (message.meter !== "") {
986
+ writer.uint32(10).string(message.meter);
987
+ }
988
+ if (message.freeUnits !== 0n) {
989
+ if (BigInt.asIntN(64, message.freeUnits) !== message.freeUnits) {
990
+ throw new globalThis.Error("value provided for field message.freeUnits of type int64 too large");
991
+ }
992
+ writer.uint32(16).int64(message.freeUnits);
993
+ }
994
+ if (message.usedUnits !== 0n) {
995
+ if (BigInt.asIntN(64, message.usedUnits) !== message.usedUnits) {
996
+ throw new globalThis.Error("value provided for field message.usedUnits of type int64 too large");
997
+ }
998
+ writer.uint32(24).int64(message.usedUnits);
999
+ }
1000
+ if (message.remainingUnits !== 0n) {
1001
+ if (BigInt.asIntN(64, message.remainingUnits) !== message.remainingUnits) {
1002
+ throw new globalThis.Error("value provided for field message.remainingUnits of type int64 too large");
1003
+ }
1004
+ writer.uint32(32).int64(message.remainingUnits);
1005
+ }
1006
+ if (message.rateMicrocents !== 0n) {
1007
+ if (BigInt.asIntN(64, message.rateMicrocents) !== message.rateMicrocents) {
1008
+ throw new globalThis.Error("value provided for field message.rateMicrocents of type int64 too large");
1009
+ }
1010
+ writer.uint32(40).int64(message.rateMicrocents);
1011
+ }
1012
+ if (message.unitQuantity !== 0n) {
1013
+ if (BigInt.asIntN(64, message.unitQuantity) !== message.unitQuantity) {
1014
+ throw new globalThis.Error("value provided for field message.unitQuantity of type int64 too large");
1015
+ }
1016
+ writer.uint32(48).int64(message.unitQuantity);
1017
+ }
1018
+ if (message.periodSeconds !== 0n) {
1019
+ if (BigInt.asIntN(64, message.periodSeconds) !== message.periodSeconds) {
1020
+ throw new globalThis.Error("value provided for field message.periodSeconds of type int64 too large");
1021
+ }
1022
+ writer.uint32(56).int64(message.periodSeconds);
1023
+ }
1024
+ return writer;
1025
+ },
1026
+ decode(input, length) {
1027
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1028
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1029
+ if (previousRecursionDepth >= 100) {
1030
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1031
+ }
1032
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1033
+ try {
1034
+ const end = length === undefined ? reader.len : reader.pos + length;
1035
+ const message = createBaseUsageAllowance();
1036
+ while (reader.pos < end) {
1037
+ const tag = reader.uint32();
1038
+ switch (tag >>> 3) {
1039
+ case 1: {
1040
+ if (tag !== 10) {
1041
+ break;
1042
+ }
1043
+ message.meter = reader.string();
1044
+ continue;
1045
+ }
1046
+ case 2: {
1047
+ if (tag !== 16) {
1048
+ break;
1049
+ }
1050
+ message.freeUnits = reader.int64();
1051
+ continue;
1052
+ }
1053
+ case 3: {
1054
+ if (tag !== 24) {
1055
+ break;
1056
+ }
1057
+ message.usedUnits = reader.int64();
1058
+ continue;
1059
+ }
1060
+ case 4: {
1061
+ if (tag !== 32) {
1062
+ break;
1063
+ }
1064
+ message.remainingUnits = reader.int64();
1065
+ continue;
1066
+ }
1067
+ case 5: {
1068
+ if (tag !== 40) {
1069
+ break;
1070
+ }
1071
+ message.rateMicrocents = reader.int64();
1072
+ continue;
1073
+ }
1074
+ case 6: {
1075
+ if (tag !== 48) {
1076
+ break;
1077
+ }
1078
+ message.unitQuantity = reader.int64();
1079
+ continue;
1080
+ }
1081
+ case 7: {
1082
+ if (tag !== 56) {
1083
+ break;
1084
+ }
1085
+ message.periodSeconds = reader.int64();
1086
+ continue;
1087
+ }
1088
+ }
1089
+ if ((tag & 7) === 4 || tag === 0) {
1090
+ break;
1091
+ }
1092
+ reader.skip(tag & 7);
1093
+ }
1094
+ return message;
1095
+ }
1096
+ finally {
1097
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1098
+ }
1099
+ },
1100
+ fromJSON(object) {
1101
+ return {
1102
+ meter: isSet(object.meter) ? globalThis.String(object.meter) : "",
1103
+ freeUnits: isSet(object.freeUnits)
1104
+ ? BigInt(object.freeUnits)
1105
+ : isSet(object.free_units)
1106
+ ? BigInt(object.free_units)
1107
+ : 0n,
1108
+ usedUnits: isSet(object.usedUnits)
1109
+ ? BigInt(object.usedUnits)
1110
+ : isSet(object.used_units)
1111
+ ? BigInt(object.used_units)
1112
+ : 0n,
1113
+ remainingUnits: isSet(object.remainingUnits)
1114
+ ? BigInt(object.remainingUnits)
1115
+ : isSet(object.remaining_units)
1116
+ ? BigInt(object.remaining_units)
1117
+ : 0n,
1118
+ rateMicrocents: isSet(object.rateMicrocents)
1119
+ ? BigInt(object.rateMicrocents)
1120
+ : isSet(object.rate_microcents)
1121
+ ? BigInt(object.rate_microcents)
1122
+ : 0n,
1123
+ unitQuantity: isSet(object.unitQuantity)
1124
+ ? BigInt(object.unitQuantity)
1125
+ : isSet(object.unit_quantity)
1126
+ ? BigInt(object.unit_quantity)
1127
+ : 0n,
1128
+ periodSeconds: isSet(object.periodSeconds)
1129
+ ? BigInt(object.periodSeconds)
1130
+ : isSet(object.period_seconds)
1131
+ ? BigInt(object.period_seconds)
1132
+ : 0n,
1133
+ };
1134
+ },
1135
+ toJSON(message) {
1136
+ const obj = {};
1137
+ if (message.meter !== "") {
1138
+ obj.meter = message.meter;
1139
+ }
1140
+ if (message.freeUnits !== 0n) {
1141
+ obj.freeUnits = message.freeUnits.toString();
1142
+ }
1143
+ if (message.usedUnits !== 0n) {
1144
+ obj.usedUnits = message.usedUnits.toString();
1145
+ }
1146
+ if (message.remainingUnits !== 0n) {
1147
+ obj.remainingUnits = message.remainingUnits.toString();
1148
+ }
1149
+ if (message.rateMicrocents !== 0n) {
1150
+ obj.rateMicrocents = message.rateMicrocents.toString();
1151
+ }
1152
+ if (message.unitQuantity !== 0n) {
1153
+ obj.unitQuantity = message.unitQuantity.toString();
1154
+ }
1155
+ if (message.periodSeconds !== 0n) {
1156
+ obj.periodSeconds = message.periodSeconds.toString();
1157
+ }
1158
+ return obj;
1159
+ },
1160
+ create(base) {
1161
+ return exports.UsageAllowance.fromPartial(base ?? {});
1162
+ },
1163
+ fromPartial(object) {
1164
+ const message = createBaseUsageAllowance();
1165
+ message.meter = object.meter ?? "";
1166
+ message.freeUnits = (object.freeUnits !== undefined && object.freeUnits !== null) ? BigInt(object.freeUnits) : 0n;
1167
+ message.usedUnits = (object.usedUnits !== undefined && object.usedUnits !== null) ? BigInt(object.usedUnits) : 0n;
1168
+ message.remainingUnits = (object.remainingUnits !== undefined && object.remainingUnits !== null)
1169
+ ? BigInt(object.remainingUnits)
1170
+ : 0n;
1171
+ message.rateMicrocents = (object.rateMicrocents !== undefined && object.rateMicrocents !== null)
1172
+ ? BigInt(object.rateMicrocents)
1173
+ : 0n;
1174
+ message.unitQuantity = (object.unitQuantity !== undefined && object.unitQuantity !== null)
1175
+ ? BigInt(object.unitQuantity)
1176
+ : 0n;
1177
+ message.periodSeconds = (object.periodSeconds !== undefined && object.periodSeconds !== null)
1178
+ ? BigInt(object.periodSeconds)
1179
+ : 0n;
1180
+ return message;
1181
+ },
1182
+ };
1183
+ function createBaseUsagePolicy() {
1184
+ return {
1185
+ orgId: "",
1186
+ version: "",
1187
+ currency: "",
1188
+ estimateId: "",
1189
+ estimateExpiresAt: undefined,
1190
+ estimated720HourMicrocents: 0n,
1191
+ allowances: [],
1192
+ acceptedVersion: "",
1193
+ acceptedAt: undefined,
1194
+ inventoryAt: undefined,
1195
+ mode: "",
1196
+ chargingReady: false,
1197
+ };
1198
+ }
1199
+ exports.UsagePolicy = {
1200
+ encode(message, writer = new wire_1.BinaryWriter()) {
1201
+ if (message.orgId !== "") {
1202
+ writer.uint32(10).string(message.orgId);
1203
+ }
1204
+ if (message.version !== "") {
1205
+ writer.uint32(18).string(message.version);
1206
+ }
1207
+ if (message.currency !== "") {
1208
+ writer.uint32(26).string(message.currency);
1209
+ }
1210
+ if (message.estimateId !== "") {
1211
+ writer.uint32(34).string(message.estimateId);
1212
+ }
1213
+ if (message.estimateExpiresAt !== undefined) {
1214
+ timestamp_js_1.Timestamp.encode(toTimestamp(message.estimateExpiresAt), writer.uint32(42).fork()).join();
1215
+ }
1216
+ if (message.estimated720HourMicrocents !== 0n) {
1217
+ if (BigInt.asIntN(64, message.estimated720HourMicrocents) !== message.estimated720HourMicrocents) {
1218
+ throw new globalThis.Error("value provided for field message.estimated720HourMicrocents of type int64 too large");
1219
+ }
1220
+ writer.uint32(48).int64(message.estimated720HourMicrocents);
1221
+ }
1222
+ for (const v of message.allowances) {
1223
+ exports.UsageAllowance.encode(v, writer.uint32(58).fork()).join();
1224
+ }
1225
+ if (message.acceptedVersion !== "") {
1226
+ writer.uint32(66).string(message.acceptedVersion);
1227
+ }
1228
+ if (message.acceptedAt !== undefined) {
1229
+ timestamp_js_1.Timestamp.encode(toTimestamp(message.acceptedAt), writer.uint32(74).fork()).join();
1230
+ }
1231
+ if (message.inventoryAt !== undefined) {
1232
+ timestamp_js_1.Timestamp.encode(toTimestamp(message.inventoryAt), writer.uint32(82).fork()).join();
1233
+ }
1234
+ if (message.mode !== "") {
1235
+ writer.uint32(90).string(message.mode);
1236
+ }
1237
+ if (message.chargingReady !== false) {
1238
+ writer.uint32(96).bool(message.chargingReady);
1239
+ }
1240
+ return writer;
1241
+ },
1242
+ decode(input, length) {
1243
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1244
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1245
+ if (previousRecursionDepth >= 100) {
1246
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1247
+ }
1248
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1249
+ try {
1250
+ const end = length === undefined ? reader.len : reader.pos + length;
1251
+ const message = createBaseUsagePolicy();
1252
+ while (reader.pos < end) {
1253
+ const tag = reader.uint32();
1254
+ switch (tag >>> 3) {
1255
+ case 1: {
1256
+ if (tag !== 10) {
1257
+ break;
1258
+ }
1259
+ message.orgId = reader.string();
1260
+ continue;
1261
+ }
1262
+ case 2: {
1263
+ if (tag !== 18) {
1264
+ break;
1265
+ }
1266
+ message.version = reader.string();
1267
+ continue;
1268
+ }
1269
+ case 3: {
1270
+ if (tag !== 26) {
1271
+ break;
1272
+ }
1273
+ message.currency = reader.string();
1274
+ continue;
1275
+ }
1276
+ case 4: {
1277
+ if (tag !== 34) {
1278
+ break;
1279
+ }
1280
+ message.estimateId = reader.string();
1281
+ continue;
1282
+ }
1283
+ case 5: {
1284
+ if (tag !== 42) {
1285
+ break;
1286
+ }
1287
+ message.estimateExpiresAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
1288
+ continue;
1289
+ }
1290
+ case 6: {
1291
+ if (tag !== 48) {
1292
+ break;
1293
+ }
1294
+ message.estimated720HourMicrocents = reader.int64();
1295
+ continue;
1296
+ }
1297
+ case 7: {
1298
+ if (tag !== 58) {
1299
+ break;
1300
+ }
1301
+ message.allowances.push(exports.UsageAllowance.decode(reader, reader.uint32()));
1302
+ continue;
1303
+ }
1304
+ case 8: {
1305
+ if (tag !== 66) {
1306
+ break;
1307
+ }
1308
+ message.acceptedVersion = reader.string();
1309
+ continue;
1310
+ }
1311
+ case 9: {
1312
+ if (tag !== 74) {
1313
+ break;
1314
+ }
1315
+ message.acceptedAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
1316
+ continue;
1317
+ }
1318
+ case 10: {
1319
+ if (tag !== 82) {
1320
+ break;
1321
+ }
1322
+ message.inventoryAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
1323
+ continue;
1324
+ }
1325
+ case 11: {
1326
+ if (tag !== 90) {
1327
+ break;
1328
+ }
1329
+ message.mode = reader.string();
1330
+ continue;
1331
+ }
1332
+ case 12: {
1333
+ if (tag !== 96) {
1334
+ break;
1335
+ }
1336
+ message.chargingReady = reader.bool();
1337
+ continue;
1338
+ }
1339
+ }
1340
+ if ((tag & 7) === 4 || tag === 0) {
1341
+ break;
1342
+ }
1343
+ reader.skip(tag & 7);
1344
+ }
1345
+ return message;
1346
+ }
1347
+ finally {
1348
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1349
+ }
1350
+ },
1351
+ fromJSON(object) {
1352
+ return {
1353
+ orgId: isSet(object.orgId)
1354
+ ? globalThis.String(object.orgId)
1355
+ : isSet(object.org_id)
1356
+ ? globalThis.String(object.org_id)
1357
+ : "",
1358
+ version: isSet(object.version) ? globalThis.String(object.version) : "",
1359
+ currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
1360
+ estimateId: isSet(object.estimateId)
1361
+ ? globalThis.String(object.estimateId)
1362
+ : isSet(object.estimate_id)
1363
+ ? globalThis.String(object.estimate_id)
1364
+ : "",
1365
+ estimateExpiresAt: isSet(object.estimateExpiresAt)
1366
+ ? fromJsonTimestamp(object.estimateExpiresAt)
1367
+ : isSet(object.estimate_expires_at)
1368
+ ? fromJsonTimestamp(object.estimate_expires_at)
1369
+ : undefined,
1370
+ estimated720HourMicrocents: isSet(object.estimated720HourMicrocents)
1371
+ ? BigInt(object.estimated720HourMicrocents)
1372
+ : isSet(object.estimated_720_hour_microcents)
1373
+ ? BigInt(object.estimated_720_hour_microcents)
1374
+ : 0n,
1375
+ allowances: globalThis.Array.isArray(object?.allowances)
1376
+ ? object.allowances.map((e) => exports.UsageAllowance.fromJSON(e))
1377
+ : [],
1378
+ acceptedVersion: isSet(object.acceptedVersion)
1379
+ ? globalThis.String(object.acceptedVersion)
1380
+ : isSet(object.accepted_version)
1381
+ ? globalThis.String(object.accepted_version)
1382
+ : "",
1383
+ acceptedAt: isSet(object.acceptedAt)
1384
+ ? fromJsonTimestamp(object.acceptedAt)
1385
+ : isSet(object.accepted_at)
1386
+ ? fromJsonTimestamp(object.accepted_at)
1387
+ : undefined,
1388
+ inventoryAt: isSet(object.inventoryAt)
1389
+ ? fromJsonTimestamp(object.inventoryAt)
1390
+ : isSet(object.inventory_at)
1391
+ ? fromJsonTimestamp(object.inventory_at)
1392
+ : undefined,
1393
+ mode: isSet(object.mode) ? globalThis.String(object.mode) : "",
1394
+ chargingReady: isSet(object.chargingReady)
1395
+ ? globalThis.Boolean(object.chargingReady)
1396
+ : isSet(object.charging_ready)
1397
+ ? globalThis.Boolean(object.charging_ready)
1398
+ : false,
1399
+ };
1400
+ },
1401
+ toJSON(message) {
1402
+ const obj = {};
1403
+ if (message.orgId !== "") {
1404
+ obj.orgId = message.orgId;
1405
+ }
1406
+ if (message.version !== "") {
1407
+ obj.version = message.version;
1408
+ }
1409
+ if (message.currency !== "") {
1410
+ obj.currency = message.currency;
1411
+ }
1412
+ if (message.estimateId !== "") {
1413
+ obj.estimateId = message.estimateId;
1414
+ }
1415
+ if (message.estimateExpiresAt !== undefined) {
1416
+ obj.estimateExpiresAt = message.estimateExpiresAt.toISOString();
1417
+ }
1418
+ if (message.estimated720HourMicrocents !== 0n) {
1419
+ obj.estimated720HourMicrocents = message.estimated720HourMicrocents.toString();
1420
+ }
1421
+ if (message.allowances?.length) {
1422
+ obj.allowances = message.allowances.map((e) => exports.UsageAllowance.toJSON(e));
1423
+ }
1424
+ if (message.acceptedVersion !== "") {
1425
+ obj.acceptedVersion = message.acceptedVersion;
1426
+ }
1427
+ if (message.acceptedAt !== undefined) {
1428
+ obj.acceptedAt = message.acceptedAt.toISOString();
1429
+ }
1430
+ if (message.inventoryAt !== undefined) {
1431
+ obj.inventoryAt = message.inventoryAt.toISOString();
1432
+ }
1433
+ if (message.mode !== "") {
1434
+ obj.mode = message.mode;
1435
+ }
1436
+ if (message.chargingReady !== false) {
1437
+ obj.chargingReady = message.chargingReady;
1438
+ }
1439
+ return obj;
1440
+ },
1441
+ create(base) {
1442
+ return exports.UsagePolicy.fromPartial(base ?? {});
1443
+ },
1444
+ fromPartial(object) {
1445
+ const message = createBaseUsagePolicy();
1446
+ message.orgId = object.orgId ?? "";
1447
+ message.version = object.version ?? "";
1448
+ message.currency = object.currency ?? "";
1449
+ message.estimateId = object.estimateId ?? "";
1450
+ message.estimateExpiresAt = object.estimateExpiresAt ?? undefined;
1451
+ message.estimated720HourMicrocents =
1452
+ (object.estimated720HourMicrocents !== undefined && object.estimated720HourMicrocents !== null)
1453
+ ? BigInt(object.estimated720HourMicrocents)
1454
+ : 0n;
1455
+ message.allowances = object.allowances?.map((e) => exports.UsageAllowance.fromPartial(e)) || [];
1456
+ message.acceptedVersion = object.acceptedVersion ?? "";
1457
+ message.acceptedAt = object.acceptedAt ?? undefined;
1458
+ message.inventoryAt = object.inventoryAt ?? undefined;
1459
+ message.mode = object.mode ?? "";
1460
+ message.chargingReady = object.chargingReady ?? false;
1461
+ return message;
1462
+ },
1463
+ };
1464
+ function createBaseAcceptUsagePolicyRequest() {
1465
+ return { orgId: "", version: "", estimateId: "" };
1466
+ }
1467
+ exports.AcceptUsagePolicyRequest = {
1468
+ encode(message, writer = new wire_1.BinaryWriter()) {
1469
+ if (message.orgId !== "") {
1470
+ writer.uint32(10).string(message.orgId);
1471
+ }
1472
+ if (message.version !== "") {
1473
+ writer.uint32(18).string(message.version);
1474
+ }
1475
+ if (message.estimateId !== "") {
1476
+ writer.uint32(26).string(message.estimateId);
1477
+ }
1478
+ return writer;
1479
+ },
1480
+ decode(input, length) {
1481
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1482
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
1483
+ if (previousRecursionDepth >= 100) {
1484
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1485
+ }
1486
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
1487
+ try {
1488
+ const end = length === undefined ? reader.len : reader.pos + length;
1489
+ const message = createBaseAcceptUsagePolicyRequest();
1490
+ while (reader.pos < end) {
1491
+ const tag = reader.uint32();
1492
+ switch (tag >>> 3) {
1493
+ case 1: {
1494
+ if (tag !== 10) {
1495
+ break;
1496
+ }
1497
+ message.orgId = reader.string();
1498
+ continue;
1499
+ }
1500
+ case 2: {
1501
+ if (tag !== 18) {
1502
+ break;
1503
+ }
1504
+ message.version = reader.string();
1505
+ continue;
1506
+ }
1507
+ case 3: {
1508
+ if (tag !== 26) {
1509
+ break;
1510
+ }
1511
+ message.estimateId = reader.string();
1512
+ continue;
1513
+ }
1514
+ }
1515
+ if ((tag & 7) === 4 || tag === 0) {
1516
+ break;
1517
+ }
1518
+ reader.skip(tag & 7);
1519
+ }
1520
+ return message;
1521
+ }
1522
+ finally {
1523
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
1524
+ }
1525
+ },
1526
+ fromJSON(object) {
1527
+ return {
1528
+ orgId: isSet(object.orgId)
1529
+ ? globalThis.String(object.orgId)
1530
+ : isSet(object.org_id)
1531
+ ? globalThis.String(object.org_id)
1532
+ : "",
1533
+ version: isSet(object.version) ? globalThis.String(object.version) : "",
1534
+ estimateId: isSet(object.estimateId)
1535
+ ? globalThis.String(object.estimateId)
1536
+ : isSet(object.estimate_id)
1537
+ ? globalThis.String(object.estimate_id)
1538
+ : "",
1539
+ };
1540
+ },
1541
+ toJSON(message) {
1542
+ const obj = {};
1543
+ if (message.orgId !== "") {
1544
+ obj.orgId = message.orgId;
1545
+ }
1546
+ if (message.version !== "") {
1547
+ obj.version = message.version;
1548
+ }
1549
+ if (message.estimateId !== "") {
1550
+ obj.estimateId = message.estimateId;
1551
+ }
1552
+ return obj;
1553
+ },
1554
+ create(base) {
1555
+ return exports.AcceptUsagePolicyRequest.fromPartial(base ?? {});
1556
+ },
1557
+ fromPartial(object) {
1558
+ const message = createBaseAcceptUsagePolicyRequest();
1559
+ message.orgId = object.orgId ?? "";
1560
+ message.version = object.version ?? "";
1561
+ message.estimateId = object.estimateId ?? "";
1562
+ return message;
1563
+ },
1564
+ };
1565
+ function toTimestamp(date) {
1566
+ const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
1567
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
1568
+ return { seconds, nanos };
1569
+ }
1570
+ function fromTimestamp(t) {
1571
+ let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;
1572
+ millis += (t.nanos || 0) / 1_000_000;
1573
+ return new globalThis.Date(millis);
1574
+ }
1575
+ function fromJsonTimestamp(o) {
1576
+ if (o instanceof globalThis.Date) {
1577
+ return o;
1578
+ }
1579
+ else if (typeof o === "string") {
1580
+ return new globalThis.Date(o);
1581
+ }
1582
+ else {
1583
+ return fromTimestamp(timestamp_js_1.Timestamp.fromJSON(o));
1584
+ }
1585
+ }
1586
+ function isSet(value) {
1587
+ return value !== null && value !== undefined;
1588
+ }