@powerhousedao/shared 6.2.3-dev.33 → 6.2.3-dev.35

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 (45) hide show
  1. package/dist/clis/args/index.d.mts +1 -1
  2. package/dist/clis/args/{service-BBx5GDTc.d.mts → service-CHjY5epu.d.mts} +3 -3
  3. package/dist/clis/args/{service-BBx5GDTc.d.mts.map → service-CHjY5epu.d.mts.map} +1 -1
  4. package/dist/clis/args/service.d.mts +1 -1
  5. package/dist/clis/build-pieces.d.mts +1 -1
  6. package/dist/clis/constants.d.mts +1 -1
  7. package/dist/clis/index.d.mts +3 -2
  8. package/dist/clis/index.d.mts.map +1 -1
  9. package/dist/clis/index.mjs +5 -2
  10. package/dist/clis/index.mjs.map +1 -1
  11. package/dist/clis/{types-nzer4WIr.d.mts → types-DM26OWlT.d.mts} +2 -2
  12. package/dist/clis/{types-nzer4WIr.d.mts.map → types-DM26OWlT.d.mts.map} +1 -1
  13. package/dist/{config-loader-C6dZB_iX.js → config-loader-CXhzL512.js} +7 -2
  14. package/dist/{config-loader-C6dZB_iX.js.map → config-loader-CXhzL512.js.map} +1 -1
  15. package/dist/connect/config-loader.d.ts +2 -1
  16. package/dist/connect/config-loader.d.ts.map +1 -1
  17. package/dist/connect/config-loader.js +2 -2
  18. package/dist/connect/index.d.ts +3 -3
  19. package/dist/connect/index.js +2 -2
  20. package/dist/document-drive/index.d.ts +3 -4
  21. package/dist/document-drive/index.d.ts.map +1 -1
  22. package/dist/document-model/index.d.ts +2 -3
  23. package/dist/document-model/index.js +7 -322
  24. package/dist/document-model/index.js.map +1 -1
  25. package/dist/{index-5gwOhPG5.d.ts → index-DdXp-CVw.d.ts} +2 -2
  26. package/dist/{index-5gwOhPG5.d.ts.map → index-DdXp-CVw.d.ts.map} +1 -1
  27. package/dist/index.d.ts +4 -4
  28. package/dist/processors/index.d.ts +2 -2
  29. package/dist/processors/index.js +58 -3
  30. package/dist/processors/index.js.map +1 -1
  31. package/dist/purge-v06m_oGz.js +381 -0
  32. package/dist/purge-v06m_oGz.js.map +1 -0
  33. package/dist/registry/index.d.ts +3 -3
  34. package/dist/registry/index.js +10 -1
  35. package/dist/registry/index.js.map +1 -1
  36. package/dist/registry/manifest-slim.d.ts +2 -2
  37. package/dist/{types-CI3ren9F.d.ts → types-B11NGQOQ.d.ts} +20 -12
  38. package/dist/types-B11NGQOQ.d.ts.map +1 -0
  39. package/dist/{types-CmeoQg_J.d.ts → types-CFbd2nan.d.ts} +1489 -468
  40. package/dist/types-CFbd2nan.d.ts.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/index-D6833Siv.d.ts +0 -939
  43. package/dist/index-D6833Siv.d.ts.map +0 -1
  44. package/dist/types-CI3ren9F.d.ts.map +0 -1
  45. package/dist/types-CmeoQg_J.d.ts.map +0 -1
@@ -0,0 +1,381 @@
1
+ import { l as bytesToBase64Url$1, n as generateId, s as buildOperationSignatureMessage, t as deriveOperationId } from "./utils-CSF716ux.js";
2
+ import { stringify } from "safe-stable-stringify";
3
+ import { sha256 } from "@noble/hashes/sha2.js";
4
+ //#region document-model/action-signature.ts
5
+ const ACTION_SIGNATURE_V2_PREFIX = "v2:";
6
+ const V2_HASH = /^v2:[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/;
7
+ const V2_TIMESTAMP = /^[0-9]+$/;
8
+ const V2_SIGNATURE = /^0x[0-9a-f]{128}$/;
9
+ const LONE_SURROGATE = /\p{Cs}/u;
10
+ const PREIMAGE_FIELDS = [
11
+ "version",
12
+ "documentId",
13
+ "branch",
14
+ "scope",
15
+ "type",
16
+ "id",
17
+ "timestampUtcMs",
18
+ "input",
19
+ "signer.user.address",
20
+ "signer.user.networkId",
21
+ "signer.user.chainId",
22
+ "signer.app.key"
23
+ ];
24
+ /** A value that would not survive a JSON store round trip unchanged. */
25
+ var CanonicalJsonError = class extends Error {
26
+ constructor(path, detail) {
27
+ super(`Cannot canonicalize ${path}: ${detail}`);
28
+ this.name = "CanonicalJsonError";
29
+ }
30
+ };
31
+ /** Sorted-key JSON, as the state hash encodes; drops `undefined` properties. */
32
+ function canonicalJson(value, label = "value") {
33
+ assertCanonical(value, label, /* @__PURE__ */ new Set());
34
+ return stringify(value);
35
+ }
36
+ /** Actions the reactor reduces itself, onto the document scope. */
37
+ const DOCUMENT_SCOPE_ACTION_TYPES = /* @__PURE__ */ new Set([
38
+ "CREATE_DOCUMENT",
39
+ "DELETE_DOCUMENT",
40
+ "UPGRADE_DOCUMENT",
41
+ "ADD_RELATIONSHIP",
42
+ "REMOVE_RELATIONSHIP",
43
+ "UPDATE_RELATIONSHIP",
44
+ "PURGE_DOCUMENT"
45
+ ]);
46
+ /** Where a document-scope action writes: `sourceId` or `documentId`. */
47
+ function targetDocumentId(action, fallback) {
48
+ const input = action.input;
49
+ if (action.type === "ADD_RELATIONSHIP" || action.type === "REMOVE_RELATIONSHIP" || action.type === "UPDATE_RELATIONSHIP") return typeof input?.sourceId === "string" && input.sourceId.length > 0 ? input.sourceId : fallback;
50
+ return typeof input?.documentId === "string" && input.documentId.length > 0 ? input.documentId : fallback;
51
+ }
52
+ /** The log an action submitted to a job on `documentId` is stored in. */
53
+ function actionSigningTarget(action, documentId, branch) {
54
+ return {
55
+ documentId: DOCUMENT_SCOPE_ACTION_TYPES.has(action.type) ? targetDocumentId(action, documentId) : documentId,
56
+ branch
57
+ };
58
+ }
59
+ /** The identity a signer writes into `context.signer`, and signs over. */
60
+ function actionSignerIdentity(signer) {
61
+ return {
62
+ user: {
63
+ address: signer.user?.address ?? "",
64
+ networkId: signer.user?.networkId ?? "",
65
+ chainId: signer.user?.chainId ?? 0
66
+ },
67
+ app: {
68
+ name: signer.app?.name ?? "",
69
+ key: signer.app?.key ?? ""
70
+ }
71
+ };
72
+ }
73
+ /** The v2 preimage; throws `CanonicalJsonError` on an unsignable action. */
74
+ function actionPreimageV2(action, target, signer) {
75
+ if (!target.documentId) throw new CanonicalJsonError("documentId", "must not be empty");
76
+ if (!target.branch) throw new CanonicalJsonError("branch", "must not be empty");
77
+ if (action.input === void 0) throw new CanonicalJsonError("input", `action ${action.id} (${action.type}) has no input`);
78
+ const fields = [
79
+ "v2",
80
+ target.documentId,
81
+ target.branch,
82
+ action.scope,
83
+ action.type,
84
+ action.id,
85
+ action.timestampUtcMs,
86
+ action.input,
87
+ signer.user.address,
88
+ signer.user.networkId,
89
+ signer.user.chainId,
90
+ signer.app.key
91
+ ];
92
+ fields.forEach((field, i) => {
93
+ assertCanonical(field, PREIMAGE_FIELDS[i], /* @__PURE__ */ new Set());
94
+ });
95
+ return stringify(fields);
96
+ }
97
+ /** `"v2:" + base64url(sha256(preimage))`, unpadded. */
98
+ async function hashActionV2(action, target, signer) {
99
+ const preimage = actionPreimageV2(action, target, signer);
100
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(preimage));
101
+ return "v2:" + bytesToBase64Url(new Uint8Array(digest));
102
+ }
103
+ /** Signs `action` as a v2 tuple; the message layout is the legacy one. */
104
+ async function signActionV2(params) {
105
+ const { action, target, signer, sign } = params;
106
+ const previousStateHash = params.previousStateHash ?? "";
107
+ if (previousStateHash.includes(", ")) throw new Error(`Cannot sign action ${action.id}: the previous state hash contains ", "`);
108
+ const tuple = [
109
+ (Date.now() / 1e3).toFixed(0),
110
+ signer.app.key,
111
+ await hashActionV2(action, target, signer),
112
+ previousStateHash
113
+ ];
114
+ const signature = await sign(buildOperationSignatureMessage(tuple));
115
+ if (signature.length !== 64) throw new Error(`Cannot sign action ${action.id}: expected a 64-byte P-256 signature, got ${signature.length} bytes`);
116
+ return [...tuple, `0x${bytesToHex(signature)}`];
117
+ }
118
+ /** Element [2] carries the v2 prefix, whether or not it is well formed. */
119
+ function isV2ActionHash(hash) {
120
+ return hash.startsWith("v2:");
121
+ }
122
+ /** The strict shape of a v2 tuple, apart from what its hash covers. */
123
+ function v2TupleProblem(tuple) {
124
+ if (!V2_TIMESTAMP.test(tuple[0])) return "signing time is not decimal seconds";
125
+ if (!V2_HASH.test(tuple[2])) return "hash is not v2: and 43 base64url characters";
126
+ if (!V2_SIGNATURE.test(tuple[4])) return "signature is not 0x and 128 lowercase hex digits";
127
+ }
128
+ function assertCanonical(value, path, ancestors) {
129
+ switch (typeof value) {
130
+ case "string":
131
+ if (LONE_SURROGATE.test(value)) throw new CanonicalJsonError(path, "string holds a lone surrogate");
132
+ return;
133
+ case "boolean": return;
134
+ case "number":
135
+ if (!Number.isFinite(value)) throw new CanonicalJsonError(path, `${value} is not a JSON number`);
136
+ return;
137
+ case "undefined": throw new CanonicalJsonError(path, "undefined is not a JSON value");
138
+ case "bigint": throw new CanonicalJsonError(path, "BigInt is not a JSON value");
139
+ case "function":
140
+ case "symbol": throw new CanonicalJsonError(path, `${typeof value} is not a JSON value`);
141
+ }
142
+ if (value === null) return;
143
+ const object = value;
144
+ if (ancestors.has(object)) throw new CanonicalJsonError(path, "value is circular");
145
+ const toJSON = object.toJSON;
146
+ if (typeof toJSON === "function") {
147
+ assertCanonical(toJSON.call(object), path, new Set(ancestors).add(object));
148
+ return;
149
+ }
150
+ ancestors.add(object);
151
+ if (Array.isArray(object)) for (let i = 0; i < object.length; i++) {
152
+ if (!(i in object)) throw new CanonicalJsonError(`${path}[${i}]`, "array is sparse");
153
+ assertCanonical(object[i], `${path}[${i}]`, ancestors);
154
+ }
155
+ else for (const [key, child] of Object.entries(object)) {
156
+ if (LONE_SURROGATE.test(key)) throw new CanonicalJsonError(path, "key holds a lone surrogate");
157
+ if (child === void 0) continue;
158
+ assertCanonical(child, `${path}.${key}`, ancestors);
159
+ }
160
+ ancestors.delete(object);
161
+ }
162
+ function bytesToBase64Url(bytes) {
163
+ let binary = "";
164
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
165
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
166
+ }
167
+ function bytesToHex(bytes) {
168
+ return Array.from(bytes).map((byte) => byte.toString(16).padStart(2, "0")).join("");
169
+ }
170
+ //#endregion
171
+ //#region document-model/peer-agreement.ts
172
+ /** A purged document's protocol; never preferred, so creation never selects it. */
173
+ const DOCUMENT_PURGE_PROTOCOL = "document-purge";
174
+ /** A peer that takes refusals of polled purge markers on the poll. */
175
+ const MARKER_REFUSAL_FEATURE = "marker-refusal";
176
+ const PEER_CAPABILITIES = [
177
+ {
178
+ kind: "protocol",
179
+ name: "base-reducer",
180
+ baseline: [1, 2],
181
+ supported: () => [1, 2],
182
+ preferred: () => 2,
183
+ optional: false
184
+ },
185
+ {
186
+ kind: "protocol",
187
+ name: "signature",
188
+ baseline: [2],
189
+ supported: () => [2],
190
+ optional: true
191
+ },
192
+ {
193
+ kind: "protocol",
194
+ name: DOCUMENT_PURGE_PROTOCOL,
195
+ baseline: [],
196
+ supported: () => [1],
197
+ optional: true
198
+ },
199
+ {
200
+ kind: "feature",
201
+ name: MARKER_REFUSAL_FEATURE,
202
+ baseline: [],
203
+ supported: () => [1]
204
+ }
205
+ ];
206
+ /** `base` plus `extra`; an extra replaces a base entry of the same name. */
207
+ function mergePeerCapabilities(base, extra) {
208
+ const key = (capability) => `${capability.kind}:${capability.name}`;
209
+ const replaced = new Set(extra.map(key));
210
+ return [...base.filter((capability) => !replaced.has(key(capability))), ...extra];
211
+ }
212
+ const PEER_MANIFEST_FORMAT = 1;
213
+ function versionSet(values) {
214
+ return [...new Set(values)].sort((a, b) => a - b);
215
+ }
216
+ function supportsFrom(capabilities, values) {
217
+ const supports = {
218
+ protocols: {},
219
+ features: {}
220
+ };
221
+ for (const capability of capabilities) {
222
+ const target = capability.kind === "protocol" ? supports.protocols : supports.features;
223
+ target[capability.name] = versionSet(values(capability));
224
+ }
225
+ return supports;
226
+ }
227
+ /** What this reactor supports, for every capability it registers. */
228
+ function localSupports(capabilities, flags) {
229
+ return supportsFrom(capabilities, (capability) => capability.supported(flags));
230
+ }
231
+ /** What a peer that announces nothing supports. */
232
+ function legacySupports(capabilities) {
233
+ return supportsFrom(capabilities, (capability) => capability.baseline);
234
+ }
235
+ function manifestRevision(supports, sequence = 0) {
236
+ const preimage = canonicalJson({
237
+ protocols: supports.protocols,
238
+ features: supports.features,
239
+ sequence
240
+ }, "peer manifest");
241
+ return bytesToBase64Url$1(sha256(new TextEncoder().encode(preimage)));
242
+ }
243
+ function localPeerManifest(capabilities, flags, appKey, sequence = 0) {
244
+ const supports = localSupports(capabilities, flags);
245
+ return {
246
+ format: 1,
247
+ ...appKey !== void 0 ? { appKey } : {},
248
+ sequence,
249
+ revision: manifestRevision(supports, sequence),
250
+ protocols: supports.protocols,
251
+ features: supports.features
252
+ };
253
+ }
254
+ /** A manifest sent before the one already held; silence carries no sequence. */
255
+ function isOlderManifest(next, held) {
256
+ return next !== null && held != null && next.sequence < held.sequence;
257
+ }
258
+ /** A peer's manifest, or the baselines for a peer that announced none. */
259
+ function peerSupports(manifest, capabilities) {
260
+ return manifest ?? legacySupports(capabilities);
261
+ }
262
+ function readVersionMap(value) {
263
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return;
264
+ const map = {};
265
+ for (const [name, versions] of Object.entries(value)) {
266
+ if (!Array.isArray(versions) || !versions.every((v) => Number.isInteger(v))) return;
267
+ map[name] = versionSet(versions);
268
+ }
269
+ return map;
270
+ }
271
+ /**
272
+ * A manifest as received from a peer, or null when it is not one. Formats only
273
+ * add fields, so one of an unknown format is read as its two maps.
274
+ */
275
+ function readPeerManifest(value) {
276
+ if (typeof value !== "object" || value === null) return null;
277
+ const raw = value;
278
+ const protocols = readVersionMap(raw.protocols);
279
+ const features = readVersionMap(raw.features ?? {});
280
+ if (!protocols || !features) return null;
281
+ const sequence = Number.isSafeInteger(raw.sequence) ? raw.sequence : 0;
282
+ return {
283
+ format: 1,
284
+ ...typeof raw.appKey === "string" ? { appKey: raw.appKey } : {},
285
+ sequence,
286
+ revision: typeof raw.revision === "string" ? raw.revision : manifestRevision({
287
+ protocols,
288
+ features
289
+ }, sequence),
290
+ protocols,
291
+ features
292
+ };
293
+ }
294
+ /** Only keys this reactor registers are judged; an absent key agrees. */
295
+ function holdReason(peer, versions, capabilities) {
296
+ for (const capability of capabilities) {
297
+ if (capability.kind !== "protocol") continue;
298
+ const version = versions[capability.name];
299
+ if (version === void 0) continue;
300
+ const supported = peer.protocols[capability.name] ?? [];
301
+ if (!supported.includes(version)) return {
302
+ protocol: capability.name,
303
+ version,
304
+ peerSupports: supported
305
+ };
306
+ }
307
+ }
308
+ /** Whether a peer runs every version this reactor does, so nothing is held. */
309
+ function coversLocal(peer, local, capabilities) {
310
+ for (const capability of capabilities) {
311
+ if (capability.kind !== "protocol") continue;
312
+ const theirs = peer.protocols[capability.name] ?? [];
313
+ if (!(local.protocols[capability.name] ?? []).every((version) => theirs.includes(version))) return false;
314
+ }
315
+ return true;
316
+ }
317
+ /**
318
+ * protocolVersions for a new document: per negotiated protocol, the highest
319
+ * version up to the local preference that every member supports, else the
320
+ * lowest local one. `requested` wins over what is selected.
321
+ */
322
+ function selectProtocolVersions(input) {
323
+ const members = [...input.members];
324
+ const selected = {};
325
+ for (const capability of input.capabilities) {
326
+ if (capability.kind !== "protocol" || !capability.preferred) continue;
327
+ const preferred = capability.preferred(input.flags);
328
+ const supported = capability.supported(input.flags);
329
+ let agreed = supported.filter((version) => version <= preferred);
330
+ for (const member of members) {
331
+ const theirs = member.protocols[capability.name] ?? [];
332
+ agreed = agreed.filter((version) => theirs.includes(version));
333
+ }
334
+ selected[capability.name] = agreed.length > 0 ? Math.max(...agreed) : Math.min(...supported);
335
+ }
336
+ return {
337
+ ...selected,
338
+ ...input.requested
339
+ };
340
+ }
341
+ //#endregion
342
+ //#region document-model/purge.ts
343
+ const PURGE_DOCUMENT = "PURGE_DOCUMENT";
344
+ function isPurgeMarker(value) {
345
+ return ("operation" in value ? value.operation.action : "action" in value ? value.action : value)?.type === PURGE_DOCUMENT;
346
+ }
347
+ /** An unsigned marker; `purgedAtUtcIso` is the action's own timestamp. */
348
+ function purgeDocumentAction(input, options = {}) {
349
+ const timestampUtcMs = options.timestampUtcMs ?? (/* @__PURE__ */ new Date()).toISOString();
350
+ return {
351
+ id: options.id ?? generateId(),
352
+ type: PURGE_DOCUMENT,
353
+ scope: "document",
354
+ timestampUtcMs,
355
+ input: {
356
+ documentId: input.documentId,
357
+ documentType: input.documentType,
358
+ purgedAtUtcIso: timestampUtcMs,
359
+ requestId: input.requestId
360
+ }
361
+ };
362
+ }
363
+ /** The sole row of a purged stream: document/main, index 0, skip 0, hash "". */
364
+ function purgeMarkerOperation(action) {
365
+ return {
366
+ id: deriveOperationId(action.input.documentId, "document", "main", action.id),
367
+ index: 0,
368
+ skip: 0,
369
+ timestampUtcMs: action.timestampUtcMs,
370
+ hash: "",
371
+ action
372
+ };
373
+ }
374
+ /** Protocol versions of a purged id; derived, never stored. */
375
+ function purgedProtocolVersions() {
376
+ return { [DOCUMENT_PURGE_PROTOCOL]: 1 };
377
+ }
378
+ //#endregion
379
+ export { signActionV2 as A, DOCUMENT_SCOPE_ACTION_TYPES as C, canonicalJson as D, actionSigningTarget as E, v2TupleProblem as M, hashActionV2 as O, CanonicalJsonError as S, actionSignerIdentity as T, mergePeerCapabilities as _, purgedProtocolVersions as a, selectProtocolVersions as b, PEER_CAPABILITIES as c, holdReason as d, isOlderManifest as f, manifestRevision as g, localSupports as h, purgeMarkerOperation as i, targetDocumentId as j, isV2ActionHash as k, PEER_MANIFEST_FORMAT as l, localPeerManifest as m, isPurgeMarker as n, DOCUMENT_PURGE_PROTOCOL as o, legacySupports as p, purgeDocumentAction as r, MARKER_REFUSAL_FEATURE as s, PURGE_DOCUMENT as t, coversLocal as u, peerSupports as v, actionPreimageV2 as w, ACTION_SIGNATURE_V2_PREFIX as x, readPeerManifest as y };
380
+
381
+ //# sourceMappingURL=purge-v06m_oGz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purge-v06m_oGz.js","names":["stringifyJson","bytesToBase64Url"],"sources":["../document-model/action-signature.ts","../document-model/peer-agreement.ts","../document-model/purge.ts"],"sourcesContent":["import { stringify as stringifyJson } from \"safe-stable-stringify\";\nimport type { Action } from \"./actions.js\";\nimport { buildOperationSignatureMessage } from \"./crypto.js\";\nimport type {\n AppActionSigner,\n Signature,\n UserActionSigner,\n} from \"./signatures.js\";\nimport type { ActionSigningHandler } from \"./types.js\";\n\nexport const ACTION_SIGNATURE_V2_PREFIX = \"v2:\";\n\n// 32 bytes: 42 free characters, then one whose low two bits are zero.\nconst V2_HASH = /^v2:[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/;\nconst V2_TIMESTAMP = /^[0-9]+$/;\nconst V2_SIGNATURE = /^0x[0-9a-f]{128}$/;\nconst LONE_SURROGATE = /\\p{Cs}/u;\nconst PREIMAGE_FIELDS = [\n \"version\",\n \"documentId\",\n \"branch\",\n \"scope\",\n \"type\",\n \"id\",\n \"timestampUtcMs\",\n \"input\",\n \"signer.user.address\",\n \"signer.user.networkId\",\n \"signer.user.chainId\",\n \"signer.app.key\",\n];\n\n/** The log an operation is stored in, which a v2 tuple is bound to. */\nexport type ActionSigningTarget = {\n documentId: string;\n branch: string;\n};\n\n/** Who a v2 tuple attributes the action to; both halves are in the preimage. */\nexport type ActionSignerIdentity = {\n user: UserActionSigner;\n app: AppActionSigner;\n};\n\n/** A value that would not survive a JSON store round trip unchanged. */\nexport class CanonicalJsonError extends Error {\n constructor(path: string, detail: string) {\n super(`Cannot canonicalize ${path}: ${detail}`);\n this.name = \"CanonicalJsonError\";\n }\n}\n\n/** Sorted-key JSON, as the state hash encodes; drops `undefined` properties. */\nexport function canonicalJson(value: unknown, label = \"value\"): string {\n assertCanonical(value, label, new Set());\n return stringifyJson(value) as string;\n}\n\n/** Actions the reactor reduces itself, onto the document scope. */\nexport const DOCUMENT_SCOPE_ACTION_TYPES: ReadonlySet<string> = new Set([\n \"CREATE_DOCUMENT\",\n \"DELETE_DOCUMENT\",\n \"UPGRADE_DOCUMENT\",\n \"ADD_RELATIONSHIP\",\n \"REMOVE_RELATIONSHIP\",\n \"UPDATE_RELATIONSHIP\",\n \"PURGE_DOCUMENT\",\n]);\n\n/** Where a document-scope action writes: `sourceId` or `documentId`. */\nexport function targetDocumentId(\n action: { type: string; input: unknown },\n fallback: string,\n): string {\n const input = action.input as\n | { documentId?: unknown; sourceId?: unknown }\n | undefined;\n\n if (\n action.type === \"ADD_RELATIONSHIP\" ||\n action.type === \"REMOVE_RELATIONSHIP\" ||\n action.type === \"UPDATE_RELATIONSHIP\"\n ) {\n return typeof input?.sourceId === \"string\" && input.sourceId.length > 0\n ? input.sourceId\n : fallback;\n }\n\n return typeof input?.documentId === \"string\" && input.documentId.length > 0\n ? input.documentId\n : fallback;\n}\n\n/** The log an action submitted to a job on `documentId` is stored in. */\nexport function actionSigningTarget(\n action: { type: string; input: unknown },\n documentId: string,\n branch: string,\n): ActionSigningTarget {\n return {\n documentId: DOCUMENT_SCOPE_ACTION_TYPES.has(action.type)\n ? targetDocumentId(action, documentId)\n : documentId,\n branch,\n };\n}\n\n/** The identity a signer writes into `context.signer`, and signs over. */\nexport function actionSignerIdentity(signer: {\n user?: UserActionSigner;\n app?: AppActionSigner;\n}): ActionSignerIdentity {\n return {\n user: {\n address: signer.user?.address ?? \"\",\n networkId: signer.user?.networkId ?? \"\",\n chainId: signer.user?.chainId ?? 0,\n },\n app: {\n name: signer.app?.name ?? \"\",\n key: signer.app?.key ?? \"\",\n },\n };\n}\n\n/** The v2 preimage; throws `CanonicalJsonError` on an unsignable action. */\nexport function actionPreimageV2(\n action: Action,\n target: ActionSigningTarget,\n signer: ActionSignerIdentity,\n): string {\n if (!target.documentId) {\n throw new CanonicalJsonError(\"documentId\", \"must not be empty\");\n }\n if (!target.branch) {\n throw new CanonicalJsonError(\"branch\", \"must not be empty\");\n }\n if (action.input === undefined) {\n throw new CanonicalJsonError(\n \"input\",\n `action ${action.id} (${action.type}) has no input`,\n );\n }\n const fields: unknown[] = [\n \"v2\",\n target.documentId,\n target.branch,\n action.scope,\n action.type,\n action.id,\n action.timestampUtcMs,\n action.input,\n signer.user.address,\n signer.user.networkId,\n signer.user.chainId,\n signer.app.key,\n ];\n fields.forEach((field, i) => {\n assertCanonical(field, PREIMAGE_FIELDS[i], new Set());\n });\n return stringifyJson(fields) as string;\n}\n\n/** `\"v2:\" + base64url(sha256(preimage))`, unpadded. */\nexport async function hashActionV2(\n action: Action,\n target: ActionSigningTarget,\n signer: ActionSignerIdentity,\n): Promise<string> {\n const preimage = actionPreimageV2(action, target, signer);\n const digest = await crypto.subtle.digest(\n \"SHA-256\",\n new TextEncoder().encode(preimage),\n );\n return ACTION_SIGNATURE_V2_PREFIX + bytesToBase64Url(new Uint8Array(digest));\n}\n\n/** Signs `action` as a v2 tuple; the message layout is the legacy one. */\nexport async function signActionV2(params: {\n action: Action;\n target: ActionSigningTarget;\n signer: ActionSignerIdentity;\n sign: ActionSigningHandler;\n previousStateHash?: string;\n}): Promise<Signature> {\n const { action, target, signer, sign } = params;\n const previousStateHash = params.previousStateHash ?? \"\";\n if (previousStateHash.includes(\", \")) {\n throw new Error(\n `Cannot sign action ${action.id}: the previous state hash contains \", \"`,\n );\n }\n\n const tuple: [string, string, string, string] = [\n (Date.now() / 1000).toFixed(0),\n signer.app.key,\n await hashActionV2(action, target, signer),\n previousStateHash,\n ];\n const signature = await sign(buildOperationSignatureMessage(tuple));\n if (signature.length !== 64) {\n throw new Error(\n `Cannot sign action ${action.id}: expected a 64-byte P-256 signature, got ${signature.length} bytes`,\n );\n }\n return [...tuple, `0x${bytesToHex(signature)}`];\n}\n\n/** Element [2] carries the v2 prefix, whether or not it is well formed. */\nexport function isV2ActionHash(hash: string): boolean {\n return hash.startsWith(ACTION_SIGNATURE_V2_PREFIX);\n}\n\n/** The strict shape of a v2 tuple, apart from what its hash covers. */\nexport function v2TupleProblem(tuple: Signature): string | undefined {\n if (!V2_TIMESTAMP.test(tuple[0])) {\n return \"signing time is not decimal seconds\";\n }\n if (!V2_HASH.test(tuple[2])) {\n return \"hash is not v2: and 43 base64url characters\";\n }\n if (!V2_SIGNATURE.test(tuple[4])) {\n return \"signature is not 0x and 128 lowercase hex digits\";\n }\n return undefined;\n}\n\nfunction assertCanonical(\n value: unknown,\n path: string,\n ancestors: Set<object>,\n): void {\n switch (typeof value) {\n case \"string\":\n if (LONE_SURROGATE.test(value)) {\n throw new CanonicalJsonError(path, \"string holds a lone surrogate\");\n }\n return;\n case \"boolean\":\n return;\n case \"number\":\n if (!Number.isFinite(value)) {\n throw new CanonicalJsonError(path, `${value} is not a JSON number`);\n }\n return;\n case \"undefined\":\n throw new CanonicalJsonError(path, \"undefined is not a JSON value\");\n case \"bigint\":\n throw new CanonicalJsonError(path, \"BigInt is not a JSON value\");\n case \"function\":\n case \"symbol\":\n throw new CanonicalJsonError(path, `${typeof value} is not a JSON value`);\n }\n\n if (value === null) {\n return;\n }\n\n const object = value as object;\n if (ancestors.has(object)) {\n throw new CanonicalJsonError(path, \"value is circular\");\n }\n\n const toJSON = (object as { toJSON?: unknown }).toJSON;\n if (typeof toJSON === \"function\") {\n assertCanonical(\n (toJSON as () => unknown).call(object),\n path,\n new Set(ancestors).add(object),\n );\n return;\n }\n\n ancestors.add(object);\n if (Array.isArray(object)) {\n for (let i = 0; i < object.length; i++) {\n if (!(i in object)) {\n throw new CanonicalJsonError(`${path}[${i}]`, \"array is sparse\");\n }\n assertCanonical(object[i], `${path}[${i}]`, ancestors);\n }\n } else {\n for (const [key, child] of Object.entries(object)) {\n if (LONE_SURROGATE.test(key)) {\n throw new CanonicalJsonError(path, \"key holds a lone surrogate\");\n }\n if (child === undefined) {\n continue;\n }\n assertCanonical(child, `${path}.${key}`, ancestors);\n }\n }\n ancestors.delete(object);\n}\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let binary = \"\";\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary)\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/, \"\");\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n return Array.from(bytes)\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n","import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { canonicalJson } from \"./action-signature.js\";\nimport { bytesToBase64Url } from \"./crypto.js\";\n\n/** The reactor feature flags a capability's support is a function of. */\nexport type PeerCapabilityFlags = {\n readonly [flag: string]: boolean | undefined;\n};\n\n/** A document protocol, named by its `protocolVersions` key. */\nexport type ProtocolCapability = {\n kind: \"protocol\";\n name: string;\n /** What a peer that announces nothing is assumed to support. */\n baseline: readonly number[];\n supported(flags: PeerCapabilityFlags): readonly number[];\n /** The version new documents take when peers agree. Absent: not negotiated. */\n preferred?(flags: PeerCapabilityFlags): number;\n /** A header may omit the key. */\n optional: boolean;\n};\n\n/** A feature that changes what a peer sends or expects on the wire. */\nexport type FeatureCapability = {\n kind: \"feature\";\n name: string;\n baseline: readonly number[];\n supported(flags: PeerCapabilityFlags): readonly number[];\n};\n\nexport type PeerCapability = ProtocolCapability | FeatureCapability;\n\n/** A purged document's protocol; never preferred, so creation never selects it. */\nexport const DOCUMENT_PURGE_PROTOCOL = \"document-purge\";\n\n/** A peer that takes refusals of polled purge markers on the poll. */\nexport const MARKER_REFUSAL_FEATURE = \"marker-refusal\";\n\n// Baselines are frozen at what the last release without peer agreement runs.\nexport const PEER_CAPABILITIES: readonly PeerCapability[] = [\n {\n kind: \"protocol\",\n name: \"base-reducer\",\n baseline: [1, 2],\n supported: () => [1, 2],\n preferred: () => 2,\n optional: false,\n },\n {\n kind: \"protocol\",\n name: \"signature\",\n baseline: [2],\n supported: () => [2],\n optional: true,\n },\n {\n kind: \"protocol\",\n name: DOCUMENT_PURGE_PROTOCOL,\n baseline: [],\n supported: () => [1],\n optional: true,\n },\n {\n kind: \"feature\",\n name: MARKER_REFUSAL_FEATURE,\n baseline: [],\n supported: () => [1],\n },\n];\n\n/** `base` plus `extra`; an extra replaces a base entry of the same name. */\nexport function mergePeerCapabilities(\n base: readonly PeerCapability[],\n extra: readonly PeerCapability[],\n): PeerCapability[] {\n const key = (capability: PeerCapability) =>\n `${capability.kind}:${capability.name}`;\n const replaced = new Set(extra.map(key));\n return [\n ...base.filter((capability) => !replaced.has(key(capability))),\n ...extra,\n ];\n}\n\nexport const PEER_MANIFEST_FORMAT = 1;\n\nexport type Supports = {\n protocols: { [protocol: string]: readonly number[] };\n features: { [feature: string]: readonly number[] };\n};\n\nexport type PeerManifest = Supports & {\n format: 1;\n /** The signer's did:key, when configured; informational. */\n appKey?: string;\n /** Grows with every start of the reactor; a peer ignores an older one. */\n sequence: number;\n /** base64url(sha256(canonicalJson(Supports & { sequence }))) */\n revision: string;\n};\n\nfunction versionSet(values: readonly number[]): number[] {\n return [...new Set(values)].sort((a, b) => a - b);\n}\n\nfunction supportsFrom(\n capabilities: readonly PeerCapability[],\n values: (capability: PeerCapability) => readonly number[],\n): Supports {\n const supports: Supports = { protocols: {}, features: {} };\n for (const capability of capabilities) {\n const target =\n capability.kind === \"protocol\" ? supports.protocols : supports.features;\n target[capability.name] = versionSet(values(capability));\n }\n return supports;\n}\n\n/** What this reactor supports, for every capability it registers. */\nexport function localSupports(\n capabilities: readonly PeerCapability[],\n flags: PeerCapabilityFlags,\n): Supports {\n return supportsFrom(capabilities, (capability) =>\n capability.supported(flags),\n );\n}\n\n/** What a peer that announces nothing supports. */\nexport function legacySupports(\n capabilities: readonly PeerCapability[],\n): Supports {\n return supportsFrom(capabilities, (capability) => capability.baseline);\n}\n\nexport function manifestRevision(supports: Supports, sequence = 0): string {\n const preimage = canonicalJson(\n { protocols: supports.protocols, features: supports.features, sequence },\n \"peer manifest\",\n );\n return bytesToBase64Url(sha256(new TextEncoder().encode(preimage)));\n}\n\nexport function localPeerManifest(\n capabilities: readonly PeerCapability[],\n flags: PeerCapabilityFlags,\n appKey?: string,\n sequence = 0,\n): PeerManifest {\n const supports = localSupports(capabilities, flags);\n return {\n format: PEER_MANIFEST_FORMAT,\n ...(appKey !== undefined ? { appKey } : {}),\n sequence,\n revision: manifestRevision(supports, sequence),\n protocols: supports.protocols,\n features: supports.features,\n };\n}\n\n/** A manifest sent before the one already held; silence carries no sequence. */\nexport function isOlderManifest(\n next: PeerManifest | null,\n held: PeerManifest | null | undefined,\n): boolean {\n return next !== null && held != null && next.sequence < held.sequence;\n}\n\n/** A peer's manifest, or the baselines for a peer that announced none. */\nexport function peerSupports(\n manifest: PeerManifest | null,\n capabilities: readonly PeerCapability[],\n): Supports {\n return manifest ?? legacySupports(capabilities);\n}\n\nfunction readVersionMap(\n value: unknown,\n): { [name: string]: readonly number[] } | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return undefined;\n }\n const map: { [name: string]: readonly number[] } = {};\n for (const [name, versions] of Object.entries(value)) {\n if (\n !Array.isArray(versions) ||\n !versions.every((v) => Number.isInteger(v))\n ) {\n return undefined;\n }\n map[name] = versionSet(versions as number[]);\n }\n return map;\n}\n\n/**\n * A manifest as received from a peer, or null when it is not one. Formats only\n * add fields, so one of an unknown format is read as its two maps.\n */\nexport function readPeerManifest(value: unknown): PeerManifest | null {\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n const raw = value as Record<string, unknown>;\n const protocols = readVersionMap(raw.protocols);\n const features = readVersionMap(raw.features ?? {});\n if (!protocols || !features) {\n return null;\n }\n const sequence = Number.isSafeInteger(raw.sequence)\n ? (raw.sequence as number)\n : 0;\n return {\n format: PEER_MANIFEST_FORMAT,\n ...(typeof raw.appKey === \"string\" ? { appKey: raw.appKey } : {}),\n sequence,\n revision:\n typeof raw.revision === \"string\"\n ? raw.revision\n : manifestRevision({ protocols, features }, sequence),\n protocols,\n features,\n };\n}\n\n/** Why a document may not go to a peer. */\nexport type HoldReason = {\n protocol: string;\n version: number;\n peerSupports: readonly number[];\n};\n\n/** Only keys this reactor registers are judged; an absent key agrees. */\nexport function holdReason(\n peer: Supports,\n versions: { readonly [protocol: string]: number },\n capabilities: readonly PeerCapability[],\n): HoldReason | undefined {\n for (const capability of capabilities) {\n if (capability.kind !== \"protocol\") continue;\n const version = versions[capability.name] as number | undefined;\n if (version === undefined) continue;\n const supported = peer.protocols[capability.name] ?? [];\n if (!supported.includes(version)) {\n return { protocol: capability.name, version, peerSupports: supported };\n }\n }\n return undefined;\n}\n\n/** Whether a peer runs every version this reactor does, so nothing is held. */\nexport function coversLocal(\n peer: Supports,\n local: Supports,\n capabilities: readonly PeerCapability[],\n): boolean {\n for (const capability of capabilities) {\n if (capability.kind !== \"protocol\") continue;\n const theirs = peer.protocols[capability.name] ?? [];\n const ours = local.protocols[capability.name] ?? [];\n if (!ours.every((version) => theirs.includes(version))) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * protocolVersions for a new document: per negotiated protocol, the highest\n * version up to the local preference that every member supports, else the\n * lowest local one. `requested` wins over what is selected.\n */\nexport function selectProtocolVersions(input: {\n capabilities: readonly PeerCapability[];\n flags: PeerCapabilityFlags;\n members: Iterable<Supports>;\n requested?: { readonly [protocol: string]: number };\n}): { [protocol: string]: number } {\n const members = [...input.members];\n const selected: { [protocol: string]: number } = {};\n for (const capability of input.capabilities) {\n if (capability.kind !== \"protocol\" || !capability.preferred) continue;\n const preferred = capability.preferred(input.flags);\n const supported = capability.supported(input.flags);\n let agreed = supported.filter((version) => version <= preferred);\n for (const member of members) {\n const theirs = member.protocols[capability.name] ?? [];\n agreed = agreed.filter((version) => theirs.includes(version));\n }\n selected[capability.name] =\n agreed.length > 0 ? Math.max(...agreed) : Math.min(...supported);\n }\n return { ...selected, ...input.requested };\n}\n","import type { Action } from \"./actions.js\";\nimport type { Operation, OperationWithContext } from \"./operations.js\";\nimport { DOCUMENT_PURGE_PROTOCOL } from \"./peer-agreement.js\";\nimport type { PurgeDocumentAction, PurgeDocumentActionInput } from \"./types.js\";\nimport { deriveOperationId, generateId } from \"./utils.js\";\n\nexport const PURGE_DOCUMENT = \"PURGE_DOCUMENT\";\n\nexport type PurgeMarkerOperation = Operation & { action: PurgeDocumentAction };\n\ntype ActionLike = Pick<Action, \"type\">;\n\nexport function isPurgeMarker(value: Action): value is PurgeDocumentAction;\nexport function isPurgeMarker(value: Operation): value is PurgeMarkerOperation;\nexport function isPurgeMarker(\n value: OperationWithContext,\n): value is OperationWithContext & { operation: PurgeMarkerOperation };\nexport function isPurgeMarker(\n value: ActionLike | { action?: ActionLike } | { operation: Operation },\n): boolean;\nexport function isPurgeMarker(\n value: ActionLike | { action?: ActionLike } | { operation: Operation },\n): boolean {\n const action =\n \"operation\" in value\n ? value.operation.action\n : \"action\" in value\n ? value.action\n : (value as ActionLike);\n return action?.type === PURGE_DOCUMENT;\n}\n\n/** An unsigned marker; `purgedAtUtcIso` is the action's own timestamp. */\nexport function purgeDocumentAction(\n input: Omit<PurgeDocumentActionInput, \"purgedAtUtcIso\">,\n options: { id?: string; timestampUtcMs?: string } = {},\n): PurgeDocumentAction {\n const timestampUtcMs = options.timestampUtcMs ?? new Date().toISOString();\n return {\n id: options.id ?? generateId(),\n type: PURGE_DOCUMENT,\n scope: \"document\",\n timestampUtcMs,\n input: {\n documentId: input.documentId,\n documentType: input.documentType,\n purgedAtUtcIso: timestampUtcMs,\n requestId: input.requestId,\n },\n };\n}\n\n/** The sole row of a purged stream: document/main, index 0, skip 0, hash \"\". */\nexport function purgeMarkerOperation(\n action: PurgeDocumentAction,\n): PurgeMarkerOperation {\n return {\n id: deriveOperationId(\n action.input.documentId,\n \"document\",\n \"main\",\n action.id,\n ),\n index: 0,\n skip: 0,\n timestampUtcMs: action.timestampUtcMs,\n hash: \"\",\n action,\n };\n}\n\n/** Protocol versions of a purged id; derived, never stored. */\nexport function purgedProtocolVersions(): { [protocol: string]: number } {\n return { [DOCUMENT_PURGE_PROTOCOL]: 1 };\n}\n"],"mappings":";;;;AAUA,MAAa,6BAA6B;AAG1C,MAAM,UAAU;AAChB,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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OAAO;EACP,MAAM;EACN,gBAAgB,OAAO;EACvB,MAAM;EACN;CACF;AACF;;AAGA,SAAgB,yBAAyD;CACvE,OAAO,GAAG,0BAA0B,EAAE;AACxC"}
@@ -1,5 +1,5 @@
1
- import { V as DEFAULT_REGISTRY_URL } from "../types-CmeoQg_J.js";
2
- import { B as RegistryPackageMap, F as PackageInfo, H as RegistryPackageStatus, I as PackageListItem, L as PackagePage, R as RegistryPackage, V as RegistryPackageSource, z as RegistryPackageList } from "../types-CI3ren9F.js";
1
+ import { V as DEFAULT_REGISTRY_URL } from "../types-CFbd2nan.js";
2
+ import { B as PackagePage, F as PACKAGE_MODULE_TYPES, G as RegistryPackageSource, H as RegistryPackage, I as PackageFacets, K as RegistryPackageStatus, L as PackageInfo, R as PackageListItem, U as RegistryPackageList, V as Page, W as RegistryPackageMap, z as PackageModuleType } from "../types-B11NGQOQ.js";
3
3
  import { slimManifest } from "./manifest-slim.js";
4
4
  import { toCdnUrl } from "./urls.js";
5
5
  import { getUpdateTarget, parseInstallSpec } from "./updates.js";
@@ -79,6 +79,6 @@ export interface NpmUnpublishResult {
79
79
  */
80
80
  export declare function npmUnpublish(options: NpmUnpublishOptions): Promise<NpmUnpublishResult>;
81
81
  //#endregion
82
- export { DEFAULT_REGISTRY_URL, type PackageInfo, type PackageListItem, type PackagePage, type RegistryPackage, type RegistryPackageList, type RegistryPackageMap, type RegistryPackageSource, type RegistryPackageStatus, getUpdateTarget, parseInstallSpec, slimManifest, toCdnUrl };
82
+ export { DEFAULT_REGISTRY_URL, PACKAGE_MODULE_TYPES, PackageFacets, PackageInfo, PackageListItem, PackageModuleType, PackagePage, Page, RegistryPackage, RegistryPackageList, RegistryPackageMap, RegistryPackageSource, RegistryPackageStatus, getUpdateTarget, parseInstallSpec, slimManifest, toCdnUrl };
83
83
  export {};
84
84
  //# sourceMappingURL=index.d.ts.map
@@ -5,6 +5,15 @@ import { promises, readFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";
6
6
  import { join } from "node:path";
7
7
  import spawn from "cross-spawn";
8
+ //#region registry/types.ts
9
+ /** Manifest module lists accepted by the `moduleType` filter. */
10
+ const PACKAGE_MODULE_TYPES = [
11
+ "documentModels",
12
+ "editors",
13
+ "apps",
14
+ "subgraphs",
15
+ "processors"
16
+ ];
8
17
  const DEFAULT_REGISTRY_URL = "https://registry.vetra.io";
9
18
  const POWERHOUSE_CONFIG_FILE = "powerhouse.config.json";
10
19
  const HOME_DIR = homedir();
@@ -164,6 +173,6 @@ async function npmUnpublish(options) {
164
173
  ], { cwd }) };
165
174
  }
166
175
  //#endregion
167
- export { DEFAULT_REGISTRY_URL, checkNpmAuth, getUpdateTarget, npmPublish, npmUnpublish, parseInstallSpec, registryAuthKey, resolveRegistryUrl, slimManifest, toCdnUrl, writeRegistryAuthToken };
176
+ export { DEFAULT_REGISTRY_URL, PACKAGE_MODULE_TYPES, checkNpmAuth, getUpdateTarget, npmPublish, npmUnpublish, parseInstallSpec, registryAuthKey, resolveRegistryUrl, slimManifest, toCdnUrl, writeRegistryAuthToken };
168
177
 
169
178
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fs"],"sources":["../../clis/constants.ts","../../clis/file-system/get-config.ts","../../clis/file-system/spawn-async.ts","../../registry/registry.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Manifest } from \"../document-model/types.js\";\nimport type { PowerhouseConfig } from \"./types.js\";\n\nexport const SERVICE_ACTIONS = [\n \"start\",\n \"stop\",\n \"status\",\n \"setup\",\n \"restart\",\n] as const;\n\nexport const SECONDS_IN_DAY = 24 * 60 * 60;\nexport const DEFAULT_EXPIRY_DAYS = 7;\nexport const DEFAULT_EXPIRY_SECONDS = DEFAULT_EXPIRY_DAYS * SECONDS_IN_DAY;\n\nexport const DRIVES_PRESERVE_STRATEGIES = [\n \"preserve-all\",\n \"preserve-by-url-and-detach\",\n] as const;\n\nexport const LOG_LEVELS = [\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"verbose\",\n] as const;\n\nexport const DEFAULT_TIMEOUT = 300 as const;\n\nexport const DEFAULT_CONNECT_STUDIO_PORT = 3000 as const;\n\nexport const DEFAULT_VETRA_CONNECT_PORT = 3001 as const;\n\nexport const DEFAULT_CONNECT_PREVIEW_PORT = 4173 as const;\n\nexport const DEFAULT_CONNECT_OUTDIR = \".ph/connect-build/dist/\" as const;\n\nexport const DEFAULT_RENOWN_URL = \"https://www.renown.id\" as const;\n\nexport const DEFAULT_REGISTRY_URL = \"https://registry.vetra.io\" as const;\n\nexport const DEFAULT_SWITCHBOARD_PORT = 4001 as const;\n\n// Per-project dev-server port bands. `ph init` assigns each project a port\n// triple derived from its name, so two projects never collide and an agent's\n// MCP URL can be baked into .mcp.json before a session starts.\n//\n// Two hard constraints picked these bands, both below 10000:\n//\n// 1. Below the OS ephemeral range. Linux allocates outbound source ports\n// from 32768-60999 (`/proc/sys/net/ipv4/ip_local_port_range`); macOS and\n// Windows start at 49152. A listener parked in that window can lose a\n// race to a transient outbound socket, which would surface as a\n// `--strictPort` failure blaming a project conflict that does not exist.\n// 2. Below 10000, which is where ph-clint starts. ph-clint derives its own\n// per-CLI ports by hashing into 10000-59900, so staying under 10000\n// keeps the two schemes from ever contending.\n//\n// Within those limits the blocks were chosen by measuring which ports the\n// Powerhouse repos actually reference: 2000-2999 has none, 7000-7999 has one,\n// 6000-6999 has five. See PROJECT_PORT_DENYLIST in project-ports.ts for the\n// individual ports skipped inside them.\nexport const PROJECT_PORT_BAND_SIZE = 1000 as const;\nexport const PROJECT_PORT_BAND_SWITCHBOARD = 7000 as const;\nexport const PROJECT_PORT_BAND_STUDIO = 6000 as const;\nexport const PROJECT_PORT_BAND_VETRA_CONNECT = 2000 as const;\n\nexport const DEFAULT_VETRA_DRIVE_ID = \"vetra\" as const;\n\nexport const MINIMUM_NODE_VERSION = \"24.0.0\" as const;\nexport const PH_BIN = \"ph-cli-legacy\" as const;\nexport const POWERHOUSE_CONFIG_FILE = \"powerhouse.config.json\" as const;\nexport const PH_GLOBAL_DIR_NAME = \".ph\" as const;\n// Keep PH_GLOBAL_PROJECT_NAME for backwards compatibility\nexport const PH_GLOBAL_PROJECT_NAME = PH_GLOBAL_DIR_NAME;\n\nexport const HOME_DIR = homedir();\n\nexport const POWERHOUSE_GLOBAL_DIR = join(HOME_DIR, PH_GLOBAL_DIR_NAME);\n\n// Workspace packages that go in peerDependencies of every generated project.\nexport const VERSIONED_PEER_DEPENDENCIES = [\n \"document-model\",\n \"@powerhousedao/reactor-browser\",\n];\n\ntype PeerSpec = { peer: string; dev: string };\n\nexport const REACTOR_API_PACKAGE = \"@powerhousedao/reactor-api\";\nexport const ANALYTICS_ENGINE_CORE_PACKAGE =\n \"@powerhousedao/analytics-engine-core\";\nexport const GRAPHQL_PACKAGE = \"graphql\";\nexport const GRAPHQL_TAG_PACKAGE = \"graphql-tag\";\nexport const PIECES_FRAMEWORK_PACKAGE = \"@powerhousedao/pieces-framework\";\n\n// External peerDependencies of every generated project.\n// `peer` is the consumer-facing range; `dev` is the exact build-tested pin.\n// graphql / graphql-tag are always-on because the workspace packages pulled\n// in by every `ph init` project (codegen, reactor-api, reactor-browser,\n// vetra-packages) declare them as peers — even projects without subgraphs\n// need them in scope so pnpm hoists a single graphql instance.\nexport const PEER_EXTERNAL_DEPENDENCIES = {\n [GRAPHQL_PACKAGE]: { peer: \"^16\", dev: \"16.12.0\" },\n [GRAPHQL_TAG_PACKAGE]: { peer: \"^2\", dev: \"2.12.6\" },\n react: { peer: \"^19\", dev: \"19.2.6\" },\n \"react-dom\": { peer: \"^19\", dev: \"19.2.6\" },\n zod: { peer: \"^4\", dev: \"4.3.6\" },\n} as const satisfies Record<string, PeerSpec>;\n\n// Per-feature deps added dynamically by codegen when required. `devVersioned`\n// is for a workspace package the build inlines, which no consumer provides.\nexport const FEATURE_DEPENDENCIES = {\n analyticsProcessor: {\n peerVersioned: [ANALYTICS_ENGINE_CORE_PACKAGE],\n peerExternal: {},\n devVersioned: [],\n },\n // Each piece is bundled whole (build-pieces.mts), framework included, so the\n // framework is only ever needed to compile the piece's own source.\n piece: {\n peerVersioned: [],\n peerExternal: {},\n devVersioned: [PIECES_FRAMEWORK_PACKAGE],\n },\n} as const satisfies Record<\n string,\n {\n peerVersioned: readonly string[];\n peerExternal: Record<string, PeerSpec>;\n devVersioned: readonly string[];\n }\n>;\n\nexport const VERSIONED_DEPENDENCIES = [\n ...VERSIONED_PEER_DEPENDENCIES,\n ...FEATURE_DEPENDENCIES.analyticsProcessor.peerVersioned,\n];\n\n// Transitive dependencies whose postinstall scripts the generated project\n// trusts. Mirrors the `allowBuilds` map in the boilerplate's\n// pnpm-workspace.yaml and is also passed as `--allow-build` flags to\n// `pnpm dlx @powerhousedao/ph-cli init` so pnpm 11's strict-dep-builds\n// default doesn't prompt during the outer dlx download.\nexport const BOILERPLATE_ALLOWED_BUILDS = [\n \"@apollo/protobufjs\",\n \"@datadog/pprof\",\n \"@parcel/watcher\",\n \"@reown/appkit\",\n \"bufferutil\",\n \"esbuild\",\n \"keccak\",\n \"protobufjs\",\n \"utf-8-validate\",\n] as const;\n\n// Single-version pins the boilerplate enforces on generated projects,\n// avoiding duplicates from coexisting version ranges. Rendered as pnpm\n// `overrides` (pnpm-workspace.yaml) and as yarn v1 `resolutions`\n// (package.json). Generated-project only — never change the monorepo\n// catalog for this (a re-resolution there pulls a tsc-crashing TS6 beta).\nexport const BOILERPLATE_DEPENDENCY_OVERRIDES = {\n \"date-fns\": \"4.3.0\",\n vite: \"8.0.14\",\n rolldown: \"1.0.2\",\n} as const satisfies Record<string, string>;\n\nexport const VERSIONED_DEV_DEPENDENCIES = [\n \"@powerhousedao/ph-cli\",\n \"@powerhousedao/reactor\",\n \"@powerhousedao/shared\",\n \"@powerhousedao/connect\",\n \"@powerhousedao/design-system\",\n];\n\nexport const packageJsonExports = {\n \".\": {\n types: \"./dist/types/index.d.ts\",\n browser: \"./dist/browser/index.js\",\n node: \"./dist/node/index.mjs\",\n },\n \"./reactor\": {\n types: \"./dist/types/reactor/index.d.ts\",\n browser: \"./dist/browser/reactor/index.js\",\n },\n \"./document-models\": {\n types: \"./dist/types/document-models/index.d.ts\",\n browser: \"./dist/browser/document-models/index.js\",\n node: \"./dist/node/document-models/index.mjs\",\n },\n \"./document-models/*\": {\n types: \"./dist/types/document-models/*/index.d.ts\",\n browser: \"./dist/browser/document-models/*/index.js\",\n node: \"./dist/node/document-models/*/index.mjs\",\n },\n \"./editors\": {\n types: \"./dist/types/editors/index.d.ts\",\n browser: \"./dist/browser/editors/index.js\",\n node: \"./dist/node/editors/index.mjs\",\n },\n \"./editors/*\": {\n types: \"./dist/types/editors/*/editor.d.ts\",\n browser: \"./dist/browser/editors/*/editor.js\",\n node: \"./dist/node/editors/*/editor.mjs\",\n },\n \"./subgraphs\": {\n types: \"./dist/types/subgraphs/index.d.ts\",\n browser: \"./dist/browser/subgraphs/index.js\",\n node: \"./dist/node/subgraphs/index.mjs\",\n },\n \"./processors\": {\n types: \"./dist/types/processors/index.d.ts\",\n browser: \"./dist/browser/processors/index.js\",\n node: \"./dist/node/processors/index.mjs\",\n },\n // Node only, as the build is: a piece is loaded by a host process, never by\n // the browser. Without these a package can build a piece and still fail the\n // `packageName/pieces` import a host resolves it through.\n \"./pieces\": {\n types: \"./dist/types/pieces/index.d.ts\",\n node: \"./dist/node/pieces/index.mjs\",\n },\n \"./pieces/*\": {\n types: \"./dist/types/pieces/*/index.d.ts\",\n node: \"./dist/node/pieces/*/index.mjs\",\n },\n \"./manifest\": \"./dist/powerhouse.manifest.json\",\n \"./style.css\": \"./dist/style.css\",\n} as const;\n\nexport const packageScripts = {\n \"test:watch\": \"vitest\",\n lint: \"oxlint --type-aware --type-check\",\n \"lint:fix\": \"oxlint --type-aware --type-check --fix\",\n format: \"oxfmt\",\n \"format:check\": \"oxfmt --check\",\n tsc: \"tsc\",\n \"tsc:watch\": \"tsc --watch\",\n generate: \"ph-cli generate\",\n connect: \"ph-cli connect\",\n build: \"ph-cli build\",\n reactor: \"ph-cli reactor\",\n service: \"ph-cli service\",\n vetra: \"ph-cli vetra\",\n \"service-startup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh\",\n \"service-unstartup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh\",\n} as const;\n\nexport const externalDependencies = {} as const;\n\n// eslint/prettier devDependencies present in projects scaffolded before the oxc migration.\n// Stripped from package.json during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_DEPENDENCIES = [\n \"@eslint/js\",\n \"eslint\",\n \"eslint-config-prettier\",\n \"eslint-plugin-prettier\",\n \"eslint-plugin-react\",\n \"eslint-plugin-react-hooks\",\n \"globals\",\n \"prettier\",\n \"typescript-eslint\",\n] as const;\n\n// Legacy lint/format config files written by eslint/prettier boilerplate.\n// Removed from the project root during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_FILES = [\n \"eslint.config.js\",\n \"eslint.config.mjs\",\n \"eslint.config.cjs\",\n \"eslint.config.ts\",\n \".eslintrc\",\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.json\",\n \".eslintrc.yml\",\n \".eslintrc.yaml\",\n \".eslintignore\",\n \".prettierrc\",\n \".prettierrc.js\",\n \".prettierrc.cjs\",\n \".prettierrc.json\",\n \".prettierrc.yml\",\n \".prettierrc.yaml\",\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n \"prettier.config.mjs\",\n \".prettierignore\",\n] as const;\n\nexport const externalDevDependencies = {\n \"@electric-sql/pglite\": \"0.3.15\",\n \"@electric-sql/pglite-tools\": \"0.2.20\",\n \"@powerhousedao/document-engineering\": \"1.40.5\",\n \"@tailwindcss/cli\": \"^4.1.18\",\n \"@tailwindcss/vite\": \"^4.1.18\",\n \"@types/node\": \"^24.9.2\",\n \"@types/react\": \"^19.2.3\",\n \"@types/react-dom\": \"^19.2.3\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"@vitest/coverage-v8\": \"4.1.1\",\n oxfmt: \"0.68.0\",\n oxlint: \"1.70.0\",\n \"oxlint-tsgolint\": \"0.23.0\",\n tailwindcss: \"^4.1.16\",\n typescript: \"~7.0.2\",\n vite: \"^8.0.10\",\n \"vite-tsconfig-paths\": \"6.1.1\",\n vitest: \"4.1.1\",\n} as const;\n\nexport const defaultManifest: Manifest = {\n name: \"\",\n description: \"\",\n category: \"\",\n publisher: {\n name: \"\",\n url: \"\",\n },\n documentModels: [],\n editors: [],\n apps: [],\n subgraphs: [],\n processors: [],\n};\n\nconst DEFAULT_DOCUMENT_MODELS_DIR = \"./document-models\";\nconst DEFAULT_EDITORS_DIR = \"./editors\";\nconst DEFAULT_PROCESSORS_DIR = \"./processors\";\nconst DEFAULT_SUBGRAPHS_DIR = \"./subgraphs\";\nconst DEFAULT_IMPORT_SCRIPTS_DIR = \"./scripts\";\nconst DEFAULT_SKIP_FORMAT = false;\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport const DEFAULT_CONFIG: PowerhouseConfig = {\n documentModelsDir: DEFAULT_DOCUMENT_MODELS_DIR,\n editorsDir: DEFAULT_EDITORS_DIR,\n processorsDir: DEFAULT_PROCESSORS_DIR,\n subgraphsDir: DEFAULT_SUBGRAPHS_DIR,\n importScriptsDir: DEFAULT_IMPORT_SCRIPTS_DIR,\n skipFormat: DEFAULT_SKIP_FORMAT,\n logLevel: DEFAULT_LOG_LEVEL,\n auth: {\n enabled: false,\n admins: [],\n },\n};\n","import { readFileSync } from \"node:fs\";\nimport { DEFAULT_CONFIG } from \"../constants.js\";\nimport type { PowerhouseConfig } from \"../types.js\";\n\nexport function getConfig(path = \"./powerhouse.config.json\") {\n let config: PowerhouseConfig = { ...DEFAULT_CONFIG };\n try {\n const configStr = readFileSync(path, \"utf-8\");\n const userConfig = JSON.parse(configStr) as PowerhouseConfig;\n config = { ...config, ...userConfig };\n } catch {\n // console.warn(\"No powerhouse.config.json found, using defaults\");\n }\n\n return config;\n}\n","import spawn from \"cross-spawn\";\n\nexport function spawnAsync(\n command: string,\n args: string[],\n options: {\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n } = {},\n): Promise<string> {\n return new Promise((resolve, reject) => {\n // cross-spawn rather than node:child_process.spawn. On Windows npm, pnpm\n // and yarn are all `.cmd` shims, and since the fix for CVE-2024-27980\n // (Node 18.20.2 / 20.12.2 / 21.7.3 and later) `spawn` refuses to execute\n // `.bat`/`.cmd` unless `shell: true` -- it throws `spawn EINVAL`, and\n // synchronously, so an `error` listener never sees it. Passing\n // `shell: true` instead would hand the arguments to cmd.exe, which strips\n // quotes and splits on shell metacharacters. cross-spawn resolves the shim\n // and escapes the arguments itself, so the call keeps shell-less argument\n // semantics on every platform.\n const child = spawn(command, args, {\n cwd: options.cwd,\n env: options.env,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n\n let stdout = \"\";\n let stderr = \"\";\n\n child.stdout?.on(\"data\", (d: Buffer) => {\n stdout += d.toString();\n });\n\n child.stderr?.on(\"data\", (d: Buffer) => {\n stderr += d.toString();\n });\n\n child.on(\"error\", reject);\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve(stdout.trim());\n } else {\n reject(\n new Error(stderr.trim() || `${command} exited with code ${code}`),\n );\n }\n });\n });\n}\n","import { promises as fs } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport {\n DEFAULT_REGISTRY_URL,\n POWERHOUSE_CONFIG_FILE,\n} from \"../clis/constants.js\";\nimport { getConfig } from \"../clis/file-system/get-config.js\";\nimport { spawnAsync } from \"../clis/file-system/spawn-async.js\";\n\nexport { DEFAULT_REGISTRY_URL } from \"../clis/constants.js\";\n\n/**\n * Extract the host portion of a registry URL — what npm uses as the key in\n * `~/.npmrc` for per-registry tokens (e.g. `//registry.vetra.io/`).\n */\nexport function registryAuthKey(registryUrl: string): string {\n const url = new URL(registryUrl);\n // Always trailing slash; npm's lookup is exact-match against the leading\n // path of the registry URL, with `//` prefix and trailing `/`.\n const path = url.pathname.endsWith(\"/\") ? url.pathname : `${url.pathname}/`;\n return `//${url.host}${path}:_authToken`;\n}\n\nexport interface ResolveRegistryUrlOptions {\n /** Explicit registry URL (e.g. from --registry flag). Highest priority. */\n registry?: string;\n /** Project path to read powerhouse.config.json from. */\n projectPath: string;\n /** Environment variables. Defaults to process.env. */\n env?: Record<string, string | undefined>;\n}\n\n/**\n * Resolve the registry URL with priority: flag > env > config > default.\n */\nexport function resolveRegistryUrl(options: ResolveRegistryUrlOptions): string {\n const { registry, projectPath, env = process.env } = options;\n const configPath = join(projectPath, POWERHOUSE_CONFIG_FILE);\n const config = getConfig(configPath);\n\n return (\n registry ??\n env.PH_REGISTRY_URL ??\n config.packageRegistryUrl ??\n DEFAULT_REGISTRY_URL\n );\n}\n\n/**\n * Check if the user is authenticated with the given npm registry.\n * Returns the username on success, throws on failure.\n */\nexport async function checkNpmAuth(registryUrl: string): Promise<string> {\n return spawnAsync(\"npm\", [\"whoami\", \"--registry\", registryUrl]);\n}\n\nexport interface NpmPublishOptions {\n /** Registry URL to publish to. */\n registryUrl: string;\n /** Working directory (project root). */\n cwd: string;\n /** Additional arguments forwarded to npm publish. */\n args?: string[];\n /** Bearer token for the registry. When set, passed via a registry-scoped\n * `_authToken` config flag rather than read from the user's `.npmrc`. */\n authToken?: string;\n}\n\nexport interface NpmPublishResult {\n /** stdout from npm publish. */\n stdout: string;\n}\n\n/**\n * Run `npm publish` against the given registry.\n * Uses spawn with args array to avoid shell injection.\n *\n * When `authToken` is provided, the token is passed via a registry-scoped\n * `--//host/:_authToken=<token>` flag (npm's standard form for per-registry\n * tokens) so we never have to write to `~/.npmrc`.\n */\nexport async function npmPublish(\n options: NpmPublishOptions,\n): Promise<NpmPublishResult> {\n const { registryUrl, cwd, args = [], authToken } = options;\n const tokenArg = authToken\n ? [`--${registryAuthKey(registryUrl)}=${authToken}`]\n : [];\n const npmArgs = [\"publish\", \"--registry\", registryUrl, ...tokenArg, ...args];\n const stdout = await spawnAsync(\"npm\", npmArgs, { cwd });\n return { stdout };\n}\n\n/**\n * Write `_authToken=<token>` for the given registry host into `~/.npmrc`,\n * preserving any other lines. Replaces the existing entry for the same key\n * if present. Returns the absolute path to the npmrc that was written.\n */\nexport async function writeRegistryAuthToken(\n registryUrl: string,\n token: string,\n): Promise<string> {\n const npmrcPath = join(homedir(), \".npmrc\");\n const key = registryAuthKey(registryUrl);\n let existing = \"\";\n try {\n existing = await fs.readFile(npmrcPath, \"utf8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err;\n }\n const lines = existing.split(\"\\n\");\n const filtered = lines.filter((line) => !line.startsWith(`${key}=`));\n // Also drop any trailing empties to avoid stacking blank lines on rewrite.\n while (filtered.length && filtered[filtered.length - 1] === \"\")\n filtered.pop();\n filtered.push(`${key}=${token}`);\n await fs.writeFile(npmrcPath, `${filtered.join(\"\\n\")}\\n`, \"utf8\");\n return npmrcPath;\n}\n\nexport interface NpmUnpublishOptions {\n /** Registry URL to unpublish from. */\n registryUrl: string;\n /** Working directory (project root). */\n cwd: string;\n /** Package spec: `<name>` (whole package) or `<name>@<version>` (single version). */\n spec: string;\n /** Additional arguments forwarded to npm unpublish. */\n args?: string[];\n /** Bearer token for the registry (same semantics as `NpmPublishOptions.authToken`). */\n authToken?: string;\n}\n\nexport interface NpmUnpublishResult {\n /** stdout from npm unpublish. */\n stdout: string;\n}\n\n/**\n * Run `npm unpublish` against the given registry.\n * Always passes `--force` because npm otherwise refuses to unpublish packages\n * older than 72h (a public-npmjs safeguard that doesn't apply to private registries).\n */\nexport async function npmUnpublish(\n options: NpmUnpublishOptions,\n): Promise<NpmUnpublishResult> {\n const { registryUrl, cwd, spec, args = [], authToken } = options;\n const tokenArg = authToken\n ? [`--${registryAuthKey(registryUrl)}=${authToken}`]\n : [];\n const npmArgs = [\n \"unpublish\",\n spec,\n \"--registry\",\n registryUrl,\n \"--force\",\n ...tokenArg,\n ...args,\n ];\n const stdout =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AAM,IACR,CAAC,CAAC,QAAQ,SAAS,CAAC,KAAK,WAAW,GAAG,IAAI,EAAE,CAAC;CAEnE,OAAO,SAAS,UAAU,SAAS,SAAS,SAAS,OAAO,IAC1D,SAAS,IAAI;CACf,SAAS,KAAK,GAAG,IAAI,GAAG,OAAO;CAC/B,MAAMA,SAAG,UAAU,WAAW,GAAG,SAAS,KAAK,IAAI,EAAE,KAAK,MAAM;CAChE,OAAO;AACT;;;;;;AAyBA,eAAsB,aACpB,SAC6B;CAC7B,MAAM,EAAE,aAAa,KAAK,MAAM,OAAO,CAAC,GAAG,cAAc;CAczD,OAAO,EAAE,QAAA,MADY,WAAW,OAAO;EARrC;EACA;EACA;EACA;EACA;EACA,GATe,YACb,CAAC,KAAK,gBAAgB,WAAW,EAAE,GAAG,WAAW,IACjD,CAAC;EAQH,GAAG;CAEkC,GAAS,EAAE,IAAI,CAAC,EACvC;AAClB"}
1
+ {"version":3,"file":"index.js","names":["fs"],"sources":["../../registry/types.ts","../../clis/constants.ts","../../clis/file-system/get-config.ts","../../clis/file-system/spawn-async.ts","../../registry/registry.ts"],"sourcesContent":["import type { Manifest } from \"types\";\nexport interface PackageInfo {\n name: string;\n path: string;\n manifest: Manifest | null;\n documentTypes: string[];\n version?: string;\n /** Install spec the user requested (name, name@tag, or name@version); present\n * on installed packages, used to pick the update stream. Absent for legacy\n * entries. */\n spec?: string;\n /** Mapping of dist-tag → version (e.g. {latest: \"1.0.0\", dev: \"1.1.0-dev.3\"}). */\n distTags?: Record<string, string>;\n /** All published versions of the package, sorted ascending by semver. */\n versions?: string[];\n /**\n * The newest version the registry currently reports for this package (the\n * `version` field of list items / single-package responses). Distinct from\n * {@link version}, which holds the installed version on installed rows.\n * Every registry reports it, even ones without dist-tag support, so it is\n * the fallback target for the `latest` update stream.\n */\n latestVersion?: string;\n /** Accounts that own the name (publish/unpublish rights). Present only on\n * registries with the Postgres-backed auth; omitted when untracked. */\n owners?: string[];\n}\n\n/**\n * Item shape of `GET /packages` pages: only what a listing card renders. Pass\n * `detail=full` for {@link PackageInfo} items.\n */\nexport interface PackageListItem {\n name: string;\n path: string;\n version?: string;\n description?: string;\n category?: string;\n publisher?: { name?: string; url?: string };\n}\n\n/** Envelope of `GET /packages` and `GET /pieces`. */\nexport interface Page<T> {\n items: T[];\n total: number;\n limit: number;\n offset: number;\n hasMore: boolean;\n}\n\n/** Filter options over the `name`-restricted set, sent with `facets=true`. */\nexport interface PackageFacets {\n categories: string[];\n publishers: string[];\n}\n\n/** `GET /packages`; items are {@link PackageInfo} with `detail=full`. */\nexport interface PackagePage<T = PackageListItem> extends Page<T> {\n facets?: PackageFacets;\n}\n\n/** Manifest module lists accepted by the `moduleType` filter. */\nexport const PACKAGE_MODULE_TYPES = [\n \"documentModels\",\n \"editors\",\n \"apps\",\n \"subgraphs\",\n \"processors\",\n] as const;\nexport type PackageModuleType = (typeof PACKAGE_MODULE_TYPES)[number];\n\nexport type RegistryPackageStatus =\n | \"available\"\n | \"local-install\"\n | \"registry-install\"\n | \"dismissed\";\n\nexport type RegistryPackageSource =\n | \"available\"\n | \"local-install\"\n | \"registry-install\"\n | \"common\"\n | \"project\";\n\nexport type RegistryPackage = PackageInfo & {\n status: RegistryPackageStatus;\n /**\n * Shared-dependency version mismatches against the Connect build's version\n * table, pre-formatted (see `formatSharedDepWarnings`). Absent when the\n * host has no shared-deps table (vendor-off / dev) or none were found.\n */\n sharedDepWarnings?: string[];\n};\nexport type RegistryPackageMap = Record<string, RegistryPackage | undefined>;\nexport type RegistryPackageList = RegistryPackage[];\n","import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Manifest } from \"../document-model/types.js\";\nimport type { PowerhouseConfig } from \"./types.js\";\n\nexport const SERVICE_ACTIONS = [\n \"start\",\n \"stop\",\n \"status\",\n \"setup\",\n \"restart\",\n] as const;\n\nexport const SECONDS_IN_DAY = 24 * 60 * 60;\nexport const DEFAULT_EXPIRY_DAYS = 7;\nexport const DEFAULT_EXPIRY_SECONDS = DEFAULT_EXPIRY_DAYS * SECONDS_IN_DAY;\n\nexport const DRIVES_PRESERVE_STRATEGIES = [\n \"preserve-all\",\n \"preserve-by-url-and-detach\",\n] as const;\n\nexport const LOG_LEVELS = [\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"verbose\",\n] as const;\n\nexport const DEFAULT_TIMEOUT = 300 as const;\n\nexport const DEFAULT_CONNECT_STUDIO_PORT = 3000 as const;\n\nexport const DEFAULT_VETRA_CONNECT_PORT = 3001 as const;\n\nexport const DEFAULT_CONNECT_PREVIEW_PORT = 4173 as const;\n\nexport const DEFAULT_CONNECT_OUTDIR = \".ph/connect-build/dist/\" as const;\n\nexport const DEFAULT_RENOWN_URL = \"https://www.renown.id\" as const;\n\nexport const DEFAULT_REGISTRY_URL = \"https://registry.vetra.io\" as const;\n\nexport const DEFAULT_SWITCHBOARD_PORT = 4001 as const;\n\n// Per-project dev-server port bands. `ph init` assigns each project a port\n// triple derived from its name, so two projects never collide and an agent's\n// MCP URL can be baked into .mcp.json before a session starts.\n//\n// Two hard constraints picked these bands, both below 10000:\n//\n// 1. Below the OS ephemeral range. Linux allocates outbound source ports\n// from 32768-60999 (`/proc/sys/net/ipv4/ip_local_port_range`); macOS and\n// Windows start at 49152. A listener parked in that window can lose a\n// race to a transient outbound socket, which would surface as a\n// `--strictPort` failure blaming a project conflict that does not exist.\n// 2. Below 10000, which is where ph-clint starts. ph-clint derives its own\n// per-CLI ports by hashing into 10000-59900, so staying under 10000\n// keeps the two schemes from ever contending.\n//\n// Within those limits the blocks were chosen by measuring which ports the\n// Powerhouse repos actually reference: 2000-2999 has none, 7000-7999 has one,\n// 6000-6999 has five. See PROJECT_PORT_DENYLIST in project-ports.ts for the\n// individual ports skipped inside them.\nexport const PROJECT_PORT_BAND_SIZE = 1000 as const;\nexport const PROJECT_PORT_BAND_SWITCHBOARD = 7000 as const;\nexport const PROJECT_PORT_BAND_STUDIO = 6000 as const;\nexport const PROJECT_PORT_BAND_VETRA_CONNECT = 2000 as const;\n\nexport const DEFAULT_VETRA_DRIVE_ID = \"vetra\" as const;\n\nexport const MINIMUM_NODE_VERSION = \"24.0.0\" as const;\nexport const PH_BIN = \"ph-cli-legacy\" as const;\nexport const POWERHOUSE_CONFIG_FILE = \"powerhouse.config.json\" as const;\nexport const PH_GLOBAL_DIR_NAME = \".ph\" as const;\n// Keep PH_GLOBAL_PROJECT_NAME for backwards compatibility\nexport const PH_GLOBAL_PROJECT_NAME = PH_GLOBAL_DIR_NAME;\n\nexport const HOME_DIR = homedir();\n\nexport const POWERHOUSE_GLOBAL_DIR = join(HOME_DIR, PH_GLOBAL_DIR_NAME);\n\n// Workspace packages that go in peerDependencies of every generated project.\nexport const VERSIONED_PEER_DEPENDENCIES = [\n \"document-model\",\n \"@powerhousedao/reactor-browser\",\n];\n\ntype PeerSpec = { peer: string; dev: string };\n\nexport const REACTOR_API_PACKAGE = \"@powerhousedao/reactor-api\";\nexport const ANALYTICS_ENGINE_CORE_PACKAGE =\n \"@powerhousedao/analytics-engine-core\";\nexport const GRAPHQL_PACKAGE = \"graphql\";\nexport const GRAPHQL_TAG_PACKAGE = \"graphql-tag\";\nexport const PIECES_FRAMEWORK_PACKAGE = \"@powerhousedao/pieces-framework\";\n\n// External peerDependencies of every generated project.\n// `peer` is the consumer-facing range; `dev` is the exact build-tested pin.\n// graphql / graphql-tag are always-on because the workspace packages pulled\n// in by every `ph init` project (codegen, reactor-api, reactor-browser,\n// vetra-packages) declare them as peers — even projects without subgraphs\n// need them in scope so pnpm hoists a single graphql instance.\nexport const PEER_EXTERNAL_DEPENDENCIES = {\n [GRAPHQL_PACKAGE]: { peer: \"^16\", dev: \"16.12.0\" },\n [GRAPHQL_TAG_PACKAGE]: { peer: \"^2\", dev: \"2.12.6\" },\n react: { peer: \"^19\", dev: \"19.2.6\" },\n \"react-dom\": { peer: \"^19\", dev: \"19.2.6\" },\n zod: { peer: \"^4\", dev: \"4.3.6\" },\n} as const satisfies Record<string, PeerSpec>;\n\n// Per-feature deps added dynamically by codegen when required. `devVersioned`\n// is for a workspace package the build inlines, which no consumer provides.\nexport const FEATURE_DEPENDENCIES = {\n analyticsProcessor: {\n peerVersioned: [ANALYTICS_ENGINE_CORE_PACKAGE],\n peerExternal: {},\n devVersioned: [],\n },\n // Each piece is bundled whole (build-pieces.mts), framework included, so the\n // framework is only ever needed to compile the piece's own source.\n piece: {\n peerVersioned: [],\n peerExternal: {},\n devVersioned: [PIECES_FRAMEWORK_PACKAGE],\n },\n} as const satisfies Record<\n string,\n {\n peerVersioned: readonly string[];\n peerExternal: Record<string, PeerSpec>;\n devVersioned: readonly string[];\n }\n>;\n\nexport const VERSIONED_DEPENDENCIES = [\n ...VERSIONED_PEER_DEPENDENCIES,\n ...FEATURE_DEPENDENCIES.analyticsProcessor.peerVersioned,\n];\n\n// Transitive dependencies whose postinstall scripts the generated project\n// trusts. Mirrors the `allowBuilds` map in the boilerplate's\n// pnpm-workspace.yaml and is also passed as `--allow-build` flags to\n// `pnpm dlx @powerhousedao/ph-cli init` so pnpm 11's strict-dep-builds\n// default doesn't prompt during the outer dlx download.\nexport const BOILERPLATE_ALLOWED_BUILDS = [\n \"@apollo/protobufjs\",\n \"@datadog/pprof\",\n \"@parcel/watcher\",\n \"@reown/appkit\",\n \"bufferutil\",\n \"esbuild\",\n \"keccak\",\n \"protobufjs\",\n \"utf-8-validate\",\n] as const;\n\n// Single-version pins the boilerplate enforces on generated projects,\n// avoiding duplicates from coexisting version ranges. Rendered as pnpm\n// `overrides` (pnpm-workspace.yaml) and as yarn v1 `resolutions`\n// (package.json). Generated-project only — never change the monorepo\n// catalog for this (a re-resolution there pulls a tsc-crashing TS6 beta).\nexport const BOILERPLATE_DEPENDENCY_OVERRIDES = {\n \"date-fns\": \"4.3.0\",\n vite: \"8.0.14\",\n rolldown: \"1.0.2\",\n} as const satisfies Record<string, string>;\n\nexport const VERSIONED_DEV_DEPENDENCIES = [\n \"@powerhousedao/ph-cli\",\n \"@powerhousedao/reactor\",\n \"@powerhousedao/shared\",\n \"@powerhousedao/connect\",\n \"@powerhousedao/design-system\",\n];\n\nexport const packageJsonExports = {\n \".\": {\n types: \"./dist/types/index.d.ts\",\n browser: \"./dist/browser/index.js\",\n node: \"./dist/node/index.mjs\",\n },\n \"./reactor\": {\n types: \"./dist/types/reactor/index.d.ts\",\n browser: \"./dist/browser/reactor/index.js\",\n },\n \"./document-models\": {\n types: \"./dist/types/document-models/index.d.ts\",\n browser: \"./dist/browser/document-models/index.js\",\n node: \"./dist/node/document-models/index.mjs\",\n },\n \"./document-models/*\": {\n types: \"./dist/types/document-models/*/index.d.ts\",\n browser: \"./dist/browser/document-models/*/index.js\",\n node: \"./dist/node/document-models/*/index.mjs\",\n },\n \"./editors\": {\n types: \"./dist/types/editors/index.d.ts\",\n browser: \"./dist/browser/editors/index.js\",\n node: \"./dist/node/editors/index.mjs\",\n },\n \"./editors/*\": {\n types: \"./dist/types/editors/*/editor.d.ts\",\n browser: \"./dist/browser/editors/*/editor.js\",\n node: \"./dist/node/editors/*/editor.mjs\",\n },\n \"./subgraphs\": {\n types: \"./dist/types/subgraphs/index.d.ts\",\n browser: \"./dist/browser/subgraphs/index.js\",\n node: \"./dist/node/subgraphs/index.mjs\",\n },\n \"./processors\": {\n types: \"./dist/types/processors/index.d.ts\",\n browser: \"./dist/browser/processors/index.js\",\n node: \"./dist/node/processors/index.mjs\",\n },\n // Node only, as the build is: a piece is loaded by a host process, never by\n // the browser. Without these a package can build a piece and still fail the\n // `packageName/pieces` import a host resolves it through.\n \"./pieces\": {\n types: \"./dist/types/pieces/index.d.ts\",\n node: \"./dist/node/pieces/index.mjs\",\n },\n \"./pieces/*\": {\n types: \"./dist/types/pieces/*/index.d.ts\",\n node: \"./dist/node/pieces/*/index.mjs\",\n },\n \"./manifest\": \"./dist/powerhouse.manifest.json\",\n \"./style.css\": \"./dist/style.css\",\n} as const;\n\nexport const packageScripts = {\n \"test:watch\": \"vitest\",\n lint: \"oxlint --type-aware --type-check\",\n \"lint:fix\": \"oxlint --type-aware --type-check --fix\",\n format: \"oxfmt\",\n \"format:check\": \"oxfmt --check\",\n tsc: \"tsc\",\n \"tsc:watch\": \"tsc --watch\",\n generate: \"ph-cli generate\",\n connect: \"ph-cli connect\",\n build: \"ph-cli build\",\n reactor: \"ph-cli reactor\",\n service: \"ph-cli service\",\n vetra: \"ph-cli vetra\",\n \"service-startup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh\",\n \"service-unstartup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh\",\n} as const;\n\nexport const externalDependencies = {} as const;\n\n// eslint/prettier devDependencies present in projects scaffolded before the oxc migration.\n// Stripped from package.json during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_DEPENDENCIES = [\n \"@eslint/js\",\n \"eslint\",\n \"eslint-config-prettier\",\n \"eslint-plugin-prettier\",\n \"eslint-plugin-react\",\n \"eslint-plugin-react-hooks\",\n \"globals\",\n \"prettier\",\n \"typescript-eslint\",\n] as const;\n\n// Legacy lint/format config files written by eslint/prettier boilerplate.\n// Removed from the project root during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_FILES = [\n \"eslint.config.js\",\n \"eslint.config.mjs\",\n \"eslint.config.cjs\",\n \"eslint.config.ts\",\n \".eslintrc\",\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.json\",\n \".eslintrc.yml\",\n \".eslintrc.yaml\",\n \".eslintignore\",\n \".prettierrc\",\n \".prettierrc.js\",\n \".prettierrc.cjs\",\n \".prettierrc.json\",\n \".prettierrc.yml\",\n \".prettierrc.yaml\",\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n \"prettier.config.mjs\",\n \".prettierignore\",\n] as const;\n\nexport const externalDevDependencies = {\n \"@electric-sql/pglite\": \"0.3.15\",\n \"@electric-sql/pglite-tools\": \"0.2.20\",\n \"@powerhousedao/document-engineering\": \"1.40.5\",\n \"@tailwindcss/cli\": \"^4.1.18\",\n \"@tailwindcss/vite\": \"^4.1.18\",\n \"@types/node\": \"^24.9.2\",\n \"@types/react\": \"^19.2.3\",\n \"@types/react-dom\": \"^19.2.3\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"@vitest/coverage-v8\": \"4.1.1\",\n oxfmt: \"0.68.0\",\n oxlint: \"1.70.0\",\n \"oxlint-tsgolint\": \"0.23.0\",\n tailwindcss: \"^4.1.16\",\n typescript: \"~7.0.2\",\n vite: \"^8.0.10\",\n \"vite-tsconfig-paths\": \"6.1.1\",\n vitest: \"4.1.1\",\n} as const;\n\nexport const defaultManifest: Manifest = {\n name: \"\",\n description: \"\",\n category: \"\",\n publisher: {\n name: \"\",\n url: \"\",\n },\n documentModels: [],\n editors: [],\n apps: [],\n subgraphs: [],\n processors: [],\n};\n\nconst DEFAULT_DOCUMENT_MODELS_DIR = \"./document-models\";\nconst DEFAULT_EDITORS_DIR = \"./editors\";\nconst DEFAULT_PROCESSORS_DIR = \"./processors\";\nconst DEFAULT_SUBGRAPHS_DIR = \"./subgraphs\";\nconst DEFAULT_IMPORT_SCRIPTS_DIR = \"./scripts\";\nconst DEFAULT_SKIP_FORMAT = false;\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport const DEFAULT_CONFIG: PowerhouseConfig = {\n documentModelsDir: DEFAULT_DOCUMENT_MODELS_DIR,\n editorsDir: DEFAULT_EDITORS_DIR,\n processorsDir: DEFAULT_PROCESSORS_DIR,\n subgraphsDir: DEFAULT_SUBGRAPHS_DIR,\n importScriptsDir: DEFAULT_IMPORT_SCRIPTS_DIR,\n skipFormat: DEFAULT_SKIP_FORMAT,\n logLevel: DEFAULT_LOG_LEVEL,\n auth: {\n enabled: false,\n admins: [],\n },\n};\n","import { readFileSync } from \"node:fs\";\nimport { DEFAULT_CONFIG } from \"../constants.js\";\nimport type { PowerhouseConfig } from \"../types.js\";\n\nexport function getConfig(path = \"./powerhouse.config.json\") {\n let config: PowerhouseConfig = { ...DEFAULT_CONFIG };\n try {\n const configStr = readFileSync(path, \"utf-8\");\n const userConfig = JSON.parse(configStr) as PowerhouseConfig;\n config = { ...config, ...userConfig };\n } catch {\n // console.warn(\"No powerhouse.config.json found, using defaults\");\n }\n\n return config;\n}\n","import spawn from \"cross-spawn\";\n\nexport function spawnAsync(\n command: string,\n args: string[],\n options: {\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n } = {},\n): Promise<string> {\n return new Promise((resolve, reject) => {\n // cross-spawn rather than node:child_process.spawn. On Windows npm, pnpm\n // and yarn are all `.cmd` shims, and since the fix for CVE-2024-27980\n // (Node 18.20.2 / 20.12.2 / 21.7.3 and later) `spawn` refuses to execute\n // `.bat`/`.cmd` unless `shell: true` -- it throws `spawn EINVAL`, and\n // synchronously, so an `error` listener never sees it. Passing\n // `shell: true` instead would hand the arguments to cmd.exe, which strips\n // quotes and splits on shell metacharacters. cross-spawn resolves the shim\n // and escapes the arguments itself, so the call keeps shell-less argument\n // semantics on every platform.\n const child = spawn(command, args, {\n cwd: options.cwd,\n env: options.env,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n\n let stdout = \"\";\n let stderr = \"\";\n\n child.stdout?.on(\"data\", (d: Buffer) => {\n stdout += d.toString();\n });\n\n child.stderr?.on(\"data\", (d: Buffer) => {\n stderr += d.toString();\n });\n\n child.on(\"error\", reject);\n\n child.on(\"close\", (code) => {\n if (code === 0) {\n resolve(stdout.trim());\n } else {\n reject(\n new Error(stderr.trim() || `${command} exited with code ${code}`),\n );\n }\n });\n });\n}\n","import { promises as fs } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport {\n DEFAULT_REGISTRY_URL,\n POWERHOUSE_CONFIG_FILE,\n} from \"../clis/constants.js\";\nimport { getConfig } from \"../clis/file-system/get-config.js\";\nimport { spawnAsync } from \"../clis/file-system/spawn-async.js\";\n\nexport { DEFAULT_REGISTRY_URL } from \"../clis/constants.js\";\n\n/**\n * Extract the host portion of a registry URL — what npm uses as the key in\n * `~/.npmrc` for per-registry tokens (e.g. `//registry.vetra.io/`).\n */\nexport function registryAuthKey(registryUrl: string): string {\n const url = new URL(registryUrl);\n // Always trailing slash; npm's lookup is exact-match against the leading\n // path of the registry URL, with `//` prefix and trailing `/`.\n const path = url.pathname.endsWith(\"/\") ? url.pathname : `${url.pathname}/`;\n return `//${url.host}${path}:_authToken`;\n}\n\nexport interface ResolveRegistryUrlOptions {\n /** Explicit registry URL (e.g. from --registry flag). Highest priority. */\n registry?: string;\n /** Project path to read powerhouse.config.json from. */\n projectPath: string;\n /** Environment variables. Defaults to process.env. */\n env?: Record<string, string | undefined>;\n}\n\n/**\n * Resolve the registry URL with priority: flag > env > config > default.\n */\nexport function resolveRegistryUrl(options: ResolveRegistryUrlOptions): string {\n const { registry, projectPath, env = process.env } = options;\n const configPath = join(projectPath, POWERHOUSE_CONFIG_FILE);\n const config = getConfig(configPath);\n\n return (\n registry ??\n env.PH_REGISTRY_URL ??\n config.packageRegistryUrl ??\n DEFAULT_REGISTRY_URL\n );\n}\n\n/**\n * Check if the user is authenticated with the given npm registry.\n * Returns the username on success, throws on failure.\n */\nexport async function checkNpmAuth(registryUrl: string): Promise<string> {\n return spawnAsync(\"npm\", [\"whoami\", \"--registry\", registryUrl]);\n}\n\nexport interface NpmPublishOptions {\n /** Registry URL to publish to. */\n registryUrl: string;\n /** Working directory (project root). */\n cwd: string;\n /** Additional arguments forwarded to npm publish. */\n args?: string[];\n /** Bearer token for the registry. When set, passed via a registry-scoped\n * `_authToken` config flag rather than read from the user's `.npmrc`. */\n authToken?: string;\n}\n\nexport interface NpmPublishResult {\n /** stdout from npm publish. */\n stdout: string;\n}\n\n/**\n * Run `npm publish` against the given registry.\n * Uses spawn with args array to avoid shell injection.\n *\n * When `authToken` is provided, the token is passed via a registry-scoped\n * `--//host/:_authToken=<token>` flag (npm's standard form for per-registry\n * tokens) so we never have to write to `~/.npmrc`.\n */\nexport async function npmPublish(\n options: NpmPublishOptions,\n): Promise<NpmPublishResult> {\n const { registryUrl, cwd, args = [], authToken } = options;\n const tokenArg = authToken\n ? [`--${registryAuthKey(registryUrl)}=${authToken}`]\n : [];\n const npmArgs = [\"publish\", \"--registry\", registryUrl, ...tokenArg, ...args];\n const stdout = await spawnAsync(\"npm\", npmArgs, { cwd });\n return { stdout };\n}\n\n/**\n * Write `_authToken=<token>` for the given registry host into `~/.npmrc`,\n * preserving any other lines. Replaces the existing entry for the same key\n * if present. Returns the absolute path to the npmrc that was written.\n */\nexport async function writeRegistryAuthToken(\n registryUrl: string,\n token: string,\n): Promise<string> {\n const npmrcPath = join(homedir(), \".npmrc\");\n const key = registryAuthKey(registryUrl);\n let existing = \"\";\n try {\n existing = await fs.readFile(npmrcPath, \"utf8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err;\n }\n const lines = existing.split(\"\\n\");\n const filtered = lines.filter((line) => !line.startsWith(`${key}=`));\n // Also drop any trailing empties to avoid stacking blank lines on rewrite.\n while (filtered.length && filtered[filtered.length - 1] === \"\")\n filtered.pop();\n filtered.push(`${key}=${token}`);\n await fs.writeFile(npmrcPath, `${filtered.join(\"\\n\")}\\n`, \"utf8\");\n return npmrcPath;\n}\n\nexport interface NpmUnpublishOptions {\n /** Registry URL to unpublish from. */\n registryUrl: string;\n /** Working directory (project root). */\n cwd: string;\n /** Package spec: `<name>` (whole package) or `<name>@<version>` (single version). */\n spec: string;\n /** Additional arguments forwarded to npm unpublish. */\n args?: string[];\n /** Bearer token for the registry (same semantics as `NpmPublishOptions.authToken`). */\n authToken?: string;\n}\n\nexport interface NpmUnpublishResult {\n /** stdout from npm unpublish. */\n stdout: string;\n}\n\n/**\n * Run `npm unpublish` against the given registry.\n * Always passes `--force` because npm otherwise refuses to unpublish packages\n * older than 72h (a public-npmjs safeguard that doesn't apply to private registries).\n */\nexport async function npmUnpublish(\n options: NpmUnpublishOptions,\n): Promise<NpmUnpublishResult> {\n const { registryUrl, cwd, spec, args = [], authToken } = options;\n const tokenArg = authToken\n ? [`--${registryAuthKey(registryUrl)}=${authToken}`]\n : [];\n const npmArgs = [\n \"unpublish\",\n spec,\n \"--registry\",\n registryUrl,\n \"--force\",\n ...tokenArg,\n ...args,\n ];\n const stdout = await spawnAsync(\"npm\", npmArgs, { cwd });\n return { stdout };\n}\n"],"mappings":";;;;;;;;;AA8DA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;AACF;AC1BA,MAAa,uBAAuB;AAgCpC,MAAa,yBAAyB;AAKtC,MAAa,WAAW,QAAQ;AAEK,KAAK,UAAA,KAA4B;AAGtE,MAAa,8BAA8B,CACzC,kBACA,gCACF;AA2BA,MAAa,uBAAuB;CAClC,oBAAoB;EAClB,eAAe,CAAC,sCAA6B;EAC7C,cAAc,CAAC;EACf,cAAc,CAAC;CACjB;CAGA,OAAO;EACL,eAAe,CAAC;EAChB,cAAc,CAAC;EACf,cAAc,CAAC,iCAAwB;CACzC;AACF;AASsC,CACpC,GAAG,6BACH,GAAG,qBAAqB,mBAAmB,aAC7C;AAuMA,MAAa,iBAAmC;CAC9C,mBAAmB;CACnB,YAAY;CACZ,eAAe;CACf,cAAc;CACd,kBAAkB;CAClB,YAAY;CACZ,UAAU;CACV,MAAM;EACJ,SAAS;EACT,QAAQ,CAAC;CACX;AACF;;;AC1VA,SAAgB,UAAU,OAAO,4BAA4B;CAC3D,IAAI,SAA2B,EAAE,GAAG,eAAe;CACnD,IAAI;EACF,MAAM,YAAY,aAAa,MAAM,OAAO;EAC5C,MAAM,aAAa,KAAK,MAAM,SAAS;EACvC,SAAS;GAAE,GAAG;GAAQ,GAAG;EAAW;CACtC,QAAQ,CAER;CAEA,OAAO;AACT;;;ACbA,SAAgB,WACd,SACA,MACA,UAGI,CAAC,GACY;CACjB,OAAO,IAAI,SAAS,SAAS,WAAW;EAUtC,MAAM,QAAQ,MAAM,SAAS,MAAM;GACjC,KAAK,QAAQ;GACb,KAAK,QAAQ;GACb,OAAO;IAAC;IAAU;IAAQ;GAAM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QAAQ;CAC1C,MAAM,MAAM,gBAAgB,WAAW;CACvC,IAAI,WAAW;CACf,IAAI;EACF,WAAW,MAAMA,SAAG,SAAS,WAAW,MAAM;CAChD,SAAS,KAAK;EACZ,IAAK,IAA8B,SAAS,UAAU,MAAM;CAC9D;CAEA,MAAM,WADQ,SAAS,MAAM,IACR,CAAC,CAAC,QAAQ,SAAS,CAAC,KAAK,WAAW,GAAG,IAAI,EAAE,CAAC;CAEnE,OAAO,SAAS,UAAU,SAAS,SAAS,SAAS,OAAO,IAC1D,SAAS,IAAI;CACf,SAAS,KAAK,GAAG,IAAI,GAAG,OAAO;CAC/B,MAAMA,SAAG,UAAU,WAAW,GAAG,SAAS,KAAK,IAAI,EAAE,KAAK,MAAM;CAChE,OAAO;AACT;;;;;;AAyBA,eAAsB,aACpB,SAC6B;CAC7B,MAAM,EAAE,aAAa,KAAK,MAAM,OAAO,CAAC,GAAG,cAAc;CAczD,OAAO,EAAE,QAAA,MADY,WAAW,OAAO;EARrC;EACA;EACA;EACA;EACA;EACA,GATe,YACb,CAAC,KAAK,gBAAgB,WAAW,EAAE,GAAG,WAAW,IACjD,CAAC;EAQH,GAAG;CAEkC,GAAS,EAAE,IAAI,CAAC,EACvC;AAClB"}
@@ -1,5 +1,5 @@
1
- import { Nn as Manifest } from "../types-CmeoQg_J.js";
2
- import "../types-CI3ren9F.js";
1
+ import { Nn as Manifest } from "../types-CFbd2nan.js";
2
+ import "../types-B11NGQOQ.js";
3
3
  //#region registry/manifest-slim.d.ts
4
4
  /**
5
5
  * Reduce a manifest to the summary fields the package-listing surfaces