@actions/cache 3.2.4 → 4.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 (53) hide show
  1. package/README.md +14 -2
  2. package/lib/cache.d.ts +2 -2
  3. package/lib/cache.js +222 -7
  4. package/lib/cache.js.map +1 -1
  5. package/lib/generated/google/protobuf/timestamp.d.ts +158 -0
  6. package/lib/generated/google/protobuf/timestamp.js +136 -0
  7. package/lib/generated/google/protobuf/timestamp.js.map +1 -0
  8. package/lib/generated/google/protobuf/wrappers.d.ts +307 -0
  9. package/lib/generated/google/protobuf/wrappers.js +614 -0
  10. package/lib/generated/google/protobuf/wrappers.js.map +1 -0
  11. package/lib/generated/results/api/v1/cache.d.ts +378 -0
  12. package/lib/generated/results/api/v1/cache.js +730 -0
  13. package/lib/generated/results/api/v1/cache.js.map +1 -0
  14. package/lib/generated/results/api/v1/cache.twirp.d.ts +53 -0
  15. package/lib/generated/results/api/v1/cache.twirp.js +602 -0
  16. package/lib/generated/results/api/v1/cache.twirp.js.map +1 -0
  17. package/lib/generated/results/entities/v1/cacheentry.d.ts +71 -0
  18. package/lib/generated/results/entities/v1/cacheentry.js +106 -0
  19. package/lib/generated/results/entities/v1/cacheentry.js.map +1 -0
  20. package/lib/generated/results/entities/v1/cachemetadata.d.ts +35 -0
  21. package/lib/generated/results/entities/v1/cachemetadata.js +64 -0
  22. package/lib/generated/results/entities/v1/cachemetadata.js.map +1 -0
  23. package/lib/generated/results/entities/v1/cachescope.d.ts +34 -0
  24. package/lib/generated/results/entities/v1/cachescope.js +63 -0
  25. package/lib/generated/results/entities/v1/cachescope.js.map +1 -0
  26. package/lib/internal/cacheHttpClient.d.ts +1 -3
  27. package/lib/internal/cacheHttpClient.js +30 -36
  28. package/lib/internal/cacheHttpClient.js.map +1 -1
  29. package/lib/internal/cacheUtils.d.ts +2 -1
  30. package/lib/internal/cacheUtils.js +28 -10
  31. package/lib/internal/cacheUtils.js.map +1 -1
  32. package/lib/internal/config.d.ts +3 -0
  33. package/lib/internal/config.js +37 -0
  34. package/lib/internal/config.js.map +1 -0
  35. package/lib/internal/constants.d.ts +1 -0
  36. package/lib/internal/constants.js +2 -1
  37. package/lib/internal/constants.js.map +1 -1
  38. package/lib/internal/shared/cacheTwirpClient.d.ts +6 -0
  39. package/lib/internal/shared/cacheTwirpClient.js +160 -0
  40. package/lib/internal/shared/cacheTwirpClient.js.map +1 -0
  41. package/lib/internal/shared/errors.d.ts +22 -0
  42. package/lib/internal/shared/errors.js +70 -0
  43. package/lib/internal/shared/errors.js.map +1 -0
  44. package/lib/internal/shared/user-agent.d.ts +4 -0
  45. package/lib/internal/shared/user-agent.js +13 -0
  46. package/lib/internal/shared/user-agent.js.map +1 -0
  47. package/lib/internal/uploadUtils.d.ts +60 -0
  48. package/lib/internal/uploadUtils.js +167 -0
  49. package/lib/internal/uploadUtils.js.map +1 -0
  50. package/lib/options.d.ts +12 -0
  51. package/lib/options.js +17 -0
  52. package/lib/options.js.map +1 -1
  53. package/package.json +5 -5
package/README.md CHANGED
@@ -6,6 +6,20 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
6
6
 
7
7
  Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 10 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 10 GB.
8
8
 
9
+ ## ⚠️ Important changes
10
+
11
+ The cache backend service has been rewritten from the ground up for improved performance and reliability. The [@actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) package now integrates with the new cache service (v2) APIs.
12
+
13
+ The new service will gradually roll out as of **February 1st, 2025**. The legacy service will also be sunset on the same date. Changes in this release are **fully backward compatible**.
14
+
15
+ **All previous versions of this package will be deprecated**. We recommend upgrading to version `4.0.0` as soon as possible before **February 1st, 2025.**
16
+
17
+ If you do not upgrade, all workflow runs using any of the deprecated [@actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) packages will fail.
18
+
19
+ Upgrading to the recommended version should not break or require any changes to your workflows beyond updating your `package.json` to version `4.0.0`.
20
+
21
+ Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/toolkit/discussions/1890).
22
+
9
23
  ## Usage
10
24
 
11
25
  This package is used by the v2+ versions of our first party cache action. You can find an example implementation in the cache repo [here](https://github.com/actions/cache).
@@ -47,5 +61,3 @@ const cacheKey = await cache.restoreCache(paths, key, restoreKeys)
47
61
  A cache gets downloaded in multiple segments of fixed sizes (now `128MB` to fail-fast, previously `1GB` for a `32-bit` runner and `2GB` for a `64-bit` runner were used). Sometimes, a segment download gets stuck which causes the workflow job to be stuck forever and fail. Version `v3.0.4` of cache package introduces a segment download timeout. The segment download timeout will allow the segment download to get aborted and hence allow the job to proceed with a cache miss.
48
62
 
49
63
  Default value of this timeout is 10 minutes (starting `v3.2.1` and higher, previously 60 minutes in versions between `v.3.0.4` and `v3.2.0`, both included) and can be customized by specifying an [environment variable](https://docs.github.com/en/actions/learn-github-actions/environment-variables) named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with timeout value in minutes.
50
-
51
-
package/lib/cache.d.ts CHANGED
@@ -15,8 +15,8 @@ export declare function isFeatureAvailable(): boolean;
15
15
  * Restores cache from keys
16
16
  *
17
17
  * @param paths a list of file paths to restore from the cache
18
- * @param primaryKey an explicit key for restoring the cache
19
- * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
18
+ * @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
19
+ * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
20
20
  * @param downloadOptions cache download options
21
21
  * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
22
22
  * @returns string returns the key for the cache hit, otherwise returns undefined
package/lib/cache.js CHANGED
@@ -37,7 +37,10 @@ const core = __importStar(require("@actions/core"));
37
37
  const path = __importStar(require("path"));
38
38
  const utils = __importStar(require("./internal/cacheUtils"));
39
39
  const cacheHttpClient = __importStar(require("./internal/cacheHttpClient"));
40
+ const cacheTwirpClient = __importStar(require("./internal/shared/cacheTwirpClient"));
41
+ const config_1 = require("./internal/config");
40
42
  const tar_1 = require("./internal/tar");
43
+ const constants_1 = require("./internal/constants");
41
44
  class ValidationError extends Error {
42
45
  constructor(message) {
43
46
  super(message);
@@ -81,15 +84,39 @@ exports.isFeatureAvailable = isFeatureAvailable;
81
84
  * Restores cache from keys
82
85
  *
83
86
  * @param paths a list of file paths to restore from the cache
84
- * @param primaryKey an explicit key for restoring the cache
85
- * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
87
+ * @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
88
+ * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
86
89
  * @param downloadOptions cache download options
87
90
  * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
88
91
  * @returns string returns the key for the cache hit, otherwise returns undefined
89
92
  */
90
93
  function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
91
94
  return __awaiter(this, void 0, void 0, function* () {
95
+ const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
96
+ core.debug(`Cache service version: ${cacheServiceVersion}`);
92
97
  checkPaths(paths);
98
+ switch (cacheServiceVersion) {
99
+ case 'v2':
100
+ return yield restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
101
+ case 'v1':
102
+ default:
103
+ return yield restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
104
+ }
105
+ });
106
+ }
107
+ exports.restoreCache = restoreCache;
108
+ /**
109
+ * Restores cache using the legacy Cache Service
110
+ *
111
+ * @param paths a list of file paths to restore from the cache
112
+ * @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
113
+ * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
114
+ * @param options cache download options
115
+ * @param enableCrossOsArchive an optional boolean enabled to restore on Windows any cache created on any platform
116
+ * @returns string returns the key for the cache hit, otherwise returns undefined
117
+ */
118
+ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
119
+ return __awaiter(this, void 0, void 0, function* () {
93
120
  restoreKeys = restoreKeys || [];
94
121
  const keys = [primaryKey, ...restoreKeys];
95
122
  core.debug('Resolved Keys:');
@@ -151,7 +178,85 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
151
178
  return undefined;
152
179
  });
153
180
  }
154
- exports.restoreCache = restoreCache;
181
+ /**
182
+ * Restores cache using Cache Service v2
183
+ *
184
+ * @param paths a list of file paths to restore from the cache
185
+ * @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching
186
+ * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
187
+ * @param downloadOptions cache download options
188
+ * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
189
+ * @returns string returns the key for the cache hit, otherwise returns undefined
190
+ */
191
+ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ // Override UploadOptions to force the use of Azure
194
+ options = Object.assign(Object.assign({}, options), { useAzureSdk: true });
195
+ restoreKeys = restoreKeys || [];
196
+ const keys = [primaryKey, ...restoreKeys];
197
+ core.debug('Resolved Keys:');
198
+ core.debug(JSON.stringify(keys));
199
+ if (keys.length > 10) {
200
+ throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
201
+ }
202
+ for (const key of keys) {
203
+ checkKey(key);
204
+ }
205
+ let archivePath = '';
206
+ try {
207
+ const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
208
+ const compressionMethod = yield utils.getCompressionMethod();
209
+ const request = {
210
+ key: primaryKey,
211
+ restoreKeys,
212
+ version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
213
+ };
214
+ const response = yield twirpClient.GetCacheEntryDownloadURL(request);
215
+ if (!response.ok) {
216
+ core.warning(`Cache not found for keys: ${keys.join(', ')}`);
217
+ return undefined;
218
+ }
219
+ core.info(`Cache hit for: ${request.key}`);
220
+ if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
221
+ core.info('Lookup only - skipping download');
222
+ return response.matchedKey;
223
+ }
224
+ archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
225
+ core.debug(`Archive path: ${archivePath}`);
226
+ core.debug(`Starting download of archive to: ${archivePath}`);
227
+ yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options);
228
+ const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
229
+ core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
230
+ if (core.isDebug()) {
231
+ yield (0, tar_1.listTar)(archivePath, compressionMethod);
232
+ }
233
+ yield (0, tar_1.extractTar)(archivePath, compressionMethod);
234
+ core.info('Cache restored successfully');
235
+ return response.matchedKey;
236
+ }
237
+ catch (error) {
238
+ const typedError = error;
239
+ if (typedError.name === ValidationError.name) {
240
+ throw error;
241
+ }
242
+ else {
243
+ // Supress all non-validation cache related errors because caching should be optional
244
+ core.warning(`Failed to restore: ${error.message}`);
245
+ }
246
+ }
247
+ finally {
248
+ try {
249
+ if (archivePath) {
250
+ yield utils.unlinkFile(archivePath);
251
+ }
252
+ }
253
+ catch (error) {
254
+ core.debug(`Failed to delete archive: ${error}`);
255
+ }
256
+ }
257
+ return undefined;
258
+ });
259
+ }
155
260
  /**
156
261
  * Saves a list of files with the specified key
157
262
  *
@@ -162,10 +267,33 @@ exports.restoreCache = restoreCache;
162
267
  * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
163
268
  */
164
269
  function saveCache(paths, key, options, enableCrossOsArchive = false) {
165
- var _a, _b, _c, _d, _e;
166
270
  return __awaiter(this, void 0, void 0, function* () {
271
+ const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
272
+ core.debug(`Cache service version: ${cacheServiceVersion}`);
167
273
  checkPaths(paths);
168
274
  checkKey(key);
275
+ switch (cacheServiceVersion) {
276
+ case 'v2':
277
+ return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
278
+ case 'v1':
279
+ default:
280
+ return yield saveCacheV1(paths, key, options, enableCrossOsArchive);
281
+ }
282
+ });
283
+ }
284
+ exports.saveCache = saveCache;
285
+ /**
286
+ * Save cache using the legacy Cache Service
287
+ *
288
+ * @param paths
289
+ * @param key
290
+ * @param options
291
+ * @param enableCrossOsArchive
292
+ * @returns
293
+ */
294
+ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
295
+ var _a, _b, _c, _d, _e;
296
+ return __awaiter(this, void 0, void 0, function* () {
169
297
  const compressionMethod = yield utils.getCompressionMethod();
170
298
  let cacheId = -1;
171
299
  const cachePaths = yield utils.resolvePaths(paths);
@@ -186,7 +314,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
186
314
  const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
187
315
  core.debug(`File Size: ${archiveFileSize}`);
188
316
  // For GHES, this check will take place in ReserveCache API with enterprise file size limit
189
- if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
317
+ if (archiveFileSize > fileSizeLimit && !(0, config_1.isGhes)()) {
190
318
  throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
191
319
  }
192
320
  core.debug('Reserving Cache');
@@ -205,7 +333,95 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
205
333
  throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
206
334
  }
207
335
  core.debug(`Saving Cache (ID: ${cacheId})`);
208
- yield cacheHttpClient.saveCache(cacheId, archivePath, options);
336
+ yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
337
+ }
338
+ catch (error) {
339
+ const typedError = error;
340
+ if (typedError.name === ValidationError.name) {
341
+ throw error;
342
+ }
343
+ else if (typedError.name === ReserveCacheError.name) {
344
+ core.info(`Failed to save: ${typedError.message}`);
345
+ }
346
+ else {
347
+ core.warning(`Failed to save: ${typedError.message}`);
348
+ }
349
+ }
350
+ finally {
351
+ // Try to delete the archive to save space
352
+ try {
353
+ yield utils.unlinkFile(archivePath);
354
+ }
355
+ catch (error) {
356
+ core.debug(`Failed to delete archive: ${error}`);
357
+ }
358
+ }
359
+ return cacheId;
360
+ });
361
+ }
362
+ /**
363
+ * Save cache using Cache Service v2
364
+ *
365
+ * @param paths a list of file paths to restore from the cache
366
+ * @param key an explicit key for restoring the cache
367
+ * @param options cache upload options
368
+ * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform
369
+ * @returns
370
+ */
371
+ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
372
+ return __awaiter(this, void 0, void 0, function* () {
373
+ // Override UploadOptions to force the use of Azure
374
+ // ...options goes first because we want to override the default values
375
+ // set in UploadOptions with these specific figures
376
+ options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
377
+ const compressionMethod = yield utils.getCompressionMethod();
378
+ const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
379
+ let cacheId = -1;
380
+ const cachePaths = yield utils.resolvePaths(paths);
381
+ core.debug('Cache Paths:');
382
+ core.debug(`${JSON.stringify(cachePaths)}`);
383
+ if (cachePaths.length === 0) {
384
+ throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
385
+ }
386
+ const archiveFolder = yield utils.createTempDirectory();
387
+ const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
388
+ core.debug(`Archive Path: ${archivePath}`);
389
+ try {
390
+ yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod);
391
+ if (core.isDebug()) {
392
+ yield (0, tar_1.listTar)(archivePath, compressionMethod);
393
+ }
394
+ const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
395
+ core.debug(`File Size: ${archiveFileSize}`);
396
+ // For GHES, this check will take place in ReserveCache API with enterprise file size limit
397
+ if (archiveFileSize > constants_1.CacheFileSizeLimit && !(0, config_1.isGhes)()) {
398
+ throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
399
+ }
400
+ // Set the archive size in the options, will be used to display the upload progress
401
+ options.archiveSizeBytes = archiveFileSize;
402
+ core.debug('Reserving Cache');
403
+ const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive);
404
+ const request = {
405
+ key,
406
+ version
407
+ };
408
+ const response = yield twirpClient.CreateCacheEntry(request);
409
+ if (!response.ok) {
410
+ throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
411
+ }
412
+ core.debug(`Attempting to upload cache located at: ${archivePath}`);
413
+ yield cacheHttpClient.saveCache(cacheId, archivePath, response.signedUploadUrl, options);
414
+ const finalizeRequest = {
415
+ key,
416
+ version,
417
+ sizeBytes: `${archiveFileSize}`
418
+ };
419
+ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
420
+ core.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`);
421
+ if (!finalizeResponse.ok) {
422
+ throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`);
423
+ }
424
+ cacheId = parseInt(finalizeResponse.entryId);
209
425
  }
210
426
  catch (error) {
211
427
  const typedError = error;
@@ -231,5 +447,4 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
231
447
  return cacheId;
232
448
  });
233
449
  }
234
- exports.saveCache = saveCache;
235
450
  //# sourceMappingURL=cache.js.map
package/lib/cache.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":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,MAAM,gBAAgB,GACpB,MAAM,WAAW,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAA;YAC7D,IAAI,CAAC,KAAK,CAAC,qCAAqC,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAA;YAEtE,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE;gBACxB,MAAM,IAAI,KAAK,CACb,qCAAqC,GAAG,6CAA6C,CACtF,CAAA;aACF;YAED,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;SAC7C;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,UAAU,GAAG,KAAc,CAAA;YACjC,IAAI,UAAU,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,EAAE;gBAC5C,MAAM,KAAK,CAAA;aACZ;iBAAM,IAAI,UAAU,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,EAAE;gBACrD,IAAI,CAAC,IAAI,CAAC,mBAAmB,UAAU,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;iBAAM;gBACL,IAAI,CAAC,OAAO,CAAC,mBAAmB,UAAU,CAAC,OAAO,EAAE,CAAC,CAAA;aACtD;SACF;gBAAS;YACR,0CAA0C;YAC1C,IAAI;gBACF,MAAM,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;aACpC;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAA;aACjD;SACF;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA"}
@@ -0,0 +1,158 @@
1
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
5
+ import type { PartialMessage } from "@protobuf-ts/runtime";
6
+ import type { JsonValue } from "@protobuf-ts/runtime";
7
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
8
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
9
+ import { MessageType } from "@protobuf-ts/runtime";
10
+ /**
11
+ * A Timestamp represents a point in time independent of any time zone or local
12
+ * calendar, encoded as a count of seconds and fractions of seconds at
13
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
14
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
15
+ * Gregorian calendar backwards to year one.
16
+ *
17
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
18
+ * second table is needed for interpretation, using a [24-hour linear
19
+ * smear](https://developers.google.com/time/smear).
20
+ *
21
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
22
+ * restricting to that range, we ensure that we can convert to and from [RFC
23
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
24
+ *
25
+ * # Examples
26
+ *
27
+ * Example 1: Compute Timestamp from POSIX `time()`.
28
+ *
29
+ * Timestamp timestamp;
30
+ * timestamp.set_seconds(time(NULL));
31
+ * timestamp.set_nanos(0);
32
+ *
33
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
34
+ *
35
+ * struct timeval tv;
36
+ * gettimeofday(&tv, NULL);
37
+ *
38
+ * Timestamp timestamp;
39
+ * timestamp.set_seconds(tv.tv_sec);
40
+ * timestamp.set_nanos(tv.tv_usec * 1000);
41
+ *
42
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
43
+ *
44
+ * FILETIME ft;
45
+ * GetSystemTimeAsFileTime(&ft);
46
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
47
+ *
48
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
49
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
50
+ * Timestamp timestamp;
51
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
52
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
53
+ *
54
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
55
+ *
56
+ * long millis = System.currentTimeMillis();
57
+ *
58
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
59
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
60
+ *
61
+ *
62
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
63
+ *
64
+ * Instant now = Instant.now();
65
+ *
66
+ * Timestamp timestamp =
67
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
68
+ * .setNanos(now.getNano()).build();
69
+ *
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 proto3 JSON serializer should always use UTC (as indicated by
86
+ * "Z") when printing the Timestamp type and a proto3 JSON 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://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
101
+ * ) to obtain a formatter capable of generating timestamps in this format.
102
+ *
103
+ *
104
+ *
105
+ * @generated from protobuf message google.protobuf.Timestamp
106
+ */
107
+ export interface Timestamp {
108
+ /**
109
+ * Represents seconds of UTC time since Unix epoch
110
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
111
+ * 9999-12-31T23:59:59Z inclusive.
112
+ *
113
+ * @generated from protobuf field: int64 seconds = 1;
114
+ */
115
+ seconds: string;
116
+ /**
117
+ * Non-negative fractions of a second at nanosecond resolution. Negative
118
+ * second values with fractions must still have non-negative nanos values
119
+ * that count forward in time. Must be from 0 to 999,999,999
120
+ * inclusive.
121
+ *
122
+ * @generated from protobuf field: int32 nanos = 2;
123
+ */
124
+ nanos: number;
125
+ }
126
+ declare class Timestamp$Type extends MessageType<Timestamp> {
127
+ constructor();
128
+ /**
129
+ * Creates a new `Timestamp` for the current time.
130
+ */
131
+ now(): Timestamp;
132
+ /**
133
+ * Converts a `Timestamp` to a JavaScript Date.
134
+ */
135
+ toDate(message: Timestamp): Date;
136
+ /**
137
+ * Converts a JavaScript Date to a `Timestamp`.
138
+ */
139
+ fromDate(date: Date): Timestamp;
140
+ /**
141
+ * In JSON format, the `Timestamp` type is encoded as a string
142
+ * in the RFC 3339 format.
143
+ */
144
+ internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue;
145
+ /**
146
+ * In JSON format, the `Timestamp` type is encoded as a string
147
+ * in the RFC 3339 format.
148
+ */
149
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp;
150
+ create(value?: PartialMessage<Timestamp>): Timestamp;
151
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp;
152
+ internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
153
+ }
154
+ /**
155
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
156
+ */
157
+ export declare const Timestamp: Timestamp$Type;
158
+ export {};
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Timestamp = void 0;
4
+ const runtime_1 = require("@protobuf-ts/runtime");
5
+ const runtime_2 = require("@protobuf-ts/runtime");
6
+ const runtime_3 = require("@protobuf-ts/runtime");
7
+ const runtime_4 = require("@protobuf-ts/runtime");
8
+ const runtime_5 = require("@protobuf-ts/runtime");
9
+ const runtime_6 = require("@protobuf-ts/runtime");
10
+ const runtime_7 = require("@protobuf-ts/runtime");
11
+ // @generated message type with reflection information, may provide speed optimized methods
12
+ class Timestamp$Type extends runtime_7.MessageType {
13
+ constructor() {
14
+ super("google.protobuf.Timestamp", [
15
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
16
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
17
+ ]);
18
+ }
19
+ /**
20
+ * Creates a new `Timestamp` for the current time.
21
+ */
22
+ now() {
23
+ const msg = this.create();
24
+ const ms = Date.now();
25
+ msg.seconds = runtime_6.PbLong.from(Math.floor(ms / 1000)).toString();
26
+ msg.nanos = (ms % 1000) * 1000000;
27
+ return msg;
28
+ }
29
+ /**
30
+ * Converts a `Timestamp` to a JavaScript Date.
31
+ */
32
+ toDate(message) {
33
+ return new Date(runtime_6.PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
34
+ }
35
+ /**
36
+ * Converts a JavaScript Date to a `Timestamp`.
37
+ */
38
+ fromDate(date) {
39
+ const msg = this.create();
40
+ const ms = date.getTime();
41
+ msg.seconds = runtime_6.PbLong.from(Math.floor(ms / 1000)).toString();
42
+ msg.nanos = (ms % 1000) * 1000000;
43
+ return msg;
44
+ }
45
+ /**
46
+ * In JSON format, the `Timestamp` type is encoded as a string
47
+ * in the RFC 3339 format.
48
+ */
49
+ internalJsonWrite(message, options) {
50
+ let ms = runtime_6.PbLong.from(message.seconds).toNumber() * 1000;
51
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
52
+ throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
53
+ if (message.nanos < 0)
54
+ throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
55
+ let z = "Z";
56
+ if (message.nanos > 0) {
57
+ let nanosStr = (message.nanos + 1000000000).toString().substring(1);
58
+ if (nanosStr.substring(3) === "000000")
59
+ z = "." + nanosStr.substring(0, 3) + "Z";
60
+ else if (nanosStr.substring(6) === "000")
61
+ z = "." + nanosStr.substring(0, 6) + "Z";
62
+ else
63
+ z = "." + nanosStr + "Z";
64
+ }
65
+ return new Date(ms).toISOString().replace(".000Z", z);
66
+ }
67
+ /**
68
+ * In JSON format, the `Timestamp` type is encoded as a string
69
+ * in the RFC 3339 format.
70
+ */
71
+ internalJsonRead(json, options, target) {
72
+ if (typeof json !== "string")
73
+ throw new Error("Unable to parse Timestamp from JSON " + (0, runtime_5.typeofJsonValue)(json) + ".");
74
+ let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
75
+ if (!matches)
76
+ throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
77
+ let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
78
+ if (Number.isNaN(ms))
79
+ throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
80
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
81
+ throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
82
+ if (!target)
83
+ target = this.create();
84
+ target.seconds = runtime_6.PbLong.from(ms / 1000).toString();
85
+ target.nanos = 0;
86
+ if (matches[7])
87
+ target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
88
+ return target;
89
+ }
90
+ create(value) {
91
+ const message = { seconds: "0", nanos: 0 };
92
+ globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
93
+ if (value !== undefined)
94
+ (0, runtime_3.reflectionMergePartial)(this, message, value);
95
+ return message;
96
+ }
97
+ internalBinaryRead(reader, length, options, target) {
98
+ let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
99
+ while (reader.pos < end) {
100
+ let [fieldNo, wireType] = reader.tag();
101
+ switch (fieldNo) {
102
+ case /* int64 seconds */ 1:
103
+ message.seconds = reader.int64().toString();
104
+ break;
105
+ case /* int32 nanos */ 2:
106
+ message.nanos = reader.int32();
107
+ break;
108
+ default:
109
+ let u = options.readUnknownField;
110
+ if (u === "throw")
111
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
112
+ let d = reader.skip(wireType);
113
+ if (u !== false)
114
+ (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
115
+ }
116
+ }
117
+ return message;
118
+ }
119
+ internalBinaryWrite(message, writer, options) {
120
+ /* int64 seconds = 1; */
121
+ if (message.seconds !== "0")
122
+ writer.tag(1, runtime_1.WireType.Varint).int64(message.seconds);
123
+ /* int32 nanos = 2; */
124
+ if (message.nanos !== 0)
125
+ writer.tag(2, runtime_1.WireType.Varint).int32(message.nanos);
126
+ let u = options.writeUnknownFields;
127
+ if (u !== false)
128
+ (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
129
+ return writer;
130
+ }
131
+ }
132
+ /**
133
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
134
+ */
135
+ exports.Timestamp = new Timestamp$Type();
136
+ //# sourceMappingURL=timestamp.js.map