@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.
- package/LICENSE +201 -0
- package/README.md +233 -0
- package/assets/environments.json +313 -0
- package/bin/bulletin-bootstrap +84 -0
- package/bin/bulletin-deploy +429 -0
- package/dist/bug-report.d.ts +29 -0
- package/dist/bug-report.js +27 -0
- package/dist/chunk-2VAUMZB2.js +284 -0
- package/dist/chunk-43HLT335.js +232 -0
- package/dist/chunk-5VZQ2KSU.js +231 -0
- package/dist/chunk-ADNBLFDP.js +225 -0
- package/dist/chunk-BMAEWZYV.js +24 -0
- package/dist/chunk-C2TS5MER.js +64 -0
- package/dist/chunk-DNXH4QTI.js +2336 -0
- package/dist/chunk-FZWJV5AD.js +231 -0
- package/dist/chunk-GZD2UFLR.js +8 -0
- package/dist/chunk-HOTQDYHD.js +219 -0
- package/dist/chunk-IDYGYIMH.js +207 -0
- package/dist/chunk-KHVTYIIX.js +146 -0
- package/dist/chunk-KJH2T5TQ.js +172 -0
- package/dist/chunk-KOSF5FDO.js +49 -0
- package/dist/chunk-LZJMVPYW.js +156 -0
- package/dist/chunk-MFTODIIT.js +725 -0
- package/dist/chunk-MMAZFJDG.js +91 -0
- package/dist/chunk-NF2FL4ZO.js +164 -0
- package/dist/chunk-OITUIM2E.js +524 -0
- package/dist/chunk-P6CHOMN3.js +2368 -0
- package/dist/chunk-QMYW3D6E.js +316 -0
- package/dist/chunk-QTZNULSH.js +185 -0
- package/dist/chunk-RI3ZLNPN.js +71 -0
- package/dist/chunk-S7EM5VMW.js +108 -0
- package/dist/chunk-T7EEVWNU.js +32 -0
- package/dist/chunk-UPWEOGLQ.js +37 -0
- package/dist/chunk-ZOC4GITL.js +13 -0
- package/dist/chunk-ZYVGHDMU.js +117 -0
- package/dist/chunk-probe.d.ts +37 -0
- package/dist/chunk-probe.js +18 -0
- package/dist/chunker.d.ts +8 -0
- package/dist/chunker.js +10 -0
- package/dist/deploy.d.ts +299 -0
- package/dist/deploy.js +96 -0
- package/dist/dotns.d.ts +506 -0
- package/dist/dotns.js +101 -0
- package/dist/environments.d.ts +104 -0
- package/dist/environments.js +23 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +8 -0
- package/dist/gh-pages-mirror.d.ts +76 -0
- package/dist/gh-pages-mirror.js +30 -0
- package/dist/incremental-stats.d.ts +69 -0
- package/dist/incremental-stats.js +10 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +146 -0
- package/dist/manifest/byte-budget.d.ts +46 -0
- package/dist/manifest/byte-budget.js +14 -0
- package/dist/manifest/config-load.d.ts +36 -0
- package/dist/manifest/config-load.js +10 -0
- package/dist/manifest/publish.d.ts +54 -0
- package/dist/manifest/publish.js +23 -0
- package/dist/manifest/schema.d.ts +29 -0
- package/dist/manifest/schema.js +10 -0
- package/dist/manifest/types.d.ts +90 -0
- package/dist/manifest/types.js +6 -0
- package/dist/manifest-embed.d.ts +18 -0
- package/dist/manifest-embed.js +9 -0
- package/dist/manifest-fetch.d.ts +32 -0
- package/dist/manifest-fetch.js +21 -0
- package/dist/manifest-roundtrip.d.ts +15 -0
- package/dist/manifest-roundtrip.js +55 -0
- package/dist/manifest.d.ts +44 -0
- package/dist/manifest.js +20 -0
- package/dist/memory-report.d.ts +95 -0
- package/dist/memory-report.js +17 -0
- package/dist/merkle.d.ts +50 -0
- package/dist/merkle.js +33 -0
- package/dist/personhood/bind-paid-alias.d.ts +43 -0
- package/dist/personhood/bind-paid-alias.js +10 -0
- package/dist/personhood/bind-personal-id.d.ts +55 -0
- package/dist/personhood/bind-personal-id.js +12 -0
- package/dist/personhood/bootstrap.d.ts +85 -0
- package/dist/personhood/bootstrap.js +245 -0
- package/dist/personhood/claim-pgas.d.ts +61 -0
- package/dist/personhood/claim-pgas.js +12 -0
- package/dist/personhood/constants.d.ts +23 -0
- package/dist/personhood/constants.js +22 -0
- package/dist/personhood/encoding.d.ts +49 -0
- package/dist/personhood/encoding.js +24 -0
- package/dist/personhood/hashing.d.ts +4 -0
- package/dist/personhood/hashing.js +8 -0
- package/dist/personhood/member-key.d.ts +12 -0
- package/dist/personhood/member-key.js +10 -0
- package/dist/personhood/people-client.d.ts +14 -0
- package/dist/personhood/people-client.js +48 -0
- package/dist/personhood/reprove.d.ts +43 -0
- package/dist/personhood/reprove.js +225 -0
- package/dist/pool.d.ts +51 -0
- package/dist/pool.js +30 -0
- package/dist/run-state.d.ts +22 -0
- package/dist/run-state.js +20 -0
- package/dist/telemetry.d.ts +56 -0
- package/dist/telemetry.js +71 -0
- package/dist/version-check.d.ts +38 -0
- package/dist/version-check.js +30 -0
- package/docs/bootstrap.md +49 -0
- package/docs/e2e-bootstrap.md +154 -0
- package/docs/telemetry.md +62 -0
- package/docs/testing.md +44 -0
- package/package.json +82 -0
- package/tools/release-retry-wrapper.mjs +74 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
publishManifest
|
|
3
|
+
} from "../chunk-NF2FL4ZO.js";
|
|
4
|
+
import "../chunk-RI3ZLNPN.js";
|
|
5
|
+
import "../chunk-P6CHOMN3.js";
|
|
6
|
+
import "../chunk-KHVTYIIX.js";
|
|
7
|
+
import "../chunk-KOSF5FDO.js";
|
|
8
|
+
import "../chunk-FZWJV5AD.js";
|
|
9
|
+
import "../chunk-S7EM5VMW.js";
|
|
10
|
+
import "../chunk-ADNBLFDP.js";
|
|
11
|
+
import "../chunk-43HLT335.js";
|
|
12
|
+
import "../chunk-QTZNULSH.js";
|
|
13
|
+
import "../chunk-C2TS5MER.js";
|
|
14
|
+
import "../chunk-DNXH4QTI.js";
|
|
15
|
+
import "../chunk-QMYW3D6E.js";
|
|
16
|
+
import "../chunk-MFTODIIT.js";
|
|
17
|
+
import "../chunk-KJH2T5TQ.js";
|
|
18
|
+
import "../chunk-OITUIM2E.js";
|
|
19
|
+
import "../chunk-ZOC4GITL.js";
|
|
20
|
+
import "../chunk-HOTQDYHD.js";
|
|
21
|
+
export {
|
|
22
|
+
publishManifest
|
|
23
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ExecutableManifest, ProductConfig, RootManifest } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handwritten validators for product-manifest shapes.
|
|
5
|
+
*
|
|
6
|
+
* Domain validation is shape-only. It mirrors dotNS label rules without
|
|
7
|
+
* importing the chain-aware [`parseDomainName`](../dotns.ts) helper, so the
|
|
8
|
+
* module stays free of the polkadot-api dep. Authoritative ownership and
|
|
9
|
+
* eligibility checks happen at publish-time preflight in
|
|
10
|
+
* [`publish.ts`](./publish.ts).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface ValidationOk<T> {
|
|
14
|
+
ok: true;
|
|
15
|
+
value: T;
|
|
16
|
+
}
|
|
17
|
+
interface ValidationErr {
|
|
18
|
+
ok: false;
|
|
19
|
+
errors: string[];
|
|
20
|
+
}
|
|
21
|
+
type ValidationResult<T> = ValidationOk<T> | ValidationErr;
|
|
22
|
+
/** Validate a `RootManifest` JSON value read from a dotNS `manifest` text record. */
|
|
23
|
+
declare function validateRootManifest(input: unknown): ValidationResult<RootManifest>;
|
|
24
|
+
/** Validate an `ExecutableManifest` JSON value (one of `app | widget | worker`). */
|
|
25
|
+
declare function validateExecutableManifest(input: unknown): ValidationResult<ExecutableManifest>;
|
|
26
|
+
/** Validate a `bulletin-deploy.config.ts` default export. */
|
|
27
|
+
declare function validateProductConfig(input: unknown): ValidationResult<ProductConfig>;
|
|
28
|
+
|
|
29
|
+
export { type ValidationErr, type ValidationOk, type ValidationResult, validateExecutableManifest, validateProductConfig, validateRootManifest };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-manifest type definitions per RFC paritytech/triangle-js-sdks #0001.
|
|
3
|
+
*
|
|
4
|
+
* Two-level shape: a `RootManifest` written as the `manifest` text record on
|
|
5
|
+
* `<product_id>.dot`, plus one `ExecutableManifest` per modality written as
|
|
6
|
+
* the `executable` text record on `app|widget|worker.<product_id>.dot`.
|
|
7
|
+
*
|
|
8
|
+
* Unrelated to [src/manifest.ts](../manifest.ts), which models the embedded
|
|
9
|
+
* deploy manifest that ships inside each CAR.
|
|
10
|
+
*/
|
|
11
|
+
type IconFormat = "jpeg" | "png";
|
|
12
|
+
type AppVersion = readonly [number, number, number] | readonly [number, number, number, string];
|
|
13
|
+
interface Icon {
|
|
14
|
+
cid: string;
|
|
15
|
+
format: IconFormat;
|
|
16
|
+
}
|
|
17
|
+
interface RootManifest {
|
|
18
|
+
$v: 1;
|
|
19
|
+
displayName: string;
|
|
20
|
+
description: string;
|
|
21
|
+
icon: Icon;
|
|
22
|
+
}
|
|
23
|
+
interface CommonExecutableFields {
|
|
24
|
+
$v: 1;
|
|
25
|
+
appVersion: AppVersion;
|
|
26
|
+
}
|
|
27
|
+
interface AppManifest extends CommonExecutableFields {
|
|
28
|
+
kind: "app";
|
|
29
|
+
}
|
|
30
|
+
interface WidgetDimensions {
|
|
31
|
+
height: number[];
|
|
32
|
+
width?: number;
|
|
33
|
+
}
|
|
34
|
+
interface WidgetManifest extends CommonExecutableFields {
|
|
35
|
+
kind: "widget";
|
|
36
|
+
description?: string;
|
|
37
|
+
dimensions: WidgetDimensions;
|
|
38
|
+
}
|
|
39
|
+
interface WorkerIncludes {
|
|
40
|
+
chat: boolean;
|
|
41
|
+
pocket: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface WorkerManifest extends CommonExecutableFields {
|
|
44
|
+
kind: "worker";
|
|
45
|
+
entrypoint: string;
|
|
46
|
+
includes: WorkerIncludes;
|
|
47
|
+
}
|
|
48
|
+
type ExecutableManifest = AppManifest | WidgetManifest | WorkerManifest;
|
|
49
|
+
type ExecutableKind = ExecutableManifest["kind"];
|
|
50
|
+
interface AppExecutableConfig {
|
|
51
|
+
kind: "app";
|
|
52
|
+
path: string;
|
|
53
|
+
appVersion: AppVersion;
|
|
54
|
+
}
|
|
55
|
+
interface WidgetExecutableConfig {
|
|
56
|
+
kind: "widget";
|
|
57
|
+
path: string;
|
|
58
|
+
appVersion: AppVersion;
|
|
59
|
+
description?: string;
|
|
60
|
+
dimensions: WidgetDimensions;
|
|
61
|
+
}
|
|
62
|
+
interface WorkerExecutableConfig {
|
|
63
|
+
kind: "worker";
|
|
64
|
+
path: string;
|
|
65
|
+
appVersion: AppVersion;
|
|
66
|
+
entrypoint: string;
|
|
67
|
+
includes: WorkerIncludes;
|
|
68
|
+
}
|
|
69
|
+
type ExecutableConfig = AppExecutableConfig | WidgetExecutableConfig | WorkerExecutableConfig;
|
|
70
|
+
interface IconConfig {
|
|
71
|
+
path: string;
|
|
72
|
+
format: IconFormat;
|
|
73
|
+
}
|
|
74
|
+
interface ProductConfig {
|
|
75
|
+
domain: string;
|
|
76
|
+
displayName: string;
|
|
77
|
+
description: string;
|
|
78
|
+
icon: IconConfig;
|
|
79
|
+
executables: ExecutableConfig[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Identity helper that lets `bulletin-deploy.config.ts` authors get IntelliSense on the discriminated `ExecutableConfig` union.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* import { defineConfig } from "bulletin-deploy";
|
|
86
|
+
* export default defineConfig({ domain: "hackm3.dot", ... });
|
|
87
|
+
*/
|
|
88
|
+
declare function defineConfig<T extends ProductConfig>(config: T): T;
|
|
89
|
+
|
|
90
|
+
export { type AppExecutableConfig, type AppManifest, type AppVersion, type ExecutableConfig, type ExecutableKind, type ExecutableManifest, type Icon, type IconConfig, type IconFormat, type ProductConfig, type RootManifest, type WidgetDimensions, type WidgetExecutableConfig, type WidgetManifest, type WorkerExecutableConfig, type WorkerIncludes, type WorkerManifest, defineConfig };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ManifestFileEntry, ManifestChunkEntry } from './manifest.js';
|
|
2
|
+
|
|
3
|
+
interface PlaceholderInput {
|
|
4
|
+
version: number;
|
|
5
|
+
previousContenthash: string | null;
|
|
6
|
+
deployedAt: string;
|
|
7
|
+
framework: string | null;
|
|
8
|
+
}
|
|
9
|
+
interface FinaliseInput extends PlaceholderInput {
|
|
10
|
+
files: Record<string, ManifestFileEntry>;
|
|
11
|
+
stableBlockOrder: string[];
|
|
12
|
+
blocks: string[];
|
|
13
|
+
chunks: Record<string, ManifestChunkEntry>;
|
|
14
|
+
}
|
|
15
|
+
declare function writeEmbeddedManifestPlaceholder(buildDir: string, data: PlaceholderInput): void;
|
|
16
|
+
declare function finaliseEmbeddedManifest(buildDir: string, data: FinaliseInput): void;
|
|
17
|
+
|
|
18
|
+
export { finaliseEmbeddedManifest, writeEmbeddedManifestPlaceholder };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EmbeddedManifest } from './manifest.js';
|
|
2
|
+
|
|
3
|
+
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
4
|
+
declare const SIDECAR_FILENAME = ".last_deploy_cid";
|
|
5
|
+
type FetchOutcome = {
|
|
6
|
+
source: "embedded";
|
|
7
|
+
manifest: EmbeddedManifest;
|
|
8
|
+
attempts: number;
|
|
9
|
+
bytesDownloaded?: number;
|
|
10
|
+
} | {
|
|
11
|
+
source: "heuristic_fallback";
|
|
12
|
+
reason: string;
|
|
13
|
+
attempts: number;
|
|
14
|
+
bytesDownloaded?: number;
|
|
15
|
+
} | {
|
|
16
|
+
source: "none";
|
|
17
|
+
};
|
|
18
|
+
interface FetchOptions {
|
|
19
|
+
gateway?: string;
|
|
20
|
+
gateways?: string[];
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
domain?: string;
|
|
23
|
+
buildDir?: string;
|
|
24
|
+
}
|
|
25
|
+
declare function getCacheDir(): string | null;
|
|
26
|
+
declare function readPersistentLocalManifest(domain: string | undefined, prevContenthash: string): FetchOutcome | null;
|
|
27
|
+
declare function writePersistentLocalManifest(domain: string, storageCid: string, manifestJson: string): void;
|
|
28
|
+
declare function fetchPreviousManifest(prevContenthash: string | null, options?: FetchOptions): Promise<FetchOutcome>;
|
|
29
|
+
declare function extractManifestFromCar(carBytes: Uint8Array): Promise<Uint8Array | null>;
|
|
30
|
+
declare function walkDagToManifest(blocks: Map<string, Uint8Array>, rootCid: string): Promise<Uint8Array | null>;
|
|
31
|
+
|
|
32
|
+
export { DEFAULT_TIMEOUT_MS, type FetchOptions, type FetchOutcome, SIDECAR_FILENAME, extractManifestFromCar, fetchPreviousManifest, getCacheDir, readPersistentLocalManifest, walkDagToManifest, writePersistentLocalManifest };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_TIMEOUT_MS,
|
|
3
|
+
SIDECAR_FILENAME,
|
|
4
|
+
extractManifestFromCar,
|
|
5
|
+
fetchPreviousManifest,
|
|
6
|
+
getCacheDir,
|
|
7
|
+
readPersistentLocalManifest,
|
|
8
|
+
walkDagToManifest,
|
|
9
|
+
writePersistentLocalManifest
|
|
10
|
+
} from "./chunk-FZWJV5AD.js";
|
|
11
|
+
import "./chunk-S7EM5VMW.js";
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_TIMEOUT_MS,
|
|
14
|
+
SIDECAR_FILENAME,
|
|
15
|
+
extractManifestFromCar,
|
|
16
|
+
fetchPreviousManifest,
|
|
17
|
+
getCacheDir,
|
|
18
|
+
readPersistentLocalManifest,
|
|
19
|
+
walkDagToManifest,
|
|
20
|
+
writePersistentLocalManifest
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface RoundtripOptions {
|
|
2
|
+
gateway: string;
|
|
3
|
+
budgetMs?: number;
|
|
4
|
+
pollIntervalMs?: number;
|
|
5
|
+
perRequestTimeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
declare function fetchManifestRoundtrip(cid: string, options: RoundtripOptions): Promise<{
|
|
8
|
+
ok: true;
|
|
9
|
+
manifestBytes: Uint8Array;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
reason: string;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export { type RoundtripOptions, fetchManifestRoundtrip };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractManifestFromCar
|
|
3
|
+
} from "./chunk-FZWJV5AD.js";
|
|
4
|
+
import "./chunk-S7EM5VMW.js";
|
|
5
|
+
|
|
6
|
+
// src/manifest-roundtrip.ts
|
|
7
|
+
async function fetchManifestRoundtrip(cid, options) {
|
|
8
|
+
const gateway = options.gateway.replace(/\/$/, "");
|
|
9
|
+
const budget = options.budgetMs ?? 3e4;
|
|
10
|
+
const poll = options.pollIntervalMs ?? 2e3;
|
|
11
|
+
const perReq = options.perRequestTimeoutMs ?? 1e4;
|
|
12
|
+
const start = Date.now();
|
|
13
|
+
let lastReason = "no attempts";
|
|
14
|
+
while (Date.now() - start < budget) {
|
|
15
|
+
const ctrl = new AbortController();
|
|
16
|
+
const timer = setTimeout(() => ctrl.abort(), perReq);
|
|
17
|
+
let res;
|
|
18
|
+
try {
|
|
19
|
+
res = await fetch(`${gateway}/ipfs/${cid}`, { signal: ctrl.signal });
|
|
20
|
+
} catch (e) {
|
|
21
|
+
lastReason = `network: ${e?.message ?? e}`;
|
|
22
|
+
clearTimeout(timer);
|
|
23
|
+
await sleep(poll);
|
|
24
|
+
continue;
|
|
25
|
+
} finally {
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
}
|
|
28
|
+
if (res.status === 404 || res.status === 504) {
|
|
29
|
+
lastReason = `gateway HTTP ${res.status}`;
|
|
30
|
+
await sleep(poll);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (res.status !== 200) {
|
|
34
|
+
lastReason = `gateway HTTP ${res.status}`;
|
|
35
|
+
await sleep(poll);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const buf = await res.arrayBuffer();
|
|
39
|
+
const carBytes = new Uint8Array(buf);
|
|
40
|
+
const manifestBytes = await extractManifestFromCar(carBytes);
|
|
41
|
+
if (!manifestBytes) {
|
|
42
|
+
lastReason = "manifest not in deployed DAG";
|
|
43
|
+
await sleep(poll);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
return { ok: true, manifestBytes };
|
|
47
|
+
}
|
|
48
|
+
return { ok: false, reason: `roundtrip budget exhausted: ${lastReason}` };
|
|
49
|
+
}
|
|
50
|
+
function sleep(ms) {
|
|
51
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
fetchManifestRoundtrip
|
|
55
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const MANIFEST_VERSION = 3;
|
|
2
|
+
declare const MANIFEST_DIR = ".bulletin-deploy";
|
|
3
|
+
declare const MANIFEST_FILENAME = "manifest.json";
|
|
4
|
+
declare const MANIFEST_PATH = ".bulletin-deploy/manifest.json";
|
|
5
|
+
type FileType = "stable" | "volatile";
|
|
6
|
+
interface ManifestFileEntry {
|
|
7
|
+
cid: string;
|
|
8
|
+
type: FileType;
|
|
9
|
+
size?: number;
|
|
10
|
+
}
|
|
11
|
+
interface ManifestChunkEntry {
|
|
12
|
+
size: number;
|
|
13
|
+
deployed_at: string;
|
|
14
|
+
block?: number;
|
|
15
|
+
index?: number;
|
|
16
|
+
}
|
|
17
|
+
interface EmbeddedManifest {
|
|
18
|
+
version: number;
|
|
19
|
+
previous_contenthash: string | null;
|
|
20
|
+
deployed_at: string;
|
|
21
|
+
framework: string | null;
|
|
22
|
+
files: Record<string, ManifestFileEntry>;
|
|
23
|
+
stableBlockOrder: string[];
|
|
24
|
+
blocks: string[];
|
|
25
|
+
chunks: Record<string, ManifestChunkEntry>;
|
|
26
|
+
}
|
|
27
|
+
declare function isVolatilePath(p: string): boolean;
|
|
28
|
+
type ClassifyContext = {
|
|
29
|
+
prevManifest?: EmbeddedManifest | null;
|
|
30
|
+
framework?: string | null;
|
|
31
|
+
fileCid?: string;
|
|
32
|
+
};
|
|
33
|
+
declare function classifyFileHeuristic(filePath: string, framework?: string | null): FileType;
|
|
34
|
+
declare function classifyFile(filePath: string, ctx?: ClassifyContext): FileType;
|
|
35
|
+
type ParseResult = {
|
|
36
|
+
ok: true;
|
|
37
|
+
manifest: EmbeddedManifest;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
error: string;
|
|
41
|
+
};
|
|
42
|
+
declare function parseManifest(raw: string): ParseResult;
|
|
43
|
+
|
|
44
|
+
export { type ClassifyContext, type EmbeddedManifest, type FileType, MANIFEST_DIR, MANIFEST_FILENAME, MANIFEST_PATH, MANIFEST_VERSION, type ManifestChunkEntry, type ManifestFileEntry, type ParseResult, classifyFile, classifyFileHeuristic, isVolatilePath, parseManifest };
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MANIFEST_DIR,
|
|
3
|
+
MANIFEST_FILENAME,
|
|
4
|
+
MANIFEST_PATH,
|
|
5
|
+
MANIFEST_VERSION,
|
|
6
|
+
classifyFile,
|
|
7
|
+
classifyFileHeuristic,
|
|
8
|
+
isVolatilePath,
|
|
9
|
+
parseManifest
|
|
10
|
+
} from "./chunk-S7EM5VMW.js";
|
|
11
|
+
export {
|
|
12
|
+
MANIFEST_DIR,
|
|
13
|
+
MANIFEST_FILENAME,
|
|
14
|
+
MANIFEST_PATH,
|
|
15
|
+
MANIFEST_VERSION,
|
|
16
|
+
classifyFile,
|
|
17
|
+
classifyFileHeuristic,
|
|
18
|
+
isVolatilePath,
|
|
19
|
+
parseManifest
|
|
20
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as v8 from 'node:v8';
|
|
2
|
+
|
|
3
|
+
declare function isBunRuntime(): boolean;
|
|
4
|
+
declare const DEFAULT_THRESHOLD_MB = 800;
|
|
5
|
+
interface MemorySampleMb {
|
|
6
|
+
rssMb: number;
|
|
7
|
+
heapUsedMb: number;
|
|
8
|
+
externalMb: number;
|
|
9
|
+
arrayBuffersMb: number;
|
|
10
|
+
}
|
|
11
|
+
interface DeployContextForReport {
|
|
12
|
+
/** Sanitized domain label (sanitizeBranch equivalent). No dots. */
|
|
13
|
+
domain?: string;
|
|
14
|
+
/** Sanitized repo slug. Matches what the deploy span already carries. */
|
|
15
|
+
repo?: string;
|
|
16
|
+
deployTag?: string;
|
|
17
|
+
deployMode?: "pool" | "direct" | "external";
|
|
18
|
+
jsMerkle?: boolean;
|
|
19
|
+
chunkCount?: number;
|
|
20
|
+
carBytes?: number;
|
|
21
|
+
reconnects?: number;
|
|
22
|
+
durationMs?: number;
|
|
23
|
+
sentryTraceId?: string;
|
|
24
|
+
}
|
|
25
|
+
interface MemoryReport {
|
|
26
|
+
schemaVersion: 1;
|
|
27
|
+
toolVersion: string;
|
|
28
|
+
generatedAt: string;
|
|
29
|
+
threshold: {
|
|
30
|
+
thresholdMb: number;
|
|
31
|
+
peakRssMb: number;
|
|
32
|
+
};
|
|
33
|
+
deploy: DeployContextForReport;
|
|
34
|
+
memory: {
|
|
35
|
+
peak: MemorySampleMb;
|
|
36
|
+
stages: Record<string, MemorySampleMb>;
|
|
37
|
+
};
|
|
38
|
+
v8: {
|
|
39
|
+
heapStatistics: ReturnType<typeof v8.getHeapStatistics> | undefined;
|
|
40
|
+
heapSpaceStatistics: ReturnType<typeof v8.getHeapSpaceStatistics> | undefined;
|
|
41
|
+
};
|
|
42
|
+
runtime: {
|
|
43
|
+
nodeVersion: string;
|
|
44
|
+
platform: string;
|
|
45
|
+
arch: string;
|
|
46
|
+
totalMemMb: number;
|
|
47
|
+
freeMemMb: number;
|
|
48
|
+
cpuCount: number;
|
|
49
|
+
activeHandlesByType: Record<string, number>;
|
|
50
|
+
activeRequestsByType: Record<string, number>;
|
|
51
|
+
};
|
|
52
|
+
polkadotApi?: {
|
|
53
|
+
version?: string;
|
|
54
|
+
clientsCreated?: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
declare function safeHeap<T>(f: () => T): T | undefined;
|
|
58
|
+
declare function buildMemoryReport(input: {
|
|
59
|
+
thresholdMb: number;
|
|
60
|
+
peak: MemorySampleMb;
|
|
61
|
+
stages: Record<string, MemorySampleMb>;
|
|
62
|
+
deploy: DeployContextForReport;
|
|
63
|
+
}): MemoryReport;
|
|
64
|
+
interface MaybeWriteMemoryReportInput {
|
|
65
|
+
peak: MemorySampleMb;
|
|
66
|
+
stages: Record<string, MemorySampleMb>;
|
|
67
|
+
deploy: DeployContextForReport;
|
|
68
|
+
/** Where to write the report file. Usually the build directory. */
|
|
69
|
+
outputDir?: string;
|
|
70
|
+
/** Override the default 1500 MB threshold (BULLETIN_DEPLOY_MEM_REPORT_THRESHOLD_MB). */
|
|
71
|
+
thresholdMbOverride?: number;
|
|
72
|
+
/** Hook for tests — defaults to isInternalContext(). */
|
|
73
|
+
isInternal?: () => boolean;
|
|
74
|
+
/** Hook for tests — defaults to real fs writes. */
|
|
75
|
+
writeFile?: (path: string, content: string) => void;
|
|
76
|
+
/** Hook for tests — receives the report when it would be attached to Sentry. */
|
|
77
|
+
onSentryAttach?: (report: MemoryReport) => void;
|
|
78
|
+
}
|
|
79
|
+
interface MemoryReportResult {
|
|
80
|
+
/** Why the report did/didn't fire. Useful for tests and CLI logging. */
|
|
81
|
+
status: "disabled" | "below-threshold" | "not-internal" | "written" | "unsupported-runtime";
|
|
82
|
+
thresholdMb: number;
|
|
83
|
+
peakRssMb: number;
|
|
84
|
+
path?: string;
|
|
85
|
+
}
|
|
86
|
+
declare function maybeWriteMemoryReport(input: MaybeWriteMemoryReportInput): MemoryReportResult;
|
|
87
|
+
/** Convert a MemorySample with raw byte fields into the MB-shaped sample. */
|
|
88
|
+
declare function sampleFromBytes(m: {
|
|
89
|
+
rss: number;
|
|
90
|
+
heapUsed: number;
|
|
91
|
+
external: number;
|
|
92
|
+
arrayBuffers: number;
|
|
93
|
+
}): MemorySampleMb;
|
|
94
|
+
|
|
95
|
+
export { DEFAULT_THRESHOLD_MB, type DeployContextForReport, type MaybeWriteMemoryReportInput, type MemoryReport, type MemoryReportResult, type MemorySampleMb, buildMemoryReport, isBunRuntime, maybeWriteMemoryReport, safeHeap, sampleFromBytes };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_THRESHOLD_MB,
|
|
3
|
+
buildMemoryReport,
|
|
4
|
+
isBunRuntime,
|
|
5
|
+
maybeWriteMemoryReport,
|
|
6
|
+
safeHeap,
|
|
7
|
+
sampleFromBytes
|
|
8
|
+
} from "./chunk-MFTODIIT.js";
|
|
9
|
+
import "./chunk-KJH2T5TQ.js";
|
|
10
|
+
export {
|
|
11
|
+
DEFAULT_THRESHOLD_MB,
|
|
12
|
+
buildMemoryReport,
|
|
13
|
+
isBunRuntime,
|
|
14
|
+
maybeWriteMemoryReport,
|
|
15
|
+
safeHeap,
|
|
16
|
+
sampleFromBytes
|
|
17
|
+
};
|
package/dist/merkle.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
interface MerkleizeResult {
|
|
2
|
+
carBytes: Uint8Array;
|
|
3
|
+
cid: string;
|
|
4
|
+
}
|
|
5
|
+
interface MerkleizeStableResult extends MerkleizeResult {
|
|
6
|
+
blockOrder: string[];
|
|
7
|
+
stableOrder: string[];
|
|
8
|
+
chunks: Uint8Array[];
|
|
9
|
+
chunkCids: string[];
|
|
10
|
+
section1ChunkCids: string[];
|
|
11
|
+
sectionSizes: {
|
|
12
|
+
section0: number;
|
|
13
|
+
section1: number;
|
|
14
|
+
section2: number;
|
|
15
|
+
};
|
|
16
|
+
sectionChunkCounts: {
|
|
17
|
+
section0: number;
|
|
18
|
+
section1: number;
|
|
19
|
+
section2: number;
|
|
20
|
+
};
|
|
21
|
+
/** All DAG blocks from the merkleize backend: cid → block bytes. */
|
|
22
|
+
blocks: Map<string, Uint8Array>;
|
|
23
|
+
/** File path → user-facing CID (leaf for single-block, dag-pb root for multi-block). */
|
|
24
|
+
fileCids: Map<string, string>;
|
|
25
|
+
}
|
|
26
|
+
interface MerkleizeOutput {
|
|
27
|
+
rootCid: string;
|
|
28
|
+
blocks: Map<string, Uint8Array>;
|
|
29
|
+
fileBlocks: Map<string, string[]>;
|
|
30
|
+
fileCids: Map<string, string>;
|
|
31
|
+
rootBlockCids: string[];
|
|
32
|
+
subdirCids: string[];
|
|
33
|
+
}
|
|
34
|
+
declare function merkleizeJSBackend(directoryPath: string): Promise<MerkleizeOutput>;
|
|
35
|
+
declare function merkleizeKuboBackend(directoryPath: string): Promise<MerkleizeOutput>;
|
|
36
|
+
declare function merkleizeBackend(directoryPath: string, useKubo: boolean): Promise<MerkleizeOutput>;
|
|
37
|
+
interface BuildOrderedCarOptions {
|
|
38
|
+
output: MerkleizeOutput;
|
|
39
|
+
classifyFn?: (filePath: string, fileCid?: string) => "stable" | "volatile";
|
|
40
|
+
prevStableOrder?: string[];
|
|
41
|
+
}
|
|
42
|
+
declare function buildOrderedCar(options: BuildOrderedCarOptions): Promise<MerkleizeStableResult>;
|
|
43
|
+
declare function rebuildOrderedCarFromBytes(carBytes: Uint8Array, prevStableOrder?: string[]): Promise<MerkleizeStableResult>;
|
|
44
|
+
declare function merkleizeWithStableOrder(directoryPath: string, prevStableOrder?: string[], options?: {
|
|
45
|
+
useKubo?: boolean;
|
|
46
|
+
classifyFn?: (filePath: string) => "stable" | "volatile";
|
|
47
|
+
}): Promise<MerkleizeStableResult>;
|
|
48
|
+
declare function merkleizeJS(directoryPath: string): Promise<MerkleizeResult>;
|
|
49
|
+
|
|
50
|
+
export { type BuildOrderedCarOptions, type MerkleizeOutput, type MerkleizeResult, type MerkleizeStableResult, buildOrderedCar, merkleizeBackend, merkleizeJS, merkleizeJSBackend, merkleizeKuboBackend, merkleizeWithStableOrder, rebuildOrderedCarFromBytes };
|
package/dist/merkle.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildOrderedCar,
|
|
3
|
+
merkleizeBackend,
|
|
4
|
+
merkleizeJS,
|
|
5
|
+
merkleizeJSBackend,
|
|
6
|
+
merkleizeKuboBackend,
|
|
7
|
+
merkleizeWithStableOrder,
|
|
8
|
+
rebuildOrderedCarFromBytes
|
|
9
|
+
} from "./chunk-P6CHOMN3.js";
|
|
10
|
+
import "./chunk-KHVTYIIX.js";
|
|
11
|
+
import "./chunk-KOSF5FDO.js";
|
|
12
|
+
import "./chunk-FZWJV5AD.js";
|
|
13
|
+
import "./chunk-S7EM5VMW.js";
|
|
14
|
+
import "./chunk-ADNBLFDP.js";
|
|
15
|
+
import "./chunk-43HLT335.js";
|
|
16
|
+
import "./chunk-QTZNULSH.js";
|
|
17
|
+
import "./chunk-C2TS5MER.js";
|
|
18
|
+
import "./chunk-DNXH4QTI.js";
|
|
19
|
+
import "./chunk-QMYW3D6E.js";
|
|
20
|
+
import "./chunk-MFTODIIT.js";
|
|
21
|
+
import "./chunk-KJH2T5TQ.js";
|
|
22
|
+
import "./chunk-OITUIM2E.js";
|
|
23
|
+
import "./chunk-ZOC4GITL.js";
|
|
24
|
+
import "./chunk-HOTQDYHD.js";
|
|
25
|
+
export {
|
|
26
|
+
buildOrderedCar,
|
|
27
|
+
merkleizeBackend,
|
|
28
|
+
merkleizeJS,
|
|
29
|
+
merkleizeJSBackend,
|
|
30
|
+
merkleizeKuboBackend,
|
|
31
|
+
merkleizeWithStableOrder,
|
|
32
|
+
rebuildOrderedCarFromBytes
|
|
33
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SS58String, PolkadotSigner } from 'polkadot-api';
|
|
2
|
+
|
|
3
|
+
type PaidAliasBindingErrorKind = "NotARecognizedPerson" | "RingRootNotFound" | "PaidAliasFeeUnset" | "InsufficientPgas" | "BadProof" | "DispatchError" | "RpcError" | "ClientError" | "Unknown";
|
|
4
|
+
declare class PaidAliasBindingError extends Error {
|
|
5
|
+
readonly kind: PaidAliasBindingErrorKind;
|
|
6
|
+
readonly dispatchError?: unknown;
|
|
7
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
8
|
+
kind?: PaidAliasBindingErrorKind;
|
|
9
|
+
dispatchError?: unknown;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
type RingExponent = 9 | 10 | 14;
|
|
13
|
+
interface BuildRingProofInput {
|
|
14
|
+
ringExponent: RingExponent;
|
|
15
|
+
members: Uint8Array;
|
|
16
|
+
context: Uint8Array;
|
|
17
|
+
msg: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
type BuildRingProof = (input: BuildRingProofInput) => Promise<{
|
|
20
|
+
proof: Uint8Array;
|
|
21
|
+
alias: Uint8Array;
|
|
22
|
+
}>;
|
|
23
|
+
interface PaidAliasBindingProgress {
|
|
24
|
+
onBroadcasted?: () => void;
|
|
25
|
+
onBestBlock?: (blockHash: string) => void;
|
|
26
|
+
}
|
|
27
|
+
interface BindPaidAliasParams {
|
|
28
|
+
peopleUnsafeApi: unknown;
|
|
29
|
+
ahUnsafeApi: unknown;
|
|
30
|
+
account: SS58String;
|
|
31
|
+
memberKey: Uint8Array;
|
|
32
|
+
contextBytes: Uint8Array;
|
|
33
|
+
signCall: PolkadotSigner;
|
|
34
|
+
buildRingProof: BuildRingProof;
|
|
35
|
+
progress?: PaidAliasBindingProgress;
|
|
36
|
+
}
|
|
37
|
+
interface BindPaidAliasResult {
|
|
38
|
+
blockHash: string;
|
|
39
|
+
alias: Uint8Array;
|
|
40
|
+
}
|
|
41
|
+
declare const bindPaidAliasToAccount: ({ peopleUnsafeApi, ahUnsafeApi, account, memberKey, contextBytes, signCall, buildRingProof, progress, }: BindPaidAliasParams) => Promise<BindPaidAliasResult>;
|
|
42
|
+
|
|
43
|
+
export { type BindPaidAliasParams, type BindPaidAliasResult, type BuildRingProof, type BuildRingProofInput, PaidAliasBindingError, type PaidAliasBindingErrorKind, type PaidAliasBindingProgress, type RingExponent, bindPaidAliasToAccount };
|