bulletin-deploy 0.7.14 → 0.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/bin/bulletin-deploy +5 -0
- package/dist/bug-report.js +4 -4
- package/dist/chunk-5MRZ3V4A.js +171 -0
- package/dist/{chunk-LM5U3XDV.js → chunk-5TW653QP.js} +1 -1
- package/dist/{chunk-3RNYFSU7.js → chunk-AQUBKPSF.js} +2 -2
- package/dist/chunk-C2TS5MER.js +64 -0
- package/dist/{chunk-4AP5ZFNV.js → chunk-KMRYJR4E.js} +1 -1
- package/dist/chunk-KOSF5FDO.js +49 -0
- package/dist/chunk-MJTQOXBC.js +140 -0
- package/dist/{chunk-6YJ46BN2.js → chunk-NE5MN2M2.js} +1 -1
- package/dist/chunk-S7EM5VMW.js +108 -0
- package/dist/{chunk-3ILZFC4E.js → chunk-VQHM3R6N.js} +805 -31
- package/dist/chunk-Y2OSXJIZ.js +177 -0
- package/dist/{chunk-N7YE5ZN3.js → chunk-ZGU6FOLO.js} +2 -2
- package/dist/chunk-probe.d.ts +36 -0
- package/dist/chunk-probe.js +19 -0
- package/dist/chunker.d.ts +8 -0
- package/dist/chunker.js +11 -0
- package/dist/deploy.d.ts +73 -2
- package/dist/deploy.js +24 -7
- package/dist/dotns.js +3 -3
- package/dist/incremental-stats.d.ts +65 -0
- package/dist/incremental-stats.js +11 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +51 -12
- package/dist/manifest-embed.d.ts +18 -0
- package/dist/manifest-embed.js +10 -0
- package/dist/manifest-fetch.d.ts +26 -0
- package/dist/manifest-fetch.js +14 -0
- package/dist/manifest-roundtrip.d.ts +15 -0
- package/dist/manifest-roundtrip.js +56 -0
- package/dist/manifest.d.ts +44 -0
- package/dist/manifest.js +21 -0
- package/dist/memory-report.js +2 -2
- package/dist/merkle.d.ts +38 -1
- package/dist/merkle.js +28 -3
- package/dist/run-state.js +1 -1
- package/dist/telemetry.js +2 -2
- package/dist/version-check.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-B7GUYYAN.js +0 -94
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
captureWarning
|
|
3
|
+
} from "./chunk-KMRYJR4E.js";
|
|
4
|
+
|
|
5
|
+
// src/chunk-probe.ts
|
|
6
|
+
import { Twox128, Blake2128Concat, decAnyMetadata, unifyMetadata } from "@polkadot-api/substrate-bindings";
|
|
7
|
+
import { CID } from "multiformats/cid";
|
|
8
|
+
var ChainProbeMetadataError = class extends Error {
|
|
9
|
+
constructor(msg) {
|
|
10
|
+
super(msg);
|
|
11
|
+
this.name = "ChainProbeMetadataError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var ChainProbeCrossValidationError = class extends Error {
|
|
15
|
+
constructor(msg) {
|
|
16
|
+
super(msg);
|
|
17
|
+
this.name = "ChainProbeCrossValidationError";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var _enc = new TextEncoder();
|
|
21
|
+
var MAX_BLOCK = 2 ** 30;
|
|
22
|
+
var MAX_TX_INDEX = 512;
|
|
23
|
+
var DEFAULT_BATCH_SIZE = 500;
|
|
24
|
+
var _metadataChecked = false;
|
|
25
|
+
var _crossValidated = false;
|
|
26
|
+
var _sentryBatchCount = 0;
|
|
27
|
+
function buildStorageKey(contentHashBytes) {
|
|
28
|
+
const parts = [
|
|
29
|
+
Twox128(_enc.encode("TransactionStorage")),
|
|
30
|
+
Twox128(_enc.encode("TransactionByContentHash")),
|
|
31
|
+
Blake2128Concat(contentHashBytes)
|
|
32
|
+
];
|
|
33
|
+
const total = parts.reduce((s, p) => s + p.length, 0);
|
|
34
|
+
const key = new Uint8Array(total);
|
|
35
|
+
let offset = 0;
|
|
36
|
+
for (const p of parts) {
|
|
37
|
+
key.set(p, offset);
|
|
38
|
+
offset += p.length;
|
|
39
|
+
}
|
|
40
|
+
return "0x" + Buffer.from(key).toString("hex");
|
|
41
|
+
}
|
|
42
|
+
function cidToContentHash(cidStr) {
|
|
43
|
+
return CID.parse(cidStr).multihash.digest;
|
|
44
|
+
}
|
|
45
|
+
function hexToBytes(hex) {
|
|
46
|
+
return Buffer.from(hex.replace(/^0x/, ""), "hex");
|
|
47
|
+
}
|
|
48
|
+
function _decodeStorageValue(hex) {
|
|
49
|
+
if (!hex || hex === "0x" || hex === "0x00") return null;
|
|
50
|
+
const bytes = hexToBytes(hex);
|
|
51
|
+
if (bytes.length < 8) return null;
|
|
52
|
+
const block = bytes.readUInt32LE(0);
|
|
53
|
+
const index = bytes.readUInt32LE(4);
|
|
54
|
+
if (block <= 0 || block >= MAX_BLOCK || index >= MAX_TX_INDEX) return null;
|
|
55
|
+
return { block, index };
|
|
56
|
+
}
|
|
57
|
+
async function ensureMetadataChecked(client) {
|
|
58
|
+
if (_metadataChecked) return;
|
|
59
|
+
const metaHex = await client._request("state_getMetadata", []);
|
|
60
|
+
const decoded = decAnyMetadata(hexToBytes(metaHex));
|
|
61
|
+
const unified = unifyMetadata(decoded);
|
|
62
|
+
const pallet = unified.pallets?.find((p) => p.name === "TransactionStorage");
|
|
63
|
+
if (!pallet) throw new ChainProbeMetadataError("TransactionStorage pallet not found in runtime metadata");
|
|
64
|
+
const item = pallet.storage?.items?.find((e) => e.name === "TransactionByContentHash");
|
|
65
|
+
if (!item) throw new ChainProbeMetadataError("TransactionByContentHash entry not found in TransactionStorage");
|
|
66
|
+
if (item.type?.tag !== "map") {
|
|
67
|
+
throw new ChainProbeMetadataError(
|
|
68
|
+
`TransactionByContentHash storage type is '${item.type?.tag}', expected 'map'`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const hasher = item.type.value?.hashers?.[0]?.tag;
|
|
72
|
+
if (hasher !== "Blake2128Concat") {
|
|
73
|
+
throw new ChainProbeMetadataError(
|
|
74
|
+
`TransactionByContentHash key hasher is '${hasher}', expected 'Blake2128Concat'. Update key construction in chunk-probe.ts.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
_metadataChecked = true;
|
|
78
|
+
}
|
|
79
|
+
async function crossValidateFirstHit(client, cid, block, index, contentHashBytes) {
|
|
80
|
+
if (_crossValidated) return;
|
|
81
|
+
_crossValidated = true;
|
|
82
|
+
try {
|
|
83
|
+
const blockBuf = Buffer.alloc(4);
|
|
84
|
+
blockBuf.writeUInt32LE(block, 0);
|
|
85
|
+
const txKey = "0x" + Buffer.from([
|
|
86
|
+
...Twox128(_enc.encode("TransactionStorage")),
|
|
87
|
+
...Twox128(_enc.encode("Transactions")),
|
|
88
|
+
...Blake2128Concat(blockBuf)
|
|
89
|
+
]).toString("hex");
|
|
90
|
+
const result = await client._request("state_queryStorageAt", [[txKey]]);
|
|
91
|
+
const hex = result[0]?.changes?.[0]?.[1];
|
|
92
|
+
if (!hex) {
|
|
93
|
+
captureWarning("chunk-probe cross-validate: Transactions[block] absent (non-fatal)", { cid, block, index });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const haystack = hexToBytes(hex);
|
|
97
|
+
const needle = Buffer.from(contentHashBytes);
|
|
98
|
+
if (!haystack.includes(needle)) {
|
|
99
|
+
throw new ChainProbeCrossValidationError(
|
|
100
|
+
`Cross-validation failed: content hash for CID ${cid} not found in Transactions[${block}]. Key construction may be wrong. Run tools/chain-probe-key-probe.mjs to diagnose.`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
} catch (e) {
|
|
104
|
+
if (e instanceof ChainProbeCrossValidationError) throw e;
|
|
105
|
+
captureWarning("chunk-probe cross-validate RPC error (non-fatal)", { cid, error: String(e).slice(0, 200) });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function probeChunks(cids, options) {
|
|
109
|
+
if (cids.length === 0) return [];
|
|
110
|
+
const { client, batchSize = DEFAULT_BATCH_SIZE } = options;
|
|
111
|
+
try {
|
|
112
|
+
await ensureMetadataChecked(client);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
if (e instanceof ChainProbeMetadataError) throw e;
|
|
115
|
+
return cids.map((cid) => ({ cid, present: null, failureReason: "metadata_error" }));
|
|
116
|
+
}
|
|
117
|
+
const results = new Array(cids.length);
|
|
118
|
+
for (let start = 0; start < cids.length; start += batchSize) {
|
|
119
|
+
const batchCids = cids.slice(start, start + batchSize);
|
|
120
|
+
const batchDigests = batchCids.map(cidToContentHash);
|
|
121
|
+
const batchKeys = batchDigests.map(buildStorageKey);
|
|
122
|
+
let changes;
|
|
123
|
+
try {
|
|
124
|
+
const rpcResult = await client._request("state_queryStorageAt", [batchKeys]);
|
|
125
|
+
changes = rpcResult[0]?.changes ?? [];
|
|
126
|
+
} catch {
|
|
127
|
+
for (let i = 0; i < batchCids.length; i++) {
|
|
128
|
+
results[start + i] = { cid: batchCids[i], present: null, failureReason: "rpc_error" };
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const keyToValue = new Map(changes);
|
|
133
|
+
for (let i = 0; i < batchCids.length; i++) {
|
|
134
|
+
const cid = batchCids[i];
|
|
135
|
+
const key = batchKeys[i];
|
|
136
|
+
const rawValue = keyToValue.get(key) ?? null;
|
|
137
|
+
if (!rawValue) {
|
|
138
|
+
results[start + i] = { cid, present: false };
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const decoded = _decodeStorageValue(rawValue);
|
|
142
|
+
if (!decoded) {
|
|
143
|
+
if (_sentryBatchCount < 3) {
|
|
144
|
+
captureWarning("chunk-probe decode failed (out-of-range or short value)", {
|
|
145
|
+
cid,
|
|
146
|
+
raw_hex: rawValue.slice(0, 64)
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
results[start + i] = { cid, present: null, failureReason: "decode_error" };
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
results[start + i] = { cid, present: true, block: decoded.block, index: decoded.index };
|
|
153
|
+
if (!_crossValidated) {
|
|
154
|
+
await crossValidateFirstHit(client, cid, decoded.block, decoded.index, batchDigests[i]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (_sentryBatchCount < 3) _sentryBatchCount++;
|
|
158
|
+
}
|
|
159
|
+
return results;
|
|
160
|
+
}
|
|
161
|
+
function _resetProbeSession() {
|
|
162
|
+
_metadataChecked = false;
|
|
163
|
+
_crossValidated = false;
|
|
164
|
+
_sentryBatchCount = 0;
|
|
165
|
+
}
|
|
166
|
+
function _bypassMetadataCheckForTest() {
|
|
167
|
+
_metadataChecked = true;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
ChainProbeMetadataError,
|
|
172
|
+
ChainProbeCrossValidationError,
|
|
173
|
+
_decodeStorageValue,
|
|
174
|
+
probeChunks,
|
|
175
|
+
_resetProbeSession,
|
|
176
|
+
_bypassMetadataCheckForTest
|
|
177
|
+
};
|
|
@@ -6,7 +6,7 @@ import * as path from "path";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "bulletin-deploy",
|
|
9
|
-
version: "0.7.
|
|
9
|
+
version: "0.7.15",
|
|
10
10
|
private: false,
|
|
11
11
|
repository: {
|
|
12
12
|
type: "git",
|
|
@@ -37,7 +37,7 @@ var package_default = {
|
|
|
37
37
|
],
|
|
38
38
|
scripts: {
|
|
39
39
|
prebuild: "node scripts/refresh-environments.mjs",
|
|
40
|
-
build: "tsup src/index.ts src/deploy.ts src/dotns.ts src/pool.ts src/telemetry.ts src/memory-report.ts src/merkle.ts src/gh-pages-mirror.ts src/version-check.ts src/bug-report.ts src/run-state.ts src/environments.ts src/errors.ts --format esm --dts --clean --target node22",
|
|
40
|
+
build: "tsup src/index.ts src/deploy.ts src/dotns.ts src/pool.ts src/telemetry.ts src/memory-report.ts src/merkle.ts src/gh-pages-mirror.ts src/version-check.ts src/bug-report.ts src/run-state.ts src/environments.ts src/errors.ts src/manifest.ts src/chunk-probe.ts src/manifest-embed.ts src/manifest-fetch.ts src/manifest-roundtrip.ts src/incremental-stats.ts src/chunker.ts --format esm --dts --clean --target node22",
|
|
41
41
|
"refresh-environments": "node scripts/refresh-environments.mjs",
|
|
42
42
|
prepare: "npm run build",
|
|
43
43
|
test: "npm run build && node --test test/test.js test/cli-help.test.js test/helpers/e2e-helpers.test.js test/environments.test.js",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type ChunkProbeFailureReason = "rpc_error" | "decode_error" | "metadata_error";
|
|
2
|
+
type ChunkProbeResult = {
|
|
3
|
+
cid: string;
|
|
4
|
+
present: false;
|
|
5
|
+
} | {
|
|
6
|
+
cid: string;
|
|
7
|
+
present: true;
|
|
8
|
+
block: number;
|
|
9
|
+
index: number;
|
|
10
|
+
} | {
|
|
11
|
+
cid: string;
|
|
12
|
+
present: null;
|
|
13
|
+
failureReason: ChunkProbeFailureReason;
|
|
14
|
+
};
|
|
15
|
+
interface ChainProbeOptions {
|
|
16
|
+
client: any;
|
|
17
|
+
batchSize?: number;
|
|
18
|
+
}
|
|
19
|
+
declare class ChainProbeMetadataError extends Error {
|
|
20
|
+
constructor(msg: string);
|
|
21
|
+
}
|
|
22
|
+
declare class ChainProbeCrossValidationError extends Error {
|
|
23
|
+
constructor(msg: string);
|
|
24
|
+
}
|
|
25
|
+
/** Exported for unit testing. */
|
|
26
|
+
declare function _decodeStorageValue(hex: string | null | undefined): {
|
|
27
|
+
block: number;
|
|
28
|
+
index: number;
|
|
29
|
+
} | null;
|
|
30
|
+
declare function probeChunks(cids: string[], options: ChainProbeOptions): Promise<ChunkProbeResult[]>;
|
|
31
|
+
/** Reset session-level caches. Used in tests only. */
|
|
32
|
+
declare function _resetProbeSession(): void;
|
|
33
|
+
/** Pre-set metadataChecked so tests don't need a real metadata RPC mock. Used in tests only. */
|
|
34
|
+
declare function _bypassMetadataCheckForTest(): void;
|
|
35
|
+
|
|
36
|
+
export { ChainProbeCrossValidationError, ChainProbeMetadataError, type ChainProbeOptions, type ChunkProbeFailureReason, type ChunkProbeResult, _bypassMetadataCheckForTest, _decodeStorageValue, _resetProbeSession, probeChunks };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChainProbeCrossValidationError,
|
|
3
|
+
ChainProbeMetadataError,
|
|
4
|
+
_bypassMetadataCheckForTest,
|
|
5
|
+
_decodeStorageValue,
|
|
6
|
+
_resetProbeSession,
|
|
7
|
+
probeChunks
|
|
8
|
+
} from "./chunk-Y2OSXJIZ.js";
|
|
9
|
+
import "./chunk-KMRYJR4E.js";
|
|
10
|
+
import "./chunk-ZGU6FOLO.js";
|
|
11
|
+
import "./chunk-QGM4M3NI.js";
|
|
12
|
+
export {
|
|
13
|
+
ChainProbeCrossValidationError,
|
|
14
|
+
ChainProbeMetadataError,
|
|
15
|
+
_bypassMetadataCheckForTest,
|
|
16
|
+
_decodeStorageValue,
|
|
17
|
+
_resetProbeSession,
|
|
18
|
+
probeChunks
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const CHUNK_SIZE_TARGET: number;
|
|
2
|
+
declare const CHUNK_SIZE_MAX: number;
|
|
3
|
+
interface SectionFile {
|
|
4
|
+
blocks: Uint8Array[];
|
|
5
|
+
}
|
|
6
|
+
declare function packSection(files: SectionFile[]): Uint8Array[];
|
|
7
|
+
|
|
8
|
+
export { CHUNK_SIZE_MAX, CHUNK_SIZE_TARGET, type SectionFile, packSection };
|
package/dist/chunker.js
ADDED
package/dist/deploy.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CID } from 'multiformats/cid';
|
|
2
|
+
import { ManifestFileEntry } from './manifest.js';
|
|
2
3
|
import { PolkadotSigner } from 'polkadot-api';
|
|
3
4
|
export { EXIT_CODE_NO_RETRY, NonRetryableError } from './errors.js';
|
|
4
5
|
|
|
@@ -24,6 +25,14 @@ interface ExistingProvider {
|
|
|
24
25
|
ss58?: string;
|
|
25
26
|
reconnect?: () => Promise<ProviderResult>;
|
|
26
27
|
fetchNonce?: (rpc: string | string[], ss58: string) => Promise<number>;
|
|
28
|
+
skipCids?: Set<string>;
|
|
29
|
+
probeFailedCids?: Set<string>;
|
|
30
|
+
gateway?: string;
|
|
31
|
+
}
|
|
32
|
+
interface StoredChunk {
|
|
33
|
+
cid: CID;
|
|
34
|
+
len: number;
|
|
35
|
+
viaFallback?: boolean;
|
|
27
36
|
}
|
|
28
37
|
declare const DEFAULT_BULLETIN_RPC = "wss://paseo-bulletin-rpc.polkadot.io";
|
|
29
38
|
declare const DEFAULT_POOL_SIZE = 10;
|
|
@@ -45,7 +54,21 @@ declare const ENCRYPT_KEY_LEN = 32;
|
|
|
45
54
|
declare const ENCRYPT_PBKDF2_ITERATIONS = 100000;
|
|
46
55
|
declare function encryptContent(data: Uint8Array, password: string): Promise<Uint8Array>;
|
|
47
56
|
declare function storeFile(contentBytes: Uint8Array, { client: existingClient, unsafeApi: existingApi, signer: existingSigner }?: ExistingProvider): Promise<string>;
|
|
48
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Pre-compute dense nonces for chunks that need submission.
|
|
59
|
+
* Chunks where stored[i] !== null are already on chain (skipped via skipCids or
|
|
60
|
+
* prior reconnect logic) and consume zero nonce slots.
|
|
61
|
+
* Exported under a test-only alias so unit tests can verify the dense property
|
|
62
|
+
* without touching the real chain.
|
|
63
|
+
*/
|
|
64
|
+
declare function assignDenseNonces(stored: (StoredChunk | null)[], startNonce: number): Map<number, number>;
|
|
65
|
+
declare const __assignDenseNoncesForTest: typeof assignDenseNonces;
|
|
66
|
+
declare function storeChunkedContent(chunks: Uint8Array[], { client: existingClient, unsafeApi: existingApi, signer: existingSigner, ss58: existingSS58, reconnect, fetchNonce: fetchNonceOverride, skipCids, probeFailedCids, gateway: providerGateway }?: ExistingProvider): Promise<{
|
|
67
|
+
storageCid: string;
|
|
68
|
+
tier2Verified: number;
|
|
69
|
+
tier2Inconclusive: number;
|
|
70
|
+
tier2Fallback: number;
|
|
71
|
+
}>;
|
|
49
72
|
declare function chunk(data: Uint8Array, size?: number): Uint8Array[];
|
|
50
73
|
declare function hasIPFS(): boolean;
|
|
51
74
|
declare function merkleize(directoryPath: string, outputCarPath: string): Promise<{
|
|
@@ -66,12 +89,52 @@ interface StoreDirectoryOptions {
|
|
|
66
89
|
* through to the caller so they can decide fatal / non-fatal policy.
|
|
67
90
|
*/
|
|
68
91
|
onCarReady?: (carBytes: Uint8Array, storageCid: string) => Promise<void> | void;
|
|
92
|
+
/**
|
|
93
|
+
* v2 incremental upload: contenthash from the previous deploy of this
|
|
94
|
+
* domain (the IPFS CID, not the e3-prefixed bytes). The new flow fetches
|
|
95
|
+
* this CID's embedded manifest via the gateway, classifies files,
|
|
96
|
+
* probes chunks for presence, and skips re-uploading any chunk already
|
|
97
|
+
* stored on chain. Pass null (or omit) for first-deploy behaviour.
|
|
98
|
+
* Encrypted deploys (password set) bypass the incremental path because
|
|
99
|
+
* encryption breaks chunk-level dedup.
|
|
100
|
+
*/
|
|
101
|
+
previousContenthash?: string | null;
|
|
102
|
+
/** Override gateway URL for manifest fetch + chunk probes. */
|
|
103
|
+
gateway?: string;
|
|
104
|
+
/** Skip the 500 MiB abort guard and allow oversized deploys. */
|
|
105
|
+
allowLargeDeploy?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Pin the `deployedAt` timestamp for byte-identical rebuilds.
|
|
108
|
+
* Values: "commit" (git committer date), "epoch:<N>" (Unix epoch seconds),
|
|
109
|
+
* or any ISO 8601 string. Omit for a live wall-clock timestamp.
|
|
110
|
+
*/
|
|
111
|
+
reproducibleSource?: string;
|
|
69
112
|
}
|
|
70
113
|
declare function storeDirectory(directoryPath: string, providerOrOptions?: ExistingProvider | StoreDirectoryOptions, password?: string, jsMerkle?: boolean): Promise<{
|
|
71
114
|
storageCid: string;
|
|
72
115
|
ipfsCid: string;
|
|
73
116
|
carBytes: Uint8Array;
|
|
74
117
|
}>;
|
|
118
|
+
declare function buildFilesMap(buildDir: string, fileCids?: Map<string, string>): Record<string, ManifestFileEntry>;
|
|
119
|
+
declare function detectFramework(directoryPath: string): string | null;
|
|
120
|
+
type SizeDecision = {
|
|
121
|
+
kind: "ok";
|
|
122
|
+
} | {
|
|
123
|
+
kind: "warn";
|
|
124
|
+
message: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: "abort";
|
|
127
|
+
message: string;
|
|
128
|
+
};
|
|
129
|
+
declare function checkDeploySize(carBytes: number, opts: {
|
|
130
|
+
allowLargeDeploy?: boolean;
|
|
131
|
+
}): SizeDecision;
|
|
132
|
+
declare function resolveReproducibleTimestamp(source: string): string;
|
|
133
|
+
declare function storeDirectoryV2(directoryPath: string, opts?: StoreDirectoryOptions): Promise<{
|
|
134
|
+
storageCid: string;
|
|
135
|
+
ipfsCid: string;
|
|
136
|
+
carBytes: Uint8Array;
|
|
137
|
+
}>;
|
|
75
138
|
interface DeployOptions {
|
|
76
139
|
mnemonic?: string;
|
|
77
140
|
/** Optional derivation path applied to the mnemonic (e.g. "//deploy/3"). Defaults to "" (root key). */
|
|
@@ -105,6 +168,14 @@ interface DeployOptions {
|
|
|
105
168
|
name?: string;
|
|
106
169
|
/** When set, writes the "description" text record. ≤100 chars recommended for host-app cards. */
|
|
107
170
|
description?: string;
|
|
171
|
+
/** Skip the 500 MiB abort guard and allow oversized deploys. */
|
|
172
|
+
allowLargeDeploy?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Pin the `deployedAt` timestamp for byte-identical rebuilds.
|
|
175
|
+
* Values: "commit" (git committer date), "epoch:<N>" (Unix epoch seconds),
|
|
176
|
+
* or any ISO 8601 string. Omit for a live wall-clock timestamp.
|
|
177
|
+
*/
|
|
178
|
+
reproducibleSource?: string;
|
|
108
179
|
/**
|
|
109
180
|
* Environment id from environments.json (e.g. "paseo-next", "paseo-review").
|
|
110
181
|
* Drives both the bulletin RPC and the asset-hub RPC. Defaults to
|
|
@@ -131,4 +202,4 @@ declare function resolveDotnsConnectOptions(options: Pick<DeployOptions, "mnemon
|
|
|
131
202
|
declare function estimateUploadBytes(content: DeployContent): Promise<number | null>;
|
|
132
203
|
declare function deploy(content: DeployContent, domainName?: string | null, options?: DeployOptions): Promise<DeployResult>;
|
|
133
204
|
|
|
134
|
-
export { CHUNK_MORTALITY_PERIOD, DEFAULT_BULLETIN_RPC, DEFAULT_POOL_SIZE, type DeployContent, type DeployOptions, type DeployResult, ENCRYPT_KEY_LEN, ENCRYPT_MAGIC, ENCRYPT_NONCE_LEN, ENCRYPT_PBKDF2_ITERATIONS, ENCRYPT_SALT_LEN, ENCRYPT_TAG_LEN, type StoreDirectoryOptions, chunk, computeStorageCid, createCID, deploy, deriveRootSigner, encodeContenthash, encryptContent, estimateUploadBytes, friendlyChainError, hasIPFS, isConnectionError, merkleize, resolveDotnsConnectOptions, retryBudgetExhausted, setWsHaltCallback, storeChunkedContent, storeDirectory, storeFile };
|
|
205
|
+
export { CHUNK_MORTALITY_PERIOD, DEFAULT_BULLETIN_RPC, DEFAULT_POOL_SIZE, type DeployContent, type DeployOptions, type DeployResult, ENCRYPT_KEY_LEN, ENCRYPT_MAGIC, ENCRYPT_NONCE_LEN, ENCRYPT_PBKDF2_ITERATIONS, ENCRYPT_SALT_LEN, ENCRYPT_TAG_LEN, type SizeDecision, type StoreDirectoryOptions, __assignDenseNoncesForTest, buildFilesMap, checkDeploySize, chunk, computeStorageCid, createCID, deploy, deriveRootSigner, detectFramework, encodeContenthash, encryptContent, estimateUploadBytes, friendlyChainError, hasIPFS, isConnectionError, merkleize, resolveDotnsConnectOptions, resolveReproducibleTimestamp, retryBudgetExhausted, setWsHaltCallback, storeChunkedContent, storeDirectory, storeDirectoryV2, storeFile };
|
package/dist/deploy.js
CHANGED
|
@@ -8,11 +8,15 @@ import {
|
|
|
8
8
|
ENCRYPT_PBKDF2_ITERATIONS,
|
|
9
9
|
ENCRYPT_SALT_LEN,
|
|
10
10
|
ENCRYPT_TAG_LEN,
|
|
11
|
+
__assignDenseNoncesForTest,
|
|
12
|
+
buildFilesMap,
|
|
13
|
+
checkDeploySize,
|
|
11
14
|
chunk,
|
|
12
15
|
computeStorageCid,
|
|
13
16
|
createCID,
|
|
14
17
|
deploy,
|
|
15
18
|
deriveRootSigner,
|
|
19
|
+
detectFramework,
|
|
16
20
|
encodeContenthash,
|
|
17
21
|
encryptContent,
|
|
18
22
|
estimateUploadBytes,
|
|
@@ -21,25 +25,32 @@ import {
|
|
|
21
25
|
isConnectionError,
|
|
22
26
|
merkleize,
|
|
23
27
|
resolveDotnsConnectOptions,
|
|
28
|
+
resolveReproducibleTimestamp,
|
|
24
29
|
retryBudgetExhausted,
|
|
25
30
|
setWsHaltCallback,
|
|
26
31
|
storeChunkedContent,
|
|
27
32
|
storeDirectory,
|
|
33
|
+
storeDirectoryV2,
|
|
28
34
|
storeFile
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
35
|
+
} from "./chunk-VQHM3R6N.js";
|
|
36
|
+
import "./chunk-MJTQOXBC.js";
|
|
37
|
+
import "./chunk-KOSF5FDO.js";
|
|
38
|
+
import "./chunk-5MRZ3V4A.js";
|
|
39
|
+
import "./chunk-S7EM5VMW.js";
|
|
40
|
+
import "./chunk-AQUBKPSF.js";
|
|
41
|
+
import "./chunk-NE5MN2M2.js";
|
|
42
|
+
import "./chunk-Y2OSXJIZ.js";
|
|
43
|
+
import "./chunk-C2TS5MER.js";
|
|
44
|
+
import "./chunk-5TW653QP.js";
|
|
34
45
|
import "./chunk-VOEFHED3.js";
|
|
46
|
+
import "./chunk-KMRYJR4E.js";
|
|
47
|
+
import "./chunk-ZGU6FOLO.js";
|
|
35
48
|
import "./chunk-2VYG7NXN.js";
|
|
36
49
|
import {
|
|
37
50
|
EXIT_CODE_NO_RETRY,
|
|
38
51
|
NonRetryableError
|
|
39
52
|
} from "./chunk-ZOC4GITL.js";
|
|
40
53
|
import "./chunk-HOTQDYHD.js";
|
|
41
|
-
import "./chunk-4AP5ZFNV.js";
|
|
42
|
-
import "./chunk-N7YE5ZN3.js";
|
|
43
54
|
import "./chunk-QGM4M3NI.js";
|
|
44
55
|
export {
|
|
45
56
|
CHUNK_MORTALITY_PERIOD,
|
|
@@ -53,11 +64,15 @@ export {
|
|
|
53
64
|
ENCRYPT_TAG_LEN,
|
|
54
65
|
EXIT_CODE_NO_RETRY,
|
|
55
66
|
NonRetryableError,
|
|
67
|
+
__assignDenseNoncesForTest,
|
|
68
|
+
buildFilesMap,
|
|
69
|
+
checkDeploySize,
|
|
56
70
|
chunk,
|
|
57
71
|
computeStorageCid,
|
|
58
72
|
createCID,
|
|
59
73
|
deploy,
|
|
60
74
|
deriveRootSigner,
|
|
75
|
+
detectFramework,
|
|
61
76
|
encodeContenthash,
|
|
62
77
|
encryptContent,
|
|
63
78
|
estimateUploadBytes,
|
|
@@ -66,9 +81,11 @@ export {
|
|
|
66
81
|
isConnectionError,
|
|
67
82
|
merkleize,
|
|
68
83
|
resolveDotnsConnectOptions,
|
|
84
|
+
resolveReproducibleTimestamp,
|
|
69
85
|
retryBudgetExhausted,
|
|
70
86
|
setWsHaltCallback,
|
|
71
87
|
storeChunkedContent,
|
|
72
88
|
storeDirectory,
|
|
89
|
+
storeDirectoryV2,
|
|
73
90
|
storeFile
|
|
74
91
|
};
|
package/dist/dotns.js
CHANGED
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
stripTrailingDigits,
|
|
37
37
|
validateDomainLabel,
|
|
38
38
|
verifyNonceAdvanced
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-5TW653QP.js";
|
|
40
40
|
import "./chunk-VOEFHED3.js";
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-KMRYJR4E.js";
|
|
42
|
+
import "./chunk-ZGU6FOLO.js";
|
|
43
43
|
import "./chunk-QGM4M3NI.js";
|
|
44
44
|
export {
|
|
45
45
|
CONNECTION_TIMEOUT_MS,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ChunkProbeResult } from './chunk-probe.js';
|
|
2
|
+
import { ManifestChunkEntry } from './manifest.js';
|
|
3
|
+
|
|
4
|
+
interface IncrementalStats {
|
|
5
|
+
manifestSource: "embedded" | "heuristic_fallback" | "none";
|
|
6
|
+
manifestFetchAttempts: number;
|
|
7
|
+
manifestBytes: number;
|
|
8
|
+
framework: string | null;
|
|
9
|
+
filesTotal: number;
|
|
10
|
+
filesStable: number;
|
|
11
|
+
filesVolatile: number;
|
|
12
|
+
probedTotal: number;
|
|
13
|
+
probePresent: number;
|
|
14
|
+
probeAbsent: number;
|
|
15
|
+
probeFailed: number;
|
|
16
|
+
probeFailedRpc: number;
|
|
17
|
+
probeFailedDecode: number;
|
|
18
|
+
probeFailedMetadata: number;
|
|
19
|
+
recycledCids: number;
|
|
20
|
+
retentionPeriodBlocks: number;
|
|
21
|
+
bytesSkipped: number;
|
|
22
|
+
bytesUploaded: number;
|
|
23
|
+
chunksTotal: number;
|
|
24
|
+
chunksUploaded: number;
|
|
25
|
+
chunksSkipped: number;
|
|
26
|
+
carBytes: number;
|
|
27
|
+
section0Bytes: number;
|
|
28
|
+
section1Bytes: number;
|
|
29
|
+
section2Bytes: number;
|
|
30
|
+
estimatedSecondsSaved: number;
|
|
31
|
+
tier2VerifiedCount: number;
|
|
32
|
+
tier2InconclusiveCount: number;
|
|
33
|
+
tier2FallbackCount: number;
|
|
34
|
+
}
|
|
35
|
+
interface ComputeStatsInput {
|
|
36
|
+
manifestSource: IncrementalStats["manifestSource"];
|
|
37
|
+
manifestFetchAttempts: number;
|
|
38
|
+
manifestBytes?: number;
|
|
39
|
+
framework: string | null;
|
|
40
|
+
filesTotal: number;
|
|
41
|
+
filesStable: number;
|
|
42
|
+
filesVolatile: number;
|
|
43
|
+
probeResults: ChunkProbeResult[];
|
|
44
|
+
prevChunks: Record<string, ManifestChunkEntry>;
|
|
45
|
+
retentionPeriodBlocks: number;
|
|
46
|
+
bytesSkipped: number;
|
|
47
|
+
bytesUploaded: number;
|
|
48
|
+
chunksTotal: number;
|
|
49
|
+
chunksUploaded: number;
|
|
50
|
+
chunksSkipped: number;
|
|
51
|
+
carBytes: number;
|
|
52
|
+
sectionSizes: {
|
|
53
|
+
section0: number;
|
|
54
|
+
section1: number;
|
|
55
|
+
section2: number;
|
|
56
|
+
};
|
|
57
|
+
tier2VerifiedCount: number;
|
|
58
|
+
tier2InconclusiveCount: number;
|
|
59
|
+
tier2FallbackCount: number;
|
|
60
|
+
}
|
|
61
|
+
declare function computeStats(input: ComputeStatsInput): IncrementalStats;
|
|
62
|
+
declare function telemetryAttributes(s: IncrementalStats): Record<string, string>;
|
|
63
|
+
declare function renderSummary(s: IncrementalStats): string;
|
|
64
|
+
|
|
65
|
+
export { type ComputeStatsInput, type IncrementalStats, computeStats, renderSummary, telemetryAttributes };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export { DeployContent, DeployOptions, DeployResult, deploy } from './deploy.js';
|
|
2
2
|
export { PoolAccount, PoolAuthorization, bootstrapPool, derivePoolAccounts, ensureAuthorized, fetchPoolAuthorizations, selectAccount } from './pool.js';
|
|
3
3
|
export { DotNS, DotNSConnectOptions, OwnershipResult, ParsedDomainName, PriceValidationResult, parseDomainName } from './dotns.js';
|
|
4
|
-
export { MerkleizeResult, merkleizeJS } from './merkle.js';
|
|
4
|
+
export { MerkleizeResult, MerkleizeStableResult, merkleizeJS, merkleizeWithStableOrder } from './merkle.js';
|
|
5
|
+
export { EmbeddedManifest, FileType, MANIFEST_DIR, MANIFEST_FILENAME, MANIFEST_PATH, MANIFEST_VERSION, ManifestFileEntry, ParseResult, classifyFile, isVolatilePath, parseManifest } from './manifest.js';
|
|
6
|
+
export { ChainProbeOptions, ChunkProbeResult, probeChunks } from './chunk-probe.js';
|
|
7
|
+
export { finaliseEmbeddedManifest, writeEmbeddedManifestPlaceholder } from './manifest-embed.js';
|
|
8
|
+
export { FetchOptions, FetchOutcome, fetchPreviousManifest } from './manifest-fetch.js';
|
|
9
|
+
export { ComputeStatsInput, IncrementalStats, computeStats, renderSummary, telemetryAttributes } from './incremental-stats.js';
|
|
5
10
|
export { RunState, RunStatus, VERSION, loadRunState, probablyOomRssMb, resolveStateDir, shouldShowOomHint, shouldSkipStaleWarning, stateFilePath, writeRunState } from './run-state.js';
|
|
6
11
|
import 'multiformats/cid';
|
|
7
12
|
import 'polkadot-api';
|