@vzn/vx-reapi 0.0.644 → 0.0.645

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 (3) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +2 -2
  3. package/src/cache.ts +10 -4
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 vx contributors
3
+ Copyright (c) 2026 VZN
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx-reapi",
3
- "version": "0.0.644",
3
+ "version": "0.0.645",
4
4
  "license": "MIT",
5
5
  "description": "Bazel Remote Execution API plugin for vx — remote cache (ActionCache + CAS) against NativeLink, BuildBuddy, Buildbarn or bazel-remote.",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "peerDependencies": {
42
- "@vzn/vx": "^0.0.644"
42
+ "@vzn/vx": "^0.0.645"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",
package/src/cache.ts CHANGED
@@ -96,12 +96,18 @@ export class ReapiRemoteCache {
96
96
  * hit vs miss. Costs one extra round trip, and only for a PREDICTED HIT:
97
97
  * a miss still answers in one call.
98
98
  */
99
- async has(hash: string): Promise<boolean> {
99
+ async has(hash: string): Promise<{ size: number; durationMs?: number } | null> {
100
100
  const result = await this.client.getActionResult(actionDigestFor(hash))
101
- if (result === null) return false
101
+ if (result === null) return null
102
102
  const file = result.output_files?.find((f) => f.path === ARTIFACT_PATH)
103
- if (file === undefined) return false
104
- return (await this.client.findMissingBlobs([file.digest])).length === 0
103
+ if (file === undefined) return null
104
+ if ((await this.client.findMissingBlobs([file.digest])).length > 0) return null
105
+ // The duration only when it rode inline: a CAS read for it is a round trip.
106
+ const durationMs = decodeDuration(result.stdout_raw)
107
+ return {
108
+ size: Number(file.digest.size_bytes),
109
+ ...(durationMs === undefined ? {} : { durationMs }),
110
+ }
105
111
  }
106
112
 
107
113
  /**