@haddowg/json-api-client 1.16.0 → 1.18.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/README.md +20 -0
- package/dist/ajv.d.cts +1 -1
- package/dist/ajv.d.mts +1 -1
- package/dist/index.cjs +426 -207
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +423 -208
- package/dist/index.mjs.map +1 -1
- package/dist/{validate-DCMTndv-.d.cts → validate-Cknhw9k7.d.cts} +311 -30
- package/dist/validate-Cknhw9k7.d.cts.map +1 -0
- package/dist/{validate-DCMTndv-.d.mts → validate-Cknhw9k7.d.mts} +311 -30
- package/dist/validate-Cknhw9k7.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/validate-DCMTndv-.d.cts.map +0 -1
- package/dist/validate-DCMTndv-.d.mts.map +0 -1
|
@@ -218,6 +218,14 @@ interface InputMedia {
|
|
|
218
218
|
mediaType: string;
|
|
219
219
|
kind: InputMediaKind;
|
|
220
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* A `202 Accepted` an operation declares: the server may accept the write for later and answer
|
|
223
|
+
* with a job document to poll at its `Content-Location`. `jobType` is the job's JSON:API type, a
|
|
224
|
+
* registered type when the descriptor has an entry for it.
|
|
225
|
+
*/
|
|
226
|
+
interface AcceptedDescriptor {
|
|
227
|
+
jobType: string;
|
|
228
|
+
}
|
|
221
229
|
/**
|
|
222
230
|
* A custom action declared on a type (`#[AsJsonApiAction]`). The runtime reaches it via
|
|
223
231
|
* `client.<type>.actions.<name>(...)` (collection scope) or
|
|
@@ -306,6 +314,11 @@ interface ActionDescriptor {
|
|
|
306
314
|
listFilters?: readonly string[];
|
|
307
315
|
/** The filter families the action takes, as its type's collection read does. */
|
|
308
316
|
filterFamilies?: readonly FilterFamilyDescriptor[];
|
|
317
|
+
/**
|
|
318
|
+
* Present when the action may answer `202 Accepted` with a job to poll. Absent when it always
|
|
319
|
+
* answers synchronously.
|
|
320
|
+
*/
|
|
321
|
+
accepted?: AcceptedDescriptor;
|
|
309
322
|
}
|
|
310
323
|
/**
|
|
311
324
|
* The `withCount` capability of a type's read endpoints (the Countable profile, core ADR
|
|
@@ -319,6 +332,18 @@ interface CountableDescriptor {
|
|
|
319
332
|
tokens: readonly string[];
|
|
320
333
|
profile: string;
|
|
321
334
|
}
|
|
335
|
+
/** A read that takes `relatedQuery`: the collection read or the single-resource read. */
|
|
336
|
+
type RelatedQueryOperation = 'fetchMany' | 'fetchOne';
|
|
337
|
+
/**
|
|
338
|
+
* The `relatedQuery` parameter of a type's reads (the Relationship Queries profile): a `filter`
|
|
339
|
+
* and `sort` per include path, applied to that relationship's members. `operations` names the
|
|
340
|
+
* reads that advertise it, and `profile` is the URI a client negotiates in `Accept` before the
|
|
341
|
+
* server honours it, read from the parameter's `x-profile`.
|
|
342
|
+
*/
|
|
343
|
+
interface RelatedQueryDescriptor {
|
|
344
|
+
operations: readonly RelatedQueryOperation[];
|
|
345
|
+
profile: string;
|
|
346
|
+
}
|
|
322
347
|
/**
|
|
323
348
|
* A family of sort keys matched by prefix: any key of the form `<prefix>.<suffix>`, ascending or
|
|
324
349
|
* with a leading `-`, whose suffix matches `suffixPattern` (a regular expression source, unanchored
|
|
@@ -351,6 +376,11 @@ interface ResourceDescriptor {
|
|
|
351
376
|
* Absent when no read endpoint advertises `withCount`.
|
|
352
377
|
*/
|
|
353
378
|
countable?: CountableDescriptor;
|
|
379
|
+
/**
|
|
380
|
+
* The reads that take `relatedQuery` and the profile it needs. Absent when neither the
|
|
381
|
+
* collection read nor the single-resource read advertises it.
|
|
382
|
+
*/
|
|
383
|
+
relatedQuery?: RelatedQueryDescriptor;
|
|
354
384
|
/**
|
|
355
385
|
* The relation paths the read endpoints accept in `include` — the exact enum the OpenAPI
|
|
356
386
|
* document advertises, including nested dotted paths (`tracks.album`). Drives `include`
|
|
@@ -407,7 +437,15 @@ interface ResourceDescriptor {
|
|
|
407
437
|
* {@link ActionDescriptor.scopes}.
|
|
408
438
|
*/
|
|
409
439
|
scopes?: Readonly<Record<string, readonly string[]>>;
|
|
440
|
+
/**
|
|
441
|
+
* The writes that may answer `202 Accepted` with a job to poll, keyed `create` or `update`. A
|
|
442
|
+
* delete never does. Absent when every write answers synchronously; an action's is on its
|
|
443
|
+
* {@link ActionDescriptor.accepted}.
|
|
444
|
+
*/
|
|
445
|
+
accepted?: Readonly<Partial<Record<AcceptedOperation, AcceptedDescriptor>>>;
|
|
410
446
|
}
|
|
447
|
+
/** A write that can answer `202 Accepted`. */
|
|
448
|
+
type AcceptedOperation = 'create' | 'update';
|
|
411
449
|
type ApiDescriptor = Readonly<Record<string, ResourceDescriptor>>;
|
|
412
450
|
/**
|
|
413
451
|
* Whether a relation is polymorphic: flagged {@link RelationDescriptor.polymorphic}, or, when the
|
|
@@ -452,6 +490,51 @@ interface ResourceExamples {
|
|
|
452
490
|
/** The operation examples of every type that has one, keyed by wire type. */
|
|
453
491
|
type ApiExamples = Readonly<Record<string, ResourceExamples>>;
|
|
454
492
|
//#endregion
|
|
493
|
+
//#region src/accepted.d.ts
|
|
494
|
+
/** Options for waiting on an accepted write: `wait` on the call, or {@link Accepted.$poll}. */
|
|
495
|
+
interface PollOptions {
|
|
496
|
+
/**
|
|
497
|
+
* How long to keep polling, in milliseconds, before rejecting with a {@link PollTimeoutError}.
|
|
498
|
+
* Defaults to five minutes.
|
|
499
|
+
*/
|
|
500
|
+
timeout?: number;
|
|
501
|
+
/** Stops polling when signalled. The call rejects with the signal's reason, as a request does. */
|
|
502
|
+
signal?: AbortSignal;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A write the server accepted for later (`202 Accepted`). `Job` is the job it answered with and
|
|
506
|
+
* `Result` what the write resolves to once the job is done.
|
|
507
|
+
*/
|
|
508
|
+
interface Accepted<Job, Result = unknown> {
|
|
509
|
+
/**
|
|
510
|
+
* The job, materialised as its type's resource, or the document's top-level `meta` when the
|
|
511
|
+
* server answered with a meta-only document.
|
|
512
|
+
*/
|
|
513
|
+
readonly job: Job;
|
|
514
|
+
/** The job URL, from `Content-Location`, which {@link $poll} reads until the job is done. */
|
|
515
|
+
readonly contentLocation: string;
|
|
516
|
+
/**
|
|
517
|
+
* How long the server asks the client to wait before polling, in seconds, from `Retry-After`. An
|
|
518
|
+
* HTTP date is counted from when the response arrived. Absent when the server sent none.
|
|
519
|
+
*/
|
|
520
|
+
readonly retryAfter: number | undefined;
|
|
521
|
+
/** Poll the job URL until the job is done, and resolve to what the write returns. */
|
|
522
|
+
$poll(options?: PollOptions): Promise<Result>;
|
|
523
|
+
}
|
|
524
|
+
/** Thrown when a job is still pending when the poll's timeout runs out. */
|
|
525
|
+
declare class PollTimeoutError extends Error {
|
|
526
|
+
readonly contentLocation: string;
|
|
527
|
+
readonly timeout: number;
|
|
528
|
+
constructor(contentLocation: string, timeout: number);
|
|
529
|
+
}
|
|
530
|
+
/** Whether a write's result is an {@link Accepted} job rather than its normal result. */
|
|
531
|
+
declare function isAccepted(value: unknown): value is Accepted<unknown, unknown>;
|
|
532
|
+
/**
|
|
533
|
+
* A `Retry-After` value in seconds: delta-seconds as sent, an HTTP date as the seconds left until
|
|
534
|
+
* it, rounded up and never negative. `undefined` when absent or unreadable.
|
|
535
|
+
*/
|
|
536
|
+
declare function parseRetryAfter(value: string | undefined, now?: number): number | undefined;
|
|
537
|
+
//#endregion
|
|
455
538
|
//#region src/pagination.d.ts
|
|
456
539
|
/** The wire key for each role when the server keeps the default names. */
|
|
457
540
|
declare const CANONICAL_PAGE_KEYS: {
|
|
@@ -664,6 +747,11 @@ interface ResourceEnvelope {
|
|
|
664
747
|
readonly $document: DocumentEnvelope;
|
|
665
748
|
readonly $raw: RawResource;
|
|
666
749
|
$rel(name: string): RelationView | undefined;
|
|
750
|
+
/**
|
|
751
|
+
* A relationship's count, from its `meta.total` (a `withCount` read): a finite number, else
|
|
752
|
+
* `undefined`. Read from the raw relationship, so it works when the relation carries no data.
|
|
753
|
+
*/
|
|
754
|
+
$count(name: string): number | undefined;
|
|
667
755
|
}
|
|
668
756
|
/** Edge-local accessors carried by a materialised related VALUE (per-edge view). */
|
|
669
757
|
interface EdgeEnvelope {
|
|
@@ -678,6 +766,11 @@ interface ArrayEnvelope {
|
|
|
678
766
|
$next(options?: NavigateOptions): Promise<unknown>;
|
|
679
767
|
$prev(options?: NavigateOptions): Promise<unknown>;
|
|
680
768
|
}
|
|
769
|
+
/** The accessor a to-many relationship array carries beside its {@link ArrayEnvelope}. */
|
|
770
|
+
interface RelationArrayEnvelope {
|
|
771
|
+
/** The relationship's count, from its `meta.total`: a finite number, else `undefined`. */
|
|
772
|
+
readonly $count: number | undefined;
|
|
773
|
+
}
|
|
681
774
|
/** Per-call options for `$next()`/`$prev()`. */
|
|
682
775
|
interface NavigateOptions {
|
|
683
776
|
/** Cancels the page fetch when signalled. */
|
|
@@ -961,6 +1054,11 @@ type Collection<T, P = Page> = ReadonlyArray<T> & Omit<ArrayEnvelope, '$page' |
|
|
|
961
1054
|
$next(options?: NavigateOptions): Promise<Collection<T, P> | undefined>;
|
|
962
1055
|
$prev(options?: NavigateOptions): Promise<Collection<T, P> | undefined>;
|
|
963
1056
|
};
|
|
1057
|
+
/**
|
|
1058
|
+
* A to-many relationship value: a {@link Collection} that also carries `$count`, the
|
|
1059
|
+
* relationship's `meta.total` when the read counted it.
|
|
1060
|
+
*/
|
|
1061
|
+
type RelationCollection<T, P = Page> = Collection<T, P> & RelationArrayEnvelope;
|
|
964
1062
|
/**
|
|
965
1063
|
* The edge-local accessors carried by a materialised related VALUE (a per-edge view):
|
|
966
1064
|
* `$edge` (this membership's edge meta/links) and `$pivot` (typed sugar over
|
|
@@ -1086,25 +1184,40 @@ type Identifier<TType extends string, Pivot = Record<string, unknown>, Meta exte
|
|
|
1086
1184
|
* (Excluded to-many stays a `Collection`: linkage may still be present, and a lazy
|
|
1087
1185
|
* to-many materialises as an augmented array regardless — only its members differ.)
|
|
1088
1186
|
*/
|
|
1089
|
-
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 ?
|
|
1187
|
+
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, Record<string, unknown>, EdgeMetaOf<D, T, R>>, RelationPage<D, T, R>> : Hydrated<D, A, RelatedType<D, T, R>, F, Record<string, unknown>, EdgeMetaOf<D, T, R>> | null : IsMany<D, T, R> extends true ? RelationCollection<Identifier<RelatedType<D, T, R>, Record<string, unknown>, EdgeMetaOf<D, T, R>>, RelationPage<D, T, R>> : Identifier<RelatedType<D, T, R>, Record<string, unknown>, EdgeMetaOf<D, T, R>> | null | undefined;
|
|
1090
1188
|
/**
|
|
1091
1189
|
* The relation slots of type `T`, each typed by cardinality and include-presence, then
|
|
1092
1190
|
* narrowed to the fieldset selection for `T` (relations are sparse-fieldset members too — an
|
|
1093
1191
|
* unrequested relation is statically absent). A write-only relation has no slot.
|
|
1094
1192
|
*/
|
|
1095
1193
|
type Relations<D extends ApiDescriptor, A, T extends TypeName<D>, Inc, F = unknown> = PickSelected<{ [R in ReadableRelationName<D, T>]: RelationValue<D, A, T, R, Inc, F> }, SelectedFields<F, T>>;
|
|
1194
|
+
/**
|
|
1195
|
+
* The relations of type `T` a `withCount` read can count: its count tokens without `_self_`,
|
|
1196
|
+
* which counts the collection rather than a relation.
|
|
1197
|
+
*/
|
|
1198
|
+
type CountedRelationName<D extends ApiDescriptor, T extends TypeName<D>> = Exclude<CountToken<D, T>, '_self_'>;
|
|
1199
|
+
/**
|
|
1200
|
+
* The `$count` accessor of a resource object of type `T`: a relationship's `meta.total`, read
|
|
1201
|
+
* from the raw relationship so it works when the relation carries no data. `Counted` names the
|
|
1202
|
+
* relations the read asked to count, for which it is a `number`; any other relation may have no
|
|
1203
|
+
* count, so it is `number | undefined`.
|
|
1204
|
+
*/
|
|
1205
|
+
interface CountAccessor<D extends ApiDescriptor, T extends TypeName<D>, Counted = never> {
|
|
1206
|
+
$count<R extends CountedRelationName<D, T>>(name: R): R extends Counted ? number : number | undefined;
|
|
1207
|
+
}
|
|
1096
1208
|
/**
|
|
1097
1209
|
* A materialised resource object: flattened `type` + `id` + attributes + relation slots
|
|
1098
1210
|
* as own enumerable props, intersected with the resource-level `$`-accessors. `Inc` is
|
|
1099
1211
|
* the union of relation names included by the read (narrows relations to hydrated); `F` is
|
|
1100
1212
|
* the sparse-fieldset selection map (narrows attributes/relations to the requested members —
|
|
1101
1213
|
* `type`/`id`/the `$`-accessors are always present). The default `F = unknown` keeps every
|
|
1102
|
-
* member (no fieldset narrowing).
|
|
1214
|
+
* member (no fieldset narrowing). `Counted` names the relations the read counted, whose `$count`
|
|
1215
|
+
* is then a `number`.
|
|
1103
1216
|
*/
|
|
1104
|
-
type ResourceObjectView<D extends ApiDescriptor, A, T extends TypeName<D>, Inc = never, F = unknown> = {
|
|
1217
|
+
type ResourceObjectView<D extends ApiDescriptor, A, T extends TypeName<D>, Inc = never, F = unknown, Counted = never> = {
|
|
1105
1218
|
type: T;
|
|
1106
1219
|
id: string;
|
|
1107
|
-
} & PickSelected<AttributesOf<A, T>, SelectedFields<F, T>> & Relations<D, A, T, Inc, F> & ResourceAccessors<LinksOf<A, T
|
|
1220
|
+
} & PickSelected<AttributesOf<A, T>, SelectedFields<F, T>> & Relations<D, A, T, Inc, F> & ResourceAccessors<LinksOf<A, T>> & CountAccessor<D, T, Counted>;
|
|
1108
1221
|
/**
|
|
1109
1222
|
* The element type of the `include` array for type `T`: a path from the descriptor's
|
|
1110
1223
|
* `includable` enum — the exact set the server advertises, including nested dotted paths
|
|
@@ -1256,16 +1369,56 @@ type FieldsMap<D extends ApiDescriptor> = { [T in TypeName<D>]?: readonly Member
|
|
|
1256
1369
|
* names, so `fields` entries are constrained to real members.
|
|
1257
1370
|
*/
|
|
1258
1371
|
type MemberName<D extends ApiDescriptor, T extends TypeName<D>> = Extract<keyof D[T]['attributes'], string> | ReadableRelationName<D, T>;
|
|
1372
|
+
/** A `relatedQuery` entry for a path whose relation declares no vocabulary of its own. */
|
|
1373
|
+
interface LooseRelatedQueryEntry {
|
|
1374
|
+
filter?: Record<string, unknown>;
|
|
1375
|
+
sort?: string | readonly string[];
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* The `relatedQuery` entry for relation `R` of type `T`: its `filter` and `sort` typed as the
|
|
1379
|
+
* relation's own related read types them (see {@link RelationFilterQuery} and
|
|
1380
|
+
* {@link RelationSortQuery}).
|
|
1381
|
+
*/
|
|
1382
|
+
interface RelatedQueryEntry<D extends ApiDescriptor, T extends TypeName<D>, R extends RelationName<D, T>> {
|
|
1383
|
+
filter?: RelationFilterQuery<D, T, R>;
|
|
1384
|
+
sort?: RelationSortQuery<D, T, R>;
|
|
1385
|
+
}
|
|
1386
|
+
/** The most relationships deep {@link RelatedQueryEntryAt} follows a path before it goes loose. */
|
|
1387
|
+
type MaxRelatedQueryDepth = 8;
|
|
1388
|
+
/**
|
|
1389
|
+
* The entry for include path `P` from type `T`, typed from the relation the path ends on. A
|
|
1390
|
+
* polymorphic relation part way along continues from each member type declaring the next
|
|
1391
|
+
* relation. `never` when no type along the path declares it.
|
|
1392
|
+
*/
|
|
1393
|
+
type RelatedQueryEntryAt<D extends ApiDescriptor, T extends TypeName<D>, P extends string, Depth extends readonly unknown[] = []> = Depth['length'] extends MaxRelatedQueryDepth ? LooseRelatedQueryEntry : P extends `${infer Head}.${infer Rest}` ? Head extends RelationName<D, T> ? RelatedType<D, T, Head> extends infer U ? U extends TypeName<D> ? RelatedQueryEntryAt<D, U, Rest, [...Depth, unknown]> : never : never : never : P extends RelationName<D, T> ? RelatedQueryEntry<D, T, P> : never;
|
|
1394
|
+
/** The entry for include path `P` from type `T`, loose when its relation can't be resolved. */
|
|
1395
|
+
type RelatedQueryEntryFor<D extends ApiDescriptor, T extends TypeName<D>, P extends string> = [RelatedQueryEntryAt<D, T, P>] extends [never] ? LooseRelatedQueryEntry : RelatedQueryEntryAt<D, T, P>;
|
|
1396
|
+
/**
|
|
1397
|
+
* The `relatedQuery` object for type `T` (the Relationship Queries profile): keyed by the type's
|
|
1398
|
+
* include paths, each entry a `filter` and `sort` for the relationship the path ends on.
|
|
1399
|
+
*/
|
|
1400
|
+
type RelatedQuery<D extends ApiDescriptor, T extends TypeName<D>> = { readonly [P in IncludePath<D, T>]?: RelatedQueryEntryFor<D, T, P> };
|
|
1401
|
+
/**
|
|
1402
|
+
* The `relatedQuery` read `Op` of type `T` takes: {@link RelatedQuery} when the type's
|
|
1403
|
+
* descriptor names the read in `relatedQuery.operations`, else `never`, so it can't be sent.
|
|
1404
|
+
*/
|
|
1405
|
+
type RelatedQueryParam<D extends ApiDescriptor, T extends TypeName<D>, Op extends RelatedQueryOperation> = D[T] extends {
|
|
1406
|
+
relatedQuery: {
|
|
1407
|
+
operations: readonly (infer O)[];
|
|
1408
|
+
};
|
|
1409
|
+
} ? Op extends O ? RelatedQuery<D, T> : never : never;
|
|
1259
1410
|
/** The `page` argument a collection read of type `T` accepts (see {@link PageParams}). */
|
|
1260
1411
|
type ListPageParams<D extends ApiDescriptor, T extends TypeName<D>> = PageParams<D[T]['paginator']>;
|
|
1261
1412
|
/**
|
|
1262
1413
|
* A read query carrying a typed, narrowing `include`, a typed `fields` (drives sparse-fieldset
|
|
1263
|
-
* return narrowing), a `withCount` constrained to the type's count tokens
|
|
1264
|
-
* collection's paginator (`Pg` drives the `$page` type),
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1267
|
-
|
|
1268
|
-
|
|
1414
|
+
* return narrowing), a `withCount` constrained to the type's count tokens (`Cnt` drives `$count`
|
|
1415
|
+
* narrowing), a `page` typed by the collection's paginator (`Pg` drives the `$page` type), a
|
|
1416
|
+
* `relatedQuery` keyed by include path, plus the loose JSON:API query families. `Inc`/`F`/`Cnt`
|
|
1417
|
+
* are inferred (as `const`) at the call site. Used for the COLLECTION read (`list`); the
|
|
1418
|
+
* single-resource read (`get`) uses {@link SingleReadQuery}, which drops `withCount` (no
|
|
1419
|
+
* `GET /{type}/{id}` endpoint advertises it).
|
|
1420
|
+
*/
|
|
1421
|
+
interface TypedReadQuery<D extends ApiDescriptor, T extends TypeName<D>, Inc extends readonly IncludePath<D, T>[], F extends FieldsMap<D> = FieldsMap<D>, Pg extends ListPageParams<D, T> | undefined = ListPageParams<D, T> | undefined, Cnt extends readonly CountToken<D, T>[] = readonly CountToken<D, T>[]> {
|
|
1269
1422
|
/** The relations to include — drives static narrowing; constrained to the advertised paths. */
|
|
1270
1423
|
include?: Inc;
|
|
1271
1424
|
/** Filter the collection — keys constrained to the type's advertised `filter[...]` params. */
|
|
@@ -1274,8 +1427,16 @@ interface TypedReadQuery<D extends ApiDescriptor, T extends TypeName<D>, Inc ext
|
|
|
1274
1427
|
sort?: SortQuery<D, T>;
|
|
1275
1428
|
/** Sparse fieldsets per type — drives return-type narrowing (unrequested members are absent). */
|
|
1276
1429
|
fields?: F;
|
|
1277
|
-
/**
|
|
1278
|
-
|
|
1430
|
+
/**
|
|
1431
|
+
* Relationship-count tokens (the Countable profile) — comma-joined onto `withCount`. Each
|
|
1432
|
+
* relation named here reads back as a `number` from `$count` on the result's resources.
|
|
1433
|
+
*/
|
|
1434
|
+
withCount?: Cnt;
|
|
1435
|
+
/**
|
|
1436
|
+
* A `filter` and `sort` per include path, applied to that relationship (the Relationship
|
|
1437
|
+
* Queries profile). Present only when the collection read advertises it.
|
|
1438
|
+
*/
|
|
1439
|
+
relatedQuery?: RelatedQueryParam<D, T, 'fetchMany'>;
|
|
1279
1440
|
/**
|
|
1280
1441
|
* The page to read, under the paginator's wire keys. On a menu, `kind` picks a strategy;
|
|
1281
1442
|
* without it the server answers with its default.
|
|
@@ -1285,25 +1446,31 @@ interface TypedReadQuery<D extends ApiDescriptor, T extends TypeName<D>, Inc ext
|
|
|
1285
1446
|
signal?: AbortSignal;
|
|
1286
1447
|
}
|
|
1287
1448
|
/**
|
|
1288
|
-
* A single-resource read query (`GET /{type}/{id}`):
|
|
1289
|
-
* single-resource endpoint advertises neither
|
|
1290
|
-
* filter or page) nor `withCount` — accepting
|
|
1291
|
-
* rejects an unrecognised parameter with `400`
|
|
1449
|
+
* A single-resource read query (`GET /{type}/{id}`): `include`, sparse `fields` and, where the
|
|
1450
|
+
* read advertises it, `relatedQuery`. A single-resource endpoint advertises neither
|
|
1451
|
+
* `sort`/`filter`/`page` (no collection to order, filter or page) nor `withCount` — accepting
|
|
1452
|
+
* any of them would be a lying type (the server rejects an unrecognised parameter with `400`
|
|
1453
|
+
* under strict query-param validation).
|
|
1292
1454
|
*/
|
|
1293
1455
|
interface SingleReadQuery<D extends ApiDescriptor, T extends TypeName<D>, Inc extends readonly IncludePath<D, T>[], F extends FieldsMap<D> = FieldsMap<D>> {
|
|
1294
1456
|
/** The relations to include — drives static narrowing; constrained to the advertised paths. */
|
|
1295
1457
|
include?: Inc;
|
|
1296
1458
|
/** Sparse fieldsets per type — drives return-type narrowing (unrequested members are absent). */
|
|
1297
1459
|
fields?: F;
|
|
1460
|
+
/**
|
|
1461
|
+
* A `filter` and `sort` per include path, applied to that relationship (the Relationship
|
|
1462
|
+
* Queries profile). Present only when the single-resource read advertises it.
|
|
1463
|
+
*/
|
|
1464
|
+
relatedQuery?: RelatedQueryParam<D, T, 'fetchOne'>;
|
|
1298
1465
|
/** Cancels the read when signalled (e.g. a superseded request). Not sent to the server. */
|
|
1299
1466
|
signal?: AbortSignal;
|
|
1300
1467
|
}
|
|
1301
1468
|
/**
|
|
1302
1469
|
* The static return type of a read on type `T` given its `include` tuple and `fields` selection
|
|
1303
1470
|
* `F` — the resource object with the named relations narrowed to hydrated and its members
|
|
1304
|
-
* narrowed to the requested sparse fieldset.
|
|
1471
|
+
* narrowed to the requested sparse fieldset. `Counted` names the relations the read counted.
|
|
1305
1472
|
*/
|
|
1306
|
-
type ReadResult<D extends ApiDescriptor, A, T extends TypeName<D>, Inc extends readonly IncludePath<D, T>[] = [], F = unknown> = ResourceObjectView<D, A, T, IncludedRelations<D, T, Inc>, F>;
|
|
1473
|
+
type ReadResult<D extends ApiDescriptor, A, T extends TypeName<D>, Inc extends readonly IncludePath<D, T>[] = [], F = unknown, Counted = never> = ResourceObjectView<D, A, T, IncludedRelations<D, T, Inc>, F, Counted>;
|
|
1307
1474
|
/**
|
|
1308
1475
|
* A read query for the relationship/related endpoints: loose include/fields/withCount, a `page` of
|
|
1309
1476
|
* type `Pg` (typed from the relation's paginator on a typed accessor), and a `sort` of type `S`
|
|
@@ -1547,6 +1714,55 @@ interface WriteOptions<D extends ApiDescriptor, T extends TypeName<D>, Inc exten
|
|
|
1547
1714
|
/** Sparse fieldsets per type — narrows the materialised write response. */
|
|
1548
1715
|
fields?: F;
|
|
1549
1716
|
}
|
|
1717
|
+
/** The options that make a write wait for an accepted job: `true`, or the {@link PollOptions}. */
|
|
1718
|
+
interface WaitOptions {
|
|
1719
|
+
wait: true | PollOptions;
|
|
1720
|
+
}
|
|
1721
|
+
/** The `202` write `Op` on type `T` declares (its `{ jobType }`), or `never`. */
|
|
1722
|
+
type AcceptedOf<D extends ApiDescriptor, T extends TypeName<D>, Op extends AcceptedOperation> = D[T] extends {
|
|
1723
|
+
accepted: infer Acc;
|
|
1724
|
+
} ? Acc extends { [K in Op]: infer J } ? J : never : never;
|
|
1725
|
+
/**
|
|
1726
|
+
* The job an accepted write answers with: the job type's resource view when it is a type of this
|
|
1727
|
+
* API, else an open record, which is also what a meta-only job document's `meta` reads as.
|
|
1728
|
+
*/
|
|
1729
|
+
type AcceptedJob<D extends ApiDescriptor, A, J> = J extends {
|
|
1730
|
+
jobType: infer JT extends string;
|
|
1731
|
+
} ? JT extends TypeName<D> ? ReadResult<D, A, JT> : Readonly<Record<string, unknown>> : never;
|
|
1732
|
+
/**
|
|
1733
|
+
* What write `Op` on type `T` resolves to without waiting: its result `R`, or, when it declares a
|
|
1734
|
+
* `202`, `R` or an {@link Accepted} job whose poll resolves to the resource without the write's
|
|
1735
|
+
* `include` or `fields`.
|
|
1736
|
+
*/
|
|
1737
|
+
type WriteResult<D extends ApiDescriptor, A, T extends TypeName<D>, Op extends AcceptedOperation, R> = [AcceptedOf<D, T, Op>] extends [never] ? R : R | Accepted<AcceptedJob<D, A, AcceptedOf<D, T, Op>>, ReadResult<D, A, T>>;
|
|
1738
|
+
/**
|
|
1739
|
+
* The `wait` a caller may pass to write `Op` on type `T`: a boolean or {@link PollOptions} when it
|
|
1740
|
+
* declares a `202`, else nothing.
|
|
1741
|
+
*/
|
|
1742
|
+
type WaitValue<D extends ApiDescriptor, T extends TypeName<D>, Op extends AcceptedOperation> = [AcceptedOf<D, T, Op>] extends [never] ? undefined : boolean | PollOptions | undefined;
|
|
1743
|
+
/**
|
|
1744
|
+
* What write `Op` resolves to when called with `wait` of type `Wt`: the resource without the
|
|
1745
|
+
* write's `include` or `fields` when it waits, else {@link WriteResult}.
|
|
1746
|
+
*/
|
|
1747
|
+
type WaitedWriteResult<D extends ApiDescriptor, A, T extends TypeName<D>, Op extends AcceptedOperation, R, Wt> = Wt extends true | PollOptions ? ReadResult<D, A, T> : WriteResult<D, A, T, Op, R>;
|
|
1748
|
+
/**
|
|
1749
|
+
* `client.<type>.create`. A type whose create declares a `202` also takes `wait`, which polls an
|
|
1750
|
+
* accepted job and resolves to the created resource; without it the call may resolve to an
|
|
1751
|
+
* {@link Accepted}.
|
|
1752
|
+
*/
|
|
1753
|
+
type CreateMethod<D extends ApiDescriptor, A, W, T extends TypeName<D>> = [AcceptedOf<D, T, 'create'>] extends [never] ? <const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}>(input: CreateInput<D, W, T>, opts?: WriteOptions<D, T, Inc, F>) => Promise<ReadResult<D, A, T, Inc, F>> : {
|
|
1754
|
+
(input: CreateInput<D, W, T>, opts: WaitOptions): Promise<ReadResult<D, A, T>>;
|
|
1755
|
+
<const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}>(input: CreateInput<D, W, T>, opts?: WriteOptions<D, T, Inc, F> & {
|
|
1756
|
+
wait?: false;
|
|
1757
|
+
}): Promise<WriteResult<D, A, T, 'create', ReadResult<D, A, T, Inc, F>>>;
|
|
1758
|
+
};
|
|
1759
|
+
/** `client.<type>.id(id).update`, which takes `wait` as {@link CreateMethod} does. */
|
|
1760
|
+
type UpdateMethod<D extends ApiDescriptor, A, W, T extends TypeName<D>> = [AcceptedOf<D, T, 'update'>] extends [never] ? <const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}>(patch: UpdateInput<D, W, T>, opts?: WriteOptions<D, T, Inc, F>) => Promise<ReadResult<D, A, T, Inc, F>> : {
|
|
1761
|
+
(patch: UpdateInput<D, W, T>, opts: WaitOptions): Promise<ReadResult<D, A, T>>;
|
|
1762
|
+
<const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}>(patch: UpdateInput<D, W, T>, opts?: WriteOptions<D, T, Inc, F> & {
|
|
1763
|
+
wait?: false;
|
|
1764
|
+
}): Promise<WriteResult<D, A, T, 'update', ReadResult<D, A, T, Inc, F>>>;
|
|
1765
|
+
};
|
|
1550
1766
|
/**
|
|
1551
1767
|
* The materialised positional result of a single atomic op handle:
|
|
1552
1768
|
*
|
|
@@ -1600,9 +1816,21 @@ type ActionOutputBody<E> = 'output' extends keyof E ? E['output'] : unknown;
|
|
|
1600
1816
|
* - `meta` — the response document's top-level `meta` object;
|
|
1601
1817
|
* - `none` — `void` (a `204`).
|
|
1602
1818
|
*/
|
|
1603
|
-
type ActionResult<D extends ApiDescriptor, A, Act extends ActionDescriptor, E> = Promise<Act
|
|
1819
|
+
type ActionResult<D extends ApiDescriptor, A, Act extends ActionDescriptor, E> = Promise<ActionValue<D, A, Act, E> | ActionAccepted<D, A, Act, E>>;
|
|
1820
|
+
/** The value an action answers with when it answers synchronously. */
|
|
1821
|
+
type ActionValue<D extends ApiDescriptor, A, Act extends ActionDescriptor, E> = Act extends {
|
|
1604
1822
|
location: object;
|
|
1605
|
-
} ? ActionDocumentValue<D, A, Act, E> | ActionLocation : ActionDocumentValue<D, A, Act, E
|
|
1823
|
+
} ? ActionDocumentValue<D, A, Act, E> | ActionLocation : ActionDocumentValue<D, A, Act, E>;
|
|
1824
|
+
/** The {@link Accepted} job of an action that declares a `202`, or `never`. */
|
|
1825
|
+
type ActionAccepted<D extends ApiDescriptor, A, Act extends ActionDescriptor, E> = Act extends {
|
|
1826
|
+
accepted: object;
|
|
1827
|
+
} ? Accepted<AcceptedJob<D, A, Act['accepted']>, ActionValue<D, A, Act, E>> : never;
|
|
1828
|
+
/** The `wait` option of an action that declares a `202`; `unknown` (adding nothing) otherwise. */
|
|
1829
|
+
type ActionWaitOption<Act> = Act extends {
|
|
1830
|
+
accepted: object;
|
|
1831
|
+
} ? {
|
|
1832
|
+
wait?: boolean | PollOptions;
|
|
1833
|
+
} : unknown;
|
|
1606
1834
|
/** The value of an action's JSON:API answer other than a location document. */
|
|
1607
1835
|
type ActionDocumentValue<D extends ApiDescriptor, A, Act extends ActionDescriptor, E> = Act extends {
|
|
1608
1836
|
output: 'document';
|
|
@@ -1638,6 +1866,8 @@ interface ActionCallOptions {
|
|
|
1638
1866
|
responseType?: BinaryResponseType;
|
|
1639
1867
|
/** The filters of a collection action that takes them, sent as `filter[...]` like a read's. */
|
|
1640
1868
|
filter?: Readonly<Record<string, unknown>>;
|
|
1869
|
+
/** Poll a `202 Accepted` job until it's done, for an action that declares one. */
|
|
1870
|
+
wait?: boolean | PollOptions;
|
|
1641
1871
|
}
|
|
1642
1872
|
/** A filter key a collection action accepts (its `filterable` literal union), or `never`. */
|
|
1643
1873
|
type ActionFilterKey<Act> = Act extends {
|
|
@@ -1757,15 +1987,17 @@ type ActionMethod<D extends ApiDescriptor, A, W, Act extends ActionDescriptor, E
|
|
|
1757
1987
|
} ? <const C extends ContentTypeOf<Act> = Extract<DefaultContentType<Act>, ContentTypeOf<Act>>, const M extends AcceptOf<Act> = Extract<DefaultAccept<Act>, AcceptOf<Act>>, RT extends BinaryResponseType = 'blob'>(input: InputBodyFor<D, W, Act, E, C>, options?: {
|
|
1758
1988
|
signal?: AbortSignal;
|
|
1759
1989
|
contentType?: C;
|
|
1760
|
-
} & ResponseOptions<Act, M, RT> & ActionFilterOptions<Act>) => ActionResultIn<D, A, Act, E, M, RT> : Act extends {
|
|
1990
|
+
} & ResponseOptions<Act, M, RT> & ActionFilterOptions<Act> & ActionWaitOption<Act>) => ActionResultIn<D, A, Act, E, M, RT> : Act extends {
|
|
1761
1991
|
rawOutput: readonly RawOutputMedia[];
|
|
1762
1992
|
} ? Act extends {
|
|
1763
1993
|
input: 'none';
|
|
1764
1994
|
} ? <const M extends AcceptOf<Act> = Extract<DefaultAccept<Act>, AcceptOf<Act>>, RT extends BinaryResponseType = 'blob'>(options?: {
|
|
1765
1995
|
signal?: AbortSignal;
|
|
1766
|
-
} & ResponseOptions<Act, M, RT> & ActionFilterOptions<Act>) => ActionResultIn<D, A, Act, E, M, RT> : <const M extends AcceptOf<Act> = Extract<DefaultAccept<Act>, AcceptOf<Act>>, RT extends BinaryResponseType = 'blob'>(input: WithInput<D, W, Act, E>, options?: {
|
|
1996
|
+
} & ResponseOptions<Act, M, RT> & ActionFilterOptions<Act> & ActionWaitOption<Act>) => ActionResultIn<D, A, Act, E, M, RT> : <const M extends AcceptOf<Act> = Extract<DefaultAccept<Act>, AcceptOf<Act>>, RT extends BinaryResponseType = 'blob'>(input: WithInput<D, W, Act, E>, options?: {
|
|
1767
1997
|
signal?: AbortSignal;
|
|
1768
|
-
} & ResponseOptions<Act, M, RT> & ActionFilterOptions<Act>) => ActionResultIn<D, A, Act, E, M, RT> : Act extends {
|
|
1998
|
+
} & ResponseOptions<Act, M, RT> & ActionFilterOptions<Act> & ActionWaitOption<Act>) => ActionResultIn<D, A, Act, E, M, RT> : Act extends {
|
|
1999
|
+
accepted: object;
|
|
2000
|
+
} ? AcceptedActionMethod<D, A, W, Act, E> : Act extends {
|
|
1769
2001
|
filterable: readonly string[];
|
|
1770
2002
|
} | {
|
|
1771
2003
|
filterFamilies: readonly unknown[];
|
|
@@ -1778,6 +2010,29 @@ type ActionMethod<D extends ApiDescriptor, A, W, Act extends ActionDescriptor, E
|
|
|
1778
2010
|
} & ActionFilterOptions<Act>) => ActionResult<D, A, Act, E> : Act extends {
|
|
1779
2011
|
input: 'none';
|
|
1780
2012
|
} ? () => ActionResult<D, A, Act, E> : (input: WithInput<D, W, Act, E>) => ActionResult<D, A, Act, E>;
|
|
2013
|
+
/**
|
|
2014
|
+
* An action that declares a `202`: `wait` polls the accepted job and resolves to the action's
|
|
2015
|
+
* value; without it the call may resolve to an {@link Accepted}.
|
|
2016
|
+
*/
|
|
2017
|
+
type AcceptedActionMethod<D extends ApiDescriptor, A, W, Act extends ActionDescriptor, E> = Act extends {
|
|
2018
|
+
input: 'none';
|
|
2019
|
+
} ? {
|
|
2020
|
+
(options: {
|
|
2021
|
+
signal?: AbortSignal;
|
|
2022
|
+
} & ActionFilterOptions<Act> & WaitOptions): Promise<ActionValue<D, A, Act, E>>;
|
|
2023
|
+
(options?: {
|
|
2024
|
+
signal?: AbortSignal;
|
|
2025
|
+
wait?: false;
|
|
2026
|
+
} & ActionFilterOptions<Act>): ActionResult<D, A, Act, E>;
|
|
2027
|
+
} : {
|
|
2028
|
+
(input: WithInput<D, W, Act, E>, options: {
|
|
2029
|
+
signal?: AbortSignal;
|
|
2030
|
+
} & ActionFilterOptions<Act> & WaitOptions): Promise<ActionValue<D, A, Act, E>>;
|
|
2031
|
+
(input: WithInput<D, W, Act, E>, options?: {
|
|
2032
|
+
signal?: AbortSignal;
|
|
2033
|
+
wait?: false;
|
|
2034
|
+
} & ActionFilterOptions<Act>): ActionResult<D, A, Act, E>;
|
|
2035
|
+
};
|
|
1781
2036
|
/**
|
|
1782
2037
|
* The typed map of a type's custom actions at one scope (`collection` on the
|
|
1783
2038
|
* {@link TypeAccessor}, `resource` on the {@link ResourceHandle}). Each entry is an
|
|
@@ -1798,16 +2053,16 @@ type ResourceHandle<D extends ApiDescriptor, A, W, T extends TypeName<D>, Act =
|
|
|
1798
2053
|
readonly type: T;
|
|
1799
2054
|
readonly id: string;
|
|
1800
2055
|
get<const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}>(query?: SingleReadQuery<D, T, Inc, F>): Promise<ReadResult<D, A, T, Inc, F>>;
|
|
1801
|
-
update
|
|
2056
|
+
update: UpdateMethod<D, A, W, T>;
|
|
1802
2057
|
delete(): Promise<void>;
|
|
1803
2058
|
rel<R extends RelationName<D, T>>(name: R): RelationshipAccessor<D, A, T, R>; /** The type's resource-scoped custom actions, keyed by name (sub `{id}` from this handle). */
|
|
1804
2059
|
readonly actions: ActionsAccessor<D, A, W, T, 'resource', Act>;
|
|
1805
2060
|
} & RelationshipAccessors<D, A, T>;
|
|
1806
2061
|
/** The collection-scoped accessor for one wire type (`client.albums`). */
|
|
1807
2062
|
interface TypeAccessor<D extends ApiDescriptor, A, W, T extends TypeName<D>, Act = DefaultActionTypes> {
|
|
1808
|
-
list<const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}, const Pg extends ListPageParams<D, T> | undefined = undefined>(query?: TypedReadQuery<D, T, Inc, F, Pg>): Promise<Collection<ReadResult<D, A, T, Inc, F>, PageOf<D[T]['paginator'], Pg>>>;
|
|
2063
|
+
list<const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}, const Pg extends ListPageParams<D, T> | undefined = undefined, const Cnt extends readonly CountToken<D, T>[] = []>(query?: TypedReadQuery<D, T, Inc, F, Pg, Cnt>): Promise<Collection<ReadResult<D, A, T, Inc, F, Cnt[number]>, PageOf<D[T]['paginator'], Pg>>>;
|
|
1809
2064
|
get<const Inc extends readonly IncludePath<D, T>[] = [], const F extends FieldsMap<D> = {}>(id: string, query?: SingleReadQuery<D, T, Inc, F>): Promise<ReadResult<D, A, T, Inc, F>>;
|
|
1810
|
-
create
|
|
2065
|
+
create: CreateMethod<D, A, W, T>;
|
|
1811
2066
|
id(id: string): ResourceHandle<D, A, W, T, Act>;
|
|
1812
2067
|
/** The type's collection-scoped custom actions, keyed by name. */
|
|
1813
2068
|
readonly actions: ActionsAccessor<D, A, W, T, 'collection', Act>;
|
|
@@ -1974,6 +2229,14 @@ interface ReadQuery {
|
|
|
1974
2229
|
fields?: Record<string, string[]>;
|
|
1975
2230
|
/** Relationship-count tokens (the Countable profile) — serialised comma-joined onto `withCount`. */
|
|
1976
2231
|
withCount?: readonly string[];
|
|
2232
|
+
/**
|
|
2233
|
+
* A `filter` and `sort` per include path (the Relationship Queries profile), serialised as
|
|
2234
|
+
* `relatedQuery[<path>][filter][<key>]` and `relatedQuery[<path>][sort]`.
|
|
2235
|
+
*/
|
|
2236
|
+
relatedQuery?: Readonly<Record<string, {
|
|
2237
|
+
filter?: Readonly<Record<string, unknown>>;
|
|
2238
|
+
sort?: string | readonly string[];
|
|
2239
|
+
} | undefined>>;
|
|
1977
2240
|
page?: Record<string, unknown>;
|
|
1978
2241
|
/** Cancels the read when signalled. Never serialised; passed to the transport. */
|
|
1979
2242
|
signal?: AbortSignal;
|
|
@@ -2014,6 +2277,11 @@ interface JsonApiRequest {
|
|
|
2014
2277
|
* The client sets it from the descriptor; without it an array filter value is comma-joined.
|
|
2015
2278
|
*/
|
|
2016
2279
|
listFilter?: (key: string) => boolean;
|
|
2280
|
+
/**
|
|
2281
|
+
* The filter keys of a {@link ReadQuery.relatedQuery} entry that take a list, by the entry's
|
|
2282
|
+
* include path. The client sets it from the relation the path ends on.
|
|
2283
|
+
*/
|
|
2284
|
+
relatedListFilter?: (path: string, key: string) => boolean;
|
|
2017
2285
|
body?: unknown;
|
|
2018
2286
|
/**
|
|
2019
2287
|
* Override the request `Content-Type`, which defaults to the negotiated JSON:API media type on
|
|
@@ -2053,10 +2321,11 @@ interface JsonApiRequest {
|
|
|
2053
2321
|
* Serialise a read query to a query string (no leading `?`). Bracketed keys
|
|
2054
2322
|
* (`filter[title]`, `page[number]`, `fields[albums]`) are kept literal; only values
|
|
2055
2323
|
* are percent-encoded. `isListFilter` names the filter keys that take a list, whose array value
|
|
2056
|
-
* goes out as `filter[<key>][]` once per member
|
|
2324
|
+
* goes out as `filter[<key>][]` once per member, and `isRelatedListFilter` does the same for a
|
|
2325
|
+
* `relatedQuery` entry's filters by include path. Empty/undefined entries are skipped; key order is deterministic
|
|
2057
2326
|
* (family order, then insertion order within a family) so URLs are stable for caching.
|
|
2058
2327
|
*/
|
|
2059
|
-
declare function serializeQuery(query: ReadQuery, isListFilter?: (key: string) => boolean): string;
|
|
2328
|
+
declare function serializeQuery(query: ReadQuery, isListFilter?: (key: string) => boolean, isRelatedListFilter?: (path: string, key: string) => boolean): string;
|
|
2060
2329
|
/**
|
|
2061
2330
|
* Execute a request: build the URL (a server link resolved against `baseUrl` and held to its
|
|
2062
2331
|
* origin, an absolute path verbatim, else `baseUrl + path`), apply content negotiation and any async per-request headers,
|
|
@@ -2065,6 +2334,18 @@ declare function serializeQuery(query: ReadQuery, isListFilter?: (key: string) =
|
|
|
2065
2334
|
* parsed error objects (tolerating a non-JSON error body with an empty list).
|
|
2066
2335
|
*/
|
|
2067
2336
|
declare function execute(ctx: JsonApiContext, req: JsonApiRequest): Promise<Document | undefined>;
|
|
2337
|
+
/** A response's status and headers beside its parsed {@link Document}. */
|
|
2338
|
+
interface ExecutedResponse {
|
|
2339
|
+
status: number;
|
|
2340
|
+
headers: Record<string, string>;
|
|
2341
|
+
document: Document | undefined;
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Execute a request as {@link execute} does, keeping the response's status and headers. With
|
|
2345
|
+
* `seeOther`, a `303` the transport didn't follow resolves with no document instead of throwing,
|
|
2346
|
+
* so the caller can read its `Location`.
|
|
2347
|
+
*/
|
|
2348
|
+
declare function executeResponse(ctx: JsonApiContext, req: JsonApiRequest, seeOther?: boolean): Promise<ExecutedResponse>;
|
|
2068
2349
|
/** How {@link executeRaw} reads a successful response body. */
|
|
2069
2350
|
type RawResponseType = 'text' | 'blob' | 'arraybuffer';
|
|
2070
2351
|
/**
|
|
@@ -2144,5 +2425,5 @@ declare function assertJsonApiDocument(body: unknown): asserts body is Document;
|
|
|
2144
2425
|
*/
|
|
2145
2426
|
declare function validateDocument(body: Document, validator: ResolvedValidator): void;
|
|
2146
2427
|
//#endregion
|
|
2147
|
-
export {
|
|
2148
|
-
//# sourceMappingURL=validate-
|
|
2428
|
+
export { IdentifierMember as $, CountableDescriptor as $n, AtomicUpdateHandle as $t, AcceptedOf as A, PageOf as An, TypeAccessor as At, CountedRelationName as B, parseRetryAfter as Bn, WriteOptions as Bt, createClient as C, relatedPaginatorKind as Cn, RelationshipAccessor as Ct, TransportResponse as D, PageKeys as Dn, SingleReadQuery as Dt, TransportRequest as E, Page as En, ResourceObjectView as Et, BinaryResponseType as F, resolvePaginator as Fn, UpdateMethod as Ft, DefaultWriteAttributes as G, ActionLocationDescriptor as Gn, AtomicCreateHandle as Gt, CreateMethod as H, AcceptedOperation as Hn, ActionLocation as Ht, Client as I, Accepted as In, WaitOptions as It, FieldSelectionMap as J, ApiDescriptor as Jn, AtomicHandle as Jt, EdgeMembers as K, ActionOutput as Kn, AtomicCreateInput as Kt, Collection as L, PollOptions as Ln, WaitValue as Lt, ActionsAccessor as M, PageParamsOf as Mn, TypedReadQuery as Mt, AtomicResultOf as N, ResolvedPaginator as Nn, TypedRelationReadQuery as Nt, fetchTransport as O, PageLinks as On, SortQuery as Ot, BinaryBody as P, TypedPage as Pn, UpdateInput as Pt, HydratedMember as Q, ClientIdPolicy as Qn, AtomicResults as Qt, CountAccessor as R, PollTimeoutError as Rn, WaitedWriteResult as Rt, HeadersInit as S, relatedPaginator as Sn, RelationSortQuery as St, TransportRawBody as T, ExactPageParams as Tn, ResourceHandle as Tt, DefaultActionTypes as U, ActionDescriptor as Un, isActionLocation as Ut, CreateInput as V, AcceptedDescriptor as Vn, WriteResult as Vt, DefaultAttributes as W, ActionInput as Wn, readActionLocation as Wt, FilterKey as X, AtomicDescriptor as Xn, AtomicRef as Xt, FieldsMap as Y, ApiExamples as Yn, AtomicRecorder as Yt, FilterQuery as Z, Cardinality as Zn, AtomicResult as Zt, executeRaw as _, RelationArrayEnvelope as _n, ResourceDescriptor as _r, RelationFilterQuery as _t, Validator as a, LocalIdentifier as an, OperationExamples as ar, ListPageParams as at, ClientOptions as b, ResourceLinks as bn, StrategyDescriptor as br, RelationPaginator as bt, resolveValidator as c, mediaType as cn, PaginatorRole as cr, PivotInput as ct, ExecutedResponse as d, Edge as dn, RawMediaKind as dr, RelatedIncludedResource as dt, AtomicUpdateInput as en, FilterFamilyDescriptor as er, IncludePath as et, JsonApiContext as f, EdgeEnvelope as fn, RawOutputMedia as fr, RelatedIncludedType as ft, execute as g, NavigateOptions as gn, RelationMutations as gr, RelationCollection as gt, ReadQuery as h, MaterialiseContext as hn, RelationDescriptor as hr, RelatedQueryParam as ht, ValidationOption as i, JSON_API_MEDIA_TYPE as in, MenuDescriptor as ir, LinkageRef as it, ActionCallOptions as j, PageParams as jn, TypeName as jt, AcceptedJob as k, PageMeta as kn, SortToken as kt, validateDocument as l, ArrayEnvelope as ln, PaginatorStrategy as lr, ReadResult as lt, RawResponseType as m, LinkObject as mn, RelatedQueryOperation as mr, RelatedQueryEntry as mt, SchemaMap as n, ATOMIC_EXT as nn, InputMediaKind as nr, IncludedResource as nt, WireResource as o, MediaTypeParams as on, PaginatorDescriptor as or, LooseRelatedQueryEntry as ot, JsonApiRequest as p, Link as pn, RelatedQueryDescriptor as pr, RelatedQuery as pt, ErrorCodeOf as q, ActionScope as qn, AtomicDeleteHandle as qt, ValidationConfig as r, ATOMIC_MEDIA_TYPE as rn, MediaExamples as rr, IncludedType as rt, assertJsonApiDocument as s, ResourceIdentifier as sn, PaginatorKind as sr, MemberName as st, ResolvedValidator as t, runAtomic as tn, InputMedia as tr, IncludedRelations as tt, Document as u, DocumentEnvelope as un, PivotDescriptor as ur, ReadableRelationName as ut, executeResponse as v, RelationView as vn, ResourceExamples as vr, RelationName as vt, JsonApiTransport as w, CANONICAL_PAGE_KEYS as wn, ResourceAccessors as wt, HANDLE_RESERVED as x, materialise as xn, isPolymorphic as xr, RelationReadQuery as xt, serializeQuery as y, ResourceEnvelope as yn, SortFamilyDescriptor as yr, RelationPageParams as yt, CountToken as z, isAccepted as zn, WithLinks as zt };
|
|
2429
|
+
//# sourceMappingURL=validate-Cknhw9k7.d.cts.map
|