From a3f835be0a4ff2a4fe7251db27fc5c4069986bcb Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 11 Mar 2025 20:56:39 -0700 Subject: [PATCH] registry API client --- packages/config-yaml/package.json | 2 +- packages/config-yaml/src/index.ts | 1 + packages/config-yaml/src/registryClient.ts | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/config-yaml/src/registryClient.ts diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 9433fbc30..8021713a2 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.52", + "version": "1.0.57", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/index.ts b/packages/config-yaml/src/index.ts index b64db7497..0ba530776 100644 --- a/packages/config-yaml/src/index.ts +++ b/packages/config-yaml/src/index.ts @@ -7,6 +7,7 @@ export * from "./load/getBlockType.js"; export * from "./load/merge.js"; export * from "./load/proxySecretResolution.js"; export * from "./load/unroll.js"; +export * from "./registryClient.js"; export * from "./schemas/data/index.js"; export * from "./schemas/index.js"; export * from "./schemas/models.js"; diff --git a/packages/config-yaml/src/registryClient.ts b/packages/config-yaml/src/registryClient.ts new file mode 100644 index 000000000..66e7f9549 --- /dev/null +++ b/packages/config-yaml/src/registryClient.ts @@ -0,0 +1,12 @@ +import { Registry } from "./interfaces/index.js"; +import { FullSlug } from "./interfaces/slugs.js"; + +export class RegistryClient implements Registry { + async getContent(fullSlug: FullSlug): Promise { + const response = await fetch( + `https://api.continue.dev/registry/v1/${fullSlug.ownerSlug}/${fullSlug.packageSlug}/${fullSlug.versionSlug}`, + ); + const data = await response.json(); + return data.content; + } +}