@haddowg/json-api-client 1.25.0 → 1.26.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 +6 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{validate-BPV_qwZb.d.cts → validate-C9ekU8fM.d.cts} +139 -22
- package/dist/validate-C9ekU8fM.d.cts.map +1 -0
- package/dist/{validate-BPV_qwZb.d.mts → validate-C9ekU8fM.d.mts} +139 -22
- package/dist/validate-C9ekU8fM.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/validate-BPV_qwZb.d.cts.map +0 -1
- package/dist/validate-BPV_qwZb.d.mts.map +0 -1
package/dist/ajv.d.cts
CHANGED
package/dist/ajv.d.mts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1499,7 +1499,7 @@ async function runWrite(ctx, spec) {
|
|
|
1499
1499
|
if (error instanceof JsonApiError) throw spec.remap(error);
|
|
1500
1500
|
throw error;
|
|
1501
1501
|
}
|
|
1502
|
-
const complete = (doc) => doc === void 0 ? void 0 : materialise(doc, ctx.materialise, spec.linkage ?? false);
|
|
1502
|
+
const complete = (doc) => doc === void 0 ? void 0 : spec.metaOnly === true && !("data" in doc) ? doc.meta : materialise(doc, ctx.materialise, spec.linkage ?? false);
|
|
1503
1503
|
if (res.status === 202 && spec.accepted !== void 0) return answerAccepted(ctx, spec.accepted, res, complete, spec.wait);
|
|
1504
1504
|
return complete(res.document);
|
|
1505
1505
|
}
|
|
@@ -1520,7 +1520,8 @@ async function runWrite(ctx, spec) {
|
|
|
1520
1520
|
*
|
|
1521
1521
|
* The response is shaped by the action's `output`: `document` materialises into the resource /
|
|
1522
1522
|
* collection view, `meta` returns the document's top-level `meta`, `none` resolves `undefined` (a
|
|
1523
|
-
* `204` / no body).
|
|
1523
|
+
* `204` / no body). A `metaResult` action returns the top-level `meta` of a document with no
|
|
1524
|
+
* `data`. An action declaring a `location` returns the URL of a location document as an
|
|
1524
1525
|
* `ActionLocation` and never follows it. An action declaring `rawOutput` answers in the media type
|
|
1525
1526
|
* the caller picks with `options.accept`: JSON:API as above, or a `string`, a `Blob` or
|
|
1526
1527
|
* `ArrayBuffer`, or parsed JSON by the media type's kind. A collection action that takes filters
|
|
@@ -1595,7 +1596,7 @@ function actionValue(ctx, action, doc) {
|
|
|
1595
1596
|
if (action.output === "location") throw new Error("The action answered without the location document it declares.");
|
|
1596
1597
|
}
|
|
1597
1598
|
if (action.output === "none" || action.output === "location" || doc === void 0) return;
|
|
1598
|
-
if (action.output === "meta") return doc.meta;
|
|
1599
|
+
if (action.output === "meta" || action.metaResult === true && !("data" in doc)) return doc.meta;
|
|
1599
1600
|
return materialise(doc, ctx.materialise);
|
|
1600
1601
|
}
|
|
1601
1602
|
/**
|
|
@@ -1802,7 +1803,8 @@ function resourceHandle(ctx, type, id) {
|
|
|
1802
1803
|
vars,
|
|
1803
1804
|
method: "DELETE",
|
|
1804
1805
|
body: void 0,
|
|
1805
|
-
remap: (error) => withRemappedPaths(error, ctx.descriptor, type)
|
|
1806
|
+
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1807
|
+
metaOnly: ctx.descriptor[type]?.documentMeta?.delete !== void 0
|
|
1806
1808
|
}),
|
|
1807
1809
|
rel: (name) => relationshipAccessor(ctx, type, vars, name),
|
|
1808
1810
|
actions: actionsAccessor(ctx, type, "resource", vars)
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as FilterKey, $n as PollTimeoutError, $t as WithDocumentMeta, A as AcceptedOf, An as MaterialiseContext, Ar as RelatedQueryDescriptor, At as RelationPaginator, B as CountToken, Bn as ExactPageParams, Bt as SingletonUpdateInput, C as createClient, Cn as mediaType, Cr as PaginatorDescriptor, Ct as RelatedQueryParam, D as TransportResponse, Dn as EdgeEnvelope, Dr as PivotDescriptor, Dt as RelationFilterQuery, E as TransportRequest, En as Edge, Er as PaginatorStrategy, Et as RelationCollection, F as BinaryResponseType, Fn as ResourceLinks, Fr as ResourceDescriptor, Ft as ResourceCountToken, G as DefaultAttributes, Gn as PageOf, Gt as TypedReadQuery, H as CreateInput, Hn as PageKeys, Ht as SortToken, I as Client, In as materialise, Ir as ResourceExamples, It as ResourceHandle, J as DocumentMeta, Jn as ResolvedPaginator, Jt as UpdateInput, K as DefaultWriteAttributes, Kn as PageParams, Kt as TypedRelatedReadQuery, L as Collection, Ln as relatedPaginator, Lr as SortFamilyDescriptor, Lt as ResourceObjectView, M as ActionsAccessor, Mn as RelationArrayEnvelope, Mr as RelationDescriptor, Mt as RelationSortQuery, N as AtomicResultOf, Nn as RelationView, Nr as RelationMutations, Nt as RelationshipAccessor, O as fetchTransport, On as Link, Or as RawMediaKind, Ot as RelationName, P as BinaryBody, Pn as ResourceEnvelope, Pr as ResourceCountOperation, Pt as ResourceAccessors, Q as FieldsMap, Qn as PollOptions, Qt as WaitedWriteResult, R as CollectionMeta, Rn as relatedPaginatorKind, Rr as StrategyDescriptor, Rt as SingleReadQuery, S as HeadersInit, Sn as ResourceIdentifier, Sr as OperationExamples, St as RelatedQueryEntry, T as TransportRawBody, Tn as DocumentEnvelope, Tr as PaginatorRole, Tt as RelatedReadRelatedQuery, U as CreateMethod, Un as PageLinks, Ut as TypeAccessor, V as CountedRelationName, Vn as Page, Vt as SortQuery, W as DefaultActionTypes, Wn as PageMeta, Wt as TypeName, X as ErrorCodeOf, Xn as resolvePaginator, Xt as WaitOptions, Y as EdgeMembers, Yn as TypedPage, Yt as UpdateMethod, Z as FieldSelectionMap, Zn as Accepted, Zt as WaitValue, _ as executeRaw, _n as ATOMIC_EXT, _r as FilterFamilyDescriptor, _t as ReadableRelationName, a as Validator, an as readActionLocation, ar as ActionInput, at as IncludedResource, b as ClientOptions, bn as LocalIdentifier, br as MediaExamples, bt as RelatedMeta, c as resolveValidator, cn as AtomicDeleteHandle, cr as ActionScope, ct as LinkageRef, d as ExecutedResponse, dn as AtomicRef, dr as AtomicDescriptor, dt as LooseRelatedQuery, en as WithLinks, er as isAccepted, et as FilterQuery, f as JsonApiContext, fn as AtomicResult, fr as Cardinality, ft as LooseRelatedQueryEntry, g as execute, gn as runAtomic, gr as DocumentMetaOperation, gt as ReadResult, h as ReadQuery, hn as AtomicUpdateInput, hr as DocumentMetaDescriptor, ht as PivotInput, i as ValidationOption, in as isActionLocation, ir as ActionDescriptor, it as IncludedRelations, j as ActionCallOptions, jn as NavigateOptions, jr as RelatedQueryOperation, jt as RelationReadQuery, k as AcceptedJob, kn as LinkObject, kr as RawOutputMedia, kt as RelationPageParams, l as validateDocument, ln as AtomicHandle, lr as ApiDescriptor, lt as ListFilterMember, m as RawResponseType, mn as AtomicUpdateHandle, mr as CountableDescriptor, mt as OperationMeta, n as SchemaMap, nn as WriteResult, nr as AcceptedDescriptor, nt as IdentifierMember, o as WireResource, on as AtomicCreateHandle, or as ActionLocationDescriptor, ot as IncludedType, p as JsonApiRequest, pn as AtomicResults, pr as ClientIdPolicy, pt as MemberName, q as DeleteResult, qn as PageParamsOf, qt as TypedRelationReadQuery, r as ValidationConfig, rn as ActionLocation, rr as AcceptedOperation, rt as IncludePath, s as assertJsonApiDocument, sn as AtomicCreateInput, sr as ActionOutput, st as IsSingleton, t as ResolvedValidator, tn as WriteOptions, tr as parseRetryAfter, tt as HydratedMember, u as Document, un as AtomicRecorder, ur as ApiExamples, ut as ListPageParams, v as executeResponse, vn as ATOMIC_MEDIA_TYPE, vr as InputMedia, vt as RelatedIncludedResource, w as JsonApiTransport, wn as ArrayEnvelope, wr as PaginatorKind, wt as RelatedQueryRelation, x as HANDLE_RESERVED, xn as MediaTypeParams, xr as MenuDescriptor, xt as RelatedQuery, y as serializeQuery, yn as JSON_API_MEDIA_TYPE, yr as InputMediaKind, yt as RelatedIncludedType, z as CountAccessor, zn as CANONICAL_PAGE_KEYS, zr as isPolymorphic, zt as SingletonAccessor } from "./validate-C9ekU8fM.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
4
|
/**
|
|
@@ -273,5 +273,5 @@ declare function withRemappedRelationshipPaths(error: JsonApiError, rel: string,
|
|
|
273
273
|
*/
|
|
274
274
|
declare function withRemappedAtomicPaths(error: JsonApiError, descriptor: ApiDescriptor, typeForOp: (opIndex: number) => string | undefined): JsonApiError;
|
|
275
275
|
//#endregion
|
|
276
|
-
export { ATOMIC_EXT, ATOMIC_MEDIA_TYPE, type Accepted, AcceptedDescriptor, AcceptedJob, AcceptedOf, AcceptedOperation, ActionCallOptions, ActionDescriptor, ActionInput, ActionLocation, ActionLocationDescriptor, ActionOutput, ActionScope, ActionsAccessor, ApiDescriptor, ApiExamples, ArrayEnvelope, AtomicCreateHandle, AtomicCreateInput, AtomicDeleteHandle, AtomicDescriptor, AtomicHandle, AtomicRecorder, AtomicRef, AtomicResult, AtomicResultOf, AtomicResults, AtomicUpdateHandle, AtomicUpdateInput, BinaryBody, BinaryResponseType, CANONICAL_PAGE_KEYS, Cardinality, Client, ClientIdPolicy, ClientOptions, CodedErrorObject, Collection, CountAccessor, CountToken, CountableDescriptor, CountedRelationName, CreateInput, CreateMethod, DefaultActionTypes, DefaultAttributes, DefaultWriteAttributes, Document, DocumentEnvelope, Edge, EdgeEnvelope, EdgeMembers, ErrorCodeGuard, ErrorCodeOf, ErrorFinder, ExactPageParams, ExecutedResponse, FieldSelectionMap, FieldsMap, FilterFamilyDescriptor, FilterKey, FilterQuery, FilterSpec, HANDLE_RESERVED, HeadersInit, HydratedMember, IdentifierMember, IncludePath, IncludedRelations, IncludedResource, IncludedType, InputMedia, InputMediaKind, IsSingleton, JSON_API_MEDIA_TYPE, JsonApiContext, JsonApiError, JsonApiErrorObject, JsonApiRequest, JsonApiTransport, Link, LinkObject, LinkageRef, ListFilterMember, ListPageParams, LoadAllOptions, LocalIdentifier, LooseRelatedQuery, LooseRelatedQueryEntry, MaterialiseContext, MediaExamples, MediaTypeParams, MemberName, MenuDescriptor, NavigateOptions, OperationExamples, Page, PageKeys, PageLinks, PageMeta, PageOf, PageParams, PageParamsOf, PaginatorDescriptor, PaginatorKind, PaginatorRole, PaginatorStrategy, PivotDescriptor, PivotInput, type PollOptions, PollTimeoutError, RawMediaKind, RawOutputMedia, RawResponseType, ReadQuery, ReadResult, ReadableRelationName, RelatedIncludedResource, RelatedIncludedType, RelatedQuery, RelatedQueryDescriptor, RelatedQueryEntry, RelatedQueryOperation, RelatedQueryParam, RelatedQueryRelation, RelatedReadRelatedQuery, RelationArrayEnvelope, RelationCollection, RelationDescriptor, RelationFilterQuery, RelationMutations, RelationName, RelationPageParams, RelationPaginator, RelationReadQuery, RelationSortQuery, RelationView, RelationshipAccessor, RelationshipDocument, ResolvedPaginator, ResolvedValidator, ResourceAccessors, ResourceCountOperation, ResourceCountToken, ResourceDescriptor, ResourceEnvelope, ResourceExamples, ResourceHandle, ResourceIdentifier, ResourceLinks, ResourceObjectView, SchemaMap, SingleReadQuery, SingletonAccessor, SingletonUpdateInput, SortFamilyDescriptor, SortQuery, SortToken, StrategyDescriptor, StructuralGuardError, ToDocumentOptions, TransportRawBody, TransportRequest, TransportResponse, TypeAccessor, TypeName, TypedPage, TypedReadQuery, TypedRelatedReadQuery, TypedRelationReadQuery, UpdateInput, UpdateMethod, ValidationConfig, ValidationOption, Validator, WaitOptions, WaitValue, WaitedWriteResult, WireResource, WithLinks, WriteDocument, WriteOptions, WriteResult, assertJsonApiDocument, createClient, execute, executeRaw, executeResponse, fetchTransport, findError, hasErrorCode, isAccepted, isActionLocation, isPolymorphic, listFilterMatcher, loadAll, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
276
|
+
export { ATOMIC_EXT, ATOMIC_MEDIA_TYPE, type Accepted, AcceptedDescriptor, AcceptedJob, AcceptedOf, AcceptedOperation, ActionCallOptions, ActionDescriptor, ActionInput, ActionLocation, ActionLocationDescriptor, ActionOutput, ActionScope, ActionsAccessor, ApiDescriptor, ApiExamples, ArrayEnvelope, AtomicCreateHandle, AtomicCreateInput, AtomicDeleteHandle, AtomicDescriptor, AtomicHandle, AtomicRecorder, AtomicRef, AtomicResult, AtomicResultOf, AtomicResults, AtomicUpdateHandle, AtomicUpdateInput, BinaryBody, BinaryResponseType, CANONICAL_PAGE_KEYS, Cardinality, Client, ClientIdPolicy, ClientOptions, CodedErrorObject, Collection, CollectionMeta, CountAccessor, CountToken, CountableDescriptor, CountedRelationName, CreateInput, CreateMethod, DefaultActionTypes, DefaultAttributes, DefaultWriteAttributes, DeleteResult, Document, DocumentEnvelope, DocumentMeta, DocumentMetaDescriptor, DocumentMetaOperation, Edge, EdgeEnvelope, EdgeMembers, ErrorCodeGuard, ErrorCodeOf, ErrorFinder, ExactPageParams, ExecutedResponse, FieldSelectionMap, FieldsMap, FilterFamilyDescriptor, FilterKey, FilterQuery, FilterSpec, HANDLE_RESERVED, HeadersInit, HydratedMember, IdentifierMember, IncludePath, IncludedRelations, IncludedResource, IncludedType, InputMedia, InputMediaKind, IsSingleton, JSON_API_MEDIA_TYPE, JsonApiContext, JsonApiError, JsonApiErrorObject, JsonApiRequest, JsonApiTransport, Link, LinkObject, LinkageRef, ListFilterMember, ListPageParams, LoadAllOptions, LocalIdentifier, LooseRelatedQuery, LooseRelatedQueryEntry, MaterialiseContext, MediaExamples, MediaTypeParams, MemberName, MenuDescriptor, NavigateOptions, OperationExamples, OperationMeta, Page, PageKeys, PageLinks, PageMeta, PageOf, PageParams, PageParamsOf, PaginatorDescriptor, PaginatorKind, PaginatorRole, PaginatorStrategy, PivotDescriptor, PivotInput, type PollOptions, PollTimeoutError, RawMediaKind, RawOutputMedia, RawResponseType, ReadQuery, ReadResult, ReadableRelationName, RelatedIncludedResource, RelatedIncludedType, RelatedMeta, RelatedQuery, RelatedQueryDescriptor, RelatedQueryEntry, RelatedQueryOperation, RelatedQueryParam, RelatedQueryRelation, RelatedReadRelatedQuery, RelationArrayEnvelope, RelationCollection, RelationDescriptor, RelationFilterQuery, RelationMutations, RelationName, RelationPageParams, RelationPaginator, RelationReadQuery, RelationSortQuery, RelationView, RelationshipAccessor, RelationshipDocument, ResolvedPaginator, ResolvedValidator, ResourceAccessors, ResourceCountOperation, ResourceCountToken, ResourceDescriptor, ResourceEnvelope, ResourceExamples, ResourceHandle, ResourceIdentifier, ResourceLinks, ResourceObjectView, SchemaMap, SingleReadQuery, SingletonAccessor, SingletonUpdateInput, SortFamilyDescriptor, SortQuery, SortToken, StrategyDescriptor, StructuralGuardError, ToDocumentOptions, TransportRawBody, TransportRequest, TransportResponse, TypeAccessor, TypeName, TypedPage, TypedReadQuery, TypedRelatedReadQuery, TypedRelationReadQuery, UpdateInput, UpdateMethod, ValidationConfig, ValidationOption, Validator, WaitOptions, WaitValue, WaitedWriteResult, WireResource, WithDocumentMeta, WithLinks, WriteDocument, WriteOptions, WriteResult, assertJsonApiDocument, createClient, execute, executeRaw, executeResponse, fetchTransport, findError, hasErrorCode, isAccepted, isActionLocation, isPolymorphic, listFilterMatcher, loadAll, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
277
277
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as FilterKey, $n as PollTimeoutError, $t as WithDocumentMeta, A as AcceptedOf, An as MaterialiseContext, Ar as RelatedQueryDescriptor, At as RelationPaginator, B as CountToken, Bn as ExactPageParams, Bt as SingletonUpdateInput, C as createClient, Cn as mediaType, Cr as PaginatorDescriptor, Ct as RelatedQueryParam, D as TransportResponse, Dn as EdgeEnvelope, Dr as PivotDescriptor, Dt as RelationFilterQuery, E as TransportRequest, En as Edge, Er as PaginatorStrategy, Et as RelationCollection, F as BinaryResponseType, Fn as ResourceLinks, Fr as ResourceDescriptor, Ft as ResourceCountToken, G as DefaultAttributes, Gn as PageOf, Gt as TypedReadQuery, H as CreateInput, Hn as PageKeys, Ht as SortToken, I as Client, In as materialise, Ir as ResourceExamples, It as ResourceHandle, J as DocumentMeta, Jn as ResolvedPaginator, Jt as UpdateInput, K as DefaultWriteAttributes, Kn as PageParams, Kt as TypedRelatedReadQuery, L as Collection, Ln as relatedPaginator, Lr as SortFamilyDescriptor, Lt as ResourceObjectView, M as ActionsAccessor, Mn as RelationArrayEnvelope, Mr as RelationDescriptor, Mt as RelationSortQuery, N as AtomicResultOf, Nn as RelationView, Nr as RelationMutations, Nt as RelationshipAccessor, O as fetchTransport, On as Link, Or as RawMediaKind, Ot as RelationName, P as BinaryBody, Pn as ResourceEnvelope, Pr as ResourceCountOperation, Pt as ResourceAccessors, Q as FieldsMap, Qn as PollOptions, Qt as WaitedWriteResult, R as CollectionMeta, Rn as relatedPaginatorKind, Rr as StrategyDescriptor, Rt as SingleReadQuery, S as HeadersInit, Sn as ResourceIdentifier, Sr as OperationExamples, St as RelatedQueryEntry, T as TransportRawBody, Tn as DocumentEnvelope, Tr as PaginatorRole, Tt as RelatedReadRelatedQuery, U as CreateMethod, Un as PageLinks, Ut as TypeAccessor, V as CountedRelationName, Vn as Page, Vt as SortQuery, W as DefaultActionTypes, Wn as PageMeta, Wt as TypeName, X as ErrorCodeOf, Xn as resolvePaginator, Xt as WaitOptions, Y as EdgeMembers, Yn as TypedPage, Yt as UpdateMethod, Z as FieldSelectionMap, Zn as Accepted, Zt as WaitValue, _ as executeRaw, _n as ATOMIC_EXT, _r as FilterFamilyDescriptor, _t as ReadableRelationName, a as Validator, an as readActionLocation, ar as ActionInput, at as IncludedResource, b as ClientOptions, bn as LocalIdentifier, br as MediaExamples, bt as RelatedMeta, c as resolveValidator, cn as AtomicDeleteHandle, cr as ActionScope, ct as LinkageRef, d as ExecutedResponse, dn as AtomicRef, dr as AtomicDescriptor, dt as LooseRelatedQuery, en as WithLinks, er as isAccepted, et as FilterQuery, f as JsonApiContext, fn as AtomicResult, fr as Cardinality, ft as LooseRelatedQueryEntry, g as execute, gn as runAtomic, gr as DocumentMetaOperation, gt as ReadResult, h as ReadQuery, hn as AtomicUpdateInput, hr as DocumentMetaDescriptor, ht as PivotInput, i as ValidationOption, in as isActionLocation, ir as ActionDescriptor, it as IncludedRelations, j as ActionCallOptions, jn as NavigateOptions, jr as RelatedQueryOperation, jt as RelationReadQuery, k as AcceptedJob, kn as LinkObject, kr as RawOutputMedia, kt as RelationPageParams, l as validateDocument, ln as AtomicHandle, lr as ApiDescriptor, lt as ListFilterMember, m as RawResponseType, mn as AtomicUpdateHandle, mr as CountableDescriptor, mt as OperationMeta, n as SchemaMap, nn as WriteResult, nr as AcceptedDescriptor, nt as IdentifierMember, o as WireResource, on as AtomicCreateHandle, or as ActionLocationDescriptor, ot as IncludedType, p as JsonApiRequest, pn as AtomicResults, pr as ClientIdPolicy, pt as MemberName, q as DeleteResult, qn as PageParamsOf, qt as TypedRelationReadQuery, r as ValidationConfig, rn as ActionLocation, rr as AcceptedOperation, rt as IncludePath, s as assertJsonApiDocument, sn as AtomicCreateInput, sr as ActionOutput, st as IsSingleton, t as ResolvedValidator, tn as WriteOptions, tr as parseRetryAfter, tt as HydratedMember, u as Document, un as AtomicRecorder, ur as ApiExamples, ut as ListPageParams, v as executeResponse, vn as ATOMIC_MEDIA_TYPE, vr as InputMedia, vt as RelatedIncludedResource, w as JsonApiTransport, wn as ArrayEnvelope, wr as PaginatorKind, wt as RelatedQueryRelation, x as HANDLE_RESERVED, xn as MediaTypeParams, xr as MenuDescriptor, xt as RelatedQuery, y as serializeQuery, yn as JSON_API_MEDIA_TYPE, yr as InputMediaKind, yt as RelatedIncludedType, z as CountAccessor, zn as CANONICAL_PAGE_KEYS, zr as isPolymorphic, zt as SingletonAccessor } from "./validate-C9ekU8fM.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
4
|
/**
|
|
@@ -273,5 +273,5 @@ declare function withRemappedRelationshipPaths(error: JsonApiError, rel: string,
|
|
|
273
273
|
*/
|
|
274
274
|
declare function withRemappedAtomicPaths(error: JsonApiError, descriptor: ApiDescriptor, typeForOp: (opIndex: number) => string | undefined): JsonApiError;
|
|
275
275
|
//#endregion
|
|
276
|
-
export { ATOMIC_EXT, ATOMIC_MEDIA_TYPE, type Accepted, AcceptedDescriptor, AcceptedJob, AcceptedOf, AcceptedOperation, ActionCallOptions, ActionDescriptor, ActionInput, ActionLocation, ActionLocationDescriptor, ActionOutput, ActionScope, ActionsAccessor, ApiDescriptor, ApiExamples, ArrayEnvelope, AtomicCreateHandle, AtomicCreateInput, AtomicDeleteHandle, AtomicDescriptor, AtomicHandle, AtomicRecorder, AtomicRef, AtomicResult, AtomicResultOf, AtomicResults, AtomicUpdateHandle, AtomicUpdateInput, BinaryBody, BinaryResponseType, CANONICAL_PAGE_KEYS, Cardinality, Client, ClientIdPolicy, ClientOptions, CodedErrorObject, Collection, CountAccessor, CountToken, CountableDescriptor, CountedRelationName, CreateInput, CreateMethod, DefaultActionTypes, DefaultAttributes, DefaultWriteAttributes, Document, DocumentEnvelope, Edge, EdgeEnvelope, EdgeMembers, ErrorCodeGuard, ErrorCodeOf, ErrorFinder, ExactPageParams, ExecutedResponse, FieldSelectionMap, FieldsMap, FilterFamilyDescriptor, FilterKey, FilterQuery, FilterSpec, HANDLE_RESERVED, HeadersInit, HydratedMember, IdentifierMember, IncludePath, IncludedRelations, IncludedResource, IncludedType, InputMedia, InputMediaKind, IsSingleton, JSON_API_MEDIA_TYPE, JsonApiContext, JsonApiError, JsonApiErrorObject, JsonApiRequest, JsonApiTransport, Link, LinkObject, LinkageRef, ListFilterMember, ListPageParams, LoadAllOptions, LocalIdentifier, LooseRelatedQuery, LooseRelatedQueryEntry, MaterialiseContext, MediaExamples, MediaTypeParams, MemberName, MenuDescriptor, NavigateOptions, OperationExamples, Page, PageKeys, PageLinks, PageMeta, PageOf, PageParams, PageParamsOf, PaginatorDescriptor, PaginatorKind, PaginatorRole, PaginatorStrategy, PivotDescriptor, PivotInput, type PollOptions, PollTimeoutError, RawMediaKind, RawOutputMedia, RawResponseType, ReadQuery, ReadResult, ReadableRelationName, RelatedIncludedResource, RelatedIncludedType, RelatedQuery, RelatedQueryDescriptor, RelatedQueryEntry, RelatedQueryOperation, RelatedQueryParam, RelatedQueryRelation, RelatedReadRelatedQuery, RelationArrayEnvelope, RelationCollection, RelationDescriptor, RelationFilterQuery, RelationMutations, RelationName, RelationPageParams, RelationPaginator, RelationReadQuery, RelationSortQuery, RelationView, RelationshipAccessor, RelationshipDocument, ResolvedPaginator, ResolvedValidator, ResourceAccessors, ResourceCountOperation, ResourceCountToken, ResourceDescriptor, ResourceEnvelope, ResourceExamples, ResourceHandle, ResourceIdentifier, ResourceLinks, ResourceObjectView, SchemaMap, SingleReadQuery, SingletonAccessor, SingletonUpdateInput, SortFamilyDescriptor, SortQuery, SortToken, StrategyDescriptor, StructuralGuardError, ToDocumentOptions, TransportRawBody, TransportRequest, TransportResponse, TypeAccessor, TypeName, TypedPage, TypedReadQuery, TypedRelatedReadQuery, TypedRelationReadQuery, UpdateInput, UpdateMethod, ValidationConfig, ValidationOption, Validator, WaitOptions, WaitValue, WaitedWriteResult, WireResource, WithLinks, WriteDocument, WriteOptions, WriteResult, assertJsonApiDocument, createClient, execute, executeRaw, executeResponse, fetchTransport, findError, hasErrorCode, isAccepted, isActionLocation, isPolymorphic, listFilterMatcher, loadAll, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
276
|
+
export { ATOMIC_EXT, ATOMIC_MEDIA_TYPE, type Accepted, AcceptedDescriptor, AcceptedJob, AcceptedOf, AcceptedOperation, ActionCallOptions, ActionDescriptor, ActionInput, ActionLocation, ActionLocationDescriptor, ActionOutput, ActionScope, ActionsAccessor, ApiDescriptor, ApiExamples, ArrayEnvelope, AtomicCreateHandle, AtomicCreateInput, AtomicDeleteHandle, AtomicDescriptor, AtomicHandle, AtomicRecorder, AtomicRef, AtomicResult, AtomicResultOf, AtomicResults, AtomicUpdateHandle, AtomicUpdateInput, BinaryBody, BinaryResponseType, CANONICAL_PAGE_KEYS, Cardinality, Client, ClientIdPolicy, ClientOptions, CodedErrorObject, Collection, CollectionMeta, CountAccessor, CountToken, CountableDescriptor, CountedRelationName, CreateInput, CreateMethod, DefaultActionTypes, DefaultAttributes, DefaultWriteAttributes, DeleteResult, Document, DocumentEnvelope, DocumentMeta, DocumentMetaDescriptor, DocumentMetaOperation, Edge, EdgeEnvelope, EdgeMembers, ErrorCodeGuard, ErrorCodeOf, ErrorFinder, ExactPageParams, ExecutedResponse, FieldSelectionMap, FieldsMap, FilterFamilyDescriptor, FilterKey, FilterQuery, FilterSpec, HANDLE_RESERVED, HeadersInit, HydratedMember, IdentifierMember, IncludePath, IncludedRelations, IncludedResource, IncludedType, InputMedia, InputMediaKind, IsSingleton, JSON_API_MEDIA_TYPE, JsonApiContext, JsonApiError, JsonApiErrorObject, JsonApiRequest, JsonApiTransport, Link, LinkObject, LinkageRef, ListFilterMember, ListPageParams, LoadAllOptions, LocalIdentifier, LooseRelatedQuery, LooseRelatedQueryEntry, MaterialiseContext, MediaExamples, MediaTypeParams, MemberName, MenuDescriptor, NavigateOptions, OperationExamples, OperationMeta, Page, PageKeys, PageLinks, PageMeta, PageOf, PageParams, PageParamsOf, PaginatorDescriptor, PaginatorKind, PaginatorRole, PaginatorStrategy, PivotDescriptor, PivotInput, type PollOptions, PollTimeoutError, RawMediaKind, RawOutputMedia, RawResponseType, ReadQuery, ReadResult, ReadableRelationName, RelatedIncludedResource, RelatedIncludedType, RelatedMeta, RelatedQuery, RelatedQueryDescriptor, RelatedQueryEntry, RelatedQueryOperation, RelatedQueryParam, RelatedQueryRelation, RelatedReadRelatedQuery, RelationArrayEnvelope, RelationCollection, RelationDescriptor, RelationFilterQuery, RelationMutations, RelationName, RelationPageParams, RelationPaginator, RelationReadQuery, RelationSortQuery, RelationView, RelationshipAccessor, RelationshipDocument, ResolvedPaginator, ResolvedValidator, ResourceAccessors, ResourceCountOperation, ResourceCountToken, ResourceDescriptor, ResourceEnvelope, ResourceExamples, ResourceHandle, ResourceIdentifier, ResourceLinks, ResourceObjectView, SchemaMap, SingleReadQuery, SingletonAccessor, SingletonUpdateInput, SortFamilyDescriptor, SortQuery, SortToken, StrategyDescriptor, StructuralGuardError, ToDocumentOptions, TransportRawBody, TransportRequest, TransportResponse, TypeAccessor, TypeName, TypedPage, TypedReadQuery, TypedRelatedReadQuery, TypedRelationReadQuery, UpdateInput, UpdateMethod, ValidationConfig, ValidationOption, Validator, WaitOptions, WaitValue, WaitedWriteResult, WireResource, WithDocumentMeta, WithLinks, WriteDocument, WriteOptions, WriteResult, assertJsonApiDocument, createClient, execute, executeRaw, executeResponse, fetchTransport, findError, hasErrorCode, isAccepted, isActionLocation, isPolymorphic, listFilterMatcher, loadAll, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
277
277
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1498,7 +1498,7 @@ async function runWrite(ctx, spec) {
|
|
|
1498
1498
|
if (error instanceof JsonApiError) throw spec.remap(error);
|
|
1499
1499
|
throw error;
|
|
1500
1500
|
}
|
|
1501
|
-
const complete = (doc) => doc === void 0 ? void 0 : materialise(doc, ctx.materialise, spec.linkage ?? false);
|
|
1501
|
+
const complete = (doc) => doc === void 0 ? void 0 : spec.metaOnly === true && !("data" in doc) ? doc.meta : materialise(doc, ctx.materialise, spec.linkage ?? false);
|
|
1502
1502
|
if (res.status === 202 && spec.accepted !== void 0) return answerAccepted(ctx, spec.accepted, res, complete, spec.wait);
|
|
1503
1503
|
return complete(res.document);
|
|
1504
1504
|
}
|
|
@@ -1519,7 +1519,8 @@ async function runWrite(ctx, spec) {
|
|
|
1519
1519
|
*
|
|
1520
1520
|
* The response is shaped by the action's `output`: `document` materialises into the resource /
|
|
1521
1521
|
* collection view, `meta` returns the document's top-level `meta`, `none` resolves `undefined` (a
|
|
1522
|
-
* `204` / no body).
|
|
1522
|
+
* `204` / no body). A `metaResult` action returns the top-level `meta` of a document with no
|
|
1523
|
+
* `data`. An action declaring a `location` returns the URL of a location document as an
|
|
1523
1524
|
* `ActionLocation` and never follows it. An action declaring `rawOutput` answers in the media type
|
|
1524
1525
|
* the caller picks with `options.accept`: JSON:API as above, or a `string`, a `Blob` or
|
|
1525
1526
|
* `ArrayBuffer`, or parsed JSON by the media type's kind. A collection action that takes filters
|
|
@@ -1594,7 +1595,7 @@ function actionValue(ctx, action, doc) {
|
|
|
1594
1595
|
if (action.output === "location") throw new Error("The action answered without the location document it declares.");
|
|
1595
1596
|
}
|
|
1596
1597
|
if (action.output === "none" || action.output === "location" || doc === void 0) return;
|
|
1597
|
-
if (action.output === "meta") return doc.meta;
|
|
1598
|
+
if (action.output === "meta" || action.metaResult === true && !("data" in doc)) return doc.meta;
|
|
1598
1599
|
return materialise(doc, ctx.materialise);
|
|
1599
1600
|
}
|
|
1600
1601
|
/**
|
|
@@ -1801,7 +1802,8 @@ function resourceHandle(ctx, type, id) {
|
|
|
1801
1802
|
vars,
|
|
1802
1803
|
method: "DELETE",
|
|
1803
1804
|
body: void 0,
|
|
1804
|
-
remap: (error) => withRemappedPaths(error, ctx.descriptor, type)
|
|
1805
|
+
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1806
|
+
metaOnly: ctx.descriptor[type]?.documentMeta?.delete !== void 0
|
|
1805
1807
|
}),
|
|
1806
1808
|
rel: (name) => relationshipAccessor(ctx, type, vars, name),
|
|
1807
1809
|
actions: actionsAccessor(ctx, type, "resource", vars)
|