feat(client): 0.9.x — Platform readiness & API stabilization - #70
Open
romanindev wants to merge 9 commits into
Open
feat(client): 0.9.x — Platform readiness & API stabilization #70romanindev wants to merge 9 commits into
romanindev wants to merge 9 commits into
Conversation
Expose an optional, metadata-only operationName in the request context and all lifecycle hooks for logging, tracing, and telemetry. Field is optional and omitted from hook contexts when not provided, preserving backward compatibility. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Enrich every DfsyncError thrown from the request lifecycle with optional requestId, attempt, and durationMs fields via a dedicated attachErrorContext helper, called after finalizeExecution and before onError hooks. Error constructors are left unchanged and the fields are optional, preserving backward compatibility. Response details remain available on HttpError and ValidationError. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…itions Add three opt-in retry controls, all backward compatible: - retry.maxElapsedMs: overall retry budget; stops retrying when the next delay would exceed it instead of waiting. - retry.jitter: full jitter on backoff delays (never on Retry-After). - retry.shouldRetry: predicate consulted only after built-in rules allow a retry, so it can restrict but never widen retries. Introduces ResolvedRetryConfig for the merged runtime shape and a local failWithError helper to centralize the terminal error path. Defaults and existing Retry-After semantics are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add optional serializeBody(body, ctx) and parseResponse(response, ctx) hooks at client and request level. serializeBody produces a fetch body and an optional content-type (applied only when the caller has not set one). parseResponse runs for every response before classification and validation, so HttpError.data and validateResponse both see the parsed value. Default JSON behavior is preserved when neither is configured. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduce a safeParse-style ValidationAdapter and a responseSchema option at client and request level. On failure the client throws ValidationError and surfaces adapter details on the new optional ValidationError.issues field. Precedence is explicit via resolveResponseValidator: request-level beats client-level, and within a level responseSchema beats validateResponse. Validation still runs only after successful responses and is never retried; the original parsed data is returned (no transformation in this version). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ship zodAdapter(schema) from @dfsync/client/adapters/zod as a lightweight responseSchema wrapper. zod is an optional peer dependency; the adapter is typed structurally against safeParse so it adds no runtime dependency to the core and works across zod versions. Adds a second tsup entry and the exports map entry for the subpath. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Formalize the auth provider contract as AuthProvider and export AuthContext. Add a TelemetryExporter interface plus createTelemetryHooks(exporter), which maps an exporter onto a standard HooksConfig so telemetry reuses the existing hook mechanism without a new runtime path. Combined with the already-exported ValidationAdapter and RetryPredicate, this is the minimal, version-stable extension surface. Additive and backward compatible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a concise Documentation section grouping guides by use case (reliable requests, validation & data shape, observability & tracing, extensibility) and a prominent pointer to the full documentation site. Existing content is unchanged; the full in-depth docs live on the site. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update ROADMAP.md 0.9.x section to completed/Delivered (reflecting the shipped RequestAbortedError) and update packages/client/CLAUDE.md current focus to 1.0.x with a summary of delivered 0.9.x work. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements all of the 0.9.x — Platform readiness & API stabilization roadmap items for
@dfsync/client. Every change is additive and backward compatible (no breaking changes in the public API). Version bump is handled by Changesets after merge.Changes (one logical commit each, with a changeset)
operationNamerequestId/attempt/durationMson everyDfsyncError(constructors unchanged)retry.maxElapsedMs(budget),retry.jitter(full jitter, off by default),retry.shouldRetry(predicate that can only restrict)serializeBodyandparseResponseat client/request level; default JSON preservedresponseSchemasafeParse-style adapter contract +ValidationError.issues; explicit precedence overvalidateResponse@dfsync/client/adapters/zodsubpath export;zodoptional peer, zero runtime dep in coreAuthProvider,TelemetryExporter+createTelemetryHooks;ValidationAdapter/RetryPredicateformalizedBackward compatibility
Retry-Afterand validation semantics preserved).DfsyncErroris never wrapped in a genericError.RequestAbortedErrorkept as-is (roadmap listedAbortError; renaming would be breaking).