@orkestrel/scaffold 0.0.60 → 0.0.61
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/README.md +13 -10
- package/dist/bin/main.js +632 -320
- package/dist/bin/main.js.map +1 -1
- package/dist/host/CLAUDE.md +5 -1
- package/dist/host/agents/orchestration.md +44 -19
- package/dist/host/agents/skills/enterprise-bootstrap/references/components.md +5 -5
- package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +2 -2
- package/dist/host/agents/skills/orkestrel-debrief/references/instruction-audit.md +10 -9
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +21 -11
- package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +20 -2
- package/dist/host/agents/skills/orkestrel-harden-package/SKILL.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden-package/references/hardening.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden-package/references/research.md +1 -1
- package/dist/host/agents/templates/brief.md +16 -7
- package/dist/host/agents/transports/claude.md +4 -2
- package/dist/host/agents/transports/codex.md +4 -1
- package/dist/host/claude/agents/analyst.md +3 -1
- package/dist/host/claude/agents/application.md +1 -1
- package/dist/host/claude/agents/builder.md +3 -3
- package/dist/host/claude/agents/checker.md +5 -0
- package/dist/host/claude/agents/grok.md +15 -5
- package/dist/host/claude/agents/implementer.md +1 -1
- package/dist/host/claude/agents/orkestrel.md +2 -2
- package/dist/host/claude/agents/planner.md +10 -0
- package/dist/host/claude/agents/reviewer.md +14 -8
- package/dist/host/claude/agents/sol.md +3 -1
- package/dist/host/claude/agents/verifier.md +2 -4
- package/dist/host/claude/rules/architecture.md +7 -5
- package/dist/host/claude/rules/documentation.md +1 -0
- package/dist/host/claude/rules/names.md +23 -5
- package/dist/host/claude/rules/patterns.md +1 -0
- package/dist/host/claude/rules/quality.md +1 -1
- package/dist/host/claude/rules/tests.md +3 -3
- package/dist/host/claude/rules/typescript.md +4 -1
- package/dist/host/claude/rules/writing.md +2 -2
- package/dist/host/codex/agents/builder.toml +6 -6
- package/dist/host/codex/agents/checker.toml +2 -1
- package/dist/host/codex/agents/grok.toml +12 -5
- package/dist/host/codex/agents/implementer.toml +2 -2
- package/dist/host/codex/agents/opus.toml +6 -1
- package/dist/host/codex/agents/planner.toml +11 -6
- package/dist/host/codex/agents/reviewer.toml +8 -6
- package/dist/host/guides/scaffold.md +39 -14
- package/dist/host/manifest.json +41 -41
- package/dist/host/scripts/codex.sh +0 -0
- package/dist/host/scripts/cursor.sh +0 -0
- package/dist/host/scripts/deps.sh +0 -0
- package/dist/host/scripts/ollama.sh +0 -0
- package/dist/src/core/index.cjs +420 -278
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +361 -220
- package/dist/src/core/index.d.ts +361 -220
- package/dist/src/core/index.js +417 -279
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +208 -170
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +276 -152
- package/dist/src/server/index.d.ts +276 -152
- package/dist/src/server/index.js +200 -172
- package/dist/src/server/index.js.map +1 -1
- package/package.json +4 -3
package/dist/src/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { andOf, arrayOf, attempt, boundsOf, compareValues, holds, isArray, isBoolean, isError, isFunction, isInteger, isRecord, isString, parseJSON, parseJSONAs, parseStringField, recordOf, stringOf, unionOf } from "@orkestrel/contract";
|
|
2
|
-
import { CANON_PATHS, CATALOG_AGENT_PATH, CONTROL_CHARACTER_PATTERN, EXECUTABLE_PATHS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, ScaffoldError,
|
|
2
|
+
import { CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_CLOSING_MARKER, CATALOG_OPENING_MARKER, CONTROL_CHARACTER_PATTERN, EXECUTABLE_PATHS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, ScaffoldError, bytesToHex, catalogToLayers, cloneValue, compareVersions, computeBytes, contentToHex, extractRangeMajor, extractVersion, inferGroup, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHex, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, matchesDriftReachability, matchesRange, nameToGuide, planToFindings, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { chmodSync, closeSync, constants, copyFileSync, fstatSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, opendirSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import { Emitter } from "@orkestrel/emitter";
|
|
9
9
|
//#region src/server/constants.ts
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Matches the drive prefix a Windows host path may open with.
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
|
14
14
|
* The one segment allowed to carry a colon. Every other segment is measured by
|
|
@@ -17,7 +17,7 @@ import { Emitter } from "@orkestrel/emitter";
|
|
|
17
17
|
*/
|
|
18
18
|
var DRIVE_PATTERN = /^[A-Za-z]:$/;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Matches the visible characters no host path segment may carry.
|
|
21
21
|
*
|
|
22
22
|
* @remarks
|
|
23
23
|
* Narrower than the core path law by exactly one character: a backslash is a
|
|
@@ -26,7 +26,7 @@ var DRIVE_PATTERN = /^[A-Za-z]:$/;
|
|
|
26
26
|
*/
|
|
27
27
|
var INVALID_SEGMENT_CHARACTER_PATTERN = /[<>:"|?*]/;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Matches the Windows device names that stay reserved even when an extension follows.
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* Refused on every host rather than only on Windows. A generated workspace is
|
|
@@ -35,7 +35,7 @@ var INVALID_SEGMENT_CHARACTER_PATTERN = /[<>:"|?*]/;
|
|
|
35
35
|
*/
|
|
36
36
|
var RESERVED_SEGMENT_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9]|conin\$|conout\$)(?:\..*)?$/i;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Matches the exact SHA-256 syntax a digest is stated in: sixty-four lowercase hexadecimal digits.
|
|
39
39
|
*
|
|
40
40
|
* @remarks
|
|
41
41
|
* Fixed length, unlike the core byte encoding, because a digest is one value of
|
|
@@ -44,7 +44,7 @@ var RESERVED_SEGMENT_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9]|conin\$|co
|
|
|
44
44
|
*/
|
|
45
45
|
var DIGEST_PATTERN = /^[0-9a-f]{64}$/;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Matches the Git branch syntax the repository endpoint accepts.
|
|
48
48
|
*
|
|
49
49
|
* @remarks
|
|
50
50
|
* A branch is caller-supplied and reaches a URL path, so it is closed to
|
|
@@ -54,7 +54,7 @@ var DIGEST_PATTERN = /^[0-9a-f]{64}$/;
|
|
|
54
54
|
*/
|
|
55
55
|
var BRANCH_PATTERN = /^(?!.*\.\.)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Caps the UTF-8 bytes one host path segment may encode to.
|
|
58
58
|
*
|
|
59
59
|
* @remarks
|
|
60
60
|
* The limit every supported filesystem shares for a single name. It is a byte
|
|
@@ -63,7 +63,7 @@ var BRANCH_PATTERN = /^(?!.*\.\.)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
|
63
63
|
*/
|
|
64
64
|
var MAX_PATH_SEGMENT_BYTES = 255;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Caps the segments one host path may carry.
|
|
67
67
|
*
|
|
68
68
|
* @remarks
|
|
69
69
|
* Bounds the work a path decision costs before any filesystem call is made. With
|
|
@@ -72,7 +72,7 @@ var MAX_PATH_SEGMENT_BYTES = 255;
|
|
|
72
72
|
*/
|
|
73
73
|
var MAX_PATH_DEPTH = 64;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Caps the paths one target's working-tree inventory may report.
|
|
76
76
|
*
|
|
77
77
|
* @remarks
|
|
78
78
|
* Far above the core collection ceiling, and deliberately so. A tracked or dirty
|
|
@@ -82,24 +82,24 @@ var MAX_PATH_DEPTH = 64;
|
|
|
82
82
|
* verb on it.
|
|
83
83
|
*/
|
|
84
84
|
var MAX_INVENTORY_PATHS = 1e5;
|
|
85
|
-
/**
|
|
85
|
+
/** Caps the characters one caller-supplied upstream endpoint may carry. */
|
|
86
86
|
var MAX_ENDPOINT_LENGTH = 2048;
|
|
87
|
-
/**
|
|
87
|
+
/** Caps the characters one repository branch may carry. */
|
|
88
88
|
var MAX_BRANCH_LENGTH = 255;
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Caps the simultaneous upstream requests.
|
|
91
91
|
*
|
|
92
92
|
* @remarks
|
|
93
93
|
* A ceiling rather than a default: the reader picks what it opens by, and this
|
|
94
94
|
* is only what a caller may raise it to.
|
|
95
95
|
*/
|
|
96
96
|
var MAX_UPSTREAM_CONCURRENCY = 64;
|
|
97
|
-
/**
|
|
97
|
+
/** Caps the retries one upstream request may be given after a transport fault. */
|
|
98
98
|
var MAX_UPSTREAM_RETRIES = 5;
|
|
99
|
-
/**
|
|
99
|
+
/** Caps the timeout one upstream request may be given, in milliseconds. */
|
|
100
100
|
var MAX_UPSTREAM_TIMEOUT = 3e5;
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Reserves the metadata name a staged vendored host writes at its own root.
|
|
103
103
|
*
|
|
104
104
|
* @remarks
|
|
105
105
|
* The one name a vendored file may never claim, because the staged root holds
|
|
@@ -108,14 +108,65 @@ var MAX_UPSTREAM_TIMEOUT = 3e5;
|
|
|
108
108
|
* than repeating a literal that only agrees by inspection.
|
|
109
109
|
*/
|
|
110
110
|
var MANIFEST_NAME = "manifest.json";
|
|
111
|
+
/** Holds the raw content host a repository read addresses when a caller names none. */
|
|
112
|
+
var DEFAULT_REPOSITORY_BASE = "https://raw.githubusercontent.com";
|
|
113
|
+
/** Holds the registry a version read addresses when a caller names none. */
|
|
114
|
+
var DEFAULT_REGISTRY_BASE = "https://registry.npmjs.org";
|
|
115
|
+
/** Holds the repository branch a raw content read addresses when a caller names none. */
|
|
116
|
+
var DEFAULT_BRANCH = "main";
|
|
117
|
+
/**
|
|
118
|
+
* Sets the timeout one upstream request is given when a caller names none, in milliseconds.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* Both endpoints open at this value; a caller raises either one on its own up to
|
|
122
|
+
* {@link MAX_UPSTREAM_TIMEOUT}.
|
|
123
|
+
*/
|
|
124
|
+
var DEFAULT_UPSTREAM_TIMEOUT = 1e4;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the simultaneous upstream requests a reader opens with, under
|
|
127
|
+
* {@link MAX_UPSTREAM_CONCURRENCY}.
|
|
128
|
+
*/
|
|
129
|
+
var DEFAULT_UPSTREAM_CONCURRENCY = 6;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the retries one upstream request is given when a caller names none.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* A read is attempted once by default. Retrying is the caller's decision because
|
|
135
|
+
* a repeated request costs the upstream host, not this package.
|
|
136
|
+
*/
|
|
137
|
+
var DEFAULT_UPSTREAM_RETRIES = 0;
|
|
138
|
+
/**
|
|
139
|
+
* Names the npm scope and repository owner the fleet's packages and sources are
|
|
140
|
+
* published under.
|
|
141
|
+
*/
|
|
142
|
+
var ORKESTREL_SCOPE = "orkestrel";
|
|
143
|
+
/**
|
|
144
|
+
* Names the repository this package's own vendored files are served from.
|
|
145
|
+
*
|
|
146
|
+
* @remarks
|
|
147
|
+
* This package's bare name, stated rather than derived, because the reader has no
|
|
148
|
+
* manifest to read it out of and one raw content host serves both the fleet's
|
|
149
|
+
* guides and these files.
|
|
150
|
+
*/
|
|
151
|
+
var SCAFFOLD_REPOSITORY = "scaffold";
|
|
152
|
+
/** Holds the note a release carries when its packument names no readable latest version. */
|
|
153
|
+
var UNREADABLE_VERSION_NOTE = "the answer carries no readable latest version";
|
|
154
|
+
/**
|
|
155
|
+
* Names the media type that selects the registry's abbreviated packument.
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* Sent on exactly the reads that want a version, so the registry answers with the
|
|
159
|
+
* smaller document instead of the whole packument.
|
|
160
|
+
*/
|
|
161
|
+
var PACKUMENT_MEDIA_TYPE = "application/vnd.npm.install-v1+json";
|
|
111
162
|
//#endregion
|
|
112
163
|
//#region src/server/validators.ts
|
|
113
164
|
/**
|
|
114
|
-
*
|
|
165
|
+
* Narrows a value to a path naming a location on this host.
|
|
115
166
|
*
|
|
116
167
|
* @param value - The candidate host path.
|
|
117
|
-
* @returns
|
|
118
|
-
* portable across the supported filesystems.
|
|
168
|
+
* @returns True if the value is a bounded absolute or relative path whose every segment
|
|
169
|
+
* is portable across the supported filesystems; false otherwise.
|
|
119
170
|
*
|
|
120
171
|
* @remarks
|
|
121
172
|
* The counterpart to the core path law, not a copy of it. A target directory and
|
|
@@ -172,7 +223,7 @@ function isFilesystemPath(value) {
|
|
|
172
223
|
});
|
|
173
224
|
}
|
|
174
225
|
/**
|
|
175
|
-
*
|
|
226
|
+
* Narrows a value to one exact SHA-256 digest.
|
|
176
227
|
*
|
|
177
228
|
* @remarks
|
|
178
229
|
* The identity a vendored host manifest and a write precondition are both stated
|
|
@@ -189,10 +240,11 @@ function isFilesystemPath(value) {
|
|
|
189
240
|
*/
|
|
190
241
|
var isDigest = stringOf({ pattern: DIGEST_PATTERN });
|
|
191
242
|
/**
|
|
192
|
-
*
|
|
243
|
+
* Narrows a value to a working-tree inventory within the limit one target may report.
|
|
193
244
|
*
|
|
194
245
|
* @param value - The candidate inventory.
|
|
195
|
-
* @returns
|
|
246
|
+
* @returns True if the value is an array of no more than
|
|
247
|
+
* `MAX_INVENTORY_PATHS` items; false otherwise.
|
|
196
248
|
*
|
|
197
249
|
* @remarks
|
|
198
250
|
* Compose this ahead of an element guard exactly as the core collection guard is
|
|
@@ -214,7 +266,7 @@ function isInventory(value) {
|
|
|
214
266
|
return holds(() => isArray(value) && value.length <= 1e5);
|
|
215
267
|
}
|
|
216
268
|
/**
|
|
217
|
-
*
|
|
269
|
+
* Narrows a value to a bounded upstream endpoint.
|
|
218
270
|
*
|
|
219
271
|
* @remarks
|
|
220
272
|
* Length only. Which schemes and hosts an endpoint may name is the reader's law,
|
|
@@ -226,7 +278,7 @@ var isEndpoint = stringOf({
|
|
|
226
278
|
max: MAX_ENDPOINT_LENGTH
|
|
227
279
|
});
|
|
228
280
|
/**
|
|
229
|
-
*
|
|
281
|
+
* Narrows a value to a Git branch the repository endpoint accepts.
|
|
230
282
|
*
|
|
231
283
|
* @remarks
|
|
232
284
|
* A branch reaches the repository URL's path, so the syntax is closed rather than
|
|
@@ -246,7 +298,7 @@ var isBranch = stringOf({
|
|
|
246
298
|
pattern: BRANCH_PATTERN
|
|
247
299
|
});
|
|
248
300
|
/**
|
|
249
|
-
*
|
|
301
|
+
* Narrows a value to a per-request timeout in milliseconds.
|
|
250
302
|
*
|
|
251
303
|
* @remarks
|
|
252
304
|
* A whole number of milliseconds, at least one and no more than
|
|
@@ -255,7 +307,7 @@ var isBranch = stringOf({
|
|
|
255
307
|
*/
|
|
256
308
|
var isTimeout = andOf(isInteger, boundsOf(1, MAX_UPSTREAM_TIMEOUT));
|
|
257
309
|
/**
|
|
258
|
-
*
|
|
310
|
+
* Narrows a value to a bounded list of `@orkestrel` package names.
|
|
259
311
|
*
|
|
260
312
|
* @remarks
|
|
261
313
|
* Composed from the core collection and dependency-name guards rather than
|
|
@@ -272,7 +324,7 @@ var isTimeout = andOf(isInteger, boundsOf(1, MAX_UPSTREAM_TIMEOUT));
|
|
|
272
324
|
*/
|
|
273
325
|
var isDependencyNames = andOf(isCollection, arrayOf(isDependencyName));
|
|
274
326
|
/**
|
|
275
|
-
*
|
|
327
|
+
* Narrows a value to a bounded list of target-relative paths.
|
|
276
328
|
*
|
|
277
329
|
* @remarks
|
|
278
330
|
* Composed from the core collection and path guards rather than restated, so
|
|
@@ -289,10 +341,10 @@ var isDependencyNames = andOf(isCollection, arrayOf(isDependencyName));
|
|
|
289
341
|
* ```
|
|
290
342
|
*/
|
|
291
343
|
var isPaths = andOf(isCollection, arrayOf(isPath));
|
|
292
|
-
/**
|
|
344
|
+
/** Narrows a value to a bounded list of declared runtime dependencies. */
|
|
293
345
|
var isDependencies = andOf(isCollection, arrayOf(isDependency));
|
|
294
346
|
/**
|
|
295
|
-
*
|
|
347
|
+
* Narrows a value to one {@link ManifestRegionSet}.
|
|
296
348
|
*
|
|
297
349
|
* @remarks
|
|
298
350
|
* The whole closed record a manifest-writing method accepts, so a caller
|
|
@@ -314,12 +366,12 @@ var isManifestRegionSet = recordOf({
|
|
|
314
366
|
}),
|
|
315
367
|
scripts: andOf(isCollection, arrayOf(isManifestScript))
|
|
316
368
|
});
|
|
317
|
-
/**
|
|
369
|
+
/** Narrows a value to a bounded list of fetched guide mirrors. */
|
|
318
370
|
var isMirrors = andOf(isCollection, arrayOf(isMirror));
|
|
319
|
-
/**
|
|
371
|
+
/** Narrows a value to a bounded list of fleet catalog rows. */
|
|
320
372
|
var isCatalogEntries = andOf(isCollection, arrayOf(isCatalogEntry));
|
|
321
373
|
/**
|
|
322
|
-
*
|
|
374
|
+
* Narrows a value to one {@link ManifestEntry}.
|
|
323
375
|
*
|
|
324
376
|
* @remarks
|
|
325
377
|
* Both paths are measured by the core path law, because a vendored host's
|
|
@@ -346,7 +398,7 @@ var isManifestEntry = recordOf({
|
|
|
346
398
|
digest: isDigest
|
|
347
399
|
});
|
|
348
400
|
/**
|
|
349
|
-
*
|
|
401
|
+
* Narrows a value to one {@link HostManifest}.
|
|
350
402
|
*
|
|
351
403
|
* @remarks
|
|
352
404
|
* The manifest is read from a directory a caller named, so it is the least
|
|
@@ -359,7 +411,7 @@ var isHostManifest = recordOf({
|
|
|
359
411
|
digest: isDigest
|
|
360
412
|
});
|
|
361
413
|
/**
|
|
362
|
-
*
|
|
414
|
+
* Narrows a value to one {@link Host}.
|
|
363
415
|
*
|
|
364
416
|
* @remarks
|
|
365
417
|
* A whole vendored host handed in as a value is as untrusted as one read from a
|
|
@@ -385,7 +437,7 @@ var isHost = recordOf({
|
|
|
385
437
|
bytes: isSnapshot
|
|
386
438
|
});
|
|
387
439
|
/**
|
|
388
|
-
*
|
|
440
|
+
* Narrows a value to a {@link Worktree}.
|
|
389
441
|
*
|
|
390
442
|
* @remarks
|
|
391
443
|
* Both path lists are target-relative, so both are measured by the core path
|
|
@@ -406,7 +458,7 @@ var isWorktree = recordOf({
|
|
|
406
458
|
dirty: andOf(isInventory, arrayOf(isPath))
|
|
407
459
|
});
|
|
408
460
|
/**
|
|
409
|
-
*
|
|
461
|
+
* Narrows a value to the materializer's initial listener record.
|
|
410
462
|
*
|
|
411
463
|
* @remarks
|
|
412
464
|
* Every event is optional and every declared value is a function. A key outside
|
|
@@ -421,7 +473,7 @@ var isMaterializerHooks = recordOf({
|
|
|
421
473
|
destroy: isFunction
|
|
422
474
|
}, true);
|
|
423
475
|
/**
|
|
424
|
-
*
|
|
476
|
+
* Narrows a value to {@link MaterializerOptions}.
|
|
425
477
|
*
|
|
426
478
|
* @remarks
|
|
427
479
|
* `host` admits both representations of one vendored root: a directory path and
|
|
@@ -443,7 +495,7 @@ var isMaterializerOptions = recordOf({
|
|
|
443
495
|
error: isFunction
|
|
444
496
|
}, true);
|
|
445
497
|
/**
|
|
446
|
-
*
|
|
498
|
+
* Narrows a value to the upstream reader's initial listener record.
|
|
447
499
|
*
|
|
448
500
|
* @remarks
|
|
449
501
|
* Closed to the reader's own events for the same reason the materializer's
|
|
@@ -457,7 +509,7 @@ var isUpstreamHooks = recordOf({
|
|
|
457
509
|
destroy: isFunction
|
|
458
510
|
}, true);
|
|
459
511
|
/**
|
|
460
|
-
*
|
|
512
|
+
* Narrows a value to {@link UpstreamOptions}.
|
|
461
513
|
*
|
|
462
514
|
* @remarks
|
|
463
515
|
* Each grouped endpoint is closed to its own leaves, so a setting written under
|
|
@@ -496,10 +548,10 @@ var isUpstreamOptions = recordOf({
|
|
|
496
548
|
//#endregion
|
|
497
549
|
//#region src/server/helpers.ts
|
|
498
550
|
/**
|
|
499
|
-
*
|
|
551
|
+
* Tests whether a caught filesystem error reports an absent path.
|
|
500
552
|
*
|
|
501
553
|
* @param error - The caught value.
|
|
502
|
-
* @returns `
|
|
554
|
+
* @returns True if `error` is an `Error` whose `code` is exactly `ENOENT`; false otherwise.
|
|
503
555
|
*
|
|
504
556
|
* @remarks
|
|
505
557
|
* The one place absence is told apart from failure. Every read here answers
|
|
@@ -519,10 +571,10 @@ function matchesMissingPath(error) {
|
|
|
519
571
|
return holds(() => isError(error) && Reflect.get(error, "code") === "ENOENT");
|
|
520
572
|
}
|
|
521
573
|
/**
|
|
522
|
-
*
|
|
574
|
+
* Tests whether a path addresses a target's own repository metadata.
|
|
523
575
|
*
|
|
524
576
|
* @param path - The path to classify; either separator is read.
|
|
525
|
-
* @returns
|
|
577
|
+
* @returns True if the path is `.git` or sits beneath it; false otherwise.
|
|
526
578
|
*
|
|
527
579
|
* @remarks
|
|
528
580
|
* The one home of the `.git` membership rule, read in either direction. A target
|
|
@@ -544,10 +596,10 @@ function matchesGitPath(path) {
|
|
|
544
596
|
return /(?:^|\/)\.git(?:\/|$)/i.test(path.replaceAll("\\", "/"));
|
|
545
597
|
}
|
|
546
598
|
/**
|
|
547
|
-
*
|
|
599
|
+
* Tests whether a target-relative path is one no verb may delete.
|
|
548
600
|
*
|
|
549
601
|
* @param path - The target-relative path to classify.
|
|
550
|
-
* @returns
|
|
602
|
+
* @returns True if the path must survive every verb this package runs; false otherwise.
|
|
551
603
|
*
|
|
552
604
|
* @remarks
|
|
553
605
|
* The deletion deny-list, stated as a rule over paths rather than as a list of
|
|
@@ -576,10 +628,10 @@ function matchesProtectedPath(path) {
|
|
|
576
628
|
return normalized.startsWith("src/") || normalized.startsWith("app/");
|
|
577
629
|
}
|
|
578
630
|
/**
|
|
579
|
-
*
|
|
631
|
+
* Tests whether a path names local configuration or a credential.
|
|
580
632
|
*
|
|
581
633
|
* @param path - The path to classify; either separator is read.
|
|
582
|
-
* @returns
|
|
634
|
+
* @returns True if the path must never be copied into a vendored host; false otherwise.
|
|
583
635
|
*
|
|
584
636
|
* @remarks
|
|
585
637
|
* The vendoring deny-list. A host root is staged from a real checkout, so the
|
|
@@ -604,10 +656,10 @@ function matchesSensitivePath(path) {
|
|
|
604
656
|
return /(?:^|\/)(?:(?:\.ssh|\.aws|\.azure|\.docker|\.kube|\.gnupg|\.env(?:\.[^/]*)?)(?:\/|$)|(?:\.npmrc|\.pypirc|\.netrc|\.git-credentials|settings\.local\.json|auth\.json|credentials(?:\.json)?|application_default_credentials\.json|id_rsa|id_ed25519|kubeconfig)$|\.config\/(?:gh|gcloud)(?:\/|$)|\.local\/share\/keyrings(?:\/|$)|[^/]*service-account[^/]*\.json$|[^/]*\.(?:jks|key|p12|pem|pfx|pkcs12)$)/i.test(normalized);
|
|
605
657
|
}
|
|
606
658
|
/**
|
|
607
|
-
*
|
|
659
|
+
* Tests whether a vendored path is one a target receives executable.
|
|
608
660
|
*
|
|
609
661
|
* @param path - The target-relative path to classify; either separator is read.
|
|
610
|
-
* @returns
|
|
662
|
+
* @returns True if the path is declared in {@link EXECUTABLE_PATHS}; false otherwise.
|
|
611
663
|
*
|
|
612
664
|
* @remarks
|
|
613
665
|
* The declaration is the whole answer, and deliberately so. Reading the staging
|
|
@@ -630,7 +682,7 @@ function matchesExecutablePath(path) {
|
|
|
630
682
|
return EXECUTABLE_PATHS.includes(path.replaceAll("\\", "/"));
|
|
631
683
|
}
|
|
632
684
|
/**
|
|
633
|
-
*
|
|
685
|
+
* Projects a target-relative path to the storage name a vendored host holds it under.
|
|
634
686
|
*
|
|
635
687
|
* @param path - The target-relative path the file is written to.
|
|
636
688
|
* @returns The storage name beneath the host root.
|
|
@@ -658,7 +710,7 @@ function pathToStorage(path) {
|
|
|
658
710
|
return segments.map((segment) => segment.startsWith(".") ? segment.slice(1) : segment).join("/");
|
|
659
711
|
}
|
|
660
712
|
/**
|
|
661
|
-
*
|
|
713
|
+
* Computes the SHA-256 digest of text.
|
|
662
714
|
*
|
|
663
715
|
* @param content - The text to digest.
|
|
664
716
|
* @returns Sixty-four lowercase hexadecimal digits.
|
|
@@ -701,7 +753,7 @@ function hexToDigest(hex) {
|
|
|
701
753
|
return createHash("sha256").update(Buffer.from(hex, "hex")).digest("hex");
|
|
702
754
|
}
|
|
703
755
|
/**
|
|
704
|
-
*
|
|
756
|
+
* Computes the digest of a vendored host's declared membership.
|
|
705
757
|
*
|
|
706
758
|
* @param entries - The ordered file membership declarations.
|
|
707
759
|
* @param roots - The ordered directory membership declarations.
|
|
@@ -734,11 +786,11 @@ function computeManifestDigest(entries, roots) {
|
|
|
734
786
|
}));
|
|
735
787
|
}
|
|
736
788
|
/**
|
|
737
|
-
*
|
|
789
|
+
* Tests whether a path is a physical file this package will read or replace.
|
|
738
790
|
*
|
|
739
791
|
* @param path - The resolved host path to inspect, without following links.
|
|
740
|
-
* @returns
|
|
741
|
-
* elsewhere.
|
|
792
|
+
* @returns True if the path is a regular file that is neither a link nor hard-linked
|
|
793
|
+
* elsewhere; false otherwise.
|
|
742
794
|
*
|
|
743
795
|
* @remarks
|
|
744
796
|
* The link tests are the point. A symbolic link is a path pointing somewhere
|
|
@@ -758,11 +810,11 @@ function isPhysicalFile(path) {
|
|
|
758
810
|
return status.success && status.value.isFile() && !status.value.isSymbolicLink() && status.value.nlink === 1;
|
|
759
811
|
}
|
|
760
812
|
/**
|
|
761
|
-
*
|
|
813
|
+
* Tests whether a path is a physical file with exact on-disk casing.
|
|
762
814
|
*
|
|
763
815
|
* @param path - The host path to inspect segment by segment.
|
|
764
|
-
* @returns
|
|
765
|
-
*
|
|
816
|
+
* @returns True if the path is a physical file whose requested segments exactly match
|
|
817
|
+
* the names each parent directory stores; false otherwise.
|
|
766
818
|
*
|
|
767
819
|
* @remarks
|
|
768
820
|
* A direct file lookup follows the host's case-folding rules on Windows and
|
|
@@ -796,10 +848,10 @@ function isExactCaseFile(path) {
|
|
|
796
848
|
return true;
|
|
797
849
|
}
|
|
798
850
|
/**
|
|
799
|
-
*
|
|
851
|
+
* Tests whether a path is a physical directory this package will read or write into.
|
|
800
852
|
*
|
|
801
853
|
* @param path - The resolved host path to inspect, without following links.
|
|
802
|
-
* @returns
|
|
854
|
+
* @returns True if the path is a directory that is not a link; false otherwise.
|
|
803
855
|
*
|
|
804
856
|
* @remarks
|
|
805
857
|
* A junction and a directory symbolic link both report as directories after
|
|
@@ -819,7 +871,7 @@ function isPhysicalDirectory(path) {
|
|
|
819
871
|
return status.success && status.value.isDirectory() && !status.value.isSymbolicLink();
|
|
820
872
|
}
|
|
821
873
|
/**
|
|
822
|
-
*
|
|
874
|
+
* Computes the SHA-256 digest of one file's exact bytes.
|
|
823
875
|
*
|
|
824
876
|
* @param path - The resolved host path to digest.
|
|
825
877
|
* @returns The digest, or `undefined` when the path is not a physical file, is
|
|
@@ -865,7 +917,7 @@ function computeFileDigest(path) {
|
|
|
865
917
|
return read.success ? read.value : void 0;
|
|
866
918
|
}
|
|
867
919
|
/**
|
|
868
|
-
*
|
|
920
|
+
* Resolves a path through the real filesystem, keeping the part that does not exist yet.
|
|
869
921
|
*
|
|
870
922
|
* @param path - The absolute or relative host path to resolve.
|
|
871
923
|
* @returns The lexical resolution of `path`, with its existing prefix then
|
|
@@ -941,7 +993,7 @@ function resolveRealPath(path) {
|
|
|
941
993
|
}
|
|
942
994
|
}
|
|
943
995
|
/**
|
|
944
|
-
*
|
|
996
|
+
* Resolves a root-relative path and refuses one that leaves its root.
|
|
945
997
|
*
|
|
946
998
|
* @param root - The containing host directory.
|
|
947
999
|
* @param path - The portable root-relative path.
|
|
@@ -989,11 +1041,11 @@ function resolveContainedPath(root, path) {
|
|
|
989
1041
|
return destination;
|
|
990
1042
|
}
|
|
991
1043
|
/**
|
|
992
|
-
*
|
|
1044
|
+
* Tests whether a target is safe to write a fresh workspace into.
|
|
993
1045
|
*
|
|
994
1046
|
* @param target - The candidate target directory.
|
|
995
|
-
* @returns
|
|
996
|
-
*
|
|
1047
|
+
* @returns True if the target is absent, empty, or holds nothing but its own `.git`
|
|
1048
|
+
* directory; false otherwise.
|
|
997
1049
|
*
|
|
998
1050
|
* @remarks
|
|
999
1051
|
* The green-field law. A checkout of an empty repository is where a new
|
|
@@ -1027,7 +1079,7 @@ function isVacant(target) {
|
|
|
1027
1079
|
return read.success && read.value;
|
|
1028
1080
|
}
|
|
1029
1081
|
/**
|
|
1030
|
-
*
|
|
1082
|
+
* Lists a directory's files as sorted root-relative paths.
|
|
1031
1083
|
*
|
|
1032
1084
|
* @param root - The directory to inventory.
|
|
1033
1085
|
* @returns Every descendant file as a `/`-separated root-relative path, in
|
|
@@ -1119,7 +1171,7 @@ function listFiles(root) {
|
|
|
1119
1171
|
return files.sort();
|
|
1120
1172
|
}
|
|
1121
1173
|
/**
|
|
1122
|
-
*
|
|
1174
|
+
* Lists a directory's descendant directories as sorted root-relative paths.
|
|
1123
1175
|
*
|
|
1124
1176
|
* @param root - The directory to inventory.
|
|
1125
1177
|
* @returns Every descendant directory as a `/`-separated root-relative path, in
|
|
@@ -1301,7 +1353,7 @@ function pruneEmptiedDirectories(target, removed) {
|
|
|
1301
1353
|
return pruned;
|
|
1302
1354
|
}
|
|
1303
1355
|
/**
|
|
1304
|
-
*
|
|
1356
|
+
* Reads one contained file as its exact bytes in lowercase hexadecimal.
|
|
1305
1357
|
*
|
|
1306
1358
|
* @param root - The containing host directory.
|
|
1307
1359
|
* @param path - The portable root-relative file path.
|
|
@@ -1361,7 +1413,7 @@ function readFileHex(root, path, limit = MAX_ARTIFACT_BYTES) {
|
|
|
1361
1413
|
return read.success ? read.value : void 0;
|
|
1362
1414
|
}
|
|
1363
1415
|
/**
|
|
1364
|
-
*
|
|
1416
|
+
* Reads one contained file as bounded UTF-8 text.
|
|
1365
1417
|
*
|
|
1366
1418
|
* @param root - The containing host directory.
|
|
1367
1419
|
* @param path - The portable root-relative file path.
|
|
@@ -1391,7 +1443,7 @@ function readFileText(root, path, limit = MAX_ARTIFACT_BYTES) {
|
|
|
1391
1443
|
return decoded.success ? decoded.value : void 0;
|
|
1392
1444
|
}
|
|
1393
1445
|
/**
|
|
1394
|
-
*
|
|
1446
|
+
* Reads a target's current bytes at the paths a plan claims.
|
|
1395
1447
|
*
|
|
1396
1448
|
* @param target - The target directory to read.
|
|
1397
1449
|
* @param paths - The plan-relative paths to probe.
|
|
@@ -1406,7 +1458,7 @@ function readFileText(root, path, limit = MAX_ARTIFACT_BYTES) {
|
|
|
1406
1458
|
* @remarks
|
|
1407
1459
|
* The one door from a real directory into the vocabulary an audit compares in.
|
|
1408
1460
|
* Absence is omission rather than an empty value, because core reads a missing
|
|
1409
|
-
* key as a missing destination and an empty string as a present directory;
|
|
1461
|
+
* key as a missing destination and an empty string as a present directory;
|
|
1410
1462
|
* they are different verdicts. A path that is there but unreadable throws instead
|
|
1411
1463
|
* of being omitted, because omission would report it as missing and a repair
|
|
1412
1464
|
* would then overwrite whatever is actually sitting there.
|
|
@@ -1458,7 +1510,7 @@ function readSnapshot(target, paths) {
|
|
|
1458
1510
|
return snapshot;
|
|
1459
1511
|
}
|
|
1460
1512
|
/**
|
|
1461
|
-
*
|
|
1513
|
+
* Reads a vendored host's manifest, when it carries one.
|
|
1462
1514
|
*
|
|
1463
1515
|
* @param host - The vendored host root to read.
|
|
1464
1516
|
* @param name - The root-relative manifest path. Default: `manifest.json`.
|
|
@@ -1512,7 +1564,7 @@ function readHostManifest(host, name = MANIFEST_NAME) {
|
|
|
1512
1564
|
* @param root - The vendored host root. Default: the installed package's
|
|
1513
1565
|
* vendored root, resolved from this module's location.
|
|
1514
1566
|
* @returns The verified manifest and the exact bytes of every declared entry.
|
|
1515
|
-
* @throws `ScaffoldError('TARGET',
|
|
1567
|
+
* @throws `ScaffoldError('TARGET', …)` when the root is not a readable physical
|
|
1516
1568
|
* directory, its manifest is absent or unreadable, the manifest does not verify,
|
|
1517
1569
|
* or a declared file is unreadable or misses its digest.
|
|
1518
1570
|
*
|
|
@@ -1556,7 +1608,7 @@ function readHostFloor(root) {
|
|
|
1556
1608
|
};
|
|
1557
1609
|
}
|
|
1558
1610
|
/**
|
|
1559
|
-
*
|
|
1611
|
+
* Derives one vendored-host manifest entry from a file in a checkout.
|
|
1560
1612
|
*
|
|
1561
1613
|
* @param destination - The target-relative path the file is written to.
|
|
1562
1614
|
* @param source - The resolved host path the bytes are read from.
|
|
@@ -1593,7 +1645,7 @@ function readManifestEntry(destination, source) {
|
|
|
1593
1645
|
};
|
|
1594
1646
|
}
|
|
1595
1647
|
/**
|
|
1596
|
-
*
|
|
1648
|
+
* Assembles a whole vendored host from live files and the installed floor.
|
|
1597
1649
|
*
|
|
1598
1650
|
* @param files - The host-owned vendored files read from the repository, one
|
|
1599
1651
|
* row per path.
|
|
@@ -1607,13 +1659,10 @@ function readManifestEntry(destination, source) {
|
|
|
1607
1659
|
* restates it. The host surface contributes one baseline: a fill carries live
|
|
1608
1660
|
* bytes for every path that surface writes, or it is nothing. A row that failed,
|
|
1609
1661
|
* went missing, names an undeclared path, or leaves a host-owned path absent
|
|
1610
|
-
* answers `undefined`.
|
|
1611
|
-
* floor bytes
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
* destination keeps its floor bytes here, claimed or not, and a fill that carries
|
|
1615
|
-
* no row for one is complete rather than spoiled. One `Host` can therefore carry
|
|
1616
|
-
* live host bytes beside floor bytes without mixing baselines within a surface.
|
|
1662
|
+
* answers `undefined`. Every {@link isFloorPath} destination keeps the installed
|
|
1663
|
+
* floor's bytes instead, claimed or not, so a fill carrying no row for one is
|
|
1664
|
+
* complete rather than spoiled. One `Host` can therefore carry live host bytes
|
|
1665
|
+
* beside floor bytes without mixing baselines within a surface.
|
|
1617
1666
|
*
|
|
1618
1667
|
* The emitted entries keep the release's own order and its storage and
|
|
1619
1668
|
* executable declarations, and carry digests recomputed over the bytes the fill
|
|
@@ -1638,12 +1687,12 @@ function filesToHost(files, floor) {
|
|
|
1638
1687
|
const held = /* @__PURE__ */ new Map();
|
|
1639
1688
|
for (const file of files) {
|
|
1640
1689
|
if (file.lookup !== "found" || !declared.has(file.path)) return void 0;
|
|
1641
|
-
if (!
|
|
1690
|
+
if (!isFloorPath(file.path)) held.set(file.path, file.hex);
|
|
1642
1691
|
}
|
|
1643
1692
|
const entries = [];
|
|
1644
1693
|
const bytes = {};
|
|
1645
1694
|
for (const entry of floor.manifest.entries) {
|
|
1646
|
-
const hex =
|
|
1695
|
+
const hex = isFloorPath(entry.destination) ? floor.bytes[entry.destination] : held.get(entry.destination);
|
|
1647
1696
|
if (hex === void 0) return void 0;
|
|
1648
1697
|
entries.push({
|
|
1649
1698
|
storage: entry.storage,
|
|
@@ -1663,7 +1712,7 @@ function filesToHost(files, floor) {
|
|
|
1663
1712
|
};
|
|
1664
1713
|
}
|
|
1665
1714
|
/**
|
|
1666
|
-
*
|
|
1715
|
+
* Stages the named destinations of a value host into a private root.
|
|
1667
1716
|
*
|
|
1668
1717
|
* @param host - The host whose bytes are written, keyed by destination.
|
|
1669
1718
|
* @param root - The private directory to fill; it must already be a directory
|
|
@@ -1735,7 +1784,7 @@ function stageBytes(host, root, destinations) {
|
|
|
1735
1784
|
return staged;
|
|
1736
1785
|
}
|
|
1737
1786
|
/**
|
|
1738
|
-
*
|
|
1787
|
+
* Stages a vendored host root from a real checkout.
|
|
1739
1788
|
*
|
|
1740
1789
|
* @param checkout - The checkout the vendored paths are read from.
|
|
1741
1790
|
* @param host - The vendored host root to fill; it must be absent or empty.
|
|
@@ -1970,7 +2019,7 @@ function stageInventory(checkout, path) {
|
|
|
1970
2019
|
return staged.value;
|
|
1971
2020
|
}
|
|
1972
2021
|
/**
|
|
1973
|
-
*
|
|
2022
|
+
* Captures one directory's physical identity.
|
|
1974
2023
|
*
|
|
1975
2024
|
* @param path - The resolved directory path to capture.
|
|
1976
2025
|
* @returns The anchor, or `undefined` when the path is not a physical directory.
|
|
@@ -1998,11 +2047,11 @@ function readAnchor(path) {
|
|
|
1998
2047
|
};
|
|
1999
2048
|
}
|
|
2000
2049
|
/**
|
|
2001
|
-
*
|
|
2050
|
+
* Tests whether a captured directory is still the same directory.
|
|
2002
2051
|
*
|
|
2003
2052
|
* @param anchor - The identity captured earlier.
|
|
2004
|
-
* @returns
|
|
2005
|
-
*
|
|
2053
|
+
* @returns True if the path still holds a physical directory of that exact device and
|
|
2054
|
+
* inode; false otherwise.
|
|
2006
2055
|
*
|
|
2007
2056
|
* @remarks
|
|
2008
2057
|
* This binds location rather than history. `true` means the path still resolves
|
|
@@ -2026,7 +2075,7 @@ function matchesAnchor(anchor) {
|
|
|
2026
2075
|
return current !== void 0 && current.device === anchor.device && current.inode === anchor.inode;
|
|
2027
2076
|
}
|
|
2028
2077
|
/**
|
|
2029
|
-
*
|
|
2078
|
+
* Captures what one destination holds before a write.
|
|
2030
2079
|
*
|
|
2031
2080
|
* @param path - The resolved destination path to capture.
|
|
2032
2081
|
* @returns The expectation, or `undefined` when the destination is a link or a
|
|
@@ -2075,10 +2124,10 @@ function readExpectation(path) {
|
|
|
2075
2124
|
};
|
|
2076
2125
|
}
|
|
2077
2126
|
/**
|
|
2078
|
-
*
|
|
2127
|
+
* Tests whether a destination still holds what was captured of it.
|
|
2079
2128
|
*
|
|
2080
2129
|
* @param expectation - The state captured earlier.
|
|
2081
|
-
* @returns
|
|
2130
|
+
* @returns True if re-reading the destination produces that same state; false otherwise.
|
|
2082
2131
|
*
|
|
2083
2132
|
* @remarks
|
|
2084
2133
|
* Compared field for field against a fresh {@link readExpectation}, so an
|
|
@@ -2100,11 +2149,11 @@ function matchesExpectation(expectation) {
|
|
|
2100
2149
|
return current.shape === expectation.shape && current.device === expectation.device && current.inode === expectation.inode && current.modified === expectation.modified && current.size === expectation.size && current.digest === expectation.digest;
|
|
2101
2150
|
}
|
|
2102
2151
|
/**
|
|
2103
|
-
*
|
|
2152
|
+
* Tests whether a destination still matches the narrower state a caller observed.
|
|
2104
2153
|
*
|
|
2105
2154
|
* @param precondition - The caller-observed state the write is held to.
|
|
2106
|
-
* @returns
|
|
2107
|
-
*
|
|
2155
|
+
* @returns True if the destination is absent as stated, or holds a physical file whose
|
|
2156
|
+
* bytes digest to the stated value; false otherwise.
|
|
2108
2157
|
*
|
|
2109
2158
|
* @remarks
|
|
2110
2159
|
* Narrower than {@link matchesExpectation} on purpose. A caller observed bytes,
|
|
@@ -2130,7 +2179,7 @@ function matchesPrecondition(precondition) {
|
|
|
2130
2179
|
//#endregion
|
|
2131
2180
|
//#region src/server/WriteTransaction.ts
|
|
2132
2181
|
/**
|
|
2133
|
-
*
|
|
2182
|
+
* Represents one staged, reversible mutation of one target directory.
|
|
2134
2183
|
*
|
|
2135
2184
|
* @remarks
|
|
2136
2185
|
* The transaction owns a private root beside the target — a sibling directory on
|
|
@@ -2206,7 +2255,7 @@ var WriteTransaction = class {
|
|
|
2206
2255
|
#taken = [];
|
|
2207
2256
|
#open = true;
|
|
2208
2257
|
/**
|
|
2209
|
-
*
|
|
2258
|
+
* Opens a transaction over one target directory.
|
|
2210
2259
|
*
|
|
2211
2260
|
* @param target - The directory every path is written beneath.
|
|
2212
2261
|
* @param paths - Every target-relative path this transaction may touch.
|
|
@@ -2280,20 +2329,20 @@ var WriteTransaction = class {
|
|
|
2280
2329
|
});
|
|
2281
2330
|
}
|
|
2282
2331
|
}
|
|
2283
|
-
/**
|
|
2332
|
+
/** Names the resolved directory every path is written beneath. */
|
|
2284
2333
|
get target() {
|
|
2285
2334
|
return this.#target;
|
|
2286
2335
|
}
|
|
2287
|
-
/**
|
|
2336
|
+
/** Reports what each destination held when the transaction opened, in path order. */
|
|
2288
2337
|
get expectations() {
|
|
2289
2338
|
return [...this.#expectations.values()];
|
|
2290
2339
|
}
|
|
2291
|
-
/**
|
|
2340
|
+
/** Reports whether the transaction can still be committed or discarded. */
|
|
2292
2341
|
get open() {
|
|
2293
2342
|
return this.#open;
|
|
2294
2343
|
}
|
|
2295
2344
|
/**
|
|
2296
|
-
*
|
|
2345
|
+
* Stages one text file.
|
|
2297
2346
|
*
|
|
2298
2347
|
* @param path - The target-relative path to write.
|
|
2299
2348
|
* @param content - The exact UTF-8 text the destination must hold.
|
|
@@ -2324,7 +2373,7 @@ var WriteTransaction = class {
|
|
|
2324
2373
|
this.#staged.push(path);
|
|
2325
2374
|
}
|
|
2326
2375
|
/**
|
|
2327
|
-
*
|
|
2376
|
+
* Stages one byte-for-byte copy of a file that already exists on this host.
|
|
2328
2377
|
*
|
|
2329
2378
|
* @param path - The target-relative path to write.
|
|
2330
2379
|
* @param source - The resolved absolute path to copy the bytes from.
|
|
@@ -2363,7 +2412,7 @@ var WriteTransaction = class {
|
|
|
2363
2412
|
this.#staged.push(path);
|
|
2364
2413
|
}
|
|
2365
2414
|
/**
|
|
2366
|
-
*
|
|
2415
|
+
* Establishes one directory inside the target, one segment at a time.
|
|
2367
2416
|
*
|
|
2368
2417
|
* @param path - The target-relative directory to establish.
|
|
2369
2418
|
* @returns The directory's identity and every segment this call created.
|
|
@@ -2391,7 +2440,7 @@ var WriteTransaction = class {
|
|
|
2391
2440
|
return result;
|
|
2392
2441
|
}
|
|
2393
2442
|
/**
|
|
2394
|
-
*
|
|
2443
|
+
* Marks one file for deletion at commit.
|
|
2395
2444
|
*
|
|
2396
2445
|
* @param path - The target-relative file to delete.
|
|
2397
2446
|
* @returns Nothing.
|
|
@@ -2408,7 +2457,7 @@ var WriteTransaction = class {
|
|
|
2408
2457
|
this.#taken.push(path);
|
|
2409
2458
|
}
|
|
2410
2459
|
/**
|
|
2411
|
-
*
|
|
2460
|
+
* Promotes every staged file and takes every marked file, or rolls the whole call back.
|
|
2412
2461
|
*
|
|
2413
2462
|
* @returns Every target-relative path whose destination changed: the files
|
|
2414
2463
|
* promoted, then the directories established, then the files taken.
|
|
@@ -2461,7 +2510,7 @@ var WriteTransaction = class {
|
|
|
2461
2510
|
];
|
|
2462
2511
|
}
|
|
2463
2512
|
/**
|
|
2464
|
-
*
|
|
2513
|
+
* Abandons the transaction and removes everything it created.
|
|
2465
2514
|
*
|
|
2466
2515
|
* @returns Nothing.
|
|
2467
2516
|
* @throws {@link ScaffoldError} coded `WRITE` when residue could not be
|
|
@@ -2638,7 +2687,7 @@ var WriteTransaction = class {
|
|
|
2638
2687
|
//#endregion
|
|
2639
2688
|
//#region src/server/Materializer.ts
|
|
2640
2689
|
/**
|
|
2641
|
-
*
|
|
2690
|
+
* Represents the mutation spine: read the vendored host, re-derive the target, stage, swap.
|
|
2642
2691
|
*
|
|
2643
2692
|
* @remarks
|
|
2644
2693
|
* Every verb runs the same steps. It snapshots each caller-supplied value
|
|
@@ -2682,9 +2731,7 @@ var WriteTransaction = class {
|
|
|
2682
2731
|
* materializer.destroy()
|
|
2683
2732
|
* ```
|
|
2684
2733
|
*/
|
|
2685
|
-
var Materializer = class
|
|
2686
|
-
static #opening = "<!-- orkestrel:catalog -->";
|
|
2687
|
-
static #closing = "<!-- /orkestrel:catalog -->";
|
|
2734
|
+
var Materializer = class {
|
|
2688
2735
|
#emitter;
|
|
2689
2736
|
#root;
|
|
2690
2737
|
#value;
|
|
@@ -2692,7 +2739,7 @@ var Materializer = class Materializer {
|
|
|
2692
2739
|
#entries;
|
|
2693
2740
|
#destroyed = false;
|
|
2694
2741
|
/**
|
|
2695
|
-
*
|
|
2742
|
+
* Constructs a materializer over one vendored host root.
|
|
2696
2743
|
*
|
|
2697
2744
|
* @param options - The vendored host, in either representation, the initial
|
|
2698
2745
|
* listeners, and the listener-error handler.
|
|
@@ -2746,12 +2793,12 @@ var Materializer = class Materializer {
|
|
|
2746
2793
|
if (read.value !== void 0) this.#reconcile(read.value, root);
|
|
2747
2794
|
}
|
|
2748
2795
|
}
|
|
2749
|
-
/**
|
|
2796
|
+
/** Exposes the materializer's observation channel. */
|
|
2750
2797
|
get emitter() {
|
|
2751
2798
|
return this.#emitter;
|
|
2752
2799
|
}
|
|
2753
2800
|
/**
|
|
2754
|
-
*
|
|
2801
|
+
* Compares a plan with a target through the vendored host that will repair it.
|
|
2755
2802
|
*
|
|
2756
2803
|
* @param plan - The compiled plan to compare.
|
|
2757
2804
|
* @param target - The directory to inspect.
|
|
@@ -2782,7 +2829,7 @@ var Materializer = class Materializer {
|
|
|
2782
2829
|
return this.#derive(accepted, directory);
|
|
2783
2830
|
}
|
|
2784
2831
|
/**
|
|
2785
|
-
*
|
|
2832
|
+
* Writes a plan into a vacant target.
|
|
2786
2833
|
*
|
|
2787
2834
|
* @param plan - The compiled plan to write.
|
|
2788
2835
|
* @param target - The directory to write into; it must hold nothing the plan would collide with.
|
|
@@ -2809,7 +2856,7 @@ var Materializer = class Materializer {
|
|
|
2809
2856
|
return this.#apply(directory, hydrated.artifacts, empty, [], []);
|
|
2810
2857
|
}
|
|
2811
2858
|
/**
|
|
2812
|
-
*
|
|
2859
|
+
* Writes a plan into an existing target, guided by an audit of it.
|
|
2813
2860
|
*
|
|
2814
2861
|
* @param plan - The compiled plan to write.
|
|
2815
2862
|
* @param audit - The preview returned by this materializer's `audit` method.
|
|
@@ -2855,7 +2902,7 @@ var Materializer = class Materializer {
|
|
|
2855
2902
|
return this.#apply(directory, writes, [], skipped, preconditions);
|
|
2856
2903
|
}
|
|
2857
2904
|
/**
|
|
2858
|
-
*
|
|
2905
|
+
* Writes fetched dependency guides to their local mirrors.
|
|
2859
2906
|
*
|
|
2860
2907
|
* @param mirrors - The fetched guides; each carries the local bytes its write is held to.
|
|
2861
2908
|
* @param target - The directory to write into.
|
|
@@ -2898,7 +2945,7 @@ var Materializer = class Materializer {
|
|
|
2898
2945
|
return this.#apply(directory, writes, [], skipped, preconditions);
|
|
2899
2946
|
}
|
|
2900
2947
|
/**
|
|
2901
|
-
*
|
|
2948
|
+
* Rewrites the marker-bounded package table in the target's catalog agent file.
|
|
2902
2949
|
*
|
|
2903
2950
|
* @param entries - The published packages the table must list.
|
|
2904
2951
|
* @param target - The directory to write into.
|
|
@@ -2921,7 +2968,7 @@ var Materializer = class Materializer {
|
|
|
2921
2968
|
return this.#rewrite(directory, CATALOG_AGENT_PATH, MAX_ARTIFACT_BYTES, this.#recatalog(accepted));
|
|
2922
2969
|
}
|
|
2923
2970
|
/**
|
|
2924
|
-
*
|
|
2971
|
+
* Rewrites the manifest regions the caller names in the target's manifest.
|
|
2925
2972
|
*
|
|
2926
2973
|
* @param regions - The dependency ranges and script values the manifest must declare.
|
|
2927
2974
|
* @param target - The directory to write into.
|
|
@@ -2951,7 +2998,7 @@ var Materializer = class Materializer {
|
|
|
2951
2998
|
return this.#rewrite(directory, "package.json", MAX_MANIFEST_BYTES, this.#redeclare(accepted));
|
|
2952
2999
|
}
|
|
2953
3000
|
/**
|
|
2954
|
-
* Re-
|
|
3001
|
+
* Re-derives and deletes the tracked files the plan does not own.
|
|
2955
3002
|
*
|
|
2956
3003
|
* @param plan - The compiled plan that decides which paths are foreign.
|
|
2957
3004
|
* @param audit - The preview returned by this materializer's `audit` method; it must agree with the candidate set this call re-derives.
|
|
@@ -3015,7 +3062,7 @@ var Materializer = class Materializer {
|
|
|
3015
3062
|
return this.#purge(directory, removals, skipped, preconditions);
|
|
3016
3063
|
}
|
|
3017
3064
|
/**
|
|
3018
|
-
*
|
|
3065
|
+
* Tears the materializer down. Every later call throws, and teardown is idempotent.
|
|
3019
3066
|
*
|
|
3020
3067
|
* @returns Nothing.
|
|
3021
3068
|
*
|
|
@@ -3061,7 +3108,7 @@ var Materializer = class Materializer {
|
|
|
3061
3108
|
host: root,
|
|
3062
3109
|
error: walked.error
|
|
3063
3110
|
});
|
|
3064
|
-
const declared = [...manifest.entries.map((entry) => entry.storage),
|
|
3111
|
+
const declared = [...manifest.entries.map((entry) => entry.storage), MANIFEST_NAME].sort();
|
|
3065
3112
|
const stored = walked.value;
|
|
3066
3113
|
if (stored.length !== declared.length || stored.some((name, index) => name !== declared[index])) throw this.#error("TARGET", "The vendored host does not store what its manifest declares.", {
|
|
3067
3114
|
host: root,
|
|
@@ -3139,11 +3186,7 @@ var Materializer = class Materializer {
|
|
|
3139
3186
|
let budget = remaining;
|
|
3140
3187
|
for (const entry of matched) {
|
|
3141
3188
|
const path = this.#remap(artifact, entry.destination);
|
|
3142
|
-
if (
|
|
3143
|
-
expanded.push(this.#presence(artifact, path, entry.destination));
|
|
3144
|
-
continue;
|
|
3145
|
-
}
|
|
3146
|
-
if (isDeferredPath(path)) {
|
|
3189
|
+
if (isRetainedPath(path)) {
|
|
3147
3190
|
expanded.push(this.#presence(artifact, path, entry.destination));
|
|
3148
3191
|
continue;
|
|
3149
3192
|
}
|
|
@@ -3161,8 +3204,7 @@ var Materializer = class Materializer {
|
|
|
3161
3204
|
source
|
|
3162
3205
|
});
|
|
3163
3206
|
if (isPhysicalFile(full)) {
|
|
3164
|
-
if (
|
|
3165
|
-
if (isDeferredPath(artifact.path)) return [this.#presence(artifact, artifact.path, source)];
|
|
3207
|
+
if (isRetainedPath(artifact.path)) return [this.#presence(artifact, artifact.path, source)];
|
|
3166
3208
|
return [this.#hydrated(artifact, artifact.path, source, this.#readRoot(source, remaining))];
|
|
3167
3209
|
}
|
|
3168
3210
|
if (!isPhysicalDirectory(full)) throw this.#error("TARGET", `The host source at ${source} is not a readable file.`, {
|
|
@@ -3174,11 +3216,7 @@ var Materializer = class Materializer {
|
|
|
3174
3216
|
for (const name of listFiles(full)) {
|
|
3175
3217
|
const path = `${artifact.path}/${name}`;
|
|
3176
3218
|
const destination = `${source}/${name}`;
|
|
3177
|
-
if (
|
|
3178
|
-
expanded.push(this.#presence(artifact, path, destination));
|
|
3179
|
-
continue;
|
|
3180
|
-
}
|
|
3181
|
-
if (isDeferredPath(path)) {
|
|
3219
|
+
if (isRetainedPath(path)) {
|
|
3182
3220
|
expanded.push(this.#presence(artifact, path, destination));
|
|
3183
3221
|
continue;
|
|
3184
3222
|
}
|
|
@@ -3487,10 +3525,10 @@ var Materializer = class Materializer {
|
|
|
3487
3525
|
...rows
|
|
3488
3526
|
].map((row) => `| ${row.map((cell, column) => cell.padEnd(widths[column] ?? cell.length)).join(" | ")} |`).join("\n");
|
|
3489
3527
|
return (text) => {
|
|
3490
|
-
const opening = text.indexOf(
|
|
3491
|
-
const closing = text.indexOf(
|
|
3528
|
+
const opening = text.indexOf(CATALOG_OPENING_MARKER);
|
|
3529
|
+
const closing = text.indexOf(CATALOG_CLOSING_MARKER, opening + CATALOG_OPENING_MARKER.length);
|
|
3492
3530
|
if (opening < 0 || closing < 0) throw this.#error("TARGET", "The catalog agent file carries no marked region.", { path: CATALOG_AGENT_PATH });
|
|
3493
|
-
return `${text.slice(0, opening +
|
|
3531
|
+
return `${text.slice(0, opening + CATALOG_OPENING_MARKER.length)}\n\n${table}\n\n${text.slice(closing)}`;
|
|
3494
3532
|
};
|
|
3495
3533
|
}
|
|
3496
3534
|
#cell(note) {
|
|
@@ -3527,7 +3565,7 @@ var Materializer = class Materializer {
|
|
|
3527
3565
|
//#endregion
|
|
3528
3566
|
//#region src/server/Upstream.ts
|
|
3529
3567
|
/**
|
|
3530
|
-
*
|
|
3568
|
+
* Represents the reading spine: one bounded, unauthenticated, redirect-free request per answer.
|
|
3531
3569
|
*
|
|
3532
3570
|
* @remarks
|
|
3533
3571
|
* This is the package's only network reader, and it never writes. Every call
|
|
@@ -3556,7 +3594,7 @@ var Materializer = class Materializer {
|
|
|
3556
3594
|
* flight instead of waiting for it.
|
|
3557
3595
|
*
|
|
3558
3596
|
* The allowance is threaded through the private reads as a mutable
|
|
3559
|
-
*
|
|
3597
|
+
* {@link ReadAllowance} carrier rather than held on the instance, because
|
|
3560
3598
|
* concurrent calls each own their own budget and must not spend each other's.
|
|
3561
3599
|
*
|
|
3562
3600
|
* @example
|
|
@@ -3568,17 +3606,7 @@ var Materializer = class Materializer {
|
|
|
3568
3606
|
* upstream.destroy()
|
|
3569
3607
|
* ```
|
|
3570
3608
|
*/
|
|
3571
|
-
var Upstream = class
|
|
3572
|
-
static #defaultRepository = "https://raw.githubusercontent.com";
|
|
3573
|
-
static #defaultRegistry = "https://registry.npmjs.org";
|
|
3574
|
-
static #defaultBranch = "main";
|
|
3575
|
-
static #defaultTimeout = 1e4;
|
|
3576
|
-
static #defaultConcurrency = 6;
|
|
3577
|
-
static #defaultRetries = 0;
|
|
3578
|
-
static #scope = "orkestrel";
|
|
3579
|
-
static #vendor = "scaffold";
|
|
3580
|
-
static #unreadable = "the answer carries no readable latest version";
|
|
3581
|
-
static #packument = "application/vnd.npm.install-v1+json";
|
|
3609
|
+
var Upstream = class {
|
|
3582
3610
|
#emitter;
|
|
3583
3611
|
#repositoryBase;
|
|
3584
3612
|
#repositoryBranch;
|
|
@@ -3592,7 +3620,7 @@ var Upstream = class Upstream {
|
|
|
3592
3620
|
#controller = new AbortController();
|
|
3593
3621
|
#destroyed = false;
|
|
3594
3622
|
/**
|
|
3595
|
-
*
|
|
3623
|
+
* Constructs a reader over one raw content host and one registry.
|
|
3596
3624
|
*
|
|
3597
3625
|
* @param options - The endpoints, the request bounds, the initial
|
|
3598
3626
|
* listeners, and the listener-error handler.
|
|
@@ -3616,22 +3644,22 @@ var Upstream = class Upstream {
|
|
|
3616
3644
|
...options?.on === void 0 ? {} : { on: options.on },
|
|
3617
3645
|
...options?.error === void 0 ? {} : { error: options.error }
|
|
3618
3646
|
});
|
|
3619
|
-
this.#repositoryBase = this.#endpoint(options?.repository?.base ??
|
|
3620
|
-
this.#repositoryBranch = options?.repository?.branch ??
|
|
3621
|
-
this.#repositoryTimeout = options?.repository?.timeout ??
|
|
3622
|
-
this.#registryBase = this.#endpoint(options?.registry?.base ??
|
|
3623
|
-
this.#registryTimeout = options?.registry?.timeout ??
|
|
3624
|
-
this.#concurrency = options?.concurrency ??
|
|
3625
|
-
this.#retries = options?.retries ??
|
|
3647
|
+
this.#repositoryBase = this.#endpoint(options?.repository?.base ?? "https://raw.githubusercontent.com", "repository");
|
|
3648
|
+
this.#repositoryBranch = options?.repository?.branch ?? "main";
|
|
3649
|
+
this.#repositoryTimeout = options?.repository?.timeout ?? 1e4;
|
|
3650
|
+
this.#registryBase = this.#endpoint(options?.registry?.base ?? "https://registry.npmjs.org", "registry");
|
|
3651
|
+
this.#registryTimeout = options?.registry?.timeout ?? 1e4;
|
|
3652
|
+
this.#concurrency = options?.concurrency ?? 6;
|
|
3653
|
+
this.#retries = options?.retries ?? 0;
|
|
3626
3654
|
this.#limit = options?.limit ?? MAX_REGISTRY_BYTES;
|
|
3627
3655
|
this.#budget = options?.budget ?? MAX_TOTAL_REGISTRY_BYTES;
|
|
3628
3656
|
}
|
|
3629
|
-
/**
|
|
3657
|
+
/** Exposes the upstream reader's observation channel. */
|
|
3630
3658
|
get emitter() {
|
|
3631
3659
|
return this.#emitter;
|
|
3632
3660
|
}
|
|
3633
3661
|
/**
|
|
3634
|
-
*
|
|
3662
|
+
* Looks up the newest release each declared range admits.
|
|
3635
3663
|
*
|
|
3636
3664
|
* @param dependencies - The declared dependencies to look up.
|
|
3637
3665
|
* @returns One release verdict per dependency, in input order.
|
|
@@ -3662,7 +3690,7 @@ var Upstream = class Upstream {
|
|
|
3662
3690
|
return this.#gather(accepted, (dependency) => this.#release(dependency, allowance));
|
|
3663
3691
|
}
|
|
3664
3692
|
/**
|
|
3665
|
-
*
|
|
3693
|
+
* Fetches each named package's guide, beside the local mirror it answers for.
|
|
3666
3694
|
*
|
|
3667
3695
|
* @param names - The packages to fetch: the target's declared set, or the whole organization.
|
|
3668
3696
|
* @param current - The target's local mirrors as exact bytes, keyed by mirror path.
|
|
@@ -3696,7 +3724,7 @@ var Upstream = class Upstream {
|
|
|
3696
3724
|
return this.#gather(accepted, (name) => this.#mirror(name, observed, allowance));
|
|
3697
3725
|
}
|
|
3698
3726
|
/**
|
|
3699
|
-
*
|
|
3727
|
+
* Reads each named vendored file from the repository, beside the target bytes it answers for.
|
|
3700
3728
|
*
|
|
3701
3729
|
* @param paths - The target-relative vendored paths to read.
|
|
3702
3730
|
* @param current - The target files as exact bytes, keyed by the same paths.
|
|
@@ -3744,7 +3772,7 @@ var Upstream = class Upstream {
|
|
|
3744
3772
|
return this.#gather(accepted, (path) => this.#file(path, inventory, observed, allowance));
|
|
3745
3773
|
}
|
|
3746
3774
|
/**
|
|
3747
|
-
*
|
|
3775
|
+
* Catalogs the published fleet from the registry's organization package list.
|
|
3748
3776
|
*
|
|
3749
3777
|
* @returns One row per published package, sorted by name.
|
|
3750
3778
|
* @throws {@link ScaffoldError} coded `FETCH` when the organization package
|
|
@@ -3777,7 +3805,7 @@ var Upstream = class Upstream {
|
|
|
3777
3805
|
return this.#gather(names, (name) => this.#entry(name, allowance));
|
|
3778
3806
|
}
|
|
3779
3807
|
/**
|
|
3780
|
-
*
|
|
3808
|
+
* Tears the reader down, aborting every request in flight. Teardown is idempotent.
|
|
3781
3809
|
*
|
|
3782
3810
|
* @returns Nothing.
|
|
3783
3811
|
*
|
|
@@ -3820,7 +3848,7 @@ var Upstream = class Upstream {
|
|
|
3820
3848
|
return parsed.href.replace(/\/+$/u, "");
|
|
3821
3849
|
}
|
|
3822
3850
|
async #release(dependency, allowance) {
|
|
3823
|
-
const outcome = await this.#readWithRetries(this.#registryURL(dependency.name), this.#registryTimeout, allowance,
|
|
3851
|
+
const outcome = await this.#readWithRetries(this.#registryURL(dependency.name), this.#registryTimeout, allowance, PACKUMENT_MEDIA_TYPE);
|
|
3824
3852
|
const latest = outcome.lookup === "found" ? this.#releaseVersion(outcome.content, dependency.range) : void 0;
|
|
3825
3853
|
const tagged = outcome.lookup === "found" ? this.#latest(outcome.content) : void 0;
|
|
3826
3854
|
const major = tagged === void 0 ? void 0 : extractVersion(tagged)?.[0];
|
|
@@ -3828,7 +3856,7 @@ var Upstream = class Upstream {
|
|
|
3828
3856
|
name: dependency.name,
|
|
3829
3857
|
range: dependency.range,
|
|
3830
3858
|
lookup: outcome.lookup === "found" ? "unmatched" : outcome.lookup,
|
|
3831
|
-
note: outcome.lookup === "found" ?
|
|
3859
|
+
note: outcome.lookup === "found" ? UNREADABLE_VERSION_NOTE : outcome.note,
|
|
3832
3860
|
...major === void 0 ? {} : { major }
|
|
3833
3861
|
} : {
|
|
3834
3862
|
name: dependency.name,
|
|
@@ -3955,7 +3983,7 @@ var Upstream = class Upstream {
|
|
|
3955
3983
|
};
|
|
3956
3984
|
}
|
|
3957
3985
|
async #entry(name, allowance) {
|
|
3958
|
-
const outcome = await this.#readWithRetries(this.#registryURL(name), this.#registryTimeout, allowance,
|
|
3986
|
+
const outcome = await this.#readWithRetries(this.#registryURL(name), this.#registryTimeout, allowance, PACKUMENT_MEDIA_TYPE);
|
|
3959
3987
|
const version = outcome.lookup === "found" ? this.#latest(outcome.content) : void 0;
|
|
3960
3988
|
if (version !== void 0) return {
|
|
3961
3989
|
name,
|
|
@@ -3966,7 +3994,7 @@ var Upstream = class Upstream {
|
|
|
3966
3994
|
return {
|
|
3967
3995
|
name,
|
|
3968
3996
|
lookup: outcome.lookup === "found" ? "unmatched" : outcome.lookup,
|
|
3969
|
-
note: outcome.lookup === "found" ?
|
|
3997
|
+
note: outcome.lookup === "found" ? UNREADABLE_VERSION_NOTE : outcome.note
|
|
3970
3998
|
};
|
|
3971
3999
|
}
|
|
3972
4000
|
#edges(content, version) {
|
|
@@ -3992,7 +4020,7 @@ var Upstream = class Upstream {
|
|
|
3992
4020
|
return edges;
|
|
3993
4021
|
}
|
|
3994
4022
|
async #packages(allowance) {
|
|
3995
|
-
const url = `${this.#registryBase}/-/org/${
|
|
4023
|
+
const url = `${this.#registryBase}/-/org/${ORKESTREL_SCOPE}/package`;
|
|
3996
4024
|
const outcome = await this.#readWithRetries(url, this.#registryTimeout, allowance);
|
|
3997
4025
|
if (outcome.lookup !== "found") throw this.#error("FETCH", `The organization package list at ${url} produced no answer.`, {
|
|
3998
4026
|
url,
|
|
@@ -4041,11 +4069,11 @@ var Upstream = class Upstream {
|
|
|
4041
4069
|
#guideURL(name) {
|
|
4042
4070
|
const branch = this.#encode(this.#repositoryBranch);
|
|
4043
4071
|
const repository = encodeURIComponent(name.slice(name.lastIndexOf("/") + 1));
|
|
4044
|
-
return `${this.#repositoryBase}/${
|
|
4072
|
+
return `${this.#repositoryBase}/${ORKESTREL_SCOPE}/${repository}/refs/heads/${branch}/${nameToGuide(name)}`;
|
|
4045
4073
|
}
|
|
4046
4074
|
#vendorURL(path) {
|
|
4047
4075
|
const branch = this.#encode(this.#repositoryBranch);
|
|
4048
|
-
return `${this.#repositoryBase}/${
|
|
4076
|
+
return `${this.#repositoryBase}/${ORKESTREL_SCOPE}/${SCAFFOLD_REPOSITORY}/refs/heads/${branch}/${this.#encode(path)}`;
|
|
4049
4077
|
}
|
|
4050
4078
|
#encode(path) {
|
|
4051
4079
|
return path.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
@@ -4262,6 +4290,6 @@ var Upstream = class Upstream {
|
|
|
4262
4290
|
}
|
|
4263
4291
|
};
|
|
4264
4292
|
//#endregion
|
|
4265
|
-
export { BRANCH_PATTERN, DIGEST_PATTERN, DRIVE_PATTERN, INVALID_SEGMENT_CHARACTER_PATTERN, MANIFEST_NAME, MAX_BRANCH_LENGTH, MAX_ENDPOINT_LENGTH, MAX_INVENTORY_PATHS, MAX_PATH_DEPTH, MAX_PATH_SEGMENT_BYTES, MAX_UPSTREAM_CONCURRENCY, MAX_UPSTREAM_RETRIES, MAX_UPSTREAM_TIMEOUT, Materializer, RESERVED_SEGMENT_PATTERN, Upstream, WriteTransaction, computeDigest, computeFileDigest, computeManifestDigest, filesToHost, hexToDigest, isBranch, isCatalogEntries, isDependencies, isDependencyNames, isDigest, isEndpoint, isExactCaseFile, isFilesystemPath, isHost, isHostManifest, isInventory, isManifestEntry, isManifestRegionSet, isMaterializerHooks, isMaterializerOptions, isMirrors, isPaths, isPhysicalDirectory, isPhysicalFile, isTimeout, isUpstreamHooks, isUpstreamOptions, isVacant, isWorktree, listCanonPaths, listDirectories, listFiles, matchesAnchor, matchesExecutablePath, matchesExpectation, matchesGitPath, matchesMissingPath, matchesPrecondition, matchesProtectedPath, matchesSensitivePath, pathToStorage, pruneEmptiedDirectories, readAnchor, readExpectation, readFileHex, readFileText, readHostFloor, readHostManifest, readManifestEntry, readSnapshot, resolveContainedPath, resolveRealPath, stageBytes, stageHost, stageInventory };
|
|
4293
|
+
export { BRANCH_PATTERN, DEFAULT_BRANCH, DEFAULT_REGISTRY_BASE, DEFAULT_REPOSITORY_BASE, DEFAULT_UPSTREAM_CONCURRENCY, DEFAULT_UPSTREAM_RETRIES, DEFAULT_UPSTREAM_TIMEOUT, DIGEST_PATTERN, DRIVE_PATTERN, INVALID_SEGMENT_CHARACTER_PATTERN, MANIFEST_NAME, MAX_BRANCH_LENGTH, MAX_ENDPOINT_LENGTH, MAX_INVENTORY_PATHS, MAX_PATH_DEPTH, MAX_PATH_SEGMENT_BYTES, MAX_UPSTREAM_CONCURRENCY, MAX_UPSTREAM_RETRIES, MAX_UPSTREAM_TIMEOUT, Materializer, ORKESTREL_SCOPE, PACKUMENT_MEDIA_TYPE, RESERVED_SEGMENT_PATTERN, SCAFFOLD_REPOSITORY, UNREADABLE_VERSION_NOTE, Upstream, WriteTransaction, computeDigest, computeFileDigest, computeManifestDigest, filesToHost, hexToDigest, isBranch, isCatalogEntries, isDependencies, isDependencyNames, isDigest, isEndpoint, isExactCaseFile, isFilesystemPath, isHost, isHostManifest, isInventory, isManifestEntry, isManifestRegionSet, isMaterializerHooks, isMaterializerOptions, isMirrors, isPaths, isPhysicalDirectory, isPhysicalFile, isTimeout, isUpstreamHooks, isUpstreamOptions, isVacant, isWorktree, listCanonPaths, listDirectories, listFiles, matchesAnchor, matchesExecutablePath, matchesExpectation, matchesGitPath, matchesMissingPath, matchesPrecondition, matchesProtectedPath, matchesSensitivePath, pathToStorage, pruneEmptiedDirectories, readAnchor, readExpectation, readFileHex, readFileText, readHostFloor, readHostManifest, readManifestEntry, readSnapshot, resolveContainedPath, resolveRealPath, stageBytes, stageHost, stageInventory };
|
|
4266
4294
|
|
|
4267
4295
|
//# sourceMappingURL=index.js.map
|