@wildo-ai/wildo-module-client 1.1.11 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/_http-client.d.ts.map +1 -1
- package/dist/esm/services/_http-client.js.map +1 -1
- package/dist/esm/services/_zod-issue-formatting.d.ts.map +1 -1
- package/dist/esm/services/_zod-issue-formatting.js.map +1 -1
- package/dist/esm/services/index.d.ts.map +1 -1
- package/dist/esm/services/index.js.map +1 -1
- package/dist/esm/services/lockfile-repair.service.d.ts +12 -25
- package/dist/esm/services/lockfile-repair.service.d.ts.map +1 -1
- package/dist/esm/services/lockfile-repair.service.js +34 -39
- package/dist/esm/services/lockfile-repair.service.js.map +1 -1
- package/dist/esm/services/module-adopter.service.d.ts.map +1 -1
- package/dist/esm/services/module-adopter.service.js.map +1 -1
- package/dist/esm/services/module-packager.service.d.ts +8 -8
- package/dist/esm/services/module-packager.service.d.ts.map +1 -1
- package/dist/esm/services/module-packager.service.js +8 -8
- package/dist/esm/services/module-packager.service.js.map +1 -1
- package/dist/esm/services/provider-materialization-hook.d.ts.map +1 -1
- package/dist/esm/services/provider-materialization-hook.js.map +1 -1
- package/dist/esm/services/provider-sync-runner.d.ts +8 -9
- package/dist/esm/services/provider-sync-runner.d.ts.map +1 -1
- package/dist/esm/services/provider-sync-runner.js +6 -7
- package/dist/esm/services/provider-sync-runner.js.map +1 -1
- package/dist/esm/services/registry-companion-client.d.ts.map +1 -1
- package/dist/esm/services/registry-companion-client.js.map +1 -1
- package/dist/esm/services/registry-lockfile.service.d.ts.map +1 -1
- package/dist/esm/services/registry-lockfile.service.js.map +1 -1
- package/dist/esm/services/registry-server-client.d.ts.map +1 -1
- package/dist/esm/services/registry-server-client.js +21 -7
- package/dist/esm/services/registry-server-client.js.map +1 -1
- package/dist/esm/services/types.d.ts.map +1 -1
- package/dist/esm/services/types.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/__tests__/lockfile-repair.service.test.ts +5 -5
- package/src/__tests__/registry-server-client.test.ts +82 -3
- package/src/services/lockfile-repair.service.ts +36 -58
- package/src/services/module-packager.service.ts +8 -8
- package/src/services/provider-sync-runner.ts +8 -9
- package/src/services/registry-server-client.ts +24 -5
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-server-client.js","sourceRoot":"","sources":["../../../../src/services/registry-server-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,sCAAsC,EACtC,0BAA0B,EAC1B,yBAAyB,EACzB,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,EAExB,mBAAmB,EACnB,sBAAsB,EAEtB,wBAAwB,EACxB,eAAe,EACf,kCAAkC,EAClC,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,EACxB,8BAA8B,EAC9B,gBAAgB,EAChB,2BAA2B,EAC3B,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,GAM7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErG;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,oBAAoB;IAC9B,QAAQ,EAAE,CAAC,CAAC,K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IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,kCAAkC,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,8BAA8B,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1H,MAAM,IAAI,6BAA6B,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/F,CAAC;IACD,oFAAoF;IACpF,MAAM,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,4BAA4B,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAChH,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,MAAM,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7H,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,6BAA6B,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,2BAA2B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9G,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;AAChD,CAAC","sourcesContent":["/**\n * `RegistryServerClient` — HTTP client for the central registry\n * server (`platform-module-registry`, KD-7).\n *\n * Phase 2 fills out the read + download surface (`resolve`,\n * `info`, `search`, `download`). The wire shapes mirror the\n * gateway endpoints documented in the analysis plan's \"Registry\n * HTTP API\" section. The actual server (Phase 3) ships these\n * routes; until it does, the client throws typed errors when it\n * can't reach the server.\n *\n * Auth (KD-11): if `authToken` is supplied, every request adds\n * `Authorization: Bearer <token>`. Public read paths work without\n * a token; restricted paths return 401/403, surfaced as\n * `RegistryAuthRequiredError` (no key sent), `RegistryCredentialRejectedError` (a key sent and refused)\n * or `RegistryAuthForbiddenError`; a 429 is `RegistryRateLimitedError`.\n */\n\nimport { z } from 'zod';\nimport { formatZodIssuesAsSingleLine } from './_zod-issue-formatting';\nimport {\n ModuleManifestSchema,\n ModuleVersionRecordSchema,\n RegistryArtifactIntegrityMismatchError,\n RegistryAuthForbiddenError,\n RegistryAuthRequiredError,\n RegistryCredentialRejectedError,\n RegistryArtifactVisibilitySchema,\n RegistryDomainTakenError,\n RegistryError,\n RegistryRefusalCode,\n hasRegistryRefusalCode,\n type RegistryArtifactVisibility,\n RegistryRateLimitedError,\n isRegistryError,\n isRegistryReleaseStateConflictBody,\n RegistryMalformedPayloadError,\n RegistryModuleNotFoundError,\n RegistryUnexpectedStatusError,\n RegistryVersionNotFoundError,\n RegistryYankNoticeSchema,\n RegistryYankStateConflictError,\n RegistryYankVerb,\n REGISTRY_YANK_REASON_HEADER,\n REGISTRY_YANKED_AT_HEADER,\n Sha256DigestSchema,\n ModuleSearchHitSchema,\n moduleSearchFilterQueryPairs,\n moduleSearchHitMatchesFilter,\n type ModuleManifest,\n type ModuleSearchFilter,\n type ModuleSearchHit,\n type RegistryYankNotice,\n type ModuleVersionRecord,\n} from '@wildo-ai/platform-config-lib';\nimport { fetchJsonOk, fetchTransfer, fetchWithTimeout, joinUrl, readJsonBody } from './_http-client';\n\n/**\n * Zod schema for the `info()` response payload — mirrors\n * `RegistryInfoResult` and is enforced at the client boundary so a\n * server schema drift fails fast instead of returning malformed data\n * to downstream consumers.\n */\nconst RegistryInfoResponseSchema = z.object({\n moduleId: z.string().min(1),\n manifest: ModuleManifestSchema,\n versions: z.array(ModuleVersionRecordSchema),\n tags: z.record(z.string(), z.string()),\n});\n\nconst RegistrySearchResponseSchema = z.object({\n hits: z.array(ModuleSearchHitSchema),\n});\n\nconst DIAGNOSTIC_LABEL = 'Registry';\n\nexport interface RegistryServerClientOptions {\n /** Registry origin (e.g. `https://registry.wildo.ai`). */\n baseUrl: string;\n /** Optional bearer / API-key. CLI credentials are per-machine (KD-11). */\n authToken?: string;\n /** Request timeout in ms. */\n timeoutMs?: number;\n}\n\nfunction authHeaders(options: RegistryServerClientOptions): Record<string, string> {\n return options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {};\n}\n\n/**\n * Throw the typed error for a non-2xx response, after releasing its body (#1763 review: an unread body\n * holds the connection until garbage collection). A 401 is told apart by whether a key was SENT — \"log\n * in\" and \"your key no longer works\" are different remedies (#1759 review).\n */\nasync function refuseUnlessOk(\n res: Response,\n options: RegistryServerClientOptions,\n action: string,\n notFound?: () => RegistryError,\n): Promise<void> {\n if (res.ok) return;\n let error: RegistryError;\n if (res.status === 404 && notFound) error = notFound();\n else if (res.status === 401) error = options.authToken ? new RegistryCredentialRejectedError(options.baseUrl) : new RegistryAuthRequiredError(options.baseUrl);\n else if (res.status === 403) error = new RegistryAuthForbiddenError(action);\n else if (res.status === 429) error = new RegistryRateLimitedError(options.baseUrl, action, parseRetryAfterSeconds(res.headers.get('retry-after')));\n else error = new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action);\n await res.body?.cancel().catch(() => undefined);\n throw error;\n}\n\n/** `Retry-After` in its delta-seconds form; the HTTP-date form is not produced by a Wildo backend. */\nfunction parseRetryAfterSeconds(value: string | null): number | undefined {\n if (!value || !/^\\d+$/.test(value.trim())) return undefined;\n return Number(value.trim());\n}\n\n/**\n * 6th-pass M3: typed JSON-parse helper. A misconfigured proxy that\n * returns HTML at 2xx (or a truncated stream) would otherwise throw a\n * bare `SyntaxError` from `await res.json()`, bypassing every\n * `isRegistryError(err)` handler. This helper translates the parse\n * failure into a `RegistryMalformedPayloadError` so the typed-error\n * contract is universal across the client surface.\n */\nasync function parseJsonOrThrow(\n res: Response,\n registryUrl: string,\n action: string,\n timeoutMs: number | undefined,\n): Promise<unknown> {\n try {\n return await readJsonBody(res, registryUrl, action, timeoutMs);\n } catch (err) {\n // A body cut short by the request budget is a timeout (#1763), not a malformed payload.\n if (isRegistryError(err)) throw err;\n throw new RegistryMalformedPayloadError(\n registryUrl,\n action,\n `response is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n}\n\nexport interface RegistryResolveResult {\n /** Resolved exact version (matches `Sha256DigestSchema` for digest). */\n version: string;\n artifactDigest: string;\n /**\n * Present when the resolved release is yanked. Only an EXACT-version request can resolve to one\n * (#1758) — ranges and tags never do — so the caller is pinned to it and should warn, not refuse.\n */\n yanked?: RegistryYankNotice;\n}\n\nexport interface RegistryInfoResult {\n moduleId: string;\n manifest: ModuleManifest;\n versions: readonly ModuleVersionRecord[];\n /** dist-tag → version map (e.g. `latest → 1.2.3`). */\n tags: Readonly<Record<string, string>>;\n}\n\n/** One search hit: the module, its latest version, and (#2014) its kind and provider facts. */\nexport type RegistrySearchHit = ModuleSearchHit;\n\nexport const RegistryServerClient = {\n /**\n * Liveness probe against `/health`. Returns boolean — used by\n * `wildo registry ping` smoke. The registry server now relies on\n * the framework's auto-mounted `HealthController` at the engine\n * root (`GET /health` always 200; `GET /health/ready` enforces\n * dependency readiness), so the path has NO `/v1` prefix.\n */\n async ping(options: RegistryServerClientOptions): Promise<boolean> {\n try {\n await fetchJsonOk(joinUrl(options.baseUrl, '/health'), {\n method: 'GET',\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n return true;\n } catch {\n return false;\n }\n },\n\n /**\n * Resolve a semver range / tag against a registry domain. The\n * server returns the concrete version + artifact digest so the\n * caller can verify the download against `artifactDigest`.\n */\n async resolve(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; range: string },\n ): Promise<RegistryResolveResult> {\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}/resolve?range=${encodeURIComponent(args.range)}`,\n );\n const res = await fetchWithTimeout(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, `resolve ${args.moduleId}`, () => new RegistryVersionNotFoundError(args.moduleId, args.range));\n // 6th-pass M3: typed JSON-parse (was bare `SyntaxError` for\n // malformed proxy responses).\n const json = (await parseJsonOrThrow(res, options.baseUrl, `resolve ${args.moduleId}`, options.timeoutMs)) as {\n version?: unknown;\n artifactDigest?: unknown;\n yanked?: unknown;\n };\n const digest = String(json.artifactDigest ?? '');\n // 6th-pass M4: typed digest validation (was bare `ZodError`).\n const digestParse = Sha256DigestSchema.safeParse(digest);\n if (!digestParse.success) {\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n `resolve ${args.moduleId}`,\n `artifactDigest is not a valid sha256:<64-hex> string: ${formatZodIssuesAsSingleLine(digestParse.error)}`,\n );\n }\n if (typeof json.version !== 'string' || json.version.length === 0) {\n // 3rd-pass M6: typed `RegistryMalformedPayloadError` instead of\n // bare `Error` so callers' `isRegistryError(err)` handlers fire\n // correctly.\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n `resolve ${args.moduleId}`,\n 'response missing required `version` string',\n );\n }\n let yanked: RegistryYankNotice | undefined;\n if (json.yanked !== undefined) {\n const yankParse = RegistryYankNoticeSchema.safeParse(json.yanked);\n if (!yankParse.success) {\n throw new RegistryMalformedPayloadError(options.baseUrl, `resolve ${args.moduleId}`, `yanked: ${formatZodIssuesAsSingleLine(yankParse.error)}`);\n }\n yanked = yankParse.data;\n }\n return { version: json.version, artifactDigest: digest, ...(yanked ? { yanked } : {}) };\n },\n\n /**\n * Fetch full info for a module: manifest, every published\n * version, dist-tags. Used by `wildo registry info` (Phase 4).\n */\n async info(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string },\n ): Promise<RegistryInfoResult> {\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}`,\n );\n const res = await fetchWithTimeout(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, `info ${args.moduleId}`, () => new RegistryModuleNotFoundError(args.moduleId));\n // 6th-pass M3: typed JSON-parse.\n const json = await parseJsonOrThrow(res, options.baseUrl, `info ${args.moduleId}`, options.timeoutMs);\n const parsed = RegistryInfoResponseSchema.safeParse(json);\n if (!parsed.success) {\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n `info ${args.moduleId}`,\n formatZodIssuesAsSingleLine(parsed.error),\n );\n }\n return parsed.data;\n },\n\n /**\n * Search the registry's metadata index: a module-id substring, and (#2014) the manifest filters —\n * kind, engine capability and provider maturity. The server refuses an unknown filter value.\n */\n async search(\n options: RegistryServerClientOptions,\n args: { domain: string; query: string; filter?: ModuleSearchFilter },\n ): Promise<readonly RegistrySearchHit[]> {\n const params = new URLSearchParams([['q', args.query], ...moduleSearchFilterQueryPairs(args.filter ?? {})]);\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules?${params.toString()}`,\n );\n const res = await fetchWithTimeout(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, 'search');\n // 6th-pass M3: typed JSON-parse.\n const json = await parseJsonOrThrow(res, options.baseUrl, 'search', options.timeoutMs);\n const parsed = RegistrySearchResponseSchema.safeParse(json);\n if (!parsed.success) {\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n 'search',\n formatZodIssuesAsSingleLine(parsed.error),\n );\n }\n // Re-applied here: a server that predates the filters ignores them and answers every module (#2014 review F9).\n return parsed.data.hits.filter((hit) => moduleSearchHitMatchesFilter(hit, args.filter ?? {}));\n },\n\n /**\n * Stream-download a published artifact's bytes and verify the\n * sha256 integrity matches `expectedDigest`. Throws\n * `RegistryArtifactIntegrityMismatchError` on mismatch — the\n * digest check is non-negotiable per KD-9 / Security model.\n */\n async download(\n options: RegistryServerClientOptions,\n args: {\n domain: string;\n moduleId: string;\n version: string;\n expectedDigest: string;\n },\n ): Promise<{ bytes: Uint8Array; integrity: string; yanked?: RegistryYankNotice }> {\n // 7th-pass C-M1: caller-supplied digest is a developer-contract\n // violation if malformed, not a registry-runtime condition.\n // Throw `TypeError` (matching `C-L3` precedent for\n // `getModuleStagingPaths` argument-shape violations) so the\n // typed `RegistryError` vocabulary stays reserved for\n // registry-runtime errors. Prior `Sha256DigestSchema.parse(...)`\n // leaked a bare `ZodError` that bypassed\n // `isRegistryError(err)` handlers but ALSO confused\n // typed-handler maintainers about the contract.\n const digestParse = Sha256DigestSchema.safeParse(args.expectedDigest);\n if (!digestParse.success) {\n throw new TypeError(\n `download() expectedDigest must be a valid sha256:<64-hex> string (got: ${JSON.stringify(args.expectedDigest)}). ${formatZodIssuesAsSingleLine(digestParse.error)}`,\n );\n }\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}/${encodeURIComponent(args.version)}/artifact`,\n );\n // A transfer, not a metadata call: the response is bounded by `timeoutMs`, the body by an IDLE budget\n // reset on every chunk, so a large artifact over a slow link installs and a stalled one fails (#1763).\n const { response: res, readAll } = await fetchTransfer(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, `download ${args.moduleId}@${args.version}`, () => new RegistryVersionNotFoundError(args.moduleId, args.version));\n const buf = await readAll();\n const { createHash } = await import('node:crypto');\n const observed = `sha256:${createHash('sha256').update(buf).digest('hex')}`;\n if (observed !== args.expectedDigest) {\n throw new RegistryArtifactIntegrityMismatchError(\n args.moduleId,\n args.version,\n args.expectedDigest,\n observed,\n );\n }\n // A yanked release is served by exact version (#1758) and says so in headers.\n const yankedAt = res.headers.get(REGISTRY_YANKED_AT_HEADER);\n const encodedReason = res.headers.get(REGISTRY_YANK_REASON_HEADER);\n let reason: string | undefined;\n if (encodedReason) {\n try { reason = decodeURIComponent(encodedReason); } catch { reason = encodedReason; }\n }\n return { bytes: buf, integrity: observed, ...(yankedAt ? { yanked: { yankedAt, ...(reason ? { reason } : {}) } } : {}) };\n },\n /**\n * Yank a release (#1758): ranges and `latest` stop selecting it, and `latest` moves to the highest\n * live release; an exact pin still installs it, with a warning. Needs a key holding the version UPDATE\n * role in the domain's owning organization. Returns where `latest` points afterwards.\n */\n async yank(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; version: string; reason?: string },\n ): Promise<{ latest: string | null }> {\n return changeYankState(options, args, RegistryYankVerb.YANK);\n },\n\n /** Restore a yanked release (#1758); `latest` returns to it when it outranks the current target. */\n async unyank(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; version: string },\n ): Promise<{ latest: string | null }> {\n return changeYankState(options, args, RegistryYankVerb.UNYANK);\n },\n\n /**\n * Register a domain for the key's organization (#2024). Domains are first come, first served, and every module\n * published into one inherits its `defaultVisibility`. A slug already registered throws `RegistryDomainTakenError`\n * whoever holds it; `listMyDomains` tells whether that is the caller's own organization.\n */\n async createDomain(\n options: RegistryServerClientOptions,\n args: { domain: string; defaultVisibility: RegistryArtifactVisibility },\n ): Promise<RegistryDomainRecord> {\n const url = joinUrl(options.baseUrl, '/v1/registry/domains');\n const action = `create domain ${args.domain}`;\n const res = await fetchWithTimeout(url, {\n method: 'POST',\n headers: { ...authHeaders(options), 'content-type': 'application/json' },\n body: JSON.stringify({ domain: args.domain, defaultVisibility: args.defaultVisibility }),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n if (res.status === 409) {\n // Only the registry's own code means \"the slug is registered\"; a bare 409 is shared by other refusals.\n const body = await res.json().catch(() => undefined);\n if (hasRegistryRefusalCode(body, RegistryRefusalCode.DOMAIN_TAKEN)) throw new RegistryDomainTakenError(args.domain);\n throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action);\n }\n await refuseUnlessOk(res, options, action);\n const parsed = RegistryCreateDomainResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));\n if (!parsed.success) throw new RegistryMalformedPayloadError(options.baseUrl, action, formatZodIssuesAsSingleLine(parsed.error));\n return parsed.data.domain;\n },\n\n /** The domains the key's organization owns (#2024). Needs a key holding the domain LIST role. */\n async listMyDomains(options: RegistryServerClientOptions): Promise<RegistryDomainRecord[]> {\n const url = joinUrl(options.baseUrl, '/v1/registry/my-domains');\n const action = 'list domains';\n const res = await fetchWithTimeout(url, { method: 'GET', headers: authHeaders(options), timeoutMs: options.timeoutMs, diagnosticLabel: DIAGNOSTIC_LABEL });\n await refuseUnlessOk(res, options, action);\n const parsed = RegistryListDomainsResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));\n if (!parsed.success) throw new RegistryMalformedPayloadError(options.baseUrl, action, formatZodIssuesAsSingleLine(parsed.error));\n return parsed.data.domains;\n },\n} as const;\n\n/** A registry domain as the registry answers it: the slug and the visibility its modules inherit. */\nconst RegistryDomainRecordSchema = z.object({ domain: z.string().min(1), defaultVisibility: RegistryArtifactVisibilitySchema });\nexport type RegistryDomainRecord = z.infer<typeof RegistryDomainRecordSchema>;\nconst RegistryCreateDomainResponseSchema = z.object({ domain: RegistryDomainRecordSchema });\nconst RegistryListDomainsResponseSchema = z.object({ domains: z.array(RegistryDomainRecordSchema) });\n\nconst RegistryYankResponseSchema = z.object({ ok: z.literal(true), latest: z.string().nullable().optional() });\n\nasync function changeYankState(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; version: string; reason?: string },\n verb: RegistryYankVerb,\n): Promise<{ latest: string | null }> {\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}/${verb}`,\n );\n const action = `${verb} ${args.moduleId}@${args.version}`;\n const res = await fetchWithTimeout(url, {\n method: 'POST',\n headers: { ...authHeaders(options), 'content-type': 'application/json' },\n body: JSON.stringify({ version: args.version, ...(args.reason !== undefined ? { reason: args.reason } : {}) }),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n if (res.status === 409) {\n // Only the release-state refusal is the no-op; a 409 for anything else (the registry giving up after\n // lost optimistic checks) is a FAILED yank and must not be reported as done (#1758 re-review R3).\n const body = await res.json().catch(() => undefined);\n if (isRegistryReleaseStateConflictBody(body)) throw new RegistryYankStateConflictError(args.moduleId, args.version, verb);\n throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action);\n }\n // A 404 names the module or the version; the sanitized envelope does not say which.\n await refuseUnlessOk(res, options, action, () => new RegistryVersionNotFoundError(args.moduleId, args.version));\n const parsed = RegistryYankResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));\n if (!parsed.success) {\n throw new RegistryMalformedPayloadError(options.baseUrl, action, formatZodIssuesAsSingleLine(parsed.error));\n }\n return { latest: parsed.data.latest ?? null };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"registry-server-client.js","sourceRoot":"","sources":["../../../src/services/registry-server-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,sCAAsC,EACtC,0BAA0B,EAC1B,yBAAyB,EACzB,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,EAExB,mBAAmB,EACnB,sBAAsB,EAEtB,wBAAwB,EACxB,eAAe,EACf,kCAAkC,EAClC,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2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AAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,4BAA4B,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAChH,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,MAAM,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7H,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,6BAA6B,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,2BAA2B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9G,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;AAChD,CAAC","sourcesContent":["/**\n * `RegistryServerClient` — HTTP client for the central registry\n * server (`platform-module-registry`, KD-7).\n *\n * Phase 2 fills out the read + download surface (`resolve`,\n * `info`, `search`, `download`). The wire shapes mirror the\n * gateway endpoints documented in the analysis plan's \"Registry\n * HTTP API\" section. The actual server (Phase 3) ships these\n * routes; until it does, the client throws typed errors when it\n * can't reach the server.\n *\n * Auth (KD-11): if `authToken` is supplied, every request adds\n * `Authorization: Bearer <token>`. Public read paths work without\n * a token; restricted paths return 401/403, surfaced as\n * `RegistryAuthRequiredError` (no key sent), `RegistryCredentialRejectedError` (a key sent and refused)\n * or `RegistryAuthForbiddenError`; a 429 is `RegistryRateLimitedError`.\n */\n\nimport { z } from 'zod';\nimport { formatZodIssuesAsSingleLine } from './_zod-issue-formatting';\nimport {\n ModuleManifestSchema,\n ModuleVersionRecordSchema,\n RegistryArtifactIntegrityMismatchError,\n RegistryAuthForbiddenError,\n RegistryAuthRequiredError,\n RegistryCredentialRejectedError,\n RegistryArtifactVisibilitySchema,\n RegistryDomainTakenError,\n RegistryError,\n RegistryRefusalCode,\n hasRegistryRefusalCode,\n type RegistryArtifactVisibility,\n RegistryRateLimitedError,\n isRegistryError,\n isRegistryReleaseStateConflictBody,\n parseRegistryRefusalBody,\n readRegistryRefusal,\n readRegistryRefusalBody,\n RegistryMalformedPayloadError,\n RegistryModuleNotFoundError,\n RegistryUnexpectedStatusError,\n RegistryVersionNotFoundError,\n RegistryYankNoticeSchema,\n RegistryYankStateConflictError,\n RegistryYankVerb,\n REGISTRY_YANK_REASON_HEADER,\n REGISTRY_YANKED_AT_HEADER,\n Sha256DigestSchema,\n ModuleSearchHitSchema,\n moduleSearchFilterQueryPairs,\n moduleSearchHitMatchesFilter,\n type ModuleManifest,\n type ModuleSearchFilter,\n type ModuleSearchHit,\n type RegistryYankNotice,\n type ModuleVersionRecord,\n} from '@wildo-ai/platform-config-lib';\nimport { fetchJsonOk, fetchTransfer, fetchWithTimeout, joinUrl, readJsonBody } from './_http-client';\n\n/**\n * Zod schema for the `info()` response payload — mirrors\n * `RegistryInfoResult` and is enforced at the client boundary so a\n * server schema drift fails fast instead of returning malformed data\n * to downstream consumers.\n */\nconst RegistryInfoResponseSchema = z.object({\n moduleId: z.string().min(1),\n manifest: ModuleManifestSchema,\n versions: z.array(ModuleVersionRecordSchema),\n tags: z.record(z.string(), z.string()),\n});\n\nconst RegistrySearchResponseSchema = z.object({\n hits: z.array(ModuleSearchHitSchema),\n});\n\nconst DIAGNOSTIC_LABEL = 'Registry';\n\nexport interface RegistryServerClientOptions {\n /** Registry origin (e.g. `https://registry.wildo.ai`). */\n baseUrl: string;\n /** Optional bearer / API-key. CLI credentials are per-machine (KD-11). */\n authToken?: string;\n /** Request timeout in ms. */\n timeoutMs?: number;\n}\n\n/**\n * The deadline a refusal's body is read under: the request's own budget when the caller set one, else the reader's\n * default. Needed for a download above all, whose response timer is already cleared when its headers arrive (#3388).\n */\nfunction refusalBodyBounds(options: RegistryServerClientOptions): { timeoutMs?: number } {\n return options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {};\n}\n\nfunction authHeaders(options: RegistryServerClientOptions): Record<string, string> {\n return options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {};\n}\n\n/**\n * Throw the typed error for a non-2xx response, after releasing its body (#1763 review: an unread body\n * holds the connection until garbage collection). A 401 is told apart by whether a key was SENT — \"log\n * in\" and \"your key no longer works\" are different remedies (#1759 review).\n *\n * A status with no typed meaning READS its body instead of discarding it (#3388): the registry's reason, the\n * fields a schema refusal names and the correlation id travel there, and an error carrying only `HTTP 400` sent\n * the operator to the server's logs for what the answer already said. The typed branches still discard theirs:\n * each already names its remedy, and the engine strips the context of an authentication, authorization or\n * not-found refusal at the wire, so those bodies carry no reason to report.\n */\nasync function refuseUnlessOk(\n res: Response,\n options: RegistryServerClientOptions,\n action: string,\n notFound?: () => RegistryError,\n): Promise<void> {\n if (res.ok) return;\n let error: RegistryError;\n if (res.status === 404 && notFound) error = notFound();\n else if (res.status === 401) error = options.authToken ? new RegistryCredentialRejectedError(options.baseUrl) : new RegistryAuthRequiredError(options.baseUrl);\n else if (res.status === 403) error = new RegistryAuthForbiddenError(action);\n else if (res.status === 429) error = new RegistryRateLimitedError(options.baseUrl, action, parseRetryAfterSeconds(res.headers.get('retry-after')));\n else {\n throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action, await readRegistryRefusal(res, refusalBodyBounds(options)));\n }\n await res.body?.cancel().catch(() => undefined);\n throw error;\n}\n\n/** `Retry-After` in its delta-seconds form; the HTTP-date form is not produced by a Wildo backend. */\nfunction parseRetryAfterSeconds(value: string | null): number | undefined {\n if (!value || !/^\\d+$/.test(value.trim())) return undefined;\n return Number(value.trim());\n}\n\n/**\n * 6th-pass M3: typed JSON-parse helper. A misconfigured proxy that\n * returns HTML at 2xx (or a truncated stream) would otherwise throw a\n * bare `SyntaxError` from `await res.json()`, bypassing every\n * `isRegistryError(err)` handler. This helper translates the parse\n * failure into a `RegistryMalformedPayloadError` so the typed-error\n * contract is universal across the client surface.\n */\nasync function parseJsonOrThrow(\n res: Response,\n registryUrl: string,\n action: string,\n timeoutMs: number | undefined,\n): Promise<unknown> {\n try {\n return await readJsonBody(res, registryUrl, action, timeoutMs);\n } catch (err) {\n // A body cut short by the request budget is a timeout (#1763), not a malformed payload.\n if (isRegistryError(err)) throw err;\n throw new RegistryMalformedPayloadError(\n registryUrl,\n action,\n `response is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n}\n\nexport interface RegistryResolveResult {\n /** Resolved exact version (matches `Sha256DigestSchema` for digest). */\n version: string;\n artifactDigest: string;\n /**\n * Present when the resolved release is yanked. Only an EXACT-version request can resolve to one\n * (#1758) — ranges and tags never do — so the caller is pinned to it and should warn, not refuse.\n */\n yanked?: RegistryYankNotice;\n}\n\nexport interface RegistryInfoResult {\n moduleId: string;\n manifest: ModuleManifest;\n versions: readonly ModuleVersionRecord[];\n /** dist-tag → version map (e.g. `latest → 1.2.3`). */\n tags: Readonly<Record<string, string>>;\n}\n\n/** One search hit: the module, its latest version, and (#2014) its kind and provider facts. */\nexport type RegistrySearchHit = ModuleSearchHit;\n\nexport const RegistryServerClient = {\n /**\n * Liveness probe against `/health`. Returns boolean — used by\n * `wildo registry ping` smoke. The registry server now relies on\n * the framework's auto-mounted `HealthController` at the engine\n * root (`GET /health` always 200; `GET /health/ready` enforces\n * dependency readiness), so the path has NO `/v1` prefix.\n */\n async ping(options: RegistryServerClientOptions): Promise<boolean> {\n try {\n await fetchJsonOk(joinUrl(options.baseUrl, '/health'), {\n method: 'GET',\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n return true;\n } catch {\n return false;\n }\n },\n\n /**\n * Resolve a semver range / tag against a registry domain. The\n * server returns the concrete version + artifact digest so the\n * caller can verify the download against `artifactDigest`.\n */\n async resolve(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; range: string },\n ): Promise<RegistryResolveResult> {\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}/resolve?range=${encodeURIComponent(args.range)}`,\n );\n const res = await fetchWithTimeout(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, `resolve ${args.moduleId}`, () => new RegistryVersionNotFoundError(args.moduleId, args.range));\n // 6th-pass M3: typed JSON-parse (was bare `SyntaxError` for\n // malformed proxy responses).\n const json = (await parseJsonOrThrow(res, options.baseUrl, `resolve ${args.moduleId}`, options.timeoutMs)) as {\n version?: unknown;\n artifactDigest?: unknown;\n yanked?: unknown;\n };\n const digest = String(json.artifactDigest ?? '');\n // 6th-pass M4: typed digest validation (was bare `ZodError`).\n const digestParse = Sha256DigestSchema.safeParse(digest);\n if (!digestParse.success) {\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n `resolve ${args.moduleId}`,\n `artifactDigest is not a valid sha256:<64-hex> string: ${formatZodIssuesAsSingleLine(digestParse.error)}`,\n );\n }\n if (typeof json.version !== 'string' || json.version.length === 0) {\n // 3rd-pass M6: typed `RegistryMalformedPayloadError` instead of\n // bare `Error` so callers' `isRegistryError(err)` handlers fire\n // correctly.\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n `resolve ${args.moduleId}`,\n 'response missing required `version` string',\n );\n }\n let yanked: RegistryYankNotice | undefined;\n if (json.yanked !== undefined) {\n const yankParse = RegistryYankNoticeSchema.safeParse(json.yanked);\n if (!yankParse.success) {\n throw new RegistryMalformedPayloadError(options.baseUrl, `resolve ${args.moduleId}`, `yanked: ${formatZodIssuesAsSingleLine(yankParse.error)}`);\n }\n yanked = yankParse.data;\n }\n return { version: json.version, artifactDigest: digest, ...(yanked ? { yanked } : {}) };\n },\n\n /**\n * Fetch full info for a module: manifest, every published\n * version, dist-tags. Used by `wildo registry info` (Phase 4).\n */\n async info(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string },\n ): Promise<RegistryInfoResult> {\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}`,\n );\n const res = await fetchWithTimeout(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, `info ${args.moduleId}`, () => new RegistryModuleNotFoundError(args.moduleId));\n // 6th-pass M3: typed JSON-parse.\n const json = await parseJsonOrThrow(res, options.baseUrl, `info ${args.moduleId}`, options.timeoutMs);\n const parsed = RegistryInfoResponseSchema.safeParse(json);\n if (!parsed.success) {\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n `info ${args.moduleId}`,\n formatZodIssuesAsSingleLine(parsed.error),\n );\n }\n return parsed.data;\n },\n\n /**\n * Search the registry's metadata index: a module-id substring, and (#2014) the manifest filters —\n * kind, engine capability and provider maturity. The server refuses an unknown filter value.\n */\n async search(\n options: RegistryServerClientOptions,\n args: { domain: string; query: string; filter?: ModuleSearchFilter },\n ): Promise<readonly RegistrySearchHit[]> {\n const params = new URLSearchParams([['q', args.query], ...moduleSearchFilterQueryPairs(args.filter ?? {})]);\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules?${params.toString()}`,\n );\n const res = await fetchWithTimeout(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, 'search');\n // 6th-pass M3: typed JSON-parse.\n const json = await parseJsonOrThrow(res, options.baseUrl, 'search', options.timeoutMs);\n const parsed = RegistrySearchResponseSchema.safeParse(json);\n if (!parsed.success) {\n throw new RegistryMalformedPayloadError(\n options.baseUrl,\n 'search',\n formatZodIssuesAsSingleLine(parsed.error),\n );\n }\n // Re-applied here: a server that predates the filters ignores them and answers every module (#2014 review F9).\n return parsed.data.hits.filter((hit) => moduleSearchHitMatchesFilter(hit, args.filter ?? {}));\n },\n\n /**\n * Stream-download a published artifact's bytes and verify the\n * sha256 integrity matches `expectedDigest`. Throws\n * `RegistryArtifactIntegrityMismatchError` on mismatch — the\n * digest check is non-negotiable per KD-9 / Security model.\n */\n async download(\n options: RegistryServerClientOptions,\n args: {\n domain: string;\n moduleId: string;\n version: string;\n expectedDigest: string;\n },\n ): Promise<{ bytes: Uint8Array; integrity: string; yanked?: RegistryYankNotice }> {\n // 7th-pass C-M1: caller-supplied digest is a developer-contract\n // violation if malformed, not a registry-runtime condition.\n // Throw `TypeError` (matching `C-L3` precedent for\n // `getModuleStagingPaths` argument-shape violations) so the\n // typed `RegistryError` vocabulary stays reserved for\n // registry-runtime errors. Prior `Sha256DigestSchema.parse(...)`\n // leaked a bare `ZodError` that bypassed\n // `isRegistryError(err)` handlers but ALSO confused\n // typed-handler maintainers about the contract.\n const digestParse = Sha256DigestSchema.safeParse(args.expectedDigest);\n if (!digestParse.success) {\n throw new TypeError(\n `download() expectedDigest must be a valid sha256:<64-hex> string (got: ${JSON.stringify(args.expectedDigest)}). ${formatZodIssuesAsSingleLine(digestParse.error)}`,\n );\n }\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}/${encodeURIComponent(args.version)}/artifact`,\n );\n // A transfer, not a metadata call: the response is bounded by `timeoutMs`, the body by an IDLE budget\n // reset on every chunk, so a large artifact over a slow link installs and a stalled one fails (#1763).\n const { response: res, readAll } = await fetchTransfer(url, {\n method: 'GET',\n headers: authHeaders(options),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n await refuseUnlessOk(res, options, `download ${args.moduleId}@${args.version}`, () => new RegistryVersionNotFoundError(args.moduleId, args.version));\n const buf = await readAll();\n const { createHash } = await import('node:crypto');\n const observed = `sha256:${createHash('sha256').update(buf).digest('hex')}`;\n if (observed !== args.expectedDigest) {\n throw new RegistryArtifactIntegrityMismatchError(\n args.moduleId,\n args.version,\n args.expectedDigest,\n observed,\n );\n }\n // A yanked release is served by exact version (#1758) and says so in headers.\n const yankedAt = res.headers.get(REGISTRY_YANKED_AT_HEADER);\n const encodedReason = res.headers.get(REGISTRY_YANK_REASON_HEADER);\n let reason: string | undefined;\n if (encodedReason) {\n try { reason = decodeURIComponent(encodedReason); } catch { reason = encodedReason; }\n }\n return { bytes: buf, integrity: observed, ...(yankedAt ? { yanked: { yankedAt, ...(reason ? { reason } : {}) } } : {}) };\n },\n /**\n * Yank a release (#1758): ranges and `latest` stop selecting it, and `latest` moves to the highest\n * live release; an exact pin still installs it, with a warning. Needs a key holding the version UPDATE\n * role in the domain's owning organization. Returns where `latest` points afterwards.\n */\n async yank(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; version: string; reason?: string },\n ): Promise<{ latest: string | null }> {\n return changeYankState(options, args, RegistryYankVerb.YANK);\n },\n\n /** Restore a yanked release (#1758); `latest` returns to it when it outranks the current target. */\n async unyank(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; version: string },\n ): Promise<{ latest: string | null }> {\n return changeYankState(options, args, RegistryYankVerb.UNYANK);\n },\n\n /**\n * Register a domain for the key's organization (#2024). Domains are first come, first served, and every module\n * published into one inherits its `defaultVisibility`. A slug already registered throws `RegistryDomainTakenError`\n * whoever holds it; `listMyDomains` tells whether that is the caller's own organization.\n */\n async createDomain(\n options: RegistryServerClientOptions,\n args: { domain: string; defaultVisibility: RegistryArtifactVisibility },\n ): Promise<RegistryDomainRecord> {\n const url = joinUrl(options.baseUrl, '/v1/registry/domains');\n const action = `create domain ${args.domain}`;\n const res = await fetchWithTimeout(url, {\n method: 'POST',\n headers: { ...authHeaders(options), 'content-type': 'application/json' },\n body: JSON.stringify({ domain: args.domain, defaultVisibility: args.defaultVisibility }),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n if (res.status === 409) {\n // Only the registry's own code means \"the slug is registered\"; a bare 409 is shared by other refusals.\n const body = await readRegistryRefusalBody(res, refusalBodyBounds(options));\n if (hasRegistryRefusalCode(body, RegistryRefusalCode.DOMAIN_TAKEN)) throw new RegistryDomainTakenError(args.domain);\n throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action, parseRegistryRefusalBody(body));\n }\n await refuseUnlessOk(res, options, action);\n const parsed = RegistryCreateDomainResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));\n if (!parsed.success) throw new RegistryMalformedPayloadError(options.baseUrl, action, formatZodIssuesAsSingleLine(parsed.error));\n return parsed.data.domain;\n },\n\n /** The domains the key's organization owns (#2024). Needs a key holding the domain LIST role. */\n async listMyDomains(options: RegistryServerClientOptions): Promise<RegistryDomainRecord[]> {\n const url = joinUrl(options.baseUrl, '/v1/registry/my-domains');\n const action = 'list domains';\n const res = await fetchWithTimeout(url, { method: 'GET', headers: authHeaders(options), timeoutMs: options.timeoutMs, diagnosticLabel: DIAGNOSTIC_LABEL });\n await refuseUnlessOk(res, options, action);\n const parsed = RegistryListDomainsResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));\n if (!parsed.success) throw new RegistryMalformedPayloadError(options.baseUrl, action, formatZodIssuesAsSingleLine(parsed.error));\n return parsed.data.domains;\n },\n} as const;\n\n/** A registry domain as the registry answers it: the slug and the visibility its modules inherit. */\nconst RegistryDomainRecordSchema = z.object({ domain: z.string().min(1), defaultVisibility: RegistryArtifactVisibilitySchema });\nexport type RegistryDomainRecord = z.infer<typeof RegistryDomainRecordSchema>;\nconst RegistryCreateDomainResponseSchema = z.object({ domain: RegistryDomainRecordSchema });\nconst RegistryListDomainsResponseSchema = z.object({ domains: z.array(RegistryDomainRecordSchema) });\n\nconst RegistryYankResponseSchema = z.object({ ok: z.literal(true), latest: z.string().nullable().optional() });\n\nasync function changeYankState(\n options: RegistryServerClientOptions,\n args: { domain: string; moduleId: string; version: string; reason?: string },\n verb: RegistryYankVerb,\n): Promise<{ latest: string | null }> {\n const url = joinUrl(\n options.baseUrl,\n `/v1/registry/${encodeURIComponent(args.domain)}/modules/${encodeURIComponent(args.moduleId)}/${verb}`,\n );\n const action = `${verb} ${args.moduleId}@${args.version}`;\n const res = await fetchWithTimeout(url, {\n method: 'POST',\n headers: { ...authHeaders(options), 'content-type': 'application/json' },\n body: JSON.stringify({ version: args.version, ...(args.reason !== undefined ? { reason: args.reason } : {}) }),\n timeoutMs: options.timeoutMs,\n diagnosticLabel: DIAGNOSTIC_LABEL,\n });\n if (res.status === 409) {\n // Only the release-state refusal is the no-op; a 409 for anything else (the registry giving up after\n // lost optimistic checks) is a FAILED yank and must not be reported as done (#1758 re-review R3).\n const body = await readRegistryRefusalBody(res, refusalBodyBounds(options));\n if (isRegistryReleaseStateConflictBody(body)) throw new RegistryYankStateConflictError(args.moduleId, args.version, verb);\n throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action, parseRegistryRefusalBody(body));\n }\n // A 404 names the module or the version; the sanitized envelope does not say which.\n await refuseUnlessOk(res, options, action, () => new RegistryVersionNotFoundError(args.moduleId, args.version));\n const parsed = RegistryYankResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));\n if (!parsed.success) {\n throw new RegistryMalformedPayloadError(options.baseUrl, action, formatZodIssuesAsSingleLine(parsed.error));\n }\n return { latest: parsed.data.latest ?? null };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/**\n * Shared structural types consumed across `wildo-module-client`\n * services.\n *\n * The package intentionally avoids importing the CLI's full\n * `CommandContext` (defined in `wildo-cli/src/kernel/types.ts`)\n * to keep the dependency arrow CLI → wildo-module-client (KD-3\n * forbids a reverse edge). Phase 2 services accept a structural\n * subset of whatever the host (CLI / companion) needs to pass\n * down — typically just `saasRoot` + a logger sink.\n *\n * The single shared type today is `RegistryClientLogger`. Adding\n * more shared structural types here is fine; importing\n * `wildo-cli` types is not.\n */\n\nexport interface RegistryClientLogger {\n info: (msg: string) => void;\n success?: (msg: string) => void;\n warn: (msg: string) => void;\n error: (msg: string) => void;\n}\n"]}
|