swarm-deploy 0.0.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/LICENSE.md +201 -0
  3. package/NOTICE.md +13 -0
  4. package/README.md +1283 -0
  5. package/RELEASING.md +71 -0
  6. package/SECURITY.md +40 -0
  7. package/dist/abort.d.ts +16 -0
  8. package/dist/abort.js +52 -0
  9. package/dist/abort.js.map +1 -0
  10. package/dist/allowlist.d.ts +2 -0
  11. package/dist/allowlist.js +21 -0
  12. package/dist/allowlist.js.map +1 -0
  13. package/dist/bin/swarm-deploy.d.ts +2 -0
  14. package/dist/bin/swarm-deploy.js +41 -0
  15. package/dist/bin/swarm-deploy.js.map +1 -0
  16. package/dist/cli.d.ts +27 -0
  17. package/dist/cli.js +751 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/client.d.ts +111 -0
  20. package/dist/client.js +276 -0
  21. package/dist/client.js.map +1 -0
  22. package/dist/direct-dht.d.ts +81 -0
  23. package/dist/direct-dht.js +254 -0
  24. package/dist/direct-dht.js.map +1 -0
  25. package/dist/error-code.d.ts +15 -0
  26. package/dist/error-code.js +30 -0
  27. package/dist/error-code.js.map +1 -0
  28. package/dist/errors.d.ts +31 -0
  29. package/dist/errors.js +37 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/events-node.d.ts +2 -0
  32. package/dist/events-node.js +7 -0
  33. package/dist/events-node.js.map +1 -0
  34. package/dist/files.d.ts +32 -0
  35. package/dist/files.js +85 -0
  36. package/dist/files.js.map +1 -0
  37. package/dist/fs-node.d.ts +2 -0
  38. package/dist/fs-node.js +7 -0
  39. package/dist/fs-node.js.map +1 -0
  40. package/dist/hooks-module.d.ts +9 -0
  41. package/dist/hooks-module.js +118 -0
  42. package/dist/hooks-module.js.map +1 -0
  43. package/dist/hooks.d.ts +69 -0
  44. package/dist/hooks.js +88 -0
  45. package/dist/hooks.js.map +1 -0
  46. package/dist/identity.d.ts +7 -0
  47. package/dist/identity.js +50 -0
  48. package/dist/identity.js.map +1 -0
  49. package/dist/index.d.ts +12 -0
  50. package/dist/index.js +21 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/os-node.d.ts +2 -0
  53. package/dist/os-node.js +7 -0
  54. package/dist/os-node.js.map +1 -0
  55. package/dist/path-node.d.ts +2 -0
  56. package/dist/path-node.js +7 -0
  57. package/dist/path-node.js.map +1 -0
  58. package/dist/process-node.d.ts +2 -0
  59. package/dist/process-node.js +7 -0
  60. package/dist/process-node.js.map +1 -0
  61. package/dist/release.d.ts +26 -0
  62. package/dist/release.js +419 -0
  63. package/dist/release.js.map +1 -0
  64. package/dist/server.d.ts +239 -0
  65. package/dist/server.js +928 -0
  66. package/dist/server.js.map +1 -0
  67. package/dist/storage/atomic-file.d.ts +15 -0
  68. package/dist/storage/atomic-file.js +172 -0
  69. package/dist/storage/atomic-file.js.map +1 -0
  70. package/dist/storage/commit-journal.d.ts +120 -0
  71. package/dist/storage/commit-journal.js +417 -0
  72. package/dist/storage/commit-journal.js.map +1 -0
  73. package/dist/storage/commit-store.d.ts +307 -0
  74. package/dist/storage/commit-store.js +1691 -0
  75. package/dist/storage/commit-store.js.map +1 -0
  76. package/dist/storage/layout.d.ts +16 -0
  77. package/dist/storage/layout.js +409 -0
  78. package/dist/storage/layout.js.map +1 -0
  79. package/dist/storage/link-store.d.ts +70 -0
  80. package/dist/storage/link-store.js +363 -0
  81. package/dist/storage/link-store.js.map +1 -0
  82. package/dist/storage/recovery.d.ts +100 -0
  83. package/dist/storage/recovery.js +260 -0
  84. package/dist/storage/recovery.js.map +1 -0
  85. package/dist/storage/retention.d.ts +183 -0
  86. package/dist/storage/retention.js +619 -0
  87. package/dist/storage/retention.js.map +1 -0
  88. package/dist/storage/root-coordinator.d.ts +7 -0
  89. package/dist/storage/root-coordinator.js +27 -0
  90. package/dist/storage/root-coordinator.js.map +1 -0
  91. package/dist/storage/session-store.d.ts +2 -0
  92. package/dist/storage/session-store.js +7 -0
  93. package/dist/storage/session-store.js.map +1 -0
  94. package/dist/storage/tar-session-store.d.ts +147 -0
  95. package/dist/storage/tar-session-store.js +1044 -0
  96. package/dist/storage/tar-session-store.js.map +1 -0
  97. package/dist/storage/tree-fs.d.ts +44 -0
  98. package/dist/storage/tree-fs.js +580 -0
  99. package/dist/storage/tree-fs.js.map +1 -0
  100. package/dist/storage/tree-staging.d.ts +9 -0
  101. package/dist/storage/tree-staging.js +64 -0
  102. package/dist/storage/tree-staging.js.map +1 -0
  103. package/dist/storage/types.d.ts +77 -0
  104. package/dist/storage/types.js +3 -0
  105. package/dist/storage/types.js.map +1 -0
  106. package/dist/symlinks.d.ts +36 -0
  107. package/dist/symlinks.js +128 -0
  108. package/dist/symlinks.js.map +1 -0
  109. package/dist/tar-protocol/controls.d.ts +73 -0
  110. package/dist/tar-protocol/controls.js +291 -0
  111. package/dist/tar-protocol/controls.js.map +1 -0
  112. package/dist/tar-protocol/direct-wire.d.ts +43 -0
  113. package/dist/tar-protocol/direct-wire.js +194 -0
  114. package/dist/tar-protocol/direct-wire.js.map +1 -0
  115. package/dist/tar-protocol/extract.d.ts +18 -0
  116. package/dist/tar-protocol/extract.js +124 -0
  117. package/dist/tar-protocol/extract.js.map +1 -0
  118. package/dist/tar-protocol/hash.d.ts +10 -0
  119. package/dist/tar-protocol/hash.js +44 -0
  120. package/dist/tar-protocol/hash.js.map +1 -0
  121. package/dist/tar-protocol/lifecycle.d.ts +13 -0
  122. package/dist/tar-protocol/lifecycle.js +90 -0
  123. package/dist/tar-protocol/lifecycle.js.map +1 -0
  124. package/dist/tar-protocol/manifest.d.ts +58 -0
  125. package/dist/tar-protocol/manifest.js +312 -0
  126. package/dist/tar-protocol/manifest.js.map +1 -0
  127. package/dist/tar-protocol/tree-extract.d.ts +37 -0
  128. package/dist/tar-protocol/tree-extract.js +240 -0
  129. package/dist/tar-protocol/tree-extract.js.map +1 -0
  130. package/dist/tar-protocol/tree-manifest.d.ts +45 -0
  131. package/dist/tar-protocol/tree-manifest.js +277 -0
  132. package/dist/tar-protocol/tree-manifest.js.map +1 -0
  133. package/dist/tar-protocol/tree-path.d.ts +15 -0
  134. package/dist/tar-protocol/tree-path.js +68 -0
  135. package/dist/tar-protocol/tree-path.js.map +1 -0
  136. package/dist/tar-protocol/tree.d.ts +68 -0
  137. package/dist/tar-protocol/tree.js +269 -0
  138. package/dist/tar-protocol/tree.js.map +1 -0
  139. package/dist/tar-protocol/ustar.d.ts +36 -0
  140. package/dist/tar-protocol/ustar.js +167 -0
  141. package/dist/tar-protocol/ustar.js.map +1 -0
  142. package/dist/types.d.ts +61 -0
  143. package/dist/types.js +3 -0
  144. package/dist/types.js.map +1 -0
  145. package/dist/validation.d.ts +4 -0
  146. package/dist/validation.js +26 -0
  147. package/dist/validation.js.map +1 -0
  148. package/package.json +103 -1
package/RELEASING.md ADDED
@@ -0,0 +1,71 @@
1
+ # Releasing
2
+
3
+ Releases are immutable npm versions published by the tag-triggered GitHub Actions workflow. Do not publish from a workstation.
4
+
5
+ ## One-time setup
6
+
7
+ 1. In npm, grant the maintainers publish access to the unscoped `swarm-deploy` package.
8
+ 2. Configure npm trusted publishing for this GitHub repository, workflow `publish.yml`, and environment `npm`.
9
+ 3. Protect the `npm` environment with the required reviewers and deployment-branch/tag rules. Do not add an npm token: the workflow uses OIDC.
10
+ 4. Protect release tags and require the CI checks on `main`.
11
+
12
+ ## Preflight
13
+
14
+ 1. Update `package.json` to the new SemVer version and update `CHANGELOG.md`.
15
+ Confirm the README and CLI examples use direct `--server-key` uploads and
16
+ repeatable static `--allow-key` server configuration; topics and discovery
17
+ are not release interfaces.
18
+ 2. From a clean checkout, run:
19
+
20
+ ```sh
21
+ npm install
22
+ npm run build
23
+ npm run build:test
24
+ npm run lint
25
+ npm run test:node
26
+ npm run test:bare
27
+ npm run test:package
28
+ npm audit --omit=dev
29
+ npm publish --dry-run
30
+ ```
31
+
32
+ 3. Verify `GITHUB_REF_NAME=vX.Y.Z npm run test:release-tag` with the intended version.
33
+ 4. Merge the release commit and wait for required `main` CI checks.
34
+
35
+ ## Publish and verify
36
+
37
+ The following are deliberate external actions and are not performed by tests or local release preparation:
38
+
39
+ ```sh
40
+ git tag -s vX.Y.Z <release-commit>
41
+ git push origin vX.Y.Z
42
+ ```
43
+
44
+ Approve the protected `npm` environment if required. Confirm the workflow used provenance, then verify the registry metadata, provenance statement, tarball contents, and a fresh install:
45
+
46
+ ```sh
47
+ npm view swarm-deploy@X.Y.Z version dist.integrity
48
+ npm install --global swarm-deploy@X.Y.Z
49
+ swarm-deploy --help
50
+ ```
51
+
52
+ PR/main CI is the full test authority. The tag workflow verifies the exact
53
+ stable tag and package version, confirms the tagged commit is on `main`, builds
54
+ the untracked `dist/`, and validates the package before delegating to
55
+ `holepunchto/actions/publish` at
56
+ `146b86c4d0237c124df06ecc992ddf2c585b3405`. That composite action currently
57
+ references `create-release@v1` internally and publishes with
58
+ `npm publish --ignore-scripts` and creates the GitHub release, so the workflow
59
+ must build `dist/` before invoking it.
60
+
61
+ Roll the package into one canary client/server pair first. Confirm `ready`, authentication, offer, progress, verification, commit, recovery, scrub, retention, and cleanup diagnostics before broader rollout.
62
+
63
+ ## Rollback
64
+
65
+ Package versions and deployment configuration are immutable inputs. Roll clients and servers back by reinstalling and redeploying the last known-good exact version; never republish an existing version. If the bad version should not be selected by users, deprecate it with a clear replacement:
66
+
67
+ ```sh
68
+ npm deprecate swarm-deploy@X.Y.Z "Use X.Y.(Z+1); reason: <summary>"
69
+ ```
70
+
71
+ Do not roll a server back while a v2 replacement journal is in flight. Stop new uploads, drain active work, and allow the current version to recover or finish every replacement journal first. Back up the dedicated storage root after a clean shutdown, and test the previous version against a copy before production rollback. An older server may not understand v2 replacement state.
package/SECURITY.md ADDED
@@ -0,0 +1,40 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes are provided for the latest published release. Unreleased commits
6
+ are not a supported production distribution.
7
+
8
+ ## Report a vulnerability
9
+
10
+ Email [security-oss@tether.io](mailto:security-oss@tether.io). Do not open a
11
+ public issue for a suspected vulnerability and do not include live seeds,
12
+ private infrastructure details, or production artifacts.
13
+
14
+ Include the affected version and runtime, operating system, impact, minimal
15
+ reproduction, and whether seed material or stored artifacts may have been
16
+ exposed. We will acknowledge the report within five working days. Coordination
17
+ and disclosure may use a private GitHub Security Advisory.
18
+
19
+ ## Operator precautions
20
+
21
+ - Generate independent server and client seeds and prefer owner-readable files
22
+ or protected environment variables. The CLI accepts `--seed` for explicit
23
+ inline configuration, but command arguments may be exposed through shell
24
+ history, process listings, CI tracing, and diagnostic tooling. Never log a
25
+ seed. A client pins the server's full public key; the server's immutable
26
+ startup allowlist names permitted client public keys. If a seed may be
27
+ exposed, rotate it, restart with a revised allowlist, and purge the
28
+ compromised secret from logs and caches.
29
+ - Run under a dedicated non-root account with a dedicated storage root.
30
+ Swarm Deploy protects against detected symlink and directory-identity
31
+ changes, but it does not defend against a malicious process with the same OS
32
+ permissions.
33
+ - Protect the startup allowlist as security-sensitive configuration. It is not
34
+ watched or reloaded: use a controlled server restart to change access.
35
+ - Do not manipulate `.swarm-deploy/` or copy an active storage root. Stop the
36
+ server cleanly before backup or restore, preserve the whole root, and let the
37
+ same or newer package version complete recovery before serving traffic.
38
+ - Fingerprints and digests are not seeds, but full public keys still identify
39
+ deployment principals. Share only the server public key with uploaders and
40
+ only client public keys with server operators.
@@ -0,0 +1,16 @@
1
+ import { SwarmDeployError } from './errors.js';
2
+ export interface AbortSignalLike {
3
+ readonly aborted: boolean;
4
+ addEventListener(event: 'abort', callback: () => void, options?: {
5
+ once?: boolean;
6
+ }): void;
7
+ removeEventListener(event: 'abort', callback: () => void): void;
8
+ }
9
+ export interface AbortControllerLike {
10
+ readonly signal: AbortSignalLike;
11
+ abort(): void;
12
+ }
13
+ export declare function abortError(): SwarmDeployError;
14
+ export declare function throwIfAborted(signal: Pick<AbortSignalLike, 'aborted'> | null | undefined): void;
15
+ export declare function onAbort(signal: AbortSignalLike | null | undefined, callback: () => void): () => void;
16
+ export declare function createAbortController(): AbortControllerLike;
package/dist/abort.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.abortError = abortError;
4
+ exports.throwIfAborted = throwIfAborted;
5
+ exports.onAbort = onAbort;
6
+ exports.createAbortController = createAbortController;
7
+ const errors_js_1 = require("./errors.js");
8
+ function abortError() {
9
+ return new errors_js_1.SwarmDeployError(errors_js_1.ERRORS.ABORTED, 'Operation aborted');
10
+ }
11
+ function throwIfAborted(signal) {
12
+ if (signal?.aborted)
13
+ throw abortError();
14
+ }
15
+ function onAbort(signal, callback) {
16
+ if (!signal)
17
+ return () => { };
18
+ if (signal.aborted) {
19
+ callback();
20
+ return () => { };
21
+ }
22
+ signal.addEventListener('abort', callback, { once: true });
23
+ return () => signal.removeEventListener('abort', callback);
24
+ }
25
+ function createAbortController() {
26
+ if (typeof globalThis.AbortController === 'function')
27
+ return new globalThis.AbortController();
28
+ const listeners = new Set();
29
+ const signal = {
30
+ aborted: false,
31
+ addEventListener(event, callback) {
32
+ if (event === 'abort')
33
+ listeners.add(callback);
34
+ },
35
+ removeEventListener(event, callback) {
36
+ if (event === 'abort')
37
+ listeners.delete(callback);
38
+ }
39
+ };
40
+ return {
41
+ signal,
42
+ abort() {
43
+ if (signal.aborted)
44
+ return;
45
+ signal.aborted = true;
46
+ for (const callback of listeners)
47
+ callback();
48
+ listeners.clear();
49
+ }
50
+ };
51
+ }
52
+ //# sourceMappingURL=abort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort.js","sourceRoot":"","sources":["../src/abort.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAsD;AAatD;IACE,OAAO,IAAI,4BAAgB,CAAC,kBAAM,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAA;AAClE,CAAC;AAED,wBAA+B,MAA2D;IACxF,IAAI,MAAM,EAAE,OAAO;QAA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server startup. */
2
+ export declare function parseAllowlist(text: string): Set<string>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAllowlist = parseAllowlist;
4
+ const identity_js_1 = require("./identity.js");
5
+ /** Parses immutable, canonical client public keys for server startup. */
6
+ function parseAllowlist(text) {
7
+ if (typeof text !== 'string')
8
+ throw new TypeError('Allowlist must be text');
9
+ const keys = new Set();
10
+ for (const line of text.split(/\r?\n/)) {
11
+ const key = line.trim();
12
+ if (key === '' || key.startsWith('#'))
13
+ continue;
14
+ (0, identity_js_1.parsePublicKey)(key);
15
+ if (keys.has(key))
16
+ throw new TypeError('Duplicate allowlist key');
17
+ keys.add(key);
18
+ }
19
+ return keys;
20
+ }
21
+ //# sourceMappingURL=allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowlist.js","sourceRoot":"","sources":["../src/allowlist.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAE9C,yEAAyE;AACzE,wBAA+B,IAAY;IACzC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAA;IAC3E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QACvB,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAQ;QAC/C,IAAA,4BAAc,EAAC,GAAG,CAAC,CAAA;QACnB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAA;QACjE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACf,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const _process_1 = __importDefault(require("#process"));
8
+ const cli_js_1 = require("../cli.js");
9
+ function reportFatal(err) {
10
+ try {
11
+ const message = err &&
12
+ typeof err === 'object' &&
13
+ 'message' in err &&
14
+ typeof err.message === 'string' &&
15
+ err.message
16
+ ? err.message
17
+ : 'Unknown error';
18
+ if (_process_1.default.stderr && typeof _process_1.default.stderr.write === 'function') {
19
+ _process_1.default.stderr.write(message.endsWith('\n') ? message : `${message}\n`);
20
+ }
21
+ }
22
+ catch { }
23
+ }
24
+ function exitWith(code) {
25
+ _process_1.default.exitCode = Number.isInteger(code) ? code : 1;
26
+ }
27
+ (0, cli_js_1.main)(_process_1.default.argv, _process_1.default.env, { process: _process_1.default }).then(exitWith, (err) => {
28
+ reportFatal(err);
29
+ exitWith(1);
30
+ });
31
+ if (typeof _process_1.default.on === 'function') {
32
+ _process_1.default.on('uncaughtException', (err) => {
33
+ reportFatal(err);
34
+ _process_1.default.exit(1);
35
+ });
36
+ _process_1.default.on('unhandledRejection', (err) => {
37
+ reportFatal(err);
38
+ _process_1.default.exit(1);
39
+ });
40
+ }
41
+ //# sourceMappingURL=swarm-deploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm-deploy.js","sourceRoot":"","sources":["../../src/bin/swarm-deploy.ts"],"names":[],"mappings":";;;;;;AAEA,wDAA8B;AAC9B,sCAAgC;AAEhC,SAAS,WAAW,CAAC,GAAY;IAC/B,IAAI,CAAC;QACH,MAAM,OAAO,GACX,GAAG;YACH,OAAO,GAAG,KAAK,QAAQ;YACvB,SAAS,IAAI,GAAG;YAChB,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ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;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { Server, type ServerOptions } from './server.js';
2
+ import { Client, type ClientOptions } from './client.js';
3
+ import type { DirectDhtNode } from './direct-dht.js';
4
+ type Env = Record<string, string | undefined>;
5
+ type Output = {
6
+ write(value: string): unknown;
7
+ };
8
+ type SignalProcess = {
9
+ on(signal: 'SIGINT' | 'SIGTERM', listener: () => void): unknown;
10
+ off?(signal: 'SIGINT' | 'SIGTERM', listener: () => void): unknown;
11
+ removeListener?(signal: 'SIGINT' | 'SIGTERM', listener: () => void): unknown;
12
+ };
13
+ type CliIo = {
14
+ stdout?: Output;
15
+ stderr?: Output;
16
+ process?: SignalProcess;
17
+ Server?: new (options: ServerOptions) => Server;
18
+ Client?: new (options: ClientOptions) => Client;
19
+ dht?: DirectDhtNode;
20
+ connectTimeout?: number;
21
+ idleTimeout?: number;
22
+ /** Directory that relative `--hooks` paths resolve against; defaults to `process.cwd()`. */
23
+ cwd?: string;
24
+ };
25
+ declare const USAGE: string;
26
+ declare function main(argv: Iterable<string> | null | undefined, env: Env, io?: CliIo): Promise<number>;
27
+ export { main, USAGE };