meridianjs 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.
- package/CHANGELOG.md +152 -0
- package/LICENSE.md +22 -0
- package/README.md +126 -0
- package/dist/core/adapter-validator.d.ts +10 -0
- package/dist/core/adapter-validator.d.ts.map +1 -0
- package/dist/core/adapter-validator.js +270 -0
- package/dist/core/adapter-validator.js.map +1 -0
- package/dist/core/error-sanitizer.d.ts +3 -0
- package/dist/core/error-sanitizer.d.ts.map +1 -0
- package/dist/core/error-sanitizer.js +134 -0
- package/dist/core/error-sanitizer.js.map +1 -0
- package/dist/core/header-parser.d.ts +15 -0
- package/dist/core/header-parser.d.ts.map +1 -0
- package/dist/core/header-parser.js +148 -0
- package/dist/core/header-parser.js.map +1 -0
- package/dist/core/normalizer.d.ts +10 -0
- package/dist/core/normalizer.d.ts.map +1 -0
- package/dist/core/normalizer.js +39 -0
- package/dist/core/normalizer.js.map +1 -0
- package/dist/core/observability-sanitizer.d.ts +7 -0
- package/dist/core/observability-sanitizer.d.ts.map +1 -0
- package/dist/core/observability-sanitizer.js +51 -0
- package/dist/core/observability-sanitizer.js.map +1 -0
- package/dist/core/pipeline.d.ts +34 -0
- package/dist/core/pipeline.d.ts.map +1 -0
- package/dist/core/pipeline.js +216 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/request-sanitizer.d.ts +7 -0
- package/dist/core/request-sanitizer.d.ts.map +1 -0
- package/dist/core/request-sanitizer.js +90 -0
- package/dist/core/request-sanitizer.js.map +1 -0
- package/dist/core/types.d.ts +280 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +92 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +341 -0
- package/dist/index.js.map +1 -0
- package/dist/observability/adapter.d.ts +2 -0
- package/dist/observability/adapter.d.ts.map +1 -0
- package/dist/observability/adapter.js +2 -0
- package/dist/observability/adapter.js.map +1 -0
- package/dist/observability/console.d.ts +15 -0
- package/dist/observability/console.d.ts.map +1 -0
- package/dist/observability/console.js +81 -0
- package/dist/observability/console.js.map +1 -0
- package/dist/observability/index.d.ts +6 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +6 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/noop.d.ts +9 -0
- package/dist/observability/noop.d.ts.map +1 -0
- package/dist/observability/noop.js +13 -0
- package/dist/observability/noop.js.map +1 -0
- package/dist/observability/otel.d.ts +51 -0
- package/dist/observability/otel.d.ts.map +1 -0
- package/dist/observability/otel.js +93 -0
- package/dist/observability/otel.js.map +1 -0
- package/dist/observability/prometheus.d.ts +29 -0
- package/dist/observability/prometheus.d.ts.map +1 -0
- package/dist/observability/prometheus.js +194 -0
- package/dist/observability/prometheus.js.map +1 -0
- package/dist/providers/anthropic/adapter.d.ts +17 -0
- package/dist/providers/anthropic/adapter.d.ts.map +1 -0
- package/dist/providers/anthropic/adapter.js +151 -0
- package/dist/providers/anthropic/adapter.js.map +1 -0
- package/dist/providers/anthropic/index.d.ts +3 -0
- package/dist/providers/anthropic/index.d.ts.map +1 -0
- package/dist/providers/anthropic/index.js +3 -0
- package/dist/providers/anthropic/index.js.map +1 -0
- package/dist/providers/anthropic/pagination.d.ts +11 -0
- package/dist/providers/anthropic/pagination.d.ts.map +1 -0
- package/dist/providers/anthropic/pagination.js +36 -0
- package/dist/providers/anthropic/pagination.js.map +1 -0
- package/dist/providers/github/adapter.d.ts +18 -0
- package/dist/providers/github/adapter.d.ts.map +1 -0
- package/dist/providers/github/adapter.js +232 -0
- package/dist/providers/github/adapter.js.map +1 -0
- package/dist/providers/github/index.d.ts +3 -0
- package/dist/providers/github/index.d.ts.map +1 -0
- package/dist/providers/github/index.js +3 -0
- package/dist/providers/github/index.js.map +1 -0
- package/dist/providers/github/pagination.d.ts +11 -0
- package/dist/providers/github/pagination.d.ts.map +1 -0
- package/dist/providers/github/pagination.js +53 -0
- package/dist/providers/github/pagination.js.map +1 -0
- package/dist/providers/openai/adapter.d.ts +17 -0
- package/dist/providers/openai/adapter.d.ts.map +1 -0
- package/dist/providers/openai/adapter.js +178 -0
- package/dist/providers/openai/adapter.js.map +1 -0
- package/dist/providers/openai/index.d.ts +3 -0
- package/dist/providers/openai/index.d.ts.map +1 -0
- package/dist/providers/openai/index.js +3 -0
- package/dist/providers/openai/index.js.map +1 -0
- package/dist/providers/openai/pagination.d.ts +11 -0
- package/dist/providers/openai/pagination.d.ts.map +1 -0
- package/dist/providers/openai/pagination.js +35 -0
- package/dist/providers/openai/pagination.js.map +1 -0
- package/dist/providers/stripe/adapter.d.ts +17 -0
- package/dist/providers/stripe/adapter.d.ts.map +1 -0
- package/dist/providers/stripe/adapter.js +177 -0
- package/dist/providers/stripe/adapter.js.map +1 -0
- package/dist/providers/stripe/index.d.ts +3 -0
- package/dist/providers/stripe/index.d.ts.map +1 -0
- package/dist/providers/stripe/index.js +3 -0
- package/dist/providers/stripe/index.js.map +1 -0
- package/dist/providers/stripe/pagination.d.ts +11 -0
- package/dist/providers/stripe/pagination.d.ts.map +1 -0
- package/dist/providers/stripe/pagination.js +44 -0
- package/dist/providers/stripe/pagination.js.map +1 -0
- package/dist/public.d.ts +27 -0
- package/dist/public.d.ts.map +1 -0
- package/dist/public.js +23 -0
- package/dist/public.js.map +1 -0
- package/dist/strategies/circuit-breaker.d.ts +22 -0
- package/dist/strategies/circuit-breaker.d.ts.map +1 -0
- package/dist/strategies/circuit-breaker.js +124 -0
- package/dist/strategies/circuit-breaker.js.map +1 -0
- package/dist/strategies/idempotency.d.ts +11 -0
- package/dist/strategies/idempotency.d.ts.map +1 -0
- package/dist/strategies/idempotency.js +55 -0
- package/dist/strategies/idempotency.js.map +1 -0
- package/dist/strategies/index.d.ts +6 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +6 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/pagination.d.ts +29 -0
- package/dist/strategies/pagination.d.ts.map +1 -0
- package/dist/strategies/pagination.js +130 -0
- package/dist/strategies/pagination.js.map +1 -0
- package/dist/strategies/rate-limit.d.ts +16 -0
- package/dist/strategies/rate-limit.d.ts.map +1 -0
- package/dist/strategies/rate-limit.js +94 -0
- package/dist/strategies/rate-limit.js.map +1 -0
- package/dist/strategies/retry.d.ts +13 -0
- package/dist/strategies/retry.d.ts.map +1 -0
- package/dist/strategies/retry.js +62 -0
- package/dist/strategies/retry.js.map +1 -0
- package/dist/validation/drift-detector.d.ts +5 -0
- package/dist/validation/drift-detector.d.ts.map +1 -0
- package/dist/validation/drift-detector.js +79 -0
- package/dist/validation/drift-detector.js.map +1 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +3 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/schema-storage.d.ts +19 -0
- package/dist/validation/schema-storage.d.ts.map +1 -0
- package/dist/validation/schema-storage.js +131 -0
- package/dist/validation/schema-storage.js.map +1 -0
- package/package.json +52 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.0.2] - 2025-01-XX
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Public API lockdown**: Package now exports from `src/public.ts` as the single public entry point. This restricts consumer access to only documented, stable APIs.
|
|
12
|
+
- **Error contract enhancement**: `MeridianError` now exposes a `code` getter as an alias for `category`. This provides forward compatibility with documented error contracts while maintaining backward compatibility.
|
|
13
|
+
|
|
14
|
+
### Internal
|
|
15
|
+
- Fixed incomplete code from prior refactoring in error message formatting
|
|
16
|
+
- Corrected timeout error construction to use proper `MeridianError` class instantiation
|
|
17
|
+
- Improved code consistency across error handling paths
|
|
18
|
+
|
|
19
|
+
## [2.0.1] - 2025-01-14
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- Fix incorrect internal package version. SDK_VERSION now correctly reads from package.json as single source of truth, eliminating version mismatches.
|
|
23
|
+
|
|
24
|
+
## [2.0.0] - 2025-01-09
|
|
25
|
+
|
|
26
|
+
**This release establishes the long-term safety contract of the SDK.** All breaking changes are intentional and enforce safety by default.
|
|
27
|
+
|
|
28
|
+
**⚠️ BREAKING: This is a major version release with breaking changes. See migration guide below.**
|
|
29
|
+
|
|
30
|
+
### Breaking Changes
|
|
31
|
+
|
|
32
|
+
- **Constructor removed**: `new Meridian(config)` no longer works. Use `await Meridian.create(config)` instead. This enforces async initialization and prevents use before initialization.
|
|
33
|
+
|
|
34
|
+
- **Mandatory initialization**: All SDK methods throw if called before `Meridian.create()` completes. This prevents undefined behavior from uninitialized state.
|
|
35
|
+
|
|
36
|
+
- **StateStorage enforcement**:
|
|
37
|
+
- `mode: "distributed"` **requires** a `StateStorage` implementation. Startup fails without it.
|
|
38
|
+
- Configurations without `stateStorage` require explicit `localUnsafe: true` to acknowledge the limitation.
|
|
39
|
+
- This prevents accidental use of in-memory state in production deployments.
|
|
40
|
+
|
|
41
|
+
- **Node.js version requirement**: SDK now explicitly requires Node.js ≥18.0.0 (was implicit before). This is enforced via `engines` field in `package.json`.
|
|
42
|
+
|
|
43
|
+
- **Typed request options**: `ProviderClient` methods now use strict `RequestOptions` types instead of `any`. Invalid options are caught at compile time.
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- **Safety guarantees**:
|
|
48
|
+
- Fail-fast initialization enforcement
|
|
49
|
+
- Fail-closed state management
|
|
50
|
+
- Guaranteed secret redaction in all observability paths
|
|
51
|
+
- No silent degradation - all failures are explicit
|
|
52
|
+
|
|
53
|
+
- **Pagination safety**: Cycle detection and max page limit (1000 pages) prevent infinite loops from malformed adapters.
|
|
54
|
+
|
|
55
|
+
- **Adapter validation safety**: Validation uses fake test tokens to prevent side effects during adapter checks.
|
|
56
|
+
|
|
57
|
+
- **Instance-scoped adapter cache**: Prevents config sharing across Meridian instances.
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- All examples and documentation updated to use `Meridian.create()` pattern.
|
|
62
|
+
- Enhanced header sanitization to handle variations (e.g., "X-API-Key" matches "apikey").
|
|
63
|
+
- Improved error messages for state management failures.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
- Secrets no longer leak through observability (logs, errors, metrics).
|
|
68
|
+
- Adapter cache properly scoped per instance.
|
|
69
|
+
- Pagination cannot infinite-loop.
|
|
70
|
+
|
|
71
|
+
### Migration from 1.x
|
|
72
|
+
|
|
73
|
+
**Required changes:**
|
|
74
|
+
|
|
75
|
+
1. **Replace constructor with factory method:**
|
|
76
|
+
```typescript
|
|
77
|
+
// ❌ OLD (1.x)
|
|
78
|
+
const meridian = new Meridian({ ... });
|
|
79
|
+
|
|
80
|
+
// ✅ NEW (2.0.0)
|
|
81
|
+
const meridian = await Meridian.create({ ... });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. **Add state management configuration:**
|
|
85
|
+
```typescript
|
|
86
|
+
// For local development
|
|
87
|
+
const meridian = await Meridian.create({
|
|
88
|
+
...config,
|
|
89
|
+
localUnsafe: true, // Required for local dev
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// For production/distributed
|
|
93
|
+
const meridian = await Meridian.create({
|
|
94
|
+
...config,
|
|
95
|
+
mode: "distributed",
|
|
96
|
+
stateStorage: new YourStateStorage(), // Required
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. **Ensure Node.js ≥18.0.0** (now enforced via `engines` field)
|
|
101
|
+
|
|
102
|
+
4. **Update TypeScript types:** `ProviderClient` methods now use strict `RequestOptions` instead of `any`
|
|
103
|
+
|
|
104
|
+
## [Unreleased]
|
|
105
|
+
|
|
106
|
+
### Added
|
|
107
|
+
- Auto-registration of built-in provider adapters
|
|
108
|
+
- Configuration validation for rate limit, retry, circuit breaker, and timeout settings
|
|
109
|
+
- Fallback error handling when adapter `parseError()` throws unexpectedly
|
|
110
|
+
|
|
111
|
+
### Fixed
|
|
112
|
+
- Removed circular self-dependency in package.json that caused installation failures
|
|
113
|
+
- Fetch timeout now properly cancels requests using `AbortController` (prevents resource leaks)
|
|
114
|
+
- GitHub 403 errors now correctly distinguished between rate limit and permission denied
|
|
115
|
+
- Adapter validation now runs in production (logs warning instead of throwing)
|
|
116
|
+
|
|
117
|
+
### Changed
|
|
118
|
+
- Improved type safety: `authToken` parameter now uses `AuthToken` type instead of `any`
|
|
119
|
+
|
|
120
|
+
## [1.0.2] - 2024-01-XX
|
|
121
|
+
|
|
122
|
+
### Fixed
|
|
123
|
+
- Constructor now supports both nested and flat provider config structures
|
|
124
|
+
- GitHub adapter auto-registers when provider is configured
|
|
125
|
+
|
|
126
|
+
## [1.0.1] - 2024-01-XX
|
|
127
|
+
|
|
128
|
+
### Fixed
|
|
129
|
+
- TypeScript strict mode compatibility issues
|
|
130
|
+
- Optional property handling in exactOptionalPropertyTypes mode
|
|
131
|
+
|
|
132
|
+
## [1.0.0] - 2024-01-XX
|
|
133
|
+
|
|
134
|
+
### Added
|
|
135
|
+
- Core request pipeline with unified response normalization
|
|
136
|
+
- Circuit breaker implementation with state machine
|
|
137
|
+
- Rate limiting with token bucket and adaptive backoff
|
|
138
|
+
- Retry strategy with exponential backoff and idempotency awareness
|
|
139
|
+
- Idempotency resolver with SAFE/IDEMPOTENT/CONDITIONAL/UNSAFE levels
|
|
140
|
+
- Schema validation with pluggable storage and drift detection
|
|
141
|
+
- Observability adapter pattern with console and no-op implementations
|
|
142
|
+
- GitHub provider adapter with OAuth support
|
|
143
|
+
- Pagination normalization for cursor and offset-based strategies
|
|
144
|
+
- Error normalization with unified error contract
|
|
145
|
+
- TypeScript strict mode with full type safety
|
|
146
|
+
|
|
147
|
+
[Unreleased]: https://github.com/Raghaverma/Meridian/compare/v1.0.2...HEAD
|
|
148
|
+
[1.0.2]: https://github.com/Raghaverma/Meridian/compare/v1.0.1...v1.0.2
|
|
149
|
+
[1.0.1]: https://github.com/Raghaverma/Meridian/compare/v1.0.0...v1.0.1
|
|
150
|
+
[1.0.0]: https://github.com/Raghaverma/Meridian/releases/tag/v1.0.0
|
|
151
|
+
|
|
152
|
+
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Meridian SDK Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Meridian
|
|
2
|
+
|
|
3
|
+
> **⚠️ v2.0.0 establishes the safe-by-default contract. Previous versions (<2.0.0) are deprecated and contain unsafe defaults. Upgrade to >=2.0.0.**
|
|
4
|
+
|
|
5
|
+
A TypeScript SDK that normalizes third-party API interactions through a unified request pipeline, enforcing consistent error handling, rate limiting, and response shapes across providers.
|
|
6
|
+
|
|
7
|
+
## Problem Statement
|
|
8
|
+
|
|
9
|
+
Applications integrating multiple third-party APIs face inconsistent response formats, error structures, rate limit behaviors, and pagination strategies. This fragmentation requires provider-specific error handling, retry logic, and data transformation code that is difficult to maintain and test.
|
|
10
|
+
|
|
11
|
+
Meridian provides a single abstraction layer that normalizes these differences, allowing applications to interact with any provider through a consistent interface while maintaining type safety and resilience patterns.
|
|
12
|
+
|
|
13
|
+
## Non-Goals
|
|
14
|
+
|
|
15
|
+
- UI components or dashboards
|
|
16
|
+
- API mocking or stubbing frameworks
|
|
17
|
+
- Request recording or replay functionality
|
|
18
|
+
- GraphQL support (v1)
|
|
19
|
+
- Webhook handling (v1)
|
|
20
|
+
- Multi-region routing
|
|
21
|
+
- Built-in caching (applications can layer caching on top)
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install meridian-sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
- **Node.js ≥18.0.0** (required for `fetch`, `Headers`, `AbortController`, `crypto.randomUUID`)
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
**IMPORTANT**: Meridian requires async initialization. Always use `Meridian.create()`:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Meridian } from "meridian-sdk";
|
|
39
|
+
|
|
40
|
+
// ✅ CORRECT: Async initialization
|
|
41
|
+
const meridian = await Meridian.create({
|
|
42
|
+
github: {
|
|
43
|
+
auth: { token: process.env.GITHUB_TOKEN },
|
|
44
|
+
},
|
|
45
|
+
localUnsafe: true, // Required for local development without StateStorage
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { data, meta } = await meridian.github.get("/users/octocat");
|
|
49
|
+
console.log(meta.rateLimit.remaining);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**❌ NEVER use `new Meridian()`** - the constructor is private and will fail.
|
|
53
|
+
|
|
54
|
+
### Production Deployment
|
|
55
|
+
|
|
56
|
+
For distributed deployments (serverless, multiple instances), you **must** provide a `StateStorage` implementation:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { Meridian } from "meridian-sdk";
|
|
60
|
+
import { RedisStateStorage } from "./your-redis-storage.js";
|
|
61
|
+
|
|
62
|
+
const meridian = await Meridian.create({
|
|
63
|
+
mode: "distributed",
|
|
64
|
+
stateStorage: new RedisStateStorage(redisClient), // Required in distributed mode
|
|
65
|
+
github: {
|
|
66
|
+
auth: { token: process.env.GITHUB_TOKEN },
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Without `stateStorage` in distributed mode, startup will fail.** This is intentional - in-memory state cannot be shared across instances.
|
|
72
|
+
|
|
73
|
+
### Local Development
|
|
74
|
+
|
|
75
|
+
For local development, explicitly opt-in to unsafe in-memory state:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const meridian = await Meridian.create({
|
|
79
|
+
mode: "local", // or omit mode
|
|
80
|
+
localUnsafe: true, // Explicitly acknowledge unsafe state
|
|
81
|
+
github: {
|
|
82
|
+
auth: { token: process.env.GITHUB_TOKEN },
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Warning**: `localUnsafe: true` means circuit breaker and rate limiter state will be lost on process restart. This is acceptable for development but **must not be used in production**.
|
|
88
|
+
|
|
89
|
+
## Safety Guarantees
|
|
90
|
+
|
|
91
|
+
Meridian enforces safety by default:
|
|
92
|
+
|
|
93
|
+
1. **Fail-Fast Initialization**: SDK cannot be used before initialization completes. All methods throw if called before `Meridian.create()` resolves.
|
|
94
|
+
|
|
95
|
+
2. **Fail-Closed State Management**: Distributed mode requires `StateStorage`. In-memory state is opt-in only via `localUnsafe: true`.
|
|
96
|
+
|
|
97
|
+
3. **Guaranteed Secret Redaction**: All observability paths (logs, errors, metrics) automatically redact sensitive fields: `authorization`, `cookie`, `token`, `apiKey`, `api_key`, `body`.
|
|
98
|
+
|
|
99
|
+
4. **No Silent Degradation**: Runtime failures are explicit. Invalid configurations fail at startup. Adapter validation failures stop initialization.
|
|
100
|
+
|
|
101
|
+
## Public API
|
|
102
|
+
|
|
103
|
+
### Meridian Class
|
|
104
|
+
|
|
105
|
+
- `static create(config: MeridianConfig, adapters?: Map<string, ProviderAdapter>): Promise<Meridian>` - **Use this to create instances**
|
|
106
|
+
- `getCircuitStatus(provider: string): CircuitBreakerStatus | null`
|
|
107
|
+
- `registerProvider(name: string, adapter: ProviderAdapter, config: ProviderConfig): Promise<void>`
|
|
108
|
+
|
|
109
|
+
### Provider Client
|
|
110
|
+
|
|
111
|
+
Each configured provider exposes a client with:
|
|
112
|
+
|
|
113
|
+
- `get<T>(endpoint: string, options?: RequestOptions): Promise<NormalizedResponse<T>>`
|
|
114
|
+
- `post<T>(endpoint: string, options?: RequestOptions): Promise<NormalizedResponse<T>>`
|
|
115
|
+
- `put<T>(endpoint: string, options?: RequestOptions): Promise<NormalizedResponse<T>>`
|
|
116
|
+
- `patch<T>(endpoint: string, options?: RequestOptions): Promise<NormalizedResponse<T>>`
|
|
117
|
+
- `delete<T>(endpoint: string, options?: RequestOptions): Promise<NormalizedResponse<T>>`
|
|
118
|
+
- `paginate<T>(endpoint: string, options?: RequestOptions): AsyncGenerator<NormalizedResponse<T>>`
|
|
119
|
+
|
|
120
|
+
## Project Status
|
|
121
|
+
|
|
122
|
+
**v2.0.0** - Production-ready safety contract established. Core functionality is stable. Provider coverage is expanding. API stability guaranteed for 2.x releases.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT. See [LICENSE.md](LICENSE.md) for details.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ProviderAdapter } from "./types.js";
|
|
2
|
+
export interface ValidationResult {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
errors: string[];
|
|
5
|
+
warnings: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function validateAdapter(adapter: ProviderAdapter, providerName: string): Promise<ValidationResult>;
|
|
8
|
+
export declare function assertValidAdapter(adapter: ProviderAdapter, providerName: string): Promise<void>;
|
|
9
|
+
export declare function isProviderAdapter(obj: unknown): obj is ProviderAdapter;
|
|
10
|
+
//# sourceMappingURL=adapter-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-validator.d.ts","sourceRoot":"","sources":["../../src/core/adapter-validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EAKrB,MAAM,YAAY,CAAC;AAKpB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAGD,wBAAsB,eAAe,CACnC,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,CAAC,CA+R3B;AAGD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAaf;AAGD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,eAAe,CAkBtE"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { MeridianError, } from "./types.js";
|
|
2
|
+
export async function validateAdapter(adapter, providerName) {
|
|
3
|
+
const errors = [];
|
|
4
|
+
const warnings = [];
|
|
5
|
+
const requiredMethods = [
|
|
6
|
+
"buildRequest",
|
|
7
|
+
"parseResponse",
|
|
8
|
+
"parseError",
|
|
9
|
+
"authStrategy",
|
|
10
|
+
"rateLimitPolicy",
|
|
11
|
+
"paginationStrategy",
|
|
12
|
+
"getIdempotencyConfig",
|
|
13
|
+
];
|
|
14
|
+
for (const method of requiredMethods) {
|
|
15
|
+
if (typeof adapter[method] !== "function") {
|
|
16
|
+
errors.push(`Adapter missing required method: ${String(method)}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (typeof adapter.buildRequest === "function") {
|
|
20
|
+
try {
|
|
21
|
+
const input = {
|
|
22
|
+
endpoint: "/test",
|
|
23
|
+
options: { method: "GET" },
|
|
24
|
+
authToken: { token: "test" },
|
|
25
|
+
};
|
|
26
|
+
const built = adapter.buildRequest(input);
|
|
27
|
+
if (!built || typeof built !== "object") {
|
|
28
|
+
errors.push("buildRequest must return BuiltRequest object");
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (typeof built.url !== "string") {
|
|
32
|
+
errors.push("buildRequest must return url as string");
|
|
33
|
+
}
|
|
34
|
+
if (typeof built.method !== "string") {
|
|
35
|
+
errors.push("buildRequest must return method as string");
|
|
36
|
+
}
|
|
37
|
+
if (!built.headers || typeof built.headers !== "object") {
|
|
38
|
+
errors.push("buildRequest must return headers as object");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
errors.push(`buildRequest threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (typeof adapter.parseResponse === "function") {
|
|
47
|
+
try {
|
|
48
|
+
const raw = {
|
|
49
|
+
status: 200,
|
|
50
|
+
headers: new Headers({
|
|
51
|
+
"X-RateLimit-Limit": "5000",
|
|
52
|
+
"X-RateLimit-Remaining": "4999",
|
|
53
|
+
"X-RateLimit-Reset": String(Math.floor(Date.now() / 1000) + 3600),
|
|
54
|
+
}),
|
|
55
|
+
body: { test: "data" },
|
|
56
|
+
};
|
|
57
|
+
const normalized = adapter.parseResponse(raw);
|
|
58
|
+
if (!normalized || typeof normalized !== "object") {
|
|
59
|
+
errors.push("parseResponse must return NormalizedResponse object");
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (!("data" in normalized)) {
|
|
63
|
+
errors.push("parseResponse must return object with 'data' property");
|
|
64
|
+
}
|
|
65
|
+
if (!("meta" in normalized)) {
|
|
66
|
+
errors.push("parseResponse must return object with 'meta' property");
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const meta = normalized.meta;
|
|
70
|
+
if (meta.provider !== providerName) {
|
|
71
|
+
errors.push(`parseResponse meta.provider must be '${providerName}', got '${meta.provider}'`);
|
|
72
|
+
}
|
|
73
|
+
if (!meta.rateLimit) {
|
|
74
|
+
errors.push("parseResponse meta must include rateLimit");
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
if (typeof meta.rateLimit.limit !== "number") {
|
|
78
|
+
errors.push("rateLimit.limit must be number");
|
|
79
|
+
}
|
|
80
|
+
if (typeof meta.rateLimit.remaining !== "number") {
|
|
81
|
+
errors.push("rateLimit.remaining must be number");
|
|
82
|
+
}
|
|
83
|
+
if (!(meta.rateLimit.reset instanceof Date)) {
|
|
84
|
+
errors.push("rateLimit.reset must be Date");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
errors.push(`parseResponse threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (typeof adapter.parseError === "function") {
|
|
95
|
+
const testErrors = [
|
|
96
|
+
{ status: 401, headers: new Headers(), body: { message: "Unauthorized" } },
|
|
97
|
+
{ status: 404, headers: new Headers(), body: { message: "Not Found" } },
|
|
98
|
+
{ status: 429, headers: new Headers(), body: { message: "Rate Limited" } },
|
|
99
|
+
{ status: 500, headers: new Headers(), body: { message: "Server Error" } },
|
|
100
|
+
new Error("Network error"),
|
|
101
|
+
];
|
|
102
|
+
for (const testError of testErrors) {
|
|
103
|
+
try {
|
|
104
|
+
const error = adapter.parseError(testError);
|
|
105
|
+
if (!(error instanceof MeridianError)) {
|
|
106
|
+
if (error instanceof Error) {
|
|
107
|
+
errors.push("parseError must return MeridianError instance (extends Error), got Error-like object without proper inheritance");
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
errors.push("parseError must return MeridianError instance");
|
|
111
|
+
}
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const validCategories = ["auth", "rate_limit", "network", "provider", "validation"];
|
|
115
|
+
if (!validCategories.includes(error.category)) {
|
|
116
|
+
errors.push(`parseError returned invalid category: ${error.category}. Must be one of: ${validCategories.join()}`);
|
|
117
|
+
}
|
|
118
|
+
if (typeof error.retryable !== "boolean") {
|
|
119
|
+
errors.push("parseError returned MeridianError with non-boolean 'retryable' property");
|
|
120
|
+
}
|
|
121
|
+
if (error.provider !== providerName) {
|
|
122
|
+
errors.push(`parseError returned provider '${error.provider}', expected '${providerName}'`);
|
|
123
|
+
}
|
|
124
|
+
if (typeof error.requestId !== "string") {
|
|
125
|
+
errors.push("parseError must return MeridianError with requestId as string");
|
|
126
|
+
}
|
|
127
|
+
const providerSpecificFields = ["documentation_url", "github_message", "stripe_error"];
|
|
128
|
+
for (const field of providerSpecificFields) {
|
|
129
|
+
if (field in error && !(field in Error.prototype)) {
|
|
130
|
+
warnings.push(`parseError may be leaking provider-specific field: ${field}. Consider moving to metadata.`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
errors.push(`parseError threw error for test case: ${error instanceof Error ? error.message : String(error)}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (typeof adapter.authStrategy === "function") {
|
|
140
|
+
try {
|
|
141
|
+
const config = { token: "MERIDIAN_TEST_TOKEN_DO_NOT_VALIDATE" };
|
|
142
|
+
const tokenPromise = adapter.authStrategy(config);
|
|
143
|
+
if (!(tokenPromise instanceof Promise)) {
|
|
144
|
+
errors.push("authStrategy must return Promise<AuthToken>");
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
try {
|
|
148
|
+
const token = await tokenPromise;
|
|
149
|
+
if (!token || typeof token !== "object") {
|
|
150
|
+
errors.push("authStrategy must return AuthToken object");
|
|
151
|
+
}
|
|
152
|
+
else if (typeof token.token !== "string") {
|
|
153
|
+
errors.push("authStrategy must return token as string");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
if (error instanceof Error && "category" in error) {
|
|
158
|
+
const meridianError = error;
|
|
159
|
+
if (meridianError.category !== "auth") {
|
|
160
|
+
warnings.push("authStrategy should throw MeridianError with category 'auth' on failure");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
warnings.push("authStrategy should throw MeridianError, not raw Error");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
errors.push(`authStrategy threw synchronous error: ${error instanceof Error ? error.message : String(error)}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (typeof adapter.rateLimitPolicy === "function") {
|
|
174
|
+
try {
|
|
175
|
+
const headers = new Headers({
|
|
176
|
+
"X-RateLimit-Limit": "5000",
|
|
177
|
+
"X-RateLimit-Remaining": "4999",
|
|
178
|
+
"X-RateLimit-Reset": String(Math.floor(Date.now() / 1000) + 3600),
|
|
179
|
+
});
|
|
180
|
+
const rateLimit = adapter.rateLimitPolicy(headers);
|
|
181
|
+
if (!rateLimit || typeof rateLimit !== "object") {
|
|
182
|
+
errors.push("rateLimitPolicy must return RateLimitInfo object");
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
if (typeof rateLimit.limit !== "number") {
|
|
186
|
+
errors.push("rateLimitPolicy must return limit as number");
|
|
187
|
+
}
|
|
188
|
+
if (typeof rateLimit.remaining !== "number") {
|
|
189
|
+
errors.push("rateLimitPolicy must return remaining as number");
|
|
190
|
+
}
|
|
191
|
+
if (!(rateLimit.reset instanceof Date)) {
|
|
192
|
+
errors.push("rateLimitPolicy must return reset as Date");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
errors.push(`rateLimitPolicy threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (typeof adapter.paginationStrategy === "function") {
|
|
201
|
+
try {
|
|
202
|
+
const strategy = adapter.paginationStrategy();
|
|
203
|
+
if (!strategy || typeof strategy !== "object") {
|
|
204
|
+
errors.push("paginationStrategy must return PaginationStrategy object");
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const requiredMethods = ["extractCursor", "extractTotal", "hasNext", "buildNextRequest"];
|
|
208
|
+
for (const method of requiredMethods) {
|
|
209
|
+
if (typeof strategy[method] !== "function") {
|
|
210
|
+
errors.push(`paginationStrategy must implement ${method} method`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
errors.push(`paginationStrategy threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (typeof adapter.getIdempotencyConfig === "function") {
|
|
220
|
+
try {
|
|
221
|
+
const config = adapter.getIdempotencyConfig();
|
|
222
|
+
if (!config || typeof config !== "object") {
|
|
223
|
+
errors.push("getIdempotencyConfig must return IdempotencyConfig object");
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
if (!(config.defaultSafeOperations instanceof Set)) {
|
|
227
|
+
errors.push("getIdempotencyConfig must return defaultSafeOperations as Set");
|
|
228
|
+
}
|
|
229
|
+
if (!(config.operationOverrides instanceof Map)) {
|
|
230
|
+
errors.push("getIdempotencyConfig must return operationOverrides as Map");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
errors.push(`getIdempotencyConfig threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
valid: errors.length === 0,
|
|
240
|
+
errors,
|
|
241
|
+
warnings,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
export async function assertValidAdapter(adapter, providerName) {
|
|
245
|
+
const result = await validateAdapter(adapter, providerName);
|
|
246
|
+
if (!result.valid || result.warnings.length > 0) {
|
|
247
|
+
const errorMessage = [
|
|
248
|
+
`Adapter validation failed for '${providerName}':`,
|
|
249
|
+
...result.errors.map((e) => ` - ERROR: ${e}`),
|
|
250
|
+
...result.warnings.map((w) => ` - WARNING (treated as error): ${w}`),
|
|
251
|
+
].join("\n");
|
|
252
|
+
throw new Error(errorMessage);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
export function isProviderAdapter(obj) {
|
|
256
|
+
if (!obj || typeof obj !== "object") {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
const requiredMethods = [
|
|
260
|
+
"buildRequest",
|
|
261
|
+
"parseResponse",
|
|
262
|
+
"parseError",
|
|
263
|
+
"authStrategy",
|
|
264
|
+
"rateLimitPolicy",
|
|
265
|
+
"paginationStrategy",
|
|
266
|
+
"getIdempotencyConfig",
|
|
267
|
+
];
|
|
268
|
+
return requiredMethods.every((method) => typeof obj[method] === "function");
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=adapter-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-validator.js","sourceRoot":"","sources":["../../src/core/adapter-validator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aA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