universal-api-layer 0.7.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 +82 -0
- package/LICENSE +21 -0
- package/README.md +534 -0
- package/SECURITY.md +9 -0
- package/dist/angular/index.d.ts +62 -0
- package/dist/angular/index.js +142 -0
- package/dist/chunk-DXYWZQW5.js +92 -0
- package/dist/chunk-HDW7BOZI.js +764 -0
- package/dist/chunk-YTM3FV65.js +19 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +205 -0
- package/dist/client-ByBlZaRg.d.ts +169 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +26 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.js +227 -0
- package/dist/types-CVzD7l4p.d.ts +81 -0
- package/dist/vue/index.d.ts +23 -0
- package/dist/vue/index.js +257 -0
- package/dist/websocket/angular.d.ts +9 -0
- package/dist/websocket/angular.js +15 -0
- package/dist/websocket/index.d.ts +7 -0
- package/dist/websocket/index.js +529 -0
- package/dist/websocket/react.d.ts +8 -0
- package/dist/websocket/react.js +23 -0
- package/dist/websocket/vue.d.ts +9 -0
- package/dist/websocket/vue.js +39 -0
- package/package.json +181 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.7.0 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
- Optional Angular 20.3-22 DI providers, injectApiClient and readonly session signals.
|
|
6
|
+
- Cold cancellable ApiService request$/stream$ observables with metadata/SSE typing, per-subscription abort, provider teardown and session guards. No implicit Angular query cache or HttpClient interceptor integration.
|
|
7
|
+
- Angular WebSocket state/message signal helpers with lifecycle cleanup and explicit connection ownership.
|
|
8
|
+
- TypeScript CLI scaffolding, standalone HTTP/SSE/WebSocket examples, injector/RxJS regressions and packed Angular production AOT/strict-template/browser consumers.
|
|
9
|
+
|
|
10
|
+
## 0.6.0 - 2026-11-01
|
|
11
|
+
|
|
12
|
+
- Optional raw WebSocket transport with native runtime/injectable factory, typed message validation, state/message/error subscriptions and explicit connect/disconnect/dispose.
|
|
13
|
+
- Bounded reconnect backoff/jitter and handshake deadlines, incoming message/backlog and outgoing buffered-byte limits. No outgoing queue or automatic message replay.
|
|
14
|
+
- Managed HTTP session binding cancels sockets/tickets/retries on logout/account changes and guards queued async message validations. Abortable, origin-pinned connection-ticket providers; no implicit bearer forwarding or opaque-handshake token refresh.
|
|
15
|
+
- Separate React/Vue state/message subscription adapters, component examples and core/adapter/native-server/packed-consumer coverage. ws is a development-only test server, not a runtime dependency.
|
|
16
|
+
|
|
17
|
+
## 0.5.0 - 2026-11-01
|
|
18
|
+
|
|
19
|
+
- Added lazy client.stream async generators for incremental UTF-8 text and complete SSE events, with typed output and bounded SSE buffers.
|
|
20
|
+
- Shared origin/auth/request transport, deadlines through body consumption, reader cancellation on abort/break, and session guards for already buffered events.
|
|
21
|
+
- HTTP 401 can refresh once before a successful stream starts; no automatic reconnect or replay after partial output.
|
|
22
|
+
- Vue/React streaming chat examples, real HTTP incremental delivery test, parser/cancellation/session regressions and packed consumer smoke/type checks.
|
|
23
|
+
|
|
24
|
+
## 0.4.0 - 2026-10-31
|
|
25
|
+
|
|
26
|
+
- Optional responseMode: full on client.request exposes parsed/validated data, response headers, status, statusText and URL, with precise overloads and unchanged data-only defaults.
|
|
27
|
+
- Explicit invalidateScope: all updates matching native TanStack queries in the same QueryClient; client remains the safe default scope in both adapters.
|
|
28
|
+
- Regression coverage for X-Total-Count pagination, schema/refresh/error metadata and POST/DELETE interoperability in React and Vue.
|
|
29
|
+
- Public source/test repository, Issues and CI links in npm metadata. Git history starts with the current source import rather than invented historical commits.
|
|
30
|
+
- Versioned, timestamped dependency inventory with lockfile digest and explicit distinction from a comprehensive security review.
|
|
31
|
+
|
|
32
|
+
## 0.3.1 - 2026-10-31
|
|
33
|
+
|
|
34
|
+
- Bypass the browser HTTP cache for managed sessions, including post-logout requests, and for Authorization-bearing requests. This complements TanStack namespace isolation during account changes. Public unmanaged requests retain normal HTTP caching.
|
|
35
|
+
- Added regressions for a pre-existing URL-only private HTTP cache and legacy/manual Bearer headers.
|
|
36
|
+
|
|
37
|
+
## 0.3.0 - 2026-10-31
|
|
38
|
+
|
|
39
|
+
- Managed authentication with setSession/logout, immutable public session snapshots and useApiSession in React/Vue.
|
|
40
|
+
- Account/tenant changes automatically isolate and clear owned query/mutation caches and cancel old work; same-user token rotations retain fresh data.
|
|
41
|
+
- Late and offline-paused mutation results cannot reintroduce prior-account state; public mutation callback variables remain unchanged.
|
|
42
|
+
- Default 15-second request deadline, including authentication, refresh waiting and async response validation; timeoutMs: 0 explicitly disables it.
|
|
43
|
+
- Optional coordinated token refresh: one callback for concurrent 401s, one request replay, separate bounded refresh deadline and fail-closed local logout on failure.
|
|
44
|
+
- Optional runtime schemas for core, queries and mutations: Standard Schema v1 (tested with Zod), parse/parseAsync objects and validator functions. Distinct validation errors preserve causes.
|
|
45
|
+
- requiresAuth disables private queries while logged out; authRetry: false prevents recursive refresh and allows endpoint-specific replay opt-out.
|
|
46
|
+
- Default retries exclude deterministic auth/validation/parse/client failures and respect explicit query/cache configuration.
|
|
47
|
+
- Split transport, public types, callbacks, session state and response validation into focused framework-independent modules.
|
|
48
|
+
|
|
49
|
+
### Migration
|
|
50
|
+
|
|
51
|
+
- Configure session/setSession instead of combining legacy getToken with refreshToken. User and tenant IDs must come from the authenticated backend; raw token changes cannot identify users.
|
|
52
|
+
- Long-running requests must explicitly increase or disable the new default deadline.
|
|
53
|
+
- Client-owned in-memory cache is purged on logout/session switches and when its last cache binding unmounts. Explicitly shared namespaces participate in the same purge; external persistence and server logout remain application-owned.
|
|
54
|
+
- SSR constructors must use matching initial user/tenant identities and stable non-secret client scopes; do not serialize access tokens.
|
|
55
|
+
|
|
56
|
+
## 0.2.0 ? 2026-10-31
|
|
57
|
+
|
|
58
|
+
### Security and correctness
|
|
59
|
+
|
|
60
|
+
- Client-specific cache namespaces, explicit non-secret account scopes and stable opt-in SSR identities.
|
|
61
|
+
- Only representation headers participate in cache keys; credentials and arbitrary API key headers are excluded.
|
|
62
|
+
- Cross-origin requests are blocked unless their origin is explicitly allowed. Unsafe URL forms are rejected before authentication; HTTP redirects are rejected to prevent indirect credential forwarding.
|
|
63
|
+
- Deadlines and cancellation cover token lookup, Fetch and response reading, including non-cooperative async providers.
|
|
64
|
+
- Empty successful responses return null, consistently supported by both adapters and declarations.
|
|
65
|
+
- Malformed success JSON rejects with a parse error. HTTP failures preserve response diagnostics.
|
|
66
|
+
- Auth and application callback failures have distinct ApiError codes with original causes.
|
|
67
|
+
- Shared bundle chunks preserve a single ApiError class identity across entry points.
|
|
68
|
+
|
|
69
|
+
### Tooling and compatibility
|
|
70
|
+
|
|
71
|
+
- Node >=22.13.0 and npm >=11.21.1. Ordinary isolated installs no longer need legacy-peer-deps on supported npm.
|
|
72
|
+
- Updated build/test tools, removed unnecessary test-only dependency chains and applied a patched minimatch override.
|
|
73
|
+
- Focused regression checks, strict JS/TS packed consumers, framework-version compatibility fixtures, lint/format and release checks.
|
|
74
|
+
- Added Linux/Windows CI and an enforced source-publication validation hook.
|
|
75
|
+
- CLI detects applications outside src; nullable-response-safe templates and examples.
|
|
76
|
+
|
|
77
|
+
### Migration from 0.1.x
|
|
78
|
+
|
|
79
|
+
- Handle null in request results and selection callbacks: response?.data ?? [].
|
|
80
|
+
- Absolute requests to different origins require allowedOrigins. Opting in permits credential forwarding.
|
|
81
|
+
- Use query cacheScope for account changes. Client scopes are unique unless explicitly configured; configure a stable scope for SSR hydration.
|
|
82
|
+
- Upgrade Node/npm to the supported minimums before installation or development.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 universal-api-layer 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.
|