Skip to content

Commit e55a57b

Browse files
committed
Add RegistryBase schema and type
1 parent 51d51e8 commit e55a57b

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

lib/entry-points.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy/types.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,19 @@ export function credentialToStr(credential: Credential): string {
254254
return result;
255255
}
256256

257-
/** A package registry is identified by its type and address. */
258-
export type Registry = {
257+
/** The schema for `RegistryBase` objects. */
258+
export const registryBaseSchema = {
259259
/** The type of the package registry. */
260-
type: string;
260+
type: json.string,
261261
/** Whether the registry replaces the base registry for the ecosystem. */
262-
"replaces-base"?: boolean;
263-
} & Address;
262+
"replaces-base": json.optional(json.boolean),
263+
} as const satisfies json.Schema;
264+
265+
/** Information about a registry, other than its address. */
266+
export type RegistryBase = json.FromSchema<typeof registryBaseSchema>;
267+
268+
/** A package registry is identified by its type and address. */
269+
export type Registry = RegistryBase & Address;
264270

265271
// If a registry has an `url`, then that takes precedence over the `host` which may or may
266272
// not be defined.

0 commit comments

Comments
 (0)