@haddowg/json-api-client 1.30.0 → 1.31.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/dist/ajv.cjs +1 -1
- package/dist/ajv.d.cts +1 -1
- package/dist/ajv.d.mts +1 -1
- package/dist/ajv.mjs +1 -1
- package/dist/index.cjs +156 -19
- package/dist/index.d.cts +91 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +91 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +153 -20
- package/dist/index.mjs.map +1 -1
- package/dist/{validate-B2Dtn9dI.cjs → validate-B9cyfO3p.cjs} +20 -4
- package/dist/{validate-CtXB1MGk.mjs → validate-BuPAPJMi.mjs} +16 -6
- package/dist/validate-BuPAPJMi.mjs.map +1 -0
- package/dist/{validate-ugcQVpb0.d.mts → validate-CCLqE_2J.d.cts} +208 -30
- package/dist/validate-CCLqE_2J.d.cts.map +1 -0
- package/dist/{validate-ugcQVpb0.d.cts → validate-CCLqE_2J.d.mts} +208 -30
- package/dist/validate-CCLqE_2J.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/validate-CtXB1MGk.mjs.map +0 -1
- package/dist/validate-ugcQVpb0.d.cts.map +0 -1
- package/dist/validate-ugcQVpb0.d.mts.map +0 -1
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
//#region src/error-shared.ts
|
|
2
|
+
/** An error object's first non-empty `detail` or `title`, then its `code` when `withCode` is set. */
|
|
3
|
+
function errorText(error, withCode = false) {
|
|
4
|
+
return [
|
|
5
|
+
error?.detail,
|
|
6
|
+
error?.title,
|
|
7
|
+
withCode ? error?.code : void 0
|
|
8
|
+
].find((s) => s !== void 0 && s !== "");
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
1
11
|
//#region src/errors.ts
|
|
2
12
|
/**
|
|
3
13
|
* Thrown by the always-on light structural guards when a parsed response is not a
|
|
@@ -14,14 +24,14 @@ var StructuralGuardError = class extends Error {
|
|
|
14
24
|
};
|
|
15
25
|
/**
|
|
16
26
|
* The default {@link JsonApiError} message: the generic status line, then the first error object's
|
|
17
|
-
* `
|
|
18
|
-
* objects.
|
|
27
|
+
* `detail` (else its `title`) when it has one, then `" (and N more)"` for the further error
|
|
28
|
+
* objects.
|
|
19
29
|
*/
|
|
20
30
|
function describeErrors(status, errors) {
|
|
21
31
|
let message = `JSON:API request failed with status ${status}`;
|
|
22
32
|
const first = errors[0];
|
|
23
|
-
const words = first
|
|
24
|
-
if (
|
|
33
|
+
const words = errorText(first);
|
|
34
|
+
if (words !== void 0) message += `: ${words}`;
|
|
25
35
|
if (errors.length > 1) message += ` (and ${errors.length - 1} more)`;
|
|
26
36
|
return message;
|
|
27
37
|
}
|
|
@@ -444,6 +454,12 @@ Object.defineProperty(exports, "assertJsonApiDocument", {
|
|
|
444
454
|
return assertJsonApiDocument;
|
|
445
455
|
}
|
|
446
456
|
});
|
|
457
|
+
Object.defineProperty(exports, "errorText", {
|
|
458
|
+
enumerable: true,
|
|
459
|
+
get: function() {
|
|
460
|
+
return errorText;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
447
463
|
Object.defineProperty(exports, "fieldsOfUrl", {
|
|
448
464
|
enumerable: true,
|
|
449
465
|
get: function() {
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
//#region src/error-shared.ts
|
|
2
|
+
/** An error object's first non-empty `detail` or `title`, then its `code` when `withCode` is set. */
|
|
3
|
+
function errorText(error, withCode = false) {
|
|
4
|
+
return [
|
|
5
|
+
error?.detail,
|
|
6
|
+
error?.title,
|
|
7
|
+
withCode ? error?.code : void 0
|
|
8
|
+
].find((s) => s !== void 0 && s !== "");
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
1
11
|
//#region src/errors.ts
|
|
2
12
|
/**
|
|
3
13
|
* Thrown by the always-on light structural guards when a parsed response is not a
|
|
@@ -14,14 +24,14 @@ var StructuralGuardError = class extends Error {
|
|
|
14
24
|
};
|
|
15
25
|
/**
|
|
16
26
|
* The default {@link JsonApiError} message: the generic status line, then the first error object's
|
|
17
|
-
* `
|
|
18
|
-
* objects.
|
|
27
|
+
* `detail` (else its `title`) when it has one, then `" (and N more)"` for the further error
|
|
28
|
+
* objects.
|
|
19
29
|
*/
|
|
20
30
|
function describeErrors(status, errors) {
|
|
21
31
|
let message = `JSON:API request failed with status ${status}`;
|
|
22
32
|
const first = errors[0];
|
|
23
|
-
const words = first
|
|
24
|
-
if (
|
|
33
|
+
const words = errorText(first);
|
|
34
|
+
if (words !== void 0) message += `: ${words}`;
|
|
25
35
|
if (errors.length > 1) message += ` (and ${errors.length - 1} more)`;
|
|
26
36
|
return message;
|
|
27
37
|
}
|
|
@@ -426,6 +436,6 @@ function validateResourceMember(member, validator, fields) {
|
|
|
426
436
|
}
|
|
427
437
|
}
|
|
428
438
|
//#endregion
|
|
429
|
-
export { validateDocument as a, JsonApiError as c, hasErrorCode as d, sparseSchemas as i, StructuralGuardError as l, resolveValidator as n, fieldsOfUrl as o, sparseSchema as r, nestedFieldset as s, assertJsonApiDocument as t, findError as u };
|
|
439
|
+
export { validateDocument as a, JsonApiError as c, hasErrorCode as d, errorText as f, sparseSchemas as i, StructuralGuardError as l, resolveValidator as n, fieldsOfUrl as o, sparseSchema as r, nestedFieldset as s, assertJsonApiDocument as t, findError as u };
|
|
430
440
|
|
|
431
|
-
//# sourceMappingURL=validate-
|
|
441
|
+
//# sourceMappingURL=validate-BuPAPJMi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-BuPAPJMi.mjs","names":[],"sources":["../src/error-shared.ts","../src/errors.ts","../src/nested-fieldset.ts","../src/validate.ts"],"sourcesContent":["import type { JsonApiError, JsonApiErrorObject } from './errors'\n\n/** The {@link JsonApiError} members of `E`, read without distributing over a union such as a query's error. */\nexport type JsonApiErrorOf<E> = Extract<NonNullable<E>, JsonApiError<string>>\n\n/** The codes `E`'s {@link JsonApiError} carries, else `Fallback`. */\nexport type CodesOf<E, Fallback extends string = string> = [JsonApiErrorOf<E>] extends [never]\n ? Fallback\n : JsonApiErrorOf<E> extends JsonApiError<infer C>\n ? C\n : Fallback\n\n/** An error object's first non-empty `detail` or `title`, then its `code` when `withCode` is set. */\nexport function errorText(\n error: JsonApiErrorObject | undefined,\n withCode = false,\n): string | undefined {\n return [error?.detail, error?.title, withCode ? error?.code : undefined].find(\n (s) => s !== undefined && s !== '',\n )\n}\n","import { type CodesOf, errorText, type JsonApiErrorOf } from './error-shared'\n\n/**\n * A single JSON:API error object (spec: error objects).\n *\n * `C` is the server's documented error-code union (a generated client's `ErrorCode`). `code` is\n * typed `C | (string & {})`: editors suggest the documented codes, yet any other string still\n * fits, because the catalogue is open and a server may send a code it never documented.\n */\nexport interface JsonApiErrorObject<C extends string = string> {\n id?: string\n status?: string\n code?: C | (string & {})\n title?: string\n detail?: string\n source?: { pointer?: string; parameter?: string; header?: string }\n meta?: Record<string, unknown>\n /**\n * The user-facing input path, remapped from `source.pointer` for write errors\n * (e.g. `/data/attributes/title` -> `title`). Populated by the runtime, which\n * built the envelope and therefore knows the inverse mapping. See docs/errors.md.\n */\n path?: string\n /**\n * The zero-based index of the failing operation within an atomic batch, parsed from a\n * `source.pointer` carrying an `/atomic:operations/{n}` prefix. Populated only for atomic\n * errors; `path` then holds the flat path within that operation's input.\n */\n opIndex?: number\n}\n\n/**\n * Thrown by the always-on light structural guards when a parsed response is not a\n * JSON:API document, or a `data`/`included` member is not a resource object carrying `type`+`id`.\n * Distinct from {@link JsonApiError} (a non-2xx server response): this signals the wire shape the\n * runtime relies on was violated, not an application error the server reported. The opt-in\n * per-field validator throws its engine's own error type, never this one.\n */\nexport class StructuralGuardError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'StructuralGuardError'\n }\n}\n\n/**\n * The default {@link JsonApiError} message: the generic status line, then the first error object's\n * `detail` (else its `title`) when it has one, then `\" (and N more)\"` for the further error\n * objects.\n */\nfunction describeErrors(status: number, errors: readonly JsonApiErrorObject[]): string {\n let message = `JSON:API request failed with status ${status}`\n const first = errors[0]\n const words = errorText(first)\n if (words !== undefined) {\n message += `: ${words}`\n }\n if (errors.length > 1) {\n message += ` (and ${errors.length - 1} more)`\n }\n return message\n}\n\n/**\n * Thrown for any non-2xx JSON:API response. Carries the parsed error document plus\n * expressive status matchers and pointer-grouping helpers.\n *\n * `C` types each error object's `code` (see {@link JsonApiErrorObject}). It is a compile-time\n * hint only: the runtime never checks a code against it.\n */\nexport class JsonApiError<C extends string = string> extends Error {\n readonly status: number\n readonly errors: JsonApiErrorObject<C>[]\n\n constructor(status: number, errors: JsonApiErrorObject<C>[], message?: string) {\n super(message ?? describeErrors(status, errors))\n this.name = 'JsonApiError'\n this.status = status\n this.errors = errors\n }\n\n hasStatus(status: number): boolean {\n return this.status === status\n }\n\n is4xx(): boolean {\n return this.status >= 400 && this.status < 500\n }\n\n is5xx(): boolean {\n return this.status >= 500 && this.status < 600\n }\n\n isBadRequest(): boolean {\n return this.status === 400\n }\n\n isUnauthorized(): boolean {\n return this.status === 401\n }\n\n isForbidden(): boolean {\n return this.status === 403\n }\n\n isNotFound(): boolean {\n return this.status === 404\n }\n\n isNotAcceptable(): boolean {\n return this.status === 406\n }\n\n isConflict(): boolean {\n return this.status === 409\n }\n\n isUnsupportedMediaType(): boolean {\n return this.status === 415\n }\n\n isUnprocessable(): boolean {\n return this.status === 422\n }\n\n /** Alias of {@link isUnprocessable} — the JSON:API validation status. */\n isValidationError(): boolean {\n return this.status === 422\n }\n\n isRateLimited(): boolean {\n return this.status === 429\n }\n\n /**\n * Group errors by user-facing input path (falls back to the raw pointer, then the\n * query parameter). The payoff for form/validation UX — 422 `source.pointer`s are\n * remapped to the flat shape the caller actually supplied.\n */\n byPath(): Record<string, JsonApiErrorObject<C>[]> {\n const out: Record<string, JsonApiErrorObject<C>[]> = {}\n for (const e of this.errors) {\n const key = e.path ?? e.source?.pointer ?? e.source?.parameter ?? '_'\n ;(out[key] ??= []).push(e)\n }\n return out\n }\n}\n\n/**\n * True when `err` is a {@link JsonApiError} and any of its error objects carries `code`. Takes\n * any string, so it also matches codes the server never documented. A generated client exports a\n * `hasErrorCode` bound to its server's `ErrorCode` union, which rejects a misspelt code at\n * compile time; reach for this one only to match an undocumented code.\n */\nexport function hasErrorCode(err: unknown, code: string): err is JsonApiError {\n return err instanceof JsonApiError && err.errors.some((e) => e.code === code)\n}\n\n/**\n * The codes `hasErrorCode` and `findError` take for an error typed `E`: the codes of the\n * {@link JsonApiError} it holds, such as a query's `error` typed by the operation that raised it,\n * else `C`, every code the server documents.\n */\nexport type ErrorCodesFor<E, C extends string> = string extends CodesOf<E, C> ? C : CodesOf<E, C>\n\n/**\n * {@link hasErrorCode} restricted to one server's documented codes, or to the codes `err`'s type\n * carries. A generated client binds it:\n * `export const hasErrorCode = hasErrorCodeRuntime as ErrorCodeGuard<ErrorCode>`. The cast is\n * needed because `JsonApiError<string>` doesn't assign to `JsonApiError<ErrorCode>`.\n */\nexport type ErrorCodeGuard<C extends string> = <E>(\n err: E,\n code: ErrorCodesFor<E, C>,\n) => err is E & GuardedError<E, ErrorCodesFor<E, C>>\n\n/** What a matched guard narrows `E` to: its {@link JsonApiError} members, or one carrying `K`. */\ntype GuardedError<E, K extends string> = [JsonApiErrorOf<E>] extends [never]\n ? JsonApiError<K>\n : JsonApiErrorOf<E>\n\n/**\n * An error object carrying the documented code `K`, its `meta` typed when the server declares\n * one for the code. `M` is a generated client's `ErrorMetaByCode`; a code it does not list\n * keeps the untyped `meta`.\n */\nexport type CodedErrorObject<K extends string, M = {}> = JsonApiErrorObject<K> & {\n code: K\n} & (K extends keyof M ? { meta: M[K] } : {})\n\n/**\n * The first error object in `err` carrying `code`, or `undefined` when `err` is not a\n * {@link JsonApiError} or none of its errors carries it. Takes any string; a generated client\n * exports a `findError` bound to its documented codes and their `meta`, which types the result.\n */\nexport function findError(err: unknown, code: string): JsonApiErrorObject | undefined {\n return err instanceof JsonApiError ? err.errors.find((e) => e.code === code) : undefined\n}\n\n/**\n * {@link findError} restricted to one server's documented codes and their declared `meta`, or to\n * the codes `err`'s type carries. A generated client binds it:\n * `export const findError = findErrorRuntime as ErrorFinder<ErrorCode, ErrorMetaByCode>`.\n */\nexport type ErrorFinder<C extends string, M = {}> = <E, K extends ErrorCodesFor<E, C>>(\n err: E,\n code: K,\n) => CodedErrorObject<K, M> | undefined\n","/**\n * The keys a sparse fieldset selected of each attribute it narrowed, under the Nested Fieldsets\n * profile (https://haddowg.github.io/json-api/profiles/nested-fieldsets/): attribute name -> the\n * paths `fields[type]=<attribute>.<path>` named, in request order, each once. A path into a nested\n * object, such as `geo.lat`, names one key per level, and a path through a list names its items\n * `*`, such as `*.sku`. An attribute the fieldset also lists whole\n * is left out, and so is a path whose key the fieldset also lists whole, since the server renders\n * those whole. A path ending in `*` names the list itself, so `lines.*` lists `lines` whole and\n * `shipping.parcels.*` selects `parcels` whole. Empty when nothing was narrowed.\n */\nexport type NestedFieldset = Readonly<Record<string, readonly string[]>>\n\nconst NONE: NestedFieldset = Object.freeze({})\n\n/**\n * The {@link NestedFieldset} of one type's `fields[type]` members. The path is everything after the\n * first full stop, as the server reads it, and a member with an empty key at any level selects\n * nothing.\n */\nexport function nestedFieldset(listed: readonly string[] | undefined): NestedFieldset {\n if (listed === undefined) {\n return NONE\n }\n const members = listed.map(listItself)\n const whole = new Set(members.filter((member) => !member.includes('.')))\n const out: Record<string, string[]> = {}\n for (const member of members) {\n const dot = member.indexOf('.')\n if (dot <= 0) {\n continue\n }\n const attribute = member.slice(0, dot)\n if (whole.has(attribute)) {\n continue\n }\n const path = member.slice(dot + 1)\n if (path.split('.').includes('')) {\n continue\n }\n const paths = (out[attribute] ??= [])\n if (!paths.includes(path)) {\n paths.push(path)\n }\n }\n for (const [attribute, paths] of Object.entries(out)) {\n out[attribute] = paths.filter(\n (path) => !paths.some((other) => other !== path && path.startsWith(`${other}.`)),\n )\n }\n return Object.keys(out).length === 0 ? NONE : out\n}\n\n/** A member ending in `.*` with the wildcard dropped, since it names the list itself. */\nfunction listItself(member: string): string {\n let out = member\n while (out.endsWith('.*')) {\n out = out.slice(0, -2)\n }\n return out\n}\n\n/**\n * The `fields[type]` members a request URL carries, by type, for a link the client follows as\n * given, such as a `next` page, whose query it didn't build.\n */\nexport function fieldsOfUrl(url: string): Record<string, string[]> | undefined {\n let params: URLSearchParams\n try {\n params = new URL(url, 'http://link.invalid').searchParams\n } catch {\n return undefined\n }\n let out: Record<string, string[]> | undefined\n params.forEach((value, name) => {\n const type = /^fields\\[(.+)\\]$/.exec(name)?.[1]\n if (type !== undefined) {\n ;(out ??= {})[type] = value === '' ? [] : value.split(',')\n }\n })\n return out\n}\n","import { StructuralGuardError } from './errors'\nimport { nestedFieldset } from './nested-fieldset'\nimport type { Document } from './request'\n\n/**\n * A wire resource as it appears in a document's `data`/`included` — a JSON:API resource\n * object (or bare identifier). The structural guards assert `type` (and, where required,\n * `id`); the opt-in validator sees the whole object to check the rest against its schema.\n */\nexport interface WireResource {\n type: string\n id?: string\n [key: string]: unknown\n}\n\n/**\n * What the request a resource answered tells a validator. `fields` is the sparse fieldset the\n * request sent for the resource's type, `fields[type]`, absent when it sent none.\n */\nexport interface ValidationContext {\n readonly fields?: readonly string[]\n}\n\n/**\n * The opt-in per-resource validator: validate one wire `resource` against its JSON `schema`\n * (the bundle's per-type resource-object schema). The engine is the user's — throw (or\n * aggregate-then-throw) on an invalid resource; return for a valid one. With the bare-function\n * seam form there is no per-type schema, so `schema` is `undefined` and the function owns the\n * whole decision. With the schema-driven form, `schema` is already relaxed for the request's\n * sparse fieldset (see {@link sparseSchema}). `context` carries that fieldset either way, so a\n * bare validator can relax its own schema.\n */\nexport type Validator = (\n resource: WireResource,\n schema: unknown,\n context?: ValidationContext,\n) => void\n\n/** A per-type JSON Schema map (the codegen-emitted `schemas` constant), keyed by JSON:API type. */\nexport type SchemaMap = Readonly<Record<string, unknown>>\n\n/**\n * The schema-driven validation seam: a per-type `schemas` map plus a `validator` engine. Each\n * wire resource is validated against `schemas[resource.type]`; a type with no schema is skipped.\n */\nexport interface ValidationConfig {\n schemas: SchemaMap\n validator: Validator\n}\n\n/**\n * The `validate?` option on {@link ClientOptions}: either the schema-driven {@link ValidationConfig}\n * (the common case — the codegen-emitted `schemas` map + an engine adapter) or a bare\n * {@link Validator} that owns schema lookup itself (it is called per resource with `schema` =\n * `undefined`). Absent => no per-field validation (zero overhead, no engine dependency).\n */\nexport type ValidationOption = ValidationConfig | Validator\n\n/**\n * A normalised validator: resolve a resource's schema (or `undefined`) and validate it. `fields`\n * is the request's sparse fieldset for the resource's type, when it sent one.\n */\nexport interface ResolvedValidator {\n validate(resource: WireResource, fields?: readonly string[]): void\n}\n\n/** Whether a `validate` option is the schema-driven config (vs a bare validator function). */\nfunction isConfig(option: ValidationOption): option is ValidationConfig {\n return typeof option === 'object' && option !== null && !Array.isArray(option)\n}\n\n/**\n * Normalise the `validate?` option to a single per-resource validator. The config form looks the\n * schema up by `resource.type` and skips a type with no schema (the seam stays graceful for a\n * partially-covered bundle); the bare-function form calls the validator with `schema = undefined`,\n * delegating the whole decision to the caller. Returns `undefined` when validation is off.\n */\nexport function resolveValidator(\n option: ValidationOption | undefined,\n): ResolvedValidator | undefined {\n if (option === undefined) {\n return undefined\n }\n if (isConfig(option)) {\n const { schemas, validator } = option\n const sparse = sparseSchemas()\n return {\n validate(resource, fields) {\n const schema = schemas[resource.type]\n // A type the bundle does not cover is skipped, not failed — partial coverage is allowed.\n if (schema === undefined) {\n return\n }\n if (fields === undefined) {\n validator(resource, schema)\n } else {\n validator(resource, sparse(schema, fields), { fields })\n }\n },\n }\n }\n return {\n validate(resource, fields) {\n if (fields === undefined) {\n option(resource, undefined)\n } else {\n option(resource, undefined, { fields })\n }\n },\n }\n}\n\n/**\n * A cache of {@link sparseSchema} results, by schema and fieldset, so each pair is relaxed once.\n * A schema with no fieldset comes back as it is.\n */\nexport function sparseSchemas(): (\n schema: unknown,\n fields: readonly string[] | undefined,\n) => unknown {\n const cache = new WeakMap<object, Map<string, unknown>>()\n return (schema, fields) => {\n if (fields === undefined || !isObject(schema)) {\n return schema\n }\n let bySet = cache.get(schema)\n if (bySet === undefined) {\n bySet = new Map()\n cache.set(schema, bySet)\n }\n const key = fields.join(',')\n if (!bySet.has(key)) {\n bySet.set(key, sparseSchema(schema, fields))\n }\n return bySet.get(key)\n }\n}\n\n/**\n * The members one object level of a sparse fieldset selects: `keep`, the keys it renders, and\n * `children`, the keys it narrows further, a list's items under `*`.\n */\ninterface Narrowing {\n keep: ReadonlySet<string>\n children: ReadonlyMap<string, Narrowing>\n}\n\n/** The {@link Narrowing} of key paths relative to one level, such as `b`, `c.d` or `*.sku`. */\nfunction narrowingOf(paths: readonly string[]): Narrowing {\n const keep = new Set<string>()\n const whole = new Set<string>()\n const deeper = new Map<string, string[]>()\n for (const path of paths) {\n const dot = path.indexOf('.')\n const head = dot < 0 ? path : path.slice(0, dot)\n keep.add(head)\n if (dot < 0) {\n whole.add(head)\n } else {\n const rest = deeper.get(head) ?? []\n rest.push(path.slice(dot + 1))\n deeper.set(head, rest)\n }\n }\n const children = new Map<string, Narrowing>()\n for (const [head, rest] of deeper) {\n if (!whole.has(head)) {\n children.set(head, narrowingOf(rest))\n }\n }\n return { keep, children }\n}\n\n/**\n * One {@link Narrowing} for a schema several keys share, such as a map's `additionalProperties`:\n * a key stays required only when every sharer renders it, and a key one sharer narrows is narrowed.\n */\nfunction merged(narrowings: readonly Narrowing[]): Narrowing {\n if (narrowings.length === 1) {\n return narrowings[0]!\n }\n const keep = new Set(\n [...narrowings[0]!.keep].filter((key) => narrowings.every((n) => n.keep.has(key))),\n )\n const grouped = new Map<string, Narrowing[]>()\n for (const narrowing of narrowings) {\n for (const [key, child] of narrowing.children) {\n grouped.set(key, [...(grouped.get(key) ?? []), child])\n }\n }\n const children = new Map<string, Narrowing>()\n for (const [key, group] of grouped) {\n children.set(key, merged(group))\n }\n return { keep, children }\n}\n\n/** The schema a local `$ref` such as `#/$defs/Address` points at within `root`. */\nfunction resolveRef(root: Record<string, unknown>, ref: string): unknown {\n if (!ref.startsWith('#')) {\n return undefined\n }\n let node: unknown = root\n for (const raw of ref.slice(1).split('/').slice(1)) {\n const segment = decodeURIComponent(raw).replace(/~1/g, '/').replace(/~0/g, '~')\n node = isObject(node) ? node[segment] : undefined\n }\n return node\n}\n\n/** `schema` with `narrowing` applied: its `required` cut to what the level renders, its narrowed keys relaxed in turn. */\nfunction narrowed(\n root: Record<string, unknown>,\n schema: unknown,\n narrowing: Narrowing,\n depth = 0,\n): unknown {\n if (!isObject(schema) || depth > 64) {\n return schema\n }\n if (typeof schema['$ref'] === 'string') {\n const { $ref: ref, ...siblings } = schema\n const target = resolveRef(root, ref as string)\n if (isObject(target)) {\n return narrowed(root, { ...target, ...siblings }, narrowing, depth + 1)\n }\n }\n const out: Record<string, unknown> = { ...schema }\n // The member naming a union's variant renders whatever the selection, so it stays required and\n // its `const` still tells the narrowed variants apart.\n const discriminator = isObject(out['discriminator']) ? out['discriminator']['propertyName'] : null\n const branchNarrowing =\n typeof discriminator === 'string'\n ? { keep: new Set([...narrowing.keep, discriminator]), children: narrowing.children }\n : narrowing\n for (const key of ['anyOf', 'oneOf', 'allOf'] as const) {\n const branches = out[key]\n if (Array.isArray(branches)) {\n out[key] = branches.map((branch) => narrowed(root, branch, branchNarrowing, depth + 1))\n }\n }\n // Without a discriminator, narrowed variants can no longer be told apart by their required\n // members, so a value may match more than one of them.\n if (Array.isArray(out['oneOf']) && typeof discriminator !== 'string') {\n const { oneOf, ...rest } = out\n return out['anyOf'] === undefined\n ? narrowedLevel(root, { ...rest, anyOf: oneOf }, narrowing, depth)\n : narrowedLevel(\n root,\n { ...rest, allOf: [...((rest['allOf'] as unknown[]) ?? []), { anyOf: oneOf }] },\n narrowing,\n depth,\n )\n }\n return narrowedLevel(root, out, narrowing, depth)\n}\n\n/** The rest of {@link narrowed}: one level's own `required` and keys. */\nfunction narrowedLevel(\n root: Record<string, unknown>,\n out: Record<string, unknown>,\n narrowing: Narrowing,\n depth: number,\n): unknown {\n const required = out['required']\n if (Array.isArray(required)) {\n out['required'] = required.filter((key) => typeof key === 'string' && narrowing.keep.has(key))\n }\n const properties = isObject(out['properties']) ? { ...out['properties'] } : undefined\n const patterns = isObject(out['patternProperties']) ? out['patternProperties'] : undefined\n const shared = new Map<string, Narrowing[]>()\n const share = (target: string, child: Narrowing): void => {\n shared.set(target, [...(shared.get(target) ?? []), child])\n }\n for (const [key, child] of narrowing.children) {\n if (key === '*') {\n if (isObject(out['items'])) {\n out['items'] = narrowed(root, out['items'], child, depth + 1)\n }\n continue\n }\n if (properties !== undefined && key in properties) {\n properties[key] = narrowed(root, properties[key], child, depth + 1)\n continue\n }\n const matching = Object.keys(patterns ?? {}).filter((pattern) => matches(pattern, key))\n if (matching.length > 0) {\n matching.forEach((pattern) => share(`pattern:${pattern}`, child))\n } else if (isObject(out['additionalProperties'])) {\n share('additional', child)\n }\n }\n if (properties !== undefined) {\n out['properties'] = properties\n }\n if (patterns !== undefined) {\n const next = { ...patterns }\n for (const pattern of Object.keys(patterns)) {\n const group = shared.get(`pattern:${pattern}`)\n if (group !== undefined) {\n next[pattern] = narrowed(root, patterns[pattern], merged(group), depth + 1)\n }\n }\n out['patternProperties'] = next\n }\n const additional = shared.get('additional')\n if (additional !== undefined) {\n out['additionalProperties'] = narrowed(\n root,\n out['additionalProperties'],\n merged(additional),\n depth + 1,\n )\n }\n return out\n}\n\n/** Whether a `patternProperties` pattern matches `key`; an unreadable pattern matches nothing. */\nfunction matches(pattern: string, key: string): boolean {\n try {\n return new RegExp(pattern, 'u').test(key)\n } catch {\n return false\n }\n}\n\n/**\n * A resource object schema relaxed for a response to a request whose sparse fieldset for the type\n * named `members`. An attribute or relation the fieldset leaves out is no longer required, and an\n * attribute it narrows to some of its keys, such as `address.city`, `location.geo.lat` or\n * `lines.*.sku`, requires only the keys selected at each level along those paths. A member the\n * fieldset also lists whole is left as declared, as the server renders it whole. Everything else\n * in the schema is kept, so a selected value is still checked, but for its `$id`: the copy is a\n * schema of its own.\n */\nexport function sparseSchema(schema: unknown, members: readonly string[]): unknown {\n if (!isObject(schema)) {\n return schema\n }\n const selection = nestedFieldset(members)\n const selected = new Set([\n // `lines.*` names the list itself, as `lines` does.\n ...members\n .map((member) => member.replace(/(?:\\.\\*)+$/, ''))\n .filter((member) => member !== '' && !member.includes('.')),\n ...Object.keys(selection),\n ])\n const children = new Map<string, Narrowing>()\n for (const [attribute, paths] of Object.entries(selection)) {\n children.set(attribute, narrowingOf(paths))\n }\n // The resource object keeps its own required members, but `attributes` and `relationships`\n // may be left out when the fieldset empties them.\n const required = Array.isArray(schema['required']) ? (schema['required'] as unknown[]) : []\n const out = narrowed(schema, schema, {\n keep: new Set(\n required.filter(\n (key): key is string =>\n typeof key === 'string' && key !== 'attributes' && key !== 'relationships',\n ),\n ),\n children: new Map([\n ['attributes', { keep: selected, children }],\n ['relationships', { keep: selected, children: new Map() }],\n ]),\n }) as Record<string, unknown>\n // An engine keying schemas by `$id` can then hold the copy beside the whole schema.\n delete out['$id']\n return out\n}\n\nconst isObject = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\n\n/**\n * The light structural guards every parsed response passes through (ADR 0004): assert the body\n * is a JSON:API document and that each `data`/`included` member carries a string `type` (and,\n * for a full resource, an `id`). This is the always-on, engine-free floor — it never duplicates\n * the opt-in per-field validation; it only proves the envelope invariant the runtime relies on.\n *\n * A primary-`data` resource and every `included` resource must carry `type`+`id`. A relationship\n * endpoint's primary data is pure resource-identifier linkage, which also carries `type`+`id`, so\n * the same guard holds; `linkage` is accepted for symmetry with the materialiser but the assertion\n * is identical (an identifier is `type`+`id`). `data: null` (an empty to-one) and a missing\n * `data` (a meta-only document) are valid and pass.\n */\nexport function assertJsonApiDocument(body: unknown): asserts body is Document {\n if (!isObject(body)) {\n throw new StructuralGuardError('Response body is not a JSON:API document (expected an object)')\n }\n // A JSON:API document must carry at least one of `data`, `errors`, or `meta`. An error\n // document never reaches here (a non-2xx throws a JsonApiError upstream), so the guard\n // requires a `data` or `meta` top-level member.\n if (!('data' in body) && !('meta' in body)) {\n throw new StructuralGuardError(\n 'Response body is not a JSON:API document (missing top-level \"data\" or \"meta\")',\n )\n }\n const data = body['data']\n if (Array.isArray(data)) {\n data.forEach((member, i) => assertResource(member, `data[${i}]`))\n } else if (data !== null && data !== undefined) {\n assertResource(data, 'data')\n }\n const included = body['included']\n if (included !== undefined) {\n if (!Array.isArray(included)) {\n throw new StructuralGuardError('Response \"included\" is not an array')\n }\n included.forEach((member, i) => assertResource(member, `included[${i}]`))\n }\n}\n\n/** Assert a single member is a resource object/identifier carrying string `type` + `id`. */\nfunction assertResource(member: unknown, at: string): void {\n if (!isObject(member)) {\n throw new StructuralGuardError(`${at} is not a JSON:API resource object`)\n }\n if (typeof member['type'] !== 'string') {\n throw new StructuralGuardError(`${at} is missing a string \"type\"`)\n }\n if (typeof member['id'] !== 'string') {\n throw new StructuralGuardError(`${at} (type \"${member['type']}\") is missing a string \"id\"`)\n }\n}\n\n/**\n * Run the opt-in validator over every wire resource in a document's `data` + `included`, each\n * against its per-type schema. Called only when a validator is configured (off by default). The\n * structural guards have already proven each member carries `type`+`id`, so the cast is sound.\n */\nexport function validateDocument(\n body: Document,\n validator: ResolvedValidator,\n fields?: Readonly<Record<string, readonly string[]>>,\n): void {\n const data = body.data\n if (Array.isArray(data)) {\n for (const member of data) {\n validateResourceMember(member, validator, fields)\n }\n } else if (data !== null && data !== undefined) {\n validateResourceMember(data, validator, fields)\n }\n if (body.included !== undefined) {\n // `included` always holds full resource objects.\n for (const member of body.included) {\n const resource = member as WireResource\n validator.validate(resource, fields?.[resource.type])\n }\n }\n}\n\n/**\n * Validate a `data` member, but only when it is a full RESOURCE OBJECT. A relationship-linkage\n * endpoint's `data` is bare resource IDENTIFIERS (`type`+`id`[+`meta`], no `attributes`/\n * `relationships`); the per-type schema describes the resource object, so running it over an\n * identifier would spuriously fail. The structural guard already covered the identifier shape.\n */\nfunction validateResourceMember(\n member: unknown,\n validator: ResolvedValidator,\n fields: Readonly<Record<string, readonly string[]>> | undefined,\n): void {\n if (isObject(member) && ('attributes' in member || 'relationships' in member)) {\n const resource = member as WireResource\n validator.validate(resource, fields?.[resource.type])\n }\n}\n"],"mappings":";;AAaA,SAAgB,UACd,OACA,WAAW,OACS;CACpB,OAAO;EAAC,OAAO;EAAQ,OAAO;EAAO,WAAW,OAAO,OAAO,KAAA;CAAS,CAAC,CAAC,MACtE,MAAM,MAAM,KAAA,KAAa,MAAM,EAClC;AACF;;;;;;;;;;ACkBA,IAAa,uBAAb,cAA0C,MAAM;CAC9C,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;AAOA,SAAS,eAAe,QAAgB,QAA+C;CACrF,IAAI,UAAU,uCAAuC;CACrD,MAAM,QAAQ,OAAO;CACrB,MAAM,QAAQ,UAAU,KAAK;CAC7B,IAAI,UAAU,KAAA,GACZ,WAAW,KAAK;CAElB,IAAI,OAAO,SAAS,GAClB,WAAW,SAAS,OAAO,SAAS,EAAE;CAExC,OAAO;AACT;;;;;;;;AASA,IAAa,eAAb,cAA6D,MAAM;CACjE;CACA;CAEA,YAAY,QAAgB,QAAiC,SAAkB;EAC7E,MAAM,WAAW,eAAe,QAAQ,MAAM,CAAC;EAC/C,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,SAAS;CAChB;CAEA,UAAU,QAAyB;EACjC,OAAO,KAAK,WAAW;CACzB;CAEA,QAAiB;EACf,OAAO,KAAK,UAAU,OAAO,KAAK,SAAS;CAC7C;CAEA,QAAiB;EACf,OAAO,KAAK,UAAU,OAAO,KAAK,SAAS;CAC7C;CAEA,eAAwB;EACtB,OAAO,KAAK,WAAW;CACzB;CAEA,iBAA0B;EACxB,OAAO,KAAK,WAAW;CACzB;CAEA,cAAuB;EACrB,OAAO,KAAK,WAAW;CACzB;CAEA,aAAsB;EACpB,OAAO,KAAK,W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B,UAAU,SAAS,UAAU,SAAS,SAAS,KAAK;CACtD;AACF"}
|
|
@@ -117,6 +117,13 @@ interface RelationDescriptor {
|
|
|
117
117
|
pivotFields?: Readonly<Record<string, string>>;
|
|
118
118
|
/** The `meta.pivot` a response renders on each member (`<Type><Rel>Pivot`). */
|
|
119
119
|
readPivot?: PivotDescriptor;
|
|
120
|
+
/**
|
|
121
|
+
* `true` when a response renders `meta.pivot` on every member of the relation's linkage, as its
|
|
122
|
+
* response identifiers require `meta` and its `pivot`. A linkage member's `$pivot` and `$edge`
|
|
123
|
+
* are then always present. Absent means a member may come without them. A request never has to
|
|
124
|
+
* send a pivot.
|
|
125
|
+
*/
|
|
126
|
+
pivotRendered?: boolean;
|
|
120
127
|
/**
|
|
121
128
|
* The `meta.pivot` a request may send on each member (`<Type><Rel>WritePivot`): a create,
|
|
122
129
|
* update or atomic body, or a relationship mutation.
|
|
@@ -1259,6 +1266,76 @@ declare function relatedPaginator(relation: RelationDescriptor | undefined, ctx:
|
|
|
1259
1266
|
/** The kind a relation's related read answers with when it sends no `page`. See {@link relatedPaginator}. */
|
|
1260
1267
|
declare function relatedPaginatorKind(relation: RelationDescriptor | undefined, ctx: MaterialiseContext): PaginatorKind;
|
|
1261
1268
|
//#endregion
|
|
1269
|
+
//#region src/input-validation.d.ts
|
|
1270
|
+
/**
|
|
1271
|
+
* The parts of the Standard Schema interface (standardschema.dev) the client calls. Zod, Valibot
|
|
1272
|
+
* and ArkType schemas implement it.
|
|
1273
|
+
*/
|
|
1274
|
+
interface StandardSchema<Input = unknown> {
|
|
1275
|
+
readonly '~standard': {
|
|
1276
|
+
readonly version: 1;
|
|
1277
|
+
readonly vendor: string;
|
|
1278
|
+
readonly validate: (value: unknown) => StandardSchemaResult | Promise<StandardSchemaResult>;
|
|
1279
|
+
readonly types?: {
|
|
1280
|
+
readonly input: Input;
|
|
1281
|
+
} | undefined;
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
/** What a Standard Schema's `validate` returns. */
|
|
1285
|
+
type StandardSchemaResult = {
|
|
1286
|
+
readonly value: unknown;
|
|
1287
|
+
readonly issues?: undefined;
|
|
1288
|
+
} | {
|
|
1289
|
+
readonly issues: readonly StandardSchemaIssue[];
|
|
1290
|
+
};
|
|
1291
|
+
/** One problem a Standard Schema found. */
|
|
1292
|
+
interface StandardSchemaIssue {
|
|
1293
|
+
readonly message: string;
|
|
1294
|
+
readonly path?: readonly (PropertyKey | {
|
|
1295
|
+
readonly key: PropertyKey;
|
|
1296
|
+
})[] | undefined;
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* The schemas `createClient({ validateInput })` checks a write's input against before sending it,
|
|
1300
|
+
* by wire type: `{ albums: { create: albumsCreateSchema, update: albumsUpdateSchema } }`. A type or
|
|
1301
|
+
* a write with no schema is sent unchecked. `json-api-codegen --zod` generates this map.
|
|
1302
|
+
*/
|
|
1303
|
+
type InputSchemas = Readonly<Record<string, {
|
|
1304
|
+
readonly create?: StandardSchema;
|
|
1305
|
+
readonly update?: StandardSchema;
|
|
1306
|
+
}>>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Thrown by a create or update whose input fails the schema `validateInput` holds for it, before
|
|
1309
|
+
* any request is sent. `fieldErrors(error)` takes it as it takes a server's 422.
|
|
1310
|
+
*/
|
|
1311
|
+
declare class InputValidationError extends Error {
|
|
1312
|
+
readonly type: string;
|
|
1313
|
+
readonly operation: 'create' | 'update';
|
|
1314
|
+
readonly issues: readonly StandardSchemaIssue[];
|
|
1315
|
+
/** The failing operation's index in an atomic batch. */
|
|
1316
|
+
readonly opIndex?: number;
|
|
1317
|
+
constructor(type: string, operation: 'create' | 'update', issues: readonly StandardSchemaIssue[], opIndex?: number);
|
|
1318
|
+
}
|
|
1319
|
+
/** One write's input, as `validateInput` checks it. */
|
|
1320
|
+
interface InputCheck {
|
|
1321
|
+
readonly type: string;
|
|
1322
|
+
readonly operation: 'create' | 'update';
|
|
1323
|
+
readonly input: unknown;
|
|
1324
|
+
readonly opIndex?: number;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* The {@link InputValidationError} `check`'s input fails its schema in `schemas` with, or
|
|
1328
|
+
* `undefined` when it passes or has no schema. A Promise only for a schema that validates
|
|
1329
|
+
* asynchronously.
|
|
1330
|
+
*/
|
|
1331
|
+
declare function inputFailure(schemas: InputSchemas | undefined, check: InputCheck): InputValidationError | undefined | Promise<InputValidationError | undefined>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Run `write` once `check`'s input passes its schema, else reject with the
|
|
1334
|
+
* {@link InputValidationError}. A write with no schema, or a schema that validates synchronously,
|
|
1335
|
+
* starts in this tick.
|
|
1336
|
+
*/
|
|
1337
|
+
declare function withInputCheck<T>(schemas: InputSchemas | undefined, check: InputCheck, write: () => Promise<T>): Promise<T>;
|
|
1338
|
+
//#endregion
|
|
1262
1339
|
//#region src/atomic.d.ts
|
|
1263
1340
|
/**
|
|
1264
1341
|
* A reference to a resource for an `update`/`remove` op: a bare identifier (or a materialised
|
|
@@ -1436,7 +1513,7 @@ type AtomicResults<D extends ApiDescriptor, A, Ops extends readonly AtomicHandle
|
|
|
1436
1513
|
* A thrown {@link JsonApiError} has each error's pointer remapped to `(opIndex, flatPath)` (the
|
|
1437
1514
|
* failing op's type drives the flat-path inversion) before it propagates.
|
|
1438
1515
|
*/
|
|
1439
|
-
declare function runAtomic<D extends ApiDescriptor, A, W, const Ops>(request: JsonApiContext, materialiseCtx: MaterialiseContext, descriptor: D, path: string, build: (tx: AtomicRecorder<D, W>) => Ops): Promise<Ops extends readonly AtomicHandle[] ? AtomicResults<D, A, Ops> : AtomicResult[]>;
|
|
1516
|
+
declare function runAtomic<D extends ApiDescriptor, A, W, const Ops>(request: JsonApiContext, materialiseCtx: MaterialiseContext, descriptor: D, path: string, build: (tx: AtomicRecorder<D, W>) => Ops, inputSchemas?: InputSchemas): Promise<Ops extends readonly AtomicHandle[] ? AtomicResults<D, A, Ops> : AtomicResult[]>;
|
|
1440
1517
|
//#endregion
|
|
1441
1518
|
//#region src/location.d.ts
|
|
1442
1519
|
/**
|
|
@@ -1502,16 +1579,40 @@ type RelationCollection<T, P = Page> = Collection<T, P> & RelationArrayEnvelope;
|
|
|
1502
1579
|
* `$edge` (this membership's edge meta/links) and `$pivot` (typed sugar over
|
|
1503
1580
|
* `$edge.meta.pivot`). `$pivot` is graceful: present iff the endpoint rendered
|
|
1504
1581
|
* `meta.pivot` (relationship/related endpoints), `undefined` otherwise. `Meta` types
|
|
1505
|
-
* `$edge.meta` where the linkage renders the relation's declared identifier meta.
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1582
|
+
* `$edge.meta` where the linkage renders the relation's declared identifier meta. `Rendered` is
|
|
1583
|
+
* `true` for a member of a linkage that renders `meta.pivot` on every member, whose `$edge`,
|
|
1584
|
+
* `$edge.meta` and `$pivot` are then always present.
|
|
1585
|
+
*
|
|
1586
|
+
* `Pending` is the pivot and edge meta a pending optimistic member carries, when they differ from
|
|
1587
|
+
* a confirmed one's: such a member holds only the pivot values its write sent, so every field the
|
|
1588
|
+
* write pivot doesn't require is optional. The type is then a union on `$optimistic`, and checking that it
|
|
1589
|
+
* isn't `'pending'` gives the confirmed member's types.
|
|
1590
|
+
*/
|
|
1591
|
+
type EdgeMembers<Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown>, Rendered extends boolean = false, Pending extends PendingEdge = never> = [Pending] extends [never] ? EdgeAccessors<Pivot, Meta, Rendered, 'pending' | undefined> : EdgeAccessors<Pivot, Meta, Rendered, undefined> | EdgeAccessors<Pending['pivot'], Pending['meta'], Rendered, 'pending'>;
|
|
1592
|
+
/** The pivot and edge meta of a pending optimistic member, as {@link EdgeMembers} takes them. */
|
|
1593
|
+
interface PendingEdge {
|
|
1594
|
+
readonly pivot: unknown;
|
|
1595
|
+
readonly meta: Record<string, unknown>;
|
|
1596
|
+
}
|
|
1597
|
+
/** The accessors {@link EdgeMembers} describes, for one value of `$optimistic`. */
|
|
1598
|
+
type EdgeAccessors<Pivot, Meta extends Record<string, unknown>, Rendered extends boolean, Optimistic extends 'pending' | undefined> = {
|
|
1599
|
+
readonly $edge: Rendered extends true ? Edge<Meta> & {
|
|
1600
|
+
readonly meta: Meta;
|
|
1601
|
+
} : Edge<Meta> | undefined;
|
|
1602
|
+
readonly $pivot: Rendered extends true ? Pivot : Pivot | undefined;
|
|
1603
|
+
} & ([Optimistic] extends ['pending'] ? PendingMarker : OptimisticMarker<Optimistic>);
|
|
1604
|
+
/** The `$optimistic` of a member a pending write holds. */
|
|
1605
|
+
interface PendingMarker {
|
|
1606
|
+
/** `'pending'`: a cache layer holds an unconfirmed change to this member. */
|
|
1607
|
+
readonly $optimistic: 'pending';
|
|
1608
|
+
}
|
|
1609
|
+
/** The `$optimistic` of a member that may or may not be pending. */
|
|
1610
|
+
interface OptimisticMarker<Optimistic extends 'pending' | undefined> {
|
|
1510
1611
|
/**
|
|
1511
1612
|
* `'pending'` while a cache layer (an optimistic draft in `@haddowg/json-api-query`) holds an
|
|
1512
1613
|
* unconfirmed change to this member, else `undefined`.
|
|
1513
1614
|
*/
|
|
1514
|
-
readonly $optimistic?:
|
|
1615
|
+
readonly $optimistic?: Optimistic;
|
|
1515
1616
|
}
|
|
1516
1617
|
/**
|
|
1517
1618
|
* The resource-level `$`-accessors on a materialised resource object. `Links` types `$links`: the
|
|
@@ -1656,22 +1757,29 @@ type RelationPage<D extends ApiDescriptor, T extends TypeName<D>, R extends Rela
|
|
|
1656
1757
|
/**
|
|
1657
1758
|
* The bare resource-identifier shape a non-included (but linked) relation takes,
|
|
1658
1759
|
* carrying the per-edge `$edge`/`$pivot` accessors the runtime attaches to every
|
|
1659
|
-
* materialised related value.
|
|
1760
|
+
* materialised related value. `Rendered` marks them always present, as {@link EdgeMembers} says.
|
|
1660
1761
|
*/
|
|
1661
|
-
type IdentifierMember<TType extends string, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown
|
|
1762
|
+
type IdentifierMember<TType extends string, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown>, Rendered extends boolean = false, Pending extends PendingEdge = never> = ResourceIdentifier<TType> & EdgeMembers<Pivot, Meta, Rendered, Pending>;
|
|
1662
1763
|
/**
|
|
1663
1764
|
* A hydrated related resource: a per-edge VIEW — the full `ResourceObjectView` of the
|
|
1664
1765
|
* related node plus this membership's `$edge`/`$pivot`. Relations one hop deep stay as
|
|
1665
1766
|
* identifiers (no nested-include narrowing in the read API today). The fieldset map `F`
|
|
1666
1767
|
* threads through so a sparse fieldset on the included type narrows its attributes/relations.
|
|
1667
1768
|
* `Pivot` types the per-edge `$pivot` (a `belongsToMany` relation's `meta.pivot`), and `Meta` the
|
|
1668
|
-
* per-edge `$edge.meta`.
|
|
1769
|
+
* per-edge `$edge.meta`. `Rendered` marks them always present, as {@link EdgeMembers} says.
|
|
1669
1770
|
*/
|
|
1670
|
-
type HydratedMember<D extends ApiDescriptor, A, TType extends TypeName<D>, F = unknown, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown
|
|
1771
|
+
type HydratedMember<D extends ApiDescriptor, A, TType extends TypeName<D>, F = unknown, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown>, Rendered extends boolean = false, Pending extends PendingEdge = never> = ResourceObjectView<D, A, TType, never, F> & EdgeMembers<Pivot, Meta, Rendered, Pending>;
|
|
1671
1772
|
/** A hydrated related value distributes over a polymorphic union of related types. */
|
|
1672
|
-
type Hydrated<D extends ApiDescriptor, A, TType extends TypeName<D>, F = unknown, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown
|
|
1773
|
+
type Hydrated<D extends ApiDescriptor, A, TType extends TypeName<D>, F = unknown, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown>, Rendered extends boolean = false, Pending extends PendingEdge = never> = TType extends TypeName<D> ? HydratedMember<D, A, TType, F, Pivot, Meta, Rendered, Pending> : never;
|
|
1673
1774
|
/** An identifier related value distributes over a polymorphic union of related types. */
|
|
1674
|
-
type Identifier<TType extends string, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown
|
|
1775
|
+
type Identifier<TType extends string, Pivot = Record<string, unknown>, Meta extends Record<string, unknown> = Record<string, unknown>, Rendered extends boolean = false, Pending extends PendingEdge = never> = TType extends string ? IdentifierMember<TType, Pivot, Meta, Rendered, Pending> : never;
|
|
1776
|
+
/**
|
|
1777
|
+
* `true` when relation `R` renders `meta.pivot` on every member of its linkage, as the
|
|
1778
|
+
* descriptor's `pivotRendered` says.
|
|
1779
|
+
*/
|
|
1780
|
+
type PivotRendered<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> = D[T]['relations'][R] extends {
|
|
1781
|
+
pivotRendered: true;
|
|
1782
|
+
} ? true : false;
|
|
1675
1783
|
/**
|
|
1676
1784
|
* The static value of one relation slot, resolved by cardinality and whether the
|
|
1677
1785
|
* relation name is present in the read's `include` tuple `Inc`:
|
|
@@ -1684,8 +1792,10 @@ type Identifier<TType extends string, Pivot = Record<string, unknown>, Meta exte
|
|
|
1684
1792
|
*
|
|
1685
1793
|
* (Excluded to-many stays a `Collection`: linkage may still be present, and a lazy
|
|
1686
1794
|
* to-many materialises as an augmented array regardless — only its members differ.)
|
|
1795
|
+
*
|
|
1796
|
+
* Each member's `$pivot` is typed from the relation's `readPivot`, as on the relationship endpoint.
|
|
1687
1797
|
*/
|
|
1688
|
-
type RelationValue<D extends ApiDescriptor, A, T extends TypeName<D>, R extends RelationName<D, T>, Inc, F = unknown> = R extends Inc ? IsMany<D, T, R> extends true ? RelationCollection<Hydrated<D, A, RelatedType<D, T, R>, F,
|
|
1798
|
+
type RelationValue<D extends ApiDescriptor, A, T extends TypeName<D>, R extends RelationName<D, T>, Inc, F = unknown> = R extends Inc ? IsMany<D, T, R> extends true ? RelationCollection<Hydrated<D, A, RelatedType<D, T, R>, F, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>, PivotRendered<D, T, R>, PendingEdgeOf<D, T, R>>, RelationPage<D, T, R>> : Hydrated<D, A, RelatedType<D, T, R>, F, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>, PivotRendered<D, T, R>, PendingEdgeOf<D, T, R>> | null : IsMany<D, T, R> extends true ? RelationCollection<Identifier<RelatedType<D, T, R>, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>, PivotRendered<D, T, R>, PendingEdgeOf<D, T, R>>, RelationPage<D, T, R>> : Identifier<RelatedType<D, T, R>, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>, PivotRendered<D, T, R>, PendingEdgeOf<D, T, R>> | null | undefined;
|
|
1689
1799
|
/**
|
|
1690
1800
|
* The relation slots of type `T`, each typed by cardinality and include-presence, then
|
|
1691
1801
|
* narrowed to the fieldset selection for `T` (relations are sparse-fieldset members too — an
|
|
@@ -2154,21 +2264,62 @@ type PivotFieldsOf<D extends ApiDescriptor, T extends TypeName<D>, R extends Rel
|
|
|
2154
2264
|
* `identifierMeta` declares, typed like a pivot, with the relation's `pivot` beside them. An
|
|
2155
2265
|
* identifier meta that says whether it is open takes only those, and the undeclared members it
|
|
2156
2266
|
* opens to; one that doesn't say is an open record. A relation declaring none keeps the open
|
|
2157
|
-
* record.
|
|
2267
|
+
* record, with its typed `pivot` where it renders one on every member.
|
|
2158
2268
|
*/
|
|
2159
|
-
type EdgeMetaOf<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> = D[T]['relations'][R] extends {
|
|
2269
|
+
type EdgeMetaOf<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>, Pivot = PivotFieldsOf<D, T, R>> = D[T]['relations'][R] extends {
|
|
2160
2270
|
identifierMeta: infer P;
|
|
2161
2271
|
} ? P extends {
|
|
2162
2272
|
additional: false | {
|
|
2163
2273
|
format: unknown;
|
|
2164
2274
|
};
|
|
2165
|
-
} ? PivotObject<P> & EdgePivot<D, T, R> & AdditionalMembers<P,
|
|
2166
|
-
|
|
2167
|
-
|
|
2275
|
+
} ? PivotObject<P> & EdgePivot<D, T, R, Pivot> & AdditionalMembers<P, Pivot> : PivotObject<P> & Record<string, unknown> : D[T]['relations'][R] extends {
|
|
2276
|
+
pivotRendered: true;
|
|
2277
|
+
} ? Record<string, unknown> & EdgePivot<D, T, R, Pivot> : Record<string, unknown>;
|
|
2278
|
+
/**
|
|
2279
|
+
* The `pivot` a pivot relation's identifier meta carries beside its declared members, always
|
|
2280
|
+
* present where the relation renders it on every member.
|
|
2281
|
+
*/
|
|
2282
|
+
type EdgePivot<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>, Pivot = PivotFieldsOf<D, T, R>> = D[T]['relations'][R] extends {
|
|
2283
|
+
pivotRendered: true;
|
|
2284
|
+
} ? {
|
|
2285
|
+
readonly pivot: Pivot;
|
|
2286
|
+
} : D[T]['relations'][R] extends {
|
|
2168
2287
|
pivot: true;
|
|
2169
2288
|
} ? {
|
|
2170
|
-
readonly pivot?:
|
|
2289
|
+
readonly pivot?: Pivot;
|
|
2171
2290
|
} : unknown;
|
|
2291
|
+
/** The fields relation `R`'s `writePivot` requires every write to send. */
|
|
2292
|
+
type WriteRequiredPivotField<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> = D[T]['relations'][R] extends {
|
|
2293
|
+
writePivot: infer W;
|
|
2294
|
+
} ? RequiredPivotField<W> : never;
|
|
2295
|
+
/**
|
|
2296
|
+
* The fields of relation `R`'s read pivot that every response renders but a write needn't send:
|
|
2297
|
+
* the ones only the server sets, such as a timestamp it stamps on attach, and the ones a write
|
|
2298
|
+
* may leave out.
|
|
2299
|
+
*/
|
|
2300
|
+
type UnsentPivotField<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> = D[T]['relations'][R] extends {
|
|
2301
|
+
readPivot: infer P;
|
|
2302
|
+
} ? Exclude<RequiredPivotField<P>, WriteRequiredPivotField<D, T, R>> : never;
|
|
2303
|
+
/**
|
|
2304
|
+
* The typed `meta.pivot` a pending optimistic member of relation `R` carries. It holds only what
|
|
2305
|
+
* the write sent, so a field is required only where the read renders it and the write pivot
|
|
2306
|
+
* requires it, and every other field is optional. Equal to {@link PivotFieldsOf} where the write
|
|
2307
|
+
* pivot requires every field the read requires.
|
|
2308
|
+
*/
|
|
2309
|
+
type PendingPivotOf<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> = D[T]['relations'][R] extends {
|
|
2310
|
+
readPivot: infer P;
|
|
2311
|
+
} ? { readonly [K in PivotFieldNames<P> as K extends UnsentPivotField<D, T, R> ? never : K extends RequiredPivotField<P> ? K : never]: PivotValue<P, K> } & { readonly [K in PivotFieldNames<P> as K extends UnsentPivotField<D, T, R> ? K : K extends RequiredPivotField<P> ? never : K]?: PivotValue<P, K> } & AdditionalMembers<P> : PivotFieldsOf<D, T, R>;
|
|
2312
|
+
/**
|
|
2313
|
+
* The {@link PendingEdge} of the linkage members of relation `R`, where the relation renders its
|
|
2314
|
+
* pivot on every member and requires a field of it that the write pivot doesn't. `never` otherwise:
|
|
2315
|
+
* a pending member then types like a confirmed one.
|
|
2316
|
+
*/
|
|
2317
|
+
type PendingEdgeOf<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> = D[T]['relations'][R] extends {
|
|
2318
|
+
pivotRendered: true;
|
|
2319
|
+
} ? [UnsentPivotField<D, T, R>] extends [never] ? never : {
|
|
2320
|
+
readonly pivot: PendingPivotOf<D, T, R>;
|
|
2321
|
+
readonly meta: EdgeMetaOf<D, T, R, PendingPivotOf<D, T, R>>;
|
|
2322
|
+
} : never;
|
|
2172
2323
|
/**
|
|
2173
2324
|
* The typed `meta.pivot` a request may send on each member of relation `R`, from the descriptor's
|
|
2174
2325
|
* `writePivot` (only writable fields, optional unless required). Falls back like
|
|
@@ -2326,9 +2477,10 @@ type RelatedValue<D extends ApiDescriptor, A, T extends TypeName<D>, R extends R
|
|
|
2326
2477
|
* A linkage VALUE for relation `R` (the `/relationships/{rel}` endpoint, identifiers only):
|
|
2327
2478
|
* a `Collection` of identifier members for to-many, a single identifier (or `null`) for to-one.
|
|
2328
2479
|
* Each member's `$pivot` is typed from the relation's `readPivot`, and its `$edge.meta` from its
|
|
2329
|
-
* `identifierMeta`.
|
|
2480
|
+
* `identifierMeta`. `Settled` is `true` for linkage no cache layer can hold pending, such as an
|
|
2481
|
+
* atomic result, whose members are typed only as confirmed.
|
|
2330
2482
|
*/
|
|
2331
|
-
type LinkageValue<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>, Q = undefined> = IsMany<D, T, R> extends true ? Collection<Identifier<RelatedType<D, T, R>, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>>, RelationPage<D, T, R, Q>> : Identifier<RelatedType<D, T, R>, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>> | null;
|
|
2483
|
+
type LinkageValue<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>, Q = undefined, Settled extends boolean = false> = IsMany<D, T, R> extends true ? Collection<Identifier<RelatedType<D, T, R>, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>, PivotRendered<D, T, R>, Settled extends true ? never : PendingEdgeOf<D, T, R>>, RelationPage<D, T, R, Q>> : Identifier<RelatedType<D, T, R>, PivotFieldsOf<D, T, R>, EdgeMetaOf<D, T, R>, PivotRendered<D, T, R>, Settled extends true ? never : PendingEdgeOf<D, T, R>> | null;
|
|
2332
2484
|
/**
|
|
2333
2485
|
* The query relation `R`'s relationship read takes, its `sort` and `filter` narrowed to what the
|
|
2334
2486
|
* relation declares and its `page` of type `Pg`. It takes no `relatedQuery`.
|
|
@@ -2625,13 +2777,14 @@ type UpdateMethod<D extends ApiDescriptor, A, W, T extends TypeName<D>, I = Upda
|
|
|
2625
2777
|
* `meta`);
|
|
2626
2778
|
* - an {@link AtomicDeleteHandle} -> `undefined` (a remove carries no data);
|
|
2627
2779
|
* - an {@link AtomicRelationshipHandle} for relation `R` of `T` -> the `AtomicResult` wrapping the
|
|
2628
|
-
* linkage the server answered with, as the relationship
|
|
2629
|
-
* `undefined` data when it answered with an empty
|
|
2780
|
+
* linkage the server answered with, typed as the relationship endpoint's (a pivot the relation
|
|
2781
|
+
* renders on every member is present), or `undefined` data when it answered with an empty
|
|
2782
|
+
* result. A result comes straight from the server, so no member of it is pending.
|
|
2630
2783
|
*
|
|
2631
2784
|
* Drives the per-op positional typing of {@link AtomicResults} (the callback's returned tuple of
|
|
2632
2785
|
* handles maps to a tuple of these).
|
|
2633
2786
|
*/
|
|
2634
|
-
type AtomicResultOf<D extends ApiDescriptor, A, Handle> = Handle extends AtomicDeleteHandle ? undefined : Handle extends AtomicRelationshipHandle<infer T, infer R> ? T extends TypeName<D> ? R extends RelationName<D, T> ? AtomicResult<LinkageValue<D, T, R> | undefined> : never : never : Handle extends AtomicCreateHandle<infer T> ? T extends TypeName<D> ? AtomicResult<ResourceObjectView<D, A, T>> : never : Handle extends AtomicUpdateHandle<infer T> ? T extends TypeName<D> ? AtomicResult<ResourceObjectView<D, A, T>> : never : never;
|
|
2787
|
+
type AtomicResultOf<D extends ApiDescriptor, A, Handle> = Handle extends AtomicDeleteHandle ? undefined : Handle extends AtomicRelationshipHandle<infer T, infer R> ? T extends TypeName<D> ? R extends RelationName<D, T> ? AtomicResult<LinkageValue<D, T, R, undefined, true> | undefined> : never : never : Handle extends AtomicCreateHandle<infer T> ? T extends TypeName<D> ? AtomicResult<ResourceObjectView<D, A, T>> : never : Handle extends AtomicUpdateHandle<infer T> ? T extends TypeName<D> ? AtomicResult<ResourceObjectView<D, A, T>> : never : never;
|
|
2635
2788
|
/** The custom actions declared on type `T` (the descriptor's `actions` block, or `{}`). */
|
|
2636
2789
|
type ActionsOf<D extends ApiDescriptor, T extends TypeName<D>> = D[T] extends {
|
|
2637
2790
|
actions: infer Acts;
|
|
@@ -3016,9 +3169,10 @@ interface TypeAccessor<D extends ApiDescriptor, A, W, T extends TypeName<D>, Act
|
|
|
3016
3169
|
* generated `WriteAttributes` map (per-type `{ create; update }` attribute pairs) and `Act`
|
|
3017
3170
|
* the generated per-action body-type map; both thread through to the write/action surfaces and
|
|
3018
3171
|
* default so read-only / codegen-less callers compile. `E` is the server's documented
|
|
3019
|
-
* error-code union
|
|
3172
|
+
* error-code union and `O` the codes each operation raises, keyed by operation id, both carried
|
|
3173
|
+
* at the type level only (read them back with `ErrorCodeOf` and `OperationErrorCodeOf`).
|
|
3020
3174
|
*/
|
|
3021
|
-
type Client<D extends ApiDescriptor, A = DefaultAttributes<D>, W = DefaultWriteAttributes<D>, Act = DefaultActionTypes, E extends string = string, L = Record<never, never>> = { -readonly [T in keyof D as Extract<T, string>]: D[T] extends {
|
|
3175
|
+
type Client<D extends ApiDescriptor, A = DefaultAttributes<D>, W = DefaultWriteAttributes<D>, Act = DefaultActionTypes, E extends string = string, L = Record<never, never>, O = Record<never, never>> = { -readonly [T in keyof D as Extract<T, string>]: D[T] extends {
|
|
3022
3176
|
singleton: true;
|
|
3023
3177
|
} ? SingletonAccessor<D, WithLinks<A, L>, W, Extract<T, string>, Act> : TypeAccessor<D, WithLinks<A, L>, W, Extract<T, string>, Act> } & {
|
|
3024
3178
|
/**
|
|
@@ -3039,12 +3193,30 @@ type Client<D extends ApiDescriptor, A = DefaultAttributes<D>, W = DefaultWriteA
|
|
|
3039
3193
|
*/
|
|
3040
3194
|
atomic<const Ops>(build: (tx: AtomicRecorder<D, W>) => Ops): Promise<Ops extends readonly AtomicHandle[] ? AtomicResults<D, WithLinks<A, L>, Ops> : AtomicResult[]>;
|
|
3041
3195
|
readonly [errorCodes]?: E;
|
|
3196
|
+
readonly '~errorCodesByOperation'?: O;
|
|
3042
3197
|
};
|
|
3043
3198
|
declare const errorCodes: unique symbol;
|
|
3199
|
+
/**
|
|
3200
|
+
* The type-only members a client carries its error codes in: `E`, every documented code, and
|
|
3201
|
+
* `O`, the codes each operation raises. Intersect it into a type that stands in for a client.
|
|
3202
|
+
*/
|
|
3203
|
+
interface ErrorCodeCarrier<E extends string = string, O = Record<never, never>> {
|
|
3204
|
+
readonly [errorCodes]?: E;
|
|
3205
|
+
readonly '~errorCodesByOperation'?: O;
|
|
3206
|
+
}
|
|
3044
3207
|
/** The error-code union a client type carries, or `string` for one that carries none. */
|
|
3045
3208
|
type ErrorCodeOf<T> = T extends {
|
|
3046
3209
|
readonly [errorCodes]?: infer C extends string;
|
|
3047
3210
|
} ? C : string;
|
|
3211
|
+
/**
|
|
3212
|
+
* The codes operation `Op` raises on a client type, such as `'create.albums'`. Every code the
|
|
3213
|
+
* client carries when it lists none for `Op`.
|
|
3214
|
+
*/
|
|
3215
|
+
type OperationErrorCodeOf<T, Op extends string> = T extends {
|
|
3216
|
+
readonly '~errorCodesByOperation'?: infer O;
|
|
3217
|
+
} ? OperationCodes<ErrorCodeOf<T>, O, Op> : ErrorCodeOf<T>;
|
|
3218
|
+
/** The codes operation `Op` raises per `O`, a generated `ErrorCodeByOperation`, else `C`. */
|
|
3219
|
+
type OperationCodes<C extends string, O, Op extends string> = Op extends keyof O ? Extract<O[Op], string> : C;
|
|
3048
3220
|
/**
|
|
3049
3221
|
* The fallback attribute map when a caller doesn't supply the generated `Attributes`
|
|
3050
3222
|
* (direct `createClient` users without codegen): every type's attributes are an open
|
|
@@ -3146,6 +3318,12 @@ interface ClientOptions {
|
|
|
3146
3318
|
* validation engine (e.g. ajv) is brought by the caller; the client never depends on one.
|
|
3147
3319
|
*/
|
|
3148
3320
|
validate?: ValidationOption;
|
|
3321
|
+
/**
|
|
3322
|
+
* Schemas to check each create's and update's input against before sending it, by wire type.
|
|
3323
|
+
* An input that fails rejects with an {@link InputValidationError} and sends nothing. Pass the
|
|
3324
|
+
* `inputSchemas` that `json-api-codegen --zod` generates, or your own Standard Schemas.
|
|
3325
|
+
*/
|
|
3326
|
+
validateInput?: InputSchemas;
|
|
3149
3327
|
}
|
|
3150
3328
|
/**
|
|
3151
3329
|
* The reserved members on a {@link ResourceHandle} — names the Proxy resolves itself, so a
|
|
@@ -3162,7 +3340,7 @@ declare const HANDLE_RESERVED: ReadonlySet<string>;
|
|
|
3162
3340
|
* (`$next()`/`$prev()`, related links) is wired through `materialise`'s `navigate` seam,
|
|
3163
3341
|
* which resolves the server's link against `baseUrl`, executes it and re-materialises.
|
|
3164
3342
|
*/
|
|
3165
|
-
declare function createClient<D extends ApiDescriptor, A = DefaultAttributes<D>, W = DefaultWriteAttributes<D>, Act = DefaultActionTypes, E extends string = string, L = Record<never, never>>(descriptor: D, options: ClientOptions): Client<D, A, W, Act, E, L>;
|
|
3343
|
+
declare function createClient<D extends ApiDescriptor, A = DefaultAttributes<D>, W = DefaultWriteAttributes<D>, Act = DefaultActionTypes, E extends string = string, L = Record<never, never>, O = Record<never, never>>(descriptor: D, options: ClientOptions): Client<D, A, W, Act, E, L, O>;
|
|
3166
3344
|
//#endregion
|
|
3167
3345
|
//#region src/request.d.ts
|
|
3168
3346
|
/**
|
|
@@ -3401,5 +3579,5 @@ declare function assertJsonApiDocument(body: unknown): asserts body is Document;
|
|
|
3401
3579
|
*/
|
|
3402
3580
|
declare function validateDocument(body: Document, validator: ResolvedValidator, fields?: Readonly<Record<string, readonly string[]>>): void;
|
|
3403
3581
|
//#endregion
|
|
3404
|
-
export { DeleteResult as $,
|
|
3405
|
-
//# sourceMappingURL=validate-
|
|
3582
|
+
export { DeleteResult as $, InputValidationError as $n, PollOptions as $r, RelationSortQuery as $t, TransportResponse as A, PivotDescriptor as Ai, WriteOptions as An, ATOMIC_MEDIA_TYPE as Ar, OptionsArg as At, Client as B, ResourceExamples as Bi, AtomicOperationArgs as Bn, Page as Br, RelatedMeta as Bt, ClientOptions as C, MenuDescriptor as Ci, UpdateMethod as Cn, identifierViewOf as Cr, MetaOption as Ct, JsonApiTransport as D, PaginatorKind as Di, WithDocumentMeta as Dn, relatedPaginatorKind as Dr, OperationCodes as Dt, createClient as E, PaginatorDescriptor as Ei, WaitedWriteResult as En, relatedPaginator as Er, NestedFieldsetMember as Et, ActionCallOptions as F, RelationDescriptor as Fi, readActionLocation as Fn, mediaType as Fr, ReadAttributesOf as Ft, CountedRelationName as G, AtomicRelationshipRecorder as Gn, PageParams as Gr, RelatedReadRelatedQuery as Gt, CollectionMeta as H, SortFamilyDescriptor as Hi, AtomicRef as Hn, PageLinks as Hr, RelatedQueryEntry as Ht, ActionsAccessor as I, RelationMutations as Ii, AtomicCreateHandle as In, NestedFieldset as Ir, ReadResult as It, CreateMethod as J, AtomicUpdateHandle as Jn, TypedPage as Jr, RelationName as Jt, CreateAttributesOf as K, AtomicResult as Kn, PageParamsOf as Kr, RelationCollection as Kt, AtomicResultOf as L, RequestMetaOperation as Li, AtomicCreateInput as Ln, nestedFieldset as Lr, ReadableRelationName as Lt, AcceptedJob as M, RawOutputMedia as Mi, WriteResult as Mn, LocalIdentifier as Mr, PendingPivotOf as Mt, AcceptedMeta as N, RelatedQueryDescriptor as Ni, ActionLocation as Nn, MediaTypeParams as Nr, PivotFieldsOf as Nt, TransportRawBody as O, PaginatorRole as Oi, WithLinks as On, setMaterialisedOverlay as Or, OperationErrorCodeOf as Ot, AcceptedOf as P, RelatedQueryOperation as Pi, isActionLocation as Pn, ResourceIdentifier as Pr, PivotInput as Pt, DeleteArgs as Q, InputSchemas as Qn, Accepted as Qr, RelationRequestMetaOf as Qt, BinaryBody as R, ResourceCountOperation as Ri, AtomicDeleteHandle as Rn, CANONICAL_PAGE_KEYS as Rr, RelatedIncludedResource as Rt, serializeQuery as S, MediaExamples as Si, UpdateInput as Sn, edgeViewOf as Sr, MetaObject as St, HeadersInit as T, OperationExamples as Ti, WaitValue as Tn, materialise as Tr, MutationVerb as Tt, CountAccessor as U, StrategyDescriptor as Ui, AtomicRelationshipArgs as Un, PageMeta as Ur, RelatedQueryParam as Ut, Collection as V, ResourceMetaDescriptor as Vi, AtomicRecorder as Vn, PageKeys as Vr, RelatedQuery as Vt, CountToken as W, isPolymorphic as Wi, AtomicRelationshipHandle as Wn, PageOf as Wr, RelatedQueryRelation as Wt, DefaultAttributes as X, runAtomic as Xn, prevPageParams as Xr, RelationPaginator as Xt, DefaultActionTypes as Y, AtomicUpdateInput as Yn, nextPageParams as Yr, RelationPageParams as Yt, DefaultWriteAttributes as Z, InputCheck as Zn, resolvePaginator as Zr, RelationReadQuery as Zt, RawResponseType as _, DocumentMetaDescriptor as _i, TypeAccessor as _n, PendingPlacement as _r, ListPageParams as _t, ValidationOption as a, ActionDescriptor as ai, ResourceCountToken as an, ArrayEnvelope as ar, FieldsMap as at, executeRaw as b, InputMedia as bi, TypedRelatedReadQuery as bn, ResourceEnvelope as br, MemberName as bt, assertJsonApiDocument as c, ActionOutput as ci, ResourceObjectView as cn, EdgeEnvelope as cr, HydratedMember as ct, sparseSchemas as d, ApiDescriptor as di, SingleReadQuery as dn, LinkObject as dr, IncludedRelations as dt, PollTimeoutError as ei, RelationshipAccessor as en, StandardSchema as er, DocumentMeta as et, validateDocument as f, ApiExamples as fi, SingletonAccessor as fn, MaterialiseContext as fr, IncludedResource as ft, JsonApiRequest as g, CountableDescriptor as gi, TakesVerb as gn, PendingMember as gr, ListFilterMember as gt, JsonApiContext as h, ClientIdPolicy as hi, SortToken as hn, PendingCreate as hr, LinkageRef as ht, ValidationContext as i, AcceptedOperation as ii, ResourceAccessors as in, withInputCheck as ir, FieldSelectionMap as it, fetchTransport as j, RawMediaKind as ji, WritePivotOf as jn, JSON_API_MEDIA_TYPE as jr, PendingEdge as jt, TransportRequest as k, PaginatorStrategy as ki, WritableRelationName as kn, ATOMIC_EXT as kr, OperationMeta as kt, resolveValidator as l, ActionScope as li, ResourceWriteMeta as ln, EdgeMember as lr, IdentifierMember as lt, ExecutedResponse as m, Cardinality as mi, SortQuery as mn, NavigateOptions as mr, IsSingleton as mt, SchemaMap as n, parseRetryAfter as ni, RequestMetaOf as nn, StandardSchemaResult as nr, ErrorCodeCarrier as nt, Validator as o, ActionInput as oi, ResourceHandle as on, DocumentEnvelope as or, FilterKey as ot, Document as p, AtomicDescriptor as pi, SingletonUpdateInput as pn, MaterialisedOverlay as pr, IncludedType as pt, CreateInput as q, AtomicResults as qn, ResolvedPaginator as qr, RelationFilterQuery as qt, ValidationConfig as r, AcceptedDescriptor as ri, RequiresRequestMeta as rn, inputFailure as rr, ErrorCodeOf as rt, WireResource as s, ActionLocationDescriptor as si, ResourceMetaOf as sn, Edge as sr, FilterQuery as st, ResolvedValidator as t, isAccepted as ti, RelationshipMembers as tn, StandardSchemaIssue as tr, EdgeMembers as tt, sparseSchema as u, AdditionalMembersDescriptor as ui, ResourceWriteOperation as un, Link as ur, IncludePath as ut, ReadQuery as v, DocumentMetaOperation as vi, TypeName as vn, RelationArrayEnvelope as vr, LooseRelatedQuery as vt, HANDLE_RESERVED as w, MetaLiteral as wi, WaitOptions as wn, isMaterialised as wr, MutationMetaOf as wt, executeResponse as x, InputMediaKind as xi, TypedRelationReadQuery as xn, ResourceLinks as xr, MemberTypeOf as xt, execute as y, FilterFamilyDescriptor as yi, TypedReadQuery as yn, RelationView as yr, LooseRelatedQueryEntry as yt, BinaryResponseType as z, ResourceDescriptor as zi, AtomicHandle as zn, ExactPageParams as zr, RelatedIncludedType as zt };
|
|
3583
|
+
//# sourceMappingURL=validate-CCLqE_2J.d.cts.map
|