@parity/product-deploy 0.7.28-rc.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 (109) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +233 -0
  3. package/assets/environments.json +313 -0
  4. package/bin/bulletin-bootstrap +84 -0
  5. package/bin/bulletin-deploy +429 -0
  6. package/dist/bug-report.d.ts +29 -0
  7. package/dist/bug-report.js +27 -0
  8. package/dist/chunk-2VAUMZB2.js +284 -0
  9. package/dist/chunk-43HLT335.js +232 -0
  10. package/dist/chunk-5VZQ2KSU.js +231 -0
  11. package/dist/chunk-ADNBLFDP.js +225 -0
  12. package/dist/chunk-BMAEWZYV.js +24 -0
  13. package/dist/chunk-C2TS5MER.js +64 -0
  14. package/dist/chunk-DNXH4QTI.js +2336 -0
  15. package/dist/chunk-FZWJV5AD.js +231 -0
  16. package/dist/chunk-GZD2UFLR.js +8 -0
  17. package/dist/chunk-HOTQDYHD.js +219 -0
  18. package/dist/chunk-IDYGYIMH.js +207 -0
  19. package/dist/chunk-KHVTYIIX.js +146 -0
  20. package/dist/chunk-KJH2T5TQ.js +172 -0
  21. package/dist/chunk-KOSF5FDO.js +49 -0
  22. package/dist/chunk-LZJMVPYW.js +156 -0
  23. package/dist/chunk-MFTODIIT.js +725 -0
  24. package/dist/chunk-MMAZFJDG.js +91 -0
  25. package/dist/chunk-NF2FL4ZO.js +164 -0
  26. package/dist/chunk-OITUIM2E.js +524 -0
  27. package/dist/chunk-P6CHOMN3.js +2368 -0
  28. package/dist/chunk-QMYW3D6E.js +316 -0
  29. package/dist/chunk-QTZNULSH.js +185 -0
  30. package/dist/chunk-RI3ZLNPN.js +71 -0
  31. package/dist/chunk-S7EM5VMW.js +108 -0
  32. package/dist/chunk-T7EEVWNU.js +32 -0
  33. package/dist/chunk-UPWEOGLQ.js +37 -0
  34. package/dist/chunk-ZOC4GITL.js +13 -0
  35. package/dist/chunk-ZYVGHDMU.js +117 -0
  36. package/dist/chunk-probe.d.ts +37 -0
  37. package/dist/chunk-probe.js +18 -0
  38. package/dist/chunker.d.ts +8 -0
  39. package/dist/chunker.js +10 -0
  40. package/dist/deploy.d.ts +299 -0
  41. package/dist/deploy.js +96 -0
  42. package/dist/dotns.d.ts +506 -0
  43. package/dist/dotns.js +101 -0
  44. package/dist/environments.d.ts +104 -0
  45. package/dist/environments.js +23 -0
  46. package/dist/errors.d.ts +6 -0
  47. package/dist/errors.js +8 -0
  48. package/dist/gh-pages-mirror.d.ts +76 -0
  49. package/dist/gh-pages-mirror.js +30 -0
  50. package/dist/incremental-stats.d.ts +69 -0
  51. package/dist/incremental-stats.js +10 -0
  52. package/dist/index.d.ts +23 -0
  53. package/dist/index.js +146 -0
  54. package/dist/manifest/byte-budget.d.ts +46 -0
  55. package/dist/manifest/byte-budget.js +14 -0
  56. package/dist/manifest/config-load.d.ts +36 -0
  57. package/dist/manifest/config-load.js +10 -0
  58. package/dist/manifest/publish.d.ts +54 -0
  59. package/dist/manifest/publish.js +23 -0
  60. package/dist/manifest/schema.d.ts +29 -0
  61. package/dist/manifest/schema.js +10 -0
  62. package/dist/manifest/types.d.ts +90 -0
  63. package/dist/manifest/types.js +6 -0
  64. package/dist/manifest-embed.d.ts +18 -0
  65. package/dist/manifest-embed.js +9 -0
  66. package/dist/manifest-fetch.d.ts +32 -0
  67. package/dist/manifest-fetch.js +21 -0
  68. package/dist/manifest-roundtrip.d.ts +15 -0
  69. package/dist/manifest-roundtrip.js +55 -0
  70. package/dist/manifest.d.ts +44 -0
  71. package/dist/manifest.js +20 -0
  72. package/dist/memory-report.d.ts +95 -0
  73. package/dist/memory-report.js +17 -0
  74. package/dist/merkle.d.ts +50 -0
  75. package/dist/merkle.js +33 -0
  76. package/dist/personhood/bind-paid-alias.d.ts +43 -0
  77. package/dist/personhood/bind-paid-alias.js +10 -0
  78. package/dist/personhood/bind-personal-id.d.ts +55 -0
  79. package/dist/personhood/bind-personal-id.js +12 -0
  80. package/dist/personhood/bootstrap.d.ts +85 -0
  81. package/dist/personhood/bootstrap.js +245 -0
  82. package/dist/personhood/claim-pgas.d.ts +61 -0
  83. package/dist/personhood/claim-pgas.js +12 -0
  84. package/dist/personhood/constants.d.ts +23 -0
  85. package/dist/personhood/constants.js +22 -0
  86. package/dist/personhood/encoding.d.ts +49 -0
  87. package/dist/personhood/encoding.js +24 -0
  88. package/dist/personhood/hashing.d.ts +4 -0
  89. package/dist/personhood/hashing.js +8 -0
  90. package/dist/personhood/member-key.d.ts +12 -0
  91. package/dist/personhood/member-key.js +10 -0
  92. package/dist/personhood/people-client.d.ts +14 -0
  93. package/dist/personhood/people-client.js +48 -0
  94. package/dist/personhood/reprove.d.ts +43 -0
  95. package/dist/personhood/reprove.js +225 -0
  96. package/dist/pool.d.ts +51 -0
  97. package/dist/pool.js +30 -0
  98. package/dist/run-state.d.ts +22 -0
  99. package/dist/run-state.js +20 -0
  100. package/dist/telemetry.d.ts +56 -0
  101. package/dist/telemetry.js +71 -0
  102. package/dist/version-check.d.ts +38 -0
  103. package/dist/version-check.js +30 -0
  104. package/docs/bootstrap.md +49 -0
  105. package/docs/e2e-bootstrap.md +154 -0
  106. package/docs/telemetry.md +62 -0
  107. package/docs/testing.md +44 -0
  108. package/package.json +82 -0
  109. package/tools/release-retry-wrapper.mjs +74 -0
@@ -0,0 +1,91 @@
1
+ import {
2
+ validateProductConfig
3
+ } from "./chunk-LZJMVPYW.js";
4
+ import {
5
+ NonRetryableError
6
+ } from "./chunk-ZOC4GITL.js";
7
+
8
+ // src/manifest/config-load.ts
9
+ import * as fs from "fs/promises";
10
+ import * as path from "path";
11
+ import { pathToFileURL } from "url";
12
+ var CANDIDATE_FILENAMES = [
13
+ "bulletin-deploy.config.ts",
14
+ "bulletin-deploy.config.js",
15
+ "bulletin-deploy.config.mjs"
16
+ ];
17
+ async function loadProductConfig(options = {}) {
18
+ const sourcePath = await resolveConfigPath(options);
19
+ const mod = await importConfig(sourcePath);
20
+ const candidate = pickDefault(mod);
21
+ const result = validateProductConfig(candidate);
22
+ if (!result.ok) {
23
+ throw new NonRetryableError(
24
+ `Invalid product config at ${sourcePath}:
25
+ - ${result.errors.join("\n - ")}`
26
+ );
27
+ }
28
+ return { config: result.value, sourcePath };
29
+ }
30
+ async function tryLoadProductConfig(options = {}) {
31
+ try {
32
+ return await loadProductConfig(options);
33
+ } catch (err) {
34
+ if (err instanceof NonRetryableError && /No product config found/.test(err.message)) {
35
+ return null;
36
+ }
37
+ throw err;
38
+ }
39
+ }
40
+ async function resolveConfigPath(options) {
41
+ if (options.path) {
42
+ const resolved = path.resolve(options.path);
43
+ if (!await fileExists(resolved)) {
44
+ throw new NonRetryableError(`Product config not found at ${resolved}`);
45
+ }
46
+ return resolved;
47
+ }
48
+ const start = path.resolve(options.cwd ?? process.cwd());
49
+ let dir = start;
50
+ while (true) {
51
+ for (const name of CANDIDATE_FILENAMES) {
52
+ const candidate = path.join(dir, name);
53
+ if (await fileExists(candidate)) return candidate;
54
+ }
55
+ if (!options.walkUp) break;
56
+ const parent = path.dirname(dir);
57
+ if (parent === dir) break;
58
+ dir = parent;
59
+ }
60
+ const where = options.walkUp ? `${start} (walking up)` : start;
61
+ throw new NonRetryableError(
62
+ `No product config found in ${where}. Looked for: ${CANDIDATE_FILENAMES.join(", ")}.`
63
+ );
64
+ }
65
+ async function fileExists(p) {
66
+ try {
67
+ const stat2 = await fs.stat(p);
68
+ return stat2.isFile();
69
+ } catch {
70
+ return false;
71
+ }
72
+ }
73
+ async function importConfig(sourcePath) {
74
+ if (sourcePath.endsWith(".ts")) {
75
+ const { createJiti } = await import("jiti");
76
+ const jiti = createJiti(import.meta.url, { interopDefault: false });
77
+ return jiti.import(sourcePath);
78
+ }
79
+ return import(pathToFileURL(sourcePath).href);
80
+ }
81
+ function pickDefault(mod) {
82
+ if (mod && typeof mod === "object" && "default" in mod) {
83
+ return mod.default;
84
+ }
85
+ return mod;
86
+ }
87
+
88
+ export {
89
+ loadProductConfig,
90
+ tryLoadProductConfig
91
+ };
@@ -0,0 +1,164 @@
1
+ import {
2
+ pessimisticSizePreflight
3
+ } from "./chunk-RI3ZLNPN.js";
4
+ import {
5
+ encodeContenthash,
6
+ resolveDotnsConnectOptions,
7
+ storeDirectory,
8
+ storeFile
9
+ } from "./chunk-P6CHOMN3.js";
10
+ import {
11
+ DotNS
12
+ } from "./chunk-DNXH4QTI.js";
13
+ import {
14
+ getPopSelfServeConfig,
15
+ loadEnvironments,
16
+ resolveEndpoints
17
+ } from "./chunk-OITUIM2E.js";
18
+ import {
19
+ NonRetryableError
20
+ } from "./chunk-ZOC4GITL.js";
21
+
22
+ // src/manifest/publish.ts
23
+ import * as fs from "fs/promises";
24
+ import * as path from "path";
25
+ async function publishManifest(opts) {
26
+ const { config, sourcePath } = opts.loaded;
27
+ if (config.domain !== opts.domain) {
28
+ throw new NonRetryableError(
29
+ `Config domain '${config.domain}' (in ${sourcePath}) does not match deploy domain '${opts.domain}'. Either update the config or pass the matching <domain> argument.`
30
+ );
31
+ }
32
+ const sizeReport = pessimisticSizePreflight(config);
33
+ if (!sizeReport.ok) {
34
+ const failing = sizeReport.checks.filter((c) => !c.ok).map((c) => `${c.key}: ${c.bytes}/${c.budget} B`).join(", ");
35
+ throw new NonRetryableError(
36
+ `Manifest size preflight failed: ${failing}. Shrink displayName / description / paths or override BULLETIN_TEXT_BUDGET.`
37
+ );
38
+ }
39
+ const configDir = path.dirname(sourcePath);
40
+ const iconAbs = path.resolve(configDir, config.icon.path);
41
+ const iconBytes = await readFileOrThrow(iconAbs, "icon");
42
+ console.log(`
43
+ Manifest publish \u2014 ${config.domain}`);
44
+ console.log(` Loaded config: ${sourcePath}`);
45
+ console.log(` Uploading icon (${iconBytes.length} B)\u2026`);
46
+ const iconCid = await storeFile(iconBytes);
47
+ console.log(` Icon CID: ${iconCid}`);
48
+ const executableCids = {};
49
+ for (const exec of config.executables) {
50
+ const execAbs = path.resolve(configDir, exec.path);
51
+ if (opts.buildDirCid && path.resolve(opts.buildDirCid.absPath) === execAbs) {
52
+ console.log(` Executable [${exec.kind}] reused build-dir CID: ${opts.buildDirCid.cid}`);
53
+ executableCids[exec.kind] = opts.buildDirCid.cid;
54
+ continue;
55
+ }
56
+ console.log(` Uploading executable [${exec.kind}] from ${execAbs}\u2026`);
57
+ const { storageCid } = await storeDirectory(execAbs, {}, void 0, true);
58
+ console.log(` Executable [${exec.kind}] CID: ${storageCid}`);
59
+ executableCids[exec.kind] = storageCid;
60
+ }
61
+ const dotns = await connectDotNS(opts);
62
+ try {
63
+ const baseLabel = stripDotSuffix(config.domain);
64
+ await dotns.ensureContentResolver(baseLabel);
65
+ const rootManifest = composeRoot(config, iconCid);
66
+ const rootJson = JSON.stringify(rootManifest);
67
+ console.log(` Writing root manifest text record on ${config.domain} (${Buffer.byteLength(rootJson, "utf8")} B)\u2026`);
68
+ await dotns.setTextRecord(baseLabel, "manifest", rootJson);
69
+ let textRecordsWritten = 1;
70
+ for (const exec of config.executables) {
71
+ const cid = executableCids[exec.kind];
72
+ if (!cid) throw new NonRetryableError(`Internal: missing CID for executable kind '${exec.kind}'`);
73
+ const ownership = await dotns.checkSubdomainOwnership(exec.kind, baseLabel);
74
+ if (!ownership.owned) {
75
+ if (ownership.owner) {
76
+ throw new NonRetryableError(
77
+ `Subname ${exec.kind}.${config.domain} is owned by ${ownership.owner}, not the publisher. Aborting.`
78
+ );
79
+ }
80
+ console.log(` Registering subname ${exec.kind}.${config.domain}\u2026`);
81
+ await dotns.registerSubdomain(exec.kind, baseLabel);
82
+ }
83
+ await dotns.ensureContentResolver(`${exec.kind}.${baseLabel}`);
84
+ const subContenthash = `0x${encodeContenthash(cid)}`;
85
+ console.log(` Setting contenthash on ${exec.kind}.${config.domain} \u2192 ${cid}\u2026`);
86
+ await dotns.setContenthash(`${exec.kind}.${baseLabel}`, subContenthash);
87
+ const execManifest = composeExecutable(exec);
88
+ const execJson = JSON.stringify(execManifest);
89
+ console.log(` Writing executable manifest on ${exec.kind}.${config.domain} (${Buffer.byteLength(execJson, "utf8")} B)\u2026`);
90
+ await dotns.setTextRecord(`${exec.kind}.${baseLabel}`, "executable", execJson);
91
+ textRecordsWritten++;
92
+ }
93
+ console.log(` \u2713 ${textRecordsWritten} text record${textRecordsWritten === 1 ? "" : "s"} written.`);
94
+ return { iconCid, executableCids, textRecordsWritten };
95
+ } finally {
96
+ dotns.disconnect();
97
+ }
98
+ }
99
+ async function readFileOrThrow(p, label) {
100
+ try {
101
+ return await fs.readFile(p);
102
+ } catch (err) {
103
+ throw new NonRetryableError(`Cannot read ${label} at ${p}: ${err.message}`);
104
+ }
105
+ }
106
+ async function connectDotNS(opts) {
107
+ const envId = opts.env ?? "paseo-next-v2";
108
+ const { doc } = await loadEnvironments();
109
+ const resolved = resolveEndpoints(doc, envId);
110
+ const popSelfServe = getPopSelfServeConfig(doc, envId);
111
+ const deployOptsShim = {
112
+ mnemonic: opts.mnemonic,
113
+ derivationPath: opts.derivationPath
114
+ };
115
+ const connectOpts = resolveDotnsConnectOptions(
116
+ deployOptsShim,
117
+ resolved.assetHub,
118
+ resolved.autoAccountMapping,
119
+ resolved.contracts,
120
+ resolved.nativeToEthRatio,
121
+ envId,
122
+ popSelfServe,
123
+ resolved.registerStorageDeposit
124
+ );
125
+ const dotns = new DotNS();
126
+ await dotns.connect(connectOpts);
127
+ return dotns;
128
+ }
129
+ function composeRoot(config, iconCid) {
130
+ return {
131
+ $v: 1,
132
+ displayName: config.displayName,
133
+ description: config.description,
134
+ icon: { cid: iconCid, format: config.icon.format }
135
+ };
136
+ }
137
+ function composeExecutable(exec) {
138
+ if (exec.kind === "app") {
139
+ return { $v: 1, kind: "app", appVersion: exec.appVersion };
140
+ }
141
+ if (exec.kind === "widget") {
142
+ return {
143
+ $v: 1,
144
+ kind: "widget",
145
+ appVersion: exec.appVersion,
146
+ dimensions: exec.dimensions,
147
+ ...exec.description !== void 0 ? { description: exec.description } : {}
148
+ };
149
+ }
150
+ return {
151
+ $v: 1,
152
+ kind: "worker",
153
+ appVersion: exec.appVersion,
154
+ entrypoint: exec.entrypoint,
155
+ includes: exec.includes
156
+ };
157
+ }
158
+ function stripDotSuffix(domain) {
159
+ return domain.replace(/\.dot$/i, "");
160
+ }
161
+
162
+ export {
163
+ publishManifest
164
+ };