meridianjs 0.2.2 → 0.2.4
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 +65 -160
- package/README.md +560 -93
- package/dist/analytics/collector.d.ts +28 -0
- package/dist/analytics/collector.d.ts.map +1 -0
- package/dist/analytics/collector.js +62 -0
- package/dist/analytics/collector.js.map +1 -0
- package/dist/analytics/index.d.ts +3 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js +2 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/capabilities/index.d.ts +3 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +2 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/registry.d.ts +6 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +61 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/core/pipeline.d.ts +3 -1
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +25 -0
- package/dist/core/pipeline.js.map +1 -1
- package/dist/core/types.d.ts +37 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +4 -2
- package/dist/core/types.js.map +1 -1
- package/dist/debug/index.d.ts +3 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +2 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/recorder.d.ts +32 -0
- package/dist/debug/recorder.d.ts.map +1 -0
- package/dist/debug/recorder.js +76 -0
- package/dist/debug/recorder.js.map +1 -0
- package/dist/generator/cli.d.ts +20 -0
- package/dist/generator/cli.d.ts.map +1 -0
- package/dist/generator/cli.js +56 -0
- package/dist/generator/cli.js.map +1 -0
- package/dist/generator/index.d.ts +9 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +49 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/openapi.d.ts +13 -0
- package/dist/generator/openapi.d.ts.map +1 -0
- package/dist/generator/openapi.js +49 -0
- package/dist/generator/openapi.js.map +1 -0
- package/dist/generator/templates.d.ts +16 -0
- package/dist/generator/templates.d.ts.map +1 -0
- package/dist/generator/templates.js +290 -0
- package/dist/generator/templates.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -1
- package/dist/policies/builtin.d.ts +24 -0
- package/dist/policies/builtin.d.ts.map +1 -0
- package/dist/policies/builtin.js +94 -0
- package/dist/policies/builtin.js.map +1 -0
- package/dist/policies/index.d.ts +2 -0
- package/dist/policies/index.d.ts.map +1 -0
- package/dist/policies/index.js +2 -0
- package/dist/policies/index.js.map +1 -0
- package/dist/public.d.ts +15 -0
- package/dist/public.d.ts.map +1 -1
- package/dist/public.js +15 -0
- package/dist/public.js.map +1 -1
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/monitor.d.ts +10 -0
- package/dist/schema/monitor.d.ts.map +1 -0
- package/dist/schema/monitor.js +46 -0
- package/dist/schema/monitor.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/service-client.d.ts +34 -0
- package/dist/services/service-client.d.ts.map +1 -0
- package/dist/services/service-client.js +156 -0
- package/dist/services/service-client.js.map +1 -0
- package/dist/transactions/index.d.ts +3 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +2 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/transactions/saga.d.ts +22 -0
- package/dist/transactions/saga.d.ts.map +1 -0
- package/dist/transactions/saga.js +58 -0
- package/dist/transactions/saga.js.map +1 -0
- package/dist/validation/drift-detector.d.ts.map +1 -1
- package/dist/validation/drift-detector.js +17 -8
- package/dist/validation/drift-detector.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,174 +1,79 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to
|
|
3
|
+
All notable changes to Meridian are documented here.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
---
|
|
7
6
|
|
|
8
|
-
## [0.2.
|
|
7
|
+
## [0.2.4] — Operational Intelligence
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
- **Core stabilization**: Integrated 741 contract tests (19 invariants × 39 adapters) verifying error handling, rate limiting, retries, timeouts, pagination, and request/response normalization across every provider adapter via the shared `runProviderContract` harness.
|
|
12
|
-
- **Contract test suite & CLI runner**: Run tests with `npm run test:contracts` or per-provider via `npm run test:contracts stripe`.
|
|
13
|
-
- **CI pipeline integration**: Added contract validation to the GitHub Actions test runner.
|
|
14
|
-
- **Provider status matrix**: Published a complete compatibility checklist in the README.
|
|
15
|
-
- **Comprehensive developer documentation**: Added 8 core manuals under the `docs/` folder.
|
|
16
|
-
|
|
17
|
-
## [2.0.2] - 2025-01-XX
|
|
18
|
-
|
|
19
|
-
### Changed
|
|
20
|
-
- **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.
|
|
21
|
-
- **Error contract enhancement**: `MeridianError` now exposes a `code` getter returning a frozen public `MeridianErrorCode` (e.g. `AUTH_FAILED`, `RATE_LIMITED`, `UPSTREAM_5XX`), derived from `category` and HTTP status. This provides a stable, documented error contract independent of the internal category.
|
|
22
|
-
|
|
23
|
-
### Internal
|
|
24
|
-
- Fixed incomplete code from prior refactoring in error message formatting
|
|
25
|
-
- Corrected timeout error construction to use proper `MeridianError` class instantiation
|
|
26
|
-
- Improved code consistency across error handling paths
|
|
27
|
-
|
|
28
|
-
## [2.0.1] - 2025-01-14
|
|
29
|
-
|
|
30
|
-
### Fixed
|
|
31
|
-
- Fix incorrect internal package version. SDK_VERSION now correctly reads from package.json as single source of truth, eliminating version mismatches.
|
|
32
|
-
|
|
33
|
-
## [2.0.0] - 2025-01-09
|
|
34
|
-
|
|
35
|
-
**This release establishes the long-term safety contract of the SDK.** All breaking changes are intentional and enforce safety by default.
|
|
36
|
-
|
|
37
|
-
**⚠️ BREAKING: This is a major version release with breaking changes. See migration guide below.**
|
|
38
|
-
|
|
39
|
-
### Breaking Changes
|
|
40
|
-
|
|
41
|
-
- **Constructor removed**: `new Meridian(config)` no longer works. Use `await Meridian.create(config)` instead. This enforces async initialization and prevents use before initialization.
|
|
42
|
-
|
|
43
|
-
- **Mandatory initialization**: All SDK methods throw if called before `Meridian.create()` completes. This prevents undefined behavior from uninitialized state.
|
|
44
|
-
|
|
45
|
-
- **StateStorage enforcement**:
|
|
46
|
-
- `mode: "distributed"` **requires** a `StateStorage` implementation. Startup fails without it.
|
|
47
|
-
- Configurations without `stateStorage` require explicit `localUnsafe: true` to acknowledge the limitation.
|
|
48
|
-
- This prevents accidental use of in-memory state in production deployments.
|
|
49
|
-
|
|
50
|
-
- **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`.
|
|
51
|
-
|
|
52
|
-
- **Typed request options**: `ProviderClient` methods now use strict `RequestOptions` types instead of `any`. Invalid options are caught at compile time.
|
|
9
|
+
This release transforms Meridian from an API normalisation SDK into an operational layer for third-party integrations. Every feature below works with zero configuration beyond what you already have.
|
|
53
10
|
|
|
54
11
|
### Added
|
|
55
12
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
13
|
+
**Service Abstraction & Failover**
|
|
14
|
+
- `meridian.service("name")` — logical service client that routes across multiple providers
|
|
15
|
+
- `MeridianConfig.services` — configure provider groups with a routing strategy
|
|
16
|
+
- Routing strategies: `"failover"`, `"round-robin"`, `"lowest-latency"`, `"cheapest"`, `"highest-success-rate"`
|
|
17
|
+
- `"lowest-latency"` self-calibrates via EWMA over `meta.trace.latency`
|
|
18
|
+
- `"highest-success-rate"` routes dynamically using live analytics data
|
|
19
|
+
- `"cheapest"` accepts a `costs` map and fails over in ascending cost order
|
|
20
|
+
|
|
21
|
+
**Request Trace**
|
|
22
|
+
- `result.meta.trace` — always present: `retries`, `latency`, `circuitBreaker`, `rateLimitRemaining`
|
|
23
|
+
- `ResponseContext.trace` — trace data now visible to all observability adapters
|
|
24
|
+
|
|
25
|
+
**Analytics & Health**
|
|
26
|
+
- `meridian.analytics()` — per-provider: `requests`, `errors`, `errorRate`, `successRate`, `avgLatency`, `p95Latency`
|
|
27
|
+
- `meridian.health()` — per-provider status (`healthy`/`degraded`/`down`) combining analytics + circuit breaker
|
|
28
|
+
- `AnalyticsCollector` always active, zero configuration required
|
|
29
|
+
|
|
30
|
+
**Debug Recording & Replay**
|
|
31
|
+
- `meridian.debug.enable()` / `.disable()` / `.clear()`
|
|
32
|
+
- `meridian.debug.recordings()` — full log with trace data and original request options
|
|
33
|
+
- `meridian.replay(requestId)` — re-execute any recorded request with identical options
|
|
34
|
+
|
|
35
|
+
**Policy Engine**
|
|
36
|
+
- `MeridianConfig.policies` — evaluate before every request, block or allow
|
|
37
|
+
- Built-ins: `blockPII()`, `allowedProviders()`, `blockedProviders()`, `readOnly()`, `customPolicy()`
|
|
38
|
+
- PII detection covers: credit cards, SSNs, emails, phone numbers, Aadhaar, PAN
|
|
39
|
+
- Blocked requests throw `MeridianError` with `category: "validation"` — no network round-trip wasted
|
|
40
|
+
|
|
41
|
+
**Multi-Provider Transactions**
|
|
42
|
+
- `meridian.transaction(steps)` — saga pattern across multiple providers
|
|
43
|
+
- Per-step `rollback` function; executed in reverse order on failure
|
|
44
|
+
- `TransactionError` carries `failed`, `succeeded`, `rolledBack`, `rollbackErrors`, `results`
|
|
45
|
+
|
|
46
|
+
**Schema Drift Detection (enhanced)**
|
|
47
|
+
- `meridian.schema.snapshot(provider, endpoint, data)` — baseline any live response
|
|
48
|
+
- `meridian.schema.check(provider, endpoint, data)` — detect field removals, type changes, required changes
|
|
49
|
+
- `DriftDetector` now recurses into nested object and array schemas
|
|
50
|
+
|
|
51
|
+
**Provider Capability Registry**
|
|
52
|
+
- `meridian.providers()` — all configured providers with capability arrays
|
|
53
|
+
- `meridian.findProviders({ capability })` — filter by capability string
|
|
54
|
+
- 39 providers mapped: chat, embeddings, streaming, payments, kyc, upi, shipping, maps, and more
|
|
55
|
+
|
|
56
|
+
**Adapter Generator**
|
|
57
|
+
- `npx meridian generate --provider <name> [--openapi spec.json]`
|
|
58
|
+
- Parses OpenAPI 3.x JSON: extracts base URL, auth type, endpoint list
|
|
59
|
+
- Generates `adapter.ts`, `adapter.test.ts` (8 passing tests out of the box), `pagination.ts`, `index.ts`
|
|
67
60
|
|
|
68
61
|
### Changed
|
|
69
62
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
- Improved error messages for state management failures.
|
|
73
|
-
|
|
74
|
-
### Fixed
|
|
75
|
-
|
|
76
|
-
- Secrets no longer leak through observability (logs, errors, metrics).
|
|
77
|
-
- Adapter cache properly scoped per instance.
|
|
78
|
-
- Pagination cannot infinite-loop.
|
|
63
|
+
- `DriftDetector.detect()` now recursively compares nested schemas (previously top-level only)
|
|
64
|
+
- `ResponseContext` gains optional `trace?: RequestTrace` for observability adapter use
|
|
79
65
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
**Required changes:**
|
|
83
|
-
|
|
84
|
-
1. **Replace constructor with factory method:**
|
|
85
|
-
```typescript
|
|
86
|
-
// ❌ OLD (1.x)
|
|
87
|
-
const meridian = new Meridian({ ... });
|
|
88
|
-
|
|
89
|
-
// ✅ NEW (2.0.0)
|
|
90
|
-
const meridian = await Meridian.create({ ... });
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
2. **Add state management configuration:**
|
|
94
|
-
```typescript
|
|
95
|
-
// For local development
|
|
96
|
-
const meridian = await Meridian.create({
|
|
97
|
-
...config,
|
|
98
|
-
localUnsafe: true, // Required for local dev
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// For production/distributed
|
|
102
|
-
const meridian = await Meridian.create({
|
|
103
|
-
...config,
|
|
104
|
-
mode: "distributed",
|
|
105
|
-
stateStorage: new YourStateStorage(), // Required
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
3. **Ensure Node.js ≥18.0.0** (now enforced via `engines` field)
|
|
110
|
-
|
|
111
|
-
4. **Update TypeScript types:** `ProviderClient` methods now use strict `RequestOptions` instead of `any`
|
|
112
|
-
|
|
113
|
-
## [0.1.3] - 2026-05-31
|
|
114
|
-
|
|
115
|
-
### Added
|
|
116
|
-
- **Razorpay adapter** (`src/providers/razorpay/`) — full `ProviderAdapter` implementation for India's largest payment gateway
|
|
117
|
-
- Basic auth with `key_id:key_secret` (supports `username`/`password` or `apiKey`/`custom.keySecret`)
|
|
118
|
-
- `X-Idempotency-Key` header support on write operations
|
|
119
|
-
- Error mapping: 400/422→validation, 401/403→auth, 404→validation, 429→rate_limit, 5xx→provider (retryable)
|
|
120
|
-
- Offset-based pagination via Razorpay's `items[]`/`count`/`skip` list format
|
|
121
|
-
- Idempotency config for orders, payments, refunds, transfers, payouts, subscriptions, invoices
|
|
122
|
-
- 31 contract tests covering all adapter methods
|
|
123
|
-
- Registered 17 additional Indian provider adapters in the built-in registry (Cashfree, PayU, Juspay, MSG91, Exotel, Gupshup, Setu, Decentro, Shiprocket, Delhivery, HyperVerge, Digio, Karza, IDfy, Cleartax, MapMyIndia, Perfios) — implementations pending
|
|
124
|
-
- `ROADMAP.md` — comprehensive future plan covering Indian and international provider coverage, SDK capabilities (webhook verification, streaming, mock adapter, batch operations, India compliance mode, UPI helpers), and version targets through v1.0
|
|
125
|
-
|
|
126
|
-
## [Unreleased]
|
|
127
|
-
|
|
128
|
-
### Added
|
|
129
|
-
- Auto-registration of built-in provider adapters
|
|
130
|
-
- Configuration validation for rate limit, retry, circuit breaker, and timeout settings
|
|
131
|
-
- Fallback error handling when adapter `parseError()` throws unexpectedly
|
|
132
|
-
|
|
133
|
-
### Fixed
|
|
134
|
-
- Removed circular self-dependency in package.json that caused installation failures
|
|
135
|
-
- Fetch timeout now properly cancels requests using `AbortController` (prevents resource leaks)
|
|
136
|
-
- GitHub 403 errors now correctly distinguished between rate limit and permission denied
|
|
137
|
-
- Adapter validation now runs in production (logs warning instead of throwing)
|
|
138
|
-
|
|
139
|
-
### Changed
|
|
140
|
-
- Improved type safety: `authToken` parameter now uses `AuthToken` type instead of `any`
|
|
141
|
-
|
|
142
|
-
## [1.0.2] - 2024-01-XX
|
|
143
|
-
|
|
144
|
-
### Fixed
|
|
145
|
-
- Constructor now supports both nested and flat provider config structures
|
|
146
|
-
- GitHub adapter auto-registers when provider is configured
|
|
147
|
-
|
|
148
|
-
## [1.0.1] - 2024-01-XX
|
|
149
|
-
|
|
150
|
-
### Fixed
|
|
151
|
-
- TypeScript strict mode compatibility issues
|
|
152
|
-
- Optional property handling in exactOptionalPropertyTypes mode
|
|
153
|
-
|
|
154
|
-
## [1.0.0] - 2024-01-XX
|
|
155
|
-
|
|
156
|
-
### Added
|
|
157
|
-
- Core request pipeline with unified response normalization
|
|
158
|
-
- Circuit breaker implementation with state machine
|
|
159
|
-
- Rate limiting with token bucket and adaptive backoff
|
|
160
|
-
- Retry strategy with exponential backoff and idempotency awareness
|
|
161
|
-
- Idempotency resolver with SAFE/IDEMPOTENT/CONDITIONAL/UNSAFE levels
|
|
162
|
-
- Schema validation with pluggable storage and drift detection
|
|
163
|
-
- Observability adapter pattern with console and no-op implementations
|
|
164
|
-
- GitHub provider adapter with OAuth support
|
|
165
|
-
- Pagination normalization for cursor and offset-based strategies
|
|
166
|
-
- Error normalization with unified error contract
|
|
167
|
-
- TypeScript strict mode with full type safety
|
|
168
|
-
|
|
169
|
-
[Unreleased]: https://github.com/Raghaverma/Meridian/compare/v1.0.2...HEAD
|
|
170
|
-
[1.0.2]: https://github.com/Raghaverma/Meridian/compare/v1.0.1...v1.0.2
|
|
171
|
-
[1.0.1]: https://github.com/Raghaverma/Meridian/compare/v1.0.0...v1.0.1
|
|
172
|
-
[1.0.0]: https://github.com/Raghaverma/Meridian/releases/tag/v1.0.0
|
|
66
|
+
---
|
|
173
67
|
|
|
68
|
+
## [0.2.3] — SDK Prototype
|
|
174
69
|
|
|
70
|
+
- 39 provider adapters with unified contract
|
|
71
|
+
- Normalized responses, errors, pagination, rate limits
|
|
72
|
+
- Circuit breaker, retry, rate limiting
|
|
73
|
+
- Webhook verification
|
|
74
|
+
- Contract testing suite (19 invariants per adapter)
|
|
75
|
+
- Streaming (SSE) for OpenAI, Anthropic, Gemini, Mistral, Cohere
|
|
76
|
+
- Batch requests with concurrency control
|
|
77
|
+
- India compliance mode (DPDPA PII redaction)
|
|
78
|
+
- Proxy server (`boundary-proxy`)
|
|
79
|
+
- Observability adapters: Console, NoOp, OpenTelemetry, Prometheus
|