@nervur.org/installer-node 0.0.0-stage → 0.37.2
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/LICENSE +105 -0
- package/README.md +159 -2
- package/SECURITY.md +8 -0
- package/bin/nervur.js +5 -0
- package/cargo/emscripten-module.wasm +0 -0
- package/cargo/manifest.json +1 -0
- package/cargo/sqlite3.wasm +0 -0
- package/cargo/table-i-i.wasm +0 -0
- package/cargo/table-i-ii.wasm +0 -0
- package/cargo/table-i-iii.wasm +0 -0
- package/cargo/table-i-iiii.wasm +0 -0
- package/cargo/table-i-iiiii.wasm +0 -0
- package/cargo/table-i-iiij.wasm +0 -0
- package/cargo/table-i-ij.wasm +0 -0
- package/cargo/table-v-ii.wasm +0 -0
- package/cargo/table-v-iii.wasm +0 -0
- package/cargo/worker.js +30808 -0
- package/organs/console/node/guard.d.ts +10 -0
- package/organs/console/node/guard.js +52 -0
- package/organs/console/node/index.d.ts +4 -0
- package/organs/console/node/index.js +5 -0
- package/organs/console/node/line.d.ts +16 -0
- package/organs/console/node/line.js +150 -0
- package/organs/console/node/main.js +51 -0
- package/organs/console/node/program.d.ts +1 -0
- package/organs/console/node/program.js +5 -0
- package/organs/console/node/proof.d.ts +15 -0
- package/organs/console/node/proof.js +84 -0
- package/organs/console/node/socket.d.ts +15 -0
- package/organs/console/node/socket.js +99 -0
- package/organs/disk/index.d.ts +1 -0
- package/organs/disk/index.js +2 -0
- package/organs/disk/node/files.js +162 -0
- package/organs/disk/node/main.js +20 -0
- package/organs/disk/node/program.d.ts +1 -0
- package/organs/disk/node/program.js +5 -0
- package/organs/disk/organ.d.ts +5 -0
- package/organs/disk/organ.js +69 -0
- package/organs/network/node/fill.d.ts +21 -0
- package/organs/network/node/fill.js +195 -0
- package/organs/network/node/flows.js +66 -0
- package/organs/network/node/half.js +260 -0
- package/organs/network/node/lines.d.ts +29 -0
- package/organs/network/node/lines.js +236 -0
- package/organs/network/node/link.d.ts +24 -0
- package/organs/network/node/link.js +215 -0
- package/organs/network/node/main.js +41 -0
- package/organs/network/node/moved.d.ts +2 -0
- package/organs/network/node/moved.js +20 -0
- package/organs/network/node/near.d.ts +63 -0
- package/organs/network/node/near.js +263 -0
- package/organs/network/node/program.d.ts +1 -0
- package/organs/network/node/program.js +5 -0
- package/organs/network/node/schemes.d.ts +1 -0
- package/organs/network/node/schemes.js +2 -0
- package/organs/network/node/sent.d.ts +13 -0
- package/organs/network/node/sent.js +101 -0
- package/organs/network/node/served.d.ts +19 -0
- package/organs/network/node/served.js +237 -0
- package/organs/screen/node/client.js +3 -0
- package/organs/screen/node/follow.js +266 -0
- package/organs/screen/node/frames.js +26 -0
- package/organs/screen/node/held.js +27 -0
- package/organs/screen/node/http.js +179 -0
- package/organs/screen/node/lay.js +116 -0
- package/organs/screen/node/leave.js +27 -0
- package/organs/screen/node/linked.js +69 -0
- package/organs/screen/node/listen.js +61 -0
- package/organs/screen/node/look.js +121 -0
- package/organs/screen/node/loop.js +154 -0
- package/organs/screen/node/main.js +74 -0
- package/organs/screen/node/mirror.js +112 -0
- package/organs/screen/node/notice.js +44 -0
- package/organs/screen/node/presser.js +11 -0
- package/organs/screen/node/presses.js +108 -0
- package/organs/screen/node/program.d.ts +1 -0
- package/organs/screen/node/program.js +5 -0
- package/organs/screen/node/shown.js +205 -0
- package/organs/screen/node/standing.js +29 -0
- package/organs/screen/node/state.js +80 -0
- package/organs/screen/node/tell.js +47 -0
- package/organs/screen/node/uid.js +65 -0
- package/organs/screen/node/worn.js +23 -0
- package/organs/shell/index.d.ts +1 -0
- package/organs/shell/index.js +2 -0
- package/organs/shell/node/main.js +26 -0
- package/organs/shell/node/output.js +70 -0
- package/organs/shell/node/pressure.js +14 -0
- package/organs/shell/node/program.d.ts +1 -0
- package/organs/shell/node/program.js +5 -0
- package/organs/shell/node/runs.js +220 -0
- package/organs/shell/node/told.js +70 -0
- package/organs/shell/organ.d.ts +5 -0
- package/organs/shell/organ.js +59 -0
- package/package.json +43 -4
- package/src/command/act.d.ts +31 -0
- package/src/command/act.js +261 -0
- package/src/command/answers.d.ts +3 -0
- package/src/command/answers.js +232 -0
- package/src/command/args.d.ts +14 -0
- package/src/command/args.js +220 -0
- package/src/command/arrive.d.ts +2 -0
- package/src/command/arrive.js +21 -0
- package/src/command/asked.d.ts +18 -0
- package/src/command/asked.js +49 -0
- package/src/command/backup.d.ts +18 -0
- package/src/command/backup.js +261 -0
- package/src/command/before.d.ts +40 -0
- package/src/command/before.js +249 -0
- package/src/command/born.d.ts +27 -0
- package/src/command/born.js +103 -0
- package/src/command/bridge.d.ts +19 -0
- package/src/command/bridge.js +152 -0
- package/src/command/chain.d.ts +9 -0
- package/src/command/chain.js +48 -0
- package/src/command/channel.d.ts +29 -0
- package/src/command/channel.js +263 -0
- package/src/command/choices.d.ts +35 -0
- package/src/command/choices.js +173 -0
- package/src/command/claim.d.ts +12 -0
- package/src/command/claim.js +46 -0
- package/src/command/commands.d.ts +16 -0
- package/src/command/commands.js +257 -0
- package/src/command/ends.d.ts +16 -0
- package/src/command/ends.js +78 -0
- package/src/command/follow.d.ts +12 -0
- package/src/command/follow.js +66 -0
- package/src/command/given.d.ts +39 -0
- package/src/command/given.js +53 -0
- package/src/command/held.d.ts +15 -0
- package/src/command/held.js +56 -0
- package/src/command/index.d.ts +1 -0
- package/src/command/index.js +203 -0
- package/src/command/jailer.d.ts +28 -0
- package/src/command/jailer.js +135 -0
- package/src/command/laid.d.ts +6 -0
- package/src/command/laid.js +31 -0
- package/src/command/left.d.ts +9 -0
- package/src/command/left.js +34 -0
- package/src/command/line.d.ts +7 -0
- package/src/command/line.js +39 -0
- package/src/command/link.d.ts +30 -0
- package/src/command/link.js +123 -0
- package/src/command/lobes.d.ts +1 -0
- package/src/command/lobes.js +10 -0
- package/src/command/locks.d.ts +17 -0
- package/src/command/locks.js +76 -0
- package/src/command/mcp/calls.d.ts +27 -0
- package/src/command/mcp/calls.js +155 -0
- package/src/command/mcp/notices.d.ts +22 -0
- package/src/command/mcp/notices.js +203 -0
- package/src/command/mcp/resources.d.ts +31 -0
- package/src/command/mcp/resources.js +108 -0
- package/src/command/mcp/server.d.ts +19 -0
- package/src/command/mcp/server.js +149 -0
- package/src/command/mcp/tools.d.ts +39 -0
- package/src/command/mcp/tools.js +131 -0
- package/src/command/mcp.d.ts +8 -0
- package/src/command/mcp.js +39 -0
- package/src/command/noticed.d.ts +11 -0
- package/src/command/noticed.js +55 -0
- package/src/command/older.d.ts +11 -0
- package/src/command/older.js +45 -0
- package/src/command/open.d.ts +24 -0
- package/src/command/open.js +107 -0
- package/src/command/passphrase.d.ts +6 -0
- package/src/command/passphrase.js +82 -0
- package/src/command/reclaim.d.ts +7 -0
- package/src/command/reclaim.js +47 -0
- package/src/command/refused.d.ts +4 -0
- package/src/command/refused.js +27 -0
- package/src/command/release.d.ts +27 -0
- package/src/command/release.js +153 -0
- package/src/command/repo.d.ts +31 -0
- package/src/command/repo.js +133 -0
- package/src/command/rewrap.d.ts +16 -0
- package/src/command/rewrap.js +175 -0
- package/src/command/runtime.d.ts +25 -0
- package/src/command/runtime.js +175 -0
- package/src/command/salvage.d.ts +4 -0
- package/src/command/salvage.js +42 -0
- package/src/command/screen.d.ts +14 -0
- package/src/command/screen.js +62 -0
- package/src/command/spawn.d.ts +23 -0
- package/src/command/spawn.js +213 -0
- package/src/command/start.d.ts +34 -0
- package/src/command/start.js +246 -0
- package/src/command/state.d.ts +5 -0
- package/src/command/state.js +39 -0
- package/src/command/token.d.ts +1 -0
- package/src/command/token.js +9 -0
- package/src/command/trial.d.ts +18 -0
- package/src/command/trial.js +108 -0
- package/src/command/undone.d.ts +3 -0
- package/src/command/undone.js +21 -0
- package/src/command/vouch.d.ts +1 -0
- package/src/command/vouch.js +15 -0
- package/src/command/windows-processes.d.ts +2 -0
- package/src/command/windows-processes.js +22 -0
- package/src/command/wipe.d.ts +9 -0
- package/src/command/wipe.js +105 -0
- package/src/command/words.d.ts +5 -0
- package/src/command/words.js +53 -0
- package/src/door/claim.d.ts +5 -0
- package/src/door/claim.js +21 -0
- package/src/door/claimed.d.ts +7 -0
- package/src/door/claimed.js +110 -0
- package/src/door/configuration.d.ts +40 -0
- package/src/door/configuration.js +206 -0
- package/src/door/design.d.ts +13 -0
- package/src/door/design.js +71 -0
- package/src/door/digests.d.ts +7 -0
- package/src/door/digests.js +36 -0
- package/src/door/distribution.d.ts +25 -0
- package/src/door/distribution.js +88 -0
- package/src/door/door.d.ts +41 -0
- package/src/door/door.js +219 -0
- package/src/door/dressed.d.ts +34 -0
- package/src/door/dressed.js +182 -0
- package/src/door/faculties.d.ts +29 -0
- package/src/door/faculties.js +88 -0
- package/src/door/longest.d.ts +6 -0
- package/src/door/longest.js +25 -0
- package/src/fills/account-only.d.ts +3 -0
- package/src/fills/account-only.js +24 -0
- package/src/fills/boot-key.d.ts +21 -0
- package/src/fills/boot-key.js +70 -0
- package/src/fills/boot-move.d.ts +25 -0
- package/src/fills/boot-move.js +86 -0
- package/src/fills/bridge.d.ts +13 -0
- package/src/fills/bridge.js +86 -0
- package/src/fills/chance.d.ts +2 -0
- package/src/fills/chance.js +7 -0
- package/src/fills/crypto.d.ts +2 -0
- package/src/fills/crypto.js +94 -0
- package/src/fills/flushed.d.ts +9 -0
- package/src/fills/flushed.js +80 -0
- package/src/fills/hardware.d.ts +18 -0
- package/src/fills/hardware.js +70 -0
- package/src/fills/held.d.ts +31 -0
- package/src/fills/held.js +171 -0
- package/src/fills/keepers.d.ts +23 -0
- package/src/fills/keepers.js +151 -0
- package/src/fills/keyring.d.ts +19 -0
- package/src/fills/keyring.js +131 -0
- package/src/fills/pages.d.ts +3 -0
- package/src/fills/pages.js +260 -0
- package/src/fills/reserve.d.ts +11 -0
- package/src/fills/reserve.js +72 -0
- package/src/fills/time.d.ts +2 -0
- package/src/fills/time.js +29 -0
- package/src/fills/unlocker.d.ts +6 -0
- package/src/fills/unlocker.js +26 -0
- package/src/fills/vitals.d.ts +8 -0
- package/src/fills/vitals.js +100 -0
- package/src/fills/windows-start.d.ts +2 -0
- package/src/fills/windows-start.js +21 -0
- package/src/halves/build.d.ts +10 -0
- package/src/halves/build.js +219 -0
- package/src/halves/end.d.ts +17 -0
- package/src/halves/end.js +157 -0
- package/src/halves/genome.d.ts +3 -0
- package/src/halves/genome.js +21 -0
- package/src/halves/handler.d.ts +8 -0
- package/src/halves/handler.js +40 -0
- package/src/halves/index.d.ts +5 -0
- package/src/halves/index.js +6 -0
- package/src/halves/laid.d.ts +12 -0
- package/src/halves/laid.js +103 -0
- package/src/halves/lent.d.ts +6 -0
- package/src/halves/lent.js +147 -0
- package/src/halves/native.d.ts +12 -0
- package/src/halves/native.js +53 -0
- package/src/halves/statements.d.ts +23 -0
- package/src/halves/statements.js +165 -0
- package/src/halves/tokens.d.ts +22 -0
- package/src/halves/tokens.js +135 -0
- package/src/link/link.d.ts +4 -0
- package/src/link/link.js +4 -0
- package/src/link/placeholder.d.ts +1 -0
- package/src/link/placeholder.js +21 -0
- package/src/link/steps.d.ts +52 -0
- package/src/link/steps.js +118 -0
- package/src/lobes/calls.d.ts +76 -0
- package/src/lobes/calls.js +61 -0
- package/src/lobes/channel.d.ts +76 -0
- package/src/lobes/channel.js +202 -0
- package/src/lobes/index.d.ts +1 -0
- package/src/lobes/index.js +2 -0
- package/src/lobes/lobes.d.ts +15 -0
- package/src/lobes/lobes.js +244 -0
- package/src/lobes/main.js +107 -0
- package/src/lobes/thread.d.ts +22 -0
- package/src/lobes/thread.js +270 -0
- package/src/organism/act.d.ts +8 -0
- package/src/organism/act.js +63 -0
- package/src/organism/beat.d.ts +5 -0
- package/src/organism/beat.js +45 -0
- package/src/organism/compiled.d.ts +2 -0
- package/src/organism/compiled.js +24 -0
- package/src/organism/folder.d.ts +88 -0
- package/src/organism/folder.js +259 -0
- package/src/organism/main.d.ts +1 -0
- package/src/organism/main.js +11 -0
- package/src/organism/organism.d.ts +1 -0
- package/src/organism/organism.js +220 -0
- package/src/organism/said.d.ts +12 -0
- package/src/organism/said.js +30 -0
- package/src/organism/told.d.ts +5 -0
- package/src/organism/told.js +110 -0
- package/src/organism/unlock.d.ts +8 -0
- package/src/organism/unlock.js +95 -0
- package/src/organism/upgrade.d.ts +24 -0
- package/src/organism/upgrade.js +145 -0
- package/src/organism/via.d.ts +7 -0
- package/src/organism/via.js +20 -0
- package/src/service/body.d.ts +8 -0
- package/src/service/body.js +34 -0
- package/src/service/handler.d.ts +20 -0
- package/src/service/handler.js +128 -0
- package/src/service/index.d.ts +4 -0
- package/src/service/index.js +16 -0
- package/src/service/manager.d.ts +18 -0
- package/src/service/manager.js +185 -0
- package/src/service/service.d.ts +24 -0
- package/src/service/service.js +200 -0
- package/src/service/swap.d.ts +12 -0
- package/src/service/swap.js +74 -0
- package/src/service/watchdog.d.ts +6 -0
- package/src/service/watchdog.js +31 -0
- package/src/tcp/crowd.d.ts +18 -0
- package/src/tcp/crowd.js +85 -0
- package/src/tcp/dial.d.ts +23 -0
- package/src/tcp/dial.js +102 -0
- package/src/tcp/frame.d.ts +23 -0
- package/src/tcp/frame.js +159 -0
- package/src/tcp/listen.d.ts +50 -0
- package/src/tcp/listen.js +207 -0
- package/src/tcp/source.d.ts +2 -0
- package/src/tcp/source.js +26 -0
- package/src/version/index.d.ts +1 -0
- package/src/version/index.js +2 -0
- package/src/version/version.d.ts +1 -0
- package/src/version/version.js +2 -0
- package/src/work/first.d.ts +11 -0
- package/src/work/first.js +91 -0
- package/src/work/index.d.ts +2 -0
- package/src/work/index.js +15 -0
- package/src/work/work.d.ts +20 -0
- package/src/work/work.js +136 -0
- package/src/ws/dial.d.ts +7 -0
- package/src/ws/dial.js +252 -0
- package/src/ws/dialing.d.ts +50 -0
- package/src/ws/dialing.js +72 -0
- package/src/ws/frame.d.ts +32 -0
- package/src/ws/frame.js +124 -0
- package/src/ws/handshake.d.ts +4 -0
- package/src/ws/handshake.js +27 -0
- package/src/ws/line.d.ts +45 -0
- package/src/ws/line.js +250 -0
- package/src/ws/listen.d.ts +42 -0
- package/src/ws/listen.js +272 -0
- package/src/ws/rfc6455.d.ts +18 -0
- package/src/ws/rfc6455.js +187 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { execFile, spawn } from 'node:child_process';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { existsSync, mkdtempSync, readdirSync, readFileSync, realpathSync, rmSync } from 'node:fs';
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
import { tmpdir } from 'node:os';
|
|
7
|
+
import { dirname, join, win32 } from 'node:path';
|
|
8
|
+
import { pathToFileURL } from 'node:url';
|
|
9
|
+
import { distributionOf, packageOf, } from '../door/distribution.js';
|
|
10
|
+
import { commandIn, heldBy, leftGone, releaseLaid, scriptOf, STAGED, stagedPackage, } from './release.js';
|
|
11
|
+
import { nodeLaid } from './runtime.js';
|
|
12
|
+
import { HOST_PROCESSES } from './spawn.js';
|
|
13
|
+
import { isFields, readText, } from '@nervur.org/genome/standard';
|
|
14
|
+
import { channelWhy, NPM_DEFAULT, REFUSED, tokenFor } from './refused.js';
|
|
15
|
+
import { tokened } from './token.js';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const INSTALLER = '@nervur.org/installer-node';
|
|
22
|
+
|
|
23
|
+
export const channelOf = (said ) =>
|
|
24
|
+
said === '' || said === 'undefined' || said === NPM_DEFAULT ? null : said;
|
|
25
|
+
|
|
26
|
+
export const startedBy = (
|
|
27
|
+
program ,
|
|
28
|
+
args ,
|
|
29
|
+
platform ,
|
|
30
|
+
node ,
|
|
31
|
+
) =>
|
|
32
|
+
program === 'npm' && platform === 'win32'
|
|
33
|
+
? [node, [win32.join(win32.dirname(node), 'node_modules', 'npm', 'bin', 'npm-cli.js'), ...args]]
|
|
34
|
+
: [program, args];
|
|
35
|
+
|
|
36
|
+
const run = (
|
|
37
|
+
program ,
|
|
38
|
+
args ,
|
|
39
|
+
registry = null,
|
|
40
|
+
) =>
|
|
41
|
+
new Promise((done) => {
|
|
42
|
+
const [started, words] = startedBy(program, args, process.platform, process.execPath);
|
|
43
|
+
const options = { encoding: 'utf8', maxBuffer: 1 << 24, env: tokened(process.env, registry) } ;
|
|
44
|
+
execFile(started, [...words], options, (failed, out, err) => {
|
|
45
|
+
const code = failed === null ? 0 : typeof failed.code === 'number' ? failed.code : null;
|
|
46
|
+
done({ code, out, err: failed !== null && err === '' ? failed.message : err });
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const floorTaken = async (spec , named ) => {
|
|
51
|
+
const folder = mkdtempSync(join(tmpdir(), 'nervur-floor-'));
|
|
52
|
+
try {
|
|
53
|
+
const registry = await channel(named);
|
|
54
|
+
const ran = await run(
|
|
55
|
+
'npm',
|
|
56
|
+
[
|
|
57
|
+
'install',
|
|
58
|
+
spec,
|
|
59
|
+
'--prefix',
|
|
60
|
+
folder,
|
|
61
|
+
'--no-save',
|
|
62
|
+
'--ignore-scripts',
|
|
63
|
+
'--no-audit',
|
|
64
|
+
'--no-fund',
|
|
65
|
+
...scoped(registry),
|
|
66
|
+
],
|
|
67
|
+
registry,
|
|
68
|
+
);
|
|
69
|
+
if (ran.code !== 0) return { why: await refusedWhy(spec, ran, registry) };
|
|
70
|
+
const name = packageOf(spec);
|
|
71
|
+
const version = versionIn(join(folder, 'node_modules', name, 'package.json'));
|
|
72
|
+
if (version === null) return { why: `the channel's ${name} names no version` };
|
|
73
|
+
const required = createRequire(join(folder, 'package.json'));
|
|
74
|
+
const exported = await import(pathToFileURL(required.resolve(name)).href);
|
|
75
|
+
return await distributionOf(name, version, exported);
|
|
76
|
+
} catch (thrown) {
|
|
77
|
+
return { why: `${spec} reads not: ${thrown instanceof Error ? thrown.message : String(thrown)}` };
|
|
78
|
+
} finally {
|
|
79
|
+
rmSync(folder, { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const flagged = (registry ) => (registry === null ? [] : ['--registry', registry]);
|
|
84
|
+
const scoped = (registry ) =>
|
|
85
|
+
registry === null ? [] : [`--@nervur.org:registry=${registry}`];
|
|
86
|
+
|
|
87
|
+
const refusedWhy = async (
|
|
88
|
+
spec ,
|
|
89
|
+
ran ,
|
|
90
|
+
registry ,
|
|
91
|
+
) => {
|
|
92
|
+
const said = `${ran.err}\n${ran.out}`;
|
|
93
|
+
if (!REFUSED.test(said)) return channelWhy(spec, said);
|
|
94
|
+
const channel = registry ?? NPM_DEFAULT;
|
|
95
|
+
return channelWhy(spec, said, tokenFor((await run('npm', ['config', 'list'], channel)).out, channel), channel);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const versionIn = (file ) => {
|
|
99
|
+
const read = readText(readFileSync(file, 'utf8'));
|
|
100
|
+
const version = 'data' in read && isFields(read.data) ? read.data['version'] : undefined;
|
|
101
|
+
return typeof version === 'string' ? version : null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const channel = async (named ) =>
|
|
105
|
+
named ?? channelOf((await run('npm', ['config', 'get', 'registry'])).out.trim());
|
|
106
|
+
|
|
107
|
+
const sha256 = (file ) => createHash('sha256').update(readFileSync(file)).digest('hex');
|
|
108
|
+
|
|
109
|
+
export const viewed = async (spec , named = null) => {
|
|
110
|
+
const registry = await channel(named);
|
|
111
|
+
const ran = await run('npm', ['view', spec, '--json', 'version', 'dependencies', ...flagged(registry)], registry);
|
|
112
|
+
if (ran.code !== 0) return { why: await refusedWhy(spec, ran, registry) };
|
|
113
|
+
const read = readText(ran.out);
|
|
114
|
+
if ('why' in read) return { why: `the channel's answer for ${spec} is no JSON` };
|
|
115
|
+
const data = read.data;
|
|
116
|
+
const one = Array.isArray(data) ? data[data.length - 1] : data;
|
|
117
|
+
const version = isFields(one) ? one['version'] : undefined;
|
|
118
|
+
const dependencies = isFields(one) ? one['dependencies'] : undefined;
|
|
119
|
+
const installer = isFields(dependencies) ? dependencies[INSTALLER] : undefined;
|
|
120
|
+
if (typeof version !== 'string' || typeof installer !== 'string')
|
|
121
|
+
return { why: `the channel's ${spec} carries no ${INSTALLER}` };
|
|
122
|
+
return { version, installer };
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const packed = async (spec , registry , folder ) => {
|
|
126
|
+
const ran = await run('npm', ['pack', spec, '--pack-destination', folder, ...flagged(registry)], registry);
|
|
127
|
+
const file = ran.out.trim().split('\n').pop() ?? '';
|
|
128
|
+
return ran.code === 0 && file.endsWith('.tgz') ? join(folder, file) : { why: await refusedWhy(spec, ran, registry) };
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const digestOn = async (version , named = null) => {
|
|
132
|
+
const folder = mkdtempSync(join(tmpdir(), 'nervur-'));
|
|
133
|
+
try {
|
|
134
|
+
const file = await packed(`nervur@${version}`, await channel(named), folder);
|
|
135
|
+
return typeof file === 'string' ? sha256(file) : file;
|
|
136
|
+
} finally {
|
|
137
|
+
rmSync(folder, { recursive: true, force: true });
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
const refusedDigest = (spec , held , digest ) => ({
|
|
144
|
+
why: `${spec} is ${held}, where ${digest} was named: nothing is laid`,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const laidBeside = async (
|
|
148
|
+
spec ,
|
|
149
|
+
words ,
|
|
150
|
+
registry = null,
|
|
151
|
+
hold = true,
|
|
152
|
+
) => {
|
|
153
|
+
const prefix = await run('npm', ['prefix', '-g']);
|
|
154
|
+
if (prefix.code !== 0) return { why: 'npm tells no global prefix to lay the package in' };
|
|
155
|
+
const global = prefix.out.trim();
|
|
156
|
+
const beside = join(global, STAGED);
|
|
157
|
+
if (hold) leftGone(global, HOST_PROCESSES);
|
|
158
|
+
else rmSync(beside, { recursive: true, force: true });
|
|
159
|
+
try {
|
|
160
|
+
const ran = await run('npm', ['install', '-g', '--prefix', beside, ...words], registry);
|
|
161
|
+
if (ran.code !== 0) return { why: await refusedWhy(spec, ran, registry) };
|
|
162
|
+
const node = hold ? await nodeLaid(stagedPackage(beside)) : null;
|
|
163
|
+
return node ?? releaseLaid(global, beside, hold);
|
|
164
|
+
} finally {
|
|
165
|
+
rmSync(beside, { recursive: true, force: true });
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const fromChannel = async (version , taking , hold = true) => {
|
|
170
|
+
const spec = `nervur@${version}`;
|
|
171
|
+
const registry = await channel(taking.channel ?? null);
|
|
172
|
+
const folder = mkdtempSync(join(tmpdir(), 'nervur-'));
|
|
173
|
+
try {
|
|
174
|
+
const file = await packed(spec, registry, folder);
|
|
175
|
+
if (typeof file !== 'string') return file;
|
|
176
|
+
const held = sha256(file);
|
|
177
|
+
if (taking.digest !== undefined && held !== taking.digest) return refusedDigest(spec, held, taking.digest);
|
|
178
|
+
return await laidBeside(spec, [file, ...scoped(registry)], registry, hold);
|
|
179
|
+
} finally {
|
|
180
|
+
rmSync(folder, { recursive: true, force: true });
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const packagesIn = (folder ) =>
|
|
185
|
+
readdirSync(folder)
|
|
186
|
+
.filter((name) => name.endsWith('.tgz'))
|
|
187
|
+
.map((name) => join(folder, name));
|
|
188
|
+
|
|
189
|
+
const fromHand = async (version , taking , folder , hold = true) => {
|
|
190
|
+
const spec = `nervur@${version}`;
|
|
191
|
+
const file = join(folder, `nervur-${version}.tgz`);
|
|
192
|
+
if (!existsSync(file)) return { why: `${folder} holds no ${spec}` };
|
|
193
|
+
const held = sha256(file);
|
|
194
|
+
if (taking.digest !== undefined && held !== taking.digest) return refusedDigest(spec, held, taking.digest);
|
|
195
|
+
return laidBeside(spec, [...packagesIn(folder)], null, hold);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const taken = (version , taking = {}) =>
|
|
199
|
+
taking.package === undefined ? fromChannel(version, taking) : fromHand(version, taking, taking.package);
|
|
200
|
+
|
|
201
|
+
export const takenAside = (version , taking = {}) =>
|
|
202
|
+
taking.package === undefined ? fromChannel(version, taking, false) : fromHand(version, taking, taking.package, false);
|
|
203
|
+
|
|
204
|
+
export const atHand = (folder ) => {
|
|
205
|
+
const named = readdirSync(folder).flatMap((name) => /^nervur-(\d+\.\d+\.\d+)\.tgz$/.exec(name)?.[1] ?? []);
|
|
206
|
+
const version = named.toSorted((one, other) => one.localeCompare(other, undefined, { numeric: true })).at(-1);
|
|
207
|
+
if (version === undefined) return { why: `${folder} holds no nervur-<version>.tgz` };
|
|
208
|
+
const installers = readdirSync(folder).flatMap(
|
|
209
|
+
(name) => /^nervur\.org-installer-node-(\d+\.\d+\.\d+)\.tgz$/.exec(name)?.[1] ?? [],
|
|
210
|
+
);
|
|
211
|
+
const installer = installers.find((one) => one === version);
|
|
212
|
+
return installer === undefined ? { why: `${folder} holds no installer-node ${version}` } : { version, installer };
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const standingCommand = async () => {
|
|
216
|
+
const bin = await commanded();
|
|
217
|
+
if (typeof bin !== 'string') return bin;
|
|
218
|
+
const root = await packageRoot();
|
|
219
|
+
if (typeof root !== 'string') return root;
|
|
220
|
+
const held = heldBy(bin);
|
|
221
|
+
return held === null ? { why: `${bin} is no link a release was laid under` } : { bin, held, root };
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const commanded = async () => {
|
|
225
|
+
const prefix = await run('npm', ['prefix', '-g']);
|
|
226
|
+
if (prefix.code !== 0) return { why: 'npm tells no global prefix to find the command it installed' };
|
|
227
|
+
const bin = commandIn(prefix.out.trim());
|
|
228
|
+
return existsSync(bin) ? bin : { why: `the command npm installed is not at ${bin}` };
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const packageRoot = async () => {
|
|
232
|
+
const bin = await commanded();
|
|
233
|
+
if (typeof bin !== 'string') return bin;
|
|
234
|
+
return dirname(dirname(realpathSync(bin)));
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export const handedOver = async (
|
|
238
|
+
installer ,
|
|
239
|
+
words = process.argv.slice(2),
|
|
240
|
+
) => {
|
|
241
|
+
const bin = await commanded();
|
|
242
|
+
if (typeof bin !== 'string') return bin;
|
|
243
|
+
const script = scriptOf(bin);
|
|
244
|
+
if (typeof script !== 'string') return script;
|
|
245
|
+
return new Promise((done) => {
|
|
246
|
+
const child = spawn(process.execPath, [script, ...words], {
|
|
247
|
+
stdio: 'inherit',
|
|
248
|
+
env: { ...process.env, NERVUR_HANDED: installer },
|
|
249
|
+
});
|
|
250
|
+
child.on('error', (failed) => done({ why: `the new command did not start: ${failed.message}` }));
|
|
251
|
+
child.on('close', (code) => done(code ?? 1));
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const commandScript = async () => {
|
|
256
|
+
const bin = await commanded();
|
|
257
|
+
return typeof bin === 'string' ? scriptOf(bin) : bin;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export const globalPrefix = async () => {
|
|
261
|
+
const prefix = await run('npm', ['prefix', '-g']);
|
|
262
|
+
return prefix.code === 0 ? prefix.out.trim() : { why: 'npm tells no global prefix to hold the command in' };
|
|
263
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type BootMode } from '../door/configuration.js';
|
|
2
|
+
import { type Laid } from '../organism/folder.js';
|
|
3
|
+
import { type Given } from './given.js';
|
|
4
|
+
export declare const sameWs: (laid: Laid, given: Given) => boolean;
|
|
5
|
+
export declare const choicesMoved: (laid: Laid, given: Pick<Given, 'port' | 'publicHost' | 'ws' | 'work' | 'screen'>) => Laid | {
|
|
6
|
+
readonly why: string;
|
|
7
|
+
};
|
|
8
|
+
type Why = {
|
|
9
|
+
readonly why: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const movesAny: (laid: Laid, given: Given) => Promise<boolean>;
|
|
12
|
+
export declare const laidAgain: (given: Given, home: string, laid: Laid) => Promise<{
|
|
13
|
+
readonly laid: Laid;
|
|
14
|
+
readonly restarts: boolean;
|
|
15
|
+
readonly key?: Uint8Array | null;
|
|
16
|
+
} | {
|
|
17
|
+
readonly why: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const floorWordOf: (given: Given) => {
|
|
20
|
+
readonly why: string;
|
|
21
|
+
} | null;
|
|
22
|
+
export declare const wordsOf: ({ publicHost, ws, screen, reserve, claim, }: Given) => {
|
|
23
|
+
readonly publicHost?: string;
|
|
24
|
+
readonly ws?: string;
|
|
25
|
+
readonly screen?: boolean;
|
|
26
|
+
readonly reserve?: number;
|
|
27
|
+
readonly claim?: string;
|
|
28
|
+
};
|
|
29
|
+
export type Chosen = Given & {
|
|
30
|
+
readonly port: number;
|
|
31
|
+
readonly bootMode: BootMode;
|
|
32
|
+
};
|
|
33
|
+
export declare const chosenOf: (given: Given) => Chosen;
|
|
34
|
+
export declare const designWordOf: (given: Given) => Promise<Why | null>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dataText } from '@nervur.org/genome/standard';
|
|
4
|
+
import { designData, designIn } from '../door/design.js';
|
|
5
|
+
import { bootModeOf, personSits, PORT, screenLaid, sitsAtInstall, } from '../door/configuration.js';
|
|
6
|
+
import { layFolderAgain, readFolder, withWs, } from '../organism/folder.js';
|
|
7
|
+
import { packageOf } from '../door/distribution.js';
|
|
8
|
+
import { workOf } from '../work/index.js';
|
|
9
|
+
import { organismOf, } from './given.js';
|
|
10
|
+
import { bootMoved } from './rewrap.js';
|
|
11
|
+
|
|
12
|
+
const choicesOf = (laid ) =>
|
|
13
|
+
`port ${laid.port}, boot ${laid.bootMode}${laid.publicHost === undefined ? '' : `, public ${laid.publicHost}`}${laid.ws === undefined ? '' : `, ws ${laid.ws}`}${laid.wss === undefined ? '' : `, wss ${laid.wss}`}${laid.work === undefined ? '' : `, work ${laid.work.account}`}`;
|
|
14
|
+
|
|
15
|
+
export const sameWs = (laid , given ) =>
|
|
16
|
+
given.ws === null ||
|
|
17
|
+
laid.ws === undefined ||
|
|
18
|
+
[laid.ws, laid.wss].includes(given.ws) ||
|
|
19
|
+
withWs(laid, given.ws) !== laid;
|
|
20
|
+
|
|
21
|
+
export const choicesMoved = (
|
|
22
|
+
laid ,
|
|
23
|
+
given ,
|
|
24
|
+
) => {
|
|
25
|
+
if (given.screen !== undefined && given.screen !== personSits(process.platform, laid.screen))
|
|
26
|
+
return {
|
|
27
|
+
why: `an organism stands here ${given.screen ? 'with no screen' : 'with a screen'}: --screen and --no-screen are a first install's word`,
|
|
28
|
+
};
|
|
29
|
+
const work = given.work === null || given.work === laid.work?.account ? laid.work : workOf(given.work);
|
|
30
|
+
if (work !== undefined && 'why' in work) return work;
|
|
31
|
+
const moved = withWs(laid, given.ws);
|
|
32
|
+
const same =
|
|
33
|
+
(given.port ?? laid.port) === laid.port &&
|
|
34
|
+
(given.publicHost ?? laid.publicHost) === laid.publicHost &&
|
|
35
|
+
work === laid.work;
|
|
36
|
+
if (same) return moved;
|
|
37
|
+
return {
|
|
38
|
+
...moved,
|
|
39
|
+
port: given.port ?? laid.port,
|
|
40
|
+
...(given.publicHost === null ? {} : { publicHost: given.publicHost }),
|
|
41
|
+
...(work === undefined ? {} : { work }),
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const designMoved = async (
|
|
46
|
+
laid ,
|
|
47
|
+
given ,
|
|
48
|
+
) => {
|
|
49
|
+
if (given.design === null || !namesDesign(given.design)) return null;
|
|
50
|
+
const named = await designIn(given.design);
|
|
51
|
+
if ('why' in named) return named;
|
|
52
|
+
const { design, size } = named;
|
|
53
|
+
if (design === undefined) return null;
|
|
54
|
+
const kept = laid.design !== undefined && dataText(designData(laid.design)) === dataText(designData(design));
|
|
55
|
+
return kept && (size === undefined || size === laid.size)
|
|
56
|
+
? null
|
|
57
|
+
: { design, ...(size === undefined ? {} : { size }) };
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const namesDesign = (file ) => {
|
|
63
|
+
try {
|
|
64
|
+
const said = JSON.parse(readFileSync(file, 'utf8'));
|
|
65
|
+
const organism = typeof said === 'object' && said !== null ? Reflect.get(said, 'organism') : undefined;
|
|
66
|
+
const design =
|
|
67
|
+
typeof organism === 'object' && organism !== null ? Reflect.get(organism, 'design') : undefined;
|
|
68
|
+
return design !== undefined && design !== null;
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const movesAny = async (laid , given ) => {
|
|
75
|
+
const moved = choicesMoved(laid, given);
|
|
76
|
+
return (
|
|
77
|
+
'why' in moved ||
|
|
78
|
+
moved !== laid ||
|
|
79
|
+
(await designMoved(laid, given)) !== null ||
|
|
80
|
+
(given.bootMode !== null && given.bootMode !== laid.bootMode)
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const withDesign = async (laid , was , given ) => {
|
|
85
|
+
const named = await designMoved(was, given);
|
|
86
|
+
if (named === null) return laid;
|
|
87
|
+
if ('why' in named) return named;
|
|
88
|
+
given.print("The organism wears the design named from its next start, unless an owner's wear chose another.");
|
|
89
|
+
return { ...laid, design: named.design, ...(named.size === undefined ? {} : { size: named.size }) };
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const movedSaid = (given , was , now ) => {
|
|
93
|
+
if (was.port !== now.port || was.publicHost !== now.publicHost)
|
|
94
|
+
given.print('The organism is reached anew: every invitation drawn before names the old address.');
|
|
95
|
+
if (was.work?.account !== now.work?.account)
|
|
96
|
+
given.print(
|
|
97
|
+
`The body runs as ${now.work?.account ?? 'this account'} from now on: what ${was.work?.account ?? 'this account'} held stands where it was, and comes back from the world.`,
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const laidAgain = async (
|
|
102
|
+
given ,
|
|
103
|
+
home ,
|
|
104
|
+
laid ,
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
) => {
|
|
108
|
+
if (!sameWs(laid, given))
|
|
109
|
+
return {
|
|
110
|
+
why: `an organism is already installed at ${home}, with ${choicesOf(laid)}: a --ws may be added where it holds none, a wss beside a plain ws, and never names another`,
|
|
111
|
+
};
|
|
112
|
+
const chosen = choicesMoved(laid, given);
|
|
113
|
+
if ('why' in chosen) return chosen;
|
|
114
|
+
const moved = await withDesign(chosen, laid, given);
|
|
115
|
+
if ('why' in moved) return moved;
|
|
116
|
+
const again = moved === laid ? null : layFolderAgain(home, moved);
|
|
117
|
+
if (again !== null) return again;
|
|
118
|
+
movedSaid(given, laid, moved);
|
|
119
|
+
if (given.bootMode === null || given.bootMode === moved.bootMode) return { laid: moved, restarts: moved !== laid };
|
|
120
|
+
const booted = await bootMoved(given, home, moved, given.bootMode);
|
|
121
|
+
return 'why' in booted ? booted : { ...booted, restarts: false };
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const floorWordOf = (given ) => {
|
|
125
|
+
if (given.faculties === null) return null;
|
|
126
|
+
const stands = readFolder(organismOf(given.home));
|
|
127
|
+
if (!('laid' in stands)) return null;
|
|
128
|
+
const held = stands.laid.floor?.package;
|
|
129
|
+
return held === packageOf(given.faculties)
|
|
130
|
+
? null
|
|
131
|
+
: {
|
|
132
|
+
why: `an organism stands here on ${held ?? "this installer's floor"}: --faculties is a first install's word, and an owner moves a standing organism's lobes by version`,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const wordsOf = ({
|
|
137
|
+
publicHost,
|
|
138
|
+
ws,
|
|
139
|
+
screen,
|
|
140
|
+
reserve,
|
|
141
|
+
claim,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
) => ({
|
|
149
|
+
...(claim === null ? {} : { claim }),
|
|
150
|
+
...(publicHost === null ? {} : { publicHost }),
|
|
151
|
+
...(ws === null ? {} : { ws }),
|
|
152
|
+
...screenLaid(process.platform, process.env, screen),
|
|
153
|
+
...(reserve === undefined ? {} : { reserve }),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
export const chosenOf = (given ) => ({
|
|
158
|
+
...given,
|
|
159
|
+
port: given.port ?? PORT,
|
|
160
|
+
bootMode: given.bootMode ?? bootModeOf(process.platform, sitsAtInstall(process.platform, process.env, given.screen)),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export const designWordOf = async (given ) => {
|
|
164
|
+
if (given.design === null) return null;
|
|
165
|
+
const stands = readFolder(organismOf(given.home));
|
|
166
|
+
if (!('laid' in stands)) return null;
|
|
167
|
+
const named = await designIn(given.design);
|
|
168
|
+
if ('why' in named) return named;
|
|
169
|
+
if (named.design !== undefined || stands.laid.size === named.size) return null;
|
|
170
|
+
return {
|
|
171
|
+
why: `an organism stands here with ${stands.laid.size === undefined ? "no class of its screen's size named" : `its screen's size named ${stands.laid.size}`}: a class named with no design is a first install's word`,
|
|
172
|
+
};
|
|
173
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Laid } from '../organism/folder.js';
|
|
2
|
+
import { type Given } from './given.js';
|
|
3
|
+
type Why = {
|
|
4
|
+
readonly why: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const claimIn: (file: string | undefined, command: string) => {
|
|
7
|
+
readonly claim: string | null;
|
|
8
|
+
} | Why;
|
|
9
|
+
export declare const claimWordOf: (given: Given) => Why | null;
|
|
10
|
+
export declare const claimSaid: (laid: Laid) => string;
|
|
11
|
+
export declare const unclaimed: (laid: Laid) => Laid;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { CLAIM_PATH, isClaim, sameText } from '../door/claim.js';
|
|
4
|
+
import { readFolder, } from '../organism/folder.js';
|
|
5
|
+
import { organismOf, } from './given.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const claimIn = (file , command ) => {
|
|
10
|
+
if (file === undefined) return { claim: null };
|
|
11
|
+
if (command !== 'install' && command !== 'update' && command !== 'restore')
|
|
12
|
+
return { why: '--claim is for install and restore' };
|
|
13
|
+
let text;
|
|
14
|
+
try {
|
|
15
|
+
text = readFileSync(file, 'utf8').replace(/\r?\n$/u, '');
|
|
16
|
+
} catch (thrown) {
|
|
17
|
+
return { why: `--claim reads no file at ${file}: ${thrown instanceof Error ? thrown.message : String(thrown)}` };
|
|
18
|
+
}
|
|
19
|
+
return isClaim(text)
|
|
20
|
+
? { claim: text }
|
|
21
|
+
: { why: `--claim names a file holding one token, as openssl rand -hex 32 draws, and ${file} holds none` };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const claimWordOf = (given ) => {
|
|
25
|
+
if (given.claim === null) return null;
|
|
26
|
+
const stands = readFolder(organismOf(given.home));
|
|
27
|
+
if (!('laid' in stands)) return null;
|
|
28
|
+
const held = stands.laid.claim;
|
|
29
|
+
return held !== undefined && sameText(held, given.claim)
|
|
30
|
+
? null
|
|
31
|
+
: {
|
|
32
|
+
why: `an organism stands here ${held === undefined ? 'owned at its console' : 'claimed by another claim'}: --claim is a first install's word`,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const claimSaid = (laid ) => {
|
|
37
|
+
const host = laid.publicHost ?? '127.0.0.1';
|
|
38
|
+
const at = `http://${host.includes(':') ? `[${host}]` : host}:${laid.port + 1}`;
|
|
39
|
+
return `Its anchor is claimed: POST ${at}${CLAIM_PATH} with "Authorization: Bearer <claim>" answers its first invitation, and whoever accepts it holds the anchor; no one is present here, so the console holds nothing of the brain. Until then whoever reads the claim holds the organism, so keep it as you keep this machine's root; from afar, fetch it through this machine's proxy with TLS, since over plain http the claim and the invitation cross in clear.`;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const unclaimed = (laid ) => {
|
|
43
|
+
if (laid.claim === undefined) return laid;
|
|
44
|
+
const { claim: _forgotten, ...rest } = laid;
|
|
45
|
+
return rest;
|
|
46
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Chosen } from './choices.js';
|
|
2
|
+
import { type Laid } from '../organism/folder.js';
|
|
3
|
+
import type { Asker } from './passphrase.js';
|
|
4
|
+
import { type Given, type Outcome } from './given.js';
|
|
5
|
+
export declare const passphraseTwice: (asker: Asker, short?: boolean) => Promise<string | {
|
|
6
|
+
readonly why: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const bornKey: (given: Chosen, home: string) => Promise<{
|
|
9
|
+
readonly key: Uint8Array | null;
|
|
10
|
+
} | {
|
|
11
|
+
readonly why: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const printLines: (given: Given, laid: Laid) => void;
|
|
14
|
+
export declare const install: (given: Given) => Promise<Outcome>;
|
|
15
|
+
export { organismOf, type Given, type Outcome } from './given.js';
|
|
16
|
+
export { start, stop } from './start.js';
|