@haddowg/json-api-client 1.17.0 → 1.19.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.d.cts +1 -1
- package/dist/ajv.d.mts +1 -1
- package/dist/index.cjs +375 -206
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +372 -207
- package/dist/index.mjs.map +1 -1
- package/dist/{validate-sTJePeDg.d.cts → validate-COy9e4mh.d.cts} +217 -22
- package/dist/validate-COy9e4mh.d.cts.map +1 -0
- package/dist/{validate-sTJePeDg.d.mts → validate-COy9e4mh.d.mts} +217 -22
- package/dist/validate-COy9e4mh.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/validate-sTJePeDg.d.cts.map +0 -1
- package/dist/validate-sTJePeDg.d.mts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -100,6 +100,324 @@ function findError(err, code) {
|
|
|
100
100
|
return err instanceof JsonApiError ? err.errors.find((e) => e.code === code) : void 0;
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
|
+
//#region src/types.ts
|
|
104
|
+
/** The JSON:API media type. */
|
|
105
|
+
const JSON_API_MEDIA_TYPE = "application/vnd.api+json";
|
|
106
|
+
/** The Atomic Operations extension URI. */
|
|
107
|
+
const ATOMIC_EXT = "https://jsonapi.org/ext/atomic";
|
|
108
|
+
/**
|
|
109
|
+
* Compose the JSON:API media type with any opted-in `ext`/`profile` parameters. Each parameter
|
|
110
|
+
* is a space-joined, double-quoted URI list, in the canonical order `ext` then `profile` so the
|
|
111
|
+
* output is deterministic (stable for caching/assertions). Empty/absent lists are omitted; with
|
|
112
|
+
* neither, the bare {@link JSON_API_MEDIA_TYPE} is returned (no behaviour change for a plain
|
|
113
|
+
* request). Used for both `Accept` and (when a body is present) `Content-Type`.
|
|
114
|
+
*/
|
|
115
|
+
function mediaType(params = {}) {
|
|
116
|
+
let out = JSON_API_MEDIA_TYPE;
|
|
117
|
+
if (params.ext !== void 0 && params.ext.length > 0) out += `; ext="${params.ext.join(" ")}"`;
|
|
118
|
+
if (params.profiles !== void 0 && params.profiles.length > 0) out += `; profile="${params.profiles.join(" ")}"`;
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The media type for an Atomic Operations request/response: the JSON:API media type carrying
|
|
123
|
+
* the atomic `ext` parameter. Sent as both `Content-Type` and `Accept` on a `client.atomic`
|
|
124
|
+
* batch (per the JSON:API atomic extension).
|
|
125
|
+
*/
|
|
126
|
+
const ATOMIC_MEDIA_TYPE = mediaType({ ext: [ATOMIC_EXT] });
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/request.ts
|
|
129
|
+
const isAbsolute = (path) => /^https?:\/\//i.test(path);
|
|
130
|
+
const RELATIVE_ORIGIN = "http://relative.invalid";
|
|
131
|
+
/**
|
|
132
|
+
* Resolve a server link against `baseUrl` per RFC 3986 and check where it lands. A link on the
|
|
133
|
+
* base's origin is followed; a relative base (e.g. `/api`) takes the page's origin in a browser and
|
|
134
|
+
* otherwise only accepts a link that keeps the host. Anything that isn't plain http(s) is refused.
|
|
135
|
+
*/
|
|
136
|
+
function resolveLink(link, baseUrl) {
|
|
137
|
+
let normalised = link.replace(/[\t\n\r]/g, "");
|
|
138
|
+
let start = 0;
|
|
139
|
+
while (start < normalised.length && normalised.charCodeAt(start) <= 32) start++;
|
|
140
|
+
normalised = normalised.slice(start);
|
|
141
|
+
const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(normalised)?.[1]?.toLowerCase();
|
|
142
|
+
if (scheme !== void 0 && scheme !== "http" && scheme !== "https") throw new Error(`Refusing to follow link "${link}": only http(s) links are followed`);
|
|
143
|
+
const relativeBase = !isAbsolute(baseUrl);
|
|
144
|
+
const page = globalThis.location?.href;
|
|
145
|
+
const base = new URL(baseUrl, relativeBase ? typeof page === "string" ? page : RELATIVE_ORIGIN : void 0);
|
|
146
|
+
const resolved = new URL(link, base);
|
|
147
|
+
const sameOrigin = resolved.origin === base.origin && (scheme === void 0 || /^https?:\/\//i.test(normalised));
|
|
148
|
+
if (!sameOrigin) return {
|
|
149
|
+
url: resolved.href,
|
|
150
|
+
sameOrigin
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
url: relativeBase ? resolved.pathname + resolved.search + resolved.hash : resolved.href,
|
|
154
|
+
sameOrigin
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const append = (parts, key, value) => {
|
|
158
|
+
if (value === void 0 || value === null || value === "") return;
|
|
159
|
+
parts.push(`${key}=${encodeURIComponent(String(value))}`);
|
|
160
|
+
};
|
|
161
|
+
const isPlainObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
162
|
+
/**
|
|
163
|
+
* Append a filter value under its (already-bracketed) key. A plain object is a STRUCTURED filter
|
|
164
|
+
* value — a `Range`/`DateRange` deepObject (`{ min, max }`) — and recurses into nested bracketed
|
|
165
|
+
* keys (`filter[k][min]=`), matching the server's deepObject wire shape; an array goes out once per
|
|
166
|
+
* member as `filter[k][]=` for a filter that takes a list, so a member may hold a comma, and joins
|
|
167
|
+
* with `,` otherwise; a scalar is appended directly. Without the object branch a `{ min, max }` value would reach the
|
|
168
|
+
* wire as `filter[k]=[object Object]` and be silently ignored by the server.
|
|
169
|
+
*/
|
|
170
|
+
const appendFilterValue = (parts, key, value, list = false) => {
|
|
171
|
+
if (isPlainObject$1(value)) {
|
|
172
|
+
for (const [subKey, subValue] of Object.entries(value)) appendFilterValue(parts, `${key}[${subKey}]`, subValue);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (list && Array.isArray(value)) {
|
|
176
|
+
for (const member of value) append(parts, `${key}[]`, member);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
append(parts, key, Array.isArray(value) ? value.join(",") : value);
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Serialise a read query to a query string (no leading `?`). Bracketed keys
|
|
183
|
+
* (`filter[title]`, `page[number]`, `fields[albums]`) are kept literal; only values
|
|
184
|
+
* are percent-encoded. `isListFilter` names the filter keys that take a list, whose array value
|
|
185
|
+
* goes out as `filter[<key>][]` once per member, and `isRelatedListFilter` does the same for a
|
|
186
|
+
* `relatedQuery` entry's filters by include path. Empty/undefined entries are skipped; key order is deterministic
|
|
187
|
+
* (family order, then insertion order within a family) so URLs are stable for caching.
|
|
188
|
+
*/
|
|
189
|
+
function serializeQuery(query, isListFilter, isRelatedListFilter) {
|
|
190
|
+
const parts = [];
|
|
191
|
+
if (query.filter) for (const [key, value] of Object.entries(query.filter)) appendFilterValue(parts, `filter[${key}]`, value, isListFilter?.(key) ?? false);
|
|
192
|
+
if (query.sort !== void 0) append(parts, "sort", Array.isArray(query.sort) ? query.sort.join(",") : query.sort);
|
|
193
|
+
if (query.include) append(parts, "include", query.include.join(","));
|
|
194
|
+
if (query.fields) for (const [type, names] of Object.entries(query.fields)) parts.push(`fields[${type}]=${encodeURIComponent(names.join(","))}`);
|
|
195
|
+
if (query.withCount && query.withCount.length > 0) append(parts, "withCount", query.withCount.join(","));
|
|
196
|
+
for (const [path, entry] of Object.entries(query.relatedQuery ?? {})) {
|
|
197
|
+
for (const [key, value] of Object.entries(entry?.filter ?? {})) appendFilterValue(parts, `relatedQuery[${path}][filter][${key}]`, value, isRelatedListFilter?.(path, key) ?? false);
|
|
198
|
+
if (entry?.sort !== void 0) append(parts, `relatedQuery[${path}][sort]`, typeof entry.sort === "string" ? entry.sort : entry.sort.join(","));
|
|
199
|
+
}
|
|
200
|
+
if (query.page) for (const [key, value] of Object.entries(query.page)) append(parts, `page[${key}]`, Array.isArray(value) ? value.join(",") : value);
|
|
201
|
+
return parts.join("&");
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Execute a request: build the URL (a server link resolved against `baseUrl` and held to its
|
|
205
|
+
* origin, an absolute path verbatim, else `baseUrl + path`), apply content negotiation and any async per-request headers,
|
|
206
|
+
* then drive the transport. A 2xx with a body parses to a {@link Document}; an empty /
|
|
207
|
+
* 204 body resolves to `undefined`. A non-2xx throws a {@link JsonApiError} carrying the
|
|
208
|
+
* parsed error objects (tolerating a non-JSON error body with an empty list).
|
|
209
|
+
*/
|
|
210
|
+
async function execute(ctx, req) {
|
|
211
|
+
return parseDocument((await send(ctx, req)).body);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Execute a request as {@link execute} does, keeping the response's status and headers. With
|
|
215
|
+
* `seeOther`, a `303` the transport didn't follow resolves with no document instead of throwing,
|
|
216
|
+
* so the caller can read its `Location`.
|
|
217
|
+
*/
|
|
218
|
+
async function executeResponse(ctx, req, seeOther = false) {
|
|
219
|
+
const res = await send(ctx, req, void 0, seeOther);
|
|
220
|
+
return {
|
|
221
|
+
status: res.status,
|
|
222
|
+
headers: res.headers,
|
|
223
|
+
document: res.status === 303 ? void 0 : parseDocument(res.body)
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async function executeRaw(ctx, req, as) {
|
|
227
|
+
const res = await send(ctx, req, as === "text" ? void 0 : as);
|
|
228
|
+
if (as === "text") return res.body === "" ? void 0 : res.body;
|
|
229
|
+
if (res.status === 204) return;
|
|
230
|
+
if (res.binary === void 0) throw new Error("The transport returned no binary body for a request that asked for one; a custom transport must read the response as binary when the request sets responseType.");
|
|
231
|
+
return res.binary;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Build the URL (a server link resolved against `baseUrl` and held to its origin, an absolute
|
|
235
|
+
* path verbatim, else `baseUrl + path`), apply content negotiation and any async per-request
|
|
236
|
+
* headers, then drive the transport. A non-2xx throws a {@link JsonApiError} carrying the parsed
|
|
237
|
+
* error objects (tolerating a non-JSON error body with an empty list).
|
|
238
|
+
*/
|
|
239
|
+
async function send(ctx, req, responseType, seeOther = false) {
|
|
240
|
+
let url;
|
|
241
|
+
let sendHeaders = true;
|
|
242
|
+
if (req.link) {
|
|
243
|
+
const link = resolveLink(req.path, ctx.baseUrl);
|
|
244
|
+
if (!link.sameOrigin && ctx.allowCrossOriginLinks !== true) throw new Error(`Refusing to follow link "${req.path}": it leaves the base URL's origin (set allowCrossOriginLinks to follow it without the configured headers)`);
|
|
245
|
+
url = link.url;
|
|
246
|
+
sendHeaders = link.sameOrigin;
|
|
247
|
+
} else url = isAbsolute(req.path) ? req.path : ctx.baseUrl + req.path;
|
|
248
|
+
if (req.query) {
|
|
249
|
+
const qs = serializeQuery(req.query, req.listFilter, req.relatedListFilter);
|
|
250
|
+
if (qs) url += (url.includes("?") ? "&" : "?") + qs;
|
|
251
|
+
}
|
|
252
|
+
const negotiated = mediaType({
|
|
253
|
+
ext: req.ext,
|
|
254
|
+
profiles: req.profiles
|
|
255
|
+
});
|
|
256
|
+
const headers = { Accept: req.accept ?? negotiated };
|
|
257
|
+
const transportReq = {
|
|
258
|
+
method: req.method,
|
|
259
|
+
url,
|
|
260
|
+
headers
|
|
261
|
+
};
|
|
262
|
+
if (req.signal !== void 0) transportReq.signal = req.signal;
|
|
263
|
+
if (responseType !== void 0) transportReq.responseType = responseType;
|
|
264
|
+
if (req.body !== void 0 || req.method.toUpperCase() === "POST") {
|
|
265
|
+
const contentType = req.contentType === void 0 ? negotiated : req.contentType;
|
|
266
|
+
if (contentType !== null) headers["Content-Type"] = contentType;
|
|
267
|
+
}
|
|
268
|
+
if (typeof req.body === "string" && req.raw) transportReq.body = req.body;
|
|
269
|
+
else if (req.raw && isRawBody(req.body)) transportReq.rawBody = req.body;
|
|
270
|
+
else if (req.body !== void 0) transportReq.body = JSON.stringify(req.body);
|
|
271
|
+
if (ctx.headers && sendHeaders) mergeHeaders(headers, await ctx.headers());
|
|
272
|
+
const res = await ctx.transport(transportReq);
|
|
273
|
+
if (res.status >= 200 && res.status < 300 || seeOther && res.status === 303) return res;
|
|
274
|
+
throw new JsonApiError(res.status, parseErrors(res.body));
|
|
275
|
+
}
|
|
276
|
+
/** Whether a raw body goes to the transport as is rather than through `JSON.stringify`. */
|
|
277
|
+
function isRawBody(body) {
|
|
278
|
+
return typeof Blob !== "undefined" && body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof FormData !== "undefined" && body instanceof FormData || typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Merge a `HeadersInit` (object / tuple array / `Headers`) into the outgoing map,
|
|
282
|
+
* preserving the caller's casing (unlike the WHATWG `Headers`, which lowercases). The
|
|
283
|
+
* caller's headers override the runtime defaults, so per-request `Accept` etc. can win.
|
|
284
|
+
*/
|
|
285
|
+
function mergeHeaders(into, extra) {
|
|
286
|
+
if (extra instanceof Headers) extra.forEach((value, key) => {
|
|
287
|
+
into[key] = value;
|
|
288
|
+
});
|
|
289
|
+
else if (Array.isArray(extra)) {
|
|
290
|
+
for (const [key, value] of extra) if (key !== void 0 && value !== void 0) into[key] = String(value);
|
|
291
|
+
} else for (const [key, value] of Object.entries(extra)) into[key] = String(value);
|
|
292
|
+
}
|
|
293
|
+
function parseDocument(body) {
|
|
294
|
+
if (body === "") return;
|
|
295
|
+
return JSON.parse(body);
|
|
296
|
+
}
|
|
297
|
+
function parseErrors(body) {
|
|
298
|
+
if (body === "") return [];
|
|
299
|
+
try {
|
|
300
|
+
const doc = JSON.parse(body);
|
|
301
|
+
return Array.isArray(doc.errors) ? doc.errors : [];
|
|
302
|
+
} catch {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/accepted.ts
|
|
308
|
+
/** Thrown when a job is still pending when the poll's timeout runs out. */
|
|
309
|
+
var PollTimeoutError = class extends Error {
|
|
310
|
+
contentLocation;
|
|
311
|
+
timeout;
|
|
312
|
+
constructor(contentLocation, timeout) {
|
|
313
|
+
super(`The job at ${contentLocation} was still pending after ${timeout}ms`);
|
|
314
|
+
this.name = "PollTimeoutError";
|
|
315
|
+
this.contentLocation = contentLocation;
|
|
316
|
+
this.timeout = timeout;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const ACCEPTED = Symbol.for("@haddowg/json-api-client/accepted");
|
|
320
|
+
/** Whether a write's result is an {@link Accepted} job rather than its normal result. */
|
|
321
|
+
function isAccepted(value) {
|
|
322
|
+
return typeof value === "object" && value !== null && ACCEPTED in value;
|
|
323
|
+
}
|
|
324
|
+
const DEFAULT_TIMEOUT = 300 * 1e3;
|
|
325
|
+
const DEFAULT_INTERVAL = 1e3;
|
|
326
|
+
/** A response header by name, whatever case the transport wrote it in. */
|
|
327
|
+
function header(headers, name) {
|
|
328
|
+
const wanted = name.toLowerCase();
|
|
329
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === wanted) return value;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* A `Retry-After` value in seconds: delta-seconds as sent, an HTTP date as the seconds left until
|
|
333
|
+
* it, rounded up and never negative. `undefined` when absent or unreadable.
|
|
334
|
+
*/
|
|
335
|
+
function parseRetryAfter(value, now = Date.now()) {
|
|
336
|
+
const trimmed = value?.trim();
|
|
337
|
+
if (trimmed === void 0 || trimmed === "") return;
|
|
338
|
+
if (/^\d+$/.test(trimmed)) return Number(trimmed);
|
|
339
|
+
const at = Date.parse(trimmed);
|
|
340
|
+
return Number.isNaN(at) ? void 0 : Math.max(0, Math.ceil((at - now) / 1e3));
|
|
341
|
+
}
|
|
342
|
+
/** Whether a document is a meta-only one: no primary `data` member. */
|
|
343
|
+
const isMetaOnly = (doc) => doc === void 0 || !("data" in doc);
|
|
344
|
+
/** The `type` of a document's single primary resource, if it has one. */
|
|
345
|
+
function primaryType(doc) {
|
|
346
|
+
const data = doc?.data;
|
|
347
|
+
return typeof data === "object" && data !== null && !Array.isArray(data) ? data["type"] : void 0;
|
|
348
|
+
}
|
|
349
|
+
/** Build the {@link Accepted} for a `202` response. */
|
|
350
|
+
function toAccepted(target, res) {
|
|
351
|
+
const contentLocation = header(res.headers, "Content-Location");
|
|
352
|
+
if (contentLocation === void 0) throw new Error("The server answered 202 Accepted without a Content-Location to poll.");
|
|
353
|
+
const metaJob = isMetaOnly(res.document);
|
|
354
|
+
const retryAfter = parseRetryAfter(header(res.headers, "Retry-After"));
|
|
355
|
+
const value = {
|
|
356
|
+
job: target.job(res.document),
|
|
357
|
+
contentLocation,
|
|
358
|
+
retryAfter
|
|
359
|
+
};
|
|
360
|
+
Object.defineProperty(value, ACCEPTED, {
|
|
361
|
+
value: true,
|
|
362
|
+
enumerable: false
|
|
363
|
+
});
|
|
364
|
+
Object.defineProperty(value, "$poll", {
|
|
365
|
+
value: (options) => poll(target, contentLocation, metaJob, retryAfter, options),
|
|
366
|
+
enumerable: false
|
|
367
|
+
});
|
|
368
|
+
return value;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Poll the job URL. A `2xx` still holding the job (its type, or a meta-only document for a
|
|
372
|
+
* meta-only job) is pending: wait for its `Retry-After`, else the `202`'s, else a second. A `303`
|
|
373
|
+
* the transport didn't follow is done, and its `Location` is fetched; any other `2xx` is the
|
|
374
|
+
* redirect already followed. A non-2xx throws the usual {@link JsonApiError}.
|
|
375
|
+
*/
|
|
376
|
+
async function poll(target, contentLocation, metaJob, acceptedRetryAfter, options = {}) {
|
|
377
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
378
|
+
const signal = options.signal;
|
|
379
|
+
const deadline = Date.now() + timeout;
|
|
380
|
+
const get = (path, seeOther) => executeResponse(target.request, {
|
|
381
|
+
method: "GET",
|
|
382
|
+
path,
|
|
383
|
+
link: true,
|
|
384
|
+
...signal !== void 0 ? { signal } : {}
|
|
385
|
+
}, seeOther);
|
|
386
|
+
const holdsJob = (doc) => doc !== void 0 && (primaryType(doc) === target.jobType || metaJob && isMetaOnly(doc));
|
|
387
|
+
let delay = (acceptedRetryAfter ?? DEFAULT_INTERVAL / 1e3) * 1e3;
|
|
388
|
+
for (;;) {
|
|
389
|
+
const remaining = deadline - Date.now();
|
|
390
|
+
if (remaining <= 0) throw new PollTimeoutError(contentLocation, timeout);
|
|
391
|
+
await sleep(Math.min(delay, remaining), signal);
|
|
392
|
+
const res = await get(contentLocation, true);
|
|
393
|
+
if (res.status === 303) {
|
|
394
|
+
const location = header(res.headers, "Location");
|
|
395
|
+
if (location === void 0) throw new Error(`The job at ${contentLocation} answered 303 without a Location.`);
|
|
396
|
+
return target.complete((await get(location, false)).document);
|
|
397
|
+
}
|
|
398
|
+
if (!holdsJob(res.document)) return target.complete(res.document);
|
|
399
|
+
delay = (parseRetryAfter(header(res.headers, "Retry-After")) ?? acceptedRetryAfter ?? DEFAULT_INTERVAL / 1e3) * 1e3;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/** Resolve after `ms`, or reject with the signal's reason when it aborts first. */
|
|
403
|
+
function sleep(ms, signal) {
|
|
404
|
+
return new Promise((resolve, reject) => {
|
|
405
|
+
if (signal?.aborted) {
|
|
406
|
+
reject(signal.reason);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const onAbort = () => {
|
|
410
|
+
clearTimeout(timer);
|
|
411
|
+
reject(signal.reason);
|
|
412
|
+
};
|
|
413
|
+
const timer = setTimeout(() => {
|
|
414
|
+
signal?.removeEventListener("abort", onAbort);
|
|
415
|
+
resolve();
|
|
416
|
+
}, ms);
|
|
417
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
103
421
|
//#region src/pagination.ts
|
|
104
422
|
/** The wire key for each role when the server keeps the default names. */
|
|
105
423
|
const CANONICAL_PAGE_KEYS = {
|
|
@@ -527,197 +845,6 @@ function relatedPaginatorKind(relation, ctx) {
|
|
|
527
845
|
return resolvePaginator(relatedPaginator(relation, ctx)).kind;
|
|
528
846
|
}
|
|
529
847
|
//#endregion
|
|
530
|
-
//#region src/types.ts
|
|
531
|
-
/** The JSON:API media type. */
|
|
532
|
-
const JSON_API_MEDIA_TYPE = "application/vnd.api+json";
|
|
533
|
-
/** The Atomic Operations extension URI. */
|
|
534
|
-
const ATOMIC_EXT = "https://jsonapi.org/ext/atomic";
|
|
535
|
-
/**
|
|
536
|
-
* Compose the JSON:API media type with any opted-in `ext`/`profile` parameters. Each parameter
|
|
537
|
-
* is a space-joined, double-quoted URI list, in the canonical order `ext` then `profile` so the
|
|
538
|
-
* output is deterministic (stable for caching/assertions). Empty/absent lists are omitted; with
|
|
539
|
-
* neither, the bare {@link JSON_API_MEDIA_TYPE} is returned (no behaviour change for a plain
|
|
540
|
-
* request). Used for both `Accept` and (when a body is present) `Content-Type`.
|
|
541
|
-
*/
|
|
542
|
-
function mediaType(params = {}) {
|
|
543
|
-
let out = JSON_API_MEDIA_TYPE;
|
|
544
|
-
if (params.ext !== void 0 && params.ext.length > 0) out += `; ext="${params.ext.join(" ")}"`;
|
|
545
|
-
if (params.profiles !== void 0 && params.profiles.length > 0) out += `; profile="${params.profiles.join(" ")}"`;
|
|
546
|
-
return out;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* The media type for an Atomic Operations request/response: the JSON:API media type carrying
|
|
550
|
-
* the atomic `ext` parameter. Sent as both `Content-Type` and `Accept` on a `client.atomic`
|
|
551
|
-
* batch (per the JSON:API atomic extension).
|
|
552
|
-
*/
|
|
553
|
-
const ATOMIC_MEDIA_TYPE = mediaType({ ext: [ATOMIC_EXT] });
|
|
554
|
-
//#endregion
|
|
555
|
-
//#region src/request.ts
|
|
556
|
-
const isAbsolute = (path) => /^https?:\/\//i.test(path);
|
|
557
|
-
const RELATIVE_ORIGIN = "http://relative.invalid";
|
|
558
|
-
/**
|
|
559
|
-
* Resolve a server link against `baseUrl` per RFC 3986 and check where it lands. A link on the
|
|
560
|
-
* base's origin is followed; a relative base (e.g. `/api`) takes the page's origin in a browser and
|
|
561
|
-
* otherwise only accepts a link that keeps the host. Anything that isn't plain http(s) is refused.
|
|
562
|
-
*/
|
|
563
|
-
function resolveLink(link, baseUrl) {
|
|
564
|
-
let normalised = link.replace(/[\t\n\r]/g, "");
|
|
565
|
-
let start = 0;
|
|
566
|
-
while (start < normalised.length && normalised.charCodeAt(start) <= 32) start++;
|
|
567
|
-
normalised = normalised.slice(start);
|
|
568
|
-
const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(normalised)?.[1]?.toLowerCase();
|
|
569
|
-
if (scheme !== void 0 && scheme !== "http" && scheme !== "https") throw new Error(`Refusing to follow link "${link}": only http(s) links are followed`);
|
|
570
|
-
const relativeBase = !isAbsolute(baseUrl);
|
|
571
|
-
const page = globalThis.location?.href;
|
|
572
|
-
const base = new URL(baseUrl, relativeBase ? typeof page === "string" ? page : RELATIVE_ORIGIN : void 0);
|
|
573
|
-
const resolved = new URL(link, base);
|
|
574
|
-
const sameOrigin = resolved.origin === base.origin && (scheme === void 0 || /^https?:\/\//i.test(normalised));
|
|
575
|
-
if (!sameOrigin) return {
|
|
576
|
-
url: resolved.href,
|
|
577
|
-
sameOrigin
|
|
578
|
-
};
|
|
579
|
-
return {
|
|
580
|
-
url: relativeBase ? resolved.pathname + resolved.search + resolved.hash : resolved.href,
|
|
581
|
-
sameOrigin
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
const append = (parts, key, value) => {
|
|
585
|
-
if (value === void 0 || value === null || value === "") return;
|
|
586
|
-
parts.push(`${key}=${encodeURIComponent(String(value))}`);
|
|
587
|
-
};
|
|
588
|
-
const isPlainObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
589
|
-
/**
|
|
590
|
-
* Append a filter value under its (already-bracketed) key. A plain object is a STRUCTURED filter
|
|
591
|
-
* value — a `Range`/`DateRange` deepObject (`{ min, max }`) — and recurses into nested bracketed
|
|
592
|
-
* keys (`filter[k][min]=`), matching the server's deepObject wire shape; an array goes out once per
|
|
593
|
-
* member as `filter[k][]=` for a filter that takes a list, so a member may hold a comma, and joins
|
|
594
|
-
* with `,` otherwise; a scalar is appended directly. Without the object branch a `{ min, max }` value would reach the
|
|
595
|
-
* wire as `filter[k]=[object Object]` and be silently ignored by the server.
|
|
596
|
-
*/
|
|
597
|
-
const appendFilterValue = (parts, key, value, list = false) => {
|
|
598
|
-
if (isPlainObject$1(value)) {
|
|
599
|
-
for (const [subKey, subValue] of Object.entries(value)) appendFilterValue(parts, `${key}[${subKey}]`, subValue);
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
if (list && Array.isArray(value)) {
|
|
603
|
-
for (const member of value) append(parts, `${key}[]`, member);
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
append(parts, key, Array.isArray(value) ? value.join(",") : value);
|
|
607
|
-
};
|
|
608
|
-
/**
|
|
609
|
-
* Serialise a read query to a query string (no leading `?`). Bracketed keys
|
|
610
|
-
* (`filter[title]`, `page[number]`, `fields[albums]`) are kept literal; only values
|
|
611
|
-
* are percent-encoded. `isListFilter` names the filter keys that take a list, whose array value
|
|
612
|
-
* goes out as `filter[<key>][]` once per member, and `isRelatedListFilter` does the same for a
|
|
613
|
-
* `relatedQuery` entry's filters by include path. Empty/undefined entries are skipped; key order is deterministic
|
|
614
|
-
* (family order, then insertion order within a family) so URLs are stable for caching.
|
|
615
|
-
*/
|
|
616
|
-
function serializeQuery(query, isListFilter, isRelatedListFilter) {
|
|
617
|
-
const parts = [];
|
|
618
|
-
if (query.filter) for (const [key, value] of Object.entries(query.filter)) appendFilterValue(parts, `filter[${key}]`, value, isListFilter?.(key) ?? false);
|
|
619
|
-
if (query.sort !== void 0) append(parts, "sort", Array.isArray(query.sort) ? query.sort.join(",") : query.sort);
|
|
620
|
-
if (query.include) append(parts, "include", query.include.join(","));
|
|
621
|
-
if (query.fields) for (const [type, names] of Object.entries(query.fields)) parts.push(`fields[${type}]=${encodeURIComponent(names.join(","))}`);
|
|
622
|
-
if (query.withCount && query.withCount.length > 0) append(parts, "withCount", query.withCount.join(","));
|
|
623
|
-
for (const [path, entry] of Object.entries(query.relatedQuery ?? {})) {
|
|
624
|
-
for (const [key, value] of Object.entries(entry?.filter ?? {})) appendFilterValue(parts, `relatedQuery[${path}][filter][${key}]`, value, isRelatedListFilter?.(path, key) ?? false);
|
|
625
|
-
if (entry?.sort !== void 0) append(parts, `relatedQuery[${path}][sort]`, typeof entry.sort === "string" ? entry.sort : entry.sort.join(","));
|
|
626
|
-
}
|
|
627
|
-
if (query.page) for (const [key, value] of Object.entries(query.page)) append(parts, `page[${key}]`, Array.isArray(value) ? value.join(",") : value);
|
|
628
|
-
return parts.join("&");
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Execute a request: build the URL (a server link resolved against `baseUrl` and held to its
|
|
632
|
-
* origin, an absolute path verbatim, else `baseUrl + path`), apply content negotiation and any async per-request headers,
|
|
633
|
-
* then drive the transport. A 2xx with a body parses to a {@link Document}; an empty /
|
|
634
|
-
* 204 body resolves to `undefined`. A non-2xx throws a {@link JsonApiError} carrying the
|
|
635
|
-
* parsed error objects (tolerating a non-JSON error body with an empty list).
|
|
636
|
-
*/
|
|
637
|
-
async function execute(ctx, req) {
|
|
638
|
-
return parseDocument((await send(ctx, req)).body);
|
|
639
|
-
}
|
|
640
|
-
async function executeRaw(ctx, req, as) {
|
|
641
|
-
const res = await send(ctx, req, as === "text" ? void 0 : as);
|
|
642
|
-
if (as === "text") return res.body === "" ? void 0 : res.body;
|
|
643
|
-
if (res.status === 204) return;
|
|
644
|
-
if (res.binary === void 0) throw new Error("The transport returned no binary body for a request that asked for one; a custom transport must read the response as binary when the request sets responseType.");
|
|
645
|
-
return res.binary;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Build the URL (a server link resolved against `baseUrl` and held to its origin, an absolute
|
|
649
|
-
* path verbatim, else `baseUrl + path`), apply content negotiation and any async per-request
|
|
650
|
-
* headers, then drive the transport. A non-2xx throws a {@link JsonApiError} carrying the parsed
|
|
651
|
-
* error objects (tolerating a non-JSON error body with an empty list).
|
|
652
|
-
*/
|
|
653
|
-
async function send(ctx, req, responseType) {
|
|
654
|
-
let url;
|
|
655
|
-
let sendHeaders = true;
|
|
656
|
-
if (req.link) {
|
|
657
|
-
const link = resolveLink(req.path, ctx.baseUrl);
|
|
658
|
-
if (!link.sameOrigin && ctx.allowCrossOriginLinks !== true) throw new Error(`Refusing to follow link "${req.path}": it leaves the base URL's origin (set allowCrossOriginLinks to follow it without the configured headers)`);
|
|
659
|
-
url = link.url;
|
|
660
|
-
sendHeaders = link.sameOrigin;
|
|
661
|
-
} else url = isAbsolute(req.path) ? req.path : ctx.baseUrl + req.path;
|
|
662
|
-
if (req.query) {
|
|
663
|
-
const qs = serializeQuery(req.query, req.listFilter, req.relatedListFilter);
|
|
664
|
-
if (qs) url += (url.includes("?") ? "&" : "?") + qs;
|
|
665
|
-
}
|
|
666
|
-
const negotiated = mediaType({
|
|
667
|
-
ext: req.ext,
|
|
668
|
-
profiles: req.profiles
|
|
669
|
-
});
|
|
670
|
-
const headers = { Accept: req.accept ?? negotiated };
|
|
671
|
-
const transportReq = {
|
|
672
|
-
method: req.method,
|
|
673
|
-
url,
|
|
674
|
-
headers
|
|
675
|
-
};
|
|
676
|
-
if (req.signal !== void 0) transportReq.signal = req.signal;
|
|
677
|
-
if (responseType !== void 0) transportReq.responseType = responseType;
|
|
678
|
-
if (req.body !== void 0 || req.method.toUpperCase() === "POST") {
|
|
679
|
-
const contentType = req.contentType === void 0 ? negotiated : req.contentType;
|
|
680
|
-
if (contentType !== null) headers["Content-Type"] = contentType;
|
|
681
|
-
}
|
|
682
|
-
if (typeof req.body === "string" && req.raw) transportReq.body = req.body;
|
|
683
|
-
else if (req.raw && isRawBody(req.body)) transportReq.rawBody = req.body;
|
|
684
|
-
else if (req.body !== void 0) transportReq.body = JSON.stringify(req.body);
|
|
685
|
-
if (ctx.headers && sendHeaders) mergeHeaders(headers, await ctx.headers());
|
|
686
|
-
const res = await ctx.transport(transportReq);
|
|
687
|
-
if (res.status >= 200 && res.status < 300) return res;
|
|
688
|
-
throw new JsonApiError(res.status, parseErrors(res.body));
|
|
689
|
-
}
|
|
690
|
-
/** Whether a raw body goes to the transport as is rather than through `JSON.stringify`. */
|
|
691
|
-
function isRawBody(body) {
|
|
692
|
-
return typeof Blob !== "undefined" && body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof FormData !== "undefined" && body instanceof FormData || typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams;
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Merge a `HeadersInit` (object / tuple array / `Headers`) into the outgoing map,
|
|
696
|
-
* preserving the caller's casing (unlike the WHATWG `Headers`, which lowercases). The
|
|
697
|
-
* caller's headers override the runtime defaults, so per-request `Accept` etc. can win.
|
|
698
|
-
*/
|
|
699
|
-
function mergeHeaders(into, extra) {
|
|
700
|
-
if (extra instanceof Headers) extra.forEach((value, key) => {
|
|
701
|
-
into[key] = value;
|
|
702
|
-
});
|
|
703
|
-
else if (Array.isArray(extra)) {
|
|
704
|
-
for (const [key, value] of extra) if (key !== void 0 && value !== void 0) into[key] = String(value);
|
|
705
|
-
} else for (const [key, value] of Object.entries(extra)) into[key] = String(value);
|
|
706
|
-
}
|
|
707
|
-
function parseDocument(body) {
|
|
708
|
-
if (body === "") return;
|
|
709
|
-
return JSON.parse(body);
|
|
710
|
-
}
|
|
711
|
-
function parseErrors(body) {
|
|
712
|
-
if (body === "") return [];
|
|
713
|
-
try {
|
|
714
|
-
const doc = JSON.parse(body);
|
|
715
|
-
return Array.isArray(doc.errors) ? doc.errors : [];
|
|
716
|
-
} catch {
|
|
717
|
-
return [];
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
//#endregion
|
|
721
848
|
//#region src/serialize-write.ts
|
|
722
849
|
/** Per-edge writable pivot data, supplied on a to-many member as the `$pivot` key. */
|
|
723
850
|
const PIVOT_KEY = "$pivot";
|
|
@@ -1287,10 +1414,27 @@ function writeQuery(opts) {
|
|
|
1287
1414
|
}
|
|
1288
1415
|
return Object.keys(query).length > 0 ? query : void 0;
|
|
1289
1416
|
}
|
|
1417
|
+
/** The poll options a call's `wait` asks for, or `undefined` when it doesn't wait. */
|
|
1418
|
+
const waitOptions = (wait) => wait === true ? {} : wait === false ? void 0 : wait;
|
|
1419
|
+
/**
|
|
1420
|
+
* Answer a `202` the operation declares with an `Accepted`, or with its result when the caller
|
|
1421
|
+
* waits. The job is materialised, or is the top-level `meta` of a meta-only document; `complete`
|
|
1422
|
+
* shapes the document the job URL finally answers with, as the operation shapes its own.
|
|
1423
|
+
*/
|
|
1424
|
+
function answerAccepted(ctx, accepted, res, complete, wait) {
|
|
1425
|
+
const value = toAccepted({
|
|
1426
|
+
request: ctx.request,
|
|
1427
|
+
jobType: accepted.jobType,
|
|
1428
|
+
job: (doc) => doc === void 0 || !("data" in doc) ? doc?.meta ?? {} : materialise(doc, ctx.materialise),
|
|
1429
|
+
complete
|
|
1430
|
+
}, res);
|
|
1431
|
+
return wait === void 0 ? value : value.$poll(wait);
|
|
1432
|
+
}
|
|
1290
1433
|
/**
|
|
1291
1434
|
* Drive a write: fill the path template, attach the body (and any `include`/`fields` query),
|
|
1292
1435
|
* execute, and materialise the response (`undefined` for a `204`/no body — so create/update
|
|
1293
|
-
* return the resource and delete/`204` relationship mutations resolve `undefined`/`void`).
|
|
1436
|
+
* return the resource and delete/`204` relationship mutations resolve `undefined`/`void`). A
|
|
1437
|
+
* `202` the write declares resolves to an `Accepted` job, or with `wait` to the polled result.
|
|
1294
1438
|
* On a thrown {@link JsonApiError}, each error's flat `path` is populated (via `spec.remap`)
|
|
1295
1439
|
* before it propagates, so a caller's `byPath()` keys are the flat input shape.
|
|
1296
1440
|
*/
|
|
@@ -1303,14 +1447,17 @@ async function runWrite(ctx, spec) {
|
|
|
1303
1447
|
body: spec.body
|
|
1304
1448
|
};
|
|
1305
1449
|
if (spec.query !== void 0) req.query = spec.query;
|
|
1306
|
-
|
|
1450
|
+
if (spec.wait?.signal !== void 0) req.signal = spec.wait.signal;
|
|
1451
|
+
let res;
|
|
1307
1452
|
try {
|
|
1308
|
-
|
|
1453
|
+
res = await executeResponse(ctx.request, req);
|
|
1309
1454
|
} catch (error) {
|
|
1310
1455
|
if (error instanceof JsonApiError) throw spec.remap(error);
|
|
1311
1456
|
throw error;
|
|
1312
1457
|
}
|
|
1313
|
-
|
|
1458
|
+
const complete = (doc) => doc === void 0 ? void 0 : materialise(doc, ctx.materialise, spec.linkage ?? false);
|
|
1459
|
+
if (res.status === 202 && spec.accepted !== void 0) return answerAccepted(ctx, spec.accepted, res, complete, spec.wait);
|
|
1460
|
+
return complete(res.document);
|
|
1314
1461
|
}
|
|
1315
1462
|
/**
|
|
1316
1463
|
* Invoke a custom action over its declared HTTP method (`action.method`, default `POST`) at its
|
|
@@ -1333,7 +1480,8 @@ async function runWrite(ctx, spec) {
|
|
|
1333
1480
|
* `ActionLocation` and never follows it. An action declaring `rawOutput` answers in the media type
|
|
1334
1481
|
* the caller picks with `options.accept`: JSON:API as above, or a `string`, a `Blob` or
|
|
1335
1482
|
* `ArrayBuffer`, or parsed JSON by the media type's kind. A collection action that takes filters
|
|
1336
|
-
* sends `options.filter` in the query string as a collection read does.
|
|
1483
|
+
* sends `options.filter` in the query string as a collection read does. A `202` the action
|
|
1484
|
+
* declares resolves to an `Accepted` job, or with `options.wait` to the value its job URL ends at.
|
|
1337
1485
|
*/
|
|
1338
1486
|
async function runAction(ctx, action, vars, input, options = {}) {
|
|
1339
1487
|
const req = {
|
|
@@ -1370,20 +1518,33 @@ async function runAction(ctx, action, vars, input, options = {}) {
|
|
|
1370
1518
|
const text = await executeRaw(ctx.request, req, "text");
|
|
1371
1519
|
return raw.kind === "json" && text !== void 0 ? JSON.parse(text) : text;
|
|
1372
1520
|
}
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1521
|
+
const res = await executeResponse(ctx.request, req);
|
|
1522
|
+
const complete = (doc) => actionValue(ctx, action, doc);
|
|
1523
|
+
if (res.status === 202 && action.accepted !== void 0) {
|
|
1524
|
+
const wait = waitOptions(options.wait);
|
|
1525
|
+
const signal = wait?.signal ?? options.signal;
|
|
1526
|
+
return answerAccepted(ctx, action.accepted, res, complete, wait === void 0 || signal === void 0 ? wait : {
|
|
1527
|
+
...wait,
|
|
1528
|
+
signal
|
|
1529
|
+
});
|
|
1378
1530
|
}
|
|
1379
|
-
|
|
1380
|
-
if (action.output === "meta") return doc.meta;
|
|
1381
|
-
return materialise(doc, ctx.materialise);
|
|
1531
|
+
return complete(res.document);
|
|
1382
1532
|
} catch (error) {
|
|
1383
1533
|
if (remap !== void 0 && error instanceof JsonApiError) throw remap(error);
|
|
1384
1534
|
throw error;
|
|
1385
1535
|
}
|
|
1386
1536
|
}
|
|
1537
|
+
/** Shape an action's JSON:API answer by its declared `output`, or its `location`. */
|
|
1538
|
+
function actionValue(ctx, action, doc) {
|
|
1539
|
+
if (action.location !== void 0) {
|
|
1540
|
+
const location = doc === void 0 ? void 0 : readActionLocation(doc, action.location);
|
|
1541
|
+
if (location !== void 0) return location;
|
|
1542
|
+
if (action.output === "location") throw new Error("The action answered without the location document it declares.");
|
|
1543
|
+
}
|
|
1544
|
+
if (action.output === "none" || action.output === "location" || doc === void 0) return;
|
|
1545
|
+
if (action.output === "meta") return doc.meta;
|
|
1546
|
+
return materialise(doc, ctx.materialise);
|
|
1547
|
+
}
|
|
1387
1548
|
/**
|
|
1388
1549
|
* The request media type an action with several (`inputMedia`) sends: the caller's pick, matched
|
|
1389
1550
|
* exactly or through a declared wildcard such as `image/*`, else JSON:API when listed, else the
|
|
@@ -1559,7 +1720,9 @@ function resourceHandle(ctx, type, id) {
|
|
|
1559
1720
|
method: "PATCH",
|
|
1560
1721
|
body: toDocument(ctx.descriptor, type, patch, { id }),
|
|
1561
1722
|
query: writeQuery(opts),
|
|
1562
|
-
remap: (error) => withRemappedPaths(error, ctx.descriptor, type)
|
|
1723
|
+
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1724
|
+
accepted: ctx.descriptor[type]?.accepted?.update,
|
|
1725
|
+
wait: waitOptions(opts?.wait)
|
|
1563
1726
|
}),
|
|
1564
1727
|
delete: () => runWrite(ctx, {
|
|
1565
1728
|
type,
|
|
@@ -1589,7 +1752,9 @@ function typeAccessor(ctx, type) {
|
|
|
1589
1752
|
method: "POST",
|
|
1590
1753
|
body: toDocument(ctx.descriptor, type, input),
|
|
1591
1754
|
query: writeQuery(opts),
|
|
1592
|
-
remap: (error) => withRemappedPaths(error, ctx.descriptor, type)
|
|
1755
|
+
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1756
|
+
accepted: ctx.descriptor[type]?.accepted?.create,
|
|
1757
|
+
wait: waitOptions(opts?.wait)
|
|
1593
1758
|
}),
|
|
1594
1759
|
id: (id) => resourceHandle(ctx, type, id),
|
|
1595
1760
|
actions: actionsAccessor(ctx, type, "collection", {})
|
|
@@ -1659,6 +1824,6 @@ function isPolymorphic(relation) {
|
|
|
1659
1824
|
return relation.polymorphic ?? relation.types.length > 1;
|
|
1660
1825
|
}
|
|
1661
1826
|
//#endregion
|
|
1662
|
-
export { ATOMIC_EXT, ATOMIC_MEDIA_TYPE, CANONICAL_PAGE_KEYS, HANDLE_RESERVED, JSON_API_MEDIA_TYPE, JsonApiError, StructuralGuardError, assertJsonApiDocument, createClient, execute, executeRaw, fetchTransport, findError, hasErrorCode, isActionLocation, isPolymorphic, listFilterMatcher, materialise, mediaType, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
1827
|
+
export { ATOMIC_EXT, ATOMIC_MEDIA_TYPE, CANONICAL_PAGE_KEYS, HANDLE_RESERVED, JSON_API_MEDIA_TYPE, JsonApiError, PollTimeoutError, StructuralGuardError, assertJsonApiDocument, createClient, execute, executeRaw, executeResponse, fetchTransport, findError, hasErrorCode, isAccepted, isActionLocation, isPolymorphic, listFilterMatcher, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
1663
1828
|
|
|
1664
1829
|
//# sourceMappingURL=index.mjs.map
|