@parity/product-deploy 0.8.3-rc.8 → 0.9.0-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 (59) hide show
  1. package/LICENSE +674 -201
  2. package/README.md +59 -2
  3. package/assets/environments.json +0 -1
  4. package/bin/bulletin-deploy +21 -1
  5. package/dist/auth/index.d.ts +2 -3
  6. package/dist/auth/index.js +2 -1
  7. package/dist/auth/vendor/index.d.ts +2 -3
  8. package/dist/auth/vendor/index.js +2 -1
  9. package/dist/auth/vendor/ui/index.d.ts +1 -2
  10. package/dist/auth-C-Pel0AT.d.ts +235 -0
  11. package/dist/auth-config.d.ts +30 -8
  12. package/dist/auth-config.js +14 -6
  13. package/dist/bug-report.js +4 -4
  14. package/dist/{chunk-YXGNQZZF.js → chunk-2SR5D4CP.js} +19 -15
  15. package/dist/{chunk-OFVBJOFB.js → chunk-6NW5M3F5.js} +9 -20
  16. package/dist/{chunk-7DGFJC6E.js → chunk-DHY2ZXVZ.js} +81 -42
  17. package/dist/chunk-G56VYTUD.js +75 -0
  18. package/dist/{chunk-5K3RI5C2.js → chunk-GL3U7K2B.js} +0 -1
  19. package/dist/{chunk-327NAPBD.js → chunk-H4LWILH4.js} +32 -6
  20. package/dist/chunk-J7CYVTAW.js +43 -0
  21. package/dist/{chunk-WHMNBSG7.js → chunk-LCKLYFAZ.js} +5 -4
  22. package/dist/{chunk-3OWKSL7K.js → chunk-NP4SLURL.js} +1 -1
  23. package/dist/{chunk-T4PAK4YK.js → chunk-O2NWQLYB.js} +2 -2
  24. package/dist/{chunk-RPU72Z4B.js → chunk-RD2QHYTL.js} +242 -36
  25. package/dist/{chunk-EGNMZHMR.js → chunk-WZBAQCA5.js} +15 -4
  26. package/dist/{chunk-YOQLRCQV.js → chunk-YIKGVALU.js} +3 -3
  27. package/dist/chunk-probe.js +3 -3
  28. package/dist/commands/login.d.ts +34 -9
  29. package/dist/commands/login.js +186 -30
  30. package/dist/commands/logout.d.ts +1 -2
  31. package/dist/commands/logout.js +5 -3
  32. package/dist/commands/whoami.d.ts +1 -2
  33. package/dist/commands/whoami.js +7 -4
  34. package/dist/deploy.d.ts +19 -4
  35. package/dist/deploy.js +14 -9
  36. package/dist/dotns.d.ts +7 -0
  37. package/dist/dotns.js +4 -4
  38. package/dist/environments.js +1 -1
  39. package/dist/index.js +11 -10
  40. package/dist/manifest/publish.js +11 -10
  41. package/dist/manifest/types.d.ts +1 -1
  42. package/dist/memory-report.js +2 -2
  43. package/dist/merkle.js +10 -9
  44. package/dist/personhood/bootstrap.js +10 -10
  45. package/dist/personhood/people-client.js +4 -4
  46. package/dist/run-state.js +1 -1
  47. package/dist/{signer-CriGqahj.d.ts → signer-vR6KKC7V.d.ts} +1 -1
  48. package/dist/spinner.d.ts +21 -0
  49. package/dist/spinner.js +6 -0
  50. package/dist/sss-allowance.d.ts +29 -0
  51. package/dist/sss-allowance.js +8 -0
  52. package/dist/storage-signer.d.ts +94 -2
  53. package/dist/storage-signer.js +18 -9
  54. package/dist/telemetry.js +2 -2
  55. package/dist/version-check.d.ts +0 -3
  56. package/dist/version-check.js +3 -3
  57. package/package.json +19 -15
  58. package/dist/allocations-B65Is4Md.d.ts +0 -97
  59. package/dist/auth-DkRZBK-T.d.ts +0 -122
package/README.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # bulletin-deploy
2
2
 
3
- Early alpha code, stay tuned.
3
+ CLI tool for deploying web apps to the [Polkadot Bulletin Chain](https://github.com/paritytech/polkadot-bulletin-chain) via DotNS, Polkadot's on-chain naming system.
4
4
 
5
- Full documentation and contributing guide: [docs-internal/README.dev.md](docs-internal/README.dev.md)
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install -g bulletin-deploy
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```sh
14
+ # Build your app, then deploy:
15
+ bulletin-deploy ./dist my-app.dot
16
+ ```
17
+
18
+ ## Session-based signing (mobile wallet)
19
+
20
+ Sign in once with your mobile Polkadot wallet — no mnemonic on disk:
21
+
22
+ ```sh
23
+ bulletin-deploy login # Scan QR code with your Polkadot wallet app
24
+ bulletin-deploy whoami # Show the currently signed-in address
25
+ bulletin-deploy logout # Sign out and clear the session
26
+ ```
27
+
28
+ After `login`, subsequent deploys will use the session signer automatically.
29
+
30
+ ## Options
31
+
32
+ Run `bulletin-deploy --help` for the full option reference.
33
+
34
+ Key options:
35
+
36
+ | Option | Description |
37
+ |--------|-------------|
38
+ | `--env <id>` | Target environment (default: `paseo-next-v2`). Run `--list-environments` to see available IDs. |
39
+ | `--mnemonic "..."` | DotNS owner mnemonic (or set `MNEMONIC` env var). Alternative to session signing. |
40
+ | `--js-merkle` | Use pure-JS merkleization (no IPFS Kubo binary required). |
41
+ | `--publish` | List the domain in the on-chain Publisher registry after deploy. |
42
+ | `--config <path>` | Explicit path to `bulletin-deploy.config.ts` for product deploys. |
43
+ | `--tag "..."` | Label the deploy in telemetry. |
44
+ | `--version` | Print the installed version and exit. |
45
+
46
+ ## Environments
47
+
48
+ bulletin-deploy ships with built-in environment presets (RPC endpoints, contract addresses). Use `--list-environments` to print the table. Override individual fields with `--environment-file <path>` or `--contract KEY=0x...`.
49
+
50
+ ## Telemetry
51
+
52
+ Deploy telemetry (Sentry) is **off by default**. It activates only if you explicitly opt in with `BULLETIN_DEPLOY_TELEMETRY=1`, or when the CLI detects it is running in Parity's own CI. Set `BULLETIN_DEPLOY_TELEMETRY=0` to force it off in any context. The Sentry DSN baked into the package is a public project identifier, not a secret — it grants no access to collected data.
53
+
54
+ Separately from telemetry, the CLI checks the npm registry for the minimum supported version. Set `BULLETIN_DEPLOY_UPDATE_CHECK=0` to disable that check.
55
+
56
+ ## Contributing
57
+
58
+ Issues and pull requests are welcome on the GitHub repository. Releases are cut by the maintainers. (Parity-internal design notes and investigation logs live in `docs-internal/`, which is not published to npm.)
59
+
60
+ ## License
61
+
62
+ [GPL-3.0-or-later](LICENSE). Versions up to and including 0.8.3 were published under Apache-2.0; the license changed to GPL-3.0-or-later ahead of the project being open-sourced.
@@ -99,7 +99,6 @@
99
99
  "e2eEligible": true,
100
100
  "backend": "https://identity-backend-next.parity-testnet.parity.io",
101
101
  "ipfs": "https://paseo-bulletin-next-ipfs.polkadot.io",
102
- "docsUrl": "https://sre.teleport.parity.io/environments/paseo-next/",
103
102
  "autoAccountMapping": true,
104
103
  "nativeToEthRatio": 100000000,
105
104
  "registerStorageDeposit": 2000000000000,
@@ -8,6 +8,16 @@ import { loadRunState, writeRunState, shouldSkipStaleWarning, shouldShowOomHint,
8
8
  import { loadEnvironments, listEnvironments, formatEnvironmentTable, DEFAULT_ENV_ID } from "../dist/environments.js";
9
9
  import * as fs from "fs";
10
10
 
11
+ // Suppress "@parity/product-sdk-logger" localStorage warning in Node.js v22+.
12
+ // The logger tries to read log-level config from localStorage which doesn't exist
13
+ // in Node.js — it emits a NoSuchNativeMethod warning we cannot fix upstream.
14
+ const _origEmitWarning = process.emitWarning.bind(process);
15
+ process.emitWarning = (warning, ...rest) => {
16
+ const msg = (typeof warning === "string" ? warning : warning?.message ?? String(warning)).toLowerCase();
17
+ if (msg.includes("localstorage") || msg.includes("local storage")) return;
18
+ _origEmitWarning(warning, ...rest);
19
+ };
20
+
11
21
  // Install early so anything printed during flag parsing / preflight is
12
22
  // available to the bug-report log tail.
13
23
  installLogCapture();
@@ -202,6 +212,9 @@ if (flags.help || positional.length === 0) {
202
212
 
203
213
  Usage:
204
214
  bulletin-deploy <build-dir> <domain.dot> Deploy an app
215
+ bulletin-deploy login Sign in with your Polkadot mobile app
216
+ bulletin-deploy logout Sign out and clear the session
217
+ bulletin-deploy whoami Show the currently signed-in identity
205
218
 
206
219
  Options:
207
220
  --env <id> Target environment from environments.json (default: paseo-next-v2).
@@ -290,7 +303,14 @@ if (!flags.help && !flags.version) {
290
303
  console.error("");
291
304
  markRelaunchOomHintShown();
292
305
  } else if (prev.status === "crashed" && prev.reason) {
293
- console.error(` Previous deploy exited via ${prev.reason}. Continuing.`);
306
+ const reasonMap = {
307
+ "unhandled": "crashed unexpectedly",
308
+ "uncaught": "crashed unexpectedly",
309
+ "SIGINT": "was interrupted (Ctrl-C)",
310
+ "SIGTERM": "was stopped",
311
+ };
312
+ const friendly = reasonMap[prev.reason] ?? "did not exit cleanly";
313
+ console.error(` Previous deploy ${friendly}. Continuing.`);
294
314
  } else if (prev.status === "running") {
295
315
  console.error(` Previous deploy did not exit cleanly. Continuing.`);
296
316
  }
@@ -1,7 +1,6 @@
1
- export { A as AuthClient, a as AuthConfig, C as ConnectResult, L as LoginHandle, b as LoginStatus, c as LogoutHandle, d as LogoutStatus, S as SessionAddresses, e as SessionHandle, f as createAuthClient } from '../auth-DkRZBK-T.js';
1
+ export { A as AllocatableResource, a as AllocationOutcome, b as AllocationSummary, c as AuthClient, d as AuthConfig, C as ConnectResult, D as DEFAULT_RESOURCES, L as LoginHandle, e as LoginStatus, f as LogoutHandle, g as LogoutStatus, S as SessionAddresses, h as SessionHandle, i as createAuthClient, r as requestResourceAllocation, s as summarizeOutcomes } from '../auth-C-Pel0AT.js';
2
2
  export { renderQrCode } from '@parity/product-sdk-terminal';
3
- export { R as ResolvedSigner, S as SignerNotAvailableError, r as resolveSigner } from '../signer-CriGqahj.js';
4
- export { A as AllocatableResource, a as AllocationOutcome, b as AllocationSummary, D as DEFAULT_RESOURCES, r as requestResourceAllocation, s as summarizeOutcomes } from '../allocations-B65Is4Md.js';
3
+ export { R as ResolvedSigner, S as SignerNotAvailableError, r as resolveSigner } from '../signer-vR6KKC7V.js';
5
4
  export { renderLoginStatus, renderLogoutStatus } from './vendor/ui/index.js';
6
5
  import 'polkadot-api';
7
6
  import '@parity/product-sdk-tx';
@@ -6,12 +6,13 @@ import {
6
6
  requestResourceAllocation,
7
7
  resolveSigner,
8
8
  summarizeOutcomes
9
- } from "../chunk-7DGFJC6E.js";
9
+ } from "../chunk-DHY2ZXVZ.js";
10
10
  import {
11
11
  renderLoginStatus,
12
12
  renderLogoutStatus,
13
13
  renderQrCode
14
14
  } from "../chunk-RIRDBSBG.js";
15
+ import "../chunk-ZOC4GITL.js";
15
16
  export {
16
17
  DEFAULT_RESOURCES,
17
18
  SignerNotAvailableError,
@@ -1,8 +1,7 @@
1
- export { A as AuthClient, a as AuthConfig, C as ConnectResult, L as LoginHandle, b as LoginStatus, c as LogoutHandle, d as LogoutStatus, S as SessionAddresses, e as SessionHandle, f as createAuthClient } from '../../auth-DkRZBK-T.js';
1
+ export { A as AllocatableResource, a as AllocationOutcome, b as AllocationSummary, c as AuthClient, d as AuthConfig, C as ConnectResult, D as DEFAULT_RESOURCES, L as LoginHandle, e as LoginStatus, f as LogoutHandle, g as LogoutStatus, O as OnExistingAllowancePolicy, R as ResourceTag, S as SessionAddresses, h as SessionHandle, i as createAuthClient, r as requestResourceAllocation, s as summarizeOutcomes } from '../../auth-C-Pel0AT.js';
2
2
  import { UserSession } from '@parity/product-sdk-terminal';
3
3
  import { PolkadotSigner } from 'polkadot-api';
4
- export { R as ResolvedSigner, S as SignerNotAvailableError, a as SignerOptions, b as SignerSource, p as parseDevAccountName, r as resolveSigner } from '../../signer-CriGqahj.js';
5
- export { A as AllocatableResource, a as AllocationOutcome, b as AllocationSummary, D as DEFAULT_RESOURCES, O as OnExistingAllowancePolicy, R as ResourceTag, r as requestResourceAllocation, s as summarizeOutcomes } from '../../allocations-B65Is4Md.js';
4
+ export { R as ResolvedSigner, S as SignerNotAvailableError, a as SignerOptions, b as SignerSource, p as parseDevAccountName, r as resolveSigner } from '../../signer-vR6KKC7V.js';
6
5
  import '@parity/product-sdk-tx';
7
6
 
8
7
  interface ProductAccountRef {
@@ -10,7 +10,8 @@ import {
10
10
  resolveSigner,
11
11
  sessionRootPublicKey,
12
12
  summarizeOutcomes
13
- } from "../../chunk-7DGFJC6E.js";
13
+ } from "../../chunk-DHY2ZXVZ.js";
14
+ import "../../chunk-ZOC4GITL.js";
14
15
  export {
15
16
  DEFAULT_RESOURCES,
16
17
  INCOMPLETE_SESSION_MESSAGE,
@@ -1,7 +1,6 @@
1
1
  export { renderQrCode } from '@parity/product-sdk-terminal';
2
- import { b as LoginStatus, d as LogoutStatus } from '../../../auth-DkRZBK-T.js';
2
+ import { e as LoginStatus, g as LogoutStatus } from '../../../auth-C-Pel0AT.js';
3
3
  import 'polkadot-api';
4
- import '../../../allocations-B65Is4Md.js';
5
4
 
6
5
  /**
7
6
  * Pure formatters that map the `LoginStatus` / `LogoutStatus` streams to
@@ -0,0 +1,235 @@
1
+ import { UserSession, TerminalAdapter } from '@parity/product-sdk-terminal';
2
+ import { PolkadotSigner } from 'polkadot-api';
3
+
4
+ /**
5
+ * RFC-0010 resource allocation — thin wrapper over product-sdk-terminal's
6
+ * host-runner facet. Lifted from playground-cli `src/utils/allowances/host.ts`
7
+ * (issue #411).
8
+ *
9
+ * `@parity/product-sdk-terminal/host` exports `requestResourceAllocation(session,
10
+ * adapter, resources, options?)` which handles:
11
+ * - sending the AP request to the paired mobile wallet
12
+ * - the `onExisting` policy (default auto-picks "Ignore" unless all requested
13
+ * resources are already slot-table cached, then "Increase")
14
+ * - caching granted key material to disk as `{appId}_AllowanceKeys.json`
15
+ * (the same file our storage-signer reads — verified compat-stable in PR #855)
16
+ *
17
+ * Wire format (SCALE-derived, mirrors host-papp's
18
+ * `dist/sso/sessionManager/scale/resourceAllocation.d.ts`):
19
+ * request → { callingProductId, resources: AllocatableResource[], onExisting }
20
+ * response → AllocationOutcome[] (one per resource, in order)
21
+ *
22
+ * The mobile app handles `hostRequestResourceAllocation` in
23
+ * `AllowanceHostCalls.kt` and routes the user through an approval UI.
24
+ */
25
+
26
+ /**
27
+ * Structural mirror of host-papp's `ApAllocatableResource` codec type. We
28
+ * declare it locally because host-papp's package root doesn't re-export the
29
+ * codec types yet — when it does (and product-sdk-terminal threads them
30
+ * through) this can be replaced with a direct import.
31
+ *
32
+ * StatementStoreAllowance — write to the SSS (host_chat, allowance ring).
33
+ * BulletInAllowance — write to Bulletin (TransactionStorage.store).
34
+ * SmartContractAllowance — PGAS sponsoring for Revive contract calls.
35
+ * The `value` is the derivation index of the
36
+ * product account (0 for the default account).
37
+ * AutoSigning — surrender the product-account signing key to
38
+ * the host so it can sign on the user's behalf
39
+ * without per-call prompts. Not used today.
40
+ *
41
+ * NOTE: host-api v0.8 renamed this variant to 'BulletinAllowance', but the
42
+ * SSO resource-allocation codec (host-papp, which this path reaches via
43
+ * product-sdk-terminal) retains the old 'BulletInAllowance' spelling as of
44
+ * host-papp 0.8.5 / terminal 0.3.1. Ours must match the SSO codec — the
45
+ * _SDK_COMPAT_PIN below fails the build if the SDK's spelling ever changes.
46
+ */
47
+ type AllocatableResource = {
48
+ tag: "StatementStoreAllowance";
49
+ value: undefined;
50
+ } | {
51
+ tag: "BulletInAllowance";
52
+ value: undefined;
53
+ } | {
54
+ tag: "SmartContractAllowance";
55
+ value: number;
56
+ } | {
57
+ tag: "AutoSigning";
58
+ value: undefined;
59
+ };
60
+ /**
61
+ * Outcome of one allocation. We don't read the inner `Allocated` payload
62
+ * (allowance slot keys, derivation secrets) — the host stores them and uses
63
+ * them transparently on subsequent calls. We just need the tag to know
64
+ * whether the allocation succeeded.
65
+ */
66
+ type AllocationOutcome = {
67
+ tag: "Allocated";
68
+ value: unknown;
69
+ } | {
70
+ tag: "Rejected";
71
+ value: undefined;
72
+ } | {
73
+ tag: "NotAvailable";
74
+ value: undefined;
75
+ };
76
+ /** Tag-only view, handy for downstream code that doesn't care about payloads. */
77
+ type ResourceTag = AllocatableResource["tag"];
78
+ type OnExistingAllowancePolicy = "Ignore" | "Increase";
79
+ /**
80
+ * Default mobile-granted resource set for a CLI product account: write access
81
+ * to the statement store + Bulletin, plus PGAS sponsoring for the default
82
+ * (index 0) product account.
83
+ */
84
+ declare const DEFAULT_RESOURCES: AllocatableResource[];
85
+ /**
86
+ * Send a `host_request_resource_allocation` request over the user's active
87
+ * session. The host (mobile wallet) prompts the user to approve and returns
88
+ * one outcome per requested resource in order. Granted key material is cached
89
+ * to disk by the terminal facet (`{appId}_AllowanceKeys.json`) so subsequent
90
+ * calls (and the storage-signer reader) find it without a second wallet prompt.
91
+ *
92
+ * Throws on transport-level failures (Statement Store unreachable, encryption
93
+ * error, etc.). Per-resource refusals are reported as `Rejected`/`NotAvailable`
94
+ * outcomes — callers inspect the array to decide whether to proceed.
95
+ *
96
+ * `onExisting` is pinned to "Ignore": return existing cached keys if any, else
97
+ * allocate a new slot. Auto-pick would give "Increase" when all slot-table
98
+ * resources are already cached, which re-prompts the user unnecessarily.
99
+ */
100
+ declare function requestResourceAllocation(session: UserSession, adapter: TerminalAdapter, resources?: AllocatableResource[], onExisting?: OnExistingAllowancePolicy): Promise<AllocationOutcome[]>;
101
+ interface AllocationSummary {
102
+ granted: AllocatableResource[];
103
+ rejected: AllocatableResource[];
104
+ unavailable: AllocatableResource[];
105
+ }
106
+ /**
107
+ * Bucket allocation outcomes by tag. Order-sensitive: `outcomes[i]` maps to
108
+ * `resources[i]`. Outcomes without a matching resource are silently dropped.
109
+ */
110
+ declare function summarizeOutcomes(outcomes: AllocationOutcome[], resources: AllocatableResource[]): AllocationSummary;
111
+
112
+ /**
113
+ * Per-product configuration injected into `createAuthClient`. Lifting the
114
+ * sign-in glue out of playground-cli (issue #411) means the env-specific
115
+ * constants playground hard-coded in its `config.ts` (DAPP_ID, product id,
116
+ * metadata URL, People-chain endpoints) become consumer-supplied so the same
117
+ * package serves `playground` and `dot` (and future products) unchanged.
118
+ */
119
+ interface AuthConfig {
120
+ /** The dApp identity string. Scopes the on-disk session namespace
121
+ * (`~/.polkadot-apps/${dappId}_*`) and the SSO pairing — each product
122
+ * gets its own, independently-revocable session. */
123
+ dappId: string;
124
+ /** Product id used to derive the product account (`/product/{productId}/{index}`). */
125
+ productId: string;
126
+ /** Derivation index of the product account (0 = default). */
127
+ derivationIndex: number;
128
+ /** Wallet-facing app name shown on the Sign-In screen (sent inline at pairing). */
129
+ hostName: string;
130
+ /** Host app version sent inline at pairing. */
131
+ hostVersion: string;
132
+ /** People-parachain RPC endpoints the terminal adapter connects to. */
133
+ peopleEndpoints: string[];
134
+ }
135
+
136
+ /**
137
+ * The three addresses we surface from a paired session.
138
+ *
139
+ * - `rootAddress` — SS58 of `session.rootAccountId`, the `rootUserAccountId`
140
+ * the mobile app sent over the SSO handshake (bare-mnemonic sr25519 root on
141
+ * current mobile builds). Keyed by `Resources.Consumers` on the People
142
+ * parachain, so it's the right input for `lookupUsername`.
143
+ * - `productAddress` — SS58 of the product account derived via
144
+ * `product/{productId}/{index}` from `rootAccountId`. This is what actually
145
+ * signs on-chain transactions from the CLI.
146
+ * - `productH160` — the same product pubkey as a 20-byte EVM address (Revive /
147
+ * contracts view). Derived from the SAME pubkey as `productAddress`.
148
+ */
149
+ interface SessionAddresses {
150
+ rootAddress: string;
151
+ productAddress: string;
152
+ productH160: `0x${string}`;
153
+ }
154
+ type ConnectResult = {
155
+ kind: "existing";
156
+ address: string;
157
+ addresses: SessionAddresses;
158
+ } | {
159
+ kind: "qr";
160
+ qrCode: string;
161
+ login: LoginHandle;
162
+ };
163
+ type LoginStatus = {
164
+ step: "waiting";
165
+ } | {
166
+ step: "paired";
167
+ } | {
168
+ step: "pending";
169
+ stage: string;
170
+ } | {
171
+ step: "success";
172
+ address: string;
173
+ addresses: SessionAddresses;
174
+ } | {
175
+ step: "error";
176
+ message: string;
177
+ };
178
+ interface LoginHandle {
179
+ adapter: TerminalAdapter;
180
+ /** The authenticate() promise — already running since connect(). */
181
+ authPromise: ReturnType<TerminalAdapter["sso"]["authenticate"]>;
182
+ }
183
+ /**
184
+ * A session signer bundle — the signer plus an explicit `destroy()` that tears
185
+ * down the long-lived adapter the signer depends on. Callers MUST invoke
186
+ * `destroy()` once done — the WebSocket keeps the event loop alive.
187
+ *
188
+ * `adapter` is exposed so callers that need to send a host request (e.g.
189
+ * `requestResourceAllocation`) can pass it without creating a second WebSocket.
190
+ */
191
+ interface SessionHandle {
192
+ address: string;
193
+ addresses: SessionAddresses;
194
+ signer: PolkadotSigner;
195
+ userSession: UserSession;
196
+ adapter: TerminalAdapter;
197
+ destroy(): void;
198
+ }
199
+ type LogoutStatus = {
200
+ step: "disconnecting";
201
+ address: string;
202
+ } | {
203
+ step: "success";
204
+ address: string;
205
+ } | {
206
+ step: "partial";
207
+ address: string;
208
+ reason: string;
209
+ } | {
210
+ step: "error";
211
+ message: string;
212
+ };
213
+ interface LogoutHandle {
214
+ adapter: TerminalAdapter;
215
+ address: string;
216
+ session: UserSession;
217
+ }
218
+ /** The product-bound auth surface returned by `createAuthClient`. */
219
+ interface AuthClient {
220
+ connect(): Promise<ConnectResult>;
221
+ waitForLogin(handle: LoginHandle, onStatus: (status: LoginStatus) => void): Promise<SessionHandle | null>;
222
+ getSessionSigner(): Promise<SessionHandle | null>;
223
+ findSession(): Promise<LogoutHandle | null>;
224
+ waitForLogout(handle: LogoutHandle, onStatus: (status: LogoutStatus) => void): Promise<void>;
225
+ requestAllocation(session: UserSession, adapter: TerminalAdapter, resources?: AllocatableResource[], onExisting?: OnExistingAllowancePolicy): Promise<AllocationOutcome[]>;
226
+ clearLocalAppStorage(dir?: string): Promise<void>;
227
+ }
228
+ /**
229
+ * Build an auth client bound to a product's `AuthConfig`. All adapter creation,
230
+ * address derivation, and session-storage scoping read from `config`, so the
231
+ * same code serves any product.
232
+ */
233
+ declare function createAuthClient(config: AuthConfig): AuthClient;
234
+
235
+ export { type AllocatableResource as A, type ConnectResult as C, DEFAULT_RESOURCES as D, type LoginHandle as L, type OnExistingAllowancePolicy as O, type ResourceTag as R, type SessionAddresses as S, type AllocationOutcome as a, type AllocationSummary as b, type AuthClient as c, type AuthConfig as d, type LoginStatus as e, type LogoutHandle as f, type LogoutStatus as g, type SessionHandle as h, createAuthClient as i, requestResourceAllocation as r, summarizeOutcomes as s };
@@ -1,21 +1,24 @@
1
- import { a as AuthConfig, A as AuthClient } from './auth-DkRZBK-T.js';
1
+ import { d as AuthConfig, c as AuthClient } from './auth-C-Pel0AT.js';
2
2
  import { EnvironmentsDoc } from './environments.js';
3
3
  import '@parity/product-sdk-terminal';
4
4
  import 'polkadot-api';
5
- import './allocations-B65Is4Md.js';
6
5
 
7
6
  /** dApp identity that scopes the SSO session namespace on disk. Currently reuses
8
- * playground's identity for dev; swap to e.g. "dot-deploy" when dot has its own
9
- * hosted metadata document. */
7
+ * playground's identity for dev; swap to e.g. "dot-deploy" when the package is renamed. */
10
8
  declare const DOT_DAPP_ID = "dot-cli";
11
9
  /** Product id used for product-account derivation (`/product/{productId}/{index}`).
12
10
  * Reuses playground's product id so dev sessions are shared. */
13
11
  declare const DOT_PRODUCT_ID = "playground.dot";
14
12
  /** Derivation index (0 = default product account). */
15
13
  declare const DOT_DERIVATION_INDEX = 0;
16
- /** Metadata document URL the mobile wallet fetches at pairing to display the app name/icon.
17
- * Reuses playground's hosted gist for dev — swap once dot has its own hosted doc. */
18
- declare const DOT_TERMINAL_METADATA_URL = "https://gist.githubusercontent.com/ReinhardHatko/1967dd3f4afe78683cc0ba14d6ec8744/raw/c1625eb7ed7671b7e09a3fa2a25998dde33c70b8/metadata.json";
14
+ /** Wallet-facing app name shown on the Sign-In screen; #850 flips this at the package rename. */
15
+ declare const DOT_HOST_NAME = "bulletin-deploy";
16
+ /**
17
+ * Shown when a persisted session file exists but the V2 codec cannot decode it —
18
+ * typically a v0.7 SCALE blob that is structurally incompatible with the V2 wire format.
19
+ * The adapter silently returns [] in this case; we surface the cause and recovery steps.
20
+ */
21
+ declare const STALE_SESSION_MESSAGE: string;
19
22
  /**
20
23
  * Returns true if there is a persisted SSO session file on disk.
21
24
  * Does NOT load the SSO stack — uses only node fs/os/path.
@@ -30,10 +33,29 @@ declare function hasPersistedSession(): boolean;
30
33
  * its endpoint for `envId` is absent.
31
34
  */
32
35
  declare function buildAuthConfig(doc: EnvironmentsDoc, envId: string): AuthConfig;
36
+ /**
37
+ * Resolve the Bulletin chain WS endpoint(s) for an environment from the
38
+ * environments doc. Mirrors buildAuthConfig's people-chain resolution.
39
+ *
40
+ * Login needs this because src/deploy.ts only reassigns its module-level
41
+ * BULLETIN_ENDPOINTS (initialized to DEFAULT_BULLETIN_RPC = the paseo-next
42
+ * chain) to the selected env's endpoint inside the deploy flow. The login path
43
+ * never runs that, so without resolving here it would poll the default chain
44
+ * instead of the selected env's (e.g. paseo-next-v2 on paseo-bulletin-next-rpc)
45
+ * and never observe an authorization that lives on the selected chain.
46
+ *
47
+ * Returns null if the bulletin chain or its endpoint for envId is absent.
48
+ */
49
+ declare function resolveBulletinEndpoints(doc: EnvironmentsDoc, envId: string): string[] | null;
50
+ /**
51
+ * Return the People chain WSS endpoints for the given environment.
52
+ * Used by the SSS allowance preflight check — no SSO deps loaded.
53
+ */
54
+ declare function getPeopleChainEndpoints(envId: string): Promise<string[]>;
33
55
  /**
34
56
  * Lazily create an auth client for the given environment. Imports the facade
35
57
  * only when called so the SSO deps don't load in headless/mnemonic paths.
36
58
  */
37
59
  declare function getAuthClient(envId: string): Promise<AuthClient>;
38
60
 
39
- export { DOT_DAPP_ID, DOT_DERIVATION_INDEX, DOT_PRODUCT_ID, DOT_TERMINAL_METADATA_URL, buildAuthConfig, getAuthClient, hasPersistedSession };
61
+ export { DOT_DAPP_ID, DOT_DERIVATION_INDEX, DOT_HOST_NAME, DOT_PRODUCT_ID, STALE_SESSION_MESSAGE, buildAuthConfig, getAuthClient, getPeopleChainEndpoints, hasPersistedSession, resolveBulletinEndpoints };
@@ -1,20 +1,28 @@
1
1
  import {
2
2
  DOT_DAPP_ID,
3
3
  DOT_DERIVATION_INDEX,
4
+ DOT_HOST_NAME,
4
5
  DOT_PRODUCT_ID,
5
- DOT_TERMINAL_METADATA_URL,
6
+ STALE_SESSION_MESSAGE,
6
7
  buildAuthConfig,
7
8
  getAuthClient,
8
- hasPersistedSession
9
- } from "./chunk-327NAPBD.js";
10
- import "./chunk-5K3RI5C2.js";
9
+ getPeopleChainEndpoints,
10
+ hasPersistedSession,
11
+ resolveBulletinEndpoints
12
+ } from "./chunk-H4LWILH4.js";
13
+ import "./chunk-LCKLYFAZ.js";
14
+ import "./chunk-2SR5D4CP.js";
15
+ import "./chunk-GL3U7K2B.js";
11
16
  import "./chunk-ZOC4GITL.js";
12
17
  export {
13
18
  DOT_DAPP_ID,
14
19
  DOT_DERIVATION_INDEX,
20
+ DOT_HOST_NAME,
15
21
  DOT_PRODUCT_ID,
16
- DOT_TERMINAL_METADATA_URL,
22
+ STALE_SESSION_MESSAGE,
17
23
  buildAuthConfig,
18
24
  getAuthClient,
19
- hasPersistedSession
25
+ getPeopleChainEndpoints,
26
+ hasPersistedSession,
27
+ resolveBulletinEndpoints
20
28
  };
@@ -9,10 +9,10 @@ import {
9
9
  offerBugReport,
10
10
  scrubSecrets,
11
11
  setDeployContext
12
- } from "./chunk-T4PAK4YK.js";
13
- import "./chunk-OFVBJOFB.js";
14
- import "./chunk-WHMNBSG7.js";
15
- import "./chunk-YXGNQZZF.js";
12
+ } from "./chunk-O2NWQLYB.js";
13
+ import "./chunk-6NW5M3F5.js";
14
+ import "./chunk-LCKLYFAZ.js";
15
+ import "./chunk-2SR5D4CP.js";
16
16
  export {
17
17
  buildCliFlagsSummary,
18
18
  buildLabels,
@@ -6,7 +6,7 @@ import * as path from "path";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@parity/product-deploy",
9
- version: "0.8.3-rc.8",
9
+ version: "0.9.0-rc.0",
10
10
  private: false,
11
11
  repository: {
12
12
  type: "git",
@@ -49,15 +49,17 @@ var package_default = {
49
49
  "tools/release-retry-wrapper.mjs"
50
50
  ],
51
51
  scripts: {
52
- 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 src/personhood/encoding.ts src/personhood/hashing.ts src/personhood/constants.ts src/personhood/member-key.ts src/personhood/people-client.ts src/personhood/proof-validity.ts src/personhood/reprove.ts src/personhood/bind-personal-id.ts src/personhood/claim-pgas.ts src/personhood/bind-paid-alias.ts src/personhood/bootstrap.ts src/personhood/chain-prereqs.ts src/manifest/types.ts src/manifest/schema.ts src/manifest/byte-budget.ts src/manifest/config-load.ts src/manifest/publish.ts src/auth/index.ts src/auth/vendor/index.ts src/auth/vendor/ui/index.ts src/auth-config.ts src/commands/login.ts src/commands/logout.ts src/commands/whoami.ts src/storage-signer.ts --format esm --dts --clean --target node22",
52
+ 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 src/personhood/encoding.ts src/personhood/hashing.ts src/personhood/constants.ts src/personhood/member-key.ts src/personhood/people-client.ts src/personhood/proof-validity.ts src/personhood/reprove.ts src/personhood/bind-personal-id.ts src/personhood/claim-pgas.ts src/personhood/bind-paid-alias.ts src/personhood/bootstrap.ts src/personhood/chain-prereqs.ts src/manifest/types.ts src/manifest/schema.ts src/manifest/byte-budget.ts src/manifest/config-load.ts src/manifest/publish.ts src/auth/index.ts src/auth/vendor/index.ts src/auth/vendor/ui/index.ts src/auth-config.ts src/commands/login.ts src/commands/logout.ts src/commands/whoami.ts src/storage-signer.ts src/spinner.ts src/sss-allowance.ts --format esm --dts --clean --target node22",
53
53
  "refresh-environments": "node scripts/refresh-environments.mjs",
54
+ postinstall: "patch-package",
54
55
  prepare: "npm run build",
55
- test: "npm run build && node --test test/test.js test/cli-help.test.js test/helpers/e2e-helpers.test.js test/environments.test.js test/refresh-environments.test.js test/chunk-sharing-report.test.js test/product-manifest.test.js test/cache-savings-totals.test.js test/error-pattern-signature.test.js test/exit-codes.test.js test/probe-env-health.test.js test/e2e-chain-calls.test.js test/auth-config.test.js test/whoami.test.js test/login.test.js test/logout.test.js test/auth-resolve.test.js",
56
+ test: "npm run build && node --test test/test.js test/cli-help.test.js test/helpers/e2e-helpers.test.js test/environments.test.js test/refresh-environments.test.js test/chunk-sharing-report.test.js test/product-manifest.test.js test/cache-savings-totals.test.js test/error-pattern-signature.test.js test/exit-codes.test.js test/probe-env-health.test.js test/e2e-chain-calls.test.js test/auth-config.test.js test/whoami.test.js test/login.test.js test/logout.test.js test/auth-resolve.test.js test/storage-signer.test.js test/spinner.test.js test/sss-allowance.test.js && npm run test:vendor",
56
57
  "test:e2e": "npm run build && node --test test/e2e.test.js",
57
58
  "test:e2e:smoke": "bash scripts/e2e-pass.sh smoke",
58
59
  "test:e2e:pr": "bash scripts/e2e-pass.sh pr",
59
60
  "test:e2e:nightly": "bash scripts/e2e-pass.sh nightly",
60
- benchmark: "npm run build && node benchmark.js"
61
+ benchmark: "npm run build && node benchmark.js",
62
+ "test:vendor": "vitest run src/auth/vendor"
61
63
  },
62
64
  dependencies: {
63
65
  "@ipld/car": "^5.4.3",
@@ -65,7 +67,7 @@ var package_default = {
65
67
  "@noble/hashes": "^1.7.2",
66
68
  "@parity/product-sdk-address": "^0.1.1",
67
69
  "@parity/product-sdk-keys": "^0.3.0",
68
- "@parity/product-sdk-terminal": "^0.2.1",
70
+ "@parity/product-sdk-terminal": "^0.3.1",
69
71
  "@parity/product-sdk-tx": "^0.2.4",
70
72
  "@polkadot-api/metadata-builders": "^0.14.2",
71
73
  "@polkadot-api/substrate-bindings": "^0.20.2",
@@ -80,28 +82,30 @@ var package_default = {
80
82
  multiformats: "^13.4.1",
81
83
  "polkadot-api": "^2.1.3",
82
84
  verifiablejs: "1.3.0-beta.4",
83
- viem: "^2.30.5"
85
+ viem: "^2.30.5",
86
+ ws: "^8.20.1"
84
87
  },
85
88
  devDependencies: {
86
89
  "@types/node": "^22.0.0",
90
+ "@types/ws": "^8.18.1",
91
+ "patch-package": "^8.0.1",
87
92
  tsup: "^8.5.0",
88
93
  typescript: "^5.9.3",
89
- vitest: "^3.0.0",
90
- ws: "^8.20.1"
94
+ vitest: "^4.1.0"
91
95
  },
92
96
  overrides: {
93
97
  "@polkadot-api/json-rpc-provider": "^0.2.0",
94
- "@novasamatech/host-api": "0.7.9-4",
95
- "@novasamatech/host-papp": "0.7.9-4",
96
- "@novasamatech/product-sdk": "0.7.9-4",
97
- "@novasamatech/scale": "0.7.9-4",
98
- "@novasamatech/statement-store": "0.7.9-4",
99
- "@novasamatech/storage-adapter": "0.7.9-4"
98
+ "@novasamatech/host-api": "0.8.6",
99
+ "@novasamatech/host-papp": "0.8.6",
100
+ "@novasamatech/scale": "0.8.6",
101
+ "@novasamatech/statement-store": "0.8.6",
102
+ "@novasamatech/storage-adapter": "0.8.6"
100
103
  },
101
104
  minimumVersion: "0.5.6",
102
105
  engines: {
103
106
  node: ">=22"
104
- }
107
+ },
108
+ license: "GPL-3.0-or-later"
105
109
  };
106
110
 
107
111
  // src/run-state.ts