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