Feature/open api - #720
Merged
Merged
Conversation
Introduce a tenant-scoped admin operation registry and OpenAPI emitter (admin-api). Add generated openapi.json, emitter script, tsup entry and tests. Change admin SDK to TenantClient, make document APIs tenant-scoped, and require exactly one of apiToken/tenantToken in HttpClient. Server: add API-token support with constant-time matching, requireTenantAccess/requireApiToken guards, mount admin routes from the registry, and expose deployment license status as an api-token-only route. Implement keyset cursor pagination for documents (opaque v1.<base64> cursors), add DB index migrations for Postgres/SQLite, and update services, repos, routes, examples and tests accordingly.
Introduce full tenants lifecycle: OpenAPI endpoints, admin-api Zod schemas and adminOperations for tenants (create, list, get, delete). Add admin client Tenants and expose via CloudAdmin. Implement server-side routes, list cursor encoding/decoding, and tenant repo methods (ensure, ensureExplicit, list, deleteCascadeDb). Add DB migrations (Postgres/SQLite) and schema column/index auto_provisioned for provenance and keyset ordering. Wire auto-provision flag into DocumentLifecycleService and add end-to-end admin tests covering create, list, provenance, pagination and cascade delete.
Add POST /v1/tenants/{tenantId}/tokens to mint doc or tenant tokens and extend revoke flow. Introduce TenantTokens SDK, HttpClient.postEmpty, and server route handlers that log every issuance/revocation to a new security_events table. Add repository, schema entries and migrations for Postgres/SQLite. Replace old tenant scope `tokens.mint` with `tokens.issue-doc` and `tokens.revoke`, update OpenAPI, auth verifier types and many tests to exercise the new behavior. Also rename admin status paths to deployment status and adjust imports/tests (skip some stale engine-core wire tests).
Support API-token (root) access on the doc-plane and per-request X-Document-Password (base64) handling. Adds preHandler to synthesize tenant principal for API tokens and strict base64/UTF-8 decoding. Threads decoded docPassword into request/jwt contexts. Refactors DocumentService open/password flows: per-request authorization for api-token callers, canonical open singleflight retry, stateless password verification against open sessions, and password-verification cache lookup helper. Updates jwt-plugin types and test stub to simulate password failures. Adds comprehensive doc-plane API-token tests.
Add four .changeset files describing package version bumps and major feature changes: - @cloudpdf/admin (major): tenant-scoped admin SDK, tenant lifecycle, tenant token issuance/revocation, document iterator, move shared schemas to @cloudpdf/contract. - @cloudpdf/contract (major): full backend HTTP contract, Zod schemas, OpenAPI 3.1 emitter and generated openapi.json, contract tests. - @cloudpdf/server (major): tenant-scoped server API, root API-token workflow, tenant lifecycle, pagination, migrations, and expanded tests. - @embedpdf/engine-core (minor): export wireTemplates for shared document-plane route templates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Enforce production-secret validation for apiAuthTokens in buildApp and reject short root tokens for production licenses. Replace raw SHA-256 digests with a process-local HMAC-based matcher (random key) for constant-time API token comparisons. Add strict Base64 handling for X-Document-Password: max length, canonical padding rules, and round-trip verification to reject malformed inputs. Update related tests to cover unpadded base64, invalid padding, oversized headers, and production-token validation.
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.
No description provided.