meridianjs 0.2.3 → 0.2.5

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 (94) hide show
  1. package/CHANGELOG.md +97 -150
  2. package/README.md +214 -122
  3. package/dist/analytics/collector.d.ts +44 -0
  4. package/dist/analytics/collector.d.ts.map +1 -0
  5. package/dist/analytics/collector.js +82 -0
  6. package/dist/analytics/collector.js.map +1 -0
  7. package/dist/analytics/index.d.ts +3 -0
  8. package/dist/analytics/index.d.ts.map +1 -0
  9. package/dist/analytics/index.js +2 -0
  10. package/dist/analytics/index.js.map +1 -0
  11. package/dist/capabilities/index.d.ts +3 -0
  12. package/dist/capabilities/index.d.ts.map +1 -0
  13. package/dist/capabilities/index.js +2 -0
  14. package/dist/capabilities/index.js.map +1 -0
  15. package/dist/capabilities/registry.d.ts +6 -0
  16. package/dist/capabilities/registry.d.ts.map +1 -0
  17. package/dist/capabilities/registry.js +61 -0
  18. package/dist/capabilities/registry.js.map +1 -0
  19. package/dist/core/pipeline.d.ts +3 -1
  20. package/dist/core/pipeline.d.ts.map +1 -1
  21. package/dist/core/pipeline.js +42 -0
  22. package/dist/core/pipeline.js.map +1 -1
  23. package/dist/core/types.d.ts +42 -1
  24. package/dist/core/types.d.ts.map +1 -1
  25. package/dist/core/types.js +1 -1
  26. package/dist/core/types.js.map +1 -1
  27. package/dist/debug/index.d.ts +3 -0
  28. package/dist/debug/index.d.ts.map +1 -0
  29. package/dist/debug/index.js +2 -0
  30. package/dist/debug/index.js.map +1 -0
  31. package/dist/debug/recorder.d.ts +32 -0
  32. package/dist/debug/recorder.d.ts.map +1 -0
  33. package/dist/debug/recorder.js +76 -0
  34. package/dist/debug/recorder.js.map +1 -0
  35. package/dist/generator/cli.d.ts +20 -0
  36. package/dist/generator/cli.d.ts.map +1 -0
  37. package/dist/generator/cli.js +56 -0
  38. package/dist/generator/cli.js.map +1 -0
  39. package/dist/generator/index.d.ts +9 -0
  40. package/dist/generator/index.d.ts.map +1 -0
  41. package/dist/generator/index.js +49 -0
  42. package/dist/generator/index.js.map +1 -0
  43. package/dist/generator/openapi.d.ts +13 -0
  44. package/dist/generator/openapi.d.ts.map +1 -0
  45. package/dist/generator/openapi.js +49 -0
  46. package/dist/generator/openapi.js.map +1 -0
  47. package/dist/generator/templates.d.ts +16 -0
  48. package/dist/generator/templates.d.ts.map +1 -0
  49. package/dist/generator/templates.js +292 -0
  50. package/dist/generator/templates.js.map +1 -0
  51. package/dist/index.d.ts +33 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +101 -0
  54. package/dist/index.js.map +1 -1
  55. package/dist/policies/builtin.d.ts +40 -0
  56. package/dist/policies/builtin.d.ts.map +1 -0
  57. package/dist/policies/builtin.js +186 -0
  58. package/dist/policies/builtin.js.map +1 -0
  59. package/dist/policies/index.d.ts +2 -0
  60. package/dist/policies/index.d.ts.map +1 -0
  61. package/dist/policies/index.js +2 -0
  62. package/dist/policies/index.js.map +1 -0
  63. package/dist/public.d.ts +17 -0
  64. package/dist/public.d.ts.map +1 -1
  65. package/dist/public.js +15 -0
  66. package/dist/public.js.map +1 -1
  67. package/dist/schema/index.d.ts +2 -0
  68. package/dist/schema/index.d.ts.map +1 -0
  69. package/dist/schema/index.js +2 -0
  70. package/dist/schema/index.js.map +1 -0
  71. package/dist/schema/monitor.d.ts +23 -0
  72. package/dist/schema/monitor.d.ts.map +1 -0
  73. package/dist/schema/monitor.js +70 -0
  74. package/dist/schema/monitor.js.map +1 -0
  75. package/dist/services/index.d.ts +2 -0
  76. package/dist/services/index.d.ts.map +1 -0
  77. package/dist/services/index.js +2 -0
  78. package/dist/services/index.js.map +1 -0
  79. package/dist/services/service-client.d.ts +41 -0
  80. package/dist/services/service-client.d.ts.map +1 -0
  81. package/dist/services/service-client.js +243 -0
  82. package/dist/services/service-client.js.map +1 -0
  83. package/dist/transactions/index.d.ts +3 -0
  84. package/dist/transactions/index.d.ts.map +1 -0
  85. package/dist/transactions/index.js +2 -0
  86. package/dist/transactions/index.js.map +1 -0
  87. package/dist/transactions/saga.d.ts +22 -0
  88. package/dist/transactions/saga.d.ts.map +1 -0
  89. package/dist/transactions/saga.js +58 -0
  90. package/dist/transactions/saga.js.map +1 -0
  91. package/dist/validation/drift-detector.d.ts.map +1 -1
  92. package/dist/validation/drift-detector.js +17 -8
  93. package/dist/validation/drift-detector.js.map +1 -1
  94. package/package.json +7 -3
@@ -0,0 +1,49 @@
1
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { parseOpenAPI } from "./openapi.js";
4
+ import { generateAdapter, generateIndex, generatePagination, generateTest } from "./templates.js";
5
+ export async function generate(opts) {
6
+ const { provider } = opts;
7
+ const outputDir = opts.output ?? join("src", "providers", provider);
8
+ let ctx = {
9
+ provider,
10
+ baseUrl: opts.baseUrl ?? `https://api.${provider}.com`,
11
+ authType: opts.auth ?? "apiKey",
12
+ authKeyName: "apiKey",
13
+ endpoints: [],
14
+ };
15
+ if (opts.openapi) {
16
+ const raw = await readFile(opts.openapi, "utf-8");
17
+ const spec = parseOpenAPI(JSON.parse(raw));
18
+ ctx = {
19
+ provider,
20
+ baseUrl: opts.baseUrl ?? spec.baseUrl,
21
+ authType: opts.auth ?? spec.authType,
22
+ authKeyName: spec.authKeyName,
23
+ endpoints: spec.endpoints,
24
+ };
25
+ }
26
+ await mkdir(outputDir, { recursive: true });
27
+ await Promise.all([
28
+ writeFile(join(outputDir, "adapter.ts"), generateAdapter(ctx), "utf-8"),
29
+ writeFile(join(outputDir, "adapter.test.ts"), generateTest(ctx), "utf-8"),
30
+ writeFile(join(outputDir, "pagination.ts"), generatePagination(ctx), "utf-8"),
31
+ writeFile(join(outputDir, "index.ts"), generateIndex(ctx), "utf-8"),
32
+ ]);
33
+ const lines = [
34
+ `✓ Generated adapter for "${provider}" → ${outputDir}/`,
35
+ " adapter.ts core adapter (auth, error mapping, rate-limit headers)",
36
+ " adapter.test.ts 8 tests that pass immediately",
37
+ " pagination.ts pagination strategy stub",
38
+ " index.ts barrel export",
39
+ "",
40
+ "Next steps:",
41
+ ` 1. Add "${provider}" to BUILTIN_ADAPTER_CLASSES in src/index.ts`,
42
+ " 2. Fill in the TODO comments in adapter.ts and pagination.ts",
43
+ ` 3. npm test -- --reporter=verbose src/providers/${provider}/adapter.test.ts`,
44
+ ];
45
+ for (const line of lines) {
46
+ process.stdout.write(`${line}\n`);
47
+ }
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAWlG,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAsB;IACnD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAEpE,IAAI,GAAG,GAAqB;QAC1B,QAAQ;QACR,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,eAAe,QAAQ,MAAM;QACtD,QAAQ,EAAE,IAAI,CAAC,IAAI,IAAI,QAAQ;QAC/B,WAAW,EAAE,QAAQ;QACrB,SAAS,EAAE,EAAE;KACd,CAAC;IAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,YAAY,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 -0,0 +1,13 @@
1
+ export interface ParsedSpec {
2
+ title: string;
3
+ baseUrl: string;
4
+ authType: "apiKey" | "bearer" | "basic" | "oauth2";
5
+ authKeyName: string;
6
+ endpoints: Array<{
7
+ method: string;
8
+ path: string;
9
+ operationId?: string;
10
+ }>;
11
+ }
12
+ export declare function parseOpenAPI(doc: unknown): ParsedSpec;
13
+ //# sourceMappingURL=openapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/generator/openapi.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAkDrD"}
@@ -0,0 +1,49 @@
1
+ export function parseOpenAPI(doc) {
2
+ const spec = doc;
3
+ const title = spec.info?.title ?? "Unknown";
4
+ let baseUrl = "https://api.example.com";
5
+ if (spec.servers?.[0]?.url) {
6
+ baseUrl = spec.servers[0].url;
7
+ }
8
+ else if (spec.host) {
9
+ baseUrl = `https://${spec.host}${spec.basePath ?? ""}`;
10
+ }
11
+ let authType = "apiKey";
12
+ let authKeyName = "apiKey";
13
+ const schemes = spec.components?.securitySchemes ?? spec.securityDefinitions ?? {};
14
+ for (const scheme of Object.values(schemes)) {
15
+ if (scheme.type === "http" && scheme.scheme === "basic") {
16
+ authType = "basic";
17
+ break;
18
+ }
19
+ if (scheme.type === "http" && scheme.scheme === "bearer") {
20
+ authType = "bearer";
21
+ break;
22
+ }
23
+ if (scheme.type === "oauth2") {
24
+ authType = "oauth2";
25
+ break;
26
+ }
27
+ if (scheme.type === "apiKey") {
28
+ authType = "apiKey";
29
+ authKeyName = scheme.name ?? "x-api-key";
30
+ }
31
+ }
32
+ const endpoints = [];
33
+ const httpMethods = new Set(["get", "post", "put", "patch", "delete"]);
34
+ for (const [path, methods] of Object.entries(spec.paths ?? {})) {
35
+ for (const [method, op] of Object.entries(methods)) {
36
+ if (httpMethods.has(method)) {
37
+ const ep = {
38
+ method: method.toUpperCase(),
39
+ path,
40
+ };
41
+ if (op.operationId !== undefined)
42
+ ep.operationId = op.operationId;
43
+ endpoints.push(ep);
44
+ }
45
+ }
46
+ }
47
+ return { title, baseUrl, authType, authKeyName, endpoints };
48
+ }
49
+ //# sourceMappingURL=openapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../src/generator/openapi.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,MAAM,IAAI,GAAG,GAAiB,CAAC;IAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC;IAE5C,IAAI,OAAO,GAAG,yBAAyB,CAAC;IACxC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAC3B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAChC,CAAC;SAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,GAAG,WAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;IACzD,CAAC;IAED,IAAI,QAAQ,GAA2B,QAAQ,CAAC;IAChD,IAAI,WAAW,GAAG,QAAQ,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,eAAe,IAAI,IAAI,CA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I,EAAE,CAAC,WAAW,KAAK,SAAS;oBAAE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC;gBAClE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface GeneratorContext {
2
+ provider: string;
3
+ baseUrl: string;
4
+ authType: "apiKey" | "bearer" | "basic" | "oauth2";
5
+ authKeyName: string;
6
+ endpoints: Array<{
7
+ method: string;
8
+ path: string;
9
+ operationId?: string;
10
+ }>;
11
+ }
12
+ export declare function generateAdapter(ctx: GeneratorContext): string;
13
+ export declare function generatePagination(ctx: GeneratorContext): string;
14
+ export declare function generateIndex(ctx: GeneratorContext): string;
15
+ export declare function generateTest(ctx: GeneratorContext): string;
16
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/generator/templates.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E;AAwCD,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAuH7D;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAiChE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAI3D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAoG1D"}
@@ -0,0 +1,292 @@
1
+ function pascal(name) {
2
+ return name
3
+ .split(/[-_\s]+/)
4
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
5
+ .join("");
6
+ }
7
+ function authHeaderLine(ctx) {
8
+ if (ctx.authType === "basic") {
9
+ return `"Authorization": \`Basic \${Buffer.from(\`\${authToken.token}:\${authToken.secret ?? ""}\`).toString("base64")}\``;
10
+ }
11
+ return '"Authorization": `Bearer ${authToken.token}`';
12
+ }
13
+ function authStrategyBody(ctx) {
14
+ const className = `${pascal(ctx.provider)}`;
15
+ if (ctx.authType === "basic") {
16
+ return ` const user = config.username ?? config.apiKey ?? "";
17
+ const pass = config.password ?? "";
18
+ if (!user) throw new Error("${className}: username or apiKey is required");
19
+ return { token: user, secret: pass };`;
20
+ }
21
+ return ` const key = config.apiKey ?? config.token ?? "";
22
+ if (!key) throw new Error("${className}: apiKey or token is required");
23
+ return { token: key };`;
24
+ }
25
+ function endpointComments(ctx) {
26
+ if (ctx.endpoints.length === 0)
27
+ return "";
28
+ const lines = ctx.endpoints
29
+ .slice(0, 20)
30
+ .map((e) => ` // ${e.method.padEnd(7)} ${e.path}${e.operationId ? ` (${e.operationId})` : ""}`)
31
+ .join("\n");
32
+ return `\n // Known endpoints from OpenAPI spec:\n${lines}\n`;
33
+ }
34
+ export function generateAdapter(ctx) {
35
+ const name = pascal(ctx.provider);
36
+ return `import { ResponseNormalizer } from "../../core/normalizer.js";
37
+ import type {
38
+ AdapterInput,
39
+ AuthConfig,
40
+ AuthToken,
41
+ BuiltRequest,
42
+ IdempotencyConfig,
43
+ NormalizedResponse,
44
+ PaginationStrategy,
45
+ ProviderAdapter,
46
+ RateLimitInfo,
47
+ RawResponse,
48
+ } from "../../core/types.js";
49
+ import { MeridianError, SDK_VERSION } from "../../core/types.js";
50
+ import { ${name}PaginationStrategy } from "./pagination.js";
51
+ ${endpointComments(ctx)}
52
+ export class ${name}Adapter implements ProviderAdapter {
53
+ private baseUrl: string;
54
+
55
+ constructor(baseUrl = "${ctx.baseUrl}") {
56
+ this.baseUrl = baseUrl;
57
+ }
58
+
59
+ buildRequest(input: AdapterInput): BuiltRequest {
60
+ const { endpoint, options, authToken, baseUrl } = input;
61
+ const effectiveBaseUrl = baseUrl ?? this.baseUrl;
62
+
63
+ const url = new URL(endpoint, effectiveBaseUrl);
64
+
65
+ if (options.query) {
66
+ for (const [key, value] of Object.entries(options.query)) {
67
+ url.searchParams.set(key, String(value));
68
+ }
69
+ }
70
+
71
+ const headers: Record<string, string> = {
72
+ ${authHeaderLine(ctx)},
73
+ "User-Agent": \`Meridian-SDK/\${SDK_VERSION}\`,
74
+ "Content-Type": "application/json",
75
+ ...options.headers,
76
+ };
77
+
78
+ let body: string | undefined;
79
+ const method = options.method ?? "GET";
80
+ if (options.body && method !== "GET" && method !== "HEAD") {
81
+ body = JSON.stringify(options.body);
82
+ }
83
+
84
+ const built: BuiltRequest = { url: url.toString(), method, headers };
85
+ if (body !== undefined) built.body = body;
86
+ return built;
87
+ }
88
+
89
+ parseResponse(raw: RawResponse): NormalizedResponse {
90
+ const rateLimitInfo = this.rateLimitPolicy(raw.headers);
91
+ const paginationInfo = ResponseNormalizer.extractPaginationInfo(raw, this.paginationStrategy());
92
+ return ResponseNormalizer.normalize(raw, "${ctx.provider}", rateLimitInfo, paginationInfo);
93
+ }
94
+
95
+ parseError(raw: unknown): MeridianError {
96
+ if (typeof raw === "object" && raw !== null && "status" in raw) {
97
+ const status = (raw as { status: number }).status;
98
+ const body = (raw as { body?: unknown }).body;
99
+
100
+ // TODO: extract provider-specific error message from body
101
+ const message =
102
+ typeof body === "object" && body !== null && "message" in body
103
+ ? String((body as { message: unknown }).message)
104
+ : \`HTTP \${status}\`;
105
+
106
+ if (status === 401 || status === 403) {
107
+ return new MeridianError(message, "auth", "${ctx.provider}", false, "", {}, undefined, status);
108
+ }
109
+ if (status === 429) {
110
+ return new MeridianError(message, "rate_limit", "${ctx.provider}", true, "", {}, undefined, status);
111
+ }
112
+ if (status >= 400 && status < 500) {
113
+ return new MeridianError(message, "validation", "${ctx.provider}", false, "", {}, undefined, status);
114
+ }
115
+ if (status >= 500) {
116
+ return new MeridianError(message, "provider", "${ctx.provider}", true, "", {}, undefined, status);
117
+ }
118
+ }
119
+ if (raw instanceof Error) {
120
+ return new MeridianError(raw.message, "network", "${ctx.provider}", true);
121
+ }
122
+ return new MeridianError("Unknown error", "provider", "${ctx.provider}", false);
123
+ }
124
+
125
+ async authStrategy(config: AuthConfig): Promise<AuthToken> {
126
+ ${authStrategyBody(ctx)}
127
+ }
128
+
129
+ rateLimitPolicy(headers: Headers): RateLimitInfo {
130
+ // TODO: verify ${ctx.provider} rate-limit header names
131
+ const reset = Number(headers.get("x-ratelimit-reset") ?? headers.get("x-rate-limit-reset") ?? 0);
132
+ return {
133
+ limit: Number(headers.get("x-ratelimit-limit") ?? headers.get("x-rate-limit-limit") ?? 100),
134
+ remaining: Number(
135
+ headers.get("x-ratelimit-remaining") ?? headers.get("x-rate-limit-remaining") ?? 100,
136
+ ),
137
+ reset: new Date(reset > 1_000_000_000 ? reset * 1000 : Date.now() + 60_000),
138
+ };
139
+ }
140
+
141
+ paginationStrategy(): PaginationStrategy {
142
+ return new ${name}PaginationStrategy();
143
+ }
144
+
145
+ getIdempotencyConfig(): IdempotencyConfig {
146
+ return {
147
+ defaultSafeOperations: new Set(["GET", "HEAD"]),
148
+ operationOverrides: new Map(),
149
+ };
150
+ }
151
+ }
152
+ `;
153
+ }
154
+ export function generatePagination(ctx) {
155
+ const name = pascal(ctx.provider);
156
+ return `import type { PaginationStrategy, RawResponse, RequestOptions } from "../../core/types.js";
157
+
158
+ export class ${name}PaginationStrategy implements PaginationStrategy {
159
+ extractCursor(response: RawResponse): string | null {
160
+ // TODO: update with actual ${ctx.provider} pagination field names
161
+ const body = response.body as Record<string, unknown>;
162
+ return (body.next_cursor as string) ?? (body.cursor as string) ?? (body.next as string) ?? null;
163
+ }
164
+
165
+ extractTotal(response: RawResponse): number | null {
166
+ const body = response.body as Record<string, unknown>;
167
+ return typeof body.total === "number" ? body.total : null;
168
+ }
169
+
170
+ hasNext(response: RawResponse): boolean {
171
+ return this.extractCursor(response) !== null;
172
+ }
173
+
174
+ buildNextRequest(
175
+ endpoint: string,
176
+ options: RequestOptions,
177
+ cursor: string,
178
+ ): { endpoint: string; options: RequestOptions } {
179
+ // TODO: update with the actual ${ctx.provider} cursor param name
180
+ return {
181
+ endpoint,
182
+ options: { ...options, query: { ...options.query, cursor } },
183
+ };
184
+ }
185
+ }
186
+ `;
187
+ }
188
+ export function generateIndex(ctx) {
189
+ const name = pascal(ctx.provider);
190
+ return `export { ${name}Adapter } from "./adapter.js";
191
+ `;
192
+ }
193
+ export function generateTest(ctx) {
194
+ const name = pascal(ctx.provider);
195
+ const authArg = ctx.authType === "basic"
196
+ ? "{ username: 'testuser', password: 'testpass' }"
197
+ : "{ apiKey: 'test-key' }";
198
+ return `import { describe, expect, it } from "vitest";
199
+ import { ${name}Adapter } from "./adapter.js";
200
+
201
+ const adapter = new ${name}Adapter();
202
+
203
+ describe("${name}Adapter", () => {
204
+ describe("buildRequest", () => {
205
+ it("builds a GET request with auth header", () => {
206
+ const req = adapter.buildRequest({
207
+ endpoint: "/test",
208
+ options: { method: "GET" },
209
+ authToken: { token: "test-key" },
210
+ });
211
+ expect(req.url).toContain("/test");
212
+ expect(req.method).toBe("GET");
213
+ expect(req.headers["Authorization"]).toBeDefined();
214
+ });
215
+
216
+ it("appends query parameters", () => {
217
+ const req = adapter.buildRequest({
218
+ endpoint: "/test",
219
+ options: { method: "GET", query: { page: 1, limit: 10 } },
220
+ authToken: { token: "test-key" },
221
+ });
222
+ expect(req.url).toContain("page=1");
223
+ expect(req.url).toContain("limit=10");
224
+ });
225
+
226
+ it("serialises POST body as JSON", () => {
227
+ const req = adapter.buildRequest({
228
+ endpoint: "/test",
229
+ options: { method: "POST", body: { name: "test" } },
230
+ authToken: { token: "test-key" },
231
+ });
232
+ expect(req.body).toBe(JSON.stringify({ name: "test" }));
233
+ });
234
+
235
+ it("omits body for GET requests", () => {
236
+ const req = adapter.buildRequest({
237
+ endpoint: "/test",
238
+ options: { method: "GET", body: { should: "be-ignored" } },
239
+ authToken: { token: "test-key" },
240
+ });
241
+ expect(req.body).toBeUndefined();
242
+ });
243
+ });
244
+
245
+ describe("parseError", () => {
246
+ it("returns auth error for 401", () => {
247
+ const err = adapter.parseError({ status: 401, headers: new Headers(), body: {} });
248
+ expect(err.category).toBe("auth");
249
+ expect(err.retryable).toBe(false);
250
+ });
251
+
252
+ it("returns auth error for 403", () => {
253
+ const err = adapter.parseError({ status: 403, headers: new Headers(), body: {} });
254
+ expect(err.category).toBe("auth");
255
+ });
256
+
257
+ it("returns rate_limit error for 429", () => {
258
+ const err = adapter.parseError({ status: 429, headers: new Headers(), body: {} });
259
+ expect(err.category).toBe("rate_limit");
260
+ expect(err.retryable).toBe(true);
261
+ });
262
+
263
+ it("returns retryable provider error for 500", () => {
264
+ const err = adapter.parseError({ status: 500, headers: new Headers(), body: {} });
265
+ expect(err.category).toBe("provider");
266
+ expect(err.retryable).toBe(true);
267
+ });
268
+
269
+ it("extracts message from error body", () => {
270
+ const err = adapter.parseError({
271
+ status: 400,
272
+ headers: new Headers(),
273
+ body: { message: "Invalid request" },
274
+ });
275
+ expect(err.message).toBe("Invalid request");
276
+ });
277
+ });
278
+
279
+ describe("authStrategy", () => {
280
+ it("throws when no credentials provided", async () => {
281
+ await expect(adapter.authStrategy({})).rejects.toThrow();
282
+ });
283
+
284
+ it("resolves token from config", async () => {
285
+ const token = await adapter.authStrategy(${authArg});
286
+ expect(token.token).toBeTruthy();
287
+ });
288
+ });
289
+ });
290
+ `;
291
+ }
292
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/gener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D,CAAC,CAAC,wBAAwB,CAAC;IAE/B,OAAO;WACE,IAAI;;sBAEO,IAAI;;YAEd,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAkFiC,OAAO;;;;;CAKvD,CAAC;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,12 @@ import { type StreamChunk } from "./core/streaming.js";
2
2
  import type { BatchRequest, CircuitBreakerStatus, MeridianConfig, NormalizedResponse, ProviderConfig, RequestOptions } from "./core/types.js";
3
3
  import { MeridianError } from "./core/types.js";
4
4
  import type { ProviderAdapter } from "./core/types.js";
5
+ import type { CostReport } from "./analytics/collector.js";
6
+ import { CircuitState } from "./core/types.js";
7
+ import { DebugRecorder } from "./debug/recorder.js";
8
+ import { SchemaMonitor } from "./schema/monitor.js";
9
+ import { ServiceClient } from "./services/service-client.js";
10
+ import type { TransactionResult, TransactionStep } from "./transactions/saga.js";
5
11
  export declare const BUILTIN_ADAPTER_CLASSES: Record<string, new () => ProviderAdapter>;
6
12
  export interface ProviderClient {
7
13
  get<T = unknown>(endpoint: string, options?: RequestOptions): Promise<NormalizedResponse<T>>;
@@ -21,6 +27,10 @@ export declare class Meridian {
21
27
  private adapters;
22
28
  private started;
23
29
  private adapterCache;
30
+ private serviceClients;
31
+ private analyticsCollector;
32
+ private debugRecorder;
33
+ private _schemaMonitor;
24
34
  private constructor();
25
35
  static create(config: MeridianConfig, adapters?: Map<string, ProviderAdapter>): Promise<Meridian>;
26
36
  private emitLocalStateWarning;
@@ -68,6 +78,29 @@ export declare class Meridian {
68
78
  provider(name: "mollie"): ProviderClient | undefined;
69
79
  provider(name: "apollo"): ProviderClient | undefined;
70
80
  provider(name: string): ProviderClient | undefined;
81
+ service(name: string): ServiceClient | undefined;
82
+ analytics(): Record<string, import("./analytics/collector.js").ProviderStats>;
83
+ health(): Record<string, {
84
+ status: "healthy" | "degraded" | "down";
85
+ successRate: string;
86
+ avgLatency: number;
87
+ circuitBreaker: CircuitState;
88
+ }>;
89
+ cost(currency?: string): CostReport;
90
+ providers(): Array<{
91
+ name: string;
92
+ capabilities: string[];
93
+ }>;
94
+ findProviders(filter: {
95
+ capability: string;
96
+ }): Array<{
97
+ name: string;
98
+ capabilities: string[];
99
+ }>;
100
+ get debug(): DebugRecorder;
101
+ replay(requestId: string): Promise<NormalizedResponse<unknown>>;
102
+ get schema(): SchemaMonitor;
103
+ transaction(steps: TransactionStep[]): Promise<TransactionResult>;
71
104
  registerProvider(name: string, adapter: ProviderAdapter, config: ProviderConfig): Promise<void>;
72
105
  start(): Promise<void>;
73
106
  private ensureStarted;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAEV,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAElB,cAAc,EACd,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA+CvD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,eAAe,CAwC7E,CAAC;AAoBF,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9F,GAAG,CAAC,CAAC,GAAG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