From e84b1216e79fbcd284b4bae08d70e9257e5d63f0 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Fri, 6 Nov 2026 23:48:36 -0500 Subject: [PATCH 1/2] KB-02: add authorized knowledge application and bounded storage --- AGENTS.md | 21 +- README.md | 40 +- docs/COLLECTIONS.md | 181 + docs/HOST_COMPOSITION.md | 214 ++ docs/RELEASING.md | 28 +- package.json | 9 + packages/application/LICENSE | 21 + packages/application/README.md | 99 + packages/application/package.json | 44 + packages/application/src/articles.ts | 766 ++++ packages/application/src/errors.ts | 34 + packages/application/src/governance.ts | 471 +++ packages/application/src/index.ts | 45 + packages/application/src/reads.ts | 498 +++ packages/application/src/records.ts | 198 + packages/application/src/repository.ts | 1105 ++++++ packages/application/src/storage-helpers.ts | 156 + packages/application/src/types.ts | 414 +++ packages/application/tsconfig.json | 11 + packages/contracts/src/index.ts | 5 + packages/core/README.md | 15 +- packages/core/src/index.ts | 6 +- pnpm-lock.yaml | 3642 ++++++++++++++++++- scripts/release-packages.mjs | 16 +- test/README.md | 42 + test/application-fixtures.ts | 381 ++ test/application-stores.ts | 48 + test/azurite.ts | 99 + test/trace-store.ts | 97 + tests/application-storage.test.ts | 488 +++ tests/application.test.ts | 751 ++++ tsconfig.json | 3 +- tsconfig.test.json | 1 + vitest.config.ts | 1 + 34 files changed, 9748 insertions(+), 202 deletions(-) create mode 100644 docs/COLLECTIONS.md create mode 100644 docs/HOST_COMPOSITION.md create mode 100644 packages/application/LICENSE create mode 100644 packages/application/README.md create mode 100644 packages/application/package.json create mode 100644 packages/application/src/articles.ts create mode 100644 packages/application/src/errors.ts create mode 100644 packages/application/src/governance.ts create mode 100644 packages/application/src/index.ts create mode 100644 packages/application/src/reads.ts create mode 100644 packages/application/src/records.ts create mode 100644 packages/application/src/repository.ts create mode 100644 packages/application/src/storage-helpers.ts create mode 100644 packages/application/src/types.ts create mode 100644 packages/application/tsconfig.json create mode 100644 test/README.md create mode 100644 test/application-fixtures.ts create mode 100644 test/application-stores.ts create mode 100644 test/azurite.ts create mode 100644 test/trace-store.ts create mode 100644 tests/application-storage.test.ts create mode 100644 tests/application.test.ts diff --git a/AGENTS.md b/AGENTS.md index 926c5dc..0c1c0e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,8 +8,9 @@ tests. The approved scope is the [Support Desk enhancement plan](https://github. - Contracts and core own collection policy, immutable article revisions, validation/evidence bindings, approval, publication, and retirement. -- KB-01 is pure domain work. Storage, authorized services, retrieval, API/MCP, - and host interfaces are later tasks; do not create their packages early. +- KB-01 owns pure domain work. KB-02 adds declared persistence and authorized + application services. Retrieval/search, API/MCP, and live host interfaces + remain later tasks; do not create their packages early. - Never implement a database, authorization role model, identity/session/token system, audit log, request limiter, or durable scheduler here. Compose the corresponding Pegma package in the owning later task. @@ -22,8 +23,17 @@ tests. The approved scope is the [Support Desk enhancement plan](https://github. - Approval binds exact content, revision, audience/policy, applicability, validation policy, and evidence. Edits and changed authority invalidate it. A `passed` string or claimed runner identity does not authenticate evidence. -- Core transitions are not an authorization boundary. The later application - must authenticate/authorize the actor, attestations, and current resources. +- Core transitions are not an authorization boundary. The application + enforces named permissions and current KB resources; the host authenticates + access contexts and evidence/source facts. Caller-supplied proof fields do + not establish that trust. +- KB-02 article heads are normalized; content/evidence/publication history is + immutable and bounded. Application generation fences every state change, + independently of content revision. Same-partition CAS, Audit, receipts, and + causal jobs commit together. Collection/profile and article partitions do + not provide a global policy fence; current reads must reject stale authority. +- Replay rechecks current operation/resource permission and returns a bounded + historical acknowledgement, not raw content or restored publication authority. - Base packages require no Support Desk, GitHub, model, framework, HTTP, or provider SDK. Evidence is data; never execute code or fetch submitted URLs. - Constrain content and links; host renderers must disable executable content @@ -50,3 +60,6 @@ trusted-publisher configuration are separate maintainer operations. Read this file, the root README, then the owning package README. The public enhancement plan defines KB-01 through KB-05. Give a worker one task and an explicit file ownership boundary; do not revert another worker's edits. +For KB-02, read [declared collections](docs/COLLECTIONS.md) before changing +durable operations and [host composition](docs/HOST_COMPOSITION.md) before +changing authorization, verifier, replay, or DTO boundaries. diff --git a/README.md b/README.md index 1e973b7..ba10a9c 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,18 @@ Hosts own their users, storage, authorization policy, interfaces, and deployment Knowledge Base owns collection policy, immutable article revisions, validation, and exact publication approval. It requires no GitHub connection or AI provider. -> Development status: KB-01 implements contracts and pure domain transitions. -> The packages are unpublished. Authorized persistence, retrieval, API/MCP, -> and customer/staff interfaces are later tasks. This repository is not yet an -> operational knowledge-base service or a production dependency. +> Development status: KB-01 provides contracts and pure domain transitions; +> KB-02 adds authorized application/persistence source. Its implementation and +> repository gates determine completion. All three packages are unpublished. +> Retrieval/search, API/MCP, and live customer/staff interfaces remain later +> tasks. This repository is not yet an operational hosted KB or a production +> dependency. -| Package | Scope | -| ----------------------------------------------------------------- | ------------------------------------------------------ | -| [`@pegma/knowledge-base-contracts`](packages/contracts/README.md) | Collection, article, evidence, and approval vocabulary | -| [`@pegma/knowledge-base-core`](packages/core/README.md) | Pure validation and lifecycle transitions | +| Package | Scope | +| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| [`@pegma/knowledge-base-contracts`](packages/contracts/README.md) | Collection, article, evidence, and approval vocabulary | +| [`@pegma/knowledge-base-core`](packages/core/README.md) | Pure validation and lifecycle transitions | +| [`@pegma/knowledge-base-application`](packages/application/README.md) | Authorized services, bounded declared persistence, private DTOs, and exact publication | Collections default to private and independently specify portal and bot-answer audiences. Articles inherit collection policy. Staff approval binds the exact @@ -23,11 +26,22 @@ authorizes edited content. Core transitions accept explicit inputs and return new values. They do not authenticate a runner or staff member, enforce host roles, fetch evidence URLs, -or execute guide steps. Later application services must enforce current -Authorization Core permissions and authenticated attestation boundaries. +or execute guide steps. The application enforces current named permissions +and resource checks; hosts authenticate scoped access contexts and trusted +evidence/source facts. Private draft, evidence, provenance, and review reads +have separate DTOs. The keyed published read returns portal-safe content only. Local agents will test guides against authorized staging and submit evidence through the later API/MCP adapter. +KB-02 stores normalized heads and bounded immutable history with same-partition +CAS, Audit, replay receipts, and causal jobs. Application generation is separate +from content revision. Replay returns a historical bounded acknowledgement +after current authorization, never a raw aggregate. Current publication reads +reject stale authority; no cross-partition policy transaction is promised. +Read [declared collections](docs/COLLECTIONS.md) and +[host composition](docs/HOST_COMPOSITION.md) for the layout, limits, verifier +contract, and safe read boundaries. + Develop on Node 22 or 24 with pnpm 10.34.5: ```sh @@ -38,9 +52,9 @@ pnpm test pnpm run release:check ``` -The npm and pnpm workspace declarations deliberately name the same two source +The npm and pnpm workspace declarations deliberately name the same source packages: pnpm links them for development, while npm supplies artifact packing. -The release check installs both tarballs in a consumer outside either workspace +The release check installs all three tarballs in a consumer outside either workspace to verify dependency resolution without source links. The [approved enhancement plan](https://github.com/pegma-dev/support-desk/blob/main/docs/KNOWLEDGE_AI_PLAN.md) @@ -54,3 +68,5 @@ Read [AGENTS.md](AGENTS.md) before changing code and [release operations](docs/RELEASING.md) before preparing artifacts. Merging source does not publish a package. Each new npm name needs the maintainer's first publication and trusted-publisher setup before hosts can consume it. + +Built in the open by RetireGolden, LLC. diff --git a/docs/COLLECTIONS.md b/docs/COLLECTIONS.md new file mode 100644 index 0000000..c3cbb18 --- /dev/null +++ b/docs/COLLECTIONS.md @@ -0,0 +1,181 @@ +# KB-02 declared collections and durable layout + +## Design status + +This layout was written before durable operations and synchronized with the +storage/application seam agreement. KB-02 source work remains subject to the +owning implementation tests and repository gate; this document alone does not +mark the task complete. The declared collection is `knowledge-base.records.v1`. +The approved scope is the +[implementation plan](https://github.com/pegma-dev/support-desk/blob/main/docs/KNOWLEDGE_AI_PLAN.md) +and its P-00 capacity/privacy requirements. No KB-03 search projection, MCP +endpoint, real-host acceptance, or production readiness is established here. + +## Partition and authority rules + +Use host-supplied `@pegma/storage-core` collections and codecs. Do not add a +private database or a second in-memory persistence implementation. Every +accepted mutation, its Audit action, replay receipt, and causal jobs must +share one declared collection and one partition so one `transact` commits +all of them. Storage Core provides no cross-partition transaction. + +The logical partition families are: + +| Partition family | Authoritative records | Transaction scope | +| ----------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------ | +| Article | Normalized head, immutable revisions/evidence/publication history, receipts, Audit events, causal jobs | One article mutation | +| Collection | Current collection policy, exact public-policy approval, governance configuration, receipts, Audit, causal jobs | One collection mutation | +| Validation policy | Current validation policy, receipts, Audit, causal jobs | One validation-policy mutation | + +The physical partition is `:`, where `kind` is `article`, +`collection`, or `validation` and the lowercase digest covers canonical JSON +of `[kind, resourceId]`. Logical resource/command IDs are bounded, well-formed +Unicode: normal astral pairs are accepted and lone surrogates are rejected. +Canonical JSON hashing avoids raw text-encoding ambiguity. IDs remain data; +callers cannot select another resource through an arbitrary storage key. +The synchronous codec validates stored metadata, JSON shape, and bounds; it +cannot see the backend key or recompute the resource's asynchronous hash. +Repository keyed reads check the expected resource, partition, and row +identity. These checks reject malformed or inconsistent records within the +supported storage boundary; they do not authenticate database contents. + +This layout assumes the application is the exclusive writer to its declared +collection and the host/store adapter is trusted. Quota counters and immutable +history depend on every write following the application transaction protocol. +Direct database writes or tampering are outside that integrity model; hashes +and codecs are not signatures or database-access controls. + +Collection and validation-policy partitions are separate authorities. Reading +them before an article transaction cannot globally fence a concurrent policy +change. Article CAS protects the article generation only. Recheck current +authority before read/projection use and reject stale publication bindings; +do not claim an atomic policy-revocation transaction across those partitions. + +## Article record families + +The application reconstructs the bounded core `Article` transition aggregate +from records. It does not persist that entire aggregate as one ever-growing +JSON envelope. + +| Logical row | Required identity/binding | Lifecycle | +| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| `head` | Article ID, application generation, state, current revision/evidence references, private source generation, pending review, and separate publication pointers | Conditional replacement | +| `revision:` | Immutable content hash and applicability | Insert-only retained history | +| `evidence:::` | Article revision, exact evidence ID/version/hash and trusted verifier receipt | Insert-only retained history | +| `review::pending\|publication` | Exact review binding and source/governance generation fence | Immutable review history; unchanged snapshots can reuse a row | +| `publication:` | Approval binding; content remains in the separately referenced revision row | Immutable approval; head pointers control current use | +| `provenance:` | Opaque private source references and application-computed hash | Immutable private snapshot | +| `revoked:` | Revoked exact historical evidence tuple and reason | Immutable marker | +| `command:` | Request fingerprint, actor/resource binding, committed bounded acknowledgement | Idempotent accepted-command result | +| Audit action | Audit's stable event ID and accepted mutation metadata | Same transaction as the accepted mutation | +| `job::` | Stable command/ordinal/generation and bounded payload/state | Same transaction as its cause; retries update bounded state | + +Evidence-ID and command-ID hashes use canonical JSON of the exact ID. Causal +job identity includes the stable command and ordinal. Audit uses +`auditRecordId(commandIdHash)`. Collection partitions retain +`collection-policy:` and `configuration:`; +unchanged configuration can reuse its prior row. Validation-policy partitions +retain `policy:`. No cross-family read grants authority. + +Application generation advances on every accepted article mutation, including +evidence and review changes. Content revision advances only on a content edit. +They are separate fences: two evidence submissions for the same content +revision must not overwrite each other through a content-only CAS. + +An evidence key includes the article revision as well as its own ID/version. +Core may restart an evidence ID's version sequence on a new draft; omitting +the article revision would collide with retained evidence from the old draft. +Publication references exact retained evidence versions. Editing a draft may +clear current evidence/review pointers while preserving those immutable rows +needed by an existing approved publication. + +`publicationReview` remains separate from the pending `review`. It binds the +published revision to its own source snapshot and collection-governance +generation while a new draft/review is prepared. Current publication reads +hydrate that published snapshot, not the new draft's evidence or provenance. +Proof freshness is rechecked as of the stored approval's `reviewedAt`; an +approved guide does not expire merely because its evidence ages after approval. +Current policy/source eligibility, governance generation, retained proof +availability, and revocation remain live checks. +Explicit evidence revocation records its article revision/ID/version/hash, +clears pending review, and holds an affected publication. Replacing current +evidence does not silently revoke a previously approved historical proof. + +Source references and evidence are private staff material. Store only opaque +external source references and bounded verification metadata, never copied +ticket transcripts or a raw-source archive. Resolving a source reference +requires current permission to that external resource; KB permission alone +does not authorize the source ticket. Customer/bot DTOs contain approved +content only and must not serialize an aggregate, receipts, evidence, review, +provenance, or private storage metadata. + +## Physical representation and hard bounds + +The codec maps one record to native flat `StoredRecord` metadata plus +`part0` through `part14`. Its canonical JSON payload is split into at most +15 string properties of at most 30,000 UTF-16 units each, without splitting +a surrogate pair. The payload is limited to 895,904 UTF-16 bytes, reserving +4,096 bytes within a 900,000-byte component entity budget for metadata. +The adapter maps these properties natively; the whole map must not be wrapped +inside one large Azure string property. + +| Bound | Component default and enforced ceiling | +| --------------------- | ----------------------------------------------------------------------------------------------------------- | +| `maxPhysicalRows` | 1,024 retained physical rows per resource partition; configurable up to 10,000 | +| `maxRetainedBytes` | 16 MiB encoded-record JSON estimate per partition; configurable up to 64 MiB | +| `controlReserveRows` | 32 rows held back from ordinary authoring admission | +| `controlReserveBytes` | 512 KiB held back from ordinary authoring admission | +| `maxArticleRevisions` | 64 retained content revisions and maximum revision number; configurable up to 1,000 | +| `maxEvidenceVersions` | 256 retained evidence versions across revisions; configurable up to 1,000 | +| `maxConflictAttempts` | 3 storage-conflict attempts; configurable up to 8 | +| Native row payload | At most 15 parts; 30,000 UTF-16 units per part; payload plus reserved metadata at most 900,000 UTF-16 bytes | +| Transaction | At most 100 actions and 3 MiB encoded-record JSON estimate | + +The 16 MiB and 3 MiB metrics count +`new TextEncoder().encode(canonicalJson(nativeStoredRecord)).length`; they are conservative +component admission estimates, not a claim to measure Azure SDK wire framing. +Rows, native string properties, and transaction work have independent bounds. +Configured values are bounded integers; reserves must be nonnegative and +strictly smaller than their respective partition totals. +Host/adapter constraints still apply. Deployment throughput, retention periods, +and live capacity require the owning host's evidence. + +The smallest supported adapter limit governs a transaction. Admission counts +every physical row and its native chunk bytes before filtering. When a bound is +reached, return a named capacity outcome without partial accepted state. +Heads account for all application-created physical rows, including immutable +history, Audit, commands, and jobs. Online commands use keyed reads rather +than partition scans. No full-history API, automatic pruning, or unlimited +revision history is provided. A future retention/compaction operation must +preserve live references, replay commitments, and its own completion capacity, +or fail visibly for operator action. + +## Mutation, replay, and recovery + +Read the authoritative head/version and current collection/validation policy, +authorize the operation, and validate its expected application generation. +Prepare the pure core transition from the bounded hydrated aggregate. Plan +the resulting physical writes and admission reservation before committing a +single-partition CAS transaction containing the head change, immutable rows, +Audit, receipt, and causal work. A conflict reloads/redecides within a bound +and repeats resource checks under the call's trusted access-context freshness +boundary; it does not append an unbounded attempt log. + +A command ID is scoped to its actor, operation, target, and exact input +semantic fingerprint. Identical replay returns a bounded historical +acknowledgement without duplicating history/Audit/jobs; a changed fingerprint +conflicts. Overlapping identical commands return that same acknowledgement +once the accepted command's receipt exists, even when their original expected +generation is now stale. Replay still +requires the caller's current operation/resource permissions. A receipt is +not an access capability, and replay cannot recover private data after access +revocation. It returns no content, evidence, or provenance, and does not promise +that the acknowledged content is still published or usable. A separate current +read establishes current availability. Published-history hydration uses its +exact retained immutable versions, not the new mutable draft's material. + +Invalid rows or an unavailable dependency produce a visible failure. There is +no best-effort acceptance through Spine's event bus. Projection/search repair +is KB-03 work and cannot authorize a read or hide a failed authoritative +mutation. Host blob uploads are separate from record transactions and need +pending references plus orphan cleanup in the owning integration. diff --git a/docs/HOST_COMPOSITION.md b/docs/HOST_COMPOSITION.md new file mode 100644 index 0000000..c53cfae --- /dev/null +++ b/docs/HOST_COMPOSITION.md @@ -0,0 +1,214 @@ +# KB-02 host composition + +## Status and ownership + +This documents the agreed KB-02 source API and host boundary. Implementation +and repository gates determine task completion; this document does not assert +that either real host is ready. The unpublished application composes +contracts/core with host-supplied Storage Core and Authorization Core. It is +not an HTTP server, an identity system, a search service, or an operational +MCP endpoint. See [declared collections](COLLECTIONS.md) for the required +layout, CAS, admission, and replay design. + +The host owns identity verification, scoped local-agent credentials, current +authorization resolution, browser/transport protections, store construction, +clock/logger, trusted attestation verification, source-resource authorization, +retention/scheduling, safe rendering, and error mapping. The application owns +permission names and current resource checks for its own commands and keyed +reads. Collections own audiences; there are no article ACLs or host roles +inside this package. + +## Authenticate before composing access + +Resolve a trusted principal and a current Authorization Core access context +for each call, including replay. Apply the authenticated credential's scope +and target audience restrictions before passing effective authority into the +application. An access-context-shaped HTTP object from a customer is not an +authenticated context. The host must not cache permission authority beyond +its supported revocation/freshness boundary. + +API/MCP author credentials initially permit draft authoring and evidence +submission. They do not acquire review/publication or collection-management +authority by declaring a runner, reviewer, attester, or permission string. +Hosts map named KB permissions into existing policy and role administration; +the KB does not issue credentials, create roles, parse cookies, or implement +OAuth. Existing public catalog MCP connectivity is not private authoring +authentication. The live credential/protected-resource proofs remain +KB-04/host activation prerequisites. + +For each operation, check its named permission and current resource scope. +An article's collection is authoritative data loaded by the application, not +an arbitrary client-supplied partition. A move between collections must check +the relevant source and destination authority. Portal and approved bot-answer +audiences remain separate; a broad staff/service context cannot silently widen +the effective customer's answer audience. + +## Authoring, evidence, and exact review + +Compose `createKnowledgeBaseApplication` once with `store` and `clock`, and +optional `limits`, `evidenceVerifier`, and `privateSources`. The full +[application types](../packages/application/src/types.ts) define the command, +result, verifier, and DTO contracts. Keep mutation +commands distinct from trusted contexts: the host supplies actor identity, +clock, current scoped access, and verified external facts. The application +does not take an actor, role list, timestamp, or permission grant from an +untrusted command body as proof of authority. + +| Operation family | Service methods | Required named permission | +| ---------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| Collection policy | `createCollection`, `previewCollectionPolicy`, `updateCollectionPolicy` | `collectionManage`; anonymous portal or bot use additionally needs `publicCollectionApprove` and explicit `approvePublic` | +| Validation/governance | `putValidationPolicy`, `putGovernanceConfiguration`, `getValidationPolicy`, `getGovernanceConfiguration` | `validationManage` | +| Collection staff view | `getCollection` | `collectionRead` | +| Author requirements | `getValidationRequirements` | `draftWrite` or `evidenceSubmit` | +| Drafts | `createDraft`, `updateDraft`; `getDraft` | `draftWrite`; `draftRead` respectively | +| Evidence | `submitEvidence`; `getEvidence`; `revokeEvidence` | `evidenceSubmit`; `evidenceRead`; `evidenceRevoke` respectively | +| Private provenance | `setProvenance`; `getProvenance` | `provenanceWrite`; `provenanceRead`, plus source-resource checks | +| Review | `submitForReview`; `getReview`, `rejectReview` | `reviewSubmit`; `review` respectively | +| Publication | `publishArticle`; `retireArticle` | `publish`; `retire` respectively | +| Portal-safe keyed read | `getPublishedArticle` | `articleRead` and the published collection's current portal audience | + +Names in this table are members of the contracts package's +`knowledgePermissions`; they are permission identifiers, not roles. Resource +and proof checks remain additional requirements. `getPublishedArticle` is a +portal read, not bot-only retrieval. No KB-03 search/bot-retrieval surface is +provided by these methods. + +`getValidationRequirements` returns the current article-kind checks, +validation-policy reference, governance generation, and expected staging +build for authorized authors. It omits trusted attester IDs; full governance +configuration remains an administrative read. + +Use application generation for optimistic mutation commands. Content revision +is only the version of the article text and metadata: + +| Accepted action | Content revision | Application generation | +| ------------------------- | ---------------- | ---------------------- | +| Create draft | 1 | 1 | +| Attach evidence | 1 | 2 | +| Submit exact review | 1 | 3 | +| Publish reviewed revision | 1 | 4 | +| Edit guide | 2 | 5 | + +The numbers illustrate separate fences, not a prescribed command sequence. +Creates use `expectedGeneration: 0`; an existing resource mutation supplies +its exact current generation. Every mutation also supplies `commandId` +and `correlationId`; reuse a stable command ID for the same semantic command. +The service derives actor and operation time from trusted +access/clock inputs. +A concurrent evidence, review, or source-reference mutation changes application +generation even when content revision is unchanged. Stale expected generation +must not overwrite that accepted work. Storage conflicts are retried only +within the configured bound with reloaded state and resource checks. The host +owns access-context freshness and revocation behavior. + +`submitEvidence` accepts an `EvidenceSubmission` plus an opaque receipt string. +`EvidenceVerifier.verify` receives the authenticated access context, current +article revision, complete submission, opaque receipt, and authoritative +governance configuration. It must authenticate the +runner/proof and return a verification receipt bound to the exact article +revision/hash, evidence/check, product/staging build, execution result, and +trusted verifier identity/time. The application may check configured runner/ +verifier membership and freshness after receiving trusted facts. It must not +establish those facts by echoing the caller's `passed` result or attestation. +Missing verification configuration or a null result fails closed; it is not a +testing shortcut for a real integration. + +The verification adapter should be read-only or safely idempotent under a +stable operation/evidence identity: transaction retries do not authorize +duplicate external side effects. Replacing evidence produces a new immutable +version and invalidates pending review. Evidence for an old draft cannot +authorize the edited one. Staging execution and protected artifact upload are +host/local-agent work; the application never fetches submitted URLs or runs +guide steps. + +Review/publication uses exact current content, collection audience policy, +validation policy, applicability, and evidence bindings. A reviewer's scoped +permission is checked at the command boundary; a matching hash is not a signed +capability. Policy/public-collection approval is a separate authorized admin +operation. The initial host configuration keeps anonymous portal/chat use +disabled even though the contract can represent a reviewed public audience. + +## DTO and source privacy boundaries + +Use purpose-specific result types. Published-content results contain approved +article content and safe article metadata only. Private staff authoring/history +results require current named permissions and collection/resource checks. +Never send a raw core `Article` aggregate to a browser customer or support model: +it may contain private draft content, review, evidence, attestation references, +and provenance even when the article is retired. + +Opaque source references require separate current authorization to the source +resource. A staff member's KB permission does not prove they can read a linked +ticket. The application/host must check that authority before exposing private +source metadata or resolving the reference; unavailable source authorization +must not be treated as an allow. Keep raw customer conversations in the owning +support system rather than copying them into KB history. + +`PrivateSourcesVerifier.canRead` checks each private reference returned by +`getProvenance`. The separate `canPublish` and `isCurrent` callbacks attest +source eligibility/currentness without returning source bodies. Nonempty +source snapshots fail closed when those required gates are unavailable. +A portal customer does not need permission to read private source tickets in +order to consume an approved guide; the source-currentness gate still runs +independently for source-bearing published content. + +Published-content reads hydrate the old publication's revision, exact retained +proofs, `publicationReview`, and `publishedProvenance`, using its published +collection/configuration rather than a new draft's collection or metadata. +They must confirm current collection and validation-policy +authority, exact publication bindings, and the required retained evidence +state. Evidence freshness is revalidated at the recorded approval's +`reviewedAt`, preserving approved guidance as evidence ages; new review and +publication commands use the current clock. Governance generation, current +policy/source eligibility, exact retained proof availability, and revocation +remain live gates. Retirement or current policy revocation defeats old pointers. A +separate collection/profile transaction cannot atomically fence all article +partitions: current checks make stale state unusable on subsequent reads; +the implementation must not promise cross-partition atomic revocation. +KB-03 retrieval/search adds its own bounded candidate and final-authority +checks; a KB-02 keyed read is not that search implementation. + +## Replay, failure, and host operation + +Bind a command's ID/fingerprint to the actor, operation, target, and semantic +inputs. `CommandResult` contains `value` and `replayed`. Identical retry +returns the original bounded historical acknowledgement without appending another +Audit event, immutable history version, or causal job. A changed fingerprint +conflicts. Before returning a replay result, recheck current operation and +resource authority. The acknowledgement carries resource ID/generation and +small status/hash/version fields, not article content, evidence, or provenance. +It does not promise that the acknowledged state is current or servable; use +the appropriate current read. An old expected generation may identify an exact +replay, while a new command must match current generation. A retained receipt +cannot restore access after revocation. + +Resource generation, content revision, and opaque store version are distinct: +the first is the application command fence, the second identifies immutable +content, and the last participates in a backend CAS transaction. Persist the +accepted head change, receipt, Audit action, immutable records, and causal jobs +together. No accepted state change depends on an in-process event subscriber +running or a second cross-partition write succeeding. + +Host error mapping must preserve named authorization, conflict, capacity, +invalid-input, missing-resource, and unavailable-dependency outcomes while +returning content-free messages to untrusted callers. Operational logs use +safe IDs/generations and coarse categories; they must not serialize content, +evidence, credentials, full receipts, or source references. Audit remains the +transactional Pegma contract, not a parallel host log format. + +Configured limits govern physical rows/chunks, retained bytes/history, +transaction actions/bytes, conflict attempts, and control reserve. Reaching a +limit produces a visible admission failure before partial acceptance. Do not +increase a lifetime cap to hide an unbounded read, skip the reserve to force a +publish, or delete referenced evidence to make room. See +[COLLECTIONS.md](COLLECTIONS.md) for the component defaults, enforced ceilings, +and byte accounting definition. + +Hosts remain responsible for authorized evidence downloads, retention/deletion, +backup/recovery, blob orphan cleanup, safe Markdown/plain-text rendering, +rate limits, and later worker wakeups/checkpoints. Signed-in web/API integration +and a supervised deployment require their own task evidence. Passing local +application tests does not establish KB-03 retrieval, MCP authentication, +provider ZDR configuration, either real host, or production readiness. + +Built in the open by RetireGolden, LLC. diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 413ccb7..99b393b 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,11 +1,13 @@ # Release operations -## KB-01 status +## Source status -`@pegma/knowledge-base-contracts` and `@pegma/knowledge-base-core` are prepared -at synchronized version `0.1.0`. Both package names are unpublished. KB-01 -establishes packaging checks and the release handoff; it does not publish, -create tags/releases, configure credentials, or enable a publish workflow. +`@pegma/knowledge-base-contracts`, `@pegma/knowledge-base-core`, and +`@pegma/knowledge-base-application` are prepared at synchronized source version +`0.1.0`. All three package names are unpublished. KB-01/KB-02 establish domain +and authorized application source plus packaging checks; their repository +gates determine task completion. They do not publish, create tags/releases, +configure credentials, or enable a publish workflow. Hosts must wait for an exact public registry release. Git branches, copied source, local paths, and unpublished production tarballs are not substitutes. @@ -23,20 +25,20 @@ pnpm test pnpm run release:check ``` -`release:check` packs contracts and then core using npm. Each package's +`release:check` packs contracts, core, then application using npm. Each package's `prepack` builds its own output, so a package cannot silently ship a stale distribution. The checker verifies: - synchronized stable versions, exact internal/Spine pins, ESM/public metadata, - and the two declared runtime/type entry points; + and each package's declared runtime/type entry points; - a package-local README and MIT LICENSE, a build-on-prepack script, and exclusion of `src/**/*.test.ts` from compilation; - npm's artifact inventory containing only package metadata, README, LICENSE, and JavaScript/declaration output and maps under `dist`, with compiled tests excluded and both entry-point files present; - the actual tarball bytes against npm's reported SHA-1 and SHA-512 integrity; -- an isolated consumer installation of both tarballs and successful ESM - imports of both public packages. +- an isolated consumer installation of all three tarballs and successful ESM + imports of all three public packages. The consumer disables install scripts, audit, and funding requests and obtains released external dependencies from the public npm registry. It has no workspace @@ -53,7 +55,7 @@ pnpm run release:pack ``` This runs the same checks, then writes a new `.release/knowledge-base-*` -directory containing the two tarballs and `manifest.json` with their inventory +directory containing the three tarballs and `manifest.json` with their inventory and integrity values. Existing artifact directories are preserved. These files are local preparation artifacts, not proof of a released version or provenance. The checker does not verify a source tag, main ancestry, registry publication, @@ -67,8 +69,10 @@ when implementing the release workflow; this checklist records the Pegma release procedure, not proof that external publisher settings exist. - [ ] Confirm package-name ownership and organization publishing permissions. -- [ ] Complete KB-05's application/adapter and dual-store release criteria for - any additional packages being advertised; do not publish empty packages. +- [ ] Complete KB-05's advertised package/adapter and dual-store release + criteria. KB-02 memory/Azurite evidence does not establish the later D1 + consumer fixture, MCP client flow, or either host's production readiness. + Do not publish empty packages. - [ ] Merge reviewed release source and exact version/pin changes to protected `origin/main`; require every current-head review, test, build, security, and artifact check to pass. diff --git a/package.json b/package.json index 16ae4c1..b0874eb 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,16 @@ "release:pack": "node scripts/release-packages.mjs pack" }, "devDependencies": { + "@azure/data-tables": "13.3.2", + "@pegma/authorization-core": "0.4.0", + "@pegma/knowledge-base-application": "0.1.0", + "@pegma/knowledge-base-contracts": "0.1.0", + "@pegma/knowledge-base-core": "0.1.0", + "@pegma/spine": "0.1.2", + "@pegma/storage-azure-tables": "0.4.0", + "@pegma/storage-core": "0.4.0", "@types/node": "26.6.6", + "azurite": "3.37.0", "prettier": "3.9.10", "typescript": "7.0.2", "vitest": "5.0.5" diff --git a/packages/application/LICENSE b/packages/application/LICENSE new file mode 100644 index 0000000..833a7d0 --- /dev/null +++ b/packages/application/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Pegma + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/application/README.md b/packages/application/README.md new file mode 100644 index 0000000..320e028 --- /dev/null +++ b/packages/application/README.md @@ -0,0 +1,99 @@ +# @pegma/knowledge-base-application + +This unpublished KB-02 source package composes contracts/core with +host-supplied Storage Core, Authorization Core, Audit, and a clock. Source +implementation and repository gates determine KB-02 completion; neither this +package nor local tests establish a live host or production readiness. + +The [declared layout](https://github.com/pegma-dev/knowledge-base/blob/main/docs/COLLECTIONS.md) records the agreement made +before durable operations. [Host composition](https://github.com/pegma-dev/knowledge-base/blob/main/docs/HOST_COMPOSITION.md) describes the host +authentication, current-resource authorization, verified-evidence, and privacy +boundaries. KB-03 retrieval, API/MCP, real-host acceptance, and production +activation remain later tasks. + +The application API owns authorized commands, application-generation CAS, +bounded immutable revision/evidence history, exact review/publication, +transactional Audit/receipts/causal jobs, and safe published-content DTOs. +Collections own audience policy; articles inherit it without per-article ACLs. +Role models, token issuance, sessions, HTTP, provider SDKs, arbitrary URL +fetching, code execution, and a new database are outside this package. + +Passing evidence requires a host-authenticated verifier receipt bound to the +exact submitted evidence. Echoing caller-supplied `passed`, runner identity, +or an attestation object does not establish proof. Command replay likewise +rechecks current permission and resource authority before returning a result. +Never expose raw aggregates or private evidence/source references to customers +or a support model. + +## Composition and commands + +`createKnowledgeBaseApplication` takes `store` and `clock`, with optional +`limits`, `evidenceVerifier`, and `privateSources`. Hosts authenticate callers +and resolve current scoped `AccessContext` values. The +[public types](https://github.com/pegma-dev/knowledge-base/blob/main/packages/application/src/types.ts) define commands and purpose-specific results; +the package owns no HTTP routes or credentials. + +Creates use `expectedGeneration: 0`; later mutations use exact application +generation, which also advances for evidence/review/provenance changes. +Content revision advances only when content changes. All mutation inputs +include a stable `commandId` and observability `correlationId`. The service +derives actor/time from the trusted context and clock. + +Collection/validation/governance commands establish private defaults, current +validation requirements, staging applicability, and trusted attesters. Article +commands create/update drafts, submit verified evidence and review, publish an +exact `ReviewSnapshot`, reject, retire, set private provenance, or revoke an +exact historical proof. The snapshot includes the core approval binding plus +article/source/governance generations. + +`CommandResult` returns `{ value, replayed }`, where `value` is a bounded +historical acknowledgement. It contains no body/evidence/provenance. Replay +rechecks current operation/resource authority, conflicts on changed semantic +input, and does not claim the historical result is currently servable. + +## Reads and trust + +`getDraft`, `getEvidence`, `getProvenance`, and `getReview` have distinct +permissions and DTOs. Private references additionally require current source +resource authorization. `getValidationRequirements` gives authorized authors +current kind-specific checks, policy reference, and staging build without +disclosing trusted attester IDs. `getPublishedArticle` is a portal-safe keyed read: +it checks the published collection's current portal audience and returns only +approved content/safe metadata. It is not KB-03 search or bot-only retrieval. + +`EvidenceVerifier.verify` authenticates an opaque receipt against the entire +submission, authenticated actor, exact article, and governance configuration. +It returns trusted attestation facts or null. A missing verifier fails closed. +`PrivateSourcesVerifier.canRead` controls private reference disclosure; +`canPublish` and `isCurrent` independently attest source eligibility without +making source tickets readable to customers. Missing required gates fail +closed for nonempty source snapshots. + +An existing publication retains its own review/source snapshot and exact +historical proof references while a new draft is prepared. Replacing current +evidence does not revoke an old proof; explicit revocation holds an affected +publication and clears pending review. Current reads reject stale governance +or source authority. Retained evidence freshness is checked at the recorded +approval time; later aging alone does not expire an approved guide. New review +and publication use current time, while current policy/source eligibility, +proof availability, and revocation remain live checks. Article CAS cannot +globally fence separate collection/ +validation-policy partitions. + +## Storage and limits + +All accepted head changes, immutable rows, generic Audit actions, receipts, and +causal jobs share one resource partition in `knowledge-base.records.v1`. +Native flat chunk properties keep bounded rows compatible with the host's +store adapter. The application separately bounds physical rows, encoded bytes, +history, transaction work, retries, and control reserve. Read the +[layout limits](https://github.com/pegma-dev/knowledge-base/blob/main/docs/COLLECTIONS.md#physical-representation-and-hard-bounds) +before changing admission or retention; these are component safety bounds, +not measured host throughput. No private persistence or parallel audit log is +implemented here. + +Merging source does not publish a package. Hosts must wait for the exact public +release and normal release/host activation gates. See +[release operations](https://github.com/pegma-dev/knowledge-base/blob/main/docs/RELEASING.md). + +Built in the open by RetireGolden, LLC. diff --git a/packages/application/package.json b/packages/application/package.json new file mode 100644 index 0000000..9e6b24a --- /dev/null +++ b/packages/application/package.json @@ -0,0 +1,44 @@ +{ + "name": "@pegma/knowledge-base-application", + "version": "0.1.0", + "description": "Authorized knowledge authoring, evidence, review, and publication over Pegma storage.", + "license": "MIT", + "type": "module", + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "files": [ + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist/**/*.js", + "dist/**/*.js.map" + ], + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "engines": { + "node": ">=22" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/pegma-dev/knowledge-base.git", + "directory": "packages/application" + }, + "dependencies": { + "@pegma/audit": "0.2.0", + "@pegma/authorization-core": "0.4.0", + "@pegma/knowledge-base-contracts": "0.1.0", + "@pegma/knowledge-base-core": "0.1.0", + "@pegma/spine": "0.1.2", + "@pegma/storage-core": "0.4.0" + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "check": "tsc -p tsconfig.json --noEmit", + "prepack": "pnpm run --silent build" + } +} diff --git a/packages/application/src/articles.ts b/packages/application/src/articles.ts new file mode 100644 index 0000000..d281c20 --- /dev/null +++ b/packages/application/src/articles.ts @@ -0,0 +1,766 @@ +import type { AccessContext } from "@pegma/authorization-core"; +import { + knowledgePermissions, + type ArticleRevision, + type KnowledgePermission, + type VerificationEvidence, +} from "@pegma/knowledge-base-contracts"; +import { + createArticle, + KnowledgeBaseError, + publishArticle as publishCoreArticle, + recordEvidence, + rejectReview as rejectCoreReview, + retireArticle as retireCoreArticle, + reviseArticle, + submitForReview as submitCoreReview, +} from "@pegma/knowledge-base-core"; + +import { + KnowledgeBaseNotFoundError, + KnowledgeBasePrerequisiteError, + requirePermission, +} from "./errors.js"; +import { loadGovernanceContext } from "./governance.js"; +import { maximumRecordNativeBytes, type StoredArticle } from "./records.js"; +import type { + KnowledgeRepository, + RepositoryCommand, + RepositoryResult, +} from "./repository.js"; +import { + canonicalJson, + fingerprint, + RepositoryCapacityError, + RepositoryConflictError, + RepositoryIntegrityError, + requireGeneration, + requireIdentifier, + snapshotData, +} from "./storage-helpers.js"; +import type { + ArticleAcknowledgement, + ArticleCommandInput, + CommandResult, + KnowledgeBaseApplication, + KnowledgeBaseServiceOptions, + PrivateSourceReference, + ReviewSnapshot, + SourceSnapshot, +} from "./types.js"; + +type ArticleMethods = Pick< + KnowledgeBaseApplication, + | "createDraft" + | "updateDraft" + | "submitEvidence" + | "submitForReview" + | "publishArticle" + | "rejectReview" + | "retireArticle" + | "setProvenance" + | "revokeEvidence" +>; + +type ArticleChange = { + readonly next: Omit; + readonly auditDetails?: Readonly< + Record + >; +}; + +const commandFields = [ + "commandId", + "correlationId", + "expectedGeneration", + "articleId", +] as const; +const maximumSourceReferences = 32; + +function boundedText( + value: unknown, + field: string, + maximum = 1_000, +): asserts value is string { + if ( + typeof value !== "string" || + value.length === 0 || + value.length > maximum || + value.trim() !== value || + /[\u0000-\u001f\u007f]/u.test(value) + ) + throw new TypeError(field + " must be bounded nonempty text"); +} + +function allowedFields( + value: object, + allowed: readonly string[], + field: string, +): void { + if ( + value === null || + typeof value !== "object" || + Array.isArray(value) || + Object.keys(value).some((key) => !allowed.includes(key)) + ) + throw new TypeError(field + " contains unsupported fields"); +} + +function commandSnapshot( + access: AccessContext, + input: T, + permission: KnowledgePermission, + extra: readonly string[], +): { readonly access: AccessContext; readonly input: T } { + const caller = snapshotData(access); + requirePermission(caller, permission); + const encoded = canonicalJson(input); + if (new TextEncoder().encode(encoded).byteLength > maximumRecordNativeBytes) { + throw new RepositoryCapacityError("command_bytes"); + } + const command = JSON.parse(encoded) as T; + allowedFields(command, [...commandFields, ...extra], "command"); + requireIdentifier(caller.principalId, "principalId"); + requireIdentifier(command.articleId, "articleId"); + requireIdentifier(command.commandId, "commandId"); + requireIdentifier(command.correlationId, "correlationId"); + requireGeneration(command.expectedGeneration); + return { access: caller, input: command }; +} + +function requireArticle(current: StoredArticle | null): StoredArticle { + if (current === null) throw new KnowledgeBaseNotFoundError("article"); + return current; +} + +function nextState(current: StoredArticle): Omit { + const { generation: _generation, ...next } = current; + return next; +} + +function withoutPendingReview( + current: StoredArticle, +): Omit { + const { review: _review, ...next } = nextState(current); + return { + ...next, + article: + current.article.state === "in-review" + ? rejectCoreReview(current.article, current.article.current.number) + : current.article, + }; +} + +function acknowledgement( + result: RepositoryResult, +): CommandResult { + return { + value: { + id: result.value.article.id, + generation: result.value.generation, + articleRevision: result.value.article.current.number, + state: result.value.article.state, + contentHash: result.value.article.current.contentHash, + }, + replayed: result.replayed, + }; +} + +function validateReferences( + references: readonly PrivateSourceReference[], +): void { + if ( + !Array.isArray(references) || + references.length > maximumSourceReferences + ) { + throw new RepositoryCapacityError("source_references"); + } + const ids = new Set(); + for (const reference of references) { + allowedFields( + reference, + ["id", "system", "resourceId", "version"], + "source reference", + ); + for (const [field, value] of Object.entries(reference)) { + boundedText(value, "source." + field, 200); + if (value.includes("://")) + throw new TypeError("Source references must use opaque identifiers"); + } + for (const field of ["id", "system", "resourceId", "version"] as const) { + requireIdentifier(reference[field], "source." + field); + } + if (ids.has(reference.id)) + throw new TypeError("Source reference ids must be unique"); + ids.add(reference.id); + } +} + +async function sourceSnapshot( + generation: number, + references: readonly PrivateSourceReference[], +): Promise { + requireGeneration(generation, 1); + validateReferences(references); + const fields = { generation, references: snapshotData(references) }; + return { ...fields, hash: await fingerprint(fields) }; +} + +async function verifySourceSnapshot(snapshot: SourceSnapshot): Promise { + requireGeneration(snapshot.generation, 1); + validateReferences(snapshot.references); + if ( + snapshot.hash !== + (await fingerprint({ + generation: snapshot.generation, + references: snapshot.references, + })) + ) + throw new RepositoryIntegrityError(); +} + +function rejectRevokedCurrentEvidence(current: StoredArticle): void { + if ( + current.revokedEvidence.some( + (revocation) => + revocation.articleRevision === current.article.current.number && + current.article.evidence.some( + (evidence) => + evidence.id === revocation.id && + evidence.version === revocation.version && + evidence.hash === revocation.hash, + ), + ) + ) { + throw new KnowledgeBaseError( + "evidence", + "evidence", + "Current evidence has been revoked", + ); + } +} + +/** + * Instance-wide staff authoring permissions are explicit. Portal/bot audience + * authorization is applied by the separate safe-read services. + */ +export function createArticleServices( + repository: KnowledgeRepository, + options: KnowledgeBaseServiceOptions, +): ArticleMethods { + async function sourcesEligible( + article: ArticleRevision, + snapshot: SourceSnapshot, + ): Promise { + await verifySourceSnapshot(snapshot); + if (snapshot.references.length === 0) return; + const verifier = options.privateSources; + if ( + typeof verifier?.canPublish !== "function" || + typeof verifier.isCurrent !== "function" + ) + throw new KnowledgeBasePrerequisiteError("private-source-verifier"); + try { + const request = { + article: snapshotData(article), + snapshot: snapshotData(snapshot), + }; + if ( + (await verifier.isCurrent(snapshotData(request))) !== true || + (await verifier.canPublish(snapshotData(request))) !== true + ) { + throw new KnowledgeBasePrerequisiteError("source-eligibility"); + } + } catch { + throw new KnowledgeBasePrerequisiteError("source-eligibility"); + } + } + + async function requireSourceAccess( + access: AccessContext, + articleId: string, + references: readonly PrivateSourceReference[], + ): Promise { + validateReferences(references); + if (references.length === 0) return; + const verifier = options.privateSources; + if (typeof verifier?.canRead !== "function") { + throw new KnowledgeBasePrerequisiteError("private-source-verifier"); + } + for (const reference of references) { + try { + if ( + (await verifier.canRead({ + access: snapshotData(access), + articleId, + reference: snapshotData(reference), + })) !== true + ) + throw new KnowledgeBasePrerequisiteError("source-access"); + } catch { + throw new KnowledgeBasePrerequisiteError("source-access"); + } + } + } + + async function execute( + access: AccessContext, + input: T, + permission: KnowledgePermission, + operation: string, + extraFields: readonly string[], + decide: ( + current: StoredArticle | null, + generation: number, + command: T, + caller: AccessContext, + ) => Promise, + control = false, + create = false, + ): Promise> { + const request = commandSnapshot(access, input, permission, extraFields); + if ( + create + ? request.input.expectedGeneration !== 0 + : request.input.expectedGeneration < 1 + ) { + throw new RepositoryConflictError(); + } + const command: RepositoryCommand = { + commandId: request.input.commandId, + correlationId: request.input.correlationId, + actorId: request.access.principalId, + operation, + fingerprint: await fingerprint({ + actorId: request.access.principalId, + operation, + payload: Object.fromEntries( + Object.entries(request.input).filter( + ([field]) => field !== "commandId" && field !== "correlationId", + ), + ), + }), + occurredAt: options.clock.now(), + }; + const result = await repository.executeArticle({ + id: request.input.articleId, + expectedGeneration: request.input.expectedGeneration, + command, + control, + recheck: async (current) => { + requirePermission(request.access, permission); + if (!create) requireArticle(current); + // Authoring is instance-wide, but an ordinary operation/replay still + // confirms its current collection exists. Safety withdrawals do not + // depend on unrelated collection/provider configuration being healthy. + if (current !== null && !control) { + const collection = await repository.readCollectionVersioned( + current.article.current.collectionId, + ); + if (collection === null) + throw new KnowledgeBaseNotFoundError("collection"); + } + }, + decide: async (current, generation) => + decide(current, generation, request.input, request.access), + }); + return acknowledgement(result); + } + + return { + createDraft(access, input) { + return execute( + access, + input, + knowledgePermissions.draftWrite, + "article.create", + ["collectionId", "draft"], + async (current, _generation, command, caller) => { + if (current !== null) throw new RepositoryConflictError(); + requireIdentifier(command.collectionId, "collectionId"); + const governance = await loadGovernanceContext( + repository, + command.collectionId, + options.clock.now(), + ); + const article = await createArticle({ + id: command.articleId, + draft: command.draft, + context: { ...governance.context, actorId: caller.principalId }, + }); + return { + next: { + article, + provenance: await sourceSnapshot(1, []), + publicationHeld: false, + revokedEvidence: [], + }, + }; + }, + false, + true, + ); + }, + + updateDraft(access, input) { + return execute( + access, + input, + knowledgePermissions.draftWrite, + "article.update", + ["collectionId", "draft"], + async (current, _generation, command, caller) => { + const stored = requireArticle(current); + requireIdentifier(command.collectionId, "collectionId"); + const governance = await loadGovernanceContext( + repository, + command.collectionId, + options.clock.now(), + ); + const article = await reviseArticle(stored.article, { + expectedRevision: stored.article.current.number, + draft: command.draft, + context: { ...governance.context, actorId: caller.principalId }, + }); + return { next: { ...withoutPendingReview(stored), article } }; + }, + ); + }, + + submitEvidence(access, input) { + return execute( + access, + input, + knowledgePermissions.evidenceSubmit, + "article.evidence.submit", + ["evidence", "receipt"], + async (current, _generation, command, caller) => { + const stored = requireArticle(current); + boundedText(command.receipt, "receipt", 8_192); + allowedFields( + command.evidence, + [ + "id", + "articleId", + "articleRevision", + "contentHash", + "validationPolicy", + "checkId", + "testKind", + "applicability", + "stagingBuildId", + "steps", + "result", + "executedAt", + "runnerId", + "artifacts", + ], + "evidence submission", + ); + const verifier = options.evidenceVerifier; + if (typeof verifier?.verify !== "function") { + throw new KnowledgeBasePrerequisiteError("evidence-verifier"); + } + const before = await loadGovernanceContext( + repository, + stored.article.current.collectionId, + options.clock.now(), + ); + const collection = await repository.readCollectionVersioned( + stored.article.current.collectionId, + ); + if (collection?.value.configuration === undefined) { + throw new KnowledgeBasePrerequisiteError( + "governance-configuration", + ); + } + let attestation: VerificationEvidence["attestation"] | null; + try { + const verified = await verifier.verify({ + access: snapshotData(caller), + article: snapshotData(stored.article.current), + submission: snapshotData(command.evidence), + receipt: command.receipt, + configuration: snapshotData(collection.value.configuration), + }); + attestation = + verified === null || verified === undefined + ? null + : snapshotData(verified); + } catch { + throw new KnowledgeBasePrerequisiteError("evidence-verifier"); + } + if (attestation === null || attestation === undefined) { + throw new KnowledgeBasePrerequisiteError("evidence-verifier"); + } + const after = await loadGovernanceContext( + repository, + stored.article.current.collectionId, + options.clock.now(), + ); + if ( + before.governanceGeneration !== after.governanceGeneration || + before.validationGeneration !== after.validationGeneration || + collection.value.generation !== before.governanceGeneration + ) + throw new RepositoryConflictError(); + const article = await recordEvidence(stored.article, { + evidence: command.evidence, + attestation, + context: after.context, + }); + return { next: { ...withoutPendingReview(stored), article } }; + }, + ); + }, + + submitForReview(access, input) { + return execute( + access, + input, + knowledgePermissions.reviewSubmit, + "article.review.submit", + [], + async (current, generation) => { + const stored = requireArticle(current); + rejectRevokedCurrentEvidence(stored); + const before = await loadGovernanceContext( + repository, + stored.article.current.collectionId, + options.clock.now(), + ); + await sourcesEligible(stored.article.current, stored.provenance); + const after = await loadGovernanceContext( + repository, + stored.article.current.collectionId, + options.clock.now(), + ); + if ( + before.governanceGeneration !== after.governanceGeneration || + before.validationGeneration !== after.validationGeneration + ) + throw new RepositoryConflictError(); + const article = await submitCoreReview(stored.article, { + expectedRevision: stored.article.current.number, + context: after.context, + }); + if (article.review === undefined) + throw new RepositoryIntegrityError(); + const review: ReviewSnapshot = { + articleGeneration: generation, + binding: article.review, + sourceSnapshotHash: stored.provenance.hash, + sourceGeneration: stored.provenance.generation, + governanceGeneration: after.governanceGeneration, + }; + return { next: { ...nextState(stored), article, review } }; + }, + ); + }, + + publishArticle(access, input) { + return execute( + access, + input, + knowledgePermissions.publish, + "article.publish", + ["review"], + async (current, _generation, command, caller) => { + const stored = requireArticle(current); + rejectRevokedCurrentEvidence(stored); + if ( + stored.review === undefined || + stored.review.articleGeneration !== stored.generation || + canonicalJson(stored.review) !== canonicalJson(command.review) || + stored.review.sourceGeneration !== stored.provenance.generation || + stored.review.sourceSnapshotHash !== stored.provenance.hash + ) + throw new RepositoryConflictError(); + const before = await loadGovernanceContext( + repository, + stored.article.current.collectionId, + options.clock.now(), + ); + if ( + before.governanceGeneration !== stored.review.governanceGeneration + ) { + throw new RepositoryConflictError(); + } + await sourcesEligible(stored.article.current, stored.provenance); + const after = await loadGovernanceContext( + repository, + stored.article.current.collectionId, + options.clock.now(), + ); + if ( + before.governanceGeneration !== after.governanceGeneration || + before.validationGeneration !== after.validationGeneration + ) + throw new RepositoryConflictError(); + const article = await publishCoreArticle(stored.article, { + expectedRevision: stored.article.current.number, + binding: stored.review.binding, + reviewerId: caller.principalId, + context: after.context, + }); + return { + next: { + ...withoutPendingReview(stored), + article, + publicationHeld: false, + publishedProvenance: stored.provenance, + publicationReview: stored.review, + }, + }; + }, + ); + }, + + rejectReview(access, input) { + return execute( + access, + input, + knowledgePermissions.review, + "article.review.reject", + ["reason"], + async (current, _generation, command) => { + const stored = requireArticle(current); + boundedText(command.reason, "reason"); + const article = rejectCoreReview( + stored.article, + stored.article.current.number, + ); + return { + next: { ...withoutPendingReview(stored), article }, + auditDetails: { reason: command.reason }, + }; + }, + ); + }, + + retireArticle(access, input) { + return execute( + access, + input, + knowledgePermissions.retire, + "article.retire", + [], + async (current) => { + const stored = requireArticle(current); + const { + publishedProvenance: _publishedProvenance, + publicationReview: _publicationReview, + ...rest + } = withoutPendingReview(stored); + return { + next: { + ...rest, + article: retireCoreArticle( + stored.article, + stored.article.current.number, + ), + publicationHeld: true, + }, + }; + }, + true, + ); + }, + + setProvenance(access, input) { + return execute( + access, + input, + knowledgePermissions.provenanceWrite, + "article.provenance.set", + ["references"], + async (current, _generation, command, caller) => { + const stored = requireArticle(current); + await requireSourceAccess( + caller, + command.articleId, + command.references, + ); + const provenance = await sourceSnapshot( + stored.provenance.generation + 1, + command.references, + ); + return { next: { ...withoutPendingReview(stored), provenance } }; + }, + ); + }, + + revokeEvidence(access, input) { + return execute( + access, + input, + knowledgePermissions.evidenceRevoke, + "article.evidence.revoke", + [ + "articleRevision", + "evidenceId", + "evidenceVersion", + "evidenceHash", + "reason", + ], + async (current, _generation, command, caller) => { + const stored = requireArticle(current); + requireGeneration(command.articleRevision, 1); + requireGeneration(command.evidenceVersion, 1); + requireIdentifier(command.evidenceId, "evidenceId"); + boundedText(command.reason, "reason"); + if (!/^[a-f0-9]{64}$/u.test(command.evidenceHash)) + throw new TypeError("Evidence hash must be SHA-256"); + const evidence = await repository.getEvidenceVersion( + command.articleId, + command.articleRevision, + command.evidenceId, + command.evidenceVersion, + ); + if (evidence === null || evidence.hash !== command.evidenceHash) { + throw new KnowledgeBaseNotFoundError("evidence"); + } + if ( + stored.revokedEvidence.some( + (marker) => marker.hash === evidence.hash, + ) + ) { + throw new RepositoryConflictError(); + } + const revocation = { + articleRevision: evidence.articleRevision, + id: evidence.id, + version: evidence.version, + hash: evidence.hash, + reason: command.reason, + revokedBy: caller.principalId, + revokedAt: options.clock.now(), + }; + const published = stored.article.published; + const referencesPublished = + published !== undefined && + published.revision.number === evidence.articleRevision && + published.approval.binding.evidence.some( + (binding) => + binding.id === evidence.id && + binding.version === evidence.version && + binding.hash === evidence.hash, + ); + return { + next: { + ...withoutPendingReview(stored), + publicationHeld: stored.publicationHeld || referencesPublished, + revokedEvidence: [...stored.revokedEvidence, revocation], + }, + auditDetails: { + evidenceId: evidence.id, + evidenceVersion: evidence.version, + reason: command.reason, + }, + }; + }, + true, + ); + }, + }; +} diff --git a/packages/application/src/errors.ts b/packages/application/src/errors.ts new file mode 100644 index 0000000..38700a3 --- /dev/null +++ b/packages/application/src/errors.ts @@ -0,0 +1,34 @@ +import { hasPermission, type AccessContext } from "@pegma/authorization-core"; + +/** Missing effective permission; hosts authenticate callers before this layer. */ +export class KnowledgeBaseAuthorizationError extends Error { + constructor(readonly permission: string) { + super("Knowledge permission is required: " + permission); + this.name = "KnowledgeBaseAuthorizationError"; + } +} + +/** Use the same unavailable result for absent and inaccessible portal content. */ +export class KnowledgeBaseNotFoundError extends Error { + constructor(readonly resource: string) { + super("Knowledge resource is unavailable: " + resource); + this.name = "KnowledgeBaseNotFoundError"; + } +} + +/** A trusted verifier or authoritative configuration is not ready. */ +export class KnowledgeBasePrerequisiteError extends Error { + constructor(readonly prerequisite: string) { + super("Knowledge prerequisite is not ready: " + prerequisite); + this.name = "KnowledgeBasePrerequisiteError"; + } +} + +export function requirePermission( + access: AccessContext, + permission: string, +): void { + if (!hasPermission(access, permission)) { + throw new KnowledgeBaseAuthorizationError(permission); + } +} diff --git a/packages/application/src/governance.ts b/packages/application/src/governance.ts new file mode 100644 index 0000000..d3da5d5 --- /dev/null +++ b/packages/application/src/governance.ts @@ -0,0 +1,471 @@ +import type { AccessContext } from "@pegma/authorization-core"; +import { + knowledgePermissions, + type CollectionPolicy, + type IsoTimestamp, +} from "@pegma/knowledge-base-contracts"; +import { + applyCollectionPolicy, + createCollection, + KnowledgeBaseError, + knowledgeLimits, + previewCollectionPolicy, + validateValidationPolicy, + type ReviewContext, +} from "@pegma/knowledge-base-core"; + +import { + KnowledgeBaseNotFoundError, + KnowledgeBasePrerequisiteError, + requirePermission, +} from "./errors.js"; +import type { KnowledgeRepository, RepositoryCommand } from "./repository.js"; +import { + canonicalJson, + commandFingerprint, + RepositoryConflictError, + requireGeneration, + requireIdentifier, + snapshotData, +} from "./storage-helpers.js"; +import type { + CommandInput, + GovernanceConfiguration, + KnowledgeBaseApplication, + KnowledgeBaseServiceOptions, +} from "./types.js"; + +export { requirePermission } from "./errors.js"; + +function dataInput(value: T, fields: readonly string[]): T { + const snapshot = snapshotData(value); + if ( + snapshot === null || + typeof snapshot !== "object" || + Array.isArray(snapshot) || + Object.keys(snapshot).some((field) => !fields.includes(field)) + ) { + throw new TypeError("Command contains unsupported fields"); + } + return snapshot; +} + +function mutationInput( + value: T, + fields: readonly string[], +): T { + const input = dataInput(value, [ + "commandId", + "correlationId", + "expectedGeneration", + ...fields, + ]); + requireIdentifier(input.commandId, "commandId"); + requireIdentifier(input.correlationId, "correlationId"); + requireGeneration(input.expectedGeneration); + return input; +} + +function trustedTime(options: KnowledgeBaseServiceOptions): IsoTimestamp { + const at = options.clock.now(); + if ( + typeof at !== "string" || + !Number.isFinite(Date.parse(at)) || + new Date(at).toISOString() !== at + ) { + throw new TypeError("Clock must return a canonical ISO timestamp"); + } + return at; +} + +async function repositoryCommand( + access: AccessContext, + input: CommandInput, + operation: string, + options: KnowledgeBaseServiceOptions, +): Promise { + requireIdentifier(access.principalId, "principalId"); + const { commandId, correlationId, ...payload } = input; + return { + commandId, + correlationId, + actorId: access.principalId, + operation, + fingerprint: await commandFingerprint({ + actorId: access.principalId, + operation, + payload, + }), + occurredAt: trustedTime(options), + }; +} + +function anonymousUse(policy: CollectionPolicy): boolean { + return [policy.portal, policy.bot].some( + (use) => use.enabled && use.audience.kind === "anonymous", + ); +} + +function validateConfiguration(value: GovernanceConfiguration): void { + const fields = [ + "validationPolicy", + "expectedStagingBuildId", + "trustedAttesterIds", + ]; + if ( + value === null || + typeof value !== "object" || + Object.keys(value).some((field) => !fields.includes(field)) + ) { + throw new TypeError("Governance configuration contains unsupported fields"); + } + const policy = value.validationPolicy; + if ( + policy === null || + typeof policy !== "object" || + Array.isArray(policy) || + Object.keys(policy).some((field) => field !== "id" && field !== "version") + ) { + throw new TypeError("A validation policy reference is required"); + } + requireIdentifier(policy.id, "validationPolicy.id"); + requireGeneration(policy.version, 1); + requireIdentifier(value.expectedStagingBuildId, "expectedStagingBuildId"); + if ( + !Array.isArray(value.trustedAttesterIds) || + value.trustedAttesterIds.length === 0 || + value.trustedAttesterIds.length > knowledgeLimits.trustedIdentities || + new Set(value.trustedAttesterIds).size !== value.trustedAttesterIds.length + ) { + throw new TypeError( + "Trusted attesters must be a bounded unique nonempty list", + ); + } + for (const id of value.trustedAttesterIds) + requireIdentifier(id, "attesterId"); +} + +export interface CurrentGovernanceContext { + readonly context: ReviewContext; + readonly governanceGeneration: number; + readonly validationGeneration: number; +} + +/** Load authoritative application facts; author input cannot supply this context. */ +export async function loadGovernanceContext( + repository: KnowledgeRepository, + collectionId: string, + at: IsoTimestamp, +): Promise { + requireIdentifier(collectionId, "collectionId"); + const collection = await repository.readCollectionVersioned(collectionId); + if (collection === null) throw new KnowledgeBaseNotFoundError("collection"); + const configuration = collection.value.configuration; + if (configuration === undefined) { + throw new KnowledgeBasePrerequisiteError("collection_configuration"); + } + validateConfiguration(configuration); + const validation = await repository.readValidationPolicyVersioned( + configuration.validationPolicy.id, + ); + if ( + validation === null || + validation.value.policy.id !== configuration.validationPolicy.id || + validation.value.policy.version !== configuration.validationPolicy.version + ) { + throw new KnowledgeBasePrerequisiteError("current_validation_policy"); + } + validateValidationPolicy(validation.value.policy); + const current = await repository.readCollectionVersioned(collectionId); + if ( + current === null || + current.value.generation !== collection.value.generation + ) { + throw new RepositoryConflictError(); + } + return snapshotData({ + context: { + collection: collection.value.collection, + validationPolicy: validation.value.policy, + expectedStagingBuildId: configuration.expectedStagingBuildId, + trustedAttesterIds: configuration.trustedAttesterIds, + at, + }, + governanceGeneration: collection.value.generation, + validationGeneration: validation.value.generation, + }); +} + +export function createGovernanceServices( + repository: KnowledgeRepository, + options: KnowledgeBaseServiceOptions, +): Pick< + KnowledgeBaseApplication, + | "createCollection" + | "previewCollectionPolicy" + | "updateCollectionPolicy" + | "putValidationPolicy" + | "putGovernanceConfiguration" +> { + return { + async createCollection(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.collectionManage); + const input = mutationInput(request, ["collectionId", "name"]); + requireIdentifier(input.collectionId, "collectionId"); + const command = await repositoryCommand( + access, + input, + "knowledge.collection.created", + options, + ); + const result = await repository.executeCollection({ + id: input.collectionId, + command, + expectedGeneration: input.expectedGeneration, + recheck: async () => { + requirePermission(access, knowledgePermissions.collectionManage); + }, + decide: async (current) => { + if (current !== null || input.expectedGeneration !== 0) { + throw new RepositoryConflictError(); + } + return { + next: { + collection: createCollection({ + id: input.collectionId, + name: input.name, + actorId: access.principalId, + at: command.occurredAt, + }), + }, + }; + }, + }); + return { + value: { + id: result.value.collection.id, + generation: result.value.generation, + policyVersion: result.value.collection.policy.version, + }, + replayed: result.replayed, + }; + }, + + async previewCollectionPolicy(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.collectionManage); + const input = dataInput(request, ["collectionId", "uses"]); + requireIdentifier(input.collectionId, "collectionId"); + const current = await repository.readCollectionVersioned( + input.collectionId, + ); + if (current === null) throw new KnowledgeBaseNotFoundError("collection"); + const uses = dataInput(input.uses, ["portal", "bot"]); + const preview = await previewCollectionPolicy( + current.value.collection, + uses, + ); + requirePermission(access, knowledgePermissions.collectionManage); + const latest = await repository.readCollectionVersioned( + input.collectionId, + ); + if ( + latest === null || + latest.value.generation !== current.value.generation + ) { + throw new RepositoryConflictError(); + } + return snapshotData({ generation: current.value.generation, preview }); + }, + + async updateCollectionPolicy(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.collectionManage); + const input = mutationInput(request, [ + "collectionId", + "preview", + "approvePublic", + ]); + requireIdentifier(input.collectionId, "collectionId"); + if ( + input.approvePublic !== undefined && + typeof input.approvePublic !== "boolean" + ) { + throw new TypeError("approvePublic must be an explicit boolean"); + } + const requiresPublicApproval = anonymousUse(input.preview.policy); + const recheck = async () => { + requirePermission(access, knowledgePermissions.collectionManage); + if (requiresPublicApproval) { + requirePermission( + access, + knowledgePermissions.publicCollectionApprove, + ); + if (input.approvePublic !== true) { + throw new KnowledgeBaseError( + "conflict", + "publicApproval", + "Explicit public approval is required", + ); + } + } + }; + await recheck(); + const command = await repositoryCommand( + access, + input, + "knowledge.collection.policy_changed", + options, + ); + const result = await repository.executeCollection({ + id: input.collectionId, + command, + expectedGeneration: input.expectedGeneration, + control: + !input.preview.policy.portal.enabled && + !input.preview.policy.bot.enabled, + recheck, + decide: async (current) => { + if (current === null) + throw new KnowledgeBaseNotFoundError("collection"); + const preview = await previewCollectionPolicy(current.collection, { + portal: input.preview.policy.portal, + bot: input.preview.policy.bot, + }); + if (canonicalJson(preview) !== canonicalJson(input.preview)) + throw new RepositoryConflictError(); + const collection = await applyCollectionPolicy(current.collection, { + preview, + actorId: access.principalId, + at: command.occurredAt, + ...(requiresPublicApproval + ? { + publicApproval: { + collectionId: current.collection.id, + policyVersion: preview.policy.version, + policyHash: preview.policyHash, + reviewerId: access.principalId, + reviewedAt: command.occurredAt, + }, + } + : {}), + }); + return { + next: { + collection, + ...(current.configuration === undefined + ? {} + : { configuration: current.configuration }), + }, + auditDetails: { policyVersion: collection.policy.version }, + }; + }, + }); + return { + value: { + id: result.value.collection.id, + generation: result.value.generation, + policyVersion: result.value.collection.policy.version, + }, + replayed: result.replayed, + }; + }, + + async putValidationPolicy(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.validationManage); + const input = mutationInput(request, ["policy"]); + validateValidationPolicy(input.policy); + const command = await repositoryCommand( + access, + input, + "knowledge.validation.policy_changed", + options, + ); + const result = await repository.executeValidationPolicy({ + id: input.policy.id, + command, + expectedGeneration: input.expectedGeneration, + recheck: async () => { + requirePermission(access, knowledgePermissions.validationManage); + }, + decide: async (current) => { + const expectedVersion = + current === null ? 1 : current.policy.version + 1; + if (input.policy.version !== expectedVersion) + throw new RepositoryConflictError(); + return { + next: { policy: input.policy }, + auditDetails: { policyVersion: input.policy.version }, + }; + }, + }); + return { + value: { + id: result.value.policy.id, + generation: result.value.generation, + version: result.value.policy.version, + }, + replayed: result.replayed, + }; + }, + + async putGovernanceConfiguration(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.validationManage); + const input = mutationInput(request, ["collectionId", "configuration"]); + requireIdentifier(input.collectionId, "collectionId"); + validateConfiguration(input.configuration); + const command = await repositoryCommand( + access, + input, + "knowledge.collection.configuration_changed", + options, + ); + const result = await repository.executeCollection({ + id: input.collectionId, + command, + expectedGeneration: input.expectedGeneration, + recheck: async () => { + requirePermission(access, knowledgePermissions.validationManage); + }, + decide: async (current) => { + if (current === null) + throw new KnowledgeBaseNotFoundError("collection"); + const validation = await repository.readValidationPolicyVersioned( + input.configuration.validationPolicy.id, + ); + if ( + validation === null || + canonicalJson(input.configuration.validationPolicy) !== + canonicalJson({ + id: validation.value.policy.id, + version: validation.value.policy.version, + }) + ) { + throw new KnowledgeBasePrerequisiteError( + "current_validation_policy", + ); + } + validateValidationPolicy(validation.value.policy); + return { + next: { + collection: current.collection, + configuration: input.configuration, + }, + auditDetails: { policyVersion: validation.value.policy.version }, + }; + }, + }); + return { + value: { + id: result.value.collection.id, + generation: result.value.generation, + policyVersion: result.value.collection.policy.version, + }, + replayed: result.replayed, + }; + }, + }; +} diff --git a/packages/application/src/index.ts b/packages/application/src/index.ts new file mode 100644 index 0000000..6223999 --- /dev/null +++ b/packages/application/src/index.ts @@ -0,0 +1,45 @@ +import { createArticleServices } from "./articles.js"; +import { createGovernanceServices } from "./governance.js"; +import { createReadServices } from "./reads.js"; +import { createKnowledgeRepository } from "./repository.js"; +import type { + KnowledgeBaseApplication, + KnowledgeBaseApplicationOptions, + KnowledgeBaseServiceOptions, +} from "./types.js"; + +/** Compose one isolated instance over the host's Store and trusted ports. */ +export function createKnowledgeBaseApplication( + options: KnowledgeBaseApplicationOptions, +): KnowledgeBaseApplication { + const repository = createKnowledgeRepository(options.store, options.limits); + const services: KnowledgeBaseServiceOptions = { + clock: options.clock, + ...(options.evidenceVerifier === undefined + ? {} + : { evidenceVerifier: options.evidenceVerifier }), + ...(options.privateSources === undefined + ? {} + : { privateSources: options.privateSources }), + }; + return Object.freeze({ + ...createArticleServices(repository, services), + ...createGovernanceServices(repository, services), + ...createReadServices(repository, services), + }); +} + +export { + KnowledgeBaseAuthorizationError, + KnowledgeBaseNotFoundError, + KnowledgeBasePrerequisiteError, +} from "./errors.js"; +export { knowledgeRecords, type KnowledgeRecord } from "./records.js"; +export type { KnowledgeRepositoryLimits } from "./repository.js"; +export { + RepositoryCapacityError, + RepositoryConflictError, + RepositoryIntegrityError, +} from "./storage-helpers.js"; +export type * from "./types.js"; +export { knowledgePermissions } from "@pegma/knowledge-base-contracts"; diff --git a/packages/application/src/reads.ts b/packages/application/src/reads.ts new file mode 100644 index 0000000..74c42eb --- /dev/null +++ b/packages/application/src/reads.ts @@ -0,0 +1,498 @@ +import { hasPermission } from "@pegma/authorization-core"; +import { + articleKinds, + knowledgePermissions, + type Article, + type IsoTimestamp, + type VerificationEvidence, +} from "@pegma/knowledge-base-contracts"; +import { + isPublicationBoundToCurrentPolicies, + KnowledgeBaseError, + knowledgeLimits, + publishArticle, +} from "@pegma/knowledge-base-core"; + +import { + KnowledgeBaseNotFoundError, + KnowledgeBasePrerequisiteError, + requirePermission, +} from "./errors.js"; +import { loadGovernanceContext } from "./governance.js"; +import type { StoredArticle } from "./records.js"; +import type { KnowledgeRepository } from "./repository.js"; +import { + canonicalJson, + RepositoryConflictError, + RepositoryIntegrityError, + requireIdentifier, + snapshotData, +} from "./storage-helpers.js"; +import type { + KnowledgeBaseApplication, + KnowledgeBaseServiceOptions, + PrivateSourceReference, + SourceSnapshot, +} from "./types.js"; + +function readInput( + value: T, + field: string, + extra: readonly string[] = [], +): T { + const input = snapshotData(value); + if ( + input === null || + typeof input !== "object" || + Array.isArray(input) || + Object.keys(input).some((key) => key !== field && !extra.includes(key)) + ) { + throw new TypeError("Read contains unsupported fields"); + } + requireIdentifier((input as Record)[field]!, field); + return input; +} + +function clockTime(options: KnowledgeBaseServiceOptions): IsoTimestamp { + const at = options.clock.now(); + if ( + typeof at !== "string" || + !Number.isFinite(Date.parse(at)) || + new Date(at).toISOString() !== at + ) { + throw new TypeError("Clock must return a canonical ISO timestamp"); + } + return at; +} + +async function requiredArticle( + repository: KnowledgeRepository, + articleId: string, +): Promise { + const current = await repository.readArticleVersioned(articleId); + if (current === null) throw new KnowledgeBaseNotFoundError("article"); + return current.value; +} + +function snapshotReferences( + snapshot: SourceSnapshot, +): readonly PrivateSourceReference[] { + if (!Array.isArray(snapshot.references) || snapshot.references.length > 32) { + throw new RepositoryIntegrityError(); + } + return snapshot.references; +} + +/** Resolve only the bounded exact versions named by a retained publication. */ +async function publishedEvidence( + repository: KnowledgeRepository, + current: StoredArticle, +): Promise { + const published = current.article.published; + if (published === undefined) return []; + const binding = published.approval.binding; + if ( + !Array.isArray(binding.evidence) || + binding.evidence.length > knowledgeLimits.evidence + ) { + throw new RepositoryIntegrityError(); + } + return Promise.all( + binding.evidence.map(async (reference) => { + const [evidence, revoked] = await Promise.all([ + repository.getEvidenceVersion( + current.article.id, + published.revision.number, + reference.id, + reference.version, + ), + repository.isEvidenceRevoked(current.article.id, reference.hash), + ]); + if (evidence === null || revoked || evidence.hash !== reference.hash) { + throw new KnowledgeBaseNotFoundError("article"); + } + return evidence; + }), + ); +} + +/** Explicit keyed staff reads and a separately authorized portal-only read. */ +export function createReadServices( + repository: KnowledgeRepository, + options: KnowledgeBaseServiceOptions, +): Pick< + KnowledgeBaseApplication, + | "getCollection" + | "getValidationPolicy" + | "getGovernanceConfiguration" + | "getValidationRequirements" + | "getDraft" + | "getEvidence" + | "getProvenance" + | "getReview" + | "getPublishedArticle" +> { + return { + async getCollection(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.collectionRead); + const input = readInput(request, "collectionId"); + const current = await repository.readCollectionVersioned( + input.collectionId, + ); + if (current === null) throw new KnowledgeBaseNotFoundError("collection"); + requirePermission(access, knowledgePermissions.collectionRead); + return snapshotData({ + generation: current.value.generation, + collection: current.value.collection, + }); + }, + + async getValidationPolicy(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.validationManage); + const input = readInput(request, "policyId"); + const current = await repository.readValidationPolicyVersioned( + input.policyId, + ); + if (current === null) + throw new KnowledgeBaseNotFoundError("validation_policy"); + requirePermission(access, knowledgePermissions.validationManage); + return snapshotData({ + generation: current.value.generation, + policy: current.value.policy, + }); + }, + + async getGovernanceConfiguration(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.validationManage); + const input = readInput(request, "collectionId"); + const current = await repository.readCollectionVersioned( + input.collectionId, + ); + if (current === null || current.value.configuration === undefined) { + throw new KnowledgeBaseNotFoundError("governance_configuration"); + } + requirePermission(access, knowledgePermissions.validationManage); + return snapshotData({ + collectionId: input.collectionId, + generation: current.value.generation, + configuration: current.value.configuration, + }); + }, + + async getValidationRequirements(access, request) { + access = snapshotData(access); + const authorize = () => { + if (!hasPermission(access, knowledgePermissions.evidenceSubmit)) { + requirePermission(access, knowledgePermissions.draftWrite); + } + }; + authorize(); + const input = readInput(request, "collectionId", ["kind"]); + if (!articleKinds.includes(input.kind)) { + throw new TypeError("Unknown article kind"); + } + const governance = await loadGovernanceContext( + repository, + input.collectionId, + clockTime(options), + ); + const [collection, validation] = await Promise.all([ + repository.readCollectionVersioned(input.collectionId), + repository.readValidationPolicyVersioned( + governance.context.validationPolicy.id, + ), + ]); + if ( + collection === null || + collection.value.generation !== governance.governanceGeneration || + validation === null || + validation.value.generation !== governance.validationGeneration + ) { + throw new RepositoryConflictError(); + } + authorize(); + return snapshotData({ + collectionId: input.collectionId, + governanceGeneration: governance.governanceGeneration, + validationPolicy: { + id: governance.context.validationPolicy.id, + version: governance.context.validationPolicy.version, + }, + expectedStagingBuildId: governance.context.expectedStagingBuildId, + checks: governance.context.validationPolicy.requirements + .filter((check) => check.kind === input.kind) + .map((check) => ({ + id: check.id, + testKind: check.testKind, + maxAgeMilliseconds: check.maxAgeMilliseconds, + })), + }); + }, + + async getDraft(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.draftRead); + const input = readInput(request, "articleId"); + const current = await requiredArticle(repository, input.articleId); + requirePermission(access, knowledgePermissions.draftRead); + return snapshotData({ + articleId: current.article.id, + generation: current.generation, + state: current.article.state, + revision: current.article.current, + hasPendingReview: current.review !== undefined, + hasPublication: current.article.published !== undefined, + publicationHeld: current.publicationHeld, + }); + }, + + async getEvidence(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.evidenceRead); + const input = readInput(request, "articleId"); + const current = await requiredArticle(repository, input.articleId); + requirePermission(access, knowledgePermissions.evidenceRead); + return snapshotData({ + articleId: current.article.id, + generation: current.generation, + evidence: current.article.evidence, + revokedEvidence: current.revokedEvidence, + }); + }, + + async getProvenance(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.provenanceRead); + const input = readInput(request, "articleId"); + const current = await requiredArticle(repository, input.articleId); + const snapshots = [ + current.provenance, + ...(current.publishedProvenance === undefined + ? [] + : [current.publishedProvenance]), + ]; + const references = new Map(); + for (const source of snapshots) { + for (const reference of snapshotReferences(source)) + references.set(canonicalJson(reference), reference); + } + if (references.size > 0) { + const verifier = options.privateSources; + if (verifier === undefined || typeof verifier.canRead !== "function") { + throw new KnowledgeBasePrerequisiteError("source_access_verifier"); + } + let allowed: readonly boolean[]; + try { + allowed = await Promise.all( + [...references.values()].map((reference) => + verifier.canRead({ + access: snapshotData(access), + articleId: input.articleId, + reference: snapshotData(reference), + }), + ), + ); + } catch { + throw new KnowledgeBasePrerequisiteError("source_access_verifier"); + } + if (allowed.some((value) => value !== true)) + throw new KnowledgeBaseNotFoundError("provenance"); + } + requirePermission(access, knowledgePermissions.provenanceRead); + const latest = await requiredArticle(repository, input.articleId); + if (latest.generation !== current.generation) + throw new RepositoryConflictError(); + requirePermission(access, knowledgePermissions.provenanceRead); + return snapshotData({ + articleId: current.article.id, + generation: current.generation, + snapshot: current.provenance, + ...(current.publishedProvenance === undefined + ? {} + : { publishedSnapshot: current.publishedProvenance }), + }); + }, + + async getReview(access, request) { + access = snapshotData(access); + requirePermission(access, knowledgePermissions.review); + const input = readInput(request, "articleId"); + const current = await requiredArticle(repository, input.articleId); + if (current.review === undefined) + throw new KnowledgeBaseNotFoundError("review"); + requirePermission(access, knowledgePermissions.review); + return snapshotData({ + articleId: current.article.id, + generation: current.generation, + review: current.review, + }); + }, + + async getPublishedArticle(access, request) { + access = snapshotData(access); + const input = readInput(request, "articleId"); + const unavailable = () => new KnowledgeBaseNotFoundError("article"); + if (!hasPermission(access, knowledgePermissions.articleRead)) + throw unavailable(); + const current = await requiredArticle(repository, input.articleId); + const publication = current.article.published; + const review = current.publicationReview; + if ( + current.article.state === "retired" || + current.publicationHeld || + publication === undefined || + review === undefined + ) + throw unavailable(); + try { + const at = clockTime(options); + const governance = await loadGovernanceContext( + repository, + publication.revision.collectionId, + at, + ); + const portal = governance.context.collection.policy.portal; + if ( + !portal.enabled || + (portal.audience.kind === "permission" && + !hasPermission(access, portal.audience.permission)) + ) + throw unavailable(); + if ( + review.governanceGeneration !== governance.governanceGeneration || + canonicalJson(review.binding) !== + canonicalJson(publication.approval.binding) + ) + throw unavailable(); + const source = current.publishedProvenance; + if ( + source === undefined || + source.hash !== review.sourceSnapshotHash || + source.generation !== review.sourceGeneration + ) + throw unavailable(); + const references = snapshotReferences(source); + if (references.length > 0) { + const verifier = options.privateSources; + if ( + verifier === undefined || + typeof verifier.canPublish !== "function" || + typeof verifier.isCurrent !== "function" + ) + throw unavailable(); + let sourceEligibility: readonly boolean[]; + try { + sourceEligibility = await Promise.all([ + verifier.canPublish({ + article: snapshotData(publication.revision), + snapshot: snapshotData(source), + }), + verifier.isCurrent({ + article: snapshotData(publication.revision), + snapshot: snapshotData(source), + }), + ]); + } catch { + throw unavailable(); + } + if (sourceEligibility.some((allowed) => allowed !== true)) + throw unavailable(); + } + const [revision, evidence] = await Promise.all([ + repository.getArticleRevision( + current.article.id, + publication.revision.number, + ), + publishedEvidence(repository, current), + ]); + if ( + revision === null || + canonicalJson(revision) !== canonicalJson(publication.revision) + ) + throw unavailable(); + if ( + !(await isPublicationBoundToCurrentPolicies( + current.article, + governance.context.collection, + governance.context.validationPolicy, + )) + ) + throw unavailable(); + const proof: Article = { + id: current.article.id, + state: "in-review", + current: revision, + evidence, + review: publication.approval.binding, + }; + const approvedAt = publication.approval.reviewedAt; + if ( + typeof approvedAt !== "string" || + !Number.isFinite(Date.parse(approvedAt)) || + new Date(approvedAt).toISOString() !== approvedAt || + Date.parse(approvedAt) > Date.parse(at) || + Date.parse(approvedAt) < Date.parse(revision.createdAt) + ) + throw unavailable(); + // Evidence maxAge applies at approval; live revocation and authority still gate every read. + await publishArticle(proof, { + expectedRevision: revision.number, + binding: publication.approval.binding, + reviewerId: publication.approval.reviewerId, + context: { ...governance.context, at: approvedAt }, + }); + const [latestArticle, latestCollection, latestValidation] = + await Promise.all([ + repository.readArticleVersioned(input.articleId), + repository.readCollectionVersioned( + publication.revision.collectionId, + ), + repository.readValidationPolicyVersioned( + governance.context.validationPolicy.id, + ), + ]); + if ( + !hasPermission(access, knowledgePermissions.articleRead) || + latestArticle === null || + latestArticle.value.generation !== current.generation || + latestCollection === null || + latestCollection.value.generation !== + governance.governanceGeneration || + latestValidation === null || + latestValidation.value.generation !== governance.validationGeneration + ) + throw unavailable(); + if ( + portal.audience.kind === "permission" && + !hasPermission(access, portal.audience.permission) + ) + throw unavailable(); + return snapshotData({ + articleId: current.article.id, + collectionId: revision.collectionId, + revision: revision.number, + kind: revision.kind, + title: revision.title, + summary: revision.summary, + content: revision.content, + tags: revision.tags, + applicability: revision.applicability, + contentHash: revision.contentHash, + }); + } catch (error) { + if ( + error instanceof KnowledgeBaseError || + error instanceof KnowledgeBaseNotFoundError || + error instanceof KnowledgeBasePrerequisiteError || + error instanceof RepositoryConflictError || + error instanceof RepositoryIntegrityError + ) + throw unavailable(); + throw error; + } + }, + }; +} diff --git a/packages/application/src/records.ts b/packages/application/src/records.ts new file mode 100644 index 0000000..2c93acb --- /dev/null +++ b/packages/application/src/records.ts @@ -0,0 +1,198 @@ +import { defineCollection, type StoredRecord } from "@pegma/storage-core"; +import type { + Article, + Collection, + ValidationPolicy, +} from "@pegma/knowledge-base-contracts"; +import type { + EvidenceRevocation, + GovernanceConfiguration, + ReviewSnapshot, + SourceSnapshot, +} from "./types.js"; +import { + canonicalJson, + RepositoryCapacityError, + RepositoryIntegrityError, + requireGeneration, + requireIdentifier, +} from "./storage-helpers.js"; + +export type ResourceKind = "article" | "collection" | "validation"; + +export interface StoredArticle { + readonly generation: number; + readonly article: Article; + readonly provenance: SourceSnapshot; + readonly review?: ReviewSnapshot; + readonly publishedProvenance?: SourceSnapshot; + readonly publicationReview?: ReviewSnapshot; + readonly publicationHeld: boolean; + readonly revokedEvidence: readonly EvidenceRevocation[]; +} + +export interface StoredCollection { + readonly generation: number; + readonly collection: Collection; + readonly configuration?: GovernanceConfiguration; +} + +export interface StoredValidationPolicy { + readonly generation: number; + readonly policy: ValidationPolicy; +} + +export type KnowledgeRecordKind = + | "head" + | "revision" + | "evidence" + | "review" + | "publication" + | "provenance" + | "revocation" + | "collection-policy" + | "configuration" + | "policy" + | "audit" + | "command" + | "job"; + +export interface KnowledgeRecord { + readonly schemaVersion: 1; + readonly resourceKind: ResourceKind; + readonly resourceId: string; + readonly partition: string; + readonly id: string; + readonly kind: KnowledgeRecordKind; + readonly data: unknown; +} + +export const maximumRecordNativeBytes = 900_000; +export const maximumTransactionEncodedBytes = 3 * 1024 * 1024; +export const maximumTransactionActions = 100; +const chunkCharacters = 30_000; +const maximumChunks = 15; +const kinds: readonly string[] = [ + "head", + "revision", + "evidence", + "review", + "publication", + "provenance", + "revocation", + "collection-policy", + "configuration", + "policy", + "audit", + "command", + "job", +]; + +function validateRecord(record: KnowledgeRecord): void { + if ( + record.schemaVersion !== 1 || + !["article", "collection", "validation"].includes(record.resourceKind) || + !kinds.includes(record.kind) + ) + throw new RepositoryIntegrityError(); + requireIdentifier(record.resourceId); + if ( + record.data === null || + typeof record.data !== "object" || + Array.isArray(record.data) + ) + throw new RepositoryIntegrityError(); + if ( + typeof record.partition !== "string" || + typeof record.id !== "string" || + !new RegExp("^" + record.resourceKind + ":[a-f0-9]{64}$", "u").test( + record.partition, + ) || + record.id.length === 0 || + record.id.length > 300 || + /[^A-Za-z0-9|:._-]/u.test(record.id) + ) + throw new RepositoryIntegrityError(); +} + +export function encodeKnowledgeRecord(record: KnowledgeRecord): StoredRecord { + validateRecord(record); + const payload = canonicalJson(record.data); + if (payload.length * 2 > maximumRecordNativeBytes - 4_096) + throw new RepositoryCapacityError("record_bytes"); + const parts: string[] = []; + for (let offset = 0; offset < payload.length;) { + let end = Math.min(payload.length, offset + chunkCharacters); + const last = payload.charCodeAt(end - 1); + if (end < payload.length && last >= 0xd800 && last <= 0xdbff) end -= 1; + parts.push(payload.slice(offset, end)); + offset = end; + } + if (parts.length === 0 || parts.length > maximumChunks) + throw new RepositoryCapacityError("record_chunks"); + const encoded: Record = { + schemaVersion: 1, + resourceKind: record.resourceKind, + resourceId: record.resourceId, + recordPartition: record.partition, + recordId: record.id, + kind: record.kind, + partCount: parts.length, + }; + for (const [index, part] of parts.entries()) encoded["part" + index] = part; + return encoded; +} + +export function decodeKnowledgeRecord(record: StoredRecord): KnowledgeRecord { + try { + if (record.schemaVersion !== 1 || typeof record.partCount !== "number") + throw new RepositoryIntegrityError(); + requireGeneration(record.partCount, 1); + if (record.partCount > maximumChunks) throw new RepositoryIntegrityError(); + const expected = new Set([ + "schemaVersion", + "resourceKind", + "resourceId", + "recordPartition", + "recordId", + "kind", + "partCount", + ...Array.from({ length: record.partCount }, (_, index) => "part" + index), + ]); + if ( + Object.keys(record).length !== expected.size || + Object.keys(record).some((key) => !expected.has(key)) + ) + throw new RepositoryIntegrityError(); + const parts: string[] = []; + for (let index = 0; index < record.partCount; index += 1) { + const part = record["part" + index]; + if (typeof part !== "string" || part.length > chunkCharacters) + throw new RepositoryIntegrityError(); + parts.push(part); + } + const payload = parts.join(""); + if (payload.length * 2 > maximumRecordNativeBytes - 4_096) + throw new RepositoryIntegrityError(); + const decoded: KnowledgeRecord = { + schemaVersion: 1, + resourceKind: record.resourceKind as ResourceKind, + resourceId: record.resourceId as string, + partition: record.recordPartition as string, + id: record.recordId as string, + kind: record.kind as KnowledgeRecordKind, + data: JSON.parse(payload) as unknown, + }; + validateRecord(decoded); + canonicalJson(decoded.data); + return decoded; + } catch { + throw new RepositoryIntegrityError(); + } +} + +export const knowledgeRecords = defineCollection({ + name: "knowledge-base.records.v1", + key: (record) => ({ partition: record.partition, id: record.id }), + codec: { encode: encodeKnowledgeRecord, decode: decodeKnowledgeRecord }, +}); diff --git a/packages/application/src/repository.ts b/packages/application/src/repository.ts new file mode 100644 index 0000000..6528a30 --- /dev/null +++ b/packages/application/src/repository.ts @@ -0,0 +1,1105 @@ +import { + auditRecordId, + defineAudit, + type AuditDetails, + type AuditEvent, +} from "@pegma/audit"; +import type { + IsoTimestamp, + PrincipalId, + VerificationEvidence, + ArticleRevision, + ArticleApproval, + Article, + Collection, + ValidationPolicy, +} from "@pegma/knowledge-base-contracts"; +import type { + Store, + TransactionAction, + VersionedRecord, +} from "@pegma/storage-core"; +import { + knowledgeRecords, + encodeKnowledgeRecord, + maximumTransactionActions, + maximumTransactionEncodedBytes, + type KnowledgeRecord, + type ResourceKind, + type StoredArticle, + type StoredCollection, + type StoredValidationPolicy, +} from "./records.js"; +import { + canonicalJson, + encodedBytes, + fingerprint, + RepositoryCapacityError, + RepositoryConflictError, + RepositoryIntegrityError, + requireGeneration, + requireIdentifier, + snapshotData, +} from "./storage-helpers.js"; +import type { + EvidenceRevocation, + GovernanceConfiguration, + ReviewSnapshot, + SourceSnapshot, +} from "./types.js"; + +export interface KnowledgeRepositoryLimits { + readonly maxPhysicalRows: number; + readonly maxRetainedBytes: number; + readonly controlReserveRows: number; + readonly controlReserveBytes: number; + readonly maxArticleRevisions: number; + readonly maxEvidenceVersions: number; + readonly maxConflictAttempts: number; +} + +export interface VersionedState { + readonly value: T; + readonly version: string; +} +export interface RepositoryCommand { + readonly commandId: string; + readonly correlationId: string; + readonly actorId: PrincipalId; + readonly operation: string; + readonly fingerprint: string; + readonly occurredAt: IsoTimestamp; +} +export interface KnowledgeJobInput { + readonly task: + "article_changed" | "collection_changed" | "validation_changed"; + readonly payload?: Readonly>; +} +export interface MutationInput { + readonly id: string; + readonly command: RepositoryCommand; + readonly expectedGeneration?: number; + readonly control?: boolean; + readonly recheck: (current: T | null) => Promise; + readonly decide: ( + current: T | null, + nextGeneration: number, + ) => Promise<{ + readonly next: Omit; + readonly jobs?: readonly KnowledgeJobInput[]; + readonly auditDetails?: AuditDetails; + }>; +} +export interface RepositoryResult { + readonly value: T; + readonly replayed: boolean; +} +export interface KnowledgeRepository { + readonly limits: KnowledgeRepositoryLimits; + readArticleVersioned( + id: string, + ): Promise | null>; + readCollectionVersioned( + id: string, + ): Promise | null>; + readValidationPolicyVersioned( + id: string, + ): Promise | null>; + getArticleRevision( + id: string, + revision: number, + ): Promise; + getEvidenceVersion( + id: string, + articleRevision: number, + evidenceId: string, + version: number, + ): Promise; + isEvidenceRevoked(id: string, hash: string): Promise; + executeArticle( + input: MutationInput, + ): Promise>; + executeCollection( + input: MutationInput, + ): Promise>; + executeValidationPolicy( + input: MutationInput, + ): Promise>; +} + +export const defaultKnowledgeRepositoryLimits: KnowledgeRepositoryLimits = + Object.freeze({ + maxPhysicalRows: 1_024, + maxRetainedBytes: 16 * 1024 * 1024, + controlReserveRows: 32, + controlReserveBytes: 512 * 1024, + maxArticleRevisions: 64, + maxEvidenceVersions: 256, + maxConflictAttempts: 3, + }); + +type State = StoredArticle | StoredCollection | StoredValidationPolicy; +interface EvidencePointer { + readonly id: string; + readonly articleRevision: number; + readonly version: number; + readonly hash: string; +} +interface ArticlePointer { + readonly resourceKind: "article"; + readonly generation: number; + readonly state: Article["state"]; + readonly current: number; + readonly evidence: readonly EvidencePointer[]; + readonly provenance: number; + readonly review?: string; + readonly published?: { readonly revision: number; readonly approval: string }; + readonly publishedProvenance?: number; + readonly publicationReview?: string; + readonly publicationHeld: boolean; + readonly revocations: readonly string[]; +} +interface CollectionPointer { + readonly resourceKind: "collection"; + readonly generation: number; + readonly revision: number; + readonly configuration?: string; +} +interface ValidationPointer { + readonly resourceKind: "validation"; + readonly generation: number; + readonly version: number; +} +type Pointer = ArticlePointer | CollectionPointer | ValidationPointer; +interface Quota { + readonly rows: number; + readonly bytes: number; + readonly revisions: number; + readonly evidence: number; +} +interface Head { + readonly pointer: Pointer; + readonly quota: Quota; +} +interface Receipt { + readonly command: RepositoryCommand; + readonly result: Pointer; +} + +function limitsFor( + overrides: Partial, +): KnowledgeRepositoryLimits { + const names = Object.keys(defaultKnowledgeRepositoryLimits); + if (Object.keys(overrides).some((name) => !names.includes(name))) + throw new TypeError("Unknown knowledge repository limit"); + const limits = { ...defaultKnowledgeRepositoryLimits, ...overrides }; + for (const [name, value] of Object.entries(limits)) { + const minimum = name.startsWith("controlReserve") ? 0 : 1; + if (!Number.isSafeInteger(value) || value < minimum) + throw new TypeError( + "Knowledge repository limits must be bounded integers", + ); + } + if ( + limits.maxPhysicalRows > 10_000 || + limits.maxRetainedBytes > 64 * 1024 * 1024 || + limits.maxArticleRevisions > 1_000 || + limits.maxEvidenceVersions > 1_000 || + limits.maxConflictAttempts > 8 || + limits.controlReserveRows >= limits.maxPhysicalRows || + limits.controlReserveBytes >= limits.maxRetainedBytes + ) + throw new TypeError("Knowledge repository limits exceed their ceilings"); + return Object.freeze(limits); +} + +export function createKnowledgeRepository( + store: Store, + overrides: Partial = {}, +): KnowledgeRepository { + const limits = limitsFor(snapshotData(overrides)); + const records = store.collection(knowledgeRecords); + const partition = async (kind: ResourceKind, id: string): Promise => { + requireIdentifier(id); + return kind + ":" + (await fingerprint([kind, id])); + }; + const evidenceId = async ( + revision: number, + id: string, + version: number, + ): Promise => { + requireGeneration(revision, 1); + requireGeneration(version, 1); + requireIdentifier(id); + return ( + "evidence:" + revision + ":" + (await fingerprint(id)) + ":" + version + ); + }; + function checkIdentity( + row: KnowledgeRecord, + kind: ResourceKind, + id: string, + scope: string, + key: string, + ): void { + if ( + row.resourceKind !== kind || + row.resourceId !== id || + row.partition !== scope || + row.id !== key + ) + throw new RepositoryIntegrityError(); + } + function validatePointer(pointer: Pointer): void { + try { + requireGeneration(pointer.generation, 1); + if (pointer.resourceKind === "article") { + requireGeneration(pointer.current, 1); + requireGeneration(pointer.provenance); + if ( + !["draft", "in-review", "published", "retired"].includes( + pointer.state, + ) || + typeof pointer.publicationHeld !== "boolean" || + !Array.isArray(pointer.evidence) || + pointer.evidence.length > 32 || + !Array.isArray(pointer.revocations) || + pointer.revocations.length > limits.maxEvidenceVersions + ) + throw new RepositoryIntegrityError(); + for (const evidence of pointer.evidence) { + requireIdentifier(evidence.id); + requireGeneration(evidence.articleRevision, 1); + requireGeneration(evidence.version, 1); + if ( + evidence.articleRevision !== pointer.current || + !/^[a-f0-9]{64}$/u.test(evidence.hash) + ) + throw new RepositoryIntegrityError(); + } + if ( + new Set(pointer.revocations).size !== pointer.revocations.length || + pointer.revocations.some( + (hash) => typeof hash !== "string" || !/^[a-f0-9]{64}$/u.test(hash), + ) + ) + throw new RepositoryIntegrityError(); + for (const key of [ + pointer.review, + pointer.publicationReview, + pointer.published?.approval, + ]) { + if ( + key !== undefined && + (typeof key !== "string" || + key.length > 300 || + /[^A-Za-z0-9|:._-]/u.test(key)) + ) + throw new RepositoryIntegrityError(); + } + if (pointer.published !== undefined) { + requireGeneration(pointer.published.revision, 1); + if ( + pointer.publishedProvenance === undefined || + pointer.publicationReview === undefined + ) + throw new RepositoryIntegrityError(); + } else if ( + pointer.publishedProvenance !== undefined || + pointer.publicationReview !== undefined || + pointer.state === "published" + ) + throw new RepositoryIntegrityError(); + if (pointer.publishedProvenance !== undefined) + requireGeneration(pointer.publishedProvenance); + } else if (pointer.resourceKind === "collection") { + requireGeneration(pointer.revision, 1); + if ( + pointer.configuration !== undefined && + (typeof pointer.configuration !== "string" || + !/^configuration:[0-9]+$/u.test(pointer.configuration)) + ) + throw new RepositoryIntegrityError(); + } else if (pointer.resourceKind === "validation") + requireGeneration(pointer.version, 1); + else throw new RepositoryIntegrityError(); + } catch { + throw new RepositoryIntegrityError(); + } + } + async function getRow( + kind: ResourceKind, + id: string, + key: string, + ): Promise { + if ( + typeof key !== "string" || + key.length === 0 || + key.length > 300 || + /[^A-Za-z0-9|:._-]/u.test(key) + ) + throw new RepositoryIntegrityError(); + const scope = await partition(kind, id); + const row = await records.get({ partition: scope, id: key }); + if (row !== null) checkIdentity(row, kind, id, scope, key); + return row; + } + async function required( + kind: ResourceKind, + id: string, + key: string, + expectedKind: KnowledgeRecord["kind"], + ): Promise { + const row = await getRow(kind, id, key); + if (row === null || row.kind !== expectedKind) + throw new RepositoryIntegrityError(); + return row.data as T; + } + async function getHead( + kind: ResourceKind, + id: string, + ): Promise | null> { + const scope = await partition(kind, id); + const row = await records.getVersioned({ partition: scope, id: "head" }); + if (row === null) return null; + checkIdentity(row.value, kind, id, scope, "head"); + try { + if (row.value.kind !== "head") throw new RepositoryIntegrityError(); + const data = row.value.data as Head; + if (data?.pointer?.resourceKind !== kind || data.quota === undefined) + throw new RepositoryIntegrityError(); + requireGeneration(data.pointer.generation, 1); + validatePointer(data.pointer); + if ( + canonicalJson(Object.keys(data.quota).sort()) !== + canonicalJson(["bytes", "evidence", "revisions", "rows"]) + ) + throw new RepositoryIntegrityError(); + for (const count of Object.values(data.quota)) { + if (!Number.isSafeInteger(count) || count < 0) + throw new RepositoryIntegrityError(); + } + if ( + data.quota.rows < 1 || + data.quota.rows > limits.maxPhysicalRows || + data.quota.bytes > limits.maxRetainedBytes + ) + throw new RepositoryCapacityError("stored_partition"); + const allowed = + kind === "article" + ? [ + "resourceKind", + "generation", + "state", + "current", + "evidence", + "provenance", + "review", + "published", + "publishedProvenance", + "publicationReview", + "publicationHeld", + "revocations", + ] + : kind === "collection" + ? ["resourceKind", "generation", "revision", "configuration"] + : ["resourceKind", "generation", "version"]; + if ( + Object.keys(data).some((key) => !["pointer", "quota"].includes(key)) || + Object.keys(data.pointer).some((key) => !allowed.includes(key)) + ) + throw new RepositoryIntegrityError(); + return row; + } catch (error) { + if ( + error instanceof RepositoryCapacityError || + error instanceof RepositoryIntegrityError + ) + throw error; + throw new RepositoryIntegrityError(); + } + } + async function getRevision( + id: string, + number: number, + ): Promise { + requireGeneration(number, 1); + const row = await getRow("article", id, "revision:" + number); + if (row === null) return null; + const value = row.data as ArticleRevision; + if ( + row.kind !== "revision" || + value?.articleId !== id || + value.number !== number + ) + throw new RepositoryIntegrityError(); + return value; + } + async function getEvidence( + id: string, + revision: number, + identifier: string, + version: number, + ): Promise { + const row = await getRow( + "article", + id, + await evidenceId(revision, identifier, version), + ); + if (row === null) return null; + const value = row.data as VerificationEvidence; + if ( + row.kind !== "evidence" || + value?.articleId !== id || + value.articleRevision !== revision || + value.id !== identifier || + value.version !== version + ) + throw new RepositoryIntegrityError(); + return value; + } + async function hydrate( + kind: ResourceKind, + id: string, + pointer: Pointer, + ): Promise { + if (pointer.resourceKind !== kind) throw new RepositoryIntegrityError(); + validatePointer(pointer); + if (pointer.resourceKind === "collection") { + const collection = await required( + kind, + id, + "collection-policy:" + pointer.revision, + "collection-policy", + ); + if (collection.id !== id || collection.revision !== pointer.revision) + throw new RepositoryIntegrityError(); + const configuration = + pointer.configuration === undefined + ? undefined + : await required( + kind, + id, + pointer.configuration, + "configuration", + ); + return { + generation: pointer.generation, + collection, + ...(configuration === undefined ? {} : { configuration }), + }; + } + if (pointer.resourceKind === "validation") { + const policy = await required( + kind, + id, + "policy:" + pointer.version, + "policy", + ); + if (policy.id !== id || policy.version !== pointer.version) + throw new RepositoryIntegrityError(); + return { generation: pointer.generation, policy }; + } + requireGeneration(pointer.current, 1); + if ( + !Array.isArray(pointer.evidence) || + pointer.evidence.length > 32 || + !Array.isArray(pointer.revocations) || + pointer.revocations.length > limits.maxEvidenceVersions || + typeof pointer.publicationHeld !== "boolean" + ) + throw new RepositoryIntegrityError(); + const current = await getRevision(id, pointer.current); + if (current === null) throw new RepositoryIntegrityError(); + const evidence = await Promise.all( + pointer.evidence.map(async (reference) => { + if (reference.articleRevision !== pointer.current) + throw new RepositoryIntegrityError(); + const value = await getEvidence( + id, + reference.articleRevision, + reference.id, + reference.version, + ); + if (value === null || value.hash !== reference.hash) + throw new RepositoryIntegrityError(); + return value; + }), + ); + const provenance = await required( + kind, + id, + "provenance:" + pointer.provenance, + "provenance", + ); + const review = + pointer.review === undefined + ? undefined + : await required(kind, id, pointer.review, "review"); + let published: Article["published"]; + if (pointer.published !== undefined) { + const revision = await getRevision(id, pointer.published.revision); + const approval = await required( + kind, + id, + pointer.published.approval, + "publication", + ); + if ( + revision === null || + approval.binding.articleId !== id || + approval.binding.articleRevision !== revision.number || + approval.binding.contentHash !== revision.contentHash + ) + throw new RepositoryIntegrityError(); + published = { revision, approval }; + } + const publishedProvenance = + pointer.publishedProvenance === undefined + ? undefined + : await required( + kind, + id, + "provenance:" + pointer.publishedProvenance, + "provenance", + ); + const publicationReview = + pointer.publicationReview === undefined + ? undefined + : await required( + kind, + id, + pointer.publicationReview, + "review", + ); + const revokedEvidence = await Promise.all( + pointer.revocations.map((hash) => + required(kind, id, "revoked:" + hash, "revocation"), + ), + ); + const article: Article = { + id, + state: pointer.state, + current, + evidence, + ...(review === undefined ? {} : { review: review.binding }), + ...(published === undefined ? {} : { published }), + }; + return { + generation: pointer.generation, + article, + provenance, + publicationHeld: pointer.publicationHeld, + revokedEvidence, + ...(review === undefined ? {} : { review }), + ...(publishedProvenance === undefined ? {} : { publishedProvenance }), + ...(publicationReview === undefined ? {} : { publicationReview }), + }; + } + async function read( + kind: ResourceKind, + id: string, + ): Promise | null> { + const row = await getHead(kind, id); + if (row === null) return null; + const head = row.value.data as Head; + return { + value: (await hydrate(kind, id, head.pointer)) as T, + version: row.version, + }; + } + async function execute( + kind: ResourceKind, + input: MutationInput, + ): Promise> { + const request = snapshotData({ + id: input.id, + command: input.command, + ...(input.expectedGeneration === undefined + ? {} + : { expectedGeneration: input.expectedGeneration }), + control: input.control === true, + }); + const recheck = input.recheck; + const decide = input.decide; + requireIdentifier(request.id); + for (const field of [ + request.command.commandId, + request.command.correlationId, + request.command.actorId, + request.command.operation, + ]) + requireIdentifier(field); + if (!/^[a-f0-9]{64}$/u.test(request.command.fingerprint)) + throw new TypeError("Expected a command fingerprint"); + const commandTime = Date.parse(request.command.occurredAt); + if ( + typeof request.command.occurredAt !== "string" || + !Number.isFinite(commandTime) || + new Date(commandTime).toISOString() !== request.command.occurredAt + ) + throw new TypeError("Expected canonical command time"); + if (request.expectedGeneration !== undefined) + requireGeneration(request.expectedGeneration); + const scope = await partition(kind, request.id); + const commandHash = await fingerprint(request.command.commandId); + const receiptKey = "command:" + commandHash; + for (let attempt = 0; attempt < limits.maxConflictAttempts; attempt += 1) { + const beforeRow = await getHead(kind, request.id); + const beforeHead = beforeRow?.value.data as Head | undefined; + const current = + beforeHead === undefined + ? null + : ((await hydrate(kind, request.id, beforeHead.pointer)) as T); + await recheck(current === null ? null : snapshotData(current)); + const receiptRow = await getRow(kind, request.id, receiptKey); + if (receiptRow !== null) { + const receipt = receiptRow.data as Receipt; + if ( + receiptRow.kind !== "command" || + receipt.command.actorId !== request.command.actorId || + receipt.command.operation !== request.command.operation || + receipt.command.fingerprint !== request.command.fingerprint || + receipt.command.commandId !== request.command.commandId + ) + throw new RepositoryConflictError(); + // Receipt and head reads are not a snapshot. The matching command may + // have committed after this attempt loaded its earlier head. + const latest = await read(kind, request.id); + await recheck(latest?.value ?? null); + if ( + latest === null || + receipt.result.generation > latest.value.generation + ) + throw new RepositoryConflictError(); + const historical = (await hydrate( + kind, + request.id, + receipt.result, + )) as T; + return { value: historical, replayed: true }; + } + if ( + request.expectedGeneration !== undefined && + request.expectedGeneration !== (current?.generation ?? 0) + ) + throw new RepositoryConflictError(); + const generation = (current?.generation ?? 0) + 1; + requireGeneration(generation, 1); + const decision = snapshotData( + await decide( + current === null ? null : snapshotData(current), + generation, + ), + ); + const next = snapshotData({ ...decision.next, generation }) as T; + const additions: KnowledgeRecord[] = []; + const queued = new Map(); + let immutablePlanningCollision = false; + const buildRow = ( + id: string, + rowKind: KnowledgeRecord["kind"], + data: unknown, + ): KnowledgeRecord => ({ + schemaVersion: 1, + resourceKind: kind, + resourceId: request.id, + partition: scope, + id, + kind: rowKind, + data: snapshotData(data), + }); + const add = async ( + key: string, + rowKind: KnowledgeRecord["kind"], + data: unknown, + ): Promise => { + if (immutablePlanningCollision) return; + const record = buildRow(key, rowKind, data); + const pending = queued.get(key); + if (pending !== undefined) { + if (canonicalJson(pending) !== canonicalJson(record)) + throw new RepositoryIntegrityError(); + return; + } + const previous = await getRow(kind, request.id, key); + if (previous !== null) { + if (canonicalJson(previous) !== canonicalJson(record)) { + // A matching command may have committed after this attempt read + // its receipt. Re-enter the receipt-first, authorized retry path; + // server timestamps are not part of semantic command identity. + immutablePlanningCollision = true; + } + return; + } + encodeKnowledgeRecord(record); + queued.set(key, record); + additions.push(record); + }; + let pointer: Pointer; + if (kind === "article") { + const value = next as StoredArticle; + const previous = current as StoredArticle | null; + const previousPointer = beforeHead?.pointer as + ArticlePointer | undefined; + if ( + value.article.id !== request.id || + value.article.current.articleId !== request.id || + value.article.current.number > limits.maxArticleRevisions || + value.article.evidence.length > 32 || + value.revokedEvidence.length > limits.maxEvidenceVersions || + value.provenance.references.length > 32 + ) + throw new RepositoryCapacityError("article_history"); + if ( + typeof value.publicationHeld !== "boolean" || + canonicalJson(value.article.review ?? null) !== + canonicalJson(value.review?.binding ?? null) || + (value.article.published !== undefined && + (value.publicationReview === undefined || + value.publishedProvenance === undefined)) || + (value.article.published === undefined && + (value.publicationReview !== undefined || + value.publishedProvenance !== undefined)) + ) + throw new RepositoryIntegrityError(); + await add( + "revision:" + value.article.current.number, + "revision", + value.article.current, + ); + for (const evidence of value.article.evidence) { + if ( + evidence.articleId !== request.id || + evidence.articleRevision !== value.article.current.number + ) + throw new RepositoryIntegrityError(); + await add( + await evidenceId( + evidence.articleRevision, + evidence.id, + evidence.version, + ), + "evidence", + evidence, + ); + } + await add( + "provenance:" + value.provenance.generation, + "provenance", + value.provenance, + ); + if (value.publishedProvenance !== undefined) + await add( + "provenance:" + value.publishedProvenance.generation, + "provenance", + value.publishedProvenance, + ); + const reviewKey = async ( + review: ReviewSnapshot | undefined, + slot: string, + ): Promise => { + if (review === undefined) return undefined; + if ( + previousPointer?.review !== undefined && + previous?.review !== undefined && + canonicalJson(previous.review) === canonicalJson(review) + ) + return previousPointer.review; + if ( + previousPointer?.publicationReview !== undefined && + previous?.publicationReview !== undefined && + canonicalJson(previous.publicationReview) === canonicalJson(review) + ) + return previousPointer.publicationReview; + const key = "review:" + generation + ":" + slot; + await add(key, "review", review); + return key; + }; + const review = await reviewKey(value.review, "pending"); + const publicationReview = await reviewKey( + value.publicationReview, + "publication", + ); + let published: ArticlePointer["published"]; + if (value.article.published !== undefined) { + await add( + "revision:" + value.article.published.revision.number, + "revision", + value.article.published.revision, + ); + const unchanged = + previous?.article.published !== undefined && + canonicalJson(previous.article.published) === + canonicalJson(value.article.published); + const approval = + unchanged && previousPointer?.published !== undefined + ? previousPointer.published.approval + : "publication:" + generation; + await add(approval, "publication", value.article.published.approval); + published = { + revision: value.article.published.revision.number, + approval, + }; + } + for (const revoked of value.revokedEvidence) { + if (!/^[a-f0-9]{64}$/u.test(revoked.hash)) + throw new RepositoryIntegrityError(); + await add("revoked:" + revoked.hash, "revocation", revoked); + } + for (const revoked of previous?.revokedEvidence ?? []) { + if ( + !value.revokedEvidence.some( + (candidate) => + canonicalJson(candidate) === canonicalJson(revoked), + ) + ) + throw new RepositoryIntegrityError(); + } + pointer = { + resourceKind: "article", + generation, + state: value.article.state, + current: value.article.current.number, + evidence: value.article.evidence.map( + ({ id, articleRevision, version, hash }) => ({ + id, + articleRevision, + version, + hash, + }), + ), + provenance: value.provenance.generation, + publicationHeld: value.publicationHeld, + revocations: value.revokedEvidence.map(({ hash }) => hash), + ...(review === undefined ? {} : { review }), + ...(published === undefined ? {} : { published }), + ...(value.publishedProvenance === undefined + ? {} + : { publishedProvenance: value.publishedProvenance.generation }), + ...(publicationReview === undefined ? {} : { publicationReview }), + }; + } else if (kind === "collection") { + const value = next as StoredCollection; + const previous = current as StoredCollection | null; + const previousPointer = beforeHead?.pointer as + CollectionPointer | undefined; + if (value.collection.id !== request.id) + throw new RepositoryIntegrityError(); + await add( + "collection-policy:" + value.collection.revision, + "collection-policy", + value.collection, + ); + let configuration: string | undefined; + if (value.configuration !== undefined) { + configuration = + previous?.configuration !== undefined && + canonicalJson(previous.configuration) === + canonicalJson(value.configuration) + ? previousPointer?.configuration + : undefined; + configuration ??= "configuration:" + generation; + await add(configuration, "configuration", value.configuration); + } + pointer = { + resourceKind: "collection", + generation, + revision: value.collection.revision, + ...(configuration === undefined ? {} : { configuration }), + }; + } else { + const value = next as StoredValidationPolicy; + if (value.policy.id !== request.id) + throw new RepositoryIntegrityError(); + await add("policy:" + value.policy.version, "policy", value.policy); + pointer = { + resourceKind: "validation", + generation, + version: value.policy.version, + }; + } + if (immutablePlanningCollision) continue; + const audit = defineAudit({ + collection: knowledgeRecords, + toRecord: (event) => buildRow(auditRecordId(event.id), "audit", event), + toEvent: (record) => + record.kind === "audit" ? (record.data as AuditEvent) : null, + }); + const event: AuditEvent = { + id: commandHash, + occurredAt: request.command.occurredAt, + actor: { kind: "principal", principalId: request.command.actorId }, + action: request.command.operation, + subject: request.id, + sequence: generation, + details: { + ...decision.auditDetails, + correlationId: request.command.correlationId, + }, + }; + const auditAction = audit.action(event); + if (auditAction.action !== "insert") throw new RepositoryIntegrityError(); + additions.push(auditAction.value); + additions.push( + buildRow(receiptKey, "command", { + command: request.command, + result: pointer, + } satisfies Receipt), + ); + const jobs: readonly KnowledgeJobInput[] = decision.jobs ?? [ + { + task: + kind === "article" + ? "article_changed" + : kind === "collection" + ? "collection_changed" + : "validation_changed", + }, + ]; + if (jobs.length > 8) throw new RepositoryCapacityError("command_jobs"); + for (const [index, job] of jobs.entries()) { + if ( + ![ + "article_changed", + "collection_changed", + "validation_changed", + ].includes(job.task) + ) + throw new TypeError("Unknown knowledge task"); + if ( + Object.keys(job.payload ?? {}).length > 32 || + Object.values(job.payload ?? {}).some( + (value) => typeof value === "string" && value.length > 2_048, + ) + ) + throw new RepositoryCapacityError("job_payload"); + additions.push( + buildRow("job:" + commandHash + ":" + index, "job", { + task: job.task, + payload: job.payload ?? {}, + generation, + status: "pending", + createdAt: request.command.occurredAt, + }), + ); + } + const priorQuota = beforeHead?.quota ?? { + rows: 0, + bytes: 0, + revisions: 0, + evidence: 0, + }; + const quota = { + rows: priorQuota.rows + additions.length + (beforeRow === null ? 1 : 0), + bytes: 0, + revisions: + priorQuota.revisions + + additions.filter((row) => row.kind === "revision").length, + evidence: + priorQuota.evidence + + additions.filter((row) => row.kind === "evidence").length, + }; + if ( + quota.revisions > limits.maxArticleRevisions || + quota.evidence > limits.maxEvidenceVersions + ) + throw new RepositoryCapacityError("retained_history"); + const encodedAdditions = additions.map(encodeKnowledgeRecord); + const baseBytes = + priorQuota.bytes - + (beforeRow === null + ? 0 + : encodedBytes(encodeKnowledgeRecord(beforeRow.value))) + + encodedAdditions.reduce((sum, row) => sum + encodedBytes(row), 0); + let headRow = buildRow("head", "head", { pointer, quota } satisfies Head); + for (let pass = 0; pass < 12; pass += 1) { + const updated = + baseBytes + encodedBytes(encodeKnowledgeRecord(headRow)); + if (updated === quota.bytes) break; + quota.bytes = updated; + headRow = buildRow("head", "head", { pointer, quota } satisfies Head); + } + const rowBudget = + limits.maxPhysicalRows - + (request.control ? 0 : limits.controlReserveRows); + const byteBudget = + limits.maxRetainedBytes - + (request.control ? 0 : limits.controlReserveBytes); + if (quota.rows > rowBudget) + throw new RepositoryCapacityError("physical_rows"); + if (quota.bytes > byteBudget) + throw new RepositoryCapacityError("retained_bytes"); + const actions: TransactionAction[] = [ + beforeRow === null + ? { action: "insert", value: headRow } + : { + action: "putIfUnchanged", + value: headRow, + version: beforeRow.version, + }, + ...additions.map((value) => ({ action: "insert" as const, value })), + ]; + if ( + actions.length > maximumTransactionActions || + encodedBytes(encodeKnowledgeRecord(headRow)) + + encodedAdditions.reduce((sum, row) => sum + encodedBytes(row), 0) > + maximumTransactionEncodedBytes + ) + throw new RepositoryCapacityError("transaction"); + const outcome = await records.transact(scope, actions); + if (!outcome.committed) continue; + const latest = await read(kind, request.id); + await recheck(latest?.value ?? null); + return { value: next, replayed: false }; + } + // The winning attempt may have committed this command on the final retry. + const receiptRow = await getRow(kind, request.id, receiptKey); + if (receiptRow !== null && receiptRow.kind === "command") { + const receipt = receiptRow.data as Receipt; + if ( + receipt.command.actorId === request.command.actorId && + receipt.command.operation === request.command.operation && + receipt.command.fingerprint === request.command.fingerprint && + receipt.command.commandId === request.command.commandId + ) { + const latest = await read(kind, request.id); + await recheck(latest?.value ?? null); + if ( + latest === null || + receipt.result.generation > latest.value.generation + ) + throw new RepositoryConflictError(); + return { + value: (await hydrate(kind, request.id, receipt.result)) as T, + replayed: true, + }; + } + } + throw new RepositoryConflictError(); + } + return { + limits, + readArticleVersioned: (id) => read("article", id), + readCollectionVersioned: (id) => read("collection", id), + readValidationPolicyVersioned: (id) => + read("validation", id), + getArticleRevision: getRevision, + getEvidenceVersion: getEvidence, + isEvidenceRevoked: async (id, hash) => { + if (!/^[a-f0-9]{64}$/u.test(hash)) + throw new TypeError("Expected evidence hash"); + const row = await getRow("article", id, "revoked:" + hash); + if (row !== null && row.kind !== "revocation") + throw new RepositoryIntegrityError(); + if (row !== null && (row.data as EvidenceRevocation)?.hash !== hash) + throw new RepositoryIntegrityError(); + return row !== null; + }, + executeArticle: (input) => execute("article", input), + executeCollection: (input) => + execute("collection", input), + executeValidationPolicy: (input) => + execute("validation", input), + }; +} diff --git a/packages/application/src/storage-helpers.ts b/packages/application/src/storage-helpers.ts new file mode 100644 index 0000000..54ab794 --- /dev/null +++ b/packages/application/src/storage-helpers.ts @@ -0,0 +1,156 @@ +import type { StoredRecord } from "@pegma/storage-core"; + +export class RepositoryConflictError extends Error { + override readonly name = "RepositoryConflictError"; + constructor() { + super("Knowledge resource changed or command identity was reused"); + } +} + +export class RepositoryCapacityError extends Error { + override readonly name = "RepositoryCapacityError"; + constructor(readonly budget: string) { + super("Knowledge resource reached its configured " + budget + " limit"); + } +} + +export class RepositoryIntegrityError extends Error { + override readonly name = "RepositoryIntegrityError"; + constructor() { + super("Stored knowledge data is inconsistent"); + } +} + +/** Snapshots data properties only; no getters, sparse arrays, or JSON coercion. */ +export function canonicalJson(value: unknown): string { + const ancestors = new Set(); + let nodes = 0; + let characters = 0; + const reserve = (count: number): void => { + characters += count; + if (characters > 2_000_000) + throw new TypeError("JSON data exceeds its encoded bound"); + }; + const visit = (item: unknown, depth = 0): string => { + nodes += 1; + if (depth > 32 || nodes > 50_000) + throw new TypeError("JSON data exceeds its graph bound"); + if ( + item === null || + typeof item === "string" || + typeof item === "boolean" + ) { + if (typeof item === "string" && item.length > 500_000) + throw new TypeError("JSON string exceeds its bound"); + const encoded = JSON.stringify(item); + reserve(encoded.length); + return encoded; + } + if (typeof item === "number" && Number.isFinite(item)) { + const encoded = String(item); + reserve(encoded.length); + return encoded; + } + if (typeof item !== "object" || item === null || ancestors.has(item)) { + throw new TypeError("Expected bounded JSON data properties"); + } + ancestors.add(item); + try { + if (Object.getOwnPropertySymbols(item).length !== 0) { + throw new TypeError("Symbol properties are not JSON data"); + } + const own = (key: string): unknown => { + const property = Object.getOwnPropertyDescriptor(item, key); + if (property === undefined || !("value" in property)) { + throw new TypeError("Accessors and sparse arrays are not JSON data"); + } + return property.value; + }; + if (Array.isArray(item)) { + if (item.length > 4_096) + throw new TypeError("JSON array exceeds its bound"); + if (Object.keys(item).length !== item.length) { + throw new TypeError("Arrays must be dense data without extra keys"); + } + reserve(2 + item.length); + return ( + "[" + + Array.from({ length: item.length }, (_, i) => + visit(own(String(i)), depth + 1), + ).join(",") + + "]" + ); + } + if (![Object.prototype, null].includes(Object.getPrototypeOf(item))) { + throw new TypeError("Only plain JSON objects are supported"); + } + const names = Object.keys(item); + if (names.length > 4_096) + throw new TypeError("JSON object exceeds its bound"); + reserve(2 + names.length); + return ( + "{" + + names + .sort() + .map((key) => { + if (key.length > 500_000) + throw new TypeError("JSON property exceeds its bound"); + const encoded = JSON.stringify(key); + reserve(encoded.length + 1); + return encoded + ":" + visit(own(key), depth + 1); + }) + .join(",") + + "}" + ); + } finally { + ancestors.delete(item); + } + }; + return visit(value); +} + +export function snapshotData(value: T): T { + return JSON.parse(canonicalJson(value)) as T; +} + +export async function fingerprint(value: unknown): Promise { + const bytes = new TextEncoder().encode(canonicalJson(value)); + const digest = await crypto.subtle.digest("SHA-256", bytes); + return Array.from(new Uint8Array(digest), (value) => + value.toString(16).padStart(2, "0"), + ).join(""); +} + +export const commandFingerprint = fingerprint; + +export function requireIdentifier(value: string, field = "identifier"): void { + if ( + typeof value !== "string" || + value.length === 0 || + value.length > 200 || + value.trim() !== value || + /[\u0000-\u001f\u007f]/u.test(value) + ) { + throw new TypeError(field + " must be bounded nonempty text"); + } + for (let index = 0; index < value.length; index += 1) { + const unit = value.charCodeAt(index); + if (unit >= 0xd800 && unit <= 0xdbff) { + const next = value.charCodeAt(index + 1); + if (!(next >= 0xdc00 && next <= 0xdfff)) + throw new TypeError(field + " must be well-formed Unicode"); + index += 1; + } else if (unit >= 0xdc00 && unit <= 0xdfff) + throw new TypeError(field + " must be well-formed Unicode"); + } +} + +export function requireGeneration(value: number, minimum = 0): void { + if (!Number.isSafeInteger(value) || value < minimum) { + throw new TypeError("Expected a safe resource generation"); + } +} + +export function encodedBytes(record: StoredRecord): number { + return new TextEncoder().encode(canonicalJson(record)).length; +} diff --git a/packages/application/src/types.ts b/packages/application/src/types.ts new file mode 100644 index 0000000..0d21b75 --- /dev/null +++ b/packages/application/src/types.ts @@ -0,0 +1,414 @@ +import type { AccessContext } from "@pegma/authorization-core"; +import type { + Applicability, + ApprovalBinding, + Article, + ArticleContent, + ArticleKind, + ArticleRevision, + Clock, + Collection, + CollectionUse, + IsoTimestamp, + PrincipalId, + ValidationPolicy, + ValidationPolicyReference, + VerificationEvidence, +} from "@pegma/knowledge-base-contracts"; +import type { + ArticleDraft, + CollectionPolicyPreview, + EvidenceSubmission, +} from "@pegma/knowledge-base-core"; +import type { Store } from "@pegma/storage-core"; + +import type { KnowledgeRepositoryLimits } from "./repository.js"; + +/** Opaque source identity only: no URL, source body, customer text, or credential. */ +export interface PrivateSourceReference { + readonly id: string; + readonly system: string; + readonly resourceId: string; + readonly version: string; +} + +/** Hash and generation are computed by the application, never supplied as proof. */ +export interface SourceSnapshot { + readonly generation: number; + readonly references: readonly PrivateSourceReference[]; + readonly hash: string; +} + +/** Trusted configuration stored with, and versioned by, the collection head. */ +export interface GovernanceConfiguration { + readonly validationPolicy: ValidationPolicyReference; + readonly expectedStagingBuildId: string; + readonly trustedAttesterIds: readonly PrincipalId[]; +} + +/** The complete application review fence, in addition to the pure core binding. */ +export interface ReviewSnapshot { + readonly articleGeneration: number; + readonly binding: ApprovalBinding; + readonly sourceSnapshotHash: string; + readonly sourceGeneration: number; + readonly governanceGeneration: number; +} + +/** Immutable revocation identifies a historical version, including its revision. */ +export interface EvidenceRevocation { + readonly articleRevision: number; + readonly id: string; + readonly version: number; + readonly hash: string; + readonly reason: string; + readonly revokedBy: PrincipalId; + readonly revokedAt: IsoTimestamp; +} + +export interface EvidenceVerificationRequest { + readonly access: AccessContext; + readonly article: ArticleRevision; + readonly submission: EvidenceSubmission; + /** Host-defined receipt. It is never treated as an attester identity by KB. */ + readonly receipt: string; + readonly configuration: GovernanceConfiguration; +} + +export interface EvidenceVerifier { + /** Authenticate the receipt and its complete submission/actor/target binding. */ + verify( + request: EvidenceVerificationRequest, + ): Promise; +} + +export interface SourceReadRequest { + readonly access: AccessContext; + readonly articleId: string; + readonly reference: PrivateSourceReference; +} + +export interface SourceEligibilityRequest { + readonly article: ArticleRevision; + readonly snapshot: SourceSnapshot; +} + +/** + * The host owns source-resource authorization and resolution/revocation facts. + * These checks do not grant any KB permission or expose source bodies. + */ +export interface PrivateSourcesVerifier { + canRead(request: SourceReadRequest): Promise; + canPublish(request: SourceEligibilityRequest): Promise; + isCurrent(request: SourceEligibilityRequest): Promise; +} + +export interface KnowledgeBaseApplicationOptions { + readonly store: Store; + readonly clock: Clock; + readonly limits?: Partial; + /** Missing verifier fails closed for every evidence submission. */ + readonly evidenceVerifier?: EvidenceVerifier; + /** Missing verifier fails closed wherever a nonempty source snapshot is needed. */ + readonly privateSources?: PrivateSourcesVerifier; +} + +export type KnowledgeBaseServiceOptions = Omit< + KnowledgeBaseApplicationOptions, + "store" +>; + +export interface CommandInput { + readonly commandId: string; + readonly correlationId: string; + /** Aggregate state generation, independent of immutable content revision. */ + readonly expectedGeneration: number; +} + +/** + * A historical bounded acknowledgement. Replaying it does not promise that the + * acknowledged content or authority is still current; use a current read. + */ +export interface CommandResult { + readonly value: T; + readonly replayed: boolean; +} + +export interface ResourceAcknowledgement { + readonly id: string; + readonly generation: number; +} + +export interface CollectionAcknowledgement extends ResourceAcknowledgement { + readonly policyVersion: number; +} + +export interface ValidationPolicyAcknowledgement extends ResourceAcknowledgement { + readonly version: number; +} + +export interface ArticleAcknowledgement extends ResourceAcknowledgement { + readonly articleRevision: number; + readonly state: Article["state"]; + readonly contentHash: string; +} + +/** Staff metadata, including policy/reviewer identities; not a portal DTO. */ +export interface CollectionDto { + readonly generation: number; + readonly collection: Collection; +} + +export interface ValidationPolicyDto { + readonly generation: number; + readonly policy: ValidationPolicy; +} + +export interface GovernanceConfigurationDto { + readonly collectionId: string; + readonly generation: number; + readonly configuration: GovernanceConfiguration; +} + +/** Author-facing active checks, with no trusted runner or attester identities. */ +export interface ValidationRequirementsDto { + readonly collectionId: string; + readonly governanceGeneration: number; + readonly validationPolicy: ValidationPolicyReference; + readonly expectedStagingBuildId: string; + readonly checks: readonly { + readonly id: string; + readonly testKind: string; + readonly maxAgeMilliseconds: number; + }[]; +} + +/** Draft material only. Evidence, provenance, and reviewer records are separate. */ +export interface DraftArticleDto { + readonly articleId: string; + readonly generation: number; + readonly state: Article["state"]; + readonly revision: ArticleRevision; + readonly hasPendingReview: boolean; + readonly hasPublication: boolean; + readonly publicationHeld: boolean; +} + +export interface EvidenceDto { + readonly articleId: string; + readonly generation: number; + readonly evidence: readonly VerificationEvidence[]; + readonly revokedEvidence: readonly EvidenceRevocation[]; +} + +export interface ProvenanceDto { + readonly articleId: string; + readonly generation: number; + readonly snapshot: SourceSnapshot; + readonly publishedSnapshot?: SourceSnapshot; +} + +export interface ReviewDto { + readonly articleId: string; + readonly generation: number; + readonly review: ReviewSnapshot; +} + +/** Explicit portal-safe content. No actor, evidence, source, or review fields. */ +export interface PublishedArticleDto { + readonly articleId: string; + readonly collectionId: string; + readonly revision: number; + readonly kind: ArticleKind; + readonly title: string; + readonly summary: string; + readonly content: ArticleContent; + readonly tags: readonly string[]; + readonly applicability: Applicability; + readonly contentHash: string; +} + +export interface CollectionPolicyPreviewDto { + readonly generation: number; + readonly preview: CollectionPolicyPreview; +} + +export interface CreateCollectionInput extends CommandInput { + readonly collectionId: string; + readonly name: string; +} + +export interface PreviewCollectionPolicyInput { + readonly collectionId: string; + readonly uses: { + readonly portal: CollectionUse; + readonly bot: CollectionUse; + }; +} + +export interface UpdateCollectionPolicyInput extends CommandInput { + readonly collectionId: string; + readonly preview: CollectionPolicyPreview; + /** Explicit approval still requires the current public-approval permission. */ + readonly approvePublic?: boolean; +} + +export interface PutValidationPolicyInput extends CommandInput { + readonly policy: ValidationPolicy; +} + +export interface PutGovernanceConfigurationInput extends CommandInput { + readonly collectionId: string; + readonly configuration: GovernanceConfiguration; +} + +export interface CreateDraftInput extends CommandInput { + readonly articleId: string; + readonly collectionId: string; + readonly draft: ArticleDraft; +} + +export interface UpdateDraftInput extends CommandInput { + readonly articleId: string; + readonly collectionId: string; + readonly draft: ArticleDraft; +} + +export interface SubmitEvidenceInput extends CommandInput { + readonly articleId: string; + readonly evidence: EvidenceSubmission; + readonly receipt: string; +} + +export interface ArticleCommandInput extends CommandInput { + readonly articleId: string; +} + +export interface PublishArticleInput extends ArticleCommandInput { + readonly review: ReviewSnapshot; +} + +export interface RejectReviewInput extends ArticleCommandInput { + readonly reason: string; +} + +export interface SetProvenanceInput extends ArticleCommandInput { + readonly references: readonly PrivateSourceReference[]; +} + +export interface RevokeEvidenceInput extends ArticleCommandInput { + readonly articleRevision: number; + readonly evidenceId: string; + readonly evidenceVersion: number; + readonly evidenceHash: string; + readonly reason: string; +} + +export interface CollectionReadInput { + readonly collectionId: string; +} + +export interface ValidationPolicyReadInput { + readonly policyId: string; +} + +export interface ValidationRequirementsReadInput { + readonly collectionId: string; + readonly kind: ArticleKind; +} + +export interface ArticleReadInput { + readonly articleId: string; +} + +export interface KnowledgeBaseApplication { + createCollection( + access: AccessContext, + input: CreateCollectionInput, + ): Promise>; + previewCollectionPolicy( + access: AccessContext, + input: PreviewCollectionPolicyInput, + ): Promise; + updateCollectionPolicy( + access: AccessContext, + input: UpdateCollectionPolicyInput, + ): Promise>; + putValidationPolicy( + access: AccessContext, + input: PutValidationPolicyInput, + ): Promise>; + putGovernanceConfiguration( + access: AccessContext, + input: PutGovernanceConfigurationInput, + ): Promise>; + createDraft( + access: AccessContext, + input: CreateDraftInput, + ): Promise>; + updateDraft( + access: AccessContext, + input: UpdateDraftInput, + ): Promise>; + submitEvidence( + access: AccessContext, + input: SubmitEvidenceInput, + ): Promise>; + submitForReview( + access: AccessContext, + input: ArticleCommandInput, + ): Promise>; + publishArticle( + access: AccessContext, + input: PublishArticleInput, + ): Promise>; + rejectReview( + access: AccessContext, + input: RejectReviewInput, + ): Promise>; + retireArticle( + access: AccessContext, + input: ArticleCommandInput, + ): Promise>; + setProvenance( + access: AccessContext, + input: SetProvenanceInput, + ): Promise>; + revokeEvidence( + access: AccessContext, + input: RevokeEvidenceInput, + ): Promise>; + getCollection( + access: AccessContext, + input: CollectionReadInput, + ): Promise; + getValidationPolicy( + access: AccessContext, + input: ValidationPolicyReadInput, + ): Promise; + getGovernanceConfiguration( + access: AccessContext, + input: CollectionReadInput, + ): Promise; + getValidationRequirements( + access: AccessContext, + input: ValidationRequirementsReadInput, + ): Promise; + getDraft( + access: AccessContext, + input: ArticleReadInput, + ): Promise; + getEvidence( + access: AccessContext, + input: ArticleReadInput, + ): Promise; + getProvenance( + access: AccessContext, + input: ArticleReadInput, + ): Promise; + getReview(access: AccessContext, input: ArticleReadInput): Promise; + getPublishedArticle( + access: AccessContext, + input: ArticleReadInput, + ): Promise; +} diff --git a/packages/application/tsconfig.json b/packages/application/tsconfig.json new file mode 100644 index 0000000..8747d26 --- /dev/null +++ b/packages/application/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "src", + "tsBuildInfoFile": "tsconfig.tsbuildinfo" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [{ "path": "../contracts" }, { "path": "../core" }] +} diff --git a/packages/contracts/src/index.ts b/packages/contracts/src/index.ts index d6ee940..6f9fea2 100644 --- a/packages/contracts/src/index.ts +++ b/packages/contracts/src/index.ts @@ -13,8 +13,13 @@ export const knowledgePermissions = { collectionManage: "knowledge.collection.manage", publicCollectionApprove: "knowledge.collection.approve-public", articleRead: "knowledge.article.read", + draftRead: "knowledge.article.draft.read", draftWrite: "knowledge.article.draft.write", + evidenceRead: "knowledge.article.evidence.read", evidenceSubmit: "knowledge.article.evidence.submit", + evidenceRevoke: "knowledge.article.evidence.revoke", + provenanceRead: "knowledge.article.provenance.read", + provenanceWrite: "knowledge.article.provenance.write", reviewSubmit: "knowledge.article.review.submit", review: "knowledge.article.review", publish: "knowledge.article.publish", diff --git a/packages/core/README.md b/packages/core/README.md index a6f3b5b..14ce6ab 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -4,13 +4,18 @@ Pure collection, draft, verification, review, publication, and retirement transitions. This initial 0.1.0 source is unpublished. It requires no Support Desk, GitHub, model, framework, database, or provider SDK. -Core owns domain invariants. The later application service authenticates -callers, resolves Authorization Core permissions, loads current authoritative -records, verifies external evidence receipts, and commits state with Audit -through Storage Core. Calling a pure function does not grant a permission. +Core owns domain invariants. The application service checks current named +permissions, loads authoritative records, uses host-verified evidence facts, +and commits state with Audit through Storage Core. The host authenticates +callers and resolves scoped Authorization Core contexts. Calling a pure +function does not grant a permission. ## Entry points +- **validateValidationPolicy** exposes the bounded core validation used by + application governance before persistence. It checks policy requirements, + including content checks and walkthrough workflow checks; it grants no + policy-administration permission. - **createCollection** always starts with portal and bot use disabled. - **previewCollectionPolicy** binds proposed independent portal/bot audiences to the current collection revision. **applyCollectionPolicy** rejects stale or @@ -56,7 +61,7 @@ The aggregate retains one current revision, at most one published revision, and a bounded set of current evidence. It does not store a revision archive. Editing clears current evidence and pending review while preserving the old published snapshot. A published snapshot contains exact evidence references; -later application storage must retain or revoke the corresponding evidence +application storage must retain or revoke the corresponding evidence versions and private provenance according to policy. **isPublicationBoundToCurrentPolicies** checks the published snapshot against diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 7b91d9d..2883ec4 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -18,4 +18,8 @@ export { type EvidenceSubmission, type ReviewContext, } from "./articles.js"; -export { KnowledgeBaseError, knowledgeLimits } from "./validation.js"; +export { + KnowledgeBaseError, + knowledgeLimits, + validatePolicy as validateValidationPolicy, +} from "./validation.js"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18f294e..222b5ec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,36 @@ importers: .: devDependencies: + '@azure/data-tables': + specifier: 13.3.2 + version: 13.3.2 + '@pegma/authorization-core': + specifier: 0.4.0 + version: 0.4.0 + '@pegma/knowledge-base-application': + specifier: 0.1.0 + version: link:packages/application + '@pegma/knowledge-base-contracts': + specifier: 0.1.0 + version: link:packages/contracts + '@pegma/knowledge-base-core': + specifier: 0.1.0 + version: link:packages/core + '@pegma/spine': + specifier: 0.1.2 + version: 0.1.2 + '@pegma/storage-azure-tables': + specifier: 0.4.0 + version: 0.4.0 + '@pegma/storage-core': + specifier: 0.4.0 + version: 0.4.0 '@types/node': specifier: 26.6.6 version: 26.6.6 + azurite: + specifier: 3.37.0 + version: 3.37.0(@types/node@26.6.6) prettier: specifier: 3.9.10 version: 3.9.10 @@ -19,7 +46,28 @@ importers: version: 7.0.2 vitest: specifier: 5.0.5 - version: 5.0.5(@types/node@26.6.6)(vite@8.3.6(@types/node@26.6.6)) + version: 5.0.5(@opentelemetry/api@1.10.0)(@types/node@26.6.6)(vite@8.3.6(@types/node@26.6.6)(yaml@2.9.1)) + + packages/application: + dependencies: + '@pegma/audit': + specifier: 0.2.0 + version: 0.2.0 + '@pegma/authorization-core': + specifier: 0.4.0 + version: 0.4.0 + '@pegma/knowledge-base-contracts': + specifier: 0.1.0 + version: link:../contracts + '@pegma/knowledge-base-core': + specifier: 0.1.0 + version: link:../core + '@pegma/spine': + specifier: 0.1.2 + version: 0.1.2 + '@pegma/storage-core': + specifier: 0.4.0 + version: 0.4.0 packages/contracts: dependencies: @@ -35,6 +83,130 @@ importers: packages: + '@azure-rest/core-client@2.9.0': + resolution: {integrity: sha512-6933vNLqh06RR7rumnrq3UZIeBtRLeBHDPMrieDPIljiCaMMwt0nRw++nd3TOxiohtasNtm29rC+b/9ZVKCOqg==} + engines: {node: '>=22.0.0'} + + '@azure/abort-controller@2.2.0': + resolution: {integrity: sha512-fNAjWnA/nZ2jz31kxR/AqRaUT8ewHBw/WuBIosK0moMy1C9e5ValbDfFdIxJzVOOYaYkV/b2F1S4H/aHiqfVQg==} + engines: {node: '>=22.0.0'} + + '@azure/core-auth@1.11.0': + resolution: {integrity: sha512-IUZydyTUkDnYdstOW9pFOOUQlBjAepK5teihDE3x6yxsPJs/hsAaaYpeGxdxrgtOiJbBKSjKW7MDk7AEhb4LRg==} + engines: {node: '>=22.0.0'} + + '@azure/core-client@1.11.1': + resolution: {integrity: sha512-2QygG2F76ZpMP2eMztiJvAiFMu71M9rDeU7vO/QKg5Css7MgM4frUOslFjhVjRhbGaCNPtz/S8M6y46/fFKVuQ==} + engines: {node: '>=22.0.0'} + + '@azure/core-lro@2.7.2': + resolution: {integrity: sha512-0YIpccoX8m/k00O7mDDMdJpbr6mf1yWo2dfmxt5A8XVZVVMz2SSKaEbMCeJRvgQ0IaSlqhjT47p4hVIRRy90xw==} + engines: {node: '>=18.0.0'} + + '@azure/core-paging@1.7.0': + resolution: {integrity: sha512-7GEAoIsaoBr6KELNRb8nypowCqvk8dnCHFCYg4XD4lOQGY2GqjQg5IhkRjyBFRO18CGSMq05PaNqSOE9GQro3g==} + engines: {node: '>=22.0.0'} + + '@azure/core-process@1.0.0': + resolution: {integrity: sha512-/shnJ+ooO8WPxDhPEeI/2oRQuubn16gZ6CvlbpWbEswZfzwI9tI/sMAHmF3x1LuQ9yZYXfLW3TjzGMLEC5blKg==} + engines: {node: '>=22.0.0'} + + '@azure/core-rest-pipeline@1.25.0': + resolution: {integrity: sha512-bMs8ekJLjX8wPV+9IPBges1SLPyuDtE9g5gLDWOpxzKcoOFQnpLGkbcT1tdw3FaAmDS1gnPmMmJ6y/T5B96kIA==} + engines: {node: '>=22.0.0'} + + '@azure/core-tracing@1.4.0': + resolution: {integrity: sha512-eGwxD0AtncrxeBM4tG8R55Pc3rdX1hNW2WibJAgYpCVA6E93mvvVH+LcssoVjOBrSKWS55yEIHsk0X8ctHmfOQ==} + engines: {node: '>=22.0.0'} + + '@azure/core-util@1.14.0': + resolution: {integrity: sha512-9n2pWK61veAuN0V20t9lOuoV4CFMdyAZ1ygZzvBGk/pBBJRib/PjL9PLXa/aI2CcPpyHfqVsxxqLCYl6uZlfDw==} + engines: {node: '>=22.0.0'} + + '@azure/core-xml@1.6.0': + resolution: {integrity: sha512-e7lX/dk//F6Qf7BB6PTY4+p2yuOQtyOeHGyapYHNwqSp2OnYpwQt49A/Nin2XmKBQ69pwagR4k/lQBq8lbHQkA==} + engines: {node: '>=22.0.0'} + + '@azure/data-tables@13.3.2': + resolution: {integrity: sha512-PZ8e4SnCpTQEbQ1P+CK6NR7Vhb86Jw1S1qJi2IcF1ij4qiPX2b4vIemwNPkYg/gZGMqKbxkPvGRpRmEbBYdXuA==} + engines: {node: '>=20.0.0'} + + '@azure/functions-extensions-base@0.3.0': + resolution: {integrity: sha512-Cux0hLu5ZXlC/Kb+yvJVhRLIdkfFwui2HeT5oGZL00r/GCUUkhGTzRfZUjRN4Bq729mPv3okPucz2z7SMQLStA==} + engines: {node: '>=18.0'} + + '@azure/functions@4.17.0': + resolution: {integrity: sha512-BC+eWRqwL3LYvkfKO0UqVSig4IrEbgbaUvxGC6MhpUJRsZqVlEYHyE0EZcn7MtOc2py1ArJdXkqwuOzdvlbBSA==} + engines: {node: '>=20.0'} + + '@azure/identity@4.14.1': + resolution: {integrity: sha512-HHuuFrmN1uuF9D5A6aAo5eHzNFNX4Q+P4SksZqDKse5YaJFFy/zDLG3wXHEV2FVGgetZ3QM8jGURNBtnQYf1NQ==} + engines: {node: '>=22.0.0'} + + '@azure/keyvault-common@2.1.1': + resolution: {integrity: sha512-SxpomJRTBfDTQnuii3w10WnZNQJGPNi15tRPdPUQz7BqyB3yk976knEueS7R0H9kSLtXbP0wJZXRh0EbRTQ0lw==} + engines: {node: '>=22.0.0'} + + '@azure/keyvault-keys@4.10.2': + resolution: {integrity: sha512-VmUSLbXRAbSzDD8grXHGPaknYs0SKr3yuf6U+d4XMpX4XuVYskNqbTTwXce0zR1LyxfTZm9rWEBcvs3vdYwCmQ==} + engines: {node: '>=20.0.0'} + + '@azure/logger@1.4.0': + resolution: {integrity: sha512-rbAE25KUfjU/s3XHUdJgceoCP5dEOpMx85J04kF+QMdta73XkuG9JGHHinch+XIoKpBdqljin+KqURpJriSzLA==} + engines: {node: '>=22.0.0'} + + '@azure/monitor-opentelemetry-exporter@1.0.0-beta.47': + resolution: {integrity: sha512-GglsCyWZaU1RGfTJBGWEzv8ETtAGOMPOd+4xivvetjFpY3fJtd6GDGKW9W8LFQNTo8nGs2AtbEwjk9W6Ywk4+g==} + engines: {node: '>=22.0.0'} + + '@azure/monitor-opentelemetry@1.21.0': + resolution: {integrity: sha512-hoHOlKLN+R5GAq+e1QPXD/3jjQ9AvaJrHOEX4gPMBjFpguDfcL/uM7Bz/RPe4SosR/K00chXqO60JfTHmwIapw==} + engines: {node: '>=22.0.0'} + + '@azure/ms-rest-js@2.7.0': + resolution: {integrity: sha512-ngbzWbqF+NmztDOpLBVDxYM+XLcUj7nKhxGbSU9WtIsXfRB//cf2ZbAG5HkOrhU9/wd/ORRB6lM/d69RKVjiyA==} + deprecated: This package has been deprecated in favor of the new Azure SDK packages from [Azure SDK for JavaScript](https://github.com/azure/azure-sdk-for-js). + + '@azure/msal-browser@5.29.0': + resolution: {integrity: sha512-Ko/Ovw6h+Gu33mp8f0FUyddr/KDWzbGzcgR8HKZaT4wgTYljLPKJP1rcDu0RHj7pkd4CR2hCHK51XFzgvq/Q5Q==} + engines: {node: '>=0.8.0'} + + '@azure/msal-common@16.16.1': + resolution: {integrity: sha512-dSKdL9h/iercb4GumsKFh+wVvLe1ohuDPiviklgnQVHnY2FYNUlbQJ3E1Qd37vkof9CfraK9BQpCW1hoOg0znQ==} + engines: {node: '>=0.8.0'} + + '@azure/msal-node@7.2.1': + resolution: {integrity: sha512-6mntsfCNq7H1eAPSZik74jT3C5at4nRqiVk7OC+D5Hy3Pe3s76uwE4+J0xvDvlVPmoX2kasf3mSwUmzeq9rW/A==} + engines: {node: '>=20'} + + '@azure/opentelemetry-instrumentation-azure-sdk@1.0.0': + resolution: {integrity: sha512-Y8rZOIMXQY/GwNRL+uLVuwIn9aEa/KnnggyYUmFxC1MigmRJCNH5NxMmxKSpddXF9SW6Z1ijRd6Pptd2A5OhGw==} + engines: {node: '>=20.0.0'} + + '@azure/opentelemetry-instrumentation-azure-sdk@1.1.0-beta.1': + resolution: {integrity: sha512-FJCHWlMA//XMs5rxf1z/mN0gaWPbJhlAVw5l4IxKhEtZX2bgNERlqbdBWXNjjkok+nTh0UcKqV5G0rrCupo+4A==} + engines: {node: '>=20.0.0'} + + '@colors/colors@1.6.0': + resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==} + engines: {node: '>=0.1.90'} + + '@colors/colors@1.6.1': + resolution: {integrity: sha512-dTmUJzXSuayBK+hZydEaXd2mhx61qWQwkwaBBY6LyEOVx/L9aQU5ac8eFNEsd9nrD1+zb9zvDCphLSe8g1F4Qw==} + engines: {node: '>=0.1.90'} + + '@dabh/diagnostics@2.0.9': + resolution: {integrity: sha512-R6siwR65Hm+3yfgP7o8DKhNvputQAwfoz9zTc3kyDudnomj2/BcLmD+uGQQPICjuFUp8ounPBU+jmKsocwVVAg==} + + '@grpc/grpc-js@1.14.7': + resolution: {integrity: sha512-W4W/fcBMGRVtG6dW2c7cw2mnpS3hvbBd+oQXjh2iYFTZDk1JJmcNqkM5KSaPubQpamlUUurrlb7G1s9NJeERmQ==} + engines: {node: '>=12.10.0'} + + '@grpc/proto-loader@0.8.1': + resolution: {integrity: sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==} + engines: {node: '>=6'} + hasBin: true + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -45,13 +217,382 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@js-joda/core@6.3.2': + resolution: {integrity: sha512-BVsYu84Gut8YTNR1v5/PnifmqXv4SVcfA/hVIM/mXADZfIocip/DfNppBtv+4am5hGH1XuH6FSoU8OHkBvZMeA==} + + '@js-sdsl/ordered-map@4.4.2': + resolution: {integrity: sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==} + + '@microsoft/applicationinsights-web-snippet@1.2.3': + resolution: {integrity: sha512-59ex4x1/PabGQIg+o0GKG5olqAJYBvMOiXec/9HCD3hK2y36YMWT0ivq5mequvtS5+21kco3SOnMB6QyScLPIA==} + + '@nodable/entities@3.1.0': + resolution: {integrity: sha512-LsS/DjHr+uDM647Gru/cA8+J3a3HfhttwCKLyuoyN7yXTFCxKBtSgMQBvrW9yNPa2/zDRUNuGPaH5QUFoa4arQ==} + + '@opentelemetry/api-logs@0.211.0': + resolution: {integrity: sha512-swFdZq8MCdmdR22jTVGQDhwqDzcI4M10nhjXkLr1EsIzXgZBqm4ZlmmcWsg3TSNf+3mzgOiqveXmBLZuDi2Lgg==} + engines: {node: '>=8.0.0'} + + '@opentelemetry/api-logs@0.221.0': + resolution: {integrity: sha512-OlanaW1vv7ufTqQ3/fPLI4arGt5ZoM+P8abOMki6uEYnpRazepSWDwDnnw+la7kE26SHVC18//SMccrDvLKOXQ==} + engines: {node: '>=8.0.0'} + + '@opentelemetry/api@1.10.0': + resolution: {integrity: sha512-lMkyes8iHrG+mk6WH7X70MdCLI2RS0FwNBY1PyQ8UemaijE2m5mv5A0Niy3HtbYTFrgkUEQjFMXmSAk2hQDuPQ==} + engines: {node: '>=8.0.0'} + + '@opentelemetry/configuration@0.221.0': + resolution: {integrity: sha512-uE9y56Zdi9Gt/RdxYnVOo3YmFZkKJJMA0gqtBe8wh8gdtF5Asqe+Oh/TWiDtFb1s+31jNY4CWgnfIB1KOITfFA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.9.0 + + '@opentelemetry/context-async-hooks@2.10.0': + resolution: {integrity: sha512-bvyMcgLEkozzSzpEEEo1OMoeQ97bxj6Qs2uN3mPrSdDvObMI1myffD/BPqcLlzZO9//d1SqQA/WPw7Cz2AiqhA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/context-async-hooks@2.12.0': + resolution: {integrity: sha512-iK/1nD7mmZVkuYjVjkdFBiCvzntJdFny1S3CYbUYyOq7V5enL6XX+gJ7eh965L1LnS11VA8mQ7Ej/ck04SB0MQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/core@2.10.0': + resolution: {integrity: sha512-/wNZ8twnEQQA4HoHu22+vcsdru6pWPWxW+7w+FlxT6Id7PE/WIbZmVKkte+PF72e0F2dnImFeHD2syyE1Mw6MQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/core@2.12.0': + resolution: {integrity: sha512-1HsSAuvT4/my0QrXWsyXFdWjKaPeCHsismKZgEEIb8NK13LP6DrMRlsUbvD/0F9mDWK3xDom9AMv3IscxgOnOQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/exporter-logs-otlp-grpc@0.221.0': + resolution: {integrity: sha512-txG1G0IrYSsKKMeiWZfj/i5cQmWB+h+hf3HzPpF3RqZVwp+iQQEIsv8Vtmzy6RWVdHdJZfygmVrBI39YTBvWcw==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-logs-otlp-http@0.221.0': + resolution: {integrity: sha512-nKXkr4Tomi6fjYVOf+ytcW3dZAVr4v4Bv5gsT6dr2gvpUPJpKgHB4XbMufMsPotRE3g0XH2GwVVCkN2w6SON+Q==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-logs-otlp-proto@0.221.0': + resolution: {integrity: sha512-AH6EY+47gXFaWYgG3hfeOneGiE9xIZGtDBk+9g0sM8NZWzsQhhmqPbQQXJzS7pyCh5jRRr2nYNXVrkCmoojRvQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-metrics-otlp-grpc@0.221.0': + resolution: {integrity: sha512-KOgCtO15FC6C1T/xOqBcr7EyUs7B+7yomGNb5Y97d3s38rPbCCk5sewkmE2b0/itOkQ/PptX8CLlD+kn2mEtTg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-metrics-otlp-http@0.221.0': + resolution: {integrity: sha512-sRfCKbOzgy8xZQV2as0RzIZlnCmCseCKZGLfRcrpo2CBngJDr+rPtX0zkG0+oUCV5kfQPUoW3W3C96Ag3Y/Clg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-metrics-otlp-proto@0.221.0': + resolution: {integrity: sha512-YMF4LveY2I3yhw61rn6nmC9FE8U24IZHPeKU1Duc5+sbwjMd8FwZAwba318ImdThCg/HuVQvhm2y6bfgNPnfYg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-prometheus@0.221.0': + resolution: {integrity: sha512-kW79a20qWESIuAdDrxzg9WKM98twV/NBWBFRAH57ap/+ssZhiCo0hckzKT0zpuwR/gSHrFAQhJL0bYDrnEM34g==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-trace-otlp-grpc@0.221.0': + resolution: {integrity: sha512-zXminlZedtq9LvOW64CnNkOqk15zV75k8JgtdTuWFge6+jk2m4GmAUm6L2eIiG1o2a2bZxXw2PDrszm+bps0IA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-trace-otlp-http@0.221.0': + resolution: {integrity: sha512-AySXiKoC+meiWm6zdVj5T2LnPDZuatveBby1cMOeQteIWsYXAUxs8Sru13G2pVSPrUXz6vF+og7QVBX6GdC/oQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-trace-otlp-proto@0.221.0': + resolution: {integrity: sha512-Z9i2T7vgZbWe9rSLYxXVIbeW+XyzUq4rZanW3ZyVNwVDqCsh0EJKUgBWWQ0CZfeuUA+RQPzKgJQHMuWAUnKqXw==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/exporter-zipkin@2.10.0': + resolution: {integrity: sha512-7gsvgf0UDoJ4l9ObrwBmz5G/ZogiPk+lq+g5GpLp24YQF/vPM/BSsnOfcLnfinast5ASUgLo78uSC/ObjlnXgg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + + '@opentelemetry/instrumentation-bunyan@0.66.0': + resolution: {integrity: sha512-IqYQC1dav35NHlD5nYnpBXK8tI6KJ9/MIt8LYKFxwlhMIwfBCfavaklyP8NtVKoJ0WZKzX2v9Sh+xGK1XvSniQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation-console@0.3.0': + resolution: {integrity: sha512-PwMaImP/ZiNzCWio00tL+3RPlHMHb852UOHLG9WYxU18rJuCPRfU40xSc0VuMEd1C7+rNhjjVHM10sWLLlN8KQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.9.1 + + '@opentelemetry/instrumentation-http@0.221.0': + resolution: {integrity: sha512-oIP91CPIANuYr09tGFElPFKAh6JUar+awJf1kBRYlaeo9b0gDwZHEB2zBfFlvdNFHm0wAVutMZODVi5smKT30g==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation-mongodb@0.74.0': + resolution: {integrity: sha512-GRnHu69YLQUYgguuYkKi6wpizMY4r7gLC08rSq8cg41p6t7+1YIy5nXoGC61NA7KCZUE9jbcDnzd45i32IblZg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation-mysql@0.67.0': + resolution: {integrity: sha512-G4aRrVKcd2Aodqi7WzRZ3LQJNKrM8BpsXEVMHrOb9s8Lg0jZXNvlLY0NWL1yVJrjnqI/unwEsp2aVHkVImPMeA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation-pg@0.73.0': + resolution: {integrity: sha512-yf3tBVwLHB9cZNNPSToNrthx36ouPe4FctFxy7ya6vSJ6gaiKjNfA/IgFFeuBpZflEQhy6aesPqzZo8ZjFkvNg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation-redis@0.69.0': + resolution: {integrity: sha512-lyCIEW89cYhMwaUSMBzsKHdwH2wOoqmuwXOARJneo9UL55govLIUCbYYAJ457oM8kdKADymlY4+SUW0DKQeIHw==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation-winston@0.65.0': + resolution: {integrity: sha512-hWSPnS530deRa+ttzY+QiGmgsK7aQHpqxbQRm56yO1j4qnIXuYYHaoSJ8/4lLOEcXB+hZs0mAAJ6QiMl1aaiGA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation@0.211.0': + resolution: {integrity: sha512-h0nrZEC/zvI994nhg7EgQ8URIHt0uDTwN90r3qQUdZORS455bbx+YebnGeEuFghUT0HlJSrLF4iHw67f+odY+Q==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/instrumentation@0.221.0': + resolution: {integrity: sha512-cCk80Z/iRDf/5gfsKMB4f74LqVA5yKETB/9ojPzVW/6/f70iu89nJvGxsFCxx4XfSohaOofkU19kiYm84AiAlw==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/otlp-exporter-base@0.221.0': + resolution: {integrity: sha512-UFPIq80OH3Ns/oPFHRj14d4DTOxUo+MUFU8hUiCq5jTqFhdeJnfVSANHT+xp92409cA+oxzvlZCe6NM1wvCuBA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/otlp-grpc-exporter-base@0.221.0': + resolution: {integrity: sha512-rQDmNgyiGCTrescjnzH2ntVyUKVIq6I2UjuK8+stT/Xg0ZOT71FVJqwjFdspQl6Yol/Yqsut9bDo+ame8oTmDQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/otlp-transformer@0.221.0': + resolution: {integrity: sha512-lg6lkOU08Az23jVcn/0Els9HP+V8PnR4Km6p0KgpTggS0n/WuhnmY64rSh83Of9iR9nD+dpWr6adlcX8KzAwjg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.3.0 + + '@opentelemetry/propagator-b3@2.10.0': + resolution: {integrity: sha512-GnA5B24H+1w8BO21J0q+IWNB0z1v+AGbcquTdIt/dufibhnhgxaA8YKvz0I3akRZhB1jHT+/tlzK+qlAjEDybQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/propagator-jaeger@2.10.0': + resolution: {integrity: sha512-yw/IX8DL470dSMZJoE82ScfYGp7JWZ/G8kFJo35ZILUVTB2jFPTOaioN+8s09pH0RHsWNhweVZb+ZnjJJpCChg==} + engines: {node: ^18.19.0 || >=20.6.0} + deprecated: Package no longer supported. See https://github.com/open-telemetry/opentelemetry-js/pull/7077 + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/redis-common@0.38.3': + resolution: {integrity: sha512-VCghU1JYs/4gP6Gqf/xro9MEsZ7LrMv2uONVsaESKL38ZOB9BqnI98FfS23wjMnHlpuE+TTaWSoAVNpTwYXzjw==} + engines: {node: ^18.19.0 || >=20.6.0} + + '@opentelemetry/resource-detector-azure@0.29.0': + resolution: {integrity: sha512-lWm0vjjlQMoc4Xvvd+dW/OZWT/SI4w+cIN7kbm8KimIZCr1EpAyvyQ7WEOrGoBoXCpQCrsZ18uKTooDgiBCGIw==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.0.0 + + '@opentelemetry/resources@2.10.0': + resolution: {integrity: sha512-q6MMm2zhggzsHVNbabYwut+a6nbuQQe3URUoxaojM/8K1IBfwwPzvxIjNi2/lI1TFe+fMHMW9MWhrtDLEXEnkA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/resources@2.12.0': + resolution: {integrity: sha512-+rSRoOdln6NhXTVcBdHSlZxJDNzwxadeweK2ltZO3tVtfp6aklABc06xclDk6ovRR+EiGgIcSbh/6NgjFhnb3A==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/sdk-logs@0.221.0': + resolution: {integrity: sha512-FaDcazjyMp7TZZZAsqbo4IkovP0UegoCu0EBkiNt+qCqvUf7FPAsfcrZ3+ZEkKgXZ/jHafop+JoGPDk3A0SmLg==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.4.0 <1.10.0' + + '@opentelemetry/sdk-metrics@2.10.0': + resolution: {integrity: sha512-t6r1VSvXNtSDnPXU1FbZeetJb7yyovHmgu0wRSoftxtE0g2rSNhQZQUy69sRUCL+iioJpX8SN/S6wq6ZtvLySQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.9.0 <1.10.0' + + '@opentelemetry/sdk-metrics@2.12.0': + resolution: {integrity: sha512-mVMaEHwCUJuY3S4Esn+nT0yQA3qCEGh+SOPJsXygU0Gl453WcsDNjtEa8EfdewMwoLyr1tlofB4fXytVpiXuow==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.9.0 <1.10.0' + + '@opentelemetry/sdk-node@0.221.0': + resolution: {integrity: sha512-UbYuvtBrQQB5Prsh9KOKy4kxzexFxfMs5MkteHeWMoswsEB7kiNhyUVkAOFW/qsEzNHtrkgyghrD2ilZJa+5YA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/sdk-trace-base@2.10.0': + resolution: {integrity: sha512-GuYQQT7QD2EeO8lcZLRQzcbOyhqAzL+6WWTKTU9mSUBYBazkEDl+VrQcXQhbB08OWM9anD1aHleVadzulpOaUQ==} + engines: {node: ^18.19.0 || >=20.6.0} + deprecated: Use @opentelemetry/sdk-trace package + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/sdk-trace-base@2.12.0': + resolution: {integrity: sha512-JOERgZCxRM06FEJ5kEWxlSRChah6MmXDx3KwCruqEv/iEyLkTokCSemf2y1w8oIHtfrr8EVTpzebq/31vn2Cpg==} + engines: {node: ^18.19.0 || >=20.6.0} + deprecated: Use @opentelemetry/sdk-trace package + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/sdk-trace-node@2.10.0': + resolution: {integrity: sha512-GZK/G6oZyBLGlH1pUgeDch7D91KoHd2uotUGIkWCPi9GI5T9X0p4L7nNAMDR1BQjkRYoDqo+ddfVx9t5Uhys+Q==} + engines: {node: ^18.19.0 || >=20.6.0} + deprecated: Use @opentelemetry/sdk-trace package + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/sdk-trace-node@2.12.0': + resolution: {integrity: sha512-9DufH1IlmQMoKAfot5y/FhTP1RnmhLb5K6eKmJO/bvzPjYwPAazoiAUbTZFdPbqxOXN0FEbhZx/e6SB1Og4jmg==} + engines: {node: ^18.19.0 || >=20.6.0} + deprecated: Use @opentelemetry/sdk-trace package + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/sdk-trace-web@2.12.0': + resolution: {integrity: sha512-y0hCzbnBHScmioF0drJOyaPk1sQf2wwbIuy3rWlM0Fcx8mLfPDvFsQ7tJ+zMm8yAqI06rSlFKkL7ZpcrFOqAdQ==} + engines: {node: ^18.19.0 || >=20.6.0} + deprecated: Use @opentelemetry/sdk-trace package + peerDependencies: + '@opentelemetry/api': '>=1.0.0 <1.10.0' + + '@opentelemetry/sdk-trace@2.10.0': + resolution: {integrity: sha512-MfQGq3GRmTh5fM/y+OjaO0vj6+luCB1XO2gfXCalKCfgKw0eHL++sm75DNweC6ohlp+aFvACqeE0fYayqdRaoQ==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/sdk-trace@2.12.0': + resolution: {integrity: sha512-ImVuRQ6faOsTi1Wna88s2avgrrf/iDgXPigIeynkUhjstMuoQUDOJXgkez2j1mlU4btjXcXBGa+q7qKFYR3GsA==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': '>=1.3.0 <1.10.0' + + '@opentelemetry/semantic-conventions@1.45.0': + resolution: {integrity: sha512-aOP45mbcOKbQVvFWfQmgoOPT8R2iwbbbgl83k4CujGV9BrJhFr3qG55MFpwFs4YLabpuW3HhzUY9eQxPlDqaZw==} + engines: {node: '>=14'} + + '@opentelemetry/sql-common@0.42.0': + resolution: {integrity: sha512-nwUwUU+8O8a4bnLqk6CodWeegGMEANgC94KTAhXcpGWLrW/2/hek/0ajNbjXnSOoNuCX+nteUPs46HFHhou9Xw==} + engines: {node: ^18.19.0 || >=20.6.0} + peerDependencies: + '@opentelemetry/api': ^1.1.0 + + '@opentelemetry/winston-transport@0.31.0': + resolution: {integrity: sha512-higyMoGHbDTNlCX5ue1dJjDQuYSWwC0L4k6x57RKLG0uXdCIdyIu/OQYnjciL+7Kv2XmPMy4VQloeh36NTJTuQ==} + engines: {node: ^18.19.0 || >=20.6.0} + '@oxc-project/types@0.156.0': resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==} + '@pegma/audit@0.2.0': + resolution: {integrity: sha512-gUcfdp1QrLJtaMImA9NzZWfDEIuqBkALepceDIl1NPyCt0ZcdMs2ud8GuppQY5wXCB1/rgCYWYzep2OkDCrMBA==} + engines: {node: '>=22'} + + '@pegma/authorization-contracts@0.4.0': + resolution: {integrity: sha512-7o+oN/CyBGcDb3rUDzJpLSi7VYS/hAk2h0LfEEPpQmT46Mk/3xLwNrXS6WPuVFT2UMdJNeExgFu7Og6pYbFMMQ==} + engines: {node: '>=22'} + + '@pegma/authorization-core@0.4.0': + resolution: {integrity: sha512-GkagQwyDfKokB2Nm9EAo6cvKB8c90VN6Or6IdaWeMwCeuseOxDZ8ccxKqccW9YorByE6rHhr2nbxjsNWorZTHQ==} + engines: {node: '>=22'} + + '@pegma/spine@0.1.1': + resolution: {integrity: sha512-EV0Zq8KJX7r7ybI+eIHUCAhnd261bveZykMQVmmZibSDRJVcd2bOuYCPvPg4wax7GmrUrdtVFJYEJqHl4PkhwQ==} + engines: {node: '>=22'} + '@pegma/spine@0.1.2': resolution: {integrity: sha512-jueFYJ3oJUacKdiERkEZ7R34xDMiEWXqn4MSA5bpTXzsXhWSap4EJUzKXtXnXuLPPjwJWLn5uoQe98kWQ6NS8A==} engines: {node: '>=22'} + '@pegma/storage-azure-tables@0.4.0': + resolution: {integrity: sha512-cHVrLyQRf8qu2d83fgO7spPxKxAZlOOfvEi/t38S6l3SD2678khJvUMcvAHm/rAQ8BlReDWd6WSnIZuQiI3A1Q==} + engines: {node: '>=22'} + + '@pegma/storage-core@0.4.0': + resolution: {integrity: sha512-aWbRhhis4Qs4TvH1Sb+OCI0a0ddOyV+6pm6HhPs+XPlaP86mTaV7OlwkIIPqk5Hw45t//tNaqfaggUeOc7rIGA==} + engines: {node: '>=22'} + + '@protobufjs/aspromise@1.1.2': + resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} + + '@protobufjs/base64@1.1.2': + resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} + + '@protobufjs/codegen@2.0.5': + resolution: {integrity: sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==} + + '@protobufjs/eventemitter@1.1.1': + resolution: {integrity: sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==} + + '@protobufjs/fetch@1.1.1': + resolution: {integrity: sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==} + + '@protobufjs/float@1.0.2': + resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} + + '@protobufjs/path@1.1.2': + resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} + + '@protobufjs/pool@1.1.0': + resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} + + '@protobufjs/utf8@1.1.2': + resolution: {integrity: sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==} + '@rolldown/binding-android-arm-eabi@1.2.16': resolution: {integrity: sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -151,18 +692,48 @@ packages: '@rolldown/pluginutils@1.0.1': resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + '@so-ric/colorspace@1.1.6': + resolution: {integrity: sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw==} + + '@types/bunyan@1.8.11': + resolution: {integrity: sha512-758fRH7umIMk5qt5ELmRMff4mLDlN+xyYzC+dkPTdKwbSkJFvz6xwyScrytPU0QIBbRRwbiE8/BIg8bpajerNQ==} + '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + '@types/debug@4.1.13': + resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==} + '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} '@types/estree@1.0.10': resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==} + '@types/ms@2.1.0': + resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + + '@types/mysql@2.15.27': + resolution: {integrity: sha512-YfWiV16IY0OeBfBCk8+hXKmdTKrKlwKN1MNKAPBu5JYxLwBEZl7QzeEpGnlZb3VMGJrrGmB84gXiH+ofs/TezA==} + '@types/node@26.6.6': resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==} + '@types/pg-pool@2.0.7': + resolution: {integrity: sha512-U4CwmGVQcbEuqpyju8/ptOKg6gEC+Tqsvj2xS9o1g71bUh8twxnC6ZL5rZKCsGN0iyH0CwgUyc9VR5owNQF9Ng==} + + '@types/pg@8.15.6': + resolution: {integrity: sha512-NoaMtzhxOrubeL/7UZuNTrejB4MPAJ0RpxZqXQf2qXuVlTPuG6Y8p4u9dKRaue4yjmC7ZhzVO2/Yyyn25znrPQ==} + + '@types/readable-stream@4.0.25': + resolution: {integrity: sha512-7GsxL8Wd5X3jh73/qgW7WCnbBvGSdD8U3E4Jiuus3/8I+PN20DtlkJtwFhr/sImXfDDQ2Z03i/9wNiIF3TVSsw==} + + '@types/triple-beam@1.3.5': + resolution: {integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==} + + '@types/validator@13.15.10': + resolution: {integrity: sha512-T8L6i7wCuyoK8A/ZeLYt1+q0ty3Zb9+qbSSvrIVitzT3YjZqkTZ40IbRsPanlB4h1QB3JVL1SYCdR6ngtFYcuA==} + '@typescript/typescript-aix-ppc64@7.0.2': resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==} engines: {node: '>=16.20.0'} @@ -283,6 +854,10 @@ packages: cpu: [x64] os: [win32] + '@typespec/ts-http-runtime@0.3.9': + resolution: {integrity: sha512-edSdeAqkdxBVzA1yL1LrLCml1YjyCVvPMtMqJpbF+6K609tHe8V6sQUzFQSGcYNhcuhOceZtjvN32+mpIth30A==} + engines: {node: '>=22.0.0'} + '@vitest/mocker@5.0.5': resolution: {integrity: sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==} peerDependencies: @@ -297,53 +872,519 @@ packages: '@vitest/spy@5.0.5': resolution: {integrity: sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==} + abort-controller@3.0.0: + resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} + engines: {node: '>=6.5'} + + accepts@2.0.0: + resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} + engines: {node: '>= 0.6'} + + acorn-import-attributes@1.9.5: + resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} + peerDependencies: + acorn: ^8 + + acorn@8.19.0: + resolution: {integrity: sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + anynum@1.0.1: + resolution: {integrity: sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==} + + applicationinsights@3.17.0: + resolution: {integrity: sha512-+53E/0oXjl1x/o4fCLCxdEoUqqqRSg1EPH1+U07/6MHkALsmKtUTyKPrqhIgCGE/fIowQGNIFBkoSDYibfYW9A==} + engines: {node: '>=22.0.0'} + + args@5.0.3: + resolution: {integrity: sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA==} + engines: {node: '>= 6.0.0'} + assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} + async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + aws-ssl-profiles@1.1.2: + resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==} + engines: {node: '>= 6.0.0'} + + axios@1.21.0: + resolution: {integrity: sha512-YCzXMB53Q9PZBsh7yN7wtapit4WepwcHS2fP8QhGsBxSz5YtgYobV7GGlWlAJi+RxfU77GQTQi2DSLUma42EYA==} + + azurite@3.37.0: + resolution: {integrity: sha512-dl2AXMkXtVlX9s3U3ttIQFFlKwe64k/ugSIVNT4V3qX488Ncw988rIHAs6apgUtfEzyqwtFN9MZp0Foq60Htag==} + engines: {node: '>=22.0.0', vscode: ^1.39.0} + hasBin: true + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + basic-auth@2.0.1: + resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} + engines: {node: '>= 0.8'} + + bl@6.1.6: + resolution: {integrity: sha512-jLsPgN/YSvPUg9UX0Kd73CXpm2Psg9FxMeCSXnk3WBO3CMT10JMwijubhGfHCnFu6TPn1ei3b975dxv7K2pWVg==} + + body-parser@2.4.0: + resolution: {integrity: sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==} + engines: {node: '>=18'} + + buffer-equal-constant-time@1.0.1: + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} + + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + + bundle-name@4.1.1: + resolution: {integrity: sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==} + engines: {node: '>=18'} + + bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + + camelcase@5.0.0: + resolution: {integrity: sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==} + engines: {node: '>=6'} + chai@6.3.0: resolution: {integrity: sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==} engines: {node: '>=18'} - detect-libc@2.1.2: - resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} - engines: {node: '>=8'} + chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} - es-module-lexer@2.3.2: - resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + cjs-module-lexer@2.3.0: + resolution: {integrity: sha512-lmNyBzi6iYiqyrExTctfmjd8tInx+dHu9PBomTfH5RXS53c27JMFJgzNv5TyAnm3PgGf+MLy0+Ws41/HlVxdKQ==} - estree-walker@3.0.3: - resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} - expect-type@1.4.0: - resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} - engines: {node: '>=12.0.0'} + color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - fdir@6.5.0: - resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} - engines: {node: '>=12.0.0'} - peerDependencies: - picomatch: ^3 || ^4 - peerDependenciesMeta: - picomatch: - optional: true + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} - fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] + color-convert@3.1.3: + resolution: {integrity: sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg==} + engines: {node: '>=14.6'} - lightningcss-android-arm64@1.33.0: - resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==} - engines: {node: '>= 12.0.0'} - cpu: [arm64] - os: [android] + color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - lightningcss-darwin-arm64@1.33.0: - resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==} - engines: {node: '>= 12.0.0'} - cpu: [arm64] - os: [darwin] + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + color-name@2.1.1: + resolution: {integrity: sha512-p2FdgwVx1a9yWBHP2wI0VgShkDpgN4kZISkxdNipGBJWpa5G6b04OINlVWCyJj0JmfvcPrgqt95E9k8yvaOJFg==} + engines: {node: '>=12.20'} + + color-string@2.1.4: + resolution: {integrity: sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg==} + engines: {node: '>=18'} + + color@5.0.3: + resolution: {integrity: sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA==} + engines: {node: '>=18'} + + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + content-disposition@2.0.1: + resolution: {integrity: sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==} + engines: {node: '>=18'} + + content-type@2.1.0: + resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==} + engines: {node: '>=18'} + + cookie-signature@1.2.2: + resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} + engines: {node: '>=6.6.0'} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + debug@2.6.9: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + default-browser-id@5.0.1: + resolution: {integrity: sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==} + engines: {node: '>=18'} + + default-browser@5.5.1: + resolution: {integrity: sha512-m1pAzaJgZ/gssEqlOhJkPJp8Xly7QyW6xcrkUa2KKcDeDSEMP7X8xipU3snUcfisTQx0w1AGae+9UtJSfVnXGw==} + engines: {node: '>=18'} + + define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + dottie@2.0.7: + resolution: {integrity: sha512-7lAK2A0b3zZr3UC5aE69CPdCFR4RHW1o2Dr74TqFykxkUCBXSRJum/yPc7g8zRHJqWKomPLHwFLLoUnn8PXXRg==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + ecdsa-sig-formatter@1.0.11: + resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} + + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + enabled@2.0.0: + resolution: {integrity: sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==} + + encodeurl@2.0.1: + resolution: {integrity: sha512-Ev/hIyePLZtpL98x562lvPtenrUfGr0lfaf44HFZ+hDEwso7ccV9QAZrEVLg0hxNAzygaAFxy2dYaAKKM0G06A==} + engines: {node: '>= 0.8'} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-module-lexer@2.3.2: + resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + + es-module-lexer@3.0.4: + resolution: {integrity: sha512-BldNY5mwkVu+cQ5Ymn3e6hB9Sx8XHx4ZevWbiUyZbfKxJxYO27Hf0wfzkxIaD5CAJMaGl3YspKELj0ff/7nCMA==} + + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + event-target-shim@5.0.1: + resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} + engines: {node: '>=6'} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + + express@5.3.0: + resolution: {integrity: sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==} + engines: {node: '>= 18'} + + fast-xml-builder@1.3.1: + resolution: {integrity: sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==} + + fast-xml-parser@5.12.0: + resolution: {integrity: sha512-/pXxRBtwxY9w8z7YbgsvIPPcPvFDsTbIkWwTQJhzNJPokj+TbN6ftmcv4j/pEQDvOCNnKGDzuk5Bo2oogIOiFg==} + hasBin: true + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fecha@4.2.3: + resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==} + + finalhandler@2.1.1: + resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} + engines: {node: '>= 18.0.0'} + + fn.name@1.1.0: + resolution: {integrity: sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==} + + follow-redirects@1.16.2: + resolution: {integrity: sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + + form-data@2.5.6: + resolution: {integrity: sha512-Ogz/E85h9tlfJzpI6TuFpGcHZFhLrb9Gw8wq9v40CxSCPnv7ahKr6Xgtkn0KYCDQJ8DNn5VoMO8EXr9V5PadyA==} + engines: {node: '>= 0.12'} + + form-data@4.0.6: + resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==} + engines: {node: '>= 6'} + + forwarded-parse@2.1.2: + resolution: {integrity: sha512-alTFZZQDKMporBH77856pXgzhEzaUVmLCDk+egLgIgHst3Tpndzz8MnKe+GzRJRfvVdn69HhpW7cmXzvtLvJAw==} + + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} + + fs-extra@11.4.1: + resolution: {integrity: sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA==} + engines: {node: '>=14.14'} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + generate-function@2.3.1: + resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} + + http-errors@2.0.1: + resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} + engines: {node: '>= 0.8'} + + http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + + https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + iconv-lite@0.7.3: + resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==} + engines: {node: '>=0.10.0'} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + import-in-the-middle@2.0.6: + resolution: {integrity: sha512-3vZV3jX0XRFW3EJDTwzWoZa+RH1b8eTTx6YOCjglrLyPuepwoBti1k3L2dKwdCUrnVEfc5CuRuGstaC/uQJJaw==} + + import-in-the-middle@3.6.0: + resolution: {integrity: sha512-xRU7hI24S2FhucXtuZXn8EpcOjfVP6iiEQyR0USayPeaOroEmSsNlqnl95866iRdRtkHrd6Q/Z4D14R60au0+A==} + engines: {node: '>=18'} + + inflection@1.13.4: + resolution: {integrity: sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw==} + engines: {'0': node >= 0.4.0} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + + is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-in-ssh@1.0.0: + resolution: {integrity: sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==} + engines: {node: '>=20'} + + is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + + is-promise@4.0.0: + resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + + is-property@1.0.2: + resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==} + + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + + is-unsafe@2.0.3: + resolution: {integrity: sha512-ZBllczCCO267vgdFb6Tq3pv+LhHaCiGMdr+ZsuL+OopruAg7S+3ZDs1vD0RPC0uSrkjzbraxaGjtX1YBxjPeFQ==} + + is-wsl@3.1.1: + resolution: {integrity: sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==} + engines: {node: '>=16'} + + js-md4@0.3.2: + resolution: {integrity: sha512-/GDnfQYsltsjRswQhN9fhv3EMw2sCpUdrdxyWDOUK7eyD++r3gRhzgiQgc/x4MAv2i1iuQ4lxO5mvqM3vj4bwA==} + + jsonfile@6.2.1: + resolution: {integrity: sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==} + + jsonwebtoken@9.0.3: + resolution: {integrity: sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==} + engines: {node: '>=12', npm: '>=6'} + + jwa@2.0.1: + resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==} + + jws@4.0.1: + resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==} + + kuler@2.0.0: + resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==} + + leven@2.1.0: + resolution: {integrity: sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==} + engines: {node: '>=0.10.0'} + + lightningcss-android-arm64@1.33.0: + resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [android] + + lightningcss-darwin-arm64@1.33.0: + resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [darwin] lightningcss-darwin-x64@1.33.0: resolution: {integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==} @@ -407,18 +1448,186 @@ packages: resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==} engines: {node: '>= 12.0.0'} + lodash.camelcase@4.3.0: + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} + + lodash.includes@4.3.0: + resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} + + lodash.isboolean@3.0.3: + resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} + + lodash.isinteger@4.0.4: + resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} + + lodash.isnumber@3.0.3: + resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==} + + lodash.isplainobject@4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + + lodash.isstring@4.0.1: + resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} + + lodash.once@4.1.1: + resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} + + lodash@4.18.1: + resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} + + logform@2.7.0: + resolution: {integrity: sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==} + engines: {node: '>= 12.0.0'} + + lokijs@1.5.12: + resolution: {integrity: sha512-Q5ALD6JiS6xAUWCwX3taQmgwxyveCtIIuL08+ml0nHwT3k0S/GIFJN+Hd38b1qYIMaE5X++iqsqWVksz7SYW+Q==} + + long@5.3.2: + resolution: {integrity: sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==} + + lru.min@1.1.5: + resolution: {integrity: sha512-5J9ysMYUpYIg9RF2vJpy9SinEmSviFSe0GyPpCQ4L5QSkLAgeLXlTAOu2ZwWUU5m+0SBl6gUU1R1ZQB3aKypfA==} + engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'} + magic-string@1.4.5: resolution: {integrity: sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==} + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + media-typer@1.1.1: + resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==} + engines: {node: '>= 0.8'} + + merge-descriptors@2.0.0: + resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} + engines: {node: '>=18'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mime-types@3.0.2: + resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} + engines: {node: '>=18'} + + module-details-from-path@1.0.4: + resolution: {integrity: sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==} + + moment-timezone@0.5.48: + resolution: {integrity: sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==} + + moment@2.31.0: + resolution: {integrity: sha512-0acOTfMiWOheYS4eoWb80yYMb/JLvVv9SHbs2PehaDzfUG0Bw855SKyk0IKTnPGa5+U2bmi3W68l1+sGLX/pvw==} + + morgan@1.12.1: + resolution: {integrity: sha512-tljKC0ex20AjO58Ob/eZ53JloycbVswbVNCHx6V6VLGzqt/w8dIynVGL0G8qVjNKwiA7sYSogCrN6QtJ82IV+g==} + engines: {node: '>= 0.8.0'} + + mri@1.1.4: + resolution: {integrity: sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==} + engines: {node: '>=4'} + + ms@2.0.0: + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + multistream@4.1.0: + resolution: {integrity: sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==} + + mysql2@3.24.6: + resolution: {integrity: sha512-enu73KhbAua2L3dIxjc6qg6ZJ7H3pt1BImZASWNWY5xSsmJ1ZuUPULTDGXgmJbI61vb+nJAG19IZclIq19UidQ==} + engines: {node: '>= 8.0'} + peerDependencies: + '@types/node': '>= 8' + + named-placeholders@1.1.6: + resolution: {integrity: sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w==} + engines: {node: '>=8.0.0'} + nanoid@3.3.20: resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + native-duplexpair@1.0.0: + resolution: {integrity: sha512-E7QQoM+3jvNtlmyfqRZ0/U75VFgCls+fSkbml2MpgWkWyz3ox8Y58gNhfuziuQYGNNQAbFZJQck55LHCnCK6CA==} + + negotiator@1.1.0: + resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==} + engines: {node: '>=18'} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + object-inspect@1.13.4: + resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} + engines: {node: '>= 0.4'} + obug@3.0.0: resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==} engines: {node: '>=12.20.0'} + on-finished@2.4.2: + resolution: {integrity: sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==} + engines: {node: '>= 0.8'} + + on-headers@1.1.0: + resolution: {integrity: sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + one-time@1.0.0: + resolution: {integrity: sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==} + + open@11.0.4: + resolution: {integrity: sha512-++Zlftm0kVLPmzC06t6epuWmcRMDbI4z5P3NNX979WA/k23+NtSOynEGzsVfZwguKw2mi5umVgnBlJQMwRz4Pg==} + engines: {node: '>=20'} + + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + path-expression-matcher@1.6.2: + resolution: {integrity: sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==} + engines: {node: '>=14.0.0'} + + path-to-regexp@8.4.2: + resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} + + pg-connection-string@2.14.1: + resolution: {integrity: sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA==} + + pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + pg-protocol@1.16.1: + resolution: {integrity: sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg==} + + pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -430,52 +1639,308 @@ packages: resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==} engines: {node: ^10 || ^12 || >=14} + postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + postgres-bytea@1.0.1: + resolution: {integrity: sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==} + engines: {node: '>=0.10.0'} + + postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + + powershell-utils@0.2.1: + resolution: {integrity: sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A==} + engines: {node: '>=20'} + prettier@3.9.10: resolution: {integrity: sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==} engines: {node: '>=14'} hasBin: true + process@0.11.10: + resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} + engines: {node: '>= 0.6.0'} + + protobufjs@7.6.6: + resolution: {integrity: sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==} + engines: {node: '>=12.0.0'} + + proxy-addr@2.0.8: + resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==} + engines: {node: '>= 0.10'} + + proxy-from-env@2.1.0: + resolution: {integrity: sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==} + engines: {node: '>=10'} + + qs@6.17.1: + resolution: {integrity: sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==} + engines: {node: '>=0.6'} + + range-parser@1.3.0: + resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==} + engines: {node: '>= 0.6'} + + raw-body@3.0.2: + resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==} + engines: {node: '>= 0.10'} + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + readable-stream@4.8.0: + resolution: {integrity: sha512-2jhTTU3Eilp/2DMT71gbcoqC35eQHasMJH0RHkYxwlxIv3+FR6Y5xAFZIwEGLxKkjZYEFlsiMNIdwUqjK2lLHQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-in-the-middle@8.0.1: + resolution: {integrity: sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==} + engines: {node: '>=9.3.0 || >=8.10.0 <9.0.0'} + + retry-as-promised@7.1.1: + resolution: {integrity: sha512-hMD7odLOt3LkTjcif8aRZqi/hybjpLNgSk5oF5FCowfCjok6LukpN2bDX7R5wDmbgBQFn7YoBxSagmtXHaJYJw==} + rolldown@1.2.16: resolution: {integrity: sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true - source-map-js@1.2.2: - resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==} - engines: {node: '>=0.10.0'} + router@2.2.0: + resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} + engines: {node: '>= 18'} - std-env@4.3.0: - resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} + run-applescript@7.1.0: + resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} + engines: {node: '>=18'} - tinybench@6.2.3: - resolution: {integrity: sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==} - engines: {node: '>=20.0.0'} + safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - tinyexec@1.3.1: - resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==} - engines: {node: '>=18'} + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - tinyglobby@0.2.17: - resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} - engines: {node: '>=12.0.0'} + safe-stable-stringify@2.5.0: + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} + engines: {node: '>=10'} - typescript@7.0.2: - resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} - engines: {node: '>=16.20.0'} - hasBin: true + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - undici-types@8.9.0: - resolution: {integrity: sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==} + sax@1.6.1: + resolution: {integrity: sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==} + engines: {node: '>=11.0.0'} - vite@8.3.6: - resolution: {integrity: sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA==} - engines: {node: ^20.19.0 || >=22.12.0} + semver@7.8.6: + resolution: {integrity: sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==} + engines: {node: '>=10'} hasBin: true + + send@1.2.1: + resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} + engines: {node: '>= 18'} + + sequelize-pool@7.1.0: + resolution: {integrity: sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==} + engines: {node: '>= 10.0.0'} + + sequelize@6.37.8: + resolution: {integrity: sha512-HJ0IQFqcTsTiqbEgiuioYFMSD00TP6Cz7zoTti+zVVBwVe9fEhev9cH6WnM3XU31+ABS356durAb99ZuOthnKw==} + engines: {node: '>=10.0.0'} peerDependencies: - '@types/node': ^20.19.0 || >=22.12.0 - '@vitejs/devtools': ^0.7.1 || ^0.8.0 - esbuild: ^0.27.0 || ^0.28.0 - jiti: '>=1.21.0' + ibm_db: '*' + mariadb: '*' + mysql2: '*' + oracledb: '*' + pg: '*' + pg-hstore: '*' + snowflake-sdk: '*' + sqlite3: '*' + tedious: '*' + peerDependenciesMeta: + ibm_db: + optional: true + mariadb: + optional: true + mysql2: + optional: true + oracledb: + optional: true + pg: + optional: true + pg-hstore: + optional: true + snowflake-sdk: + optional: true + sqlite3: + optional: true + tedious: + optional: true + + serve-static@2.2.1: + resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==} + engines: {node: '>= 18'} + + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + side-channel-list@1.0.1: + resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} + engines: {node: '>= 0.4'} + + side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + + side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + + side-channel@1.1.1: + resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==} + engines: {node: '>= 0.4'} + + source-map-js@1.2.2: + resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==} + engines: {node: '>=0.10.0'} + + sql-escaper@1.5.2: + resolution: {integrity: sha512-6CKD38c31SENivxOADeMNLdukOnUxUcflKtzVWzace7Riv1v7cAEym5Cx9Q7gYZ3ezIJI7ZpqecQq8cqNeSSFg==} + engines: {bun: '>=1.0.0', deno: '>=2.0.0', node: '>=12.0.0'} + + stack-trace@0.0.10: + resolution: {integrity: sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + + std-env@4.3.0: + resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} + + stoppable@1.1.0: + resolution: {integrity: sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==} + engines: {node: '>=4', npm: '>=6'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strnum@2.5.1: + resolution: {integrity: sha512-UM4nTLWzQiDBseVxUGxN0wJzIk0UU89Qi7pKXz9qISo+lhviJikTuikBsK/oFRlpvYHvSdz0TVoLyQ+sEpYwxA==} + + supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + + tedious@20.3.8: + resolution: {integrity: sha512-ZrJiwyGn340Sa0V0g37Xqj5bvmJ1riYwvEtg7zdm/lpw70f2ZNIQ2fvHmntU5fEOorWDa48Jo1oKYAuUP+rh7Q==} + engines: {node: '>=22'} + + text-hex@1.0.0: + resolution: {integrity: sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==} + + tinybench@6.2.3: + resolution: {integrity: sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==} + engines: {node: '>=20.0.0'} + + tinyexec@1.3.1: + resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==} + engines: {node: '>=18'} + + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + + toposort-class@1.0.1: + resolution: {integrity: sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg==} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + triple-beam@1.4.1: + resolution: {integrity: sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==} + engines: {node: '>= 14.0.0'} + + tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + + tslib@2.9.1: + resolution: {integrity: sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==} + + tunnel@0.0.6: + resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} + engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} + + type-is@2.1.0: + resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} + engines: {node: '>= 18'} + + typescript@7.0.2: + resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==} + engines: {node: '>=16.20.0'} + hasBin: true + + undici-types@8.9.0: + resolution: {integrity: sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==} + + universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} + engines: {node: '>= 10.0.0'} + + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + + uri-templates@0.2.0: + resolution: {integrity: sha512-EWkjYEN0L6KOfEoOH6Wj4ghQqU7eBZMJqRHQnxQAq+dSEzRPClkWjf8557HkWQXF6BrAUoLSAyy9i3RVTliaNg==} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). + hasBin: true + + validator@13.15.35: + resolution: {integrity: sha512-TQ5pAGhd5whStmqWvYF4OjQROlmv9SMFVt37qoCBdqRffuuklWYQlCNnEs2ZaIBD1kZRNnikiZOS1eqgkar0iw==} + engines: {node: '>= 0.10'} + + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + vite@8.3.6: + resolution: {integrity: sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + '@vitejs/devtools': ^0.7.1 || ^0.8.0 + esbuild: ^0.27.0 || ^0.28.0 + jiti: '>=1.21.0' less: ^4.0.0 sass: ^1.70.0 sass-embedded: ^1.70.0 @@ -551,13 +2016,358 @@ packages: jsdom: optional: true + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + why-is-node-running@3.2.1: resolution: {integrity: sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==} engines: {node: '>=20.11'} hasBin: true + winston-transport@4.9.0: + resolution: {integrity: sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==} + engines: {node: '>= 12.0.0'} + + winston@3.19.0: + resolution: {integrity: sha512-LZNJgPzfKR+/J3cHkxcpHKpKKvGfDZVPS4hfJCc4cCG0CgYzvlD6yE/S3CIL/Yt91ak327YCpiF/0MyeZHEHKA==} + engines: {node: '>= 12.0.0'} + + wkx@0.5.0: + resolution: {integrity: sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + wsl-utils@1.0.1: + resolution: {integrity: sha512-c16PKLIRxBYpR3jSWsdS7SFp0COm5SOQdiFjY818dYFHJbMGuLBszpF07LBWmOS1uzrHa9VGdynsEgoeKy0oOQ==} + engines: {node: '>=20'} + + xml-naming@0.3.0: + resolution: {integrity: sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==} + engines: {node: '>=16.0.0'} + + xml2js@0.5.0: + resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==} + engines: {node: '>=4.0.0'} + + xml2js@0.6.2: + resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==} + engines: {node: '>=4.0.0'} + + xmlbuilder@11.0.1: + resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} + engines: {node: '>=4.0'} + + xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yaml@2.9.1: + resolution: {integrity: sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==} + engines: {node: '>= 14.6'} + hasBin: true + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.3: + resolution: {integrity: sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==} + engines: {node: '>=12'} + snapshots: + '@azure-rest/core-client@2.9.0': + dependencies: + '@azure/abort-controller': 2.2.0 + '@azure/core-auth': 1.11.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@typespec/ts-http-runtime': 0.3.9 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/abort-controller@2.2.0': + dependencies: + tslib: 2.9.1 + + '@azure/core-auth@1.11.0': + dependencies: + '@azure/abort-controller': 2.2.0 + '@azure/core-util': 1.14.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/core-client@1.11.1': + dependencies: + '@azure/abort-controller': 2.2.0 + '@azure/core-auth': 1.11.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@azure/core-util': 1.14.0 + '@azure/logger': 1.4.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/core-lro@2.7.2': + dependencies: + '@azure/abort-controller': 2.2.0 + '@azure/core-util': 1.14.0 + '@azure/logger': 1.4.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/core-paging@1.7.0': + dependencies: + tslib: 2.9.1 + + '@azure/core-process@1.0.0': {} + + '@azure/core-rest-pipeline@1.25.0': + dependencies: + '@azure/abort-controller': 2.2.0 + '@azure/core-auth': 1.11.0 + '@azure/core-tracing': 1.4.0 + '@azure/core-util': 1.14.0 + '@azure/logger': 1.4.0 + '@typespec/ts-http-runtime': 0.3.9 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/core-tracing@1.4.0': + dependencies: + tslib: 2.9.1 + + '@azure/core-util@1.14.0': + dependencies: + '@azure/abort-controller': 2.2.0 + '@typespec/ts-http-runtime': 0.3.9 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/core-xml@1.6.0': + dependencies: + fast-xml-parser: 5.12.0 + tslib: 2.9.1 + + '@azure/data-tables@13.3.2': + dependencies: + '@azure/core-auth': 1.11.0 + '@azure/core-client': 1.11.1 + '@azure/core-paging': 1.7.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@azure/core-util': 1.14.0 + '@azure/core-xml': 1.6.0 + '@azure/logger': 1.4.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/functions-extensions-base@0.3.0': {} + + '@azure/functions@4.17.0': + dependencies: + '@azure/functions-extensions-base': 0.3.0 + cookie: 0.7.2 + + '@azure/identity@4.14.1': + dependencies: + '@azure/abort-controller': 2.2.0 + '@azure/core-auth': 1.11.0 + '@azure/core-client': 1.11.1 + '@azure/core-process': 1.0.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@azure/core-util': 1.14.0 + '@azure/logger': 1.4.0 + '@azure/msal-browser': 5.29.0 + '@azure/msal-node': 7.2.1 + open: 11.0.4 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/keyvault-common@2.1.1': + dependencies: + '@azure-rest/core-client': 2.9.0 + '@azure/abort-controller': 2.2.0 + '@azure/core-auth': 1.11.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@azure/core-util': 1.14.0 + '@azure/logger': 1.4.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/keyvault-keys@4.10.2': + dependencies: + '@azure-rest/core-client': 2.9.0 + '@azure/abort-controller': 2.2.0 + '@azure/core-auth': 1.11.0 + '@azure/core-lro': 2.7.2 + '@azure/core-paging': 1.7.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@azure/core-util': 1.14.0 + '@azure/keyvault-common': 2.1.1 + '@azure/logger': 1.4.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/logger@1.4.0': + dependencies: + '@typespec/ts-http-runtime': 0.3.9 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/monitor-opentelemetry-exporter@1.0.0-beta.47': + dependencies: + '@azure-rest/core-client': 2.9.0 + '@azure/core-auth': 1.11.0 + '@azure/core-client': 1.11.1 + '@azure/core-process': 1.0.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-util': 1.14.0 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/monitor-opentelemetry@1.21.0': + dependencies: + '@azure-rest/core-client': 2.9.0 + '@azure/core-auth': 1.11.0 + '@azure/core-rest-pipeline': 1.25.0 + '@azure/core-tracing': 1.4.0 + '@azure/identity': 4.14.1 + '@azure/logger': 1.4.0 + '@azure/monitor-opentelemetry-exporter': 1.0.0-beta.47 + '@azure/opentelemetry-instrumentation-azure-sdk': 1.1.0-beta.1 + '@microsoft/applicationinsights-web-snippet': 1.2.3 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-bunyan': 0.66.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-console': 0.3.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-mongodb': 0.74.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-mysql': 0.67.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-pg': 0.73.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-redis': 0.69.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation-winston': 0.65.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resource-detector-azure': 0.29.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-node': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-node': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + '@opentelemetry/winston-transport': 0.31.0 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/ms-rest-js@2.7.0': + dependencies: + '@azure/core-auth': 1.11.0 + abort-controller: 3.0.0 + form-data: 2.5.6 + node-fetch: 2.7.0 + tslib: 1.14.1 + tunnel: 0.0.6 + uuid: 8.3.2 + xml2js: 0.5.0 + transitivePeerDependencies: + - encoding + - supports-color + + '@azure/msal-browser@5.29.0': + dependencies: + '@azure/msal-common': 16.16.1 + + '@azure/msal-common@16.16.1': {} + + '@azure/msal-node@7.2.1': + dependencies: + '@azure/msal-common': 16.16.1 + jsonwebtoken: 9.0.3 + + '@azure/opentelemetry-instrumentation-azure-sdk@1.0.0': + dependencies: + '@azure/core-tracing': 1.4.0 + '@azure/logger': 1.4.0 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation': 0.211.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-web': 2.12.0(@opentelemetry/api@1.10.0) + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@azure/opentelemetry-instrumentation-azure-sdk@1.1.0-beta.1': + dependencies: + '@azure/core-tracing': 1.4.0 + '@azure/logger': 1.4.0 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation': 0.211.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-web': 2.12.0(@opentelemetry/api@1.10.0) + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@colors/colors@1.6.0': {} + + '@colors/colors@1.6.1': {} + + '@dabh/diagnostics@2.0.9': + dependencies: + '@so-ric/colorspace': 1.1.6 + enabled: 2.0.0 + kuler: 2.0.0 + + '@grpc/grpc-js@1.14.7': + dependencies: + '@grpc/proto-loader': 0.8.1 + '@js-sdsl/ordered-map': 4.4.2 + + '@grpc/proto-loader@0.8.1': + dependencies: + lodash.camelcase: 4.3.0 + long: 5.3.2 + protobufjs: 7.6.6 + yargs: 17.7.3 + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.6.0': {} @@ -567,161 +2377,1178 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.6.0 - '@oxc-project/types@0.156.0': {} + '@js-joda/core@6.3.2': {} - '@pegma/spine@0.1.2': {} + '@js-sdsl/ordered-map@4.4.2': {} - '@rolldown/binding-android-arm-eabi@1.2.16': - optional: true + '@microsoft/applicationinsights-web-snippet@1.2.3': {} - '@rolldown/binding-android-arm64@1.2.16': - optional: true + '@nodable/entities@3.1.0': {} - '@rolldown/binding-darwin-arm64@1.2.16': - optional: true + '@opentelemetry/api-logs@0.211.0': + dependencies: + '@opentelemetry/api': 1.10.0 - '@rolldown/binding-darwin-x64@1.2.16': - optional: true + '@opentelemetry/api-logs@0.221.0': + dependencies: + '@opentelemetry/api': 1.10.0 - '@rolldown/binding-freebsd-x64@1.2.16': - optional: true + '@opentelemetry/api@1.10.0': {} - '@rolldown/binding-linux-arm-gnueabihf@1.2.16': - optional: true + '@opentelemetry/configuration@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + yaml: 2.9.1 - '@rolldown/binding-linux-arm64-gnu@1.2.16': - optional: true + '@opentelemetry/context-async-hooks@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 - '@rolldown/binding-linux-arm64-musl@1.2.16': - optional: true + '@opentelemetry/context-async-hooks@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 - '@rolldown/binding-linux-ppc64-gnu@1.2.16': - optional: true + '@opentelemetry/core@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/semantic-conventions': 1.45.0 - '@rolldown/binding-linux-s390x-gnu@1.2.16': - optional: true + '@opentelemetry/core@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/semantic-conventions': 1.45.0 - '@rolldown/binding-linux-x64-gnu@1.2.16': - optional: true + '@opentelemetry/exporter-logs-otlp-grpc@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-grpc-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) - '@rolldown/binding-linux-x64-musl@1.2.16': - optional: true + '@opentelemetry/exporter-logs-otlp-http@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) - '@rolldown/binding-openharmony-arm64@1.2.16': - optional: true + '@opentelemetry/exporter-logs-otlp-proto@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) - '@rolldown/binding-win32-arm64-msvc@1.2.16': - optional: true + '@opentelemetry/exporter-metrics-otlp-grpc@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/exporter-metrics-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-grpc-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) - '@rolldown/binding-win32-x64-msvc@1.2.16': - optional: true + '@opentelemetry/exporter-metrics-otlp-http@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.10.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/exporter-metrics-otlp-proto@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/exporter-metrics-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) - '@rolldown/pluginutils@1.0.1': {} + '@opentelemetry/exporter-prometheus@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 - '@types/chai@5.2.3': + '@opentelemetry/exporter-trace-otlp-grpc@0.221.0(@opentelemetry/api@1.10.0)': dependencies: - '@types/deep-eql': 4.0.2 - assertion-error: 2.0.1 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-grpc-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) - '@types/deep-eql@4.0.2': {} + '@opentelemetry/exporter-trace-otlp-http@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) - '@types/estree@1.0.10': {} + '@opentelemetry/exporter-trace-otlp-proto@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) - '@types/node@26.6.6': + '@opentelemetry/exporter-zipkin@2.10.0(@opentelemetry/api@1.10.0)': dependencies: - undici-types: 8.9.0 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 - '@typescript/typescript-aix-ppc64@7.0.2': - optional: true + '@opentelemetry/instrumentation-bunyan@0.66.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + '@types/bunyan': 1.8.11 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-console@0.3.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-http@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + forwarded-parse: 2.1.2 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-mongodb@0.74.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-mysql@0.67.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + '@types/mysql': 2.15.27 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-pg@0.73.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + '@opentelemetry/sql-common': 0.42.0(@opentelemetry/api@1.10.0) + '@types/pg': 8.15.6 + '@types/pg-pool': 2.0.7 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-redis@0.69.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/redis-common': 0.38.3 + '@opentelemetry/semantic-conventions': 1.45.0 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation-winston@0.65.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation@0.211.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.211.0 + import-in-the-middle: 2.0.6 + require-in-the-middle: 8.0.1 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/instrumentation@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + import-in-the-middle: 3.6.0 + require-in-the-middle: 8.0.1 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/otlp-exporter-base@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/otlp-grpc-exporter-base@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@grpc/grpc-js': 1.14.7 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-transformer': 0.221.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/otlp-transformer@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/propagator-b3@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/propagator-jaeger@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/redis-common@0.38.3': {} + + '@opentelemetry/resource-detector-azure@0.29.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/resources@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/resources@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/sdk-logs@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/sdk-metrics@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/sdk-metrics@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/sdk-node@0.221.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/configuration': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/context-async-hooks': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-logs-otlp-grpc': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-logs-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-logs-otlp-proto': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-metrics-otlp-grpc': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-metrics-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-metrics-otlp-proto': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-prometheus': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-trace-otlp-grpc': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-trace-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-trace-otlp-proto': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-zipkin': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/instrumentation': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-grpc-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/propagator-b3': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/propagator-jaeger': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-node': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + transitivePeerDependencies: + - supports-color + + '@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/sdk-trace-base@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/sdk-trace-node@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/context-async-hooks': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.10.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/sdk-trace-node@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/context-async-hooks': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/sdk-trace-web@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/sdk-trace@2.10.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/sdk-trace@2.12.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + + '@opentelemetry/semantic-conventions@1.45.0': {} + + '@opentelemetry/sql-common@0.42.0(@opentelemetry/api@1.10.0)': + dependencies: + '@opentelemetry/api': 1.10.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + + '@opentelemetry/winston-transport@0.31.0': + dependencies: + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/semantic-conventions': 1.45.0 + winston-transport: 4.9.0 + + '@oxc-project/types@0.156.0': {} + + '@pegma/audit@0.2.0': + dependencies: + '@pegma/spine': 0.1.1 + '@pegma/storage-core': 0.4.0 + + '@pegma/authorization-contracts@0.4.0': {} + + '@pegma/authorization-core@0.4.0': + dependencies: + '@pegma/authorization-contracts': 0.4.0 + + '@pegma/spine@0.1.1': {} + + '@pegma/spine@0.1.2': {} + + '@pegma/storage-azure-tables@0.4.0': + dependencies: + '@azure/data-tables': 13.3.2 + '@pegma/storage-core': 0.4.0 + transitivePeerDependencies: + - supports-color + + '@pegma/storage-core@0.4.0': {} + + '@protobufjs/aspromise@1.1.2': {} + + '@protobufjs/base64@1.1.2': {} + + '@protobufjs/codegen@2.0.5': {} + + '@protobufjs/eventemitter@1.1.1': {} + + '@protobufjs/fetch@1.1.1': + dependencies: + '@protobufjs/aspromise': 1.1.2 + + '@protobufjs/float@1.0.2': {} + + '@protobufjs/path@1.1.2': {} + + '@protobufjs/pool@1.1.0': {} + + '@protobufjs/utf8@1.1.2': {} + + '@rolldown/binding-android-arm-eabi@1.2.16': + optional: true + + '@rolldown/binding-android-arm64@1.2.16': + optional: true + + '@rolldown/binding-darwin-arm64@1.2.16': + optional: true + + '@rolldown/binding-darwin-x64@1.2.16': + optional: true + + '@rolldown/binding-freebsd-x64@1.2.16': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.2.16': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.2.16': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.2.16': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.2.16': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.2.16': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.2.16': + optional: true + + '@rolldown/binding-linux-x64-musl@1.2.16': + optional: true + + '@rolldown/binding-openharmony-arm64@1.2.16': + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.2.16': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.2.16': + optional: true + + '@rolldown/pluginutils@1.0.1': {} + + '@so-ric/colorspace@1.1.6': + dependencies: + color: 5.0.3 + text-hex: 1.0.0 + + '@types/bunyan@1.8.11': + dependencies: + '@types/node': 26.6.6 + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/debug@4.1.13': + dependencies: + '@types/ms': 2.1.0 + + '@types/deep-eql@4.0.2': {} + + '@types/estree@1.0.10': {} + + '@types/ms@2.1.0': {} + + '@types/mysql@2.15.27': + dependencies: + '@types/node': 26.6.6 + + '@types/node@26.6.6': + dependencies: + undici-types: 8.9.0 + + '@types/pg-pool@2.0.7': + dependencies: + '@types/pg': 8.15.6 + + '@types/pg@8.15.6': + dependencies: + '@types/node': 26.6.6 + pg-protocol: 1.16.1 + pg-types: 2.2.0 + + '@types/readable-stream@4.0.25': + dependencies: + '@types/node': 26.6.6 + + '@types/triple-beam@1.3.5': {} + + '@types/validator@13.15.10': {} + + '@typescript/typescript-aix-ppc64@7.0.2': + optional: true + + '@typescript/typescript-darwin-arm64@7.0.2': + optional: true + + '@typescript/typescript-darwin-x64@7.0.2': + optional: true + + '@typescript/typescript-freebsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-freebsd-x64@7.0.2': + optional: true + + '@typescript/typescript-linux-arm64@7.0.2': + optional: true + + '@typescript/typescript-linux-arm@7.0.2': + optional: true + + '@typescript/typescript-linux-loong64@7.0.2': + optional: true + + '@typescript/typescript-linux-mips64el@7.0.2': + optional: true + + '@typescript/typescript-linux-ppc64@7.0.2': + optional: true + + '@typescript/typescript-linux-riscv64@7.0.2': + optional: true + + '@typescript/typescript-linux-s390x@7.0.2': + optional: true + + '@typescript/typescript-linux-x64@7.0.2': + optional: true + + '@typescript/typescript-netbsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-netbsd-x64@7.0.2': + optional: true + + '@typescript/typescript-openbsd-arm64@7.0.2': + optional: true + + '@typescript/typescript-openbsd-x64@7.0.2': + optional: true + + '@typescript/typescript-sunos-x64@7.0.2': + optional: true + + '@typescript/typescript-win32-arm64@7.0.2': + optional: true + + '@typescript/typescript-win32-x64@7.0.2': + optional: true + + '@typespec/ts-http-runtime@0.3.9': + dependencies: + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + tslib: 2.9.1 + transitivePeerDependencies: + - supports-color + + '@vitest/mocker@5.0.5(vite@8.3.6(@types/node@26.6.6)(yaml@2.9.1))': + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + '@vitest/spy': 5.0.5 + estree-walker: 3.0.3 + magic-string: 1.4.5 + optionalDependencies: + vite: 8.3.6(@types/node@26.6.6)(yaml@2.9.1) + + '@vitest/spy@5.0.5': {} + + abort-controller@3.0.0: + dependencies: + event-target-shim: 5.0.1 + + accepts@2.0.0: + dependencies: + mime-types: 3.0.2 + negotiator: 1.1.0 + + acorn-import-attributes@1.9.5(acorn@8.19.0): + dependencies: + acorn: 8.19.0 + + acorn@8.19.0: {} + + agent-base@6.0.2: + dependencies: + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + agent-base@7.1.4: {} + + ansi-regex@5.0.1: {} + + ansi-styles@3.2.1: + dependencies: + color-convert: 1.9.3 + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + anynum@1.0.1: {} + + applicationinsights@3.17.0: + dependencies: + '@azure/core-auth': 1.11.0 + '@azure/functions': 4.17.0 + '@azure/identity': 4.14.1 + '@azure/monitor-opentelemetry': 1.21.0 + '@azure/monitor-opentelemetry-exporter': 1.0.0-beta.47 + '@azure/opentelemetry-instrumentation-azure-sdk': 1.0.0 + '@opentelemetry/api': 1.10.0 + '@opentelemetry/api-logs': 0.221.0 + '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-logs-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-metrics-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-metrics-otlp-proto': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-trace-otlp-http': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/otlp-exporter-base': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/resources': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-logs': 0.221.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-node': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/semantic-conventions': 1.45.0 + transitivePeerDependencies: + - supports-color + + args@5.0.3: + dependencies: + camelcase: 5.0.0 + chalk: 2.4.2 + leven: 2.1.0 + mri: 1.1.4 + + assertion-error@2.0.1: {} + + async@3.2.6: {} + + asynckit@0.4.0: {} + + aws-ssl-profiles@1.1.2: {} + + axios@1.21.0: + dependencies: + follow-redirects: 1.16.2 + form-data: 4.0.6 + https-proxy-agent: 5.0.1 + proxy-from-env: 2.1.0 + transitivePeerDependencies: + - debug + - supports-color + + azurite@3.37.0(@types/node@26.6.6): + dependencies: + '@azure/ms-rest-js': 2.7.0 + applicationinsights: 3.17.0 + args: 5.0.3 + axios: 1.21.0 + etag: 1.8.1 + express: 5.3.0 + fs-extra: 11.4.1 + glob-to-regexp: 0.4.1 + jsonwebtoken: 9.0.3 + lokijs: 1.5.12 + morgan: 1.12.1 + multistream: 4.1.0 + mysql2: 3.24.6(@types/node@26.6.6) + sequelize: 6.37.8(mysql2@3.24.6(@types/node@26.6.6))(tedious@20.3.8) + stoppable: 1.1.0 + tedious: 20.3.8 + tslib: 2.9.1 + uri-templates: 0.2.0 + winston: 3.19.0 + xml2js: 0.6.2 + transitivePeerDependencies: + - '@types/node' + - debug + - encoding + - ibm_db + - mariadb + - oracledb + - pg + - pg-hstore + - snowflake-sdk + - sqlite3 + - supports-color + + base64-js@1.5.1: {} + + basic-auth@2.0.1: + dependencies: + safe-buffer: 5.1.2 + + bl@6.1.6: + dependencies: + '@types/readable-stream': 4.0.25 + buffer: 6.0.3 + inherits: 2.0.4 + readable-stream: 4.8.0 + + body-parser@2.4.0: + dependencies: + bytes: 3.1.2 + content-type: 2.1.0 + debug: 4.4.3 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + on-finished: 2.4.2 + qs: 6.17.1 + raw-body: 3.0.2 + type-is: 2.1.0 + transitivePeerDependencies: + - supports-color + + buffer-equal-constant-time@1.0.1: {} + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + bundle-name@4.1.1: + dependencies: + run-applescript: 7.1.0 + + bytes@3.1.2: {} + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + + camelcase@5.0.0: {} + + chai@6.3.0: {} + + chalk@2.4.2: + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + + cjs-module-lexer@2.3.0: {} + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + color-convert@1.9.3: + dependencies: + color-name: 1.1.3 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-convert@3.1.3: + dependencies: + color-name: 2.1.1 + + color-name@1.1.3: {} + + color-name@1.1.4: {} + + color-name@2.1.1: {} + + color-string@2.1.4: + dependencies: + color-name: 2.1.1 + + color@5.0.3: + dependencies: + color-convert: 3.1.3 + color-string: 2.1.4 + + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + content-disposition@2.0.1: {} + + content-type@2.1.0: {} + + cookie-signature@1.2.2: {} + + cookie@0.7.2: {} + + debug@2.6.9: + dependencies: + ms: 2.0.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + default-browser-id@5.0.1: {} + + default-browser@5.5.1: + dependencies: + bundle-name: 4.1.1 + default-browser-id: 5.0.1 + + define-lazy-prop@3.0.0: {} + + delayed-stream@1.0.0: {} + + depd@2.0.0: {} + + detect-libc@2.1.2: {} + + dottie@2.0.7: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + ecdsa-sig-formatter@1.0.11: + dependencies: + safe-buffer: 5.2.1 + + ee-first@1.1.1: {} + + emoji-regex@8.0.0: {} + + enabled@2.0.0: {} + + encodeurl@2.0.1: {} + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-module-lexer@2.3.2: {} + + es-module-lexer@3.0.4: {} + + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.4 + + escalade@3.2.0: {} + + escape-html@1.0.3: {} + + escape-string-regexp@1.0.5: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.10 + + etag@1.8.1: {} + + event-target-shim@5.0.1: {} + + events@3.3.0: {} + + expect-type@1.4.0: {} + + express@5.3.0: + dependencies: + accepts: 2.0.0 + body-parser: 2.4.0 + content-disposition: 2.0.1 + content-type: 2.1.0 + cookie: 0.7.2 + cookie-signature: 1.2.2 + debug: 4.4.3 + depd: 2.0.0 + encodeurl: 2.0.1 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 2.1.1 + fresh: 2.0.0 + http-errors: 2.0.1 + merge-descriptors: 2.0.0 + mime-types: 3.0.2 + on-finished: 2.4.2 + once: 1.4.0 + parseurl: 1.3.3 + proxy-addr: 2.0.8 + qs: 6.17.1 + range-parser: 1.3.0 + router: 2.2.0 + send: 1.2.1 + serve-static: 2.2.1 + statuses: 2.0.2 + type-is: 2.1.0 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + fast-xml-builder@1.3.1: + dependencies: + path-expression-matcher: 1.6.2 + xml-naming: 0.3.0 + + fast-xml-parser@5.12.0: + dependencies: + '@nodable/entities': 3.1.0 + fast-xml-builder: 1.3.1 + is-unsafe: 2.0.3 + path-expression-matcher: 1.6.2 + strnum: 2.5.1 + xml-naming: 0.3.0 + + fdir@6.5.0(picomatch@4.0.7): + optionalDependencies: + picomatch: 4.0.7 + + fecha@4.2.3: {} + + finalhandler@2.1.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.1 + escape-html: 1.0.3 + on-finished: 2.4.2 + parseurl: 1.3.3 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + fn.name@1.1.0: {} + + follow-redirects@1.16.2: {} + + form-data@2.5.6: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.4 + mime-types: 2.1.35 + safe-buffer: 5.2.1 + + form-data@4.0.6: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.4 + mime-types: 2.1.35 + + forwarded-parse@2.1.2: {} + + forwarded@0.2.0: {} + + fresh@2.0.0: {} + + fs-extra@11.4.1: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.2.1 + universalify: 2.0.1 + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + generate-function@2.3.1: + dependencies: + is-property: 1.0.2 + + get-caller-file@2.0.5: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.4 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.2 + + glob-to-regexp@0.4.1: {} - '@typescript/typescript-darwin-arm64@7.0.2': - optional: true + gopd@1.2.0: {} - '@typescript/typescript-darwin-x64@7.0.2': - optional: true + graceful-fs@4.2.11: {} - '@typescript/typescript-freebsd-arm64@7.0.2': - optional: true + has-flag@3.0.0: {} - '@typescript/typescript-freebsd-x64@7.0.2': - optional: true + has-symbols@1.1.0: {} - '@typescript/typescript-linux-arm64@7.0.2': - optional: true + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 - '@typescript/typescript-linux-arm@7.0.2': - optional: true + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 - '@typescript/typescript-linux-loong64@7.0.2': - optional: true + http-errors@2.0.1: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.2 + toidentifier: 1.0.1 - '@typescript/typescript-linux-mips64el@7.0.2': - optional: true + http-proxy-agent@7.0.2: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color - '@typescript/typescript-linux-ppc64@7.0.2': - optional: true + https-proxy-agent@5.0.1: + dependencies: + agent-base: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color - '@typescript/typescript-linux-riscv64@7.0.2': - optional: true + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color - '@typescript/typescript-linux-s390x@7.0.2': - optional: true + iconv-lite@0.7.3: + dependencies: + safer-buffer: 2.1.2 - '@typescript/typescript-linux-x64@7.0.2': - optional: true + ieee754@1.2.1: {} - '@typescript/typescript-netbsd-arm64@7.0.2': - optional: true + import-in-the-middle@2.0.6: + dependencies: + acorn: 8.19.0 + acorn-import-attributes: 1.9.5(acorn@8.19.0) + cjs-module-lexer: 2.3.0 + module-details-from-path: 1.0.4 - '@typescript/typescript-netbsd-x64@7.0.2': - optional: true + import-in-the-middle@3.6.0: + dependencies: + cjs-module-lexer: 2.3.0 + es-module-lexer: 3.0.4 + module-details-from-path: 1.0.4 - '@typescript/typescript-openbsd-arm64@7.0.2': - optional: true + inflection@1.13.4: {} - '@typescript/typescript-openbsd-x64@7.0.2': - optional: true + inherits@2.0.4: {} - '@typescript/typescript-sunos-x64@7.0.2': - optional: true + ipaddr.js@1.9.1: {} - '@typescript/typescript-win32-arm64@7.0.2': - optional: true + is-docker@3.0.0: {} - '@typescript/typescript-win32-x64@7.0.2': - optional: true + is-fullwidth-code-point@3.0.0: {} - '@vitest/mocker@5.0.5(vite@8.3.6(@types/node@26.6.6))': - dependencies: - '@jridgewell/trace-mapping': 0.3.31 - '@vitest/spy': 5.0.5 - estree-walker: 3.0.3 - magic-string: 1.4.5 - optionalDependencies: - vite: 8.3.6(@types/node@26.6.6) + is-in-ssh@1.0.0: {} - '@vitest/spy@5.0.5': {} + is-inside-container@1.0.0: + dependencies: + is-docker: 3.0.0 - assertion-error@2.0.1: {} + is-promise@4.0.0: {} - chai@6.3.0: {} + is-property@1.0.2: {} - detect-libc@2.1.2: {} + is-stream@2.0.1: {} - es-module-lexer@2.3.2: {} + is-unsafe@2.0.3: {} - estree-walker@3.0.3: + is-wsl@3.1.1: dependencies: - '@types/estree': 1.0.10 + is-inside-container: 1.0.0 - expect-type@1.4.0: {} + js-md4@0.3.2: {} - fdir@6.5.0(picomatch@4.0.7): + jsonfile@6.2.1: + dependencies: + universalify: 2.0.1 optionalDependencies: - picomatch: 4.0.7 + graceful-fs: 4.2.11 - fsevents@2.3.3: - optional: true + jsonwebtoken@9.0.3: + dependencies: + jws: 4.0.1 + lodash.includes: 4.3.0 + lodash.isboolean: 3.0.3 + lodash.isinteger: 4.0.4 + lodash.isnumber: 3.0.3 + lodash.isplainobject: 4.0.6 + lodash.isstring: 4.0.1 + lodash.once: 4.1.1 + ms: 2.1.3 + semver: 7.8.6 + + jwa@2.0.1: + dependencies: + buffer-equal-constant-time: 1.0.1 + ecdsa-sig-formatter: 1.0.11 + safe-buffer: 5.2.1 + + jws@4.0.1: + dependencies: + jwa: 2.0.1 + safe-buffer: 5.2.1 + + kuler@2.0.0: {} + + leven@2.1.0: {} lightningcss-android-arm64@1.33.0: optional: true @@ -772,14 +3599,164 @@ snapshots: lightningcss-win32-arm64-msvc: 1.33.0 lightningcss-win32-x64-msvc: 1.33.0 + lodash.camelcase@4.3.0: {} + + lodash.includes@4.3.0: {} + + lodash.isboolean@3.0.3: {} + + lodash.isinteger@4.0.4: {} + + lodash.isnumber@3.0.3: {} + + lodash.isplainobject@4.0.6: {} + + lodash.isstring@4.0.1: {} + + lodash.once@4.1.1: {} + + lodash@4.18.1: {} + + logform@2.7.0: + dependencies: + '@colors/colors': 1.6.0 + '@types/triple-beam': 1.3.5 + fecha: 4.2.3 + ms: 2.1.3 + safe-stable-stringify: 2.5.0 + triple-beam: 1.4.1 + + lokijs@1.5.12: {} + + long@5.3.2: {} + + lru.min@1.1.5: {} + magic-string@1.4.5: dependencies: '@jridgewell/sourcemap-codec': 1.6.0 + math-intrinsics@1.1.0: {} + + media-typer@1.1.1: {} + + merge-descriptors@2.0.0: {} + + mime-db@1.52.0: {} + + mime-db@1.54.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mime-types@3.0.2: + dependencies: + mime-db: 1.54.0 + + module-details-from-path@1.0.4: {} + + moment-timezone@0.5.48: + dependencies: + moment: 2.31.0 + + moment@2.31.0: {} + + morgan@1.12.1: + dependencies: + basic-auth: 2.0.1 + debug: 2.6.9 + depd: 2.0.0 + on-finished: 2.4.2 + on-headers: 1.1.0 + transitivePeerDependencies: + - supports-color + + mri@1.1.4: {} + + ms@2.0.0: {} + + ms@2.1.3: {} + + multistream@4.1.0: + dependencies: + once: 1.4.0 + readable-stream: 3.6.2 + + mysql2@3.24.6(@types/node@26.6.6): + dependencies: + '@types/node': 26.6.6 + aws-ssl-profiles: 1.1.2 + generate-function: 2.3.1 + iconv-lite: 0.7.3 + long: 5.3.2 + lru.min: 1.1.5 + named-placeholders: 1.1.6 + sql-escaper: 1.5.2 + + named-placeholders@1.1.6: + dependencies: + lru.min: 1.1.5 + nanoid@3.3.20: {} + native-duplexpair@1.0.0: {} + + negotiator@1.1.0: + dependencies: + content-type: 2.1.0 + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + object-inspect@1.13.4: {} + obug@3.0.0: {} + on-finished@2.4.2: + dependencies: + ee-first: 1.1.1 + + on-headers@1.1.0: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + one-time@1.0.0: + dependencies: + fn.name: 1.1.0 + + open@11.0.4: + dependencies: + default-browser: 5.5.1 + define-lazy-prop: 3.0.0 + is-in-ssh: 1.0.0 + is-inside-container: 1.0.0 + powershell-utils: 0.2.1 + wsl-utils: 1.0.1 + + parseurl@1.3.3: {} + + path-expression-matcher@1.6.2: {} + + path-to-regexp@8.4.2: {} + + pg-connection-string@2.14.1: {} + + pg-int8@1.0.1: {} + + pg-protocol@1.16.1: {} + + pg-types@2.2.0: + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.1 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + picocolors@1.1.1: {} picomatch@4.0.7: {} @@ -790,8 +3767,82 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.2 + postgres-array@2.0.0: {} + + postgres-bytea@1.0.1: {} + + postgres-date@1.0.7: {} + + postgres-interval@1.2.0: + dependencies: + xtend: 4.0.2 + + powershell-utils@0.2.1: {} + prettier@3.9.10: {} + process@0.11.10: {} + + protobufjs@7.6.6: + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.5 + '@protobufjs/eventemitter': 1.1.1 + '@protobufjs/fetch': 1.1.1 + '@protobufjs/float': 1.0.2 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.2 + '@types/node': 26.6.6 + long: 5.3.2 + + proxy-addr@2.0.8: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + + proxy-from-env@2.1.0: {} + + qs@6.17.1: + dependencies: + es-define-property: 1.0.1 + side-channel: 1.1.1 + + range-parser@1.3.0: {} + + raw-body@3.0.2: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + unpipe: 1.0.0 + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + readable-stream@4.8.0: + dependencies: + abort-controller: 3.0.0 + buffer: 6.0.3 + events: 3.3.0 + process: 0.11.10 + string_decoder: 1.3.0 + + require-directory@2.1.1: {} + + require-in-the-middle@8.0.1: + dependencies: + debug: 4.4.3 + module-details-from-path: 1.0.4 + transitivePeerDependencies: + - supports-color + + retry-as-promised@7.1.1: {} + rolldown@1.2.16: dependencies: '@oxc-project/types': 0.156.0 @@ -813,10 +3864,161 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.2.16 '@rolldown/binding-win32-x64-msvc': 1.2.16 + router@2.2.0: + dependencies: + debug: 4.4.3 + depd: 2.0.0 + is-promise: 4.0.0 + parseurl: 1.3.3 + path-to-regexp: 8.4.2 + transitivePeerDependencies: + - supports-color + + run-applescript@7.1.0: {} + + safe-buffer@5.1.2: {} + + safe-buffer@5.2.1: {} + + safe-stable-stringify@2.5.0: {} + + safer-buffer@2.1.2: {} + + sax@1.6.1: {} + + semver@7.8.6: {} + + send@1.2.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.1 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 2.0.0 + http-errors: 2.0.1 + mime-types: 3.0.2 + ms: 2.1.3 + on-finished: 2.4.2 + range-parser: 1.3.0 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + sequelize-pool@7.1.0: {} + + sequelize@6.37.8(mysql2@3.24.6(@types/node@26.6.6))(tedious@20.3.8): + dependencies: + '@types/debug': 4.1.13 + '@types/validator': 13.15.10 + debug: 4.4.3 + dottie: 2.0.7 + inflection: 1.13.4 + lodash: 4.18.1 + moment: 2.31.0 + moment-timezone: 0.5.48 + pg-connection-string: 2.14.1 + retry-as-promised: 7.1.1 + semver: 7.8.6 + sequelize-pool: 7.1.0 + toposort-class: 1.0.1 + uuid: 8.3.2 + validator: 13.15.35 + wkx: 0.5.0 + optionalDependencies: + mysql2: 3.24.6(@types/node@26.6.6) + tedious: 20.3.8 + transitivePeerDependencies: + - supports-color + + serve-static@2.2.1: + dependencies: + encodeurl: 2.0.1 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 1.2.1 + transitivePeerDependencies: + - supports-color + + setprototypeof@1.2.0: {} + + side-channel-list@1.0.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + + side-channel-map@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + + side-channel-weakmap@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + side-channel-map: 1.0.1 + + side-channel@1.1.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + side-channel-list: 1.0.1 + side-channel-map: 1.0.1 + side-channel-weakmap: 1.0.2 + source-map-js@1.2.2: {} + sql-escaper@1.5.2: {} + + stack-trace@0.0.10: {} + + statuses@2.0.2: {} + std-env@4.3.0: {} + stoppable@1.1.0: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strnum@2.5.1: + dependencies: + anynum: 1.0.1 + + supports-color@5.5.0: + dependencies: + has-flag: 3.0.0 + + tedious@20.3.8: + dependencies: + '@azure/core-auth': 1.11.0 + '@azure/identity': 4.14.1 + '@azure/keyvault-keys': 4.10.2 + '@js-joda/core': 6.3.2 + '@types/node': 26.6.6 + bl: 6.1.6 + iconv-lite: 0.7.3 + js-md4: 0.3.2 + native-duplexpair: 1.0.0 + transitivePeerDependencies: + - supports-color + + text-hex@1.0.0: {} + tinybench@6.2.3: {} tinyexec@1.3.1: {} @@ -826,6 +4028,26 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + toidentifier@1.0.1: {} + + toposort-class@1.0.1: {} + + tr46@0.0.3: {} + + triple-beam@1.4.1: {} + + tslib@1.14.1: {} + + tslib@2.9.1: {} + + tunnel@0.0.6: {} + + type-is@2.1.0: + dependencies: + content-type: 2.1.0 + media-typer: 1.1.1 + mime-types: 3.0.2 + typescript@7.0.2: optionalDependencies: '@typescript/typescript-aix-ppc64': 7.0.2 @@ -851,7 +4073,21 @@ snapshots: undici-types@8.9.0: {} - vite@8.3.6(@types/node@26.6.6): + universalify@2.0.1: {} + + unpipe@1.0.0: {} + + uri-templates@0.2.0: {} + + util-deprecate@1.0.2: {} + + uuid@8.3.2: {} + + validator@13.15.35: {} + + vary@1.1.2: {} + + vite@8.3.6(@types/node@26.6.6)(yaml@2.9.1): dependencies: lightningcss: 1.33.0 picomatch: 4.0.7 @@ -861,11 +4097,12 @@ snapshots: optionalDependencies: '@types/node': 26.6.6 fsevents: 2.3.3 + yaml: 2.9.1 - vitest@5.0.5(@types/node@26.6.6)(vite@8.3.6(@types/node@26.6.6)): + vitest@5.0.5(@opentelemetry/api@1.10.0)(@types/node@26.6.6)(vite@8.3.6(@types/node@26.6.6)(yaml@2.9.1)): dependencies: '@types/chai': 5.2.3 - '@vitest/mocker': 5.0.5(vite@8.3.6(@types/node@26.6.6)) + '@vitest/mocker': 5.0.5(vite@8.3.6(@types/node@26.6.6)(yaml@2.9.1)) chai: 6.3.0 es-module-lexer: 2.3.2 expect-type: 1.4.0 @@ -876,11 +4113,88 @@ snapshots: tinybench: 6.2.3 tinyexec: 1.3.1 tinyglobby: 0.2.17 - vite: 8.3.6(@types/node@26.6.6) + vite: 8.3.6(@types/node@26.6.6)(yaml@2.9.1) why-is-node-running: 3.2.1 optionalDependencies: + '@opentelemetry/api': 1.10.0 '@types/node': 26.6.6 transitivePeerDependencies: - msw + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + why-is-node-running@3.2.1: {} + + winston-transport@4.9.0: + dependencies: + logform: 2.7.0 + readable-stream: 3.6.2 + triple-beam: 1.4.1 + + winston@3.19.0: + dependencies: + '@colors/colors': 1.6.1 + '@dabh/diagnostics': 2.0.9 + async: 3.2.6 + is-stream: 2.0.1 + logform: 2.7.0 + one-time: 1.0.0 + readable-stream: 3.6.2 + safe-stable-stringify: 2.5.0 + stack-trace: 0.0.10 + triple-beam: 1.4.1 + winston-transport: 4.9.0 + + wkx@0.5.0: + dependencies: + '@types/node': 26.6.6 + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrappy@1.0.2: {} + + wsl-utils@1.0.1: + dependencies: + is-wsl: 3.1.1 + powershell-utils: 0.2.1 + + xml-naming@0.3.0: {} + + xml2js@0.5.0: + dependencies: + sax: 1.6.1 + xmlbuilder: 11.0.1 + + xml2js@0.6.2: + dependencies: + sax: 1.6.1 + xmlbuilder: 11.0.1 + + xmlbuilder@11.0.1: {} + + xtend@4.0.2: {} + + y18n@5.0.8: {} + + yaml@2.9.1: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.3: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 diff --git a/scripts/release-packages.mjs b/scripts/release-packages.mjs index 71665c0..fec8277 100644 --- a/scripts/release-packages.mjs +++ b/scripts/release-packages.mjs @@ -19,6 +19,7 @@ const root = fileURLToPath(new URL("../", import.meta.url)); const packages = [ { directory: "contracts", name: "@pegma/knowledge-base-contracts" }, { directory: "core", name: "@pegma/knowledge-base-core" }, + { directory: "application", name: "@pegma/knowledge-base-application" }, ]; const stableVersion = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u; @@ -104,9 +105,18 @@ async function validatePackages() { }); assert.deepEqual( manifest.dependencies, - specification.directory === "core" - ? { "@pegma/knowledge-base-contracts": manifest.version } - : { "@pegma/spine": "0.1.2" }, + specification.directory === "application" + ? { + "@pegma/audit": "0.2.0", + "@pegma/authorization-core": "0.4.0", + "@pegma/knowledge-base-contracts": manifest.version, + "@pegma/knowledge-base-core": manifest.version, + "@pegma/spine": "0.1.2", + "@pegma/storage-core": "0.4.0", + } + : specification.directory === "core" + ? { "@pegma/knowledge-base-contracts": manifest.version } + : { "@pegma/spine": "0.1.2" }, ); for (const document of ["README.md", "LICENSE"]) { const content = await readFile(join(directory, document), "utf8"); diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..7cbbdcb --- /dev/null +++ b/test/README.md @@ -0,0 +1,42 @@ +# KB-02 application conformance fixtures + +The suites in `tests/application.test.ts` and `tests/application-storage.test.ts` +run the same public application commands against Storage Core's real memory +store and its real Azure Tables adapter connected to local Azurite. They use +the actual contracts/core, Authorization Core permission checks, declared +record codec, and application repository. No parallel KB repository or custom +authorization engine is supplied by the fixtures. + +`application-fixtures.ts` supplies wholly fictional resolved `AccessContext` +values, a controlled clock, and scripted external evidence/source verifiers. +The receipt fixture binds its permitted reply to the exact actor, revision, +submission and governance configuration. It is a test double for a host trust +boundary, not a production attestation or credential implementation. Evidence +times follow the draft being tested; malformed-time cases call the public +service directly instead of using the successful-staging helper. + +`trace-store.ts` delegates every record operation to the supplied real store. +Its transaction interception adds refusals or a manual race barrier; captured +traces are observations, not another persistence implementation. The race +case permits a cross-partition policy update to race article publication and +asserts that current-policy serving denies the stale publication. It does not +claim cross-partition CAS or atomic policy revocation. + +`azurite.ts` starts a local table-only emulator on port 10212, distinct from +Support Desk's tests. Test tables have unique random names. The well-known +development-account connection is local-only; no cloud credentials or actual +customer data are used. Temporary emulator data is removed only after checking +that the resolved path belongs to the expected temporary-directory prefix. + +Run the application conformance suites after building the workspace packages: + +```sh +pnpm exec vitest run tests/application.test.ts tests/application-storage.test.ts +``` + +These tests establish KB-02 service and storage behavior. Passing synthetic +resolved contexts does not establish a real OAuth/MCP credential flow, and +the suites do not establish KB-03 search, browser UI, model-provider settings, +live-host acceptance, production throughput, or retention operations. The full +repository type/test/release gates and later host activation evidence remain +required. diff --git a/test/application-fixtures.ts b/test/application-fixtures.ts new file mode 100644 index 0000000..d83838a --- /dev/null +++ b/test/application-fixtures.ts @@ -0,0 +1,381 @@ +import type { AccessContext } from "@pegma/authorization-core"; +import { + createKnowledgeBaseApplication, + type DraftArticleDto, + type EvidenceVerificationRequest, + type GovernanceConfiguration, + type KnowledgeBaseApplicationOptions, + type PrivateSourceReference, + type SourceReadRequest, + type SourceEligibilityRequest, +} from "@pegma/knowledge-base-application"; +import { + articleKinds, + knowledgePermissions, + type ArticleKind, + type ArticleRevision, + type PrincipalId, + type ValidationPolicy, +} from "@pegma/knowledge-base-contracts"; +import type { + ArticleDraft, + EvidenceSubmission, +} from "@pegma/knowledge-base-core"; +import type { Store } from "@pegma/storage-core"; +import { isDeepStrictEqual } from "node:util"; +import { vi } from "vitest"; + +/** Synthetic resolved contexts, not a credential or identity implementation. */ +export function access( + principalId: PrincipalId, + permissions: readonly string[], +): AccessContext { + return { + principalId, + policyVersion: "synthetic-1", + roles: [], + entitlements: [], + permissions, + }; +} + +export const admin = access("staff/workshop", [ + ...Object.values(knowledgePermissions), + "workshop.customer", +]); +export const author = access("runner/staging", [ + knowledgePermissions.collectionRead, + knowledgePermissions.draftWrite, + knowledgePermissions.evidenceSubmit, + knowledgePermissions.reviewSubmit, + "knowledge.article.draft.read", +]); +export const customer = access("customer/workshop", [ + knowledgePermissions.collectionRead, + knowledgePermissions.articleRead, + "workshop.customer", +]); +export const outsider = access("customer/other", [ + knowledgePermissions.collectionRead, + knowledgePermissions.articleRead, +]); + +export const at = (offset = 0) => + new Date(Date.parse("2026-11-06T20:00:00.000Z") + offset).toISOString(); +export const validationPolicy: ValidationPolicy = { + id: "policy/workshop", + version: 1, + requirements: [ + ...articleKinds.map((kind) => ({ + id: `${kind}-content`, + kind, + testKind: "content", + maxAgeMilliseconds: 60_000, + trustedRunnerIds: [author.principalId], + })), + { + id: "walkthrough-workflow", + kind: "walkthrough", + testKind: "workflow", + maxAgeMilliseconds: 60_000, + trustedRunnerIds: [author.principalId], + }, + ], +}; + +export function draft( + kind: ArticleKind = "explanation", + body = "Choose [Export](/workspace/export). ", +): ArticleDraft { + return { + kind, + title: "Export your workspace", + summary: "Download a synthetic workspace export.", + content: { format: "markdown", text: body }, + tags: ["export"], + applicability: { + productId: "fictional-workshop", + productVersion: "1.0", + buildId: "staging-42", + locale: "en-US", + }, + }; +} + +export function evidence( + revision: ArticleRevision, + checkId = `${revision.kind}-content`, +): EvidenceSubmission { + const requirement = validationPolicy.requirements.find( + (check) => check.id === checkId, + ); + if (requirement === undefined) + throw new Error(`Unknown synthetic check ${checkId}`); + return { + id: `evidence/${checkId}`, + articleId: revision.articleId, + articleRevision: revision.number, + contentHash: revision.contentHash, + validationPolicy: revision.validationPolicy, + checkId, + testKind: requirement.testKind, + applicability: revision.applicability, + stagingBuildId: "staging-42", + steps: ['Run the quoted "export" workflow. PRIVATE_STAFF_EVIDENCE'], + result: "passed", + executedAt: new Date(Date.parse(revision.createdAt) + 1_000).toISOString(), + runnerId: author.principalId, + artifacts: [{ id: "private/artifact/export", hash: "a".repeat(64) }], + }; +} + +/** Scripted external trust fixtures; all KB persistence uses the supplied Store. */ +export function applicationFixture( + store: Store, + options: { + readonly missingEvidenceVerifier?: boolean; + readonly missingPrivateSources?: boolean; + readonly limits?: KnowledgeBaseApplicationOptions["limits"]; + } = {}, +) { + let offset = 0; + let commandOrdinal = 0; + const clock = { now: () => at(offset) }; + const trust = { + verifierThrows: false, + canReadSource: true, + canPublishSource: true, + sourceCurrent: true, + }; + const receipts = new Map< + string, + { + principalId: string; + article: ArticleRevision; + submission: EvidenceSubmission; + configuration: GovernanceConfiguration; + } + >(); + const verify = vi.fn(async (request: EvidenceVerificationRequest) => { + if (trust.verifierThrows) + throw new Error("Synthetic receipt service unavailable"); + const bound = receipts.get(request.receipt); + if ( + bound === undefined || + bound.principalId !== request.access.principalId || + !isDeepStrictEqual(bound.article, request.article) || + !isDeepStrictEqual(bound.submission, request.submission) || + !isDeepStrictEqual(bound.configuration, request.configuration) + ) + return null; + return { + id: request.receipt, + verifiedBy: "staff/verifier", + verifiedAt: clock.now(), + }; + }); + const privateSources = { + canRead: vi.fn(async (_request: SourceReadRequest) => trust.canReadSource), + canPublish: vi.fn( + async (_request: SourceEligibilityRequest) => trust.canPublishSource, + ), + isCurrent: vi.fn( + async (_request: SourceEligibilityRequest) => trust.sourceCurrent, + ), + }; + const app = createKnowledgeBaseApplication({ + store, + clock, + ...(options.limits === undefined ? {} : { limits: options.limits }), + ...(options.missingEvidenceVerifier + ? {} + : { evidenceVerifier: { verify } }), + ...(options.missingPrivateSources ? {} : { privateSources }), + }); + function command(prefix: string, expectedGeneration: number) { + return { + commandId: `${prefix}/${++commandOrdinal}`, + correlationId: "synthetic-correlation", + expectedGeneration, + }; + } + async function setupCollection( + collectionId = "collection/workshop", + portal = true, + ) { + await app.createCollection(admin, { + ...command("collection", 0), + collectionId, + name: "Workshop guides", + }); + try { + await app.getValidationPolicy(admin, { policyId: validationPolicy.id }); + } catch (error) { + if ( + !(error instanceof Error) || + error.name !== "KnowledgeBaseNotFoundError" + ) + throw error; + await app.putValidationPolicy(admin, { + ...command("policy", 0), + policy: validationPolicy, + }); + } + let current = await app.getCollection(admin, { collectionId }); + await app.putGovernanceConfiguration(admin, { + ...command("governance", current.generation), + collectionId, + configuration: { + validationPolicy: { + id: validationPolicy.id, + version: validationPolicy.version, + }, + expectedStagingBuildId: "staging-42", + trustedAttesterIds: ["staff/verifier"], + }, + }); + const preview = await app.previewCollectionPolicy(admin, { + collectionId, + uses: { + portal: portal + ? { + enabled: true, + audience: { kind: "permission", permission: "workshop.customer" }, + } + : { enabled: false }, + bot: { + enabled: true, + audience: { kind: "permission", permission: "workshop.customer" }, + }, + }, + }); + await app.updateCollectionPolicy(admin, { + ...command("audience", preview.generation), + collectionId, + preview: preview.preview, + }); + current = await app.getCollection(admin, { collectionId }); + return current; + } + async function createDraft( + articleId = "article/export", + collectionId = "collection/workshop", + body?: ArticleDraft, + ) { + await app.createDraft(author, { + ...command("draft", 0), + articleId, + collectionId, + draft: body ?? draft(), + }); + return app.getDraft(author, { articleId }); + } + async function issueReceipt( + current: DraftArticleDto, + submission = evidence(current.revision), + principal = author, + ) { + const receipt = `receipt/${++commandOrdinal}`; + const configuration = await app.getGovernanceConfiguration(admin, { + collectionId: current.revision.collectionId, + }); + receipts.set(receipt, { + principalId: principal.principalId, + article: structuredClone(current.revision), + submission: structuredClone(submission), + configuration: structuredClone(configuration.configuration), + }); + return { receipt, submission }; + } + async function submitEvidence( + current: DraftArticleDto, + checkId?: string, + submission?: EvidenceSubmission, + ) { + const submitted = submission ?? evidence(current.revision, checkId); + // This helper simulates a completed legitimate staging run. Negative + // timestamp/receipt cases call the public service directly instead. + offset = Math.max( + offset, + 3_000, + Date.parse(submitted.executedAt) - Date.parse(at()) + 1_000, + ); + const issued = await issueReceipt(current, submitted); + const input = { + ...command("evidence", current.generation), + articleId: current.articleId, + evidence: issued.submission, + receipt: issued.receipt, + }; + const result = await app.submitEvidence(author, input); + return { + result, + input, + current: await app.getDraft(author, { articleId: current.articleId }), + }; + } + async function review(current: DraftArticleDto) { + offset = Math.max(offset, 4_000); + await app.submitForReview(author, { + ...command("review", current.generation), + articleId: current.articleId, + }); + return app.getReview(admin, { articleId: current.articleId }); + } + async function publish(current: DraftArticleDto) { + const reviewed = await review(current); + offset = Math.max(offset, 5_000); + const input = { + ...command("publish", reviewed.generation), + articleId: current.articleId, + review: reviewed.review, + }; + const result = await app.publishArticle(admin, input); + return { + result, + input, + current: await app.getDraft(author, { articleId: current.articleId }), + }; + } + async function publishedArticle( + articleId = "article/export", + collectionId = "collection/workshop", + body?: ArticleDraft, + ) { + let current = await createDraft(articleId, collectionId, body); + current = (await submitEvidence(current)).current; + if (current.revision.kind === "walkthrough") + current = (await submitEvidence(current, "walkthrough-workflow")).current; + return publish(current); + } + async function setSources( + current: DraftArticleDto, + references: readonly PrivateSourceReference[], + ) { + await app.setProvenance(admin, { + ...command("sources", current.generation), + articleId: current.articleId, + references, + }); + return app.getDraft(author, { articleId: current.articleId }); + } + return { + app, + store, + command, + setupCollection, + createDraft, + issueReceipt, + submitEvidence, + review, + publish, + publishedArticle, + setSources, + trust, + verify, + privateSources, + setTime: (value: number) => { + offset = value; + }, + }; +} diff --git a/test/application-stores.ts b/test/application-stores.ts new file mode 100644 index 0000000..14ec3d2 --- /dev/null +++ b/test/application-stores.ts @@ -0,0 +1,48 @@ +import { TableClient } from "@azure/data-tables"; +import { randomUUID } from "node:crypto"; +import { + knowledgeRecords, + type KnowledgeRecord, +} from "@pegma/knowledge-base-application"; +import { createAzureTablesStore } from "@pegma/storage-azure-tables"; +import { createMemoryStore, type Store } from "@pegma/storage-core"; +import { TABLE_PORT } from "./azurite.js"; + +function azureStore(): Store { + const connection = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:${TABLE_PORT}/devstoreaccount1;`; + return createAzureTablesStore({ + client: TableClient.fromConnectionString( + connection, + `knowledge${randomUUID().replaceAll("-", "")}`, + { allowInsecureConnection: true }, + ), + }); +} +export const storeFactories = [ + ["memory", createMemoryStore], + ["Azurite", azureStore], +] as const; + +/** Bounded observation of the actual backing collection, not a parallel store. */ +export async function allKnowledgeRows( + store: Store, +): Promise { + const records = store.collection(knowledgeRecords); + const rows: KnowledgeRecord[] = []; + let cursor: string | undefined; + for (let pageNumber = 0; pageNumber < 8; pageNumber += 1) { + const page = await records.scan({ + limit: 1_000, + ...(cursor === undefined ? {} : { cursor }), + }); + rows.push(...page.records.map((record) => record.value)); + if (page.nextCursor === null) + return rows.sort((left, right) => + `${left.partition}/${left.id}`.localeCompare( + `${right.partition}/${right.id}`, + ), + ); + cursor = page.nextCursor; + } + throw new Error("Synthetic fixture exceeded its bounded snapshot scan"); +} diff --git a/test/azurite.ts b/test/azurite.ts new file mode 100644 index 0000000..b4736db --- /dev/null +++ b/test/azurite.ts @@ -0,0 +1,99 @@ +import { spawn, type ChildProcess } from "node:child_process"; +import { existsSync } from "node:fs"; +import { mkdtemp, rm } from "node:fs/promises"; +import { connect } from "node:net"; +import { basename, join, resolve, sep } from "node:path"; +import { tmpdir } from "node:os"; + +/** Local emulator only; deliberately different from Support Desk's test port. */ +export const TABLE_PORT = 10212; + +let child: ChildProcess | undefined; +let workspace: string | undefined; + +function accepting(port: number): Promise { + return new Promise((resolveAccepting) => { + const socket = connect({ port, host: "127.0.0.1" }); + const finish = (ready: boolean) => { + socket.destroy(); + resolveAccepting(ready); + }; + socket.once("connect", () => finish(true)); + socket.once("error", () => finish(false)); + socket.setTimeout(1_000, () => finish(false)); + }); +} + +async function removeWorkspace(): Promise { + if (workspace === undefined) return; + const absolute = resolve(workspace); + const parent = resolve(tmpdir()) + sep; + if ( + !absolute.startsWith(parent) || + !basename(absolute).startsWith("pegma-knowledge-azurite-") + ) { + throw new Error("Refusing to remove an unexpected Azurite test workspace"); + } + await rm(absolute, { recursive: true, force: true }); + workspace = undefined; +} + +export async function setup(): Promise { + const entry = join( + process.cwd(), + "node_modules", + "azurite", + "dist", + "src", + "table", + "main.js", + ); + if (!existsSync(entry)) + throw new Error( + "Azurite table service is missing; install repository dependencies first.", + ); + if (await accepting(TABLE_PORT)) + throw new Error(`Azurite test port ${TABLE_PORT} is already in use.`); + workspace = await mkdtemp(join(tmpdir(), "pegma-knowledge-azurite-")); + child = spawn( + process.execPath, + [ + entry, + "--location", + workspace, + "--silent", + "--tableHost", + "127.0.0.1", + "--tablePort", + String(TABLE_PORT), + "--disableTelemetry", + ], + { stdio: "ignore", windowsHide: true }, + ); + let failure: Error | undefined; + child.once("error", (error) => { + failure = error; + }); + const deadline = Date.now() + 30_000; + try { + while (Date.now() < deadline) { + if (failure !== undefined) throw failure; + if (child.exitCode !== null) + throw new Error(`Azurite exited early: ${child.exitCode}`); + if (await accepting(TABLE_PORT)) return; + await new Promise((resolveDelay) => setTimeout(resolveDelay, 100)); + } + throw new Error(`Azurite did not start on test port ${TABLE_PORT}.`); + } catch (error) { + child.kill(); + child = undefined; + await removeWorkspace(); + throw error; + } +} + +export async function teardown(): Promise { + child?.kill(); + child = undefined; + await removeWorkspace(); +} diff --git a/test/trace-store.ts b/test/trace-store.ts new file mode 100644 index 0000000..cacd4c9 --- /dev/null +++ b/test/trace-store.ts @@ -0,0 +1,97 @@ +import type { + CollectionDefinition, + EntityKey, + Store, + TransactionAction, + TransactionOutcome, +} from "@pegma/storage-core"; + +export interface TransactionTrace { + readonly collection: string; + readonly partition: string; + readonly actions: readonly TransactionAction[]; +} + +export interface GetTrace { + readonly collection: string; + readonly key: EntityKey; +} + +/** Delegates all data to the real Store; only read timing and transactions vary. */ +export function traceStore(backing: Store) { + const transactions: TransactionTrace[] = []; + let intercept: + | (( + trace: TransactionTrace, + commit: () => Promise, + ) => Promise) + | undefined; + let beforeGet: ((trace: GetTrace) => Promise) | undefined; + const store: Store = { + collection(definition: CollectionDefinition) { + const target = backing.collection(definition); + return new Proxy(target, { + get(object, property) { + if (property === "get") + return async (key: EntityKey) => { + await beforeGet?.({ + collection: definition.name, + key: structuredClone(key), + }); + return object.get(key); + }; + if (property === "transact") + return async ( + partition: string, + actions: readonly TransactionAction[], + ) => { + const trace = { + collection: definition.name, + partition, + actions: structuredClone(actions), + }; + transactions.push(trace); + const commit = () => object.transact(partition, actions); + return intercept === undefined + ? commit() + : intercept(trace, commit); + }; + const value: unknown = Reflect.get(object, property, object); + return typeof value === "function" ? value.bind(object) : value; + }, + }); + }, + }; + return { + store, + transactions, + intercept: (handler: typeof intercept) => { + intercept = handler; + }, + beforeGet: (handler: typeof beforeGet) => { + beforeGet = handler; + }, + }; +} + +/** Manual, bounded test barrier for completing real transactions out of order. */ +export function barrier() { + let release: (() => void) | undefined; + let announce: (() => void) | undefined; + const reached = new Promise((resolve) => { + announce = resolve; + }); + const waiting = new Promise((resolve) => { + release = resolve; + }); + return { + reached, + wait: () => { + announce!(); + return waiting; + }, + release: () => { + release!(); + }, + }; +} diff --git a/tests/application-storage.test.ts b/tests/application-storage.test.ts new file mode 100644 index 0000000..7378310 --- /dev/null +++ b/tests/application-storage.test.ts @@ -0,0 +1,488 @@ +import type { DraftArticleDto } from "@pegma/knowledge-base-application"; +import { describe, expect, it } from "vitest"; +import { + admin, + applicationFixture, + author, + draft, + evidence, +} from "../test/application-fixtures.js"; +import { + allKnowledgeRows, + storeFactories, +} from "../test/application-stores.js"; +import { barrier, traceStore } from "../test/trace-store.js"; + +const conflict = { name: "RepositoryConflictError" }; +const capacity = { name: "RepositoryCapacityError" }; + +for (const [name, createStore] of storeFactories) { + describe(`KB application atomicity and admission (${name})`, () => { + it("commits authoritative revision, audit, replay receipt and causal job together", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const current = await f.createDraft(); + const rows = (await allKnowledgeRows(f.store)).filter( + (row) => + row.resourceKind === "article" && + row.resourceId === current.articleId, + ); + expect(rows.map((row) => row.kind).sort()).toEqual([ + "audit", + "command", + "head", + "job", + "provenance", + "revision", + ]); + }); + + it("retries a refused transaction whose failedAction is absent without duplicating accepted work", async () => { + const backing = createStore(); + const traced = traceStore(backing); + const f = applicationFixture(traced.store); + await f.setupCollection(); + const current = await f.createDraft(); + let failures = 1; + traced.intercept(async (_trace, commit) => + failures-- > 0 ? { committed: false, reason: "changed" } : commit(), + ); + await f.app.updateDraft(author, { + ...f.command("retry-edit", current.generation), + articleId: current.articleId, + collectionId: current.revision.collectionId, + draft: { ...draft(), title: "Accepted once" }, + }); + traced.intercept(undefined); + const rows = (await allKnowledgeRows(backing)).filter( + (row) => row.resourceKind === "article", + ); + expect(rows.filter((row) => row.kind === "revision")).toHaveLength(2); + expect(rows.filter((row) => row.kind === "audit")).toHaveLength(2); + expect(rows.filter((row) => row.kind === "command")).toHaveLength(2); + expect(rows.filter((row) => row.kind === "job")).toHaveLength(2); + expect( + (await f.app.getDraft(author, { articleId: current.articleId })) + .revision.title, + ).toBe("Accepted once"); + }); + + it("replays an identical concurrent command after a timestamp-dependent immutable planning collision", async () => { + const backing = createStore(); + const winner = applicationFixture(backing); + await winner.setupCollection(); + const traced = traceStore(backing); + const delayed = applicationFixture(traced.store); + delayed.setTime(1_000); + const gate = barrier(); + let paused = false; + traced.beforeGet(async ({ key }) => { + if ( + !paused && + key.partition.startsWith("article:") && + key.id === "revision:1" + ) { + paused = true; + await gate.wait(); + } + }); + const input = { + ...winner.command("concurrent-identical-create", 0), + articleId: "article/concurrent-replay", + collectionId: "collection/workshop", + draft: draft(), + }; + const pending = delayed.app.createDraft(author, input).then( + (value) => ({ value }), + (error: unknown) => ({ error }), + ); + let accepted; + try { + await Promise.race([ + gate.reached, + pending.then(() => { + throw new Error("Create did not reach its immutable read barrier"); + }), + ]); + accepted = await winner.app.createDraft(author, input); + } finally { + gate.release(); + } + const settled = await pending; + traced.beforeGet(undefined); + expect(accepted.replayed).toBe(false); + expect(settled).toEqual({ + value: { value: accepted.value, replayed: true }, + }); + const rows = (await allKnowledgeRows(backing)).filter( + (row) => row.resourceKind === "article", + ); + expect(rows.map((row) => row.kind).sort()).toEqual([ + "audit", + "command", + "head", + "job", + "provenance", + "revision", + ]); + expect( + ( + await winner.app.getDraft(author, { + articleId: input.articleId, + }) + ).revision.createdAt, + ).toBe("2026-11-06T20:00:00.000Z"); + }, 30_000); + + it.each(["create", "edit"] as const)( + "replays an identical %s when the winning receipt appears after the cached head was read", + async (operation) => { + const backing = createStore(); + const winner = applicationFixture(backing); + await winner.setupCollection(); + const articleId = "article/receipt-read-race"; + const expectedGeneration = + operation === "create" + ? 0 + : (await winner.createDraft(articleId)).generation; + winner.setTime(2_000); + const traced = traceStore(backing); + const delayed = applicationFixture(traced.store, { + limits: { maxConflictAttempts: 1 }, + }); + delayed.setTime(3_000); + const gate = barrier(); + let paused = false; + traced.beforeGet(async ({ key }) => { + if ( + !paused && + key.partition.startsWith("article:") && + key.id.startsWith("command:") + ) { + paused = true; + await gate.wait(); + } + }); + const input = { + ...winner.command("receipt-read-race", expectedGeneration), + articleId, + collectionId: "collection/workshop", + draft: { ...draft(), title: "Receipt-winning guide" }, + }; + const invoke = (fixture: typeof winner) => + operation === "create" + ? fixture.app.createDraft(author, input) + : fixture.app.updateDraft(author, input); + const pending = invoke(delayed).then( + (value) => ({ value }), + (error: unknown) => ({ error }), + ); + let accepted; + let committedRows; + try { + await Promise.race([ + gate.reached, + pending.then(() => { + throw new Error("Command did not reach its receipt read barrier"); + }), + ]); + accepted = await invoke(winner); + committedRows = await allKnowledgeRows(backing); + } finally { + gate.release(); + } + const settled = await pending; + traced.beforeGet(undefined); + expect(accepted.replayed).toBe(false); + expect(settled).toEqual({ + value: { value: accepted.value, replayed: true }, + }); + expect(await allKnowledgeRows(backing)).toEqual(committedRows); + const articleRows = committedRows.filter( + (row) => row.resourceKind === "article", + ); + const acceptedCommands = operation === "create" ? 1 : 2; + for (const kind of ["revision", "audit", "command", "job"]) + expect(articleRows.filter((row) => row.kind === kind)).toHaveLength( + acceptedCommands, + ); + expect(traced.transactions).toHaveLength(0); + }, + 30_000, + ); + + it("refuses repeated failed preconditions atomically, including absent failedAction", async () => { + const backing = createStore(); + const traced = traceStore(backing); + const f = applicationFixture(traced.store); + await f.setupCollection(); + const current = await f.createDraft(); + const before = await allKnowledgeRows(backing); + let attempts = 0; + traced.intercept(async () => { + attempts += 1; + return { committed: false, reason: "changed" }; + }); + await expect( + f.app.updateDraft(author, { + ...f.command("refused-edit", current.generation), + articleId: current.articleId, + collectionId: current.revision.collectionId, + draft: { ...draft(), title: "Never committed" }, + }), + ).rejects.toMatchObject(conflict); + traced.intercept(undefined); + expect(attempts).toBe(3); + expect(await allKnowledgeRows(backing)).toEqual(before); + expect( + await f.app.getDraft(author, { articleId: current.articleId }), + ).toEqual(current); + }); + + it("allows one concurrent edit, counts every history row, and preserves retirement reserve", async () => { + const store = createStore(); + await applicationFixture(store).setupCollection(); + const f = applicationFixture(store, { + limits: { maxPhysicalRows: 14, controlReserveRows: 4 }, + }); + const original = await f.createDraft(); + const results = await Promise.allSettled( + ["First competing edit", "Second competing edit"].map((title) => + f.app.updateDraft(author, { + ...f.command("competing-edit", original.generation), + articleId: original.articleId, + collectionId: original.revision.collectionId, + draft: { ...draft(), title }, + }), + ), + ); + expect( + results.filter((result) => result.status === "fulfilled"), + ).toHaveLength(1); + expect( + results.filter((result) => result.status === "rejected"), + ).toHaveLength(1); + const current = await f.app.getDraft(author, { + articleId: original.articleId, + }); + expect(current.generation).toBe(original.generation + 1); + expect(current.revision.number).toBe(2); + expect(["First competing edit", "Second competing edit"]).toContain( + current.revision.title, + ); + const before = await allKnowledgeRows(store); + expect( + before.filter((row) => row.resourceKind === "article"), + ).toHaveLength(10); + await expect( + f.app.updateDraft(author, { + ...f.command("no-authoring-space", current.generation), + articleId: current.articleId, + collectionId: current.revision.collectionId, + draft: draft(), + }), + ).rejects.toMatchObject(capacity); + expect(await allKnowledgeRows(store)).toEqual(before); + await f.app.retireArticle(admin, { + ...f.command("reserved-retirement", current.generation), + articleId: current.articleId, + }); + expect( + (await f.app.getDraft(admin, { articleId: current.articleId })).state, + ).toBe("retired"); + expect( + (await allKnowledgeRows(store)).filter( + (row) => row.resourceKind === "article", + ), + ).toHaveLength(13); + }, 30_000); + + it("does not lose independent evidence submissions across an application-generation conflict", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const current = await f.createDraft( + "article/walkthrough", + "collection/workshop", + draft("walkthrough"), + ); + f.setTime(3_000); + const kinds = ["walkthrough-content", "walkthrough-workflow"] as const; + const inputs = await Promise.all( + kinds.map(async (kind) => { + const issued = await f.issueReceipt( + current, + evidence(current.revision, kind), + ); + return { + ...f.command(kind, current.generation), + articleId: current.articleId, + evidence: issued.submission, + receipt: issued.receipt, + }; + }), + ); + const results = await Promise.allSettled( + inputs.map((input) => f.app.submitEvidence(author, input)), + ); + expect( + results.filter((result) => result.status === "fulfilled"), + ).toHaveLength(1); + const failedIndex = results.findIndex( + (result) => result.status === "rejected", + ); + const after = await f.app.getDraft(author, { + articleId: current.articleId, + }); + expect(after.revision.number).toBe(1); + expect(after.generation).toBe(current.generation + 1); + await f.app.submitEvidence(author, { + ...inputs[failedIndex]!, + ...f.command("retry-distinct-proof", after.generation), + }); + const stored = await f.app.getEvidence(admin, { + articleId: current.articleId, + }); + expect(stored.evidence.map((proof) => proof.checkId).sort()).toEqual([ + ...kinds, + ]); + await f.review( + await f.app.getDraft(author, { articleId: current.articleId }), + ); + }, 30_000); + + it("preserves exact retained-history limits without deleting old rows to admit an edit", async () => { + const store = createStore(); + await applicationFixture(store).setupCollection(); + const f = applicationFixture(store, { + limits: { maxArticleRevisions: 2 }, + }); + let current = await f.createDraft(); + await f.app.updateDraft(author, { + ...f.command("second-revision", current.generation), + articleId: current.articleId, + collectionId: current.revision.collectionId, + draft: { ...draft(), title: "Second revision" }, + }); + current = await f.app.getDraft(author, { articleId: current.articleId }); + const before = await allKnowledgeRows(store); + await expect( + f.app.updateDraft(author, { + ...f.command("third-revision", current.generation), + articleId: current.articleId, + collectionId: current.revision.collectionId, + draft: { ...draft(), title: "Third revision" }, + }), + ).rejects.toMatchObject(capacity); + expect(await allKnowledgeRows(store)).toEqual(before); + expect( + (await allKnowledgeRows(store)).filter( + (row) => row.kind === "revision", + ), + ).toHaveLength(2); + }); + + it("keeps enough control capacity to revoke a live published proof", async () => { + const store = createStore(); + await applicationFixture(store).setupCollection(); + const f = applicationFixture(store, { + limits: { maxPhysicalRows: 22, controlReserveRows: 4 }, + }); + const published = await f.publishedArticle(); + const proof = ( + await f.app.getEvidence(admin, { + articleId: published.current.articleId, + }) + ).evidence[0]!; + expect( + (await allKnowledgeRows(store)).filter( + (row) => row.resourceKind === "article", + ), + ).toHaveLength(18); + await expect( + f.app.updateDraft(author, { + ...f.command("would-consume-reserve", published.current.generation), + articleId: published.current.articleId, + collectionId: "collection/workshop", + draft: draft(), + }), + ).rejects.toMatchObject(capacity); + await f.app.revokeEvidence(admin, { + ...f.command("reserved-proof-revocation", published.current.generation), + articleId: published.current.articleId, + articleRevision: proof.articleRevision, + evidenceId: proof.id, + evidenceVersion: proof.version, + evidenceHash: proof.hash, + reason: "Synthetic proof revoked", + }); + expect( + (await allKnowledgeRows(store)).filter( + (row) => row.resourceKind === "article", + ), + ).toHaveLength(22); + expect( + ( + await f.app.getDraft(admin, { + articleId: published.current.articleId, + }) + ).publicationHeld, + ).toBe(true); + }, 30_000); + + it("fails current-policy serving after a collection update races a publication commit", async () => { + const backing = createStore(); + const traced = traceStore(backing); + const f = applicationFixture(traced.store); + await f.setupCollection(); + let current: DraftArticleDto = await f.createDraft(); + current = (await f.submitEvidence(current)).current; + const review = await f.review(current); + f.setTime(5_000); + const gate = barrier(); + let paused = false; + traced.intercept(async (trace, commit) => { + if (!paused && trace.partition.startsWith("article:")) { + paused = true; + await gate.wait(); + } + return commit(); + }); + const pending = f.app + .publishArticle(admin, { + ...f.command("racing-publication", review.generation), + articleId: current.articleId, + review: review.review, + }) + .then( + (value) => ({ value }), + (error: unknown) => ({ error }), + ); + try { + await Promise.race([ + gate.reached, + pending.then(() => { + throw new Error( + "Publication did not reach its transaction barrier", + ); + }), + ]); + const preview = await f.app.previewCollectionPolicy(admin, { + collectionId: "collection/workshop", + uses: { portal: { enabled: false }, bot: { enabled: false } }, + }); + await f.app.updateCollectionPolicy(admin, { + ...f.command("concurrent-revocation", preview.generation), + collectionId: "collection/workshop", + preview: preview.preview, + }); + } finally { + gate.release(); + } + await pending; + traced.intercept(undefined); + await expect( + f.app.getPublishedArticle(admin, { articleId: current.articleId }), + ).rejects.toMatchObject({ name: "KnowledgeBaseNotFoundError" }); + }, 30_000); + }); +} diff --git a/tests/application.test.ts b/tests/application.test.ts new file mode 100644 index 0000000..ce6eda7 --- /dev/null +++ b/tests/application.test.ts @@ -0,0 +1,751 @@ +import { knowledgePermissions } from "@pegma/knowledge-base-contracts"; +import { knowledgeLimits } from "@pegma/knowledge-base-core"; +import { + createKnowledgeBaseApplication, + type PrivateSourceReference, + type PrivateSourcesVerifier, + type SourceEligibilityRequest, +} from "@pegma/knowledge-base-application"; +import { describe, expect, it, vi } from "vitest"; +import { + access, + admin, + at, + applicationFixture, + author, + customer, + draft, + evidence, + outsider, + validationPolicy, +} from "../test/application-fixtures.js"; +import { + allKnowledgeRows, + storeFactories, +} from "../test/application-stores.js"; + +const source: PrivateSourceReference = { + id: "source/private", + system: "synthetic-support", + resourceId: "PRIVATE_SOURCE_TICKET_7", + version: "resolution-2", +}; +const missing = { name: "KnowledgeBaseNotFoundError" }; +const conflict = { name: "RepositoryConflictError" }; + +for (const [name, createStore] of storeFactories) { + describe(`authorized KB application public entries (${name})`, () => { + it("refuses collection management for a published-content reader", async () => { + const f = applicationFixture(createStore()); + await expect( + f.app.createCollection(customer, { + ...f.command("denied", 0), + collectionId: "collection/workshop", + name: "Workshop guides", + }), + ).rejects.toMatchObject({ + permission: knowledgePermissions.collectionManage, + }); + }); + + it("lets authors inspect safe active validation requirements before creating a draft", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const requirements = await f.app.getValidationRequirements(author, { + collectionId: "collection/workshop", + kind: "walkthrough", + }); + expect(requirements.validationPolicy).toEqual({ + id: validationPolicy.id, + version: 1, + }); + expect(requirements.expectedStagingBuildId).toBe("staging-42"); + expect(requirements.checks.map((check) => check.id).sort()).toEqual([ + "walkthrough-content", + "walkthrough-workflow", + ]); + for (const secret of [ + "trustedRunnerIds", + "trustedAttesterIds", + "runner/staging", + "staff/verifier", + ]) + expect(JSON.stringify(requirements)).not.toContain(secret); + await expect( + f.app.getValidationRequirements(customer, { + collectionId: "collection/workshop", + kind: "explanation", + }), + ).rejects.toMatchObject({ name: "KnowledgeBaseAuthorizationError" }); + }); + + it("keeps author, reviewer, and private-read authority separate", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + let current = await f.createDraft(); + current = (await f.submitEvidence(current)).current; + const reviewed = await f.review(current); + const noPublish = access(author.principalId, [ + ...author.permissions, + knowledgePermissions.review, + ]); + await expect( + f.app.publishArticle(noPublish, { + ...f.command("denied-publish", reviewed.generation), + articleId: current.articleId, + review: reviewed.review, + }), + ).rejects.toMatchObject({ permission: knowledgePermissions.publish }); + for (const [read, permission] of [ + [f.app.getDraft, knowledgePermissions.draftRead], + [f.app.getEvidence, knowledgePermissions.evidenceRead], + [f.app.getProvenance, knowledgePermissions.provenanceRead], + ] as const) { + await expect( + read(customer, { articleId: current.articleId }), + ).rejects.toMatchObject({ permission }); + } + await expect( + f.app.getEvidence(author, { articleId: current.articleId }), + ).rejects.toMatchObject({ + permission: knowledgePermissions.evidenceRead, + }); + const visible = await f.app.getDraft(author, { + articleId: current.articleId, + }); + expect(visible.hasPendingReview).toBe(true); + for (const privateField of ["evidence", "review", "provenance"]) + expect(visible).not.toHaveProperty(privateField); + }); + + it("returns an explicit approved-content DTO without evidence, actors, or provenance", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + let current = await f.createDraft(); + current = await f.setSources(current, [source]); + current = (await f.submitEvidence(current)).current; + await f.publish(current); + const visible = await f.app.getPublishedArticle(customer, { + articleId: current.articleId, + }); + expect(Object.keys(visible).sort()).toEqual([ + "applicability", + "articleId", + "collectionId", + "content", + "contentHash", + "kind", + "revision", + "summary", + "tags", + "title", + ]); + for (const forbidden of [ + "PRIVATE_STAFF_EVIDENCE", + "PRIVATE_SOURCE_TICKET_7", + "createdBy", + "attestation", + "evidence", + "reviewerId", + "sourceSnapshot", + ]) + expect(JSON.stringify(visible)).not.toContain(forbidden); + expect(visible.content.text).toBe(draft().content.text); + expect( + (await f.app.getEvidence(admin, { articleId: current.articleId })) + .evidence[0]?.steps[0], + ).toContain("PRIVATE_STAFF_EVIDENCE"); + expect( + (await f.app.getProvenance(admin, { articleId: current.articleId })) + .snapshot.references, + ).toEqual([source]); + }); + + it("does not expose unpublished drafts, bot-only collections, or unauthorized portal audiences", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const unpublished = await f.createDraft("article/draft-only"); + await expect( + f.app.getPublishedArticle(customer, { + articleId: unpublished.articleId, + }), + ).rejects.toMatchObject(missing); + await f.publishedArticle("article/published"); + await expect( + f.app.getPublishedArticle(outsider, { articleId: "article/published" }), + ).rejects.toMatchObject(missing); + await f.setupCollection("collection/bot-only", false); + await f.publishedArticle("article/bot-guide", "collection/bot-only"); + for (const caller of [customer, admin]) + await expect( + f.app.getPublishedArticle(caller, { articleId: "article/bot-guide" }), + ).rejects.toMatchObject(missing); + }); + + it("preserves old publication identity while a moved draft awaits review", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + let sourced = await f.createDraft(); + sourced = await f.setSources(sourced, [source]); + sourced = (await f.submitEvidence(sourced)).current; + await f.publish(sourced); + const old = await f.app.getPublishedArticle(customer, { + articleId: "article/export", + }); + await f.setupCollection("collection/bot-only", false); + const current = await f.app.getDraft(author, { + articleId: old.articleId, + }); + await f.app.updateDraft(author, { + ...f.command("move", current.generation), + articleId: current.articleId, + collectionId: "collection/bot-only", + draft: { + ...draft(), + title: "UNAPPROVED_NEW_TITLE", + content: { format: "plain_text", text: "UNAPPROVED_NEW_CONTENT" }, + }, + }); + expect( + (await f.app.getDraft(author, { articleId: current.articleId })) + .revision.collectionId, + ).toBe("collection/bot-only"); + expect( + await f.app.getPublishedArticle(customer, { + articleId: current.articleId, + }), + ).toEqual(old); + expect(f.privateSources.isCurrent).toHaveBeenLastCalledWith( + expect.objectContaining({ + article: expect.objectContaining({ + collectionId: "collection/workshop", + number: 1, + }), + snapshot: expect.objectContaining({ references: [source] }), + }), + ); + }); + + it("isolates independently composed stores with matching resource IDs", async () => { + const a = applicationFixture(createStore()); + const b = applicationFixture(createStore()); + await a.setupCollection(); + await a.publishedArticle(); + await expect( + b.app.getPublishedArticle(customer, { articleId: "article/export" }), + ).rejects.toMatchObject(missing); + await b.setupCollection(); + await b.publishedArticle( + "article/export", + "collection/workshop", + draft("explanation", "Different fictional guide."), + ); + expect( + ( + await a.app.getPublishedArticle(customer, { + articleId: "article/export", + }) + ).content.text, + ).toBe(draft().content.text); + expect( + ( + await b.app.getPublishedArticle(customer, { + articleId: "article/export", + }) + ).content.text, + ).toBe("Different fictional guide."); + }); + + it.each(["false", "throw", "missing"] as const)( + "hides published content when live source publication eligibility is %s after a draft move", + async (mode) => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + let current = await f.createDraft(); + current = await f.setSources(current, [source]); + current = (await f.submitEvidence(current)).current; + const publishedRevision = current.revision; + current = (await f.publish(current)).current; + await f.setupCollection("collection/bot-only", false); + await f.app.updateDraft(author, { + ...f.command("move-before-source-revocation", current.generation), + articleId: current.articleId, + collectionId: "collection/bot-only", + draft: { ...draft(), title: "Unapproved moved draft" }, + }); + expect( + ( + await f.app.getPublishedArticle(customer, { + articleId: current.articleId, + }) + ).revision, + ).toBe(1); + const canPublish = vi.fn(async (_request: SourceEligibilityRequest) => { + if (mode === "throw") + throw new Error("PRIVATE_SOURCE_SERVICE_FAILURE"); + return false; + }); + // A partially configured host port must fail closed at runtime too. + const privateSources = { + canRead: f.privateSources.canRead, + isCurrent: f.privateSources.isCurrent, + ...(mode === "missing" ? {} : { canPublish }), + } as PrivateSourcesVerifier; + const reader = createKnowledgeBaseApplication({ + store: f.store, + clock: { now: () => at(10_000) }, + privateSources, + }); + const before = await allKnowledgeRows(f.store); + await expect( + reader.getPublishedArticle(customer, { + articleId: current.articleId, + }), + ).rejects.toMatchObject({ ...missing, resource: "article" }); + expect(await allKnowledgeRows(f.store)).toEqual(before); + if (mode !== "missing") + expect(canPublish).toHaveBeenLastCalledWith({ + article: publishedRevision, + snapshot: expect.objectContaining({ references: [source] }), + }); + expect(f.trust.sourceCurrent).toBe(true); + }, + ); + + it("replays bounded acknowledgements without duplicate rows and rechecks current authority", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const input = { + ...f.command("create-once", 0), + articleId: "article/replay", + collectionId: "collection/workshop", + draft: draft(), + }; + const first = await f.app.createDraft(author, input); + const before = await allKnowledgeRows(f.store); + expect(first.replayed).toBe(false); + expect(await f.app.createDraft(author, input)).toEqual({ + value: first.value, + replayed: true, + }); + await expect( + f.app.createDraft(author, { + ...input, + draft: { ...draft(), title: "Changed payload" }, + }), + ).rejects.toMatchObject(conflict); + await expect(f.app.createDraft(admin, input)).rejects.toMatchObject( + conflict, + ); + await expect( + f.app.createDraft(access(author.principalId, []), input), + ).rejects.toMatchObject({ permission: knowledgePermissions.draftWrite }); + expect(await allKnowledgeRows(f.store)).toEqual(before); + }); + + it("fences evidence changes with application generation rather than content revision", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const old = await f.createDraft(); + const changed = (await f.submitEvidence(old)).current; + expect(changed.revision.number).toBe(old.revision.number); + expect(changed.generation).toBeGreaterThan(old.generation); + await expect( + f.app.updateDraft(author, { + ...f.command("stale-edit", old.generation), + articleId: old.articleId, + collectionId: old.revision.collectionId, + draft: { ...draft(), title: "Stale title" }, + }), + ).rejects.toMatchObject(conflict); + expect( + await f.app.getDraft(author, { articleId: old.articleId }), + ).toEqual(changed); + }); + + it("rejects forged or rebound verifier receipts without accepted state", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const current = await f.createDraft(); + f.setTime(3_000); + const proof = evidence(current.revision); + const issued = await f.issueReceipt(current, proof); + const before = await allKnowledgeRows(f.store); + for (const [suffix, changed, receipt] of [ + ["forged", proof, "caller-claims-passed"], + [ + "wrong-content", + { ...proof, contentHash: "b".repeat(64) }, + issued.receipt, + ], + [ + "wrong-build", + { ...proof, stagingBuildId: "staging-wrong" }, + issued.receipt, + ], + [ + "wrong-runner", + { ...proof, runnerId: "untrusted/runner" }, + issued.receipt, + ], + ] as const) { + await expect( + f.app.submitEvidence(author, { + ...f.command(suffix, current.generation), + articleId: current.articleId, + evidence: changed, + receipt, + }), + ).rejects.toMatchObject({ + name: expect.stringMatching( + /^(KnowledgeBaseError|KnowledgeBasePrerequisiteError)$/u, + ), + }); + expect(await allKnowledgeRows(f.store)).toEqual(before); + } + expect( + (await f.app.getEvidence(admin, { articleId: current.articleId })) + .evidence, + ).toEqual([]); + }); + + it("fails closed when evidence verification is absent or unavailable", async () => { + const store = createStore(); + const f = applicationFixture(store, { missingEvidenceVerifier: true }); + await f.setupCollection(); + const current = await f.createDraft(); + f.setTime(3_000); + const before = await allKnowledgeRows(store); + await expect( + f.app.submitEvidence(author, { + ...f.command("missing-verifier", current.generation), + articleId: current.articleId, + evidence: evidence(current.revision), + receipt: "claimed-receipt", + }), + ).rejects.toMatchObject({ name: "KnowledgeBasePrerequisiteError" }); + const live = applicationFixture(store); + live.setTime(3_000); + live.trust.verifierThrows = true; + await expect( + live.app.submitEvidence(author, { + ...live.command("offline-verifier", current.generation), + articleId: current.articleId, + evidence: evidence(current.revision), + receipt: "claimed-receipt", + }), + ).rejects.toThrow(); + expect(await allKnowledgeRows(store)).toEqual(before); + }); + + it("invalidates pending review after provenance or active governance changes", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + let current = await f.createDraft(); + current = (await f.submitEvidence(current)).current; + const oldReview = await f.review(current); + current = await f.app.getDraft(author, { articleId: current.articleId }); + current = await f.setSources(current, [source]); + await expect( + f.app.publishArticle(admin, { + ...f.command("old-source-review", current.generation), + articleId: current.articleId, + review: oldReview.review, + }), + ).rejects.toThrow(); + expect( + (await f.app.getDraft(author, { articleId: current.articleId })) + .hasPublication, + ).toBe(false); + const newReview = await f.review(current); + const collection = await f.app.getCollection(admin, { + collectionId: current.revision.collectionId, + }); + await f.app.putGovernanceConfiguration(admin, { + ...f.command("profile-change", collection.generation), + collectionId: collection.collection.id, + configuration: { + validationPolicy: { id: validationPolicy.id, version: 1 }, + expectedStagingBuildId: "staging-new", + trustedAttesterIds: ["staff/verifier"], + }, + }); + await expect( + f.app.publishArticle(admin, { + ...f.command("old-profile-review", newReview.generation), + articleId: current.articleId, + review: newReview.review, + }), + ).rejects.toThrow(); + }); + + it("rechecks current collection policy and governance before published reads", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + await f.publishedArticle(); + const collectionId = "collection/workshop"; + const preview = await f.app.previewCollectionPolicy(admin, { + collectionId, + uses: { + portal: { enabled: false }, + bot: { + enabled: true, + audience: { kind: "permission", permission: "workshop.customer" }, + }, + }, + }); + await f.app.updateCollectionPolicy(admin, { + ...f.command("revoke-portal", preview.generation), + collectionId, + preview: preview.preview, + }); + await expect( + f.app.getPublishedArticle(customer, { articleId: "article/export" }), + ).rejects.toMatchObject(missing); + const other = applicationFixture(createStore()); + await other.setupCollection(); + await other.publishedArticle(); + const head = await other.app.getCollection(admin, { collectionId }); + await other.app.putGovernanceConfiguration(admin, { + ...other.command("profile", head.generation), + collectionId, + configuration: { + validationPolicy: { id: validationPolicy.id, version: 1 }, + expectedStagingBuildId: "staging-next", + trustedAttesterIds: ["staff/verifier"], + }, + }); + await expect( + other.app.getPublishedArticle(customer, { + articleId: "article/export", + }), + ).rejects.toMatchObject(missing); + }); + + it("requires source-resource permission and current source proof separately", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + let current = await f.createDraft(); + current = await f.setSources(current, [source]); + current = (await f.submitEvidence(current)).current; + f.trust.canPublishSource = false; + const beforeReview = await allKnowledgeRows(f.store); + await expect(f.review(current)).rejects.toMatchObject({ + name: "KnowledgeBasePrerequisiteError", + }); + expect(await allKnowledgeRows(f.store)).toEqual(beforeReview); + f.trust.canPublishSource = true; + await f.publish(current); + f.trust.canReadSource = false; + await expect( + f.app.getProvenance(admin, { articleId: current.articleId }), + ).rejects.toThrow(); + expect(f.privateSources.canRead).toHaveBeenLastCalledWith( + expect.objectContaining({ + access: expect.objectContaining({ principalId: admin.principalId }), + articleId: current.articleId, + reference: source, + }), + ); + f.trust.canReadSource = true; + f.trust.sourceCurrent = false; + await expect( + f.app.getPublishedArticle(customer, { articleId: current.articleId }), + ).rejects.toMatchObject(missing); + const withoutVerifier = applicationFixture(f.store, { + missingPrivateSources: true, + }); + await expect( + withoutVerifier.app.getPublishedArticle(customer, { + articleId: current.articleId, + }), + ).rejects.toThrow(); + const latest = await withoutVerifier.app.getDraft(admin, { + articleId: current.articleId, + }); + const beforeWrite = await allKnowledgeRows(f.store); + await expect( + withoutVerifier.app.setProvenance(admin, { + ...withoutVerifier.command( + "missing-source-verifier", + latest.generation, + ), + articleId: current.articleId, + references: [source], + }), + ).rejects.toMatchObject({ name: "KnowledgeBasePrerequisiteError" }); + expect(await allKnowledgeRows(f.store)).toEqual(beforeWrite); + }); + + it("revokes a historical evidence binding, holds publication, and replays safely", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const published = await f.publishedArticle(); + const proof = ( + await f.app.getEvidence(admin, { + articleId: published.current.articleId, + }) + ).evidence[0]!; + const input = { + ...f.command("revoke-proof", published.current.generation), + articleId: published.current.articleId, + articleRevision: proof.articleRevision, + evidenceId: proof.id, + evidenceVersion: proof.version, + evidenceHash: proof.hash, + reason: "Synthetic evidence withdrawal", + }; + await f.app.revokeEvidence(admin, input); + const before = await allKnowledgeRows(f.store); + expect( + ( + await f.app.getDraft(admin, { + articleId: published.current.articleId, + }) + ).publicationHeld, + ).toBe(true); + await expect( + f.app.getPublishedArticle(customer, { + articleId: published.current.articleId, + }), + ).rejects.toMatchObject(missing); + expect((await f.app.revokeEvidence(admin, input)).replayed).toBe(true); + expect(await allKnowledgeRows(f.store)).toEqual(before); + }); + + it("retains evidence by content revision without replacing an older publication", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const published = await f.publishedArticle(); + const old = await f.app.getPublishedArticle(customer, { + articleId: "article/export", + }); + await f.app.updateDraft(author, { + ...f.command("new-revision", published.current.generation), + articleId: "article/export", + collectionId: "collection/workshop", + draft: { ...draft(), title: "New unapproved revision" }, + }); + let current = await f.app.getDraft(author, { + articleId: "article/export", + }); + current = (await f.submitEvidence(current)).current; + const proof = ( + await f.app.getEvidence(admin, { articleId: current.articleId }) + ).evidence[0]!; + expect(proof.articleRevision).toBe(2); + expect(proof.version).toBe(1); + expect( + await f.app.getPublishedArticle(customer, { + articleId: current.articleId, + }), + ).toEqual(old); + }); + + it("requires explicit privileged approval for public collection changes", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const collectionId = "collection/workshop"; + const preview = await f.app.previewCollectionPolicy(admin, { + collectionId, + uses: { + portal: { enabled: true, audience: { kind: "anonymous" } }, + bot: { enabled: false }, + }, + }); + const input = { + ...f.command("public-change", preview.generation), + collectionId, + preview: preview.preview, + }; + await expect( + f.app.updateCollectionPolicy(admin, input), + ).rejects.toThrow(); + await expect( + f.app.updateCollectionPolicy( + access("staff/manager", [knowledgePermissions.collectionManage]), + { ...input, approvePublic: true }, + ), + ).rejects.toMatchObject({ + permission: knowledgePermissions.publicCollectionApprove, + }); + await f.app.updateCollectionPolicy(admin, { + ...input, + approvePublic: true, + }); + expect( + (await f.app.getCollection(admin, { collectionId })).collection + .publicApproval?.reviewerId, + ).toBe(admin.principalId); + }); + + it("rejects a stale policy preview after a governance-only generation change", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const collectionId = "collection/workshop"; + const preview = await f.app.previewCollectionPolicy(admin, { + collectionId, + uses: { portal: { enabled: false }, bot: { enabled: false } }, + }); + await f.app.putGovernanceConfiguration(admin, { + ...f.command("profile-metadata", preview.generation), + collectionId, + configuration: { + validationPolicy: { id: validationPolicy.id, version: 1 }, + expectedStagingBuildId: "staging-42", + trustedAttesterIds: ["staff/verifier"], + }, + }); + await expect( + f.app.updateCollectionPolicy(admin, { + ...f.command("stale-preview", preview.generation), + collectionId, + preview: preview.preview, + }), + ).rejects.toMatchObject(conflict); + }); + + it("roundtrips maximum quote-heavy content and verification metadata", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const before = await allKnowledgeRows(f.store); + await expect( + f.createDraft( + "article/too-large", + "collection/workshop", + draft("explanation", '"'.repeat(knowledgeLimits.contentBytes + 1)), + ), + ).rejects.toMatchObject({ + name: "KnowledgeBaseError", + field: "content.text", + }); + expect(await allKnowledgeRows(f.store)).toEqual(before); + const body = '"'.repeat(knowledgeLimits.contentBytes); + let current = await f.createDraft( + "article/heavy", + "collection/workshop", + draft("explanation", body), + ); + expect(current.revision.content.text).toBe(body); + const proof = { + ...evidence(current.revision), + steps: Array.from({ length: knowledgeLimits.steps }, () => + '"'.repeat(knowledgeLimits.stepCharacters), + ), + }; + current = (await f.submitEvidence(current, undefined, proof)).current; + expect( + (await f.app.getEvidence(admin, { articleId: current.articleId })) + .evidence[0]?.steps, + ).toEqual(proof.steps); + await f.publish(current); + expect( + ( + await f.app.getPublishedArticle(customer, { + articleId: current.articleId, + }) + ).content.text, + ).toBe(body); + }, 30_000); + }); +} diff --git a/tsconfig.json b/tsconfig.json index 632a88f..08388be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "files": [], "references": [ { "path": "./packages/contracts" }, - { "path": "./packages/core" } + { "path": "./packages/core" }, + { "path": "./packages/application" } ] } diff --git a/tsconfig.test.json b/tsconfig.test.json index 857994d..ce8a7eb 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -10,6 +10,7 @@ "include": [ "packages/*/src/**/*.test.ts", "tests/**/*.test.ts", + "test/**/*.ts", "vitest.config.ts" ] } diff --git a/vitest.config.ts b/vitest.config.ts index a191fca..14ff423 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["packages/**/*.test.ts", "tests/**/*.test.ts"], exclude: ["**/dist/**", "**/node_modules/**"], + globalSetup: ["./test/azurite.ts"], }, }); From 6ed855b130f2300914eb09e36f368c63eb5eb74f Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Sat, 7 Nov 2026 00:00:23 -0500 Subject: [PATCH 2/2] Fix KB-02 review races, portal errors, and teardown --- docs/HOST_COMPOSITION.md | 12 + packages/application/README.md | 4 + packages/application/src/governance.ts | 42 +++- packages/application/src/reads.ts | 22 +- test/azurite.ts | 68 +++++- tests/application-review-regressions.test.ts | 232 +++++++++++++++++++ 6 files changed, 363 insertions(+), 17 deletions(-) create mode 100644 tests/application-review-regressions.test.ts diff --git a/docs/HOST_COMPOSITION.md b/docs/HOST_COMPOSITION.md index c53cfae..d6bf7f3 100644 --- a/docs/HOST_COMPOSITION.md +++ b/docs/HOST_COMPOSITION.md @@ -27,6 +27,12 @@ application. An access-context-shaped HTTP object from a customer is not an authenticated context. The host must not cache permission authority beyond its supported revocation/freshness boundary. +Each call snapshots its access context. Repeated permission checks use that +immutable authority while reloading current KB resources; they do not poll +the host's identity or policy system during an in-flight call. Resolve access +anew for each call/replay and bound operation duration and authority freshness +to the host's required revocation behavior. + API/MCP author credentials initially permit draft authoring and evidence submission. They do not acquire review/publication or collection-management authority by declaring a runner, reviewer, attester, or permission string. @@ -182,6 +188,12 @@ the appropriate current read. An old expected generation may identify an exact replay, while a new command must match current generation. A retained receipt cannot restore access after revocation. +A storage or transport failure can leave the caller uncertain whether the +transaction committed. Retry the same command ID and exact semantic input, +including its original expected generation, under freshly resolved access. +The committed receipt resolves an accepted command without duplicating its +effects; an unknown outcome is not a reason to issue a new command ID. + Resource generation, content revision, and opaque store version are distinct: the first is the application command fence, the second identifies immutable content, and the last participates in a backend CAS transaction. Persist the diff --git a/packages/application/README.md b/packages/application/README.md index 320e028..e5451bf 100644 --- a/packages/application/README.md +++ b/packages/application/README.md @@ -11,6 +11,10 @@ authentication, current-resource authorization, verified-evidence, and privacy boundaries. KB-03 retrieval, API/MCP, real-host acceptance, and production activation remain later tasks. +GitHub links in this unpublished README track development `main`; they are +not frozen version documentation. KB-05 release preparation must pin those +references to verified release source before first publication. + The application API owns authorized commands, application-generation CAS, bounded immutable revision/evidence history, exact review/publication, transactional Audit/receipts/causal jobs, and safe published-content DTOs. diff --git a/packages/application/src/governance.ts b/packages/application/src/governance.ts index d3da5d5..92f62a4 100644 --- a/packages/application/src/governance.ts +++ b/packages/application/src/governance.ts @@ -11,6 +11,7 @@ import { knowledgeLimits, previewCollectionPolicy, validateValidationPolicy, + type CollectionPolicyPreview, type ReviewContext, } from "@pegma/knowledge-base-core"; @@ -106,6 +107,37 @@ function anonymousUse(policy: CollectionPolicy): boolean { ); } +function validatePreviewShape(value: CollectionPolicyPreview): void { + const preview = dataInput(value, [ + "collectionId", + "expectedRevision", + "policy", + "policyHash", + ]); + if ( + ["collectionId", "expectedRevision", "policy", "policyHash"].some( + (field) => !Object.hasOwn(preview, field), + ) + ) { + throw new TypeError("Policy preview is missing required fields"); + } + const policy = dataInput(preview.policy, ["version", "portal", "bot"]); + if ( + ["version", "portal", "bot"].some((field) => !Object.hasOwn(policy, field)) + ) { + throw new TypeError("Collection policy is missing required fields"); + } + for (const proposed of [policy.portal, policy.bot]) { + const use = dataInput(proposed, ["enabled", "audience"]); + if (typeof use.enabled !== "boolean") { + throw new TypeError( + "Collection use requires an explicit enabled boolean", + ); + } + if (use.enabled) dataInput(use.audience, ["kind", "permission"]); + } +} + function validateConfiguration(value: GovernanceConfiguration): void { const fields = [ "validationPolicy", @@ -176,10 +208,15 @@ export async function loadGovernanceContext( throw new KnowledgeBasePrerequisiteError("current_validation_policy"); } validateValidationPolicy(validation.value.policy); - const current = await repository.readCollectionVersioned(collectionId); + const [current, currentValidation] = await Promise.all([ + repository.readCollectionVersioned(collectionId), + repository.readValidationPolicyVersioned(configuration.validationPolicy.id), + ]); if ( current === null || - current.value.generation !== collection.value.generation + current.value.generation !== collection.value.generation || + currentValidation === null || + currentValidation.value.generation !== validation.value.generation ) { throw new RepositoryConflictError(); } @@ -294,6 +331,7 @@ export function createGovernanceServices( ) { throw new TypeError("approvePublic must be an explicit boolean"); } + validatePreviewShape(input.preview); const requiresPublicApproval = anonymousUse(input.preview.policy); const recheck = async () => { requirePermission(access, knowledgePermissions.collectionManage); diff --git a/packages/application/src/reads.ts b/packages/application/src/reads.ts index 74c42eb..4822475 100644 --- a/packages/application/src/reads.ts +++ b/packages/application/src/reads.ts @@ -23,6 +23,7 @@ import type { StoredArticle } from "./records.js"; import type { KnowledgeRepository } from "./repository.js"; import { canonicalJson, + RepositoryCapacityError, RepositoryConflictError, RepositoryIntegrityError, requireIdentifier, @@ -337,17 +338,17 @@ export function createReadServices( const unavailable = () => new KnowledgeBaseNotFoundError("article"); if (!hasPermission(access, knowledgePermissions.articleRead)) throw unavailable(); - const current = await requiredArticle(repository, input.articleId); - const publication = current.article.published; - const review = current.publicationReview; - if ( - current.article.state === "retired" || - current.publicationHeld || - publication === undefined || - review === undefined - ) - throw unavailable(); try { + const current = await requiredArticle(repository, input.articleId); + const publication = current.article.published; + const review = current.publicationReview; + if ( + current.article.state === "retired" || + current.publicationHeld || + publication === undefined || + review === undefined + ) + throw unavailable(); const at = clockTime(options); const governance = await loadGovernanceContext( repository, @@ -487,6 +488,7 @@ export function createReadServices( error instanceof KnowledgeBaseError || error instanceof KnowledgeBaseNotFoundError || error instanceof KnowledgeBasePrerequisiteError || + error instanceof RepositoryCapacityError || error instanceof RepositoryConflictError || error instanceof RepositoryIntegrityError ) diff --git a/test/azurite.ts b/test/azurite.ts index b4736db..4cc0d52 100644 --- a/test/azurite.ts +++ b/test/azurite.ts @@ -38,6 +38,59 @@ async function removeWorkspace(): Promise { workspace = undefined; } +function signalAndAwaitExit( + running: ChildProcess, + signal: NodeJS.Signals, + milliseconds: number, +): Promise { + if ( + running.pid === undefined || + running.exitCode !== null || + running.signalCode !== null + ) + return Promise.resolve(true); + return new Promise((resolveExit, rejectExit) => { + const cleanup = () => { + clearTimeout(timeout); + running.off("exit", exited); + running.off("error", failed); + }; + const exited = () => { + cleanup(); + resolveExit(true); + }; + const failed = (error: Error) => { + cleanup(); + rejectExit(error); + }; + const timeout = setTimeout(() => { + cleanup(); + resolveExit(false); + }, milliseconds); + running.once("exit", exited); + running.once("error", failed); + try { + running.kill(signal); + } catch (error) { + cleanup(); + rejectExit(error); + } + }); +} + +async function stopChild(): Promise { + const running = child; + if (running === undefined) return; + if ( + !(await signalAndAwaitExit(running, "SIGTERM", 2_000)) && + !(await signalAndAwaitExit(running, "SIGKILL", 2_000)) + ) + throw new Error( + "Azurite did not exit after bounded termination; its workspace was retained.", + ); + child = undefined; +} + export async function setup(): Promise { const entry = join( process.cwd(), @@ -85,15 +138,20 @@ export async function setup(): Promise { } throw new Error(`Azurite did not start on test port ${TABLE_PORT}.`); } catch (error) { - child.kill(); - child = undefined; - await removeWorkspace(); + try { + await stopChild(); + await removeWorkspace(); + } catch (cleanupError) { + throw new AggregateError( + [error, cleanupError], + "Azurite startup failed and cleanup did not complete.", + ); + } throw error; } } export async function teardown(): Promise { - child?.kill(); - child = undefined; + await stopChild(); await removeWorkspace(); } diff --git a/tests/application-review-regressions.test.ts b/tests/application-review-regressions.test.ts new file mode 100644 index 0000000..c6e7adc --- /dev/null +++ b/tests/application-review-regressions.test.ts @@ -0,0 +1,232 @@ +import { + createKnowledgeBaseApplication, + type UpdateCollectionPolicyInput, +} from "@pegma/knowledge-base-application"; +import { knowledgePermissions } from "@pegma/knowledge-base-contracts"; +import { describe, expect, it } from "vitest"; +import { + access, + admin, + applicationFixture, + at, + author, + customer, + draft, + validationPolicy, +} from "../test/application-fixtures.js"; +import { + allKnowledgeRows, + storeFactories, +} from "../test/application-stores.js"; +import { barrier, traceStore } from "../test/trace-store.js"; + +for (const [name, createStore] of storeFactories) { + describe(`KB application review regressions (${name})`, () => { + it("denies collection, validation, governance and review metadata reads without their staff permissions", async () => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const current = (await f.submitEvidence(await f.createDraft())).current; + await f.review(current); + const reader = access(customer.principalId, [ + knowledgePermissions.articleRead, + ]); + const reads = [ + [ + () => + f.app.getCollection(reader, { + collectionId: "collection/workshop", + }), + knowledgePermissions.collectionRead, + ], + [ + () => + f.app.getValidationPolicy(reader, { + policyId: validationPolicy.id, + }), + knowledgePermissions.validationManage, + ], + [ + () => + f.app.getGovernanceConfiguration(reader, { + collectionId: "collection/workshop", + }), + knowledgePermissions.validationManage, + ], + [ + () => f.app.getReview(reader, { articleId: current.articleId }), + knowledgePermissions.review, + ], + ] as const; + const before = await allKnowledgeRows(f.store); + for (const [read, permission] of reads) + await expect(read()).rejects.toMatchObject({ + name: "KnowledgeBaseAuthorizationError", + permission, + }); + expect(await allKnowledgeRows(f.store)).toEqual(before); + }); + + it.each(["article", "governance"] as const)( + "maps a stored %s partition exceeding the reader capacity to generic article unavailability", + async (path) => { + const store = createStore(); + const f = applicationFixture(store); + await f.setupCollection(); + if (path === "governance") { + for (let ordinal = 0; ordinal < 3; ordinal += 1) { + const configuration = await f.app.getGovernanceConfiguration( + admin, + { + collectionId: "collection/workshop", + }, + ); + await f.app.putGovernanceConfiguration(admin, { + ...f.command("grow-governance-history", configuration.generation), + collectionId: configuration.collectionId, + configuration: configuration.configuration, + }); + } + } + await f.publishedArticle(); + const before = await allKnowledgeRows(store); + const articleRows = before.filter( + (row) => row.resourceKind === "article", + ).length; + const collectionRows = before.filter( + (row) => row.resourceKind === "collection", + ).length; + if (path === "governance") + expect(collectionRows).toBeGreaterThan(articleRows); + const reader = createKnowledgeBaseApplication({ + store, + clock: { now: () => at(10_000) }, + limits: { + maxPhysicalRows: articleRows - (path === "article" ? 1 : 0), + controlReserveRows: 0, + }, + }); + await expect( + reader.getPublishedArticle(customer, { articleId: "article/export" }), + ).rejects.toMatchObject({ + name: "KnowledgeBaseNotFoundError", + resource: "article", + }); + expect(await allKnowledgeRows(store)).toEqual(before); + }, + ); + + it.each([ + "missing policy", + "missing uses", + "missing bot", + "null portal", + "missing enabled audience", + "null enabled audience", + ] as const)( + "deliberately rejects a malformed policy preview: %s", + async (defect) => { + const f = applicationFixture(createStore()); + await f.setupCollection(); + const proposed = await f.app.previewCollectionPolicy(admin, { + collectionId: "collection/workshop", + uses: { + portal: { + enabled: true, + audience: { kind: "permission", permission: "workshop.customer" }, + }, + bot: { enabled: false }, + }, + }); + const { policy, ...outer } = proposed.preview; + const malformed = { + "missing policy": outer, + "missing uses": { ...outer, policy: { version: policy.version } }, + "missing bot": { + ...outer, + policy: { version: policy.version, portal: policy.portal }, + }, + "null portal": { ...outer, policy: { ...policy, portal: null } }, + "missing enabled audience": { + ...outer, + policy: { ...policy, portal: { enabled: true } }, + }, + "null enabled audience": { + ...outer, + policy: { ...policy, portal: { enabled: true, audience: null } }, + }, + }; + const before = await allKnowledgeRows(f.store); + // Exercise the host's runtime JSON boundary beyond static TypeScript checks. + const input = { + ...f.command("malformed-preview", proposed.generation), + collectionId: "collection/workshop", + preview: malformed[defect], + } as UpdateCollectionPolicyInput; + await expect( + f.app.updateCollectionPolicy(admin, input), + ).rejects.toMatchObject({ + name: "TypeError", + message: expect.not.stringMatching(/Cannot (?:read|convert)/u), + }); + expect(await allKnowledgeRows(f.store)).toEqual(before); + }, + ); + + it("rejects validation policy generation changed while governance was loading", async () => { + const backing = createStore(); + const administrator = applicationFixture(backing); + await administrator.setupCollection(); + const traced = traceStore(backing); + const delayed = applicationFixture(traced.store); + const gate = barrier(); + let paused = false; + traced.beforeGet(async ({ key }) => { + if ( + !paused && + key.partition.startsWith("validation:") && + key.id === "policy:1" + ) { + paused = true; + await gate.wait(); + } + }); + const pending = delayed.app + .createDraft(author, { + ...delayed.command("governance-race", 0), + articleId: "article/governance-race", + collectionId: "collection/workshop", + draft: draft(), + }) + .then( + (value) => ({ value }), + (error: unknown) => ({ error }), + ); + let committedRows; + try { + await Promise.race([ + gate.reached, + pending.then(() => { + throw new Error("Draft did not reach its validation read barrier"); + }), + ]); + const current = await administrator.app.getValidationPolicy(admin, { + policyId: validationPolicy.id, + }); + await administrator.app.putValidationPolicy(admin, { + ...administrator.command("concurrent-policy", current.generation), + policy: { ...validationPolicy, version: 2 }, + }); + committedRows = await allKnowledgeRows(backing); + } finally { + gate.release(); + } + const settled = await pending; + traced.beforeGet(undefined); + expect(settled).toMatchObject({ + error: { name: "RepositoryConflictError" }, + }); + expect(await allKnowledgeRows(backing)).toEqual(committedRows); + expect(traced.transactions).toHaveLength(0); + }, 30_000); + }); +}