@vzn/vx-reapi 0.0.590 → 0.0.594
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.
- package/package.json +3 -4
- package/src/executor.ts +8 -5
- package/src/merkle.ts +8 -5
- package/src/wire.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx-reapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.594",
|
|
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": [
|
|
@@ -33,14 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@grpc/grpc-js": "^1.12.0",
|
|
36
|
-
"@grpc/proto-loader": "^0.7.13"
|
|
37
|
-
"protobufjs": "^7.4.0"
|
|
36
|
+
"@grpc/proto-loader": "^0.7.13"
|
|
38
37
|
},
|
|
39
38
|
"publishConfig": {
|
|
40
39
|
"access": "public"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
|
-
"@vzn/vx": "^0.0.
|
|
42
|
+
"@vzn/vx": "^0.0.594"
|
|
44
43
|
},
|
|
45
44
|
"repository": {
|
|
46
45
|
"type": "git",
|
package/src/executor.ts
CHANGED
|
@@ -30,6 +30,9 @@ import {
|
|
|
30
30
|
import { execDigestFor } from './cache.js'
|
|
31
31
|
import type { ActionResult, Digest, Directory, Operation, ReapiClient } from './wire.js'
|
|
32
32
|
|
|
33
|
+
// A default decoder strips a leading U+FEFF, which is part of a path.
|
|
34
|
+
const PATH_UTF8 = new TextDecoder('utf-8', { ignoreBOM: true })
|
|
35
|
+
|
|
33
36
|
/**
|
|
34
37
|
* Split a coarse output directory into the paths its GLOB actually names.
|
|
35
38
|
*
|
|
@@ -346,7 +349,7 @@ function decodeOutputFile(buf: Uint8Array): {
|
|
|
346
349
|
i = l
|
|
347
350
|
const slice = buf.subarray(i, i + len)
|
|
348
351
|
i += len
|
|
349
|
-
if (field === 1) out.path =
|
|
352
|
+
if (field === 1) out.path = PATH_UTF8.decode(slice)
|
|
350
353
|
else if (field === 2) out.digest = decodeDigest(slice)
|
|
351
354
|
else if (field === 5 && len > 0) out.contents = slice
|
|
352
355
|
} else if (wire === 0) {
|
|
@@ -370,8 +373,8 @@ function decodeOutputSymlink(buf: Uint8Array): { path: string; target: string }
|
|
|
370
373
|
i = l
|
|
371
374
|
const slice = buf.subarray(i, i + len)
|
|
372
375
|
i += len
|
|
373
|
-
if (key >>> 3 === 1) out.path =
|
|
374
|
-
else if (key >>> 3 === 2) out.target =
|
|
376
|
+
if (key >>> 3 === 1) out.path = PATH_UTF8.decode(slice)
|
|
377
|
+
else if (key >>> 3 === 2) out.target = PATH_UTF8.decode(slice)
|
|
375
378
|
}
|
|
376
379
|
return out
|
|
377
380
|
}
|
|
@@ -445,7 +448,7 @@ function decodeOutputDirectory(buf: Uint8Array): { path: string; tree_digest: Di
|
|
|
445
448
|
i = l
|
|
446
449
|
const slice = buf.subarray(i, i + len)
|
|
447
450
|
i += len
|
|
448
|
-
if (field === 1) out.path =
|
|
451
|
+
if (field === 1) out.path = PATH_UTF8.decode(slice)
|
|
449
452
|
else if (field === 3) out.tree_digest = decodeDigest(slice)
|
|
450
453
|
}
|
|
451
454
|
return out
|
|
@@ -1342,7 +1345,7 @@ export function commandEnvironment(
|
|
|
1342
1345
|
return [...merged].map(([name, value]) => ({ name, value }))
|
|
1343
1346
|
}
|
|
1344
1347
|
|
|
1345
|
-
|
|
1348
|
+
interface OutputPathSets {
|
|
1346
1349
|
/** v2.1+ `output_paths` — deduped, sorted. */
|
|
1347
1350
|
outputPaths: string[]
|
|
1348
1351
|
/** v2.0 legacy split: wildcard-free globs are files, prefix-derived are directories. */
|
package/src/merkle.ts
CHANGED
|
@@ -14,12 +14,15 @@ import { lstat, readlink } from 'node:fs/promises'
|
|
|
14
14
|
import path from 'node:path'
|
|
15
15
|
import type { Digest, Directory, DirectoryNode, FileNode, SymlinkNode } from './wire.js'
|
|
16
16
|
|
|
17
|
+
// A default decoder strips a leading U+FEFF, which is part of a name.
|
|
18
|
+
const PATH_UTF8 = new TextDecoder('utf-8', { ignoreBOM: true })
|
|
19
|
+
|
|
17
20
|
export interface Blob {
|
|
18
21
|
digest: Digest
|
|
19
22
|
data: Uint8Array
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
interface InputTree {
|
|
23
26
|
/** Digest of the root `Directory` — goes in `Action.input_root_digest`. */
|
|
24
27
|
root: Digest
|
|
25
28
|
/** Every blob the server needs: file contents plus the Directory nodes. */
|
|
@@ -740,7 +743,7 @@ function decodeFileNode(buf: Uint8Array): FileNode {
|
|
|
740
743
|
i = l
|
|
741
744
|
const slice = buf.subarray(i, i + len)
|
|
742
745
|
i += len
|
|
743
|
-
if (field === 1) f.name =
|
|
746
|
+
if (field === 1) f.name = PATH_UTF8.decode(slice)
|
|
744
747
|
else if (field === 2) f.digest = decodeDigestBytes(slice)
|
|
745
748
|
else if (field === 6) f.node_properties = decodeNodeProperties(slice)
|
|
746
749
|
} else if (wire === 0) {
|
|
@@ -802,7 +805,7 @@ function decodeDirectoryNode(buf: Uint8Array): DirectoryNode {
|
|
|
802
805
|
i = l
|
|
803
806
|
const slice = buf.subarray(i, i + len)
|
|
804
807
|
i += len
|
|
805
|
-
if (key >>> 3 === 1) d.name =
|
|
808
|
+
if (key >>> 3 === 1) d.name = PATH_UTF8.decode(slice)
|
|
806
809
|
else if (key >>> 3 === 2) d.digest = decodeDigestBytes(slice)
|
|
807
810
|
}
|
|
808
811
|
return d
|
|
@@ -819,8 +822,8 @@ function decodeSymlinkNode(buf: Uint8Array): SymlinkNode {
|
|
|
819
822
|
i = l
|
|
820
823
|
const slice = buf.subarray(i, i + len)
|
|
821
824
|
i += len
|
|
822
|
-
if (key >>> 3 === 1) sl.name =
|
|
823
|
-
else if (key >>> 3 === 2) sl.target =
|
|
825
|
+
if (key >>> 3 === 1) sl.name = PATH_UTF8.decode(slice)
|
|
826
|
+
else if (key >>> 3 === 2) sl.target = PATH_UTF8.decode(slice)
|
|
824
827
|
}
|
|
825
828
|
return sl
|
|
826
829
|
}
|
package/src/wire.ts
CHANGED
|
@@ -82,7 +82,7 @@ export interface Digest {
|
|
|
82
82
|
size_bytes: number
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
interface ServerCapabilities {
|
|
86
86
|
digestFunctions: string[]
|
|
87
87
|
maxBatchBytes: number
|
|
88
88
|
acUpdateEnabled: boolean
|
|
@@ -1566,7 +1566,7 @@ export interface Operation {
|
|
|
1566
1566
|
metadata?: { type_url?: string; value?: Uint8Array }
|
|
1567
1567
|
}
|
|
1568
1568
|
|
|
1569
|
-
|
|
1569
|
+
interface ExecuteOptions {
|
|
1570
1570
|
/** The operation's name, once the server has given one. */
|
|
1571
1571
|
onOperation?: (name: string) => void
|
|
1572
1572
|
/** Default TRUE: vx owns the cache decision, so the server must not re-check its own AC. */
|