@jini-ai/devops 0.5.4 → 0.5.6
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/CHANGELOG.md +10 -0
- package/dist/agent-jobs/jobs.js +33 -26
- package/dist/agent-jobs/node.d.ts +14 -0
- package/dist/agent-jobs/node.js +8 -3
- package/dist/checks/coverage/diff.js +21 -10
- package/dist/checks/coverage/disk.js +20 -13
- package/dist/checks/coverage/integrity.js +44 -39
- package/dist/checks/hardwiring-node.js +89 -73
- package/dist/checks/hardwiring.d.ts +5 -0
- package/dist/checks/hardwiring.js +75 -48
- package/dist/checks/node.js +6 -1
- package/dist/checks/published-types/index.js +30 -15
- package/dist/core/artifact-store.d.ts +35 -0
- package/dist/core/artifact-store.js +2 -0
- package/dist/deploy/host-kit.d.ts +3 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/node.d.ts +10 -0
- package/dist/deploy/node.js +11 -3
- package/dist/deploy/reachability.d.ts +2 -2
- package/dist/deploy/reachability.js +164 -117
- package/dist/dns/approval.d.ts +61 -0
- package/dist/dns/approval.js +48 -0
- package/dist/dns/contract.d.ts +206 -0
- package/dist/dns/contract.js +30 -0
- package/dist/dns/delegation.d.ts +36 -0
- package/dist/dns/delegation.js +44 -0
- package/dist/dns/index.d.ts +15 -0
- package/dist/dns/index.js +15 -0
- package/dist/dns/manual.d.ts +28 -0
- package/dist/dns/manual.js +140 -0
- package/dist/dns/node/index.d.ts +8 -0
- package/dist/dns/node/index.js +8 -0
- package/dist/dns/node/resolver.d.ts +35 -0
- package/dist/dns/node/resolver.js +155 -0
- package/dist/dns/node/udp.d.ts +27 -0
- package/dist/dns/node/udp.js +39 -0
- package/dist/dns/node/wire.d.ts +36 -0
- package/dist/dns/node/wire.js +90 -0
- package/dist/dns/plan.d.ts +34 -0
- package/dist/dns/plan.js +242 -0
- package/dist/dns/records.d.ts +67 -0
- package/dist/dns/records.js +144 -0
- package/dist/dns/registry.d.ts +26 -0
- package/dist/dns/registry.js +59 -0
- package/dist/dns/spf.d.ts +23 -0
- package/dist/dns/spf.js +35 -0
- package/dist/dns/verify.d.ts +61 -0
- package/dist/dns/verify.js +109 -0
- package/dist/local-dev/index.js +36 -20
- package/dist/packaging/electron/archive.d.ts +7 -4
- package/dist/packaging/electron/archive.js +33 -26
- package/dist/packaging/electron/imports.d.ts +2 -2
- package/dist/packaging/electron/imports.js +39 -23
- package/dist/packaging/electron/staging.js +68 -47
- package/dist/source-control/commit.js +36 -18
- package/dist/source-control/registry.js +95 -59
- package/dist/static-export/contracts.d.ts +9 -0
- package/dist/static-export/node-adapters.js +26 -17
- package/dist/static-export/runner.js +202 -65
- package/dist/static-export/transforms.d.ts +8 -1
- package/dist/static-export/transforms.js +44 -23
- package/package.json +23 -6
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
+
/** Parse diagnostics can quote source literals; location is sufficient and does not expose secrets. */
|
|
3
|
+
export function syntaxError({ tree, file }, _options = {}) {
|
|
4
|
+
const [first] = tree.parseDiagnostics;
|
|
5
|
+
if (!first)
|
|
6
|
+
return undefined;
|
|
7
|
+
const line = tree.getLineAndCharacterOfPosition(first.start ?? 0).line + 1;
|
|
8
|
+
return new Error(`Cannot parse ${file}: syntax error at line ${line}.`);
|
|
9
|
+
}
|
|
2
10
|
export const HARDWIRING_RULES = [
|
|
3
11
|
'HW1-env-default', 'HW2-vendor-adapter', 'HW3-module-state', 'HW4-injected-fetch',
|
|
4
12
|
'HW5-jini-export', 'HW6-boot-default', 'HW7-public-react', 'HW8-provider-url', 'HW9-plugin-import',
|
|
@@ -10,12 +18,9 @@ export const HARDWIRING_RULES = [
|
|
|
10
18
|
export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
11
19
|
function parse({ file, source }, _options = {}) {
|
|
12
20
|
const tree = c.createSourceFile(file, source, c.ScriptTarget.Latest, true, /\.[jt]sx$/.test(file) ? c.ScriptKind.TSX : /\.[cm]?js$/.test(file) ? c.ScriptKind.JS : c.ScriptKind.TS);
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
// Diagnostics can quote source literals; location is sufficient and does not expose secrets.
|
|
17
|
-
throw new Error(`Cannot parse ${file}: syntax error at line ${line}.`);
|
|
18
|
-
}
|
|
21
|
+
const failure = syntaxError({ tree, file });
|
|
22
|
+
if (failure)
|
|
23
|
+
throw failure;
|
|
19
24
|
return tree;
|
|
20
25
|
}
|
|
21
26
|
function member(node, name) {
|
|
@@ -37,22 +42,27 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
37
42
|
// `import { type X }` can emit `import {}` under verbatimModuleSyntax: still a load.
|
|
38
43
|
return node.importClause?.isTypeOnly === true;
|
|
39
44
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
45
|
+
function kept(literal, typeOnly, includeTypeOnly) {
|
|
46
|
+
return includeTypeOnly || !typeOnly ? literal : undefined;
|
|
42
47
|
}
|
|
43
|
-
function
|
|
48
|
+
function declarationLiteral(node, includeTypeOnly) {
|
|
44
49
|
if (c.isImportDeclaration(node))
|
|
45
|
-
return
|
|
46
|
-
if (c.isExportDeclaration(node))
|
|
47
|
-
return
|
|
48
|
-
if (c.
|
|
49
|
-
|
|
50
|
-
return load ? node.arguments[0] : undefined;
|
|
51
|
-
}
|
|
52
|
-
if (c.isImportEqualsDeclaration(node) && (includeTypeOnly || !node.isTypeOnly) && c.isExternalModuleReference(node.moduleReference))
|
|
53
|
-
return node.moduleReference.expression;
|
|
50
|
+
return kept(node.moduleSpecifier, erasedImport(node), includeTypeOnly);
|
|
51
|
+
if (c.isExportDeclaration(node) && node.moduleSpecifier)
|
|
52
|
+
return kept(node.moduleSpecifier, node.isTypeOnly, includeTypeOnly);
|
|
53
|
+
if (c.isImportEqualsDeclaration(node) && c.isExternalModuleReference(node.moduleReference))
|
|
54
|
+
return kept(node.moduleReference.expression, node.isTypeOnly, includeTypeOnly);
|
|
54
55
|
return undefined;
|
|
55
56
|
}
|
|
57
|
+
function loadCallLiteral(node) {
|
|
58
|
+
if (!c.isCallExpression(node))
|
|
59
|
+
return undefined;
|
|
60
|
+
const load = node.expression.kind === c.SyntaxKind.ImportKeyword || (c.isIdentifier(node.expression) && node.expression.text === 'require');
|
|
61
|
+
return load ? node.arguments[0] : undefined;
|
|
62
|
+
}
|
|
63
|
+
function importLiteral(node, includeTypeOnly) {
|
|
64
|
+
return loadCallLiteral(node) ?? declarationLiteral(node, includeTypeOnly);
|
|
65
|
+
}
|
|
56
66
|
function imports({ tree, includeTypeOnly = false }, _options = {}) {
|
|
57
67
|
const found = [];
|
|
58
68
|
function visit(node) {
|
|
@@ -128,24 +138,25 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
128
138
|
}
|
|
129
139
|
return true;
|
|
130
140
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
/** BindingName is Identifier | ObjectBindingPattern | ArrayBindingPattern; array holes are OmittedExpressions. */
|
|
142
|
+
function bindsFetch(name) {
|
|
143
|
+
if (c.isIdentifier(name))
|
|
144
|
+
return name.text === 'fetch';
|
|
145
|
+
return name.elements.some((e) => c.isBindingElement(e) && bindsFetch(e.name));
|
|
146
|
+
}
|
|
147
|
+
function scopeBindsFetch(scope) {
|
|
148
|
+
if (c.isFunctionLike(scope))
|
|
149
|
+
return scope.parameters.some((p) => bindsFetch(p.name));
|
|
150
|
+
if (c.isCatchClause(scope))
|
|
151
|
+
return Boolean(scope.variableDeclaration && bindsFetch(scope.variableDeclaration.name));
|
|
152
|
+
if (c.isBlock(scope) || c.isSourceFile(scope))
|
|
153
|
+
return scope.statements.some(statementBindsFetch);
|
|
136
154
|
return false;
|
|
137
155
|
}
|
|
138
156
|
function hasLocalFetch(node) {
|
|
139
|
-
for (let scope = node.parent; scope; scope = scope.parent)
|
|
140
|
-
if (
|
|
157
|
+
for (let scope = node.parent; scope; scope = scope.parent)
|
|
158
|
+
if (scopeBindsFetch(scope))
|
|
141
159
|
return true;
|
|
142
|
-
if (c.isCatchClause(scope) && scope.variableDeclaration && bindsFetch(scope.variableDeclaration.name))
|
|
143
|
-
return true;
|
|
144
|
-
if (!c.isBlock(scope) && !c.isSourceFile(scope))
|
|
145
|
-
continue;
|
|
146
|
-
if (scope.statements.some(statementBindsFetch))
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
160
|
return false;
|
|
150
161
|
}
|
|
151
162
|
function statementBindsFetch(statement) {
|
|
@@ -219,16 +230,21 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
219
230
|
return false;
|
|
220
231
|
return /https:\/\/api\./i.test(node.text);
|
|
221
232
|
}
|
|
233
|
+
/** Resolution runs for every edge, even without a plugin identity: a host resolver may fail closed on unresolved code. */
|
|
234
|
+
function targetPlugin(input, specifier) {
|
|
235
|
+
const target = input.resolveImport?.(specifier, input.file);
|
|
236
|
+
return target ? input.pluginIdentity?.(target) : undefined;
|
|
237
|
+
}
|
|
222
238
|
function inspectImports(input, tree, refs) {
|
|
223
239
|
const found = [];
|
|
224
240
|
const plugin = input.pluginIdentity?.(input.file);
|
|
241
|
+
const vendorOwner = adapter(input.file);
|
|
225
242
|
for (const ref of refs) {
|
|
226
|
-
if (vendor(ref.specifier)
|
|
243
|
+
if (!vendorOwner && vendor(ref.specifier))
|
|
227
244
|
found.push(violation(tree, ref.node, 'HW2-vendor-adapter', 'Driver/vendor dependency belongs in an adapter, kernel or provider.', ref.specifier));
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
found.push(violation(tree, ref.node, 'HW9-plugin-import', `Import crosses ${plugin} → ${targetPlugin}; plugins must communicate through host ports.`, ref.specifier));
|
|
245
|
+
const other = targetPlugin(input, ref.specifier);
|
|
246
|
+
if (plugin && other && other !== plugin)
|
|
247
|
+
found.push(violation(tree, ref.node, 'HW9-plugin-import', `Import crosses ${plugin} → ${other}; plugins must communicate through host ports.`, ref.specifier));
|
|
232
248
|
}
|
|
233
249
|
return found;
|
|
234
250
|
}
|
|
@@ -240,21 +256,26 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
240
256
|
const report = (node, rule, reason, identity) => found.push(violation(tree, node, rule, reason, identity));
|
|
241
257
|
const jini = input.mode === 'jini';
|
|
242
258
|
const envExempt = /(?:^|\/)(?:bin|cli|testing)(?:\/|\.)/.test(input.file);
|
|
259
|
+
const ownsUrls = urlOwner(input.file);
|
|
243
260
|
if (!jini && !refs.some((ref) => ref.specifier.startsWith('@jini-ai/'))) {
|
|
244
261
|
for (const item of exportedFunctions({ tree }))
|
|
245
262
|
if (input.jiniExports?.has(item.name))
|
|
246
263
|
report(item.node, 'HW5-jini-export', `Export ${item.name} duplicates a Jini function without using its owner.`, item.name);
|
|
247
264
|
}
|
|
248
|
-
function
|
|
249
|
-
if (
|
|
265
|
+
function visitJini(node) {
|
|
266
|
+
if (!envExempt && env(node) && !isEnvDefault(node))
|
|
250
267
|
report(node, 'HW1-env-default', 'process.env is allowed only as an injected environment default (?? process.env or env = process.env).', envKey(node.parent) ?? 'process.env');
|
|
251
|
-
if (
|
|
268
|
+
if (mutableModuleState(node, tree))
|
|
252
269
|
report(node, 'HW3-module-state', 'Module state must be instance-owned; readonly collections or explicitly reviewed path-keyed locks may be retained.', declarationIdentity(node.name));
|
|
253
|
-
if (
|
|
270
|
+
if (input.server && globalFetchCall(node))
|
|
254
271
|
report(node, 'HW4-injected-fetch', 'Call an injected fetch port; the global fetch may only supply its default.', node.expression.getText(tree));
|
|
272
|
+
}
|
|
273
|
+
function visit(node) {
|
|
274
|
+
if (jini)
|
|
275
|
+
visitJini(node);
|
|
255
276
|
if (uncoveredDefault(node, input.bootCoveredEnv))
|
|
256
277
|
report(node, 'HW6-boot-default', 'Unsafe development default has no matching environment check in the production refusal gate.', envKey(node.left) ?? node.left.getText(tree));
|
|
257
|
-
if (!
|
|
278
|
+
if (!ownsUrls && apiUrl(node))
|
|
258
279
|
report(node, 'HW8-provider-url', 'Vendor API URL belongs in a provider, adapter or catalog.', node.text);
|
|
259
280
|
c.forEachChild(node, visit);
|
|
260
281
|
}
|
|
@@ -274,6 +295,9 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
274
295
|
visit(tree);
|
|
275
296
|
return jsx;
|
|
276
297
|
}
|
|
298
|
+
function reactSpecifier(specifier) {
|
|
299
|
+
return /^react(?:-dom)?(?:\/|$)/.test(specifier) || /(?:^|\/)node_modules\/react(?:-dom)?(?:\/|$)/.test(specifier);
|
|
300
|
+
}
|
|
277
301
|
function implicitReact(tree, file, displayFile) {
|
|
278
302
|
// Vite's automatic JSX runtime adds an import even when source imports only erased types.
|
|
279
303
|
if (file.includes('/node_modules/'))
|
|
@@ -303,14 +327,10 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
303
327
|
else
|
|
304
328
|
found.push(item);
|
|
305
329
|
}
|
|
306
|
-
|
|
307
|
-
const file = pending[cursor];
|
|
308
|
-
if (seen.has(file))
|
|
309
|
-
continue;
|
|
310
|
-
seen.add(file);
|
|
330
|
+
function scanModule(file) {
|
|
311
331
|
const tree = parse({ file, source: readSource(file) });
|
|
312
332
|
for (const ref of imports({ tree })) {
|
|
313
|
-
if (
|
|
333
|
+
if (reactSpecifier(ref.specifier)) {
|
|
314
334
|
reportGraph({ ...violation(tree, ref.node, 'HW7-public-react', 'Public-site runtime graph must not load React or React DOM.', ref.specifier), file: displayFile(file) });
|
|
315
335
|
continue;
|
|
316
336
|
}
|
|
@@ -322,6 +342,13 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
322
342
|
if (implicit)
|
|
323
343
|
reportGraph(implicit);
|
|
324
344
|
}
|
|
345
|
+
for (let cursor = 0; cursor < pending.length; cursor++) {
|
|
346
|
+
const file = pending[cursor];
|
|
347
|
+
if (seen.has(file))
|
|
348
|
+
continue;
|
|
349
|
+
seen.add(file);
|
|
350
|
+
scanModule(file);
|
|
351
|
+
}
|
|
325
352
|
return found;
|
|
326
353
|
}
|
|
327
354
|
return { inspect, inspectPublicGraph, parse, imports, exportedFunctions,
|
package/dist/checks/node.js
CHANGED
|
@@ -15,7 +15,12 @@ export function createNodeFilesystem(_args) {
|
|
|
15
15
|
createTempDirectory: ({ parent, prefix }) => mkdtempSync(path.join(parent, prefix)),
|
|
16
16
|
createDirectory: ({ path: dir }) => { mkdirSync(dir); },
|
|
17
17
|
ensureDirectory: ({ path: dir }) => { mkdirSync(dir, { recursive: true }); },
|
|
18
|
-
copyDirectory: ({ source, destination }) => {
|
|
18
|
+
copyDirectory: ({ source, destination }) => {
|
|
19
|
+
// MOVE: The caller owns the reserved root; exclusive copy still protects every entry inside it.
|
|
20
|
+
for (const entry of readdirSync(source)) {
|
|
21
|
+
cpSync(path.join(source, entry), path.join(destination, entry), { recursive: true, force: false, errorOnExist: true });
|
|
22
|
+
}
|
|
23
|
+
},
|
|
19
24
|
removeDirectory: ({ path: dir }) => { rmSync(dir, { recursive: true, force: true }); },
|
|
20
25
|
};
|
|
21
26
|
}
|
|
@@ -100,14 +100,38 @@ function evaluateCompile(project, registry, baseline, versions) {
|
|
|
100
100
|
const drift = diagnostics.filter((block) => !known.has(block));
|
|
101
101
|
return { ...base, status: drift.length ? 'drift' : 'pass', diagnostics: drift };
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return emptyResult(project.key, 'skipped', 'no registry-resolved scoped dependencies');
|
|
103
|
+
/** Run prerequisites in order; the first failing result stops the sequence. */
|
|
104
|
+
async function failedPrerequisite({ project, runner }) {
|
|
106
105
|
for (const command of project.prerequisites) {
|
|
107
106
|
const result = await runner.run(command);
|
|
108
107
|
if (result.exitCode !== 0)
|
|
109
|
-
return
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
/** A linked scope or scoped package would let local sources masquerade as registry packages. */
|
|
113
|
+
function assertUnlinkedScope({ source, fs }) {
|
|
114
|
+
if (fs.isSymbolicLink({ path: source }))
|
|
115
|
+
throw new Error('installed scope must not be linked');
|
|
116
|
+
for (const entry of fs.readDirectory({ path: source })) {
|
|
117
|
+
if (fs.isSymbolicLink({ path: path.join(source, entry) }))
|
|
118
|
+
throw new Error(`installed scoped package is linked: ${entry}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function installedVersions({ scratch, deps, fs }) {
|
|
122
|
+
const versions = {};
|
|
123
|
+
for (const name of Object.keys(deps)) {
|
|
124
|
+
const pkg = JSON.parse(fs.readText({ path: path.join(scratch, 'node_modules', name, 'package.json') }));
|
|
125
|
+
versions[name] = pkg.version;
|
|
110
126
|
}
|
|
127
|
+
return versions;
|
|
128
|
+
}
|
|
129
|
+
async function checkCompile(project, manifest, deps, scope, fs, runner, installer) {
|
|
130
|
+
if (Object.keys(deps).length === 0)
|
|
131
|
+
return emptyResult(project.key, 'skipped', 'no registry-resolved scoped dependencies');
|
|
132
|
+
const failed = await failedPrerequisite({ project, runner });
|
|
133
|
+
if (failed)
|
|
134
|
+
return emptyResult(project.key, 'prerequisite-error', combined(failed));
|
|
111
135
|
const scratch = fs.createTempDirectory({ parent: project.scratchParent, prefix: 'published-types-' });
|
|
112
136
|
try {
|
|
113
137
|
const overrides = Object.fromEntries(Object.entries(manifest.overrides ?? {}).filter(([name]) => name.startsWith(`${scope}/`)));
|
|
@@ -116,17 +140,8 @@ async function checkCompile(project, manifest, deps, scope, fs, runner, installe
|
|
|
116
140
|
if (installed.exitCode !== 0)
|
|
117
141
|
return emptyResult(project.key, 'install-error', combined(installed));
|
|
118
142
|
const source = path.join(scratch, 'node_modules', scope);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
for (const entry of fs.readDirectory({ path: source })) {
|
|
122
|
-
if (fs.isSymbolicLink({ path: path.join(source, entry) }))
|
|
123
|
-
throw new Error(`installed scoped package is linked: ${entry}`);
|
|
124
|
-
}
|
|
125
|
-
const versions = {};
|
|
126
|
-
for (const name of Object.keys(deps)) {
|
|
127
|
-
const pkg = JSON.parse(fs.readText({ path: path.join(scratch, 'node_modules', name, 'package.json') }));
|
|
128
|
-
versions[name] = pkg.version;
|
|
129
|
-
}
|
|
143
|
+
assertUnlinkedScope({ source, fs });
|
|
144
|
+
const versions = installedVersions({ scratch, deps, fs });
|
|
130
145
|
const baseline = project.mode === 'drift' ? await runner.run(project.compiler) : { exitCode: 0, stdout: '', stderr: '' };
|
|
131
146
|
// Copy the entire installed scope, including hoisted transitive packages.
|
|
132
147
|
const cleanup = createShadow(project, source, scope, fs);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A private locator is kept by the consumer; only verified public URLs reach recipients. */
|
|
2
|
+
export interface ArtifactUpload {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly bytes: Uint8Array;
|
|
5
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Single-object delivery. Publishing a whole tree must never own these objects.
|
|
9
|
+
*
|
|
10
|
+
* The share-facing view of `@jini-ai/core/object-store`: `upload`/`delete` are an `ObjectStore`'s
|
|
11
|
+
* `put`/`delete`, `url`/`verify` its `publicAccess`. Hosts select the provider that hands one out
|
|
12
|
+
* through the object-store registry by capability, not by a vendor id.
|
|
13
|
+
*/
|
|
14
|
+
export interface ArtifactStorePort {
|
|
15
|
+
upload(required: ArtifactUpload, optional?: {
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
url: string;
|
|
19
|
+
}>;
|
|
20
|
+
delete(required: {
|
|
21
|
+
key: string;
|
|
22
|
+
}, optional?: {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/** Anonymous read, or confirmed 404/410 when present=false. Errors are not absence. */
|
|
26
|
+
verify(required: {
|
|
27
|
+
key: string;
|
|
28
|
+
url: string;
|
|
29
|
+
present: boolean;
|
|
30
|
+
bytes?: number;
|
|
31
|
+
}, optional?: {
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}): Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=artifact-store.d.ts.map
|
|
@@ -15,6 +15,7 @@ import type { assertNotRedirected, redirectGuardInit } from '../core/redirect-gu
|
|
|
15
15
|
import type { safeDnsLabel, safeProjectLabel } from './naming.js';
|
|
16
16
|
import type { checkDeploymentUrl, normalizeDeploymentUrl, waitForReachableDeploymentUrl } from './reachability.js';
|
|
17
17
|
import type { DeployError, DeployTarget, UnknownRecord } from '../core/deploy-types.js';
|
|
18
|
+
import type { ArtifactStorePort } from '../core/artifact-store.js';
|
|
18
19
|
/**
|
|
19
20
|
* The resolved saved credential a module builds its target from: always a
|
|
20
21
|
* `token`, plus whatever extra fields that host's credential carries (an
|
|
@@ -116,6 +117,8 @@ export interface DeployCredentialCheckContext {
|
|
|
116
117
|
* credential check).
|
|
117
118
|
*/
|
|
118
119
|
export interface DeployTargetModule {
|
|
120
|
+
/** Optional single-object capability, independent of whole-tree publish/reconciliation. */
|
|
121
|
+
createArtifactStore?(required: DeployTargetCreateContext, optional?: Record<string, never>): ArtifactStorePort;
|
|
119
122
|
create(context: DeployTargetCreateContext): DeployTarget;
|
|
120
123
|
/** A human-readable config error, or `null` when `config` is usable. */
|
|
121
124
|
validateConfig?(requiredArgs: {
|
package/dist/deploy/index.d.ts
CHANGED
package/dist/deploy/node.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { lookup } from 'node:dns';
|
|
2
|
+
import type { LookupFunction } from 'node:net';
|
|
2
3
|
import { Agent, type Dispatcher } from 'undici';
|
|
3
4
|
import type { ReachabilityArgs } from './reachability.js';
|
|
5
|
+
/**
|
|
6
|
+
* Socket-level lookup for deployment probes: platform's validating lookup (private-address
|
|
7
|
+
* refusal) narrowed to the shapes Node's `net.connect` accepts — a single address string, or the
|
|
8
|
+
* `{ address, family }[]` list returned for `all: true` lookups. Anything else is refused rather
|
|
9
|
+
* than forwarded untyped to the socket.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createReachabilityLookup(_required: Record<string, never>, { lookupImpl }?: {
|
|
12
|
+
lookupImpl?: typeof lookup;
|
|
13
|
+
}): LookupFunction;
|
|
4
14
|
export declare function createReachabilityDispatcher(_required: Record<string, never>, { lookupImpl }?: {
|
|
5
15
|
lookupImpl?: typeof lookup;
|
|
6
16
|
}): Agent;
|
package/dist/deploy/node.js
CHANGED
|
@@ -4,9 +4,15 @@ function isLookupAddress(value) {
|
|
|
4
4
|
return value !== null && typeof value === 'object' && 'address' in value &&
|
|
5
5
|
typeof value.address === 'string' && 'family' in value && typeof value.family === 'number';
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Socket-level lookup for deployment probes: platform's validating lookup (private-address
|
|
9
|
+
* refusal) narrowed to the shapes Node's `net.connect` accepts — a single address string, or the
|
|
10
|
+
* `{ address, family }[]` list returned for `all: true` lookups. Anything else is refused rather
|
|
11
|
+
* than forwarded untyped to the socket.
|
|
12
|
+
*/
|
|
13
|
+
export function createReachabilityLookup(_required, { lookupImpl } = {}) {
|
|
8
14
|
const validatingLookup = createValidatingLookup(lookupImpl);
|
|
9
|
-
|
|
15
|
+
return (hostname, options, callback) => {
|
|
10
16
|
validatingLookup(hostname, options, (error, address, family) => {
|
|
11
17
|
if (error) {
|
|
12
18
|
callback(error, '');
|
|
@@ -23,7 +29,9 @@ export function createReachabilityDispatcher(_required, { lookupImpl } = {}) {
|
|
|
23
29
|
callback(new Error('DNS lookup returned an invalid address'), '');
|
|
24
30
|
});
|
|
25
31
|
};
|
|
26
|
-
|
|
32
|
+
}
|
|
33
|
+
export function createReachabilityDispatcher(_required, { lookupImpl } = {}) {
|
|
34
|
+
return new Agent({ connect: { lookup: createReachabilityLookup({}, lookupImpl ? { lookupImpl } : {}) } });
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
37
|
* Node default for deployment probes: URL rejection plus connection-time DNS validation.
|
|
@@ -83,8 +83,8 @@ export declare function normalizeDeploymentUrl({ url }: {
|
|
|
83
83
|
*/
|
|
84
84
|
export declare function checkDeploymentUrl({ url, fetch: fetchPort, guard }: ReachabilityArgs, options?: ReachabilityOptions): Promise<DeploymentUrlCheck>;
|
|
85
85
|
/**
|
|
86
|
-
* Polls
|
|
87
|
-
*
|
|
86
|
+
* Polls deployment candidates until one becomes reachable or `timeoutMs` elapses.
|
|
87
|
+
* A protected result is returned after its sweep if no candidate is ready. Used right after a
|
|
88
88
|
* publish call returns, since providers frequently accept the deploy before
|
|
89
89
|
* the URL is actually resolvable.
|
|
90
90
|
*
|