@alienplatform/sdk 1.14.1 → 2.0.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 (160) hide show
  1. package/dist/dist.js +371 -275
  2. package/dist/index.d.ts +22 -28
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -14356
  5. package/dist/native.d.ts +26 -0
  6. package/dist/native.d.ts.map +1 -0
  7. package/dist/native.js +2 -0
  8. package/dist/worker-runtime/channel.d.ts +25 -0
  9. package/dist/worker-runtime/channel.d.ts.map +1 -0
  10. package/dist/worker-runtime/errors.d.ts +79 -0
  11. package/dist/worker-runtime/errors.d.ts.map +1 -0
  12. package/dist/worker-runtime/event-loop.d.ts +43 -0
  13. package/dist/worker-runtime/event-loop.d.ts.map +1 -0
  14. package/dist/{generated → worker-runtime/generated}/control.d.ts +15 -15
  15. package/dist/worker-runtime/generated/control.d.ts.map +1 -0
  16. package/dist/worker-runtime/generated/google/protobuf/duration.d.ts.map +1 -0
  17. package/dist/worker-runtime/generated/google/protobuf/timestamp.d.ts.map +1 -0
  18. package/dist/{generated → worker-runtime/generated}/wait_until.d.ts +29 -29
  19. package/dist/worker-runtime/generated/wait_until.d.ts.map +1 -0
  20. package/dist/worker-runtime/grpc-utils.d.ts +23 -0
  21. package/dist/worker-runtime/grpc-utils.d.ts.map +1 -0
  22. package/dist/worker-runtime/index.d.ts +33 -0
  23. package/dist/worker-runtime/index.d.ts.map +1 -0
  24. package/dist/{src.js → worker-runtime/index.js} +9370 -4035
  25. package/dist/worker-runtime/registry.d.ts +169 -0
  26. package/dist/worker-runtime/registry.d.ts.map +1 -0
  27. package/dist/worker-runtime/service-definitions.d.ts +12 -0
  28. package/dist/worker-runtime/service-definitions.d.ts.map +1 -0
  29. package/dist/worker-runtime/wait-until-manager.d.ts +34 -0
  30. package/dist/worker-runtime/wait-until-manager.d.ts.map +1 -0
  31. package/package.json +18 -38
  32. package/.turbo/turbo-build.log +0 -30
  33. package/AGENTS.md +0 -70
  34. package/dist/bearerTokenAuthenticationPolicy.js +0 -3028
  35. package/dist/bindings/artifact-registry.d.ts +0 -88
  36. package/dist/bindings/artifact-registry.d.ts.map +0 -1
  37. package/dist/bindings/build.d.ts +0 -67
  38. package/dist/bindings/build.d.ts.map +0 -1
  39. package/dist/bindings/index.d.ts +0 -13
  40. package/dist/bindings/index.d.ts.map +0 -1
  41. package/dist/bindings/kv.d.ts +0 -113
  42. package/dist/bindings/kv.d.ts.map +0 -1
  43. package/dist/bindings/postgres.d.ts +0 -90
  44. package/dist/bindings/postgres.d.ts.map +0 -1
  45. package/dist/bindings/postgres.test.d.ts +0 -2
  46. package/dist/bindings/postgres.test.d.ts.map +0 -1
  47. package/dist/bindings/queue.d.ts +0 -81
  48. package/dist/bindings/queue.d.ts.map +0 -1
  49. package/dist/bindings/service-account.d.ts +0 -46
  50. package/dist/bindings/service-account.d.ts.map +0 -1
  51. package/dist/bindings/storage.d.ts +0 -164
  52. package/dist/bindings/storage.d.ts.map +0 -1
  53. package/dist/bindings/vault.d.ts +0 -65
  54. package/dist/bindings/vault.d.ts.map +0 -1
  55. package/dist/bindings/worker.d.ts +0 -72
  56. package/dist/bindings/worker.d.ts.map +0 -1
  57. package/dist/channel.d.ts +0 -39
  58. package/dist/channel.d.ts.map +0 -1
  59. package/dist/checksum.js +0 -6176
  60. package/dist/commands/client.d.ts +0 -47
  61. package/dist/commands/client.d.ts.map +0 -1
  62. package/dist/commands/errors.d.ts +0 -198
  63. package/dist/commands/errors.d.ts.map +0 -1
  64. package/dist/commands/index.d.ts +0 -23
  65. package/dist/commands/index.d.ts.map +0 -1
  66. package/dist/commands/index.js +0 -387
  67. package/dist/commands/types.d.ts +0 -40
  68. package/dist/commands/types.d.ts.map +0 -1
  69. package/dist/commands.d.ts +0 -55
  70. package/dist/commands.d.ts.map +0 -1
  71. package/dist/context.d.ts +0 -182
  72. package/dist/context.d.ts.map +0 -1
  73. package/dist/dist-cjs.js +0 -15258
  74. package/dist/dist2.js +0 -1239
  75. package/dist/errors.d.ts +0 -359
  76. package/dist/errors.d.ts.map +0 -1
  77. package/dist/es5.js +0 -1720
  78. package/dist/esm.js +0 -18068
  79. package/dist/esm2.js +0 -3166
  80. package/dist/event-streams.js +0 -770
  81. package/dist/events.d.ts +0 -163
  82. package/dist/events.d.ts.map +0 -1
  83. package/dist/generated/artifact_registry.d.ts +0 -302
  84. package/dist/generated/artifact_registry.d.ts.map +0 -1
  85. package/dist/generated/build.d.ts +0 -184
  86. package/dist/generated/build.d.ts.map +0 -1
  87. package/dist/generated/container.d.ts +0 -101
  88. package/dist/generated/container.d.ts.map +0 -1
  89. package/dist/generated/control.d.ts.map +0 -1
  90. package/dist/generated/google/protobuf/duration.d.ts.map +0 -1
  91. package/dist/generated/google/protobuf/timestamp.d.ts.map +0 -1
  92. package/dist/generated/kv.d.ts +0 -182
  93. package/dist/generated/kv.d.ts.map +0 -1
  94. package/dist/generated/queue.d.ts +0 -127
  95. package/dist/generated/queue.d.ts.map +0 -1
  96. package/dist/generated/service_account.d.ts +0 -112
  97. package/dist/generated/service_account.d.ts.map +0 -1
  98. package/dist/generated/storage.d.ts +0 -784
  99. package/dist/generated/storage.d.ts.map +0 -1
  100. package/dist/generated/vault.d.ts +0 -107
  101. package/dist/generated/vault.d.ts.map +0 -1
  102. package/dist/generated/wait_until.d.ts.map +0 -1
  103. package/dist/generated/worker.d.ts +0 -107
  104. package/dist/generated/worker.d.ts.map +0 -1
  105. package/dist/global.d.ts +0 -208
  106. package/dist/global.d.ts.map +0 -1
  107. package/dist/grpc-utils.d.ts +0 -25
  108. package/dist/grpc-utils.d.ts.map +0 -1
  109. package/dist/jws.js +0 -611
  110. package/dist/open.js +0 -461
  111. package/dist/rolldown-runtime.js +0 -44
  112. package/dist/src2.js +0 -114032
  113. package/dist/types.d.ts +0 -337
  114. package/dist/types.d.ts.map +0 -1
  115. package/dist/wait-until.d.ts +0 -115
  116. package/dist/wait-until.d.ts.map +0 -1
  117. package/scripts/generate-proto.sh +0 -46
  118. package/src/bindings/AGENTS.md +0 -105
  119. package/src/bindings/artifact-registry.ts +0 -317
  120. package/src/bindings/build.ts +0 -195
  121. package/src/bindings/index.ts +0 -13
  122. package/src/bindings/kv.ts +0 -240
  123. package/src/bindings/postgres.test.ts +0 -17
  124. package/src/bindings/postgres.ts +0 -446
  125. package/src/bindings/queue.ts +0 -191
  126. package/src/bindings/service-account.ts +0 -113
  127. package/src/bindings/storage.ts +0 -536
  128. package/src/bindings/vault.ts +0 -133
  129. package/src/bindings/worker.ts +0 -164
  130. package/src/channel.ts +0 -102
  131. package/src/commands/client.ts +0 -446
  132. package/src/commands/errors.ts +0 -126
  133. package/src/commands/index.ts +0 -41
  134. package/src/commands/types.ts +0 -52
  135. package/src/commands.ts +0 -76
  136. package/src/context.ts +0 -368
  137. package/src/errors.ts +0 -280
  138. package/src/events.ts +0 -511
  139. package/src/generated/artifact_registry.ts +0 -2096
  140. package/src/generated/build.ts +0 -1311
  141. package/src/generated/container.ts +0 -503
  142. package/src/generated/control.ts +0 -2018
  143. package/src/generated/google/protobuf/duration.ts +0 -196
  144. package/src/generated/google/protobuf/timestamp.ts +0 -226
  145. package/src/generated/kv.ts +0 -1169
  146. package/src/generated/queue.ts +0 -753
  147. package/src/generated/service_account.ts +0 -814
  148. package/src/generated/storage.ts +0 -3820
  149. package/src/generated/vault.ts +0 -543
  150. package/src/generated/wait_until.ts +0 -829
  151. package/src/generated/worker.ts +0 -759
  152. package/src/global.ts +0 -287
  153. package/src/grpc-utils.ts +0 -159
  154. package/src/index.ts +0 -160
  155. package/src/types.ts +0 -397
  156. package/src/wait-until.ts +0 -273
  157. package/tsconfig.json +0 -8
  158. package/tsdown.config.ts +0 -17
  159. /package/dist/{generated → worker-runtime/generated}/google/protobuf/duration.d.ts +0 -0
  160. /package/dist/{generated → worker-runtime/generated}/google/protobuf/timestamp.d.ts +0 -0
@@ -1,196 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.12.0
4
- // protoc v7.34.1
5
- // source: google/protobuf/duration.proto
6
-
7
- /* eslint-disable */
8
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
-
10
- export const protobufPackage = "google.protobuf";
11
-
12
- /**
13
- * A Duration represents a signed, fixed-length span of time represented
14
- * as a count of seconds and fractions of seconds at nanosecond
15
- * resolution. It is independent of any calendar and concepts like "day"
16
- * or "month". It is related to Timestamp in that the difference between
17
- * two Timestamp values is a Duration and it can be added or subtracted
18
- * from a Timestamp. Range is approximately +-10,000 years.
19
- *
20
- * # Examples
21
- *
22
- * Example 1: Compute Duration from two Timestamps in pseudo code.
23
- *
24
- * Timestamp start = ...;
25
- * Timestamp end = ...;
26
- * Duration duration = ...;
27
- *
28
- * duration.seconds = end.seconds - start.seconds;
29
- * duration.nanos = end.nanos - start.nanos;
30
- *
31
- * if (duration.seconds < 0 && duration.nanos > 0) {
32
- * duration.seconds += 1;
33
- * duration.nanos -= 1000000000;
34
- * } else if (duration.seconds > 0 && duration.nanos < 0) {
35
- * duration.seconds -= 1;
36
- * duration.nanos += 1000000000;
37
- * }
38
- *
39
- * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
40
- *
41
- * Timestamp start = ...;
42
- * Duration duration = ...;
43
- * Timestamp end = ...;
44
- *
45
- * end.seconds = start.seconds + duration.seconds;
46
- * end.nanos = start.nanos + duration.nanos;
47
- *
48
- * if (end.nanos < 0) {
49
- * end.seconds -= 1;
50
- * end.nanos += 1000000000;
51
- * } else if (end.nanos >= 1000000000) {
52
- * end.seconds += 1;
53
- * end.nanos -= 1000000000;
54
- * }
55
- *
56
- * Example 3: Compute Duration from datetime.timedelta in Python.
57
- *
58
- * td = datetime.timedelta(days=3, minutes=10)
59
- * duration = Duration()
60
- * duration.FromTimedelta(td)
61
- *
62
- * # JSON Mapping
63
- *
64
- * In JSON format, the Duration type is encoded as a string rather than an
65
- * object, where the string ends in the suffix "s" (indicating seconds) and
66
- * is preceded by the number of seconds, with nanoseconds expressed as
67
- * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
68
- * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
69
- * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
70
- * microsecond should be expressed in JSON format as "3.000001s".
71
- */
72
- export interface Duration {
73
- /**
74
- * Signed seconds of the span of time. Must be from -315,576,000,000
75
- * to +315,576,000,000 inclusive. Note: these bounds are computed from:
76
- * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
77
- */
78
- seconds: number;
79
- /**
80
- * Signed fractions of a second at nanosecond resolution of the span
81
- * of time. Durations less than one second are represented with a 0
82
- * `seconds` field and a positive or negative `nanos` field. For durations
83
- * of one second or more, a non-zero value for the `nanos` field must be
84
- * of the same sign as the `seconds` field. Must be from -999,999,999
85
- * to +999,999,999 inclusive.
86
- */
87
- nanos: number;
88
- }
89
-
90
- function createBaseDuration(): Duration {
91
- return { seconds: 0, nanos: 0 };
92
- }
93
-
94
- export const Duration: MessageFns<Duration> = {
95
- encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
96
- if (message.seconds !== 0) {
97
- writer.uint32(8).int64(message.seconds);
98
- }
99
- if (message.nanos !== 0) {
100
- writer.uint32(16).int32(message.nanos);
101
- }
102
- return writer;
103
- },
104
-
105
- decode(input: BinaryReader | Uint8Array, length?: number): Duration {
106
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
107
- const end = length === undefined ? reader.len : reader.pos + length;
108
- const message = createBaseDuration();
109
- while (reader.pos < end) {
110
- const tag = reader.uint32();
111
- switch (tag >>> 3) {
112
- case 1: {
113
- if (tag !== 8) {
114
- break;
115
- }
116
-
117
- message.seconds = longToNumber(reader.int64());
118
- continue;
119
- }
120
- case 2: {
121
- if (tag !== 16) {
122
- break;
123
- }
124
-
125
- message.nanos = reader.int32();
126
- continue;
127
- }
128
- }
129
- if ((tag & 7) === 4 || tag === 0) {
130
- break;
131
- }
132
- reader.skip(tag & 7);
133
- }
134
- return message;
135
- },
136
-
137
- fromJSON(object: any): Duration {
138
- return {
139
- seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
140
- nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
141
- };
142
- },
143
-
144
- toJSON(message: Duration): unknown {
145
- const obj: any = {};
146
- if (message.seconds !== 0) {
147
- obj.seconds = Math.round(message.seconds);
148
- }
149
- if (message.nanos !== 0) {
150
- obj.nanos = Math.round(message.nanos);
151
- }
152
- return obj;
153
- },
154
-
155
- create(base?: DeepPartial<Duration>): Duration {
156
- return Duration.fromPartial(base ?? {});
157
- },
158
- fromPartial(object: DeepPartial<Duration>): Duration {
159
- const message = createBaseDuration();
160
- message.seconds = object.seconds ?? 0;
161
- message.nanos = object.nanos ?? 0;
162
- return message;
163
- },
164
- };
165
-
166
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
167
-
168
- export type DeepPartial<T> = T extends Builtin ? T
169
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
170
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
171
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
172
- : Partial<T>;
173
-
174
- function longToNumber(int64: { toString(): string }): number {
175
- const num = globalThis.Number(int64.toString());
176
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
177
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
178
- }
179
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
180
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
181
- }
182
- return num;
183
- }
184
-
185
- function isSet(value: any): boolean {
186
- return value !== null && value !== undefined;
187
- }
188
-
189
- export interface MessageFns<T> {
190
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
191
- decode(input: BinaryReader | Uint8Array, length?: number): T;
192
- fromJSON(object: any): T;
193
- toJSON(message: T): unknown;
194
- create(base?: DeepPartial<T>): T;
195
- fromPartial(object: DeepPartial<T>): T;
196
- }
@@ -1,226 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.12.0
4
- // protoc v7.34.1
5
- // source: google/protobuf/timestamp.proto
6
-
7
- /* eslint-disable */
8
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
-
10
- export const protobufPackage = "google.protobuf";
11
-
12
- /**
13
- * A Timestamp represents a point in time independent of any time zone or local
14
- * calendar, encoded as a count of seconds and fractions of seconds at
15
- * nanosecond resolution. The count is relative to an epoch at UTC midnight on
16
- * January 1, 1970, in the proleptic Gregorian calendar which extends the
17
- * Gregorian calendar backwards to year one.
18
- *
19
- * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
20
- * second table is needed for interpretation, using a [24-hour linear
21
- * smear](https://developers.google.com/time/smear).
22
- *
23
- * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
24
- * restricting to that range, we ensure that we can convert to and from [RFC
25
- * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
26
- *
27
- * # Examples
28
- *
29
- * Example 1: Compute Timestamp from POSIX `time()`.
30
- *
31
- * Timestamp timestamp;
32
- * timestamp.set_seconds(time(NULL));
33
- * timestamp.set_nanos(0);
34
- *
35
- * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
36
- *
37
- * struct timeval tv;
38
- * gettimeofday(&tv, NULL);
39
- *
40
- * Timestamp timestamp;
41
- * timestamp.set_seconds(tv.tv_sec);
42
- * timestamp.set_nanos(tv.tv_usec * 1000);
43
- *
44
- * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
45
- *
46
- * FILETIME ft;
47
- * GetSystemTimeAsFileTime(&ft);
48
- * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
49
- *
50
- * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
51
- * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
52
- * Timestamp timestamp;
53
- * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
54
- * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
55
- *
56
- * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
57
- *
58
- * long millis = System.currentTimeMillis();
59
- *
60
- * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
61
- * .setNanos((int) ((millis % 1000) * 1000000)).build();
62
- *
63
- * Example 5: Compute Timestamp from Java `Instant.now()`.
64
- *
65
- * Instant now = Instant.now();
66
- *
67
- * Timestamp timestamp =
68
- * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
69
- * .setNanos(now.getNano()).build();
70
- *
71
- * Example 6: Compute Timestamp from current time in Python.
72
- *
73
- * timestamp = Timestamp()
74
- * timestamp.GetCurrentTime()
75
- *
76
- * # JSON Mapping
77
- *
78
- * In JSON format, the Timestamp type is encoded as a string in the
79
- * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
80
- * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
81
- * where {year} is always expressed using four digits while {month}, {day},
82
- * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
83
- * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
84
- * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
85
- * is required. A ProtoJSON serializer should always use UTC (as indicated by
86
- * "Z") when printing the Timestamp type and a ProtoJSON parser should be
87
- * able to accept both UTC and other timezones (as indicated by an offset).
88
- *
89
- * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
90
- * 01:30 UTC on January 15, 2017.
91
- *
92
- * In JavaScript, one can convert a Date object to this format using the
93
- * standard
94
- * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
95
- * method. In Python, a standard `datetime.datetime` object can be converted
96
- * to this format using
97
- * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
98
- * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
99
- * the Joda Time's [`ISODateTimeFormat.dateTime()`](
100
- * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
101
- * ) to obtain a formatter capable of generating timestamps in this format.
102
- */
103
- export interface Timestamp {
104
- /**
105
- * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
106
- * be between -62135596800 and 253402300799 inclusive (which corresponds to
107
- * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
108
- */
109
- seconds: number;
110
- /**
111
- * Non-negative fractions of a second at nanosecond resolution. This field is
112
- * the nanosecond portion of the duration, not an alternative to seconds.
113
- * Negative second values with fractions must still have non-negative nanos
114
- * values that count forward in time. Must be between 0 and 999,999,999
115
- * inclusive.
116
- */
117
- nanos: number;
118
- }
119
-
120
- function createBaseTimestamp(): Timestamp {
121
- return { seconds: 0, nanos: 0 };
122
- }
123
-
124
- export const Timestamp: MessageFns<Timestamp> = {
125
- encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
126
- if (message.seconds !== 0) {
127
- writer.uint32(8).int64(message.seconds);
128
- }
129
- if (message.nanos !== 0) {
130
- writer.uint32(16).int32(message.nanos);
131
- }
132
- return writer;
133
- },
134
-
135
- decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {
136
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
137
- const end = length === undefined ? reader.len : reader.pos + length;
138
- const message = createBaseTimestamp();
139
- while (reader.pos < end) {
140
- const tag = reader.uint32();
141
- switch (tag >>> 3) {
142
- case 1: {
143
- if (tag !== 8) {
144
- break;
145
- }
146
-
147
- message.seconds = longToNumber(reader.int64());
148
- continue;
149
- }
150
- case 2: {
151
- if (tag !== 16) {
152
- break;
153
- }
154
-
155
- message.nanos = reader.int32();
156
- continue;
157
- }
158
- }
159
- if ((tag & 7) === 4 || tag === 0) {
160
- break;
161
- }
162
- reader.skip(tag & 7);
163
- }
164
- return message;
165
- },
166
-
167
- fromJSON(object: any): Timestamp {
168
- return {
169
- seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
170
- nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
171
- };
172
- },
173
-
174
- toJSON(message: Timestamp): unknown {
175
- const obj: any = {};
176
- if (message.seconds !== 0) {
177
- obj.seconds = Math.round(message.seconds);
178
- }
179
- if (message.nanos !== 0) {
180
- obj.nanos = Math.round(message.nanos);
181
- }
182
- return obj;
183
- },
184
-
185
- create(base?: DeepPartial<Timestamp>): Timestamp {
186
- return Timestamp.fromPartial(base ?? {});
187
- },
188
- fromPartial(object: DeepPartial<Timestamp>): Timestamp {
189
- const message = createBaseTimestamp();
190
- message.seconds = object.seconds ?? 0;
191
- message.nanos = object.nanos ?? 0;
192
- return message;
193
- },
194
- };
195
-
196
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
197
-
198
- export type DeepPartial<T> = T extends Builtin ? T
199
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
200
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
201
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
202
- : Partial<T>;
203
-
204
- function longToNumber(int64: { toString(): string }): number {
205
- const num = globalThis.Number(int64.toString());
206
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
207
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
208
- }
209
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
210
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
211
- }
212
- return num;
213
- }
214
-
215
- function isSet(value: any): boolean {
216
- return value !== null && value !== undefined;
217
- }
218
-
219
- export interface MessageFns<T> {
220
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
221
- decode(input: BinaryReader | Uint8Array, length?: number): T;
222
- fromJSON(object: any): T;
223
- toJSON(message: T): unknown;
224
- create(base?: DeepPartial<T>): T;
225
- fromPartial(object: DeepPartial<T>): T;
226
- }