@magicvr/schema-ui-protocol 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7654 -0
- package/lib/fetch-timeout.d.ts +13 -0
- package/package.json +23 -0
- package/protocol/app-manifest.d.ts +117 -0
- package/protocol/conformance/actions-outcome.d.ts +4 -0
- package/protocol/conformance/component-format.d.ts +13 -0
- package/protocol/conformance/query-serialize.d.ts +24 -0
- package/protocol/conformance/request-construction.d.ts +42 -0
- package/protocol/conformance/request-lifecycle.d.ts +27 -0
- package/protocol/conformance/response-mapping.d.ts +4 -0
- package/protocol/conformance/runtime-defaults.d.ts +5 -0
- package/protocol/conformance/runtime-schema-validate.d.ts +23 -0
- package/protocol/conformance/schema-validate.d.ts +16 -0
- package/protocol/conformance/search-table.d.ts +14 -0
- package/protocol/conformance/static-data.d.ts +27 -0
- package/protocol/conformance/table-sort.d.ts +4 -0
- package/protocol/conformance/upload-orchestration.d.ts +102 -0
- package/protocol/conformance/version-negotiate.d.ts +4 -0
- package/protocol/conformance-claim.json +81 -0
- package/protocol/conformance-claim.json.sha256 +1 -0
- package/protocol/conformance-local-report.json +60 -0
- package/protocol/index.d.ts +8 -0
- package/protocol/load-page.d.ts +45 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime page-schema loader for the schema-driven render path (R1 · GOAL-002).
|
|
3
|
+
*
|
|
4
|
+
* Resolves a manifest `PageEntry`'s schemaUrl (with route-parameter expansion),
|
|
5
|
+
* fetches the page document, forces structural validation (D-VAL) against the
|
|
6
|
+
* pinned page/node schemas, and returns the parsed document or throws a unified
|
|
7
|
+
* `PageSchemaError`. The fetcher is injectable so tests exercise network,
|
|
8
|
+
* parse, and validation failure paths without a server. This module does NOT
|
|
9
|
+
* switch the app's default render branch (that is GOAL-003).
|
|
10
|
+
*/
|
|
11
|
+
import type { PageEntry } from "@/protocol/app-manifest";
|
|
12
|
+
export type PageSchemaErrorCode = "PAGE_LOAD_FAILED" | "PAGE_NOT_FOUND" | "PAGE_PARSE_FAILED" | "PAGE_SCHEMA_INVALID" | "PAGE_ID_MISMATCH";
|
|
13
|
+
export interface PageSchemaValidationIssue {
|
|
14
|
+
path: string;
|
|
15
|
+
message: string;
|
|
16
|
+
keyword?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Unified, observable error for the schema loading + validation pipeline. */
|
|
19
|
+
export declare class PageSchemaError extends Error {
|
|
20
|
+
readonly code: PageSchemaErrorCode;
|
|
21
|
+
readonly url: string;
|
|
22
|
+
readonly issues?: PageSchemaValidationIssue[];
|
|
23
|
+
constructor(code: PageSchemaErrorCode, url: string, message: string, issues?: PageSchemaValidationIssue[]);
|
|
24
|
+
}
|
|
25
|
+
export interface LoadPageOptions {
|
|
26
|
+
/** Origin/base used to resolve relative schemaUrl values. Defaults to `location.origin`. */
|
|
27
|
+
baseURL?: string;
|
|
28
|
+
/** Injectable fetch; defaults to `globalThis.fetch`. */
|
|
29
|
+
fetcher?: typeof fetch;
|
|
30
|
+
/**
|
|
31
|
+
* Optional in-memory document cache keyed by resolved schemaUrl (owned by
|
|
32
|
+
* the App shell). A hit skips the network fetch AND the D-VAL structural
|
|
33
|
+
* validation (the stored document was already validated at load time, and
|
|
34
|
+
* its meta.pageId was verified against the manifest page). Intentionally
|
|
35
|
+
* opt-in: tests and callers that must observe every load pass none.
|
|
36
|
+
*/
|
|
37
|
+
cache?: Map<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Load and validate a page document for the given manifest page and route
|
|
41
|
+
* params. Resolves the schemaUrl (expanding `{param}` placeholders), fetches
|
|
42
|
+
* it, enforces structural validation, and verifies the document's `meta.pageId`
|
|
43
|
+
* matches the manifest page. Returns the parsed page document on success.
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadPageDocument(page: PageEntry, params: Record<string, string>, options?: LoadPageOptions): Promise<unknown>;
|