@forge-glance/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Logger interface for @forge-glance/sdk.
3
+ *
4
+ * All providers and clients accept an optional `logger` in their constructor
5
+ * that must satisfy this interface. Defaults to `noopLogger` when omitted,
6
+ * so the SDK is silent out of the box.
7
+ *
8
+ * Consumers can pass any compatible logger — pino, winston, console, etc.
9
+ *
10
+ * @example
11
+ * import pino from 'pino';
12
+ * const provider = new GitLabProvider(url, token, { logger: pino() });
13
+ */
14
+ export interface ForgeLogger {
15
+ debug(msg: string, meta?: Record<string, unknown>): void;
16
+ info(msg: string, meta?: Record<string, unknown>): void;
17
+ warn(msg: string, meta?: Record<string, unknown>): void;
18
+ error(msg: string, meta?: Record<string, unknown>): void;
19
+ }
20
+ export declare const noopLogger: ForgeLogger;
package/dist/logger.js ADDED
@@ -0,0 +1,10 @@
1
+ // src/logger.ts
2
+ var noopLogger = {
3
+ debug() {},
4
+ info() {},
5
+ warn() {},
6
+ error() {}
7
+ };
8
+ export {
9
+ noopLogger
10
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Provider factory (Phase C1).
3
+ *
4
+ * Creates the correct GitProvider implementation based on the provider slug
5
+ * from `connected_accounts.provider`.
6
+ */
7
+ import type { GitProvider } from "./GitProvider.ts";
8
+ import type { ForgeLogger } from "./logger.ts";
9
+ /**
10
+ * Create a GitProvider for the given provider slug.
11
+ *
12
+ * @param provider - The provider slug from the DB, e.g. "gitlab" or "github".
13
+ * @param baseURL - The base URL for the provider instance.
14
+ * @param token - The decrypted PAT for the provider.
15
+ * @returns A GitProvider implementation.
16
+ * @throws If the provider slug is unknown.
17
+ */
18
+ export declare function createProvider(provider: string, baseURL: string, token: string, options?: {
19
+ logger?: ForgeLogger;
20
+ }): GitProvider;
21
+ /** List of all supported provider slugs. */
22
+ export declare const SUPPORTED_PROVIDERS: readonly ["gitlab", "github"];
23
+ export type ProviderSlug = (typeof SUPPORTED_PROVIDERS)[number];